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

Side by Side Diff: LayoutTests/fast/events/touch/gesture/gesture-tap-active-state-iframe.html

Issue 197923006: Refactor touch hit-testing hover/active tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use states instead of colors 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <script src="../../../../resources/js-test.js"></script> 3 <script src="../../../../resources/js-test.js"></script>
4 <style type="text/css"> 4 <style type="text/css">
5 #frame { 5 #frame {
6 position: absolute; 6 position: absolute;
7 top: 300px; 7 top: 300px;
8 left: 400px; 8 left: 400px;
9 height: 3000px; 9 height: 3000px;
10 } 10 }
11
12 </style> 11 </style>
13 <body> 12 <body>
14 <iframe src='resources/gesture-tap-active-state-iframe-inner.html' id='frame'> 13 <iframe src='resources/gesture-tap-active-state-iframe-inner.html' id='frame'>
15 </iframe> 14 </iframe>
16 15
17 <p id="description"></p> 16 <p id="description"></p>
18 <p>See https://bugs.webkit.org/show_bug.cgi?id=96060 for details</p> 17 <p>See https://bugs.webkit.org/show_bug.cgi?id=96060 for details</p>
19 18
20 <div id="console"></div> 19 <div id="console"></div>
21 20
21 <script src="../resources/touch-hover-active-tests.js"></script>
22 <script> 22 <script>
23 var box;
23 24
24 description("Tests that tap gesture events set and clear the active state of ele ments, even when inside an iframe and the document is scrolled."); 25 description("Tests that tap gesture events set and clear the active state of ele ments, even when inside an iframe and the document is scrolled.");
25 26
26 var isBoxActive; 27 function runTests()
27 function runTests(ba)
28 { 28 {
29 isBoxActive = ba;
30
31 if (!window.eventSender) { 29 if (!window.eventSender) {
32 debug('This test requires DRT.'); 30 debug('This test requires DRT.');
33 return; 31 return;
34 } 32 }
35 33
36 if (!eventSender.gestureShowPress) { 34 if (!eventSender.gestureShowPress) {
37 debug('GestureShowPress is not supported by this platform'); 35 debug('GestureShowPress is not supported by this platform');
38 return; 36 return;
39 } 37 }
40 38
39 box = document.getElementById("frame").contentDocument.getElementById('box') ;
40
41 // Scroll so the box is at the top 41 // Scroll so the box is at the top
42 window.scrollTo(0, 400); 42 window.scrollTo(0, 400);
43 43
44 debug("Verify active isn't initially set"); 44 debug("Verify active isn't initially set");
45 shouldBeFalse("isBoxActive()"); 45 shouldBeDefault("getHoverActiveState(box)");
46 46
47 debug("Verify tapdown,tap sets and clears active"); 47 debug("Verify showPress, tap sets and clears active");
48 eventSender.gestureTapDown(450, 50);
48 eventSender.gestureShowPress(450, 50); 49 eventSender.gestureShowPress(450, 50);
49 shouldBeTrue("isBoxActive()"); 50 shouldBeHoveredAndActive("getHoverActiveState(box)");
50 eventSender.gestureTap(450, 50); 51 eventSender.gestureTap(450, 50);
51 // FIXME: Enable after implementing mocked timers (http://crbug.com/319529) 52 // FIXME: Enable after implementing mocked timers (http://crbug.com/319529)
52 // shouldBeTrue("isBoxActive()"); 53 // shouldBeTrue("isBoxActive()");
53 waitUntilActiveCleared(); 54 waitUntilActiveCleared();
54 } 55 }
55 56
56 function waitUntilActiveCleared() 57 function waitUntilActiveCleared()
57 { 58 {
58 if(isBoxActive()) { 59 if(getHoverActiveState(box) == "hoveredAndActive") {
59 return setTimeout(waitUntilActiveCleared, 10); 60 return setTimeout(waitUntilActiveCleared, 10);
60 } 61 }
61 62
62 shouldBeFalse("isBoxActive()"); 63 shouldBeOnlyHovered("getHoverActiveState(box)");
63 finishJSTest(); 64 finishJSTest();
64 } 65 }
65 66
66 if (window.testRunner) { 67 if (window.testRunner) {
67 window.jsTestIsAsync = true; 68 window.jsTestIsAsync = true;
68 testRunner.waitUntilDone(); 69 testRunner.waitUntilDone();
69 } 70 }
70 71
72 window.onload = runTests;
71 </script> 73 </script>
72 </body> 74 </body>
73 </html> 75 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698