| Index: LayoutTests/fast/events/touch/gesture/gesture-tap-active-state.html
|
| diff --git a/LayoutTests/fast/events/touch/gesture/gesture-tap-active-state.html b/LayoutTests/fast/events/touch/gesture/gesture-tap-active-state.html
|
| index 63c2dbe99d726a9075f6fd5788cf37dcc3a4efd2..037cb9d67c1f737bd847fe28b2adce80047fd962 100644
|
| --- a/LayoutTests/fast/events/touch/gesture/gesture-tap-active-state.html
|
| +++ b/LayoutTests/fast/events/touch/gesture/gesture-tap-active-state.html
|
| @@ -1,43 +1,24 @@
|
| <!DOCTYPE html>
|
| <html>
|
| <script src="../../../../resources/js-test.js"></script>
|
| +<link rel="stylesheet" href="../resources/touch-hover-active-tests.css">
|
| <style type="text/css">
|
| #box {
|
| - background-color: blue;
|
| width: 300px;
|
| height: 100px;
|
| }
|
| -
|
| -#box:active {
|
| - background-color: red;
|
| -}
|
| -
|
| </style>
|
| <body>
|
| -<div id="box">Gestures go here</div>
|
| +<div id="box" class="touch-interactive">Gestures go here</div>
|
|
|
| <p id="description"></p>
|
| <p>See https://bugs.webkit.org/show_bug.cgi?id=96060 for details</p>
|
|
|
| <div id="console"></div>
|
|
|
| +<script src="../resources/touch-hover-active-tests.js"></script>
|
| <script>
|
| -var color;
|
| -function isBoxActive()
|
| -{
|
| - // These need to match the background-color used above, after round-tripping.
|
| - var defaultColor = "rgb(0, 0, 255)";
|
| - var activeColor = "rgb(255, 0, 0)";
|
| -
|
| - var b = document.getElementById('box');
|
| - color = window.getComputedStyle(b).backgroundColor;
|
| - if (color == activeColor)
|
| - return true;
|
| - if (color != defaultColor)
|
| - testFailed('Got unexpected backgroundColor: ' + color);
|
| - return false;
|
| -}
|
| -
|
| +var box = document.getElementById("box");
|
| description("Tests that tap gesture events set and clear the active state of elements.");
|
|
|
| function runTests()
|
| @@ -58,34 +39,37 @@ function runTests()
|
| }
|
|
|
| debug("Verify active isn't initially set");
|
| - shouldBeFalse("isBoxActive()");
|
| + shouldBeTrue("isBoxDefault(box)");
|
|
|
| debug("Verify tapdown,tap sets and clears active");
|
| + eventSender.gestureTapDown(50, 50);
|
| eventSender.gestureShowPress(50, 50);
|
| - shouldBeTrue("isBoxActive()");
|
| + shouldBeTrue("isBoxHoveredAndActive(box)");
|
| eventSender.gestureTap(50, 50);
|
| // FIXME: Enable after implementing mocked timers (http://crbug.com/319529)
|
| - // shouldBeTrue("isBoxActive()");
|
| + // shouldBeTrue("isBoxHoveredAndActive(box)");
|
| waitUntilActiveCleared();
|
| }
|
|
|
| function waitUntilActiveCleared()
|
| {
|
| - if (isBoxActive()) {
|
| + if (isBoxHoveredAndActive(box, true)) {
|
| return setTimeout(waitUntilActiveCleared, 10);
|
| }
|
|
|
| - shouldBeFalse("isBoxActive()");
|
| + shouldBeTrue("isBoxHovered(box)");
|
|
|
| debug("Verify tapdown,tapcancel on the element sets and clears active");
|
| + eventSender.gestureTapDown(50, 50);
|
| eventSender.gestureShowPress(50, 50);
|
| - shouldBeTrue("isBoxActive()");
|
| + shouldBeTrue("isBoxHoveredAndActive(box)");
|
| eventSender.gestureTapCancel(50, 50);
|
| - shouldBeFalse("isBoxActive()");
|
| + shouldBeTrue("isBoxHovered(box)");
|
|
|
| debug("Verify tap elsewhere still clears active");
|
| + eventSender.gestureTapDown(50, 50);
|
| eventSender.gestureShowPress(50, 50);
|
| - shouldBeTrue("isBoxActive()");
|
| + shouldBeTrue("isBoxHoveredAndActive(box)");
|
| eventSender.gestureTap(400, 250);
|
| // FIXME: Remove after mocked timers added (http://crbug.com/319529)
|
| waitUntilAnotherActiveCleared();
|
| @@ -93,39 +77,43 @@ function waitUntilActiveCleared()
|
|
|
| function waitUntilAnotherActiveCleared()
|
| {
|
| - if (isBoxActive()) {
|
| + if (isBoxHoveredAndActive(box, true)) {
|
| return setTimeout(waitUntilAnotherActiveCleared, 10);
|
| }
|
|
|
| - shouldBeFalse("isBoxActive()");
|
| + shouldBeTrue("isBoxDefault(box)");
|
|
|
| debug("Verify tapCancel elsewhere still clears active");
|
| + eventSender.gestureTapDown(50, 50);
|
| eventSender.gestureShowPress(50, 50);
|
| - shouldBeTrue("isBoxActive()");
|
| + shouldBeTrue("isBoxHoveredAndActive(box)");
|
| eventSender.gestureTapCancel(400, 250);
|
| - shouldBeFalse("isBoxActive()");
|
| + shouldBeTrue("isBoxDefault(box)");
|
|
|
| debug("Verify that touchstart doesn't trigger active state");
|
| eventSender.addTouchPoint(50, 50);
|
| eventSender.touchStart();
|
| - shouldBeFalse("isBoxActive()");
|
| + shouldBeTrue("isBoxDefault(box)");
|
| eventSender.releaseTouchPoint(0);
|
| eventSender.touchEnd();
|
|
|
| debug("Verify that touchstart/touchend doesn't cancel active");
|
| + eventSender.gestureTapDown(50, 50);
|
| eventSender.gestureShowPress(50, 50);
|
| - shouldBeTrue("isBoxActive()");
|
| + shouldBeTrue("isBoxHoveredAndActive(box)");
|
| eventSender.addTouchPoint(50, 50);
|
| eventSender.touchStart();
|
| - shouldBeTrue("isBoxActive()");
|
| + shouldBeTrue("isBoxHoveredAndActive(box)");
|
| eventSender.releaseTouchPoint(0);
|
| eventSender.touchEnd();
|
| - shouldBeTrue("isBoxActive()");
|
| + shouldBeTrue("isBoxHoveredAndActive(box)");
|
| + eventSender.gestureTapCancel(50, 50);
|
| + shouldBeTrue("isBoxHovered(box)");
|
|
|
| finishJSTest();
|
| }
|
|
|
| -runTests();
|
| +window.onload = runTests;
|
| </script>
|
| </body>
|
| </html>
|
|
|