Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: LayoutTests/vibration/cancel-vibration-during-pattern-vibrating.html

Issue 18478003: Vibration cannot be canceled during pattern vibration. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for Relanding Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/vibration/cancel-vibration-during-pattern-vibrating-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../fast/js/resources/js-test-pre.js"></script>
4 </head>
5 <body>
6 <script>
7 description('Tests the cancelVibration during pattern vibration is working.');
8
9 function vibrate(pattern) {
10 navigator.vibrate(pattern);
11 shouldBeTrue('internals.isVibrating(document)');
12 }
13
14 function cancelVibration(time) {
15 setTimeout(function() {
16 navigator.vibrate(0);
17 shouldBeFalse('internals.isVibrating(document)');
18 doNextTest();
19 }, time);
20 }
21
22 function doNextTest() {
23 if (count == 4)
24 finishJSTest();
25 doTest(++count);
26 }
27
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 t he 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 interrupt ions.
43 cancelVibration(35);
44 break;
45 case 4: // Test that a trailing pause is stripped so isVibrating becomes fal se 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 interrupt ions.
48 cancelVibration(35);
49 break;
50 }
51 }
52
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');
60 }
61 </script>
62 <script src="../fast/js/resources/js-test-post.js"></script>
63 </body>
64 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/vibration/cancel-vibration-during-pattern-vibrating-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698