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 var element = document.getElementById("test"); |
| 19 simulateUserClick(element.offsetLeft + 2, element.offsetTop + 2); |
| 20 |
10 // Empty pattern is empty. Does not start a vibration. | 21 // Empty pattern is empty. Does not start a vibration. |
11 shouldBeTrue("navigator.vibrate([])"); | 22 shouldBeTrue("navigator.vibrate([])"); |
12 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(navigator), [])")
; | 23 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(navigator), [])")
; |
13 shouldBeFalse("internals.isVibrating(navigator)"); | 24 shouldBeFalse("internals.isVibrating(navigator)"); |
14 stopVibration(); | 25 stopVibration(); |
15 | 26 |
16 // An empty pattern is stored internally for a single 0. | 27 // An empty pattern is stored internally for a single 0. |
17 shouldBeTrue("navigator.vibrate(0)"); | 28 shouldBeTrue("navigator.vibrate(0)"); |
18 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(navigator), [])")
; | 29 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(navigator), [])")
; |
19 shouldBeFalse("internals.isVibrating(navigator)"); | 30 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. | 66 // This is a bug, and this test exposes the incorrect behavior. |
56 // FIXME: http://crbug.com/309700 | 67 // FIXME: http://crbug.com/309700 |
57 shouldBeTrue("navigator.vibrate([-1, -1, -1])"); | 68 shouldBeTrue("navigator.vibrate([-1, -1, -1])"); |
58 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(navigator), [1000
0, 10000, 10000])"); | 69 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(navigator), [1000
0, 10000, 10000])"); |
59 shouldBeTrue("internals.isVibrating(navigator)"); | 70 shouldBeTrue("internals.isVibrating(navigator)"); |
60 stopVibration(); | 71 stopVibration(); |
61 | 72 |
62 </script> | 73 </script> |
63 </body> | 74 </body> |
64 </html> | 75 </html> |
OLD | NEW |