Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(732)

Unified Diff: third_party/WebKit/Source/devtools/front_end/Tests.js

Issue 2656903005: ChromeDriver: Handle key events properly on Mac (Closed)
Patch Set: changes Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/devtools/protocol/native_input_event_builder_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/Tests.js
diff --git a/third_party/WebKit/Source/devtools/front_end/Tests.js b/third_party/WebKit/Source/devtools/front_end/Tests.js
index 5a96d0e64bbe85d305b1d131ecc96f331013dc26..d90b840b1fa9c8f595e2c9518e5b4a693a78cdd2 100644
--- a/third_party/WebKit/Source/devtools/front_end/Tests.js
+++ b/third_party/WebKit/Source/devtools/front_end/Tests.js
@@ -665,6 +665,61 @@
step1();
};
+ TestSuite.prototype.testDispatchKeyEventShowsAutoFill = function() {
+ var test = this;
+ var receivedReady = false;
+
+ function signalToShowAutofill() {
+ SDK.targetManager.mainTarget().inputAgent().invoke_dispatchKeyEvent(
+ {type: 'rawKeyDown', key: 'Down', windowsVirtualKeyCode: 40, nativeVirtualKeyCode: 40});
+ SDK.targetManager.mainTarget().inputAgent().invoke_dispatchKeyEvent(
+ {type: 'keyUp', key: 'Down', windowsVirtualKeyCode: 40, nativeVirtualKeyCode: 40});
+ }
+
+ function selectTopAutoFill() {
+ SDK.targetManager.mainTarget().inputAgent().invoke_dispatchKeyEvent(
+ {type: 'rawKeyDown', key: 'Down', windowsVirtualKeyCode: 40, nativeVirtualKeyCode: 40});
+ SDK.targetManager.mainTarget().inputAgent().invoke_dispatchKeyEvent(
+ {type: 'keyUp', key: 'Down', windowsVirtualKeyCode: 40, nativeVirtualKeyCode: 40});
+ SDK.targetManager.mainTarget().inputAgent().invoke_dispatchKeyEvent(
+ {type: 'rawKeyDown', key: 'Enter', windowsVirtualKeyCode: 13, nativeVirtualKeyCode: 13});
+ SDK.targetManager.mainTarget().inputAgent().invoke_dispatchKeyEvent(
+ {type: 'keyUp', key: 'Enter', windowsVirtualKeyCode: 13, nativeVirtualKeyCode: 13});
+
+ test.evaluateInConsole_('document.getElementById("name").value', onResultOfInput);
+ }
+
+ function onResultOfInput(value) {
+ // Console adds "" around the response.
+ test.assertEquals('"Abbf"', value);
+ test.releaseControl();
+ }
+
+ function onConsoleMessage(event) {
+ var message = event.data.messageText;
+ if (message === 'ready' && !receivedReady) {
+ receivedReady = true;
+ signalToShowAutofill();
+ }
+ // This log comes from the browser unittest code.
+ if (message === 'didShowSuggestions')
+ selectTopAutoFill();
+ }
+
+ this.takeControl();
+
+ // It is possible for the ready console messagage to be already received but not handled
+ // or received later. This ensures we can catch both cases.
+ SDK.multitargetConsoleModel.addEventListener(SDK.ConsoleModel.Events.MessageAdded, onConsoleMessage, this);
dgozman 2017/06/08 23:52:27 This is ConsoleModel.consoleModel now.
allada 2017/06/09 18:19:00 Done.
+
+ var messages = SDK.multitargetConsoleModel.messages();
+ if (messages.length) {
+ var text = messages[0].messageText;
+ this.assertEquals('ready', text);
+ signalToShowAutofill();
+ }
+ };
+
TestSuite.prototype.testDispatchKeyEventDoesNotCrash = function() {
SDK.targetManager.mainTarget().inputAgent().invoke_dispatchKeyEvent(
{type: 'rawKeyDown', windowsVirtualKeyCode: 0x23, key: 'End'});
« no previous file with comments | « content/browser/devtools/protocol/native_input_event_builder_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698