Chromium Code Reviews| OLD | NEW |
|---|---|
| 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') ; | |
|
tdresser
2014/03/14 14:24:51
Why do you just pass the id to isBox* sometimes, b
Zeeshan Qureshi
2014/03/14 14:52:21
Yeah, makes sense. Better than modifying getElemen
| |
| 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 shouldBeTrue("isBoxDefault(box)"); |
| 46 | 46 |
| 47 debug("Verify tapdown,tap sets and clears active"); | 47 debug("Verify tapdown,tap sets and clears active"); |
| 48 eventSender.gestureTapDown(450, 50); | |
| 48 eventSender.gestureShowPress(450, 50); | 49 eventSender.gestureShowPress(450, 50); |
| 49 shouldBeTrue("isBoxActive()"); | 50 shouldBeTrue("isBoxHoverActive(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(isBoxHoverActive(box, true)) { |
| 59 return setTimeout(waitUntilActiveCleared, 10); | 60 return setTimeout(waitUntilActiveCleared, 10); |
| 60 } | 61 } |
| 61 | 62 |
| 62 shouldBeFalse("isBoxActive()"); | 63 shouldBeTrue("isBoxHovered(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> |
| OLD | NEW |