Chromium Code Reviews| Index: LayoutTests/fast/events/touch/gesture/gesture-tap-down-scroll-no-pinch.html |
| diff --git a/LayoutTests/fast/events/touch/gesture/gesture-tap-down-scroll-no-pinch.html b/LayoutTests/fast/events/touch/gesture/gesture-tap-down-scroll-no-pinch.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c418fef40bb8d80e28eab92c9e445283ba3df54e |
| --- /dev/null |
| +++ b/LayoutTests/fast/events/touch/gesture/gesture-tap-down-scroll-no-pinch.html |
| @@ -0,0 +1,145 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<script src="../../../../resources/js-test.js"></script> |
| +<style type="text/css"> |
| +#box { |
| + width: 300px; |
| + height: 50px; |
| +} |
| + |
| +#overflowBox { |
| + width: 300px; |
| + height: 600px; |
| +} |
| + |
| +#container { |
| + width: 300px; |
| + height: 50px; |
| + overflow-y: scroll; |
| + overflow-x: hidden; |
| + margin: 10px 0 10px 0; |
| +} |
| + |
| +.interactive { background-color: blue; } |
| + |
| +.interactive:hover { background-color: red; } |
| + |
| +.interactive:active { background-color: green; } |
| + |
| +.interactive:hover:active { background-color: yellow; } |
| + |
| +#scroller { |
| + display: none; |
| + width: 100px; |
| + height: 600px; |
| +} |
| +</style> |
| +</head> |
| +<body> |
| +<div id="box" class="interactive">Gestures go here</div> |
| +<div id="container"> |
| + <div id="overflowBox" class="interactive">Gestures go here</div> |
| +</div> |
| + |
| +<p id="description"></p> |
| +<p>See http://crbug.com/316974 for details</p> |
| + |
| +<div id="console"></div> |
| + |
| +<div id="scroller"></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 = 'width=device-width, initial-scale=1, user-scalable=no'; |
| + 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 gesture tapdown behaviour when page is scrollable or not."); |
| + |
| +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 isn't scrollable or pinchable */ |
| + 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("isBoxHoverActive('box')"); |
| + |
| + debug("showpress on element should keep hover and active."); |
| + eventSender.gestureShowPress(50, 25); |
| + shouldBeTrue("isBoxHoverActive('box')"); |
| + |
|
Rick Byers
2014/02/21 03:35:52
you should be sending a tapCancel (or tap) gesture
Zeeshan Qureshi
2014/02/24 03:14:26
Yes, I was planning to do a sweep of the layout te
|
| + |
| + /* Verify behaviour when ancestor is scrollable */ |
| + debug("Verify hover, active aren't initially set (overflowBox with scrollable ancestor)."); |
| + shouldBeTrue("isBoxDefault('overflowBox')"); |
| + |
| + debug("tapdown on element should not activate."); |
| + eventSender.gestureTapDown(50, 80); |
| + shouldBeTrue("isBoxDefault('overflowBox')"); |
| + |
| + debug("showpress on element should activate."); |
| + eventSender.gestureShowPress(50, 80); |
| + shouldBeTrue("isBoxHoverActive('overflowBox')"); |
| + |
| + /* Now check when page becomes scrollable */ |
| + document.getElementById('scroller').style.display = 'block'; |
| + debug("Verify hover, active aren't initially set (page is scrollable)."); |
| + shouldBeTrue("isBoxDefault('box')"); |
| + |
| + debug("tapdown on element should not activate."); |
| + eventSender.gestureTapDown(50, 25); |
| + shouldBeTrue("isBoxDefault('box')"); |
| + |
| + debug("showpress on element should activate."); |
| + eventSender.gestureShowPress(50, 25); |
| + shouldBeTrue("isBoxHoverActive('box')"); |
| +} |
| + |
| +runTests(); |
| +</script> |
| +</body> |
| +</html> |
| + |