OLD | NEW |
1 <html> | 1 <html> |
2 <script src="../../js/resources/js-test-pre.js"></script> | 2 <script src="../../js/resources/js-test-pre.js"></script> |
3 <body> | 3 <body> |
4 <iframe style="position:absolute; top:100px; left:100px;" src="./resources/emula
ted-touch-iframe2.html"></iframe> | 4 <iframe style="position:absolute; top:100px; left:100px;" src="./resources/emula
ted-touch-iframe2.html"></iframe> |
5 <p>Test touchend events are emulated in iframes correctly.</p> | 5 <p>Test touchend events are emulated in iframes correctly.</p> |
6 <div id="console"></div> | 6 <div id="console"></div> |
7 <script type="text/javascript"> | 7 <script type="text/javascript"> |
8 | 8 |
9 var touchstartCount = 0; | 9 var touchstartCount = 0; |
| 10 var touchmoveCount = 0; |
10 var EXPECTED_TOUCHSTART_COUNT = 1; | 11 var EXPECTED_TOUCHSTART_COUNT = 1; |
| 12 var EXPECTED_TOUCHMOVE_COUNT = 1; |
11 var shouldBail; | 13 var shouldBail; |
12 | 14 |
13 function testComplete() | 15 function testComplete() |
14 { | 16 { |
15 if (shouldBail) | 17 if (shouldBail) |
16 return; | 18 return; |
17 | 19 |
18 if (touchstartCount > EXPECTED_TOUCHSTART_COUNT) { | 20 if (touchstartCount > EXPECTED_TOUCHSTART_COUNT) { |
19 debug("touchstart fired for the top frame, too, but should only fire for
the iframe!"); | 21 debug("touchstart fired for the top frame, too, but should only fire for
the iframe!"); |
20 shouldBail = true; | 22 shouldBail = true; |
21 } | 23 } |
22 | 24 |
| 25 if (!touchmoveCount) |
| 26 debug("touchmove not fired for the iframe!"); |
| 27 else if (touchmoveCount > EXPECTED_TOUCHMOVE_COUNT) |
| 28 debug("touchmove fired too many times!"); |
| 29 |
23 debug("touchend (test will time out if broken)"); | 30 debug("touchend (test will time out if broken)"); |
24 window.internals.settings.setTouchEventEmulationEnabled(false); | 31 window.internals.settings.setTouchEventEmulationEnabled(false); |
25 window.testRunner.notifyDone(); | 32 window.testRunner.notifyDone(); |
26 } | 33 } |
27 | 34 |
| 35 function handleTouchmove() |
| 36 { |
| 37 ++touchmoveCount; |
| 38 } |
| 39 |
28 function handleTouchstart() | 40 function handleTouchstart() |
29 { | 41 { |
30 ++touchstartCount; | 42 ++touchstartCount; |
31 } | 43 } |
32 | 44 |
33 function runTest() { | 45 function runTest() { |
34 if (window.eventSender && window.internals && window.internals.settings) { | 46 if (window.eventSender && window.internals && window.internals.settings) { |
35 window.eventSender.dragMode = false; | 47 window.eventSender.dragMode = false; |
36 window.internals.settings.setTouchEventEmulationEnabled(true); | 48 window.internals.settings.setTouchEventEmulationEnabled(true); |
37 | 49 |
38 eventSender.mouseMoveTo(110, 110); | 50 eventSender.mouseMoveTo(110, 110); |
39 eventSender.mouseDown(0); | 51 eventSender.mouseDown(0); |
40 eventSender.mouseMoveTo(120, 130); | 52 eventSender.mouseMoveTo(120, 130); |
41 eventSender.mouseUp(0); | 53 eventSender.mouseUp(0); |
42 } else | 54 } else |
43 debug('This test requires DRT.'); | 55 debug('This test requires DRT.'); |
44 } | 56 } |
45 | 57 |
46 if (window.testRunner) | 58 if (window.testRunner) |
47 window.testRunner.waitUntilDone(); | 59 window.testRunner.waitUntilDone(); |
48 | 60 |
49 </script> | 61 </script> |
50 </body> | 62 </body> |
51 </html> | 63 </html> |
OLD | NEW |