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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/resources/picker-common.js

Issue 2100243002: Remove non-standardize key code names from event_sender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix inspector tests that were missed by sed Created 4 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 unified diff | Download patch
OLDNEW
1 window.jsTestIsAsync = true; 1 window.jsTestIsAsync = true;
2 2
3 var popupWindow = null; 3 var popupWindow = null;
4 4
5 var popupOpenCallback = null; 5 var popupOpenCallback = null;
6 6
7 function popupOpenCallbackWrapper() { 7 function popupOpenCallbackWrapper() {
8 popupWindow.removeEventListener("didOpenPicker", popupOpenCallbackWrapper); 8 popupWindow.removeEventListener("didOpenPicker", popupOpenCallbackWrapper);
9 // We need some delay. Without it, testRunner.notifyDone() freezes. 9 // We need some delay. Without it, testRunner.notifyDone() freezes.
10 // See crbug.com/562311. 10 // See crbug.com/562311.
(...skipping 20 matching lines...) Expand all
31 // |callback| is called if we successfully open the picker UI. However it is 31 // |callback| is called if we successfully open the picker UI. However it is
32 // called only for the following types: 32 // called only for the following types:
33 // - menulist SELECT on Windows, Linux, and CrOS 33 // - menulist SELECT on Windows, Linux, and CrOS
34 // - INPUT color with DATALIST 34 // - INPUT color with DATALIST
35 // - INPUT date/datetime-local/month/week 35 // - INPUT date/datetime-local/month/week
36 function openPicker(element, callback, errorCallback) { 36 function openPicker(element, callback, errorCallback) {
37 rootWindow().moveTo(window.screenX, window.screenY); 37 rootWindow().moveTo(window.screenX, window.screenY);
38 element.offsetTop; // Force to lay out 38 element.offsetTop; // Force to lay out
39 element.focus(); 39 element.focus();
40 if (element.tagName === "SELECT") { 40 if (element.tagName === "SELECT") {
41 eventSender.keyDown("downArrow", ["altKey"]); 41 eventSender.keyDown("ArrowDown", ["altKey"]);
42 } else if (element.tagName === "INPUT") { 42 } else if (element.tagName === "INPUT") {
43 if (element.type === "color") { 43 if (element.type === "color") {
44 eventSender.keyDown(" "); 44 eventSender.keyDown(" ");
45 } else { 45 } else {
46 eventSender.keyDown("downArrow", ["altKey"]); 46 eventSender.keyDown("ArrowDown", ["altKey"]);
47 } 47 }
48 } 48 }
49 popupWindow = window.internals.pagePopupWindow; 49 popupWindow = window.internals.pagePopupWindow;
50 if (typeof callback === "function" && popupWindow) 50 if (typeof callback === "function" && popupWindow)
51 setPopupOpenCallback(callback); 51 setPopupOpenCallback(callback);
52 else if (typeof errorCallback === "function" && !popupWindow) 52 else if (typeof errorCallback === "function" && !popupWindow)
53 errorCallback(); 53 errorCallback();
54 } 54 }
55 55
56 function clickToOpenPicker(x, y, callback, errorCallback) { 56 function clickToOpenPicker(x, y, callback, errorCallback) {
(...skipping 16 matching lines...) Expand all
73 // ShellViewMsg_SetTestConfiguration IPC arrives. 73 // ShellViewMsg_SetTestConfiguration IPC arrives.
74 rootWindow().moveTo(window.screenX, window.screenY); 74 rootWindow().moveTo(window.screenX, window.screenY);
75 callback(); 75 callback();
76 }).bind(this, callback); 76 }).bind(this, callback);
77 try { 77 try {
78 popupWindow.addEventListener("didOpenPicker", popupOpenCallbackWrapper, false); 78 popupWindow.addEventListener("didOpenPicker", popupOpenCallbackWrapper, false);
79 } catch(e) { 79 } catch(e) {
80 debug(e.name); 80 debug(e.name);
81 } 81 }
82 } 82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698