Title: [130433] trunk/LayoutTests
Revision
130433
Author
[email protected]
Date
2012-10-04 16:50:09 -0700 (Thu, 04 Oct 2012)

Log Message

Update some picker tests for input[type=date]
https://bugs.webkit.org/show_bug.cgi?id=98390

Reviewed by Daniel Bates.

r130375 changed a behavior. A key bind to open a calendar picker
or a suggestion picker was changed from "Down" to "Alt + Down". We
need to update tests which open pickers for input[type=date].

* fast/forms/date/calendar-picker-appearance-expected.txt:
* fast/forms/date/calendar-picker-appearance-pre-100.html:
Use openPicker() in calendar-picker-common.js.
* fast/forms/date/calendar-picker-appearance.html: Ditto.
* fast/forms/date/calendar-picker-common.js:
(openPicker): Specify Alt modifier.
(sendKey): Add ctrlKey and altKey flags.
* fast/forms/date/calendar-picker-with-step.html:
Use openPicker() in calendar-picker-common.js.
* platform/chromium/TestExpectations:
* platform/chromium/fast/forms/date/date-suggestion-picker-appearance-rtl.html:
Use openPicker() in suggestion-picker-common.js
* platform/chromium/fast/forms/date/date-suggestion-picker-appearance-with-scroll-bar.html:
Ditto.
* platform/chromium/fast/forms/date/date-suggestion-picker-appearance.html:
Ditto.
* platform/chromium/fast/forms/date/date-suggestion-picker-key-operations-expected.txt:
* platform/chromium/fast/forms/date/date-suggestion-picker-key-operations.html:
Use openPicker() and sendKey() in suggestion-picker-common.js.
Increase the internal timeout because it was too short on my machine.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (130432 => 130433)


--- trunk/LayoutTests/ChangeLog	2012-10-04 22:54:07 UTC (rev 130432)
+++ trunk/LayoutTests/ChangeLog	2012-10-04 23:50:09 UTC (rev 130433)
@@ -1,3 +1,35 @@
+2012-10-04  Kent Tamura  <[email protected]>
+
+        Update some picker tests for input[type=date]
+        https://bugs.webkit.org/show_bug.cgi?id=98390
+
+        Reviewed by Daniel Bates.
+
+        r130375 changed a behavior. A key bind to open a calendar picker
+        or a suggestion picker was changed from "Down" to "Alt + Down". We
+        need to update tests which open pickers for input[type=date].
+
+        * fast/forms/date/calendar-picker-appearance-expected.txt:
+        * fast/forms/date/calendar-picker-appearance-pre-100.html:
+        Use openPicker() in calendar-picker-common.js.
+        * fast/forms/date/calendar-picker-appearance.html: Ditto.
+        * fast/forms/date/calendar-picker-common.js:
+        (openPicker): Specify Alt modifier.
+        (sendKey): Add ctrlKey and altKey flags.
+        * fast/forms/date/calendar-picker-with-step.html:
+        Use openPicker() in calendar-picker-common.js.
+        * platform/chromium/TestExpectations:
+        * platform/chromium/fast/forms/date/date-suggestion-picker-appearance-rtl.html:
+        Use openPicker() in suggestion-picker-common.js
+        * platform/chromium/fast/forms/date/date-suggestion-picker-appearance-with-scroll-bar.html:
+        Ditto.
+        * platform/chromium/fast/forms/date/date-suggestion-picker-appearance.html:
+        Ditto.
+        * platform/chromium/fast/forms/date/date-suggestion-picker-key-operations-expected.txt:
+        * platform/chromium/fast/forms/date/date-suggestion-picker-key-operations.html:
+        Use openPicker() and sendKey() in suggestion-picker-common.js.
+        Increase the internal timeout because it was too short on my machine.
+
 2012-10-04  Alpha Lam  <[email protected]>
 
         Unreviewed. Chromium rebaselines.

Modified: trunk/LayoutTests/fast/forms/date/calendar-picker-appearance-expected.txt (130432 => 130433)


--- trunk/LayoutTests/fast/forms/date/calendar-picker-appearance-expected.txt	2012-10-04 22:54:07 UTC (rev 130432)
+++ trunk/LayoutTests/fast/forms/date/calendar-picker-appearance-expected.txt	2012-10-04 23:50:09 UTC (rev 130433)
@@ -1,3 +1,3 @@
-CONSOLE MESSAGE: line 17: Check if window.pagePopupController exists for a page-popup window.
-CONSOLE MESSAGE: line 12: [object PagePopupController]
+CONSOLE MESSAGE: line 12: Check if window.pagePopupController exists for a page-popup window.
+CONSOLE MESSAGE: line 7: [object PagePopupController]
  

Modified: trunk/LayoutTests/fast/forms/date/calendar-picker-appearance-pre-100.html (130432 => 130433)


--- trunk/LayoutTests/fast/forms/date/calendar-picker-appearance-pre-100.html	2012-10-04 22:54:07 UTC (rev 130432)
+++ trunk/LayoutTests/fast/forms/date/calendar-picker-appearance-pre-100.html	2012-10-04 23:50:09 UTC (rev 130433)
@@ -2,21 +2,16 @@
 <html>
 <head>
 <script src=""
+<script src=""
 </head>
 <body>
 <p id="description"></p>
 <div id="console"></div>
 <input type=date id=date value="0002-02-02">
 <script>
-function sendKey(element, keyName) {
-    var event = document.createEvent('KeyboardEvent');
-    event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName);
-    element.dispatchEvent(event);
-}
-
 function finishTest() {
-    pickerWindow.removeEventListener('resize', finishTest);
-    var daysContainer = pickerWindow.document.getElementsByClassName("days-area")[0];
+    popupWindow.removeEventListener('resize', finishTest);
+    var daysContainer = popupWindow.document.getElementsByClassName("days-area")[0];
     sendKey(daysContainer, 'Right');
     sendKey(daysContainer, 'Enter');
     shouldBe('document.getElementById("date").value', '"0002-02-03"');
@@ -28,16 +23,11 @@
 if (window.testRunner)
     testRunner.waitUntilDone();
 
-window.jsTestIsAsync = true;
-
-if (window.internals)
-    internals.settings.setEnableMockPagePopup(true);
-
-var dateInput = document.getElementById('date');
-dateInput.offsetTop;
-sendKey(dateInput, 'Down');
-var pickerWindow = document.getElementById('mock-page-popup').contentWindow;
-pickerWindow.addEventListener('resize', finishTest, false);
+window._onload_ = function() {
+    var dateInput = document.getElementById('date');
+    openPicker(dateInput);
+    popupWindow.addEventListener('resize', finishTest, false);
+};
 var successfullyParsed = true;
 </script>
 <script src=""

Modified: trunk/LayoutTests/fast/forms/date/calendar-picker-appearance.html (130432 => 130433)


--- trunk/LayoutTests/fast/forms/date/calendar-picker-appearance.html	2012-10-04 22:54:07 UTC (rev 130432)
+++ trunk/LayoutTests/fast/forms/date/calendar-picker-appearance.html	2012-10-04 23:50:09 UTC (rev 130433)
@@ -1,30 +1,23 @@
 <!DOCTYPE html>
 <body>
+<script src=""
 <input type=date id=date value="10000-12-31">
 <script>
-function sendKey(input, keyName) {
-    var event = document.createEvent('KeyboardEvent');
-    event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName);
-    input.dispatchEvent(event);
-}
-
 function finishTest() {
-    console.log(pickerWindow.pagePopupController);
-    pickerWindow.removeEventListener('resize', finishTest);
+    console.log(popupWindow.pagePopupController);
+    popupWindow.removeEventListener('resize', finishTest);
     setTimeout(function() {testRunner.notifyDone();}, 0);
 }
 
 console.log('Check if window.pagePopupController exists for a page-popup window.');
 testRunner.dumpAsText(true);
 testRunner.waitUntilDone();
-if (window.internals)
-    internals.settings.setEnableMockPagePopup(true);
 
-var dateInput = document.getElementById('date');
-dateInput.offsetTop;
-sendKey(dateInput, 'Down');
-var pickerWindow = document.getElementById('mock-page-popup').contentWindow;
-pickerWindow.addEventListener('resize', finishTest, false);
+window._onload_ = function() {
+    var dateInput = document.getElementById('date');
+    openPicker(dateInput);
+    popupWindow.addEventListener('resize', finishTest, false);
+};
 </script>
 </body>
 

Modified: trunk/LayoutTests/fast/forms/date/calendar-picker-common.js (130432 => 130433)


--- trunk/LayoutTests/fast/forms/date/calendar-picker-common.js	2012-10-04 22:54:07 UTC (rev 130432)
+++ trunk/LayoutTests/fast/forms/date/calendar-picker-common.js	2012-10-04 23:50:09 UTC (rev 130433)
@@ -31,12 +31,12 @@
 }
 
 function openPicker(input) {
-    sendKey(input, "Down");
+    sendKey(input, "Down", false, true);
     popupWindow = document.getElementById('mock-page-popup').contentWindow;
 }
 
-function sendKey(input, keyName) {
+function sendKey(input, keyName, ctrlKey, altKey) {
     var event = document.createEvent('KeyboardEvent');
-    event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName);
+    event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName, 0, ctrlKey, altKey);
     input.dispatchEvent(event);
 }

Modified: trunk/LayoutTests/fast/forms/date/calendar-picker-with-step.html (130432 => 130433)


--- trunk/LayoutTests/fast/forms/date/calendar-picker-with-step.html	2012-10-04 22:54:07 UTC (rev 130432)
+++ trunk/LayoutTests/fast/forms/date/calendar-picker-with-step.html	2012-10-04 23:50:09 UTC (rev 130433)
@@ -2,6 +2,7 @@
 <html>
 <head>
 <script src=""
+<script src=""
 </head>
 <body>
 <p id="description"></p>
@@ -12,25 +13,16 @@
 <script>
 description('Test if step limits available dates in calendar picker.');
 
-window.jsTestIsAsync = true;
-if (window.internals)
-    internals.settings.setEnableMockPagePopup(true);
-
 var dateInput = document.getElementById('date');
-sendKey(dateInput, 'Down');
-var pickerWindow = document.getElementById('mock-page-popup').contentWindow;
-pickerWindow.addEventListener('resize', test1, false);
+window._onload_ = function() {
+    openPicker(dateInput);
+    popupWindow.addEventListener('resize', test1, false);
+};
 
-function sendKey(input, keyName) {
-    var event = document.createEvent('KeyboardEvent');
-    event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName);
-    input.dispatchEvent(event);
-}
-
 function test1() {
     debug("Step without min.");
     shouldBe('availableDatesInCurrentMonth().join(",")', '["2011-05-08", "2011-05-17", "2011-05-26"].join(",")');
-    pickerWindow.removeEventListener('resize', test1);
+    popupWindow.removeEventListener('resize', test1);
 
     // Close popup
     eventSender.keyDown('\x1B');
@@ -38,21 +30,19 @@
     dateInput.min = "2011-05-01";
     
     // Reopen popup
-    sendKey(document.getElementById('date'), 'Down');
-    pickerWindow = document.getElementById('mock-page-popup').contentWindow;
-
-    pickerWindow.addEventListener("resize", test2, false);
+    openPicker(dateInput);
+    popupWindow.addEventListener("resize", test2, false);
 }
 
 function test2() {
     debug("Step when min is set.");
     shouldBe('availableDatesInCurrentMonth().join(",")', '["2011-05-01", "2011-05-10", "2011-05-19", "2011-05-28"].join(",")');
-    pickerWindow.removeEventListener('resize', test2);
+    popupWindow.removeEventListener('resize', test2);
     testRunner.notifyDone();
 }
 
 function availableDatesInCurrentMonth() {
-    return Array.prototype.map.call(pickerWindow.document.querySelectorAll(".day.available:not(.not-this-month)"), function(element) {
+    return Array.prototype.map.call(popupWindow.document.querySelectorAll(".day.available:not(.not-this-month)"), function(element) {
         return element.dataset.submitValue;
     }).sort();
 }

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (130432 => 130433)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-10-04 22:54:07 UTC (rev 130432)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-10-04 23:50:09 UTC (rev 130433)
@@ -2444,7 +2444,7 @@
 webkit.org/b/61169 [ Android Linux Win ] css3/images/optimize-contrast-canvas.html [ ImageOnlyFailure ]
 webkit.org/b/61169 [ Android Linux Win ] css3/images/optimize-contrast-image.html [ ImageOnlyFailure ]
 
-webkit.org/b/92710 fast/forms/date/calendar-picker-appearance.html [ ImageOnlyFailure Pass Timeout ]
+webkit.org/b/92710 fast/forms/date/calendar-picker-appearance.html [ ImageOnlyFailure Pass ]
 
 # New test added in r87324
 crbug.com/83994 [ Win ] platform/win/plugins/call-_javascript_-that-destroys-plugin.html [ Failure ]
@@ -3658,14 +3658,10 @@
 webkit.org/b/98094 platform/chromium/fast/forms/time/time-suggestion-picker-appearance-with-scroll-bar.html [ ImageOnlyFailure Pass ]
 webkit.org/b/98094 platform/chromium/fast/forms/time/time-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure Pass ]
 
-webkit.org/b/98390 fast/forms/date/calendar-picker-appearance-pre-100.html [ Timeout ] 
-webkit.org/b/98390 fast/forms/date/calendar-picker-key-operations.html [ Timeout ] 
-webkit.org/b/98390 fast/forms/date/calendar-picker-mouse-operations.html [ Timeout ] 
-webkit.org/b/98390 fast/forms/date/calendar-picker-with-step.html [ Timeout ] 
-webkit.org/b/98390 platform/chromium/fast/forms/date/date-suggestion-picker-appearance-rtl.html [ Timeout ] 
-webkit.org/b/98390 platform/chromium/fast/forms/date/date-suggestion-picker-appearance-with-scroll-bar.html [ Timeout ] 
-webkit.org/b/98390 platform/chromium/fast/forms/date/date-suggestion-picker-appearance.html [ Timeout ] 
-webkit.org/b/98390 platform/chromium/fast/forms/date/date-suggestion-picker-key-operations.html [ Timeout ] 
+# Need rebaseline
+webkit.org/b/98390 platform/chromium/fast/forms/date/date-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure Pass ]
+webkit.org/b/98390 platform/chromium/fast/forms/date/date-suggestion-picker-appearance-with-scroll-bar.html [ ImageOnlyFailure Pass ]
+webkit.org/b/98390 platform/chromium/fast/forms/date/date-suggestion-picker-appearance.html [ ImageOnlyFailure Pass ]
 
 
 # Numerous failures in software compositing.

Modified: trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-appearance-rtl.html (130432 => 130433)


--- trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-appearance-rtl.html	2012-10-04 22:54:07 UTC (rev 130432)
+++ trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-appearance-rtl.html	2012-10-04 23:50:09 UTC (rev 130433)
@@ -1,5 +1,6 @@
 <!DOCTYPE html>
 <body dir="rtl" style="padding: 0 50px;">
+<script src=""
 <input type=date id=date list=suggestions style="width: 100px;">
 <datalist id=suggestions>
     <option label="Today">2012-01-01</option>
@@ -26,15 +27,17 @@
 <script>
 testRunner.dumpAsText(true);
 testRunner.waitUntilDone();
-if (window.internals)
-    internals.settings.setEnableMockPagePopup(true);
 
-document.getElementById('date').focus();
-if (window.eventSender)
-    eventSender.keyDown('downArrow');
-var pickerWindow = document.getElementById('mock-page-popup').contentWindow;
-pickerWindow._onresize_ = function() {
-    testRunner.notifyDone();
+window._onload_ = function() {
+    var dateInput = document.getElementById('date');
+    dateInput.offsetTop;
+    openPicker(dateInput);
+    popupWindow.addEventListener('resize', finishTest, false);
+};
+
+function finishTest() {
+    popupWindow.removeEventListener('resize', finishTest);
+    setTimeout(function() { testRunner.notifyDone(); }, 0);
 }
 </script>
 </body>

Modified: trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-appearance-with-scroll-bar.html (130432 => 130433)


--- trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-appearance-with-scroll-bar.html	2012-10-04 22:54:07 UTC (rev 130432)
+++ trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-appearance-with-scroll-bar.html	2012-10-04 23:50:09 UTC (rev 130433)
@@ -1,5 +1,6 @@
 <!DOCTYPE html>
 <body style="background-color: #eeffff;">
+<script src=""
 <input type=date id=date value="10000-12-31" list="suggestions" style="width: 100px;">
 <datalist id=suggestions>
     <option label="Today">2012-01-01</option>
@@ -45,28 +46,20 @@
     <option>2012-02-10</option>
 </datalist>
 <script>
-function sendKey(input, keyName) {
-    var event = document.createEvent('KeyboardEvent');
-    event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName);
-    input.dispatchEvent(event);
-}
-
 function finishTest() {
-    pickerWindow.removeEventListener('resize', finishTest);
-    pickerWindow.focus();
+    popupWindow.removeEventListener('resize', finishTest);
+    popupWindow.focus();
     eventSender.keyDown('pageDown');
     setTimeout(function() {testRunner.notifyDone();}, 0);
 }
 
 testRunner.dumpAsText(true);
 testRunner.waitUntilDone();
-if (window.internals)
-    internals.settings.setEnableMockPagePopup(true);
 
-var dateInput = document.getElementById('date');
-dateInput.offsetTop;
-sendKey(dateInput, 'Down');
-var pickerWindow = document.getElementById('mock-page-popup').contentWindow;
-pickerWindow.addEventListener('resize', finishTest, false);
+window._onload_ = function() {
+    var dateInput = document.getElementById('date');
+    openPicker(dateInput);
+    popupWindow.addEventListener('resize', finishTest, false);
+};
 </script>
 </body>

Modified: trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-appearance.html (130432 => 130433)


--- trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-appearance.html	2012-10-04 22:54:07 UTC (rev 130432)
+++ trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-appearance.html	2012-10-04 23:50:09 UTC (rev 130433)
@@ -1,5 +1,6 @@
 <!DOCTYPE html>
 <body style="background-color: #eeffff;">
+<script src=""
 <input type=date id=date value="10000-12-31" list="suggestions" style="width: 200px;">
 <datalist id=suggestions>
     <option>2012-01-00</option> <!--invalid-->
@@ -25,28 +26,20 @@
     <option>2012-01-19</option>
 </datalist>
 <script>
-function sendKey(input, keyName) {
-    var event = document.createEvent('KeyboardEvent');
-    event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName);
-    input.dispatchEvent(event);
-}
-
 function finishTest() {
-    pickerWindow.removeEventListener('resize', finishTest);
-    pickerWindow.focus();
+    popupWindow.removeEventListener('resize', finishTest);
+    popupWindow.focus();
     eventSender.keyDown('downArrow');
     setTimeout(function() {testRunner.notifyDone();}, 0);
 }
 
 testRunner.dumpAsText(true);
 testRunner.waitUntilDone();
-if (window.internals)
-    internals.settings.setEnableMockPagePopup(true);
 
-var dateInput = document.getElementById('date');
-dateInput.offsetTop;
-sendKey(dateInput, 'Down');
-var pickerWindow = document.getElementById('mock-page-popup').contentWindow;
-pickerWindow.addEventListener('resize', finishTest, false);
+window._onload_ = function() {
+    var dateInput = document.getElementById('date');
+    openPicker(dateInput, 'Down');
+    popupWindow.addEventListener('resize', finishTest, false);
+};
 </script>
 </body>

Modified: trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-key-operations-expected.txt (130432 => 130433)


--- trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-key-operations-expected.txt	2012-10-04 22:54:07 UTC (rev 130432)
+++ trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-key-operations-expected.txt	2012-10-04 23:50:09 UTC (rev 130433)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 91: null
+CONSOLE MESSAGE: line 89: null
 Tests that key bindings work as expected.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -7,7 +7,7 @@
 Check that page popup doesn't exist at first.
 PASS document.getElementById("mock-page-popup") is null
 Check that page popup exists.
-PASS pickerWindow.pagePopupController.toString() is "[object PagePopupController]"
+PASS popupWindow.pagePopupController.toString() is "[object PagePopupController]"
 Check that up/down arrow keys work.
 PASS highlightedEntry() is null
 PASS highlightedEntry() is "2012-01-01"
@@ -36,7 +36,7 @@
 PASS highlightedEntry() is "@openCalendarPicker"
 Open calendar picker.
 Confirm calendar picker did open.
-PASS pickerWindow.document.getElementById("main").classList.contains("calendar-picker") is true
+PASS popupWindow.document.getElementById("main").classList.contains("calendar-picker") is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-key-operations.html (130432 => 130433)


--- trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-key-operations.html	2012-10-04 22:54:07 UTC (rev 130432)
+++ trunk/LayoutTests/platform/chromium/fast/forms/date/date-suggestion-picker-key-operations.html	2012-10-04 23:50:09 UTC (rev 130433)
@@ -2,6 +2,7 @@
 <html>
 <head>
 <script src=""
+<script src=""
 </head>
 <body style="background-color: #bbbbbb;">
 <p id="description"></p>
@@ -81,30 +82,28 @@
 </datalist>
 <script>
 description("Tests that key bindings work as expected.");
-window.jsTestIsAsync = true;
-if (window.internals)
-    internals.settings.setEnableMockPagePopup(true);
 
 debug('Check that page popup doesn\'t exist at first.');
 shouldBeNull('document.getElementById("mock-page-popup")');
 
-    console.log(document.getElementById('mock-page-popup'));
-sendKey(document.getElementById('date'), 'Down');
+console.log(document.getElementById('mock-page-popup'));
 
-var pickerWindow = document.getElementById('mock-page-popup').contentWindow;
-pickerWindow.addEventListener("resize", test1, false);
+window._onload_ = function() {
+    openPicker(document.getElementById('date'), 'Down');
+    popupWindow.addEventListener("resize", test1, false);
+}
 
 var timeoutTimer = setTimeout(function() {
     testFailed("Test timed out.");
     finishJSTest();
-}, 5000);
+}, 10000);
 
 function test1() {
     debug('Check that page popup exists.');
-    shouldBe('pickerWindow.pagePopupController.toString()', '"[object PagePopupController]"');
-    pickerWindow.focus();
+    shouldBe('popupWindow.pagePopupController.toString()', '"[object PagePopupController]"');
+    popupWindow.focus();
 
-    pickerWindow.removeEventListener("resize", test1, false);
+    popupWindow.removeEventListener("resize", test1, false);
 
     debug('Check that up/down arrow keys work.');
     shouldBeNull('highlightedEntry()');
@@ -145,15 +144,14 @@
     shouldBe('document.getElementById("date").value', '"2012-03-08"');
 
     debug('Reopen popup.');
-    sendKey(document.getElementById('date'), 'Down');
-    pickerWindow = document.getElementById('mock-page-popup').contentWindow;
-    pickerWindow.addEventListener("resize", test2, false);
+    openPicker(document.getElementById('date'));
+    popupWindow.addEventListener("resize", test2, false);
 }
 
 function test2() {
-    pickerWindow.removeEventListener("resize", test2, false);
+    popupWindow.removeEventListener("resize", test2, false);
 
-    pickerWindow.focus();
+    popupWindow.focus();
 
     debug('Check that escape key closes the popup.');
     eventSender.keyDown('\x1B');
@@ -161,16 +159,15 @@
     shouldBe('document.getElementById("date").value', '"2012-03-08"');
 
     debug('Reopen popup.');
-    sendKey(document.getElementById('date'), 'Down');
-    pickerWindow = document.getElementById('mock-page-popup').contentWindow;
-    pickerWindow.addEventListener("resize", test3, false);
+    openPicker(document.getElementById('date'));
+    popupWindow.addEventListener("resize", test3, false);
 }
 
 function test3() {
-    pickerWindow.removeEventListener("resize", test3, false);
-    pickerWindow.addEventListener("resize", test4, false);
+    popupWindow.removeEventListener("resize", test3, false);
+    popupWindow.addEventListener("resize", test4, false);
 
-    pickerWindow.focus();
+    popupWindow.focus();
 
     eventSender.keyDown('pageDown');
     eventSender.keyDown('pageDown');
@@ -182,17 +179,17 @@
 }
 
 function test4() {
-    pickerWindow.removeEventListener("resize", test4, false);
+    popupWindow.removeEventListener("resize", test4, false);
 
     debug('Confirm calendar picker did open.');
-    shouldBeTrue('pickerWindow.document.getElementById("main").classList.contains("calendar-picker")');
+    shouldBeTrue('popupWindow.document.getElementById("main").classList.contains("calendar-picker")');
 
     clearTimeout(timeoutTimer);
     finishJSTest();
 }
 
 function highlightedEntry() {
-    var activeElement = pickerWindow.document.activeElement;
+    var activeElement = popupWindow.document.activeElement;
     if (!activeElement)
         return null;
     var value = activeElement.dataset.value;
@@ -204,12 +201,6 @@
     return null;
 }
 
-function sendKey(input, keyName) {
-    var event = document.createEvent('KeyboardEvent');
-    event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName);
-    input.dispatchEvent(event);
-}
-
 </script>
 <script src=""
 </body>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to