Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / vibration / vibration-patterns.html
blobfbbdd516e848be625c6d30e964d227c393a850c7
1 <html>
2 <head>
3 <script src="../resources/js-test.js"></script>
4 <script src="vibration-utils.js"></script>
5 </head>
6 <body>
7 <script>
8 description('Tests for how patterns are handled in the Vibration API.');
10 // A trailing pause is discarded from a pattern i.e. patterns of even
11 // non-zero length are truncated by 1.
12 shouldBeTrue("navigator.vibrate(newPattern(1, 4))");
13 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(document), newPattern(1, 3))");
14 shouldBeTrue("internals.isVibrating(document)");
15 stopVibration();
17 // Maximum pattern length.
18 shouldBeTrue("navigator.vibrate(newPattern(1, 99))");
19 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(document), newPattern(1, 99))");
20 shouldBeTrue("internals.isVibrating(document)");
21 stopVibration();
23 // The pattern is longer than supported. It is truncated and execution proceeds.
24 shouldBeTrue("navigator.vibrate(newPattern(1, 200))");
25 shouldBeTrue("areArraysEqual(internals.pendingVibrationPattern(document), newPattern(1, 99))");
26 shouldBeTrue("internals.isVibrating(document)");
27 stopVibration();
29 </script>
30 </body>
31 </html>