Copy platform/win/fast/events/panScroll-* to platform/chromium-win/fast/events
authoryosin@chromium.org <yosin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2012 08:27:05 +0000 (08:27 +0000)
committeryosin@chromium.org <yosin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2012 08:27:05 +0000 (08:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=104991

This patch copies pan scrolling related test from Win port to Chromium-Win port
for catching pan scrolling breakage on Chromium-Win port.

* platform/chromium/TestExpectations: Disables panScroll tests other than Windows.
* platform/chromium-win/fast/events/panScroll-click-hyperlink-expected.txt: Copied from platform/mac/fast/events.
* platform/chromium-win/fast/events/panScroll-click-hyperlink.html: ditto
* platform/chromium-win/fast/events/panScroll-event-fired-expected.txt: ditto
* platform/chromium-win/fast/events/panScroll-event-fired.html: ditto
* platform/chromium-win/fast/events/panScroll-nested-divs-expected.txt: ditto.
* platform/chromium-win/fast/events/panScroll-nested-divs.html: ditto

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137725 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/chromium-win/fast/events/panScroll-click-hyperlink-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-win/fast/events/panScroll-click-hyperlink.html [new file with mode: 0644]
LayoutTests/platform/chromium-win/fast/events/panScroll-event-fired-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-win/fast/events/panScroll-event-fired.html [new file with mode: 0644]
LayoutTests/platform/chromium-win/fast/events/panScroll-nested-divs-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-win/fast/events/panScroll-nested-divs.html [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations

index c3dc213..34f45b3 100644 (file)
@@ -1,3 +1,19 @@
+2012-12-13  Yoshifumi Inoue  <yosin@chromium.org>
+
+        Copy platform/win/fast/events/panScroll-* to platform/chromium-win/fast/events
+        https://bugs.webkit.org/show_bug.cgi?id=104991
+
+        This patch copies pan scrolling related test from Win port to Chromium-Win port
+        for catching pan scrolling breakage on Chromium-Win port.
+
+        * platform/chromium/TestExpectations: Disables panScroll tests other than Windows.
+        * platform/chromium-win/fast/events/panScroll-click-hyperlink-expected.txt: Copied from platform/mac/fast/events.
+        * platform/chromium-win/fast/events/panScroll-click-hyperlink.html: ditto
+        * platform/chromium-win/fast/events/panScroll-event-fired-expected.txt: ditto
+        * platform/chromium-win/fast/events/panScroll-event-fired.html: ditto
+        * platform/chromium-win/fast/events/panScroll-nested-divs-expected.txt: ditto.
+        * platform/chromium-win/fast/events/panScroll-nested-divs.html: ditto
+
 2012-12-14  Yoshifumi Inoue  <yosin@chromium.org>
 
         Unreviewed, rolling out r137720.
diff --git a/LayoutTests/platform/chromium-win/fast/events/panScroll-click-hyperlink-expected.txt b/LayoutTests/platform/chromium-win/fast/events/panScroll-click-hyperlink-expected.txt
new file mode 100644 (file)
index 0000000..d10fc75
--- /dev/null
@@ -0,0 +1,10 @@
+This test can be used to verify that clicking on a hyperlink is ignored when in pan scroll mode. 
+Note, this test is expected to fail on the Apple Mac and Chromium Mac port since they don't support pan scrolling.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Link 1 wasn't clicked.
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/chromium-win/fast/events/panScroll-click-hyperlink.html b/LayoutTests/platform/chromium-win/fast/events/panScroll-click-hyperlink.html
new file mode 100644 (file)
index 0000000..77a8c11
--- /dev/null
@@ -0,0 +1,94 @@
+<html>
+<head>
+<script src="../../../../fast/js/resources/js-test-pre.js"></script>
+<script>
+
+if (window.testRunner)
+    testRunner.waitUntilDone()
+
+var LeftMouseButton = 0;
+var MiddleMouseButton = 1;
+
+var testContainer;
+var didClickLink1 = false;
+
+window.onload = function()
+{
+    testContainer = document.getElementById("test-container");
+    if (window.testRunner)
+        document.body.removeChild(document.getElementById("manual-instructions"));
+    runTest();
+}
+
+function checkIfClickedLink1AndFinish()
+{
+    if (didClickLink1)
+        testFailed("Link 1 was clicked, but shouldn't have been.");
+    else
+        testPassed("Link 1 wasn't clicked.");
+    finished();
+}
+
+function runTest()
+{
+    if (!window.eventSender)
+        return;
+
+    eventSender.mouseMoveTo(testContainer.offsetLeft + 10, testContainer.offsetTop + 10);
+    eventSender.mouseDown(MiddleMouseButton);
+    eventSender.mouseUp(MiddleMouseButton);
+    eventSender.mouseMoveTo(testContainer.offsetLeft + 10, testContainer.offsetTop + testContainer.offsetHeight);
+    setTimeout(clickHyperlinksIfScrolledToBottomOtherwiseFail, 500); // 500ms should be reasonable to scroll to the bottom of the <div>.
+}
+
+function finished()
+{
+    debug('<br /><span class="pass">TEST COMPLETE</span>');
+    document.body.removeChild(document.getElementById("test-container"));
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function clickHyperlinksIfScrolledToBottomOtherwiseFail()
+{   
+    var didScrollToBottom = testContainer.scrollTop === testContainer.scrollHeight - testContainer.clientHeight;
+    if (!didScrollToBottom) {
+        testFailed("either pan scrolling is disabled or this platform doesn't support pan scrolling.");
+        finished();
+        return;
+    }
+
+    if (!window.eventSender)
+        return;
+
+    var firstLinkBoundingBox = document.getElementById("firstLink").getBoundingClientRect();
+    var secondLinkBoundingBox = document.getElementById("secondLink").getBoundingClientRect();
+    eventSender.mouseMoveTo(firstLinkBoundingBox.left + 10, firstLinkBoundingBox.top);
+    eventSender.mouseDown(LeftMouseButton);
+    eventSender.mouseUp(LeftMouseButton);
+    eventSender.leapForward(100);
+    eventSender.mouseMoveTo(secondLinkBoundingBox.left + 10, secondLinkBoundingBox.top);
+    eventSender.mouseDown(LeftMouseButton);
+    eventSender.mouseUp(LeftMouseButton);
+}
+</script>
+</head>
+<body>
+<p id="description"></p>
+<ol id="manual-instructions">
+    <li>Middle-click inside the &lt;div&gt; with the red border below.</li>
+    <li>Move the mouse such that you scroll the &lt;div&gt; until you see the hyperlinks &quot;Link 1&quot; and &quot;Link 2&quot;.</li>
+    <li>Left-click the hyperlink &quot;Link 1&quot;.</li>
+    <li>Left-click the hyperlink &quot;Link 2&quot;.</li>
+</ol>
+<div id="test-container" style="width:500px; height:100px; overflow:auto; border:2px solid red; padding:0px">
+    <div id="dummy" style="height:200px"><!-- dummy element to overflow test-container --></div>
+    <a id="firstLink" href="#" onclick="didClickLink1=true">Link 1</a> <a id="secondLink" href="#" onclick="checkIfClickedLink1AndFinish()">Link 2</a>
+</div>
+<div id="console"></div>
+<script>
+    description("This test can be used to verify that clicking on a hyperlink is ignored when in pan scroll mode. <br/>" +
+                "Note, this test is expected to fail on the Apple Mac and Chromium Mac port since they don't support pan scrolling.");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium-win/fast/events/panScroll-event-fired-expected.txt b/LayoutTests/platform/chromium-win/fast/events/panScroll-event-fired-expected.txt
new file mode 100644 (file)
index 0000000..f12b9b3
--- /dev/null
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: line 14: Mousedown with 1
+Test for bug 32303 This tests that pan scrolling works without event.preventDefault and the middle button mousedown event is fired. To test manually, try to pan scroll inside this div.
+
+Success! Div with overflow was scrolled
diff --git a/LayoutTests/platform/chromium-win/fast/events/panScroll-event-fired.html b/LayoutTests/platform/chromium-win/fast/events/panScroll-event-fired.html
new file mode 100644 (file)
index 0000000..95b745a
--- /dev/null
@@ -0,0 +1,46 @@
+<html>\r
+    <head>\r
+        <title>Pan Scrolling Test</title>\r
+    </head>\r
+    <body>\r
+        <script>\r
+            if (window.testRunner) {\r
+                testRunner.dumpAsText();\r
+                testRunner.waitUntilDone();\r
+            }\r
+            \r
+            addEventListener('mousedown', \r
+                function(event) { \r
+                    console.log("Mousedown with " + event.button);\r
+                }\r
+            , false);\r
+        </script>\r
+        <div id="overflow" style="width:500px; height:150px; overflow:auto; border:2px solid red; padding:10px">\r
+            <h1>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=32303">bug 32303</a> This tests that pan\r
+            scrolling works without event.preventDefault and the middle button mousedown event is fired.\r
+            To test manually, try to pan scroll inside this div.</h1>\r
+        </div>\r
+        <p>\r
+        <div id="console"></div>\r
+        <script>\r
+            if (window.eventSender)\r
+            {\r
+                eventSender.mouseMoveTo(50, 50);\r
+                eventSender.mouseDown(1);\r
+                eventSender.mouseUp(1);\r
+                eventSender.mouseMoveTo(50, 200);\r
+                setTimeout(finished, 500);\r
+            }\r
+            \r
+            function finished()\r
+            {\r
+                if (document.getElementById('overflow').scrollTop)\r
+                    document.getElementById('console').innerHTML = "Success! Div with overflow was scrolled";\r
+                else\r
+                    document.getElementById('console').innerHTML = "Fail! Div with overflow was not scrolled";\r
+                \r
+                window.testRunner.notifyDone();\r
+            }\r
+        </script>\r
+    </body>\r
+</html>\r
diff --git a/LayoutTests/platform/chromium-win/fast/events/panScroll-nested-divs-expected.txt b/LayoutTests/platform/chromium-win/fast/events/panScroll-nested-divs-expected.txt
new file mode 100644 (file)
index 0000000..17f5f26
--- /dev/null
@@ -0,0 +1,6 @@
+Panscrolling starting in the blue box should scroll the outer div.
+Panscrolling outside the blue boxes should scroll the outer div.
+Panscrolling starting in the blue box should scroll the outer div.
+Test for bug 28023 This tests that pan scrolling propogates correctly up the DOM tree. On success, our scroll offset should be non-zero.
+
+Success! Div with overflow was scrolled
diff --git a/LayoutTests/platform/chromium-win/fast/events/panScroll-nested-divs.html b/LayoutTests/platform/chromium-win/fast/events/panScroll-nested-divs.html
new file mode 100644 (file)
index 0000000..35811fa
--- /dev/null
@@ -0,0 +1,49 @@
+<html>\r
+    <head>\r
+        <title>Pan Scrolling Test</title>\r
+    </head>\r
+    <body>\r
+        <script>\r
+            if (testRunner) {\r
+                testRunner.dumpAsText();\r
+                testRunner.waitUntilDone();\r
+            }\r
+        </script>\r
+        <div id="overflow" style="width:500px; height:300px; overflow:auto; border:2px solid red; padding:10px">\r
+            <div style="height:200px; position:relative;">\r
+                <div style="height:150px; border:1px blue solid; overflow:auto;">\r
+                    Panscrolling starting in the blue box should scroll the outer div.\r
+                </div>\r
+                Panscrolling outside the blue boxes should scroll the outer div.\r
+            </div>\r
+            <div style="height:200px; position:relative;">\r
+                <div style="height:150px; border:1px blue solid; overflow:auto;">\r
+                    Panscrolling starting in the blue box should scroll the outer div.\r
+                </div>\r
+            </div>\r
+        </div>\r
+        <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=28023">bug 28023</a> This tests that pan scrolling\r
+        propogates correctly up the DOM tree. On success, our scroll offset should be non-zero.</p>\r
+        <div id="console"></div>\r
+        <script>\r
+            if (eventSender)\r
+            {\r
+                eventSender.mouseMoveTo(50, 50);\r
+                eventSender.mouseDown(1);\r
+                eventSender.mouseUp(1);\r
+                eventSender.mouseMoveTo(50, 200);\r
+                setTimeout(finished, 500);\r
+            }\r
+            \r
+            function finished()\r
+            {\r
+                if (document.getElementById('overflow').scrollTop)\r
+                    document.getElementById('console').innerHTML = "Success! Div with overflow was scrolled";\r
+                else\r
+                    document.getElementById('console').innerHTML = "Fail! Div with overflow was not scrolled";\r
+                \r
+                window.testRunner.notifyDone();\r
+            }\r
+        </script>\r
+    </body>\r
+</html>\r
index ec5012b..e23a002 100644 (file)
@@ -2063,6 +2063,10 @@ crbug.com/25977 [ XP Debug ] http/tests/appcache/online-whitelist.html [ Pass Ti
 crbug.com/30826 [ Win ] platform/win/fast/events/panScroll-imageMap-noHref-scroll.html [ Failure ]
 crbug.com/30826 [ Win Debug ] platform/win/fast/events/panScroll-event-fired.html [ Failure Pass Timeout ]
 
+webkit.org/b/104991 [ Android Linux Mac ] platform/chromium-win/fast/events/panScroll-click-hyperlink.html [ Skip ]
+webkit.org/b/104991 [ Android Linux Mac ] platform/chromium-win/fast/events/panScroll-event-fired.html [ Skip ]
+webkit.org/b/104991 [ Android Linux Mac ] platform/chromium-win/fast/events/panScroll-nested-divs.html [ Skip ]
+
 crbug.com/31623 [ SnowLeopard Win ] http/tests/appcache/remove-cache.html [ Failure Pass Timeout ]
 
 # V8's implementation of getOwnPropertyNames has different results for built-in