Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / vibration / cancel-vibration-during-pattern-vibrating.html
blob53ecbaa2f6dd1aba295b85a0332f22848e199e8c
1 <html>
2 <head>
3 <script src="../resources/js-test.js"></script>
4 </head>
5 <body>
6 <script>
7 description('Tests the cancelVibration during pattern vibration is working.');
9 function vibrate(pattern) {
10 navigator.vibrate(pattern);
11 shouldBeTrue('internals.isVibrating(document)');
14 function cancelVibration(time) {
15 setTimeout(function() {
16 navigator.vibrate(0);
17 shouldBeFalse('internals.isVibrating(document)');
18 doNextTest();
19 }, time);
22 function doNextTest() {
23 if (count == 4)
24 finishJSTest();
25 doTest(++count);
28 function doTest(num) {
29 switch(num) {
30 case 1: // Test that cancelling works during a vibration in a pattern.
31 vibrate([20, 20, 20]);
32 // Progress time by 10ms so we are in the middle of the first vibration of the pattern.
33 cancelVibration(10);
34 break;
35 case 2: // Test that cancelling works during a pause in a pattern.
36 vibrate([10, 10, 10]);
37 // Progress time by 15ms so we are in the middle of the first pause of the pattern.
38 cancelVibration(15);
39 break;
40 case 3: // Test that the system stops thinking that it is vibrating when the pattern ends.
41 vibrate([10, 10, 10]);
42 // Progress time by 35ms so the pattern ends naturally without interruptions.
43 cancelVibration(35);
44 break;
45 case 4: // Test that a trailing pause is stripped so isVibrating becomes false after the last vibration in the pattern.
46 vibrate([10, 10, 10, 10]); // Even number of array entries, the trailing pause will be stripped.
47 // Progress time by 35ms so the pattern ends naturally without interruptions.
48 cancelVibration(35);
49 break;
53 var count = 1;
54 if (window.testRunner) {
55 window.jsTestIsAsync = true;
56 shouldBeFalse('internals.isVibrating(document)'); // Before vibration test.
57 doTest(count);
58 } else {
59 debug('This test can not be run without the TestRunner');
61 </script>
62 </body>
63 </html>