OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../resources/js-test.js"></script> | 3 <script src="../resources/js-test.js"></script> |
| 4 <script src="../resources/user-gesture-utils.js"></script> |
| 5 <script src="vibration-utils.js"></script> |
4 </head> | 6 </head> |
5 <body> | 7 <body> |
| 8 <h4 id="test"></h4> |
6 <script> | 9 <script> |
7 description('Tests the cancelVibration during pattern vibration is working.'); | 10 description('Tests the cancelVibration during pattern vibration is working.'); |
8 | 11 |
| 12 // Simulates a user click for vibrate to be allowed. |
| 13 var element = document.getElementById("test"); |
| 14 simulateUserClick(element.offsetLeft + 2, element.offsetTop + 2); |
| 15 |
9 function vibrate(pattern) { | 16 function vibrate(pattern) { |
10 navigator.vibrate(pattern); | 17 navigator.vibrate(pattern); |
11 shouldBeTrue('internals.isVibrating(navigator)'); | 18 shouldBeTrue('internals.isVibrating(navigator)'); |
12 } | 19 } |
13 | 20 |
14 function cancelVibration(time) { | 21 function cancelVibration(time) { |
15 setTimeout(function() { | 22 setTimeout(function() { |
16 navigator.vibrate(0); | 23 navigator.vibrate(0); |
17 shouldBeFalse('internals.isVibrating(navigator)'); | 24 shouldBeFalse('internals.isVibrating(navigator)'); |
18 doNextTest(); | 25 doNextTest(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 var count = 1; | 60 var count = 1; |
54 if (window.testRunner) { | 61 if (window.testRunner) { |
55 window.jsTestIsAsync = true; | 62 window.jsTestIsAsync = true; |
56 shouldBeFalse('internals.isVibrating(navigator)'); // Before vibration test. | 63 shouldBeFalse('internals.isVibrating(navigator)'); // Before vibration test. |
57 doTest(count); | 64 doTest(count); |
58 } else { | 65 } else { |
59 debug('This test can not be run without the TestRunner'); | 66 debug('This test can not be run without the TestRunner'); |
60 } | 67 } |
61 </script> | 68 </script> |
62 </body> | 69 </body> |
63 </html> | 70 </html> |
OLD | NEW |