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

Unified Diff: LayoutTests/fast/events/touch/gesture/gesture-tap-down-pinch-no-scroll.html

Issue 163933002: Send early ShowPress on TapDown when page isn't scrollable/pinchable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add tests Created 6 years, 10 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-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>
+

Powered by Google App Engine
This is Rietveld 408576698