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

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

Issue 530653002: Use page popup pixel readback for calendar-picker-appearance.html (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaseline test Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
1 window.jsTestIsAsync = true; 1 window.jsTestIsAsync = true;
2 if (window.internals)
3 internals.setEnableMockPagePopup(true);
4 2
5 var popupWindow = null; 3 var popupWindow = null;
6 4
7 var popupOpenCallback = null; 5 var popupOpenCallback = null;
8 function openPicker(input, callback) { 6 function openPicker(input, callback) {
7 if (window.internals)
8 internals.setEnableMockPagePopup(true);
9 input.offsetTop; // Force to lay out 9 input.offsetTop; // Force to lay out
10 if (input.type === "color") { 10 if (input.type === "color") {
11 input.focus(); 11 input.focus();
12 eventSender.keyDown(" "); 12 eventSender.keyDown(" ");
13 } else { 13 } else {
14 sendKey(input, "Down", false, true); 14 sendKey(input, "Down", false, true);
15 } 15 }
16 popupWindow = document.getElementById('mock-page-popup').contentWindow; 16 popupWindow = document.getElementById('mock-page-popup').contentWindow;
17 if (typeof callback === "function") { 17 if (typeof callback === "function") {
18 popupOpenCallback = callback; 18 popupOpenCallback = callback;
19 popupWindow.addEventListener("didOpenPicker", popupOpenCallbackWrapper, false); 19 popupWindow.addEventListener("didOpenPicker", popupOpenCallbackWrapper, false);
20 } 20 }
21 } 21 }
22 22
23 function popupOpenCallbackWrapper() { 23 function popupOpenCallbackWrapper() {
24 popupWindow.removeEventListener("didOpenPicker", popupOpenCallbackWrapper); 24 popupWindow.removeEventListener("didOpenPicker", popupOpenCallbackWrapper);
25 setTimeout(popupOpenCallback, 0); 25 setTimeout(popupOpenCallback, 0);
26 } 26 }
27 27
28 function waitUntilClosing(callback) { 28 function waitUntilClosing(callback) {
29 setTimeout(callback, 1); 29 setTimeout(callback, 1);
30 } 30 }
31 31
32 function sendKey(input, keyName, ctrlKey, altKey) { 32 function sendKey(input, keyName, ctrlKey, altKey) {
33 var event = document.createEvent('KeyboardEvent'); 33 var event = document.createEvent('KeyboardEvent');
34 event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName , 0, ctrlKey, altKey); 34 event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName , 0, ctrlKey, altKey);
35 input.dispatchEvent(event); 35 input.dispatchEvent(event);
36 } 36 }
37 37
38 38 function openPickerWithoutMock(input, callback) {
39 window.moveTo();
40 input.offsetTop; // Force to lay out
41 if (input.type === "color") {
42 input.focus();
43 eventSender.keyDown(" ");
44 } else {
45 sendKey(input, "Down", false, true);
46 }
47 popupWindow = window.internals.pagePopupWindow;
48 if (typeof callback === "function") {
49 popupOpenCallback = (function(callback) {
50 // We need to move the window to the top left of available space
51 // because the window will move back to (0, 0) when the
52 // ShellViewMsg_SetTestConfiguration IPC arrives.
53 window.moveTo();
54 callback();
55 }).bind(this, callback);
56 popupWindow.addEventListener("didOpenPicker", popupOpenCallbackWrapper, false);
57 }
58 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/calendar-picker/calendar-picker-appearance.html ('k') | Source/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698