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 // See: https://www.chromestatus.com/feature/5644273861001216. |
| 14 var element = document.getElementById("test"); |
| 15 simulateUserClick(element.offsetLeft + 2, element.offsetTop + 2); |
| 16 |
9 function vibrate(pattern) { | 17 function vibrate(pattern) { |
10 navigator.vibrate(pattern); | 18 navigator.vibrate(pattern); |
11 shouldBeTrue('internals.isVibrating(navigator)'); | 19 shouldBeTrue('internals.isVibrating(navigator)'); |
12 } | 20 } |
13 | 21 |
14 function cancelVibration(time) { | 22 function cancelVibration(time) { |
15 setTimeout(function() { | 23 setTimeout(function() { |
16 navigator.vibrate(0); | 24 navigator.vibrate(0); |
17 shouldBeFalse('internals.isVibrating(navigator)'); | 25 shouldBeFalse('internals.isVibrating(navigator)'); |
18 doNextTest(); | 26 doNextTest(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 var count = 1; | 61 var count = 1; |
54 if (window.testRunner) { | 62 if (window.testRunner) { |
55 window.jsTestIsAsync = true; | 63 window.jsTestIsAsync = true; |
56 shouldBeFalse('internals.isVibrating(navigator)'); // Before vibration test. | 64 shouldBeFalse('internals.isVibrating(navigator)'); // Before vibration test. |
57 doTest(count); | 65 doTest(count); |
58 } else { | 66 } else { |
59 debug('This test can not be run without the TestRunner'); | 67 debug('This test can not be run without the TestRunner'); |
60 } | 68 } |
61 </script> | 69 </script> |
62 </body> | 70 </body> |
63 </html> | 71 </html> |
OLD | NEW |