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

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

Issue 2656903005: ChromeDriver: Handle key events properly on Mac (Closed)
Patch Set: fixes Created 3 years, 5 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 91d725f8edd7338da54e3bacc04358373a2ec35b..2d868878ddcf01d4072fc640859ddb5a94ff4f61 100644
--- a/third_party/WebKit/Source/devtools/front_end/Tests.js
+++ b/third_party/WebKit/Source/devtools/front_end/Tests.js
@@ -662,6 +662,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.
+ ConsoleModel.consoleModel.addEventListener(ConsoleModel.ConsoleModel.Events.MessageAdded, onConsoleMessage, this);
+
+ var messages = ConsoleModel.consoleModel.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