Pierre Ossman
d0203a5995
Always return copy of data from socket
...
We don't know how long the caller will hang on to this data, so we need
to be safe by default and assume it will kept indefinitely. That means
we can't return a reference to the internal buffer, as that will get
overwritten with future messages.
We want to avoid unnecessary copying in performance critical code,
though. So allow code to explicitly ask for a shared buffer, assuming
they know the data needs to be consumed immediately.
2023-06-04 19:12:02 +02:00
Pierre Ossman
e01dd27be4
Remove Websock implicit read length
...
Callers should be properly aware of how much data they need, as they
need to call rQwait() first to ensure the data is present.
2023-06-04 19:00:33 +02:00
Pierre Ossman
55ffe8fc51
Stop exposing Websock queue length
...
Callers should be using rQwait() to ensure sufficient data is present,
and not poke around in the internal buffering.
2023-06-04 19:00:33 +02:00
Pierre Ossman
0180bc81c1
Stop direct access to socket buffer
...
Use proper accessor functions instead of poking around in internal
buffers.
2023-06-04 19:00:33 +02:00
Pierre Ossman
fb3c8f64e9
Switch Display.flush() to use a promise
...
That is the modern way to handle operations that cannot complete
immediately.
2023-06-04 19:00:33 +02:00
Pierre Ossman
ae9b042df1
Change rQslice() to rQpeekBytes()
...
We don't need any full slice functionality, so let's change this to
better march rQpeek8() and rQshiftBytes().
2023-06-04 19:00:33 +02:00
Pierre Ossman
eb0ad829d2
Check that decoders consume all data
...
This is extra important in the tests where we expect no changes to the
display, as otherwise we can't tell the difference between success and a
decoder that is simply waiting for more data.
2023-06-03 15:36:29 +02:00
Pierre Ossman
d33f5ce77f
Make extended clipboard tests independent
...
Let's test the full final result instead of assuming specific internal
calls.
2023-05-30 20:48:26 +02:00
Pierre Ossman
8ae789daf0
Add missing tests for message encodings
...
All of these functions should have units tests, even if they are fairly
minimal.
2023-05-30 20:48:26 +02:00
Pierre Ossman
9e02f4d01d
Return a copy of the data from FakeWebSocket
...
The caller might hang on to the data for multiple calls, so we make sure
the returned buffer might not get overwritten.
2023-05-30 20:48:26 +02:00
Pierre Ossman
9c7576a587
Remove bad Websock mock in tests
...
This small object will not properly fake a Websock in more complex
cases, so let's avoid it and create a real Websock instead.
2023-05-30 20:48:26 +02:00
Pierre Ossman
e07ca6a8e2
Fix Websock send tests
...
Avoid poking around in the internals and instead test what is actually
sent out on the WebSocket.
2023-05-30 20:48:24 +02:00
Pierre Ossman
336ec86997
Remove internal monitoring from Plain tests
...
Tests should avoid poking in to the internals and should only look at
external behaviour.
2023-05-30 20:11:51 +02:00
Pierre Ossman
0c80c68e92
Avoid hooking in to RFB._fail for tests
...
This is an internal function so we should not be examining it in the
tests. Instead use the well defined public APIs to check for correct
behaviour.
2023-05-30 20:11:51 +02:00
Pierre Ossman
13fa6b5908
Fix last rect test
...
Avoid poking in to internals and instead test that the RFB object
responds correctly to new messages.
2023-05-30 20:11:51 +02:00
Pierre Ossman
549ccc7121
Split RSA-AES test data
...
Make the tests more clear what data is expected in the different stages
of the handshake.
2023-05-30 20:11:51 +02:00
Pierre Ossman
42bc251eb4
Make RSA-AES tests more asynchronous
...
The code tested here makes heavy use of promises, so it is easier to
test things also using promise centric code.
2023-05-30 20:11:51 +02:00
Pierre Ossman
afbb1da4d5
Remove custom RSA-AES event
...
We shouldn't add extra, undocumented, API just for the tests. They need
to figure out less invasive way to probe things.
2023-05-30 20:11:51 +02:00
Pierre Ossman
458405e05d
Merge RSA-AES tests in to RFB tests
...
These test the RFB class, so they should be with all other tests for
that class.
2023-05-30 20:11:51 +02:00
Pierre Ossman
0ee0e96f34
Fix ARD authentication test to send real data
...
Stop bypassing the data handling steps in the test as that means those
parts don't get tested.
2023-05-30 20:11:51 +02:00
Pierre Ossman
71bb6f02cd
Fix Plain authentication test checks
...
We should have constants local for the test function when doing
comparisons or we might have false positives because we compare with
buggy values in the code under test.
2023-05-30 20:11:51 +02:00
Pierre Ossman
79f099108f
Split Plain authentication tests to own section
...
VeNCrypt is a multiplexer for many authentication methods, not just
Plain. So let's split it to its own section, just like other types.
2023-05-30 20:11:51 +02:00
Pierre Ossman
0679c8a801
Test credentials using normal API
...
Avoid poking around in the internals and instead test things using the
official methods and events. This should give us more realistic and
robust tests.
2023-05-30 20:11:51 +02:00
Pierre Ossman
29a50620ff
Avoid touching internals in Tight auth tests
...
We should test using only external manipulation so we don't assume a
specific implementation.
2023-05-30 20:11:51 +02:00
Pierre Ossman
c7c293279b
Remove commented out Tight test case
...
This is not something we intend to implement, so remove this never used
test case.
2023-05-30 20:11:51 +02:00
Pierre Ossman
cd231e53ed
Don't overwrite methods with spies
...
Spies should just attach without modifying the real method, or we might
get unwanted side effects.
2023-05-30 20:11:51 +02:00
Pierre Ossman
3ef57d1600
Fix security to authentication state test
...
The "None" authentication will directly progress past authentication, so
it's not a good type for this test.
2023-05-30 20:11:51 +02:00
Pierre Ossman
da75689f4c
Fix data for empty RRE rect test
...
The given data was not a correct RRE rect.
2023-05-30 20:11:51 +02:00
Pierre Ossman
9b115a4485
Send ArrayBuffer, not Uint8Array in tests
...
This matches the true contents of a WebSocket 'message' event, so should
be a more realistic test.
2023-05-30 20:11:51 +02:00
Pierre Ossman
0dd9678e64
Harmonise extended clipboard tests
...
Let them all follow the same pattern to make things more clear.
2023-05-30 20:11:51 +02:00
Pierre Ossman
91307951d3
Fix cached JPEG test
...
This test didn't really check anything useful as the end result would be
the same if the second JPEG failed to render.
Fix this by clearing the canvas between the images, so we can tell if
the second image actually rendered or not.
2023-05-30 20:11:51 +02:00
Pierre Ossman
a565ae559f
Merge branches 'l10n' and 'fragment' of github.com:CendioOssman/noVNC
2023-05-10 13:23:34 +02:00
Pierre Ossman
0374b4c0fc
Handle translation loading in translation class
...
Let's try to keep as much as possible of the translation handling in a
single place for clarity.
2023-05-10 13:11:51 +02:00
Pierre Ossman
cd1a63b737
Restore history state after tests
...
We don't want to mess up anything permanent in each test or the tests
might start affecting each other.
2023-05-10 12:25:46 +02:00
Pierre Ossman
681632bc9f
Avoid running tests on l10n singleton
...
We want tests to be independent, so we cannot have them modify a shared
state, such as the l10n singleton. Make sure each test instantiates its
own object instead.
2023-04-06 11:11:47 +02:00
Pierre Ossman
a4453c9a26
Special case English translation fallback
...
We should not be listing this in LINGUAS as that gives the impression
that English has en explicit translation. Instead, it is a special case
that the code needs to be explicitly aware of.
This reverts 9a06058
in favour of a more robust fix.
2023-04-05 12:46:17 +02:00
Pierre Ossman
747603c0d5
Also re-enable playback on failures
...
Allows easier testing by being able to run the test multiple times.
2023-04-04 17:02:57 +02:00
Pierre Ossman
c1d2449fb8
Fix playback error message for load failure
...
We expect the promise to be rejected with a string for display to the
user.
2023-04-04 17:02:21 +02:00
pdlan
f974b73137
Cleanup for the cryptographic algorithms that are not supported by SubtleCrypto
2023-01-20 05:54:00 -05:00
Pierre Ossman
12a7c6f0de
Check for Android using userAgent
...
Modern Android systems seem to report "Linux" for navigator.platform, so
we can no longer rely on that.
2022-12-27 12:50:57 +01:00
Pierre Ossman
a187821e4f
Add OS checks for Android and ChromeOS
2022-12-27 12:50:57 +01:00
Pierre Ossman
8fb30fb9dc
Add unit tests for OS detection
2022-12-27 12:50:57 +01:00
Pierre Ossman
ee5e3c5fa3
Refine browser detection
...
Try to follow the principle outlined by Mozilla when detecting browsers
and engines.
2022-12-27 12:50:57 +01:00
Pierre Ossman
88a36370a9
Add unit tests for browser detection
2022-12-27 12:50:57 +01:00
Pierre Ossman
28c9670427
Remove test code for old Chrome
...
We don't care about ancient versions of Chrome anyway, so let's keep
things simple.
2022-12-27 12:50:57 +01:00
Dinglan Peng
b776e1495e
Add MSLogonII security type
2022-12-21 15:52:31 -05:00
Pierre Ossman
6eb17b27a0
Correctly mask non-BMP clipboard characters
...
JavaScript strings use UTF-16 encoding under the hood, but we only want
a single '?' per character we replace. So we need to be more careful
which methods we use when iterating over the clipboard string.
2022-10-27 16:24:27 +02:00
Pierre Ossman
6b555f1f74
Mask unsupported clipboard characters
...
Add a more explicit '?' for characters that the clipboard cannot handle,
instead of getting random junk.
2022-10-27 16:03:22 +02:00
Pierre Ossman
0410cbc190
Remove redundant inspect() override
...
We do this for all RFB tests now, not just these specific assertions.
2022-10-27 16:03:01 +02:00
Pierre Ossman
337fb06535
Restore Websock.allocateBuffers() after tests
...
This was accidentally removed in 0a6aec3578
.
2022-10-27 16:02:02 +02:00