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

Unified Diff: LayoutTests/fast/events/touch/gesture/gesture-tap-active-state.html

Issue 197923006: Refactor touch hit-testing hover/active tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
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..a36dafbac44eafef19e6a1aa44e18d1647ceed9b 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,23 @@
<!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;
-}
-
description("Tests that tap gesture events set and clear the active state of elements.");
function runTests()
@@ -58,34 +38,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("isBoxHoverActive('box')");
eventSender.gestureTap(50, 50);
// FIXME: Enable after implementing mocked timers (http://crbug.com/319529)
- // shouldBeTrue("isBoxActive()");
+ // shouldBeTrue("isBoxHoverActive('box')");
waitUntilActiveCleared();
}
function waitUntilActiveCleared()
{
- if (isBoxActive()) {
+ if (isBoxHoverActive('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("isBoxHoverActive('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("isBoxHoverActive('box')");
eventSender.gestureTap(400, 250);
// FIXME: Remove after mocked timers added (http://crbug.com/319529)
waitUntilAnotherActiveCleared();
@@ -93,39 +76,42 @@ function waitUntilActiveCleared()
function waitUntilAnotherActiveCleared()
{
- if (isBoxActive()) {
+ if (isBoxHoverActive('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("isBoxHoverActive('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("isBoxHoverActive('box')");
eventSender.addTouchPoint(50, 50);
eventSender.touchStart();
- shouldBeTrue("isBoxActive()");
+ shouldBeTrue("isBoxHoverActive('box')");
eventSender.releaseTouchPoint(0);
eventSender.touchEnd();
- shouldBeTrue("isBoxActive()");
+ shouldBeTrue("isBoxHoverActive('box')");
+ eventSender.gestureTapCancel(50, 50);
tdresser 2014/03/14 14:24:51 Assert on the box state after the tap cancel.
finishJSTest();
}
-runTests();
+window.onload = runTests;
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698