Index: LayoutTests/fast/events/touch/gesture/gesture-tap-down-pinch-no-scroll.html |
diff --git a/LayoutTests/fast/events/touch/gesture/gesture-tap-down-pinch-no-scroll.html b/LayoutTests/fast/events/touch/gesture/gesture-tap-down-pinch-no-scroll.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a01f71760b6f082f427327316caf40924195b0fc |
--- /dev/null |
+++ b/LayoutTests/fast/events/touch/gesture/gesture-tap-down-pinch-no-scroll.html |
@@ -0,0 +1,95 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../../../../resources/js-test.js"></script> |
+<style type="text/css"> |
+#box { |
+ width: 300px; |
+ height: 50px; |
+} |
+ |
+.interactive { background-color: blue; } |
+ |
+.interactive:hover { background-color: red; } |
+ |
+.interactive:active { background-color: green; } |
+ |
+.interactive:hover:active { background-color: yellow; } |
+</style> |
+</head> |
+<body> |
+<div id="box" class="interactive">Gestures go here</div> |
+ |
+<p id="description"></p> |
+<p>See http://crbug.com/316974 for details</p> |
+ |
+<div id="console"></div> |
+ |
+<script> |
+if (window.internals) { |
+ internals.settings.setViewportEnabled(true); |
+ internals.settings.setViewportMetaEnabled(true); |
+ |
+ // Now append meta tag so that it is handled properly |
+ var meta = document.createElement('meta'); |
+ meta.name = 'viewport'; |
+ meta.content = 'initial-scale=1, maximum-scale=2'; |
+ document.head.appendChild(meta); |
+} |
+ |
+var color; |
+ |
+function isBoxOfColor(id, givenColor) |
+{ |
+ var b = document.getElementById(id); |
+ color = window.getComputedStyle(b).backgroundColor; |
+ if (color == givenColor) |
+ return true; |
+ |
+ testFailed('Box had backgroundColor: ' + color); |
+ return false; |
+} |
+ |
+function isBoxHoverActive(id) |
+{ |
+ return isBoxOfColor(id, "rgb(255, 255, 0)"); |
+} |
+ |
+function isBoxDefault(id) |
+{ |
+ return isBoxOfColor(id, "rgb(0, 0, 255)"); |
+} |
+ |
+description("Tests that gesture tapdown doesn't set hover/active when page is pinchable."); |
+ |
+function runTests() |
+{ |
+ if (!window.eventSender) { |
+ debug('This test requires DRT.'); |
+ return; |
+ } |
+ |
+ if (!eventSender.gestureTapDown |
+ || !eventSender.gestureShowPress) { |
+ debug('Gesture events are not supported by this platform'); |
+ return; |
+ } |
+ |
+ /* Verify behaviour when page is pinchable */ |
Rick Byers
2014/02/21 03:35:52
does this really need to be a separate test (there
Zeeshan Qureshi
2014/02/24 03:14:26
Not really, I was just skeptical that adding too m
|
+ debug("Verify hover, active aren't initially set (page isn't scrollable)."); |
+ shouldBeTrue("isBoxDefault('box')"); |
+ |
+ debug("tapdown on element should activate."); |
+ eventSender.gestureTapDown(50, 25); |
+ shouldBeTrue("isBoxDefault('box')"); |
+ |
+ debug("showpress on element should keep hover and active."); |
+ eventSender.gestureShowPress(50, 25); |
+ shouldBeTrue("isBoxHoverActive('box')"); |
+} |
+ |
+runTests(); |
+</script> |
+</body> |
+</html> |
+ |