Title: [128423] trunk/LayoutTests
Revision
128423
Author
yo...@chromium.org
Date
2012-09-13 01:37:26 -0700 (Thu, 13 Sep 2012)

Log Message

[Tests] We should have test for clicking spin button in iframe.
https://bugs.webkit.org/show_bug.cgi?id=96612

Reviewed by Kent Tamura.

This patch adds two tests for clicking spin button in iframe for
input type "number" and input type "time" with multiple fields UI.

These tests are added for catching regression caused by r127876.

* fast/forms/number/number-spinbutton-click-in-iframe-expected.txt: Added.
* fast/forms/number/number-spinbutton-click-in-iframe.html: Added.
* fast/forms/resources/common-spinbutton-click-in-iframe.js: Added.
(getSpinButton): Extracts spin button in shadow DOM tree.
(mouseClick): Simulates mouse click.
(mouseMoveTo): Simulates mouse pointer move.
(runIFrameLoaded): Checking spin button clicked.
(testClickSpinButtonInIFrame): Creates and populates iframe.
* fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe-expected.txt: Added.
* fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (128422 => 128423)


--- trunk/LayoutTests/ChangeLog	2012-09-13 08:31:24 UTC (rev 128422)
+++ trunk/LayoutTests/ChangeLog	2012-09-13 08:37:26 UTC (rev 128423)
@@ -1,3 +1,26 @@
+2012-09-13  Yoshifumi Inoue  <yo...@chromium.org>
+
+        [Tests] We should have test for clicking spin button in iframe.
+        https://bugs.webkit.org/show_bug.cgi?id=96612
+
+        Reviewed by Kent Tamura.
+
+        This patch adds two tests for clicking spin button in iframe for
+        input type "number" and input type "time" with multiple fields UI.
+
+        These tests are added for catching regression caused by r127876.
+
+        * fast/forms/number/number-spinbutton-click-in-iframe-expected.txt: Added.
+        * fast/forms/number/number-spinbutton-click-in-iframe.html: Added.
+        * fast/forms/resources/common-spinbutton-click-in-iframe.js: Added.
+        (getSpinButton): Extracts spin button in shadow DOM tree.
+        (mouseClick): Simulates mouse click.
+        (mouseMoveTo): Simulates mouse pointer move.
+        (runIFrameLoaded): Checking spin button clicked.
+        (testClickSpinButtonInIFrame): Creates and populates iframe.
+        * fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe-expected.txt: Added.
+        * fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe.html: Added.
+
 2012-09-13  Zan Dobersek  <zandober...@gmail.com>
 
         Unreviewed GTK gardening.

Added: trunk/LayoutTests/fast/forms/number/number-spinbutton-click-in-iframe-expected.txt (0 => 128423)


--- trunk/LayoutTests/fast/forms/number/number-spinbutton-click-in-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/number/number-spinbutton-click-in-iframe-expected.txt	2012-09-13 08:37:26 UTC (rev 128423)
@@ -0,0 +1,10 @@
+Checks mouse click on spin button in iframe.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testInput.value is "12346"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/forms/number/number-spinbutton-click-in-iframe-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/forms/number/number-spinbutton-click-in-iframe.html (0 => 128423)


--- trunk/LayoutTests/fast/forms/number/number-spinbutton-click-in-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/number/number-spinbutton-click-in-iframe.html	2012-09-13 08:37:26 UTC (rev 128423)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<script>
+testClickSpinButtonInIFrame({
+    'expectedValue' : '12346',
+    'initialValue' : '12345',
+    'inputType' : 'number'
+});
+</script>
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/forms/number/number-spinbutton-click-in-iframe.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/forms/resources/common-spinbutton-click-in-iframe.js (0 => 128423)


--- trunk/LayoutTests/fast/forms/resources/common-spinbutton-click-in-iframe.js	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/resources/common-spinbutton-click-in-iframe.js	2012-09-13 08:37:26 UTC (rev 128423)
@@ -0,0 +1,54 @@
+window.jsTestIsAsync = true;
+
+var iframe;
+var testInput;
+
+function getSpinButton(input)
+{
+    if (!window.internals)
+        return null;
+    var editElement = window.internals.oldestShadowRoot(input);
+    return editElement.firstChild.lastChild;
+}
+
+function mouseClick()
+{
+    if (!window.eventSender)
+        return;
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+
+function mouseMoveTo(x, y)
+{
+    if (!window.eventSender)
+        return;
+    eventSender.mouseMoveTo(x, y);
+}
+
+function runIFrameLoaded(config)
+{
+    testInput = iframe.contentDocument.getElementById('test');
+    var spinButton = getSpinButton(testInput);
+    if (spinButton) {
+        mouseMoveTo(
+            iframe.offsetLeft + spinButton.offsetLeft + spinButton.offsetWidth / 2,
+            iframe.offsetTop + spinButton.offsetTop + spinButton.offsetHeight / 4);
+    }
+    mouseClick();
+    shouldBeEqualToString('testInput.value', config['expectedValue']);
+    iframe.parentNode.removeChild(iframe);
+    finishJSTest();
+}
+
+function testClickSpinButtonInIFrame(config)
+{
+    description('Checks mouse click on spin button in iframe.');
+    if (!window.eventSender)
+        debug('Please run in DumpRenderTree');
+
+    iframe = document.createElement('iframe');
+    iframe.addEventListener('load', function () { runIFrameLoaded(config) });
+    iframe.srcdoc = '<input id=test type=' + config['inputType'] + ' value="' + config['initialValue'] + '">';
+    document.body.appendChild(iframe);
+}
Property changes on: trunk/LayoutTests/fast/forms/resources/common-spinbutton-click-in-iframe.js
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe-expected.txt (0 => 128423)


--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe-expected.txt	2012-09-13 08:37:26 UTC (rev 128423)
@@ -0,0 +1,10 @@
+Checks mouse click on spin button in iframe.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testInput.value is "01:00"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe.html (0 => 128423)


--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe.html	2012-09-13 08:37:26 UTC (rev 128423)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<script>
+testClickSpinButtonInIFrame({
+    'expectedValue' : '01:00',
+    'initialValue' : '00:00',
+    'inputType' : 'time'
+});
+</script>
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe.html
___________________________________________________________________

Added: svn:eol-style

_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to