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> |
4 <script src="vibration-utils.js"></script> | 5 <script src="vibration-utils.js"></script> |
5 </head> | 6 </head> |
6 <body> | 7 <body> |
| 8 <h4 id="test"></h4> |
7 <script> | 9 <script> |
8 description('Tests for how durations are handled in the Vibration API.'); | 10 description('Tests for how durations are handled in the Vibration API.'); |
9 | 11 |
| 12 if (window.testRunner) { |
| 13 testRunner.dumpAsText(); |
| 14 testRunner.dumpChildFramesAsText(); |
| 15 } |
| 16 |
| 17 // Simulates a user click for vibrate to be allowed. |
| 18 // See: https://www.chromestatus.com/feature/5644273861001216. |
| 19 var element = document.getElementById("test"); |
| 20 simulateUserClick(element.offsetLeft + 2, element.offsetTop + 2); |
| 21 |
10 // Empty pattern is empty. Does not start a vibration. | 22 // Empty pattern is empty. Does not start a vibration. |
11 shouldBeTrue("navigator.vibrate([])"); | 23 shouldBeTrue("navigator.vibrate([])"); |
12 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(navigator), [])")
; | 24 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(navigator), [])")
; |
13 shouldBeFalse("internals.isVibrating(navigator)"); | 25 shouldBeFalse("internals.isVibrating(navigator)"); |
14 stopVibration(); | 26 stopVibration(); |
15 | 27 |
16 // An empty pattern is stored internally for a single 0. | 28 // An empty pattern is stored internally for a single 0. |
17 shouldBeTrue("navigator.vibrate(0)"); | 29 shouldBeTrue("navigator.vibrate(0)"); |
18 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(navigator), [])")
; | 30 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(navigator), [])")
; |
19 shouldBeFalse("internals.isVibrating(navigator)"); | 31 shouldBeFalse("internals.isVibrating(navigator)"); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // This is a bug, and this test exposes the incorrect behavior. | 67 // This is a bug, and this test exposes the incorrect behavior. |
56 // FIXME: http://crbug.com/309700 | 68 // FIXME: http://crbug.com/309700 |
57 shouldBeTrue("navigator.vibrate([-1, -1, -1])"); | 69 shouldBeTrue("navigator.vibrate([-1, -1, -1])"); |
58 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(navigator), [1000
0, 10000, 10000])"); | 70 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(navigator), [1000
0, 10000, 10000])"); |
59 shouldBeTrue("internals.isVibrating(navigator)"); | 71 shouldBeTrue("internals.isVibrating(navigator)"); |
60 stopVibration(); | 72 stopVibration(); |
61 | 73 |
62 </script> | 74 </script> |
63 </body> | 75 </body> |
64 </html> | 76 </html> |
OLD | NEW |