Commit Graph

206 Commits

Author SHA1 Message Date
Pierre Ossman
0b5e968e14 Better resize rate limiting
Be more aggressive with resizing, limiting it to once ever 100 ms
instead of after a 500 ms idle period. This gives a more responsive user
experience.
2025-02-05 16:59:22 +01:00
Pierre Ossman
c82178348a Include SetDesktopSize responses in tests
There might be subtle changes in behaviour, so we should mimic what a
real server does.
2025-02-05 16:53:12 +01:00
Pierre Ossman
70446bf742 Make resizeSession setting test more realistic
We shouldn't expect a resize request to be sent if the container didn't
change size first.
2025-02-05 16:53:12 +01:00
Pierre Ossman
bbbef2d9fa Add helper for ExtendedDesktopSize in tests 2025-02-05 16:53:12 +01:00
Adam Halim
e081d1415a Add support for forward and back mouse buttons
This commit implements the extendedMouseButtons pseudo-encoding, which
makes it possible to use the forward and back mouse buttons.
2025-01-15 09:11:48 +01:00
Adam Halim
e8602f23ab Move sendFbuMsg() to broader scope
This is needed if we want to use this function elsewhere in our tests.
2025-01-14 16:27:14 +01:00
Adam Halim
6383fa6384 Flush mouseMove when initiating viewport dragging
We want to flush pending mouse moves before we initiate viewport
dragging.

Before this commit, there were scenarios where the _mouseButtonMask
would track a released button as being down.
2025-01-14 12:32:51 +01:00
Adam Halim
d1548c12ec Don't send mouse events when dragging viewport
We don't want to send any mouse events to the server when dragging the
viewport. Instead, we treat them as a client-only operation.
2025-01-14 12:14:59 +01:00
Adam Halim
b9230cf23e Use MouseEvent.buttons for button state tracking
Instead of keeping track of button states ourselves by looking at
MouseEvent.button, we can use the MouseEvent.buttons which already
contains the state of all buttons.
2025-01-14 12:14:59 +01:00
Adam Halim
f9eb476f6d Add tests for dragging with gestures
There were no test for viewport dragging using gesture previously, so
let's add some.

Note that there currently are some viewport dragging behaviours that we
don't want to have, so some tests have commented out what our desired
behaviour should be.
2025-01-14 12:14:59 +01:00
Adam Halim
ea057d0793 Move gesture event help functions to broader scope
This is needed if we want to test gestures with dragging.
2025-01-14 12:14:59 +01:00
Adam Halim
31d6a77af6 Check for correct button events in dragging tests
Previously, these unit tests did not check which events were sent to the
server, only how many events were sent. This commit adds checks to see
that the expected button events are sent.
2025-01-14 12:14:59 +01:00
Adam Halim
dce8ab395b Dispatch mouse events in dragging unit tests
This makes our tests reflect the real world better, as we now send real
mouse events instead of calling private methods directly.
2025-01-14 12:14:59 +01:00
Adam Halim
db22ec6ee6 Split button click with dragging test 2025-01-14 10:38:39 +01:00
Adam Halim
de9d6888db Add unit test for wheel + buttons pressed 2025-01-14 10:38:39 +01:00
Adam Halim
7a4d1a8274 Move mouse event help functions to broader scope
These functions can be used elsewhere in the tests. We want to use these
in the dragging tests in the future instead of directly calling private
methods.
2025-01-14 10:38:39 +01:00
Samuel Mannehed
e6e03a226f Fix resizes back to initial remote session size
Since the expected client size wasn't updated when the browser window
resized, noVNC didn't resize the canvas properly when going back to
the exact same dimensions.

Fixes issue #1903
2024-12-27 14:48:11 +01:00
Pierre Ossman
7f5b51acf3 Consistently use "sentence case" style
Try to be more consistent in how we capitalize things. Both the "Title
Case" and "Sentence case" styles are popular, so either would work.
Google and Mozilla both prefer "Sentence case", so let's follow them.
2024-11-27 14:40:40 +01:00
Pierre Ossman
1b2fe3321b Manually load sinon and chai
karma-sinon-chai is not compatible with Chai 5+, and Karma is no longer
being updated.

Load sinon and chai manually instead, until we can have a long term plan
in place.
2024-08-05 15:49:39 +02:00
Kostiantyn Syrykh
9a1b1f0d06 Clipboard: handle multiple CR+LF 2024-03-25 17:35:28 +02:00
Pierre Ossman
85a465288b Merge branch 'qemu_ledstate_pseudo_encoding' of https://github.com/otthou/noVNC 2023-09-29 14:18:02 +02:00
Otto van Houten
a0b7c0dac5 Add QEMU Led Pseudo encoding support
Previously, num-lock and caps-lock syncing was performed on a best effort basis by qemu.
Now, the syncing is performed by no-vnc instead. This allows the led state syncing to work
in cases where it previously couldn't, since no-vnc has with this extension knowledge of both
the remote and local capslock and numlock status, which QEMU doesn't have.
2023-09-29 13:58:55 +02:00
Pierre Ossman
bf12c24f4c Fix bad indentation 2023-09-07 15:35:20 +02:00
Pierre Ossman
370f21b117 Correctly handle legacy security rejections
The code comment of this code was entirely incorrect, but the commit
message for 5671072 when it was added was correct. I.e. there is a
result, but not a reason.

Adjust the unit tests to make sure this doesn't regress again.
2023-09-07 14:59:36 +02:00
Pierre Ossman
72f6810797 Correctly handle "none" auth on old servers
There is no security result for the "none" authentication until RFB 3.8.
This got broken by mistake in 5671072.
2023-09-07 14:38:04 +02:00
Pierre Ossman
e81602d705 Fix zlib level change in clipboard tests
The compression level got changed in 01bb36d4, but the tests weren't
updated to follow this change.
2023-08-29 17:38:44 +02:00
Pierre Ossman
2a7db6f647 Make ExtendedDesktopSize tests more realistic
Send real messages and avoid poking around in internals, as we weren't
testing things correctly that way.
2023-06-04 19:12:02 +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
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
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
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
pdlan
f974b73137 Cleanup for the cryptographic algorithms that are not supported by SubtleCrypto 2023-01-20 05:54:00 -05: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