Add browser test for forwarded key whitelist changes

This CL adds a browser test for the changes in [1], which added logic to
update the whitelist of keys that the browser forwards to the DevTools
whenever the keybind set changes rather than just once at launch.
Forwarded keys don't work in remote debugging/hosted sessions, so they
can't be tested with an e2e test. There's also a small change here to
enable this new test in the backend: https://chromium-review.googlesource.com/c/chromium/src/+/2246552

[1] https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2231908

Bug: 174309
Change-Id: Ib511abe8192fce245e72b371954eb94c2aa3d907
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2244468
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
Reviewed-by: Brian Cui <brcui@microsoft.com>
Reviewed-by: Jose Leal <joselea@microsoft.com>
Commit-Queue: Jack Lynch <jalyn@microsoft.com>
This commit is contained in:
Jack Lynch
2020-06-15 21:13:43 +00:00
committed by Commit Bot
parent bde6ff28cf
commit 080a0fd258
+17
View File
@@ -772,6 +772,23 @@
{type: 'rawKeyDown', key: 'F8', windowsVirtualKeyCode: 119, nativeVirtualKeyCode: 119});
};
// Tests that the key whitelist in the browser is updated when shortcuts
// are changed
TestSuite.prototype.testKeyWhitelistChanged = function() {
this.takeControl();
this.addSniffer(self.UI.shortcutRegistry, '_registerBindings', () => {
self.SDK.targetManager.mainTarget().inputAgent().invoke_dispatchKeyEvent(
{type: 'rawKeyDown', key: 'F1', windowsVirtualKeyCode: 112, nativeVirtualKeyCode: 112});
});
this.addSniffer(self.UI.shortcutRegistry, 'handleKey', key => {
this.assertEquals(112, key);
this.releaseControl();
});
self.Common.settings.moduleSetting('activeKeybindSet').set('vsCode');
};
TestSuite.prototype.testDispatchKeyEventDoesNotCrash = function() {
self.SDK.targetManager.mainTarget().inputAgent().invoke_dispatchKeyEvent(
{type: 'rawKeyDown', windowsVirtualKeyCode: 0x23, key: 'End'});