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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../../resources/js-test.js"></script>
5 <style type="text/css">
6 #box {
7 width: 300px;
8 height: 50px;
9 }
10
11 .interactive { background-color: blue; }
12
13 .interactive:hover { background-color: red; }
14
15 .interactive:active { background-color: green; }
16
17 .interactive:hover:active { background-color: yellow; }
18 </style>
19 </head>
20 <body>
21 <div id="box" class="interactive">Gestures go here</div>
22
23 <p id="description"></p>
24 <p>See http://crbug.com/316974 for details</p>
25
26 <div id="console"></div>
27
28 <script>
29 if (window.internals) {
30 internals.settings.setViewportEnabled(true);
31 internals.settings.setViewportMetaEnabled(true);
32
33 // Now append meta tag so that it is handled properly
34 var meta = document.createElement('meta');
35 meta.name = 'viewport';
36 meta.content = 'initial-scale=1, maximum-scale=2';
37 document.head.appendChild(meta);
38 }
39
40 var color;
41
42 function isBoxOfColor(id, givenColor)
43 {
44 var b = document.getElementById(id);
45 color = window.getComputedStyle(b).backgroundColor;
46 if (color == givenColor)
47 return true;
48
49 testFailed('Box had backgroundColor: ' + color);
50 return false;
51 }
52
53 function isBoxHoverActive(id)
54 {
55 return isBoxOfColor(id, "rgb(255, 255, 0)");
56 }
57
58 function isBoxDefault(id)
59 {
60 return isBoxOfColor(id, "rgb(0, 0, 255)");
61 }
62
63 description("Tests that gesture tapdown doesn't set hover/active when page is pi nchable.");
64
65 function runTests()
66 {
67 if (!window.eventSender) {
68 debug('This test requires DRT.');
69 return;
70 }
71
72 if (!eventSender.gestureTapDown
73 || !eventSender.gestureShowPress) {
74 debug('Gesture events are not supported by this platform');
75 return;
76 }
77
78 /* 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
79 debug("Verify hover, active aren't initially set (page isn't scrollable).");
80 shouldBeTrue("isBoxDefault('box')");
81
82 debug("tapdown on element should activate.");
83 eventSender.gestureTapDown(50, 25);
84 shouldBeTrue("isBoxDefault('box')");
85
86 debug("showpress on element should keep hover and active.");
87 eventSender.gestureShowPress(50, 25);
88 shouldBeTrue("isBoxHoverActive('box')");
89 }
90
91 runTests();
92 </script>
93 </body>
94 </html>
95
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698