OLD | NEW |
---|---|
(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 var count = 0; | |
10 var cancelingTime = 80; | |
11 | |
12 if (window.testRunner) { | |
13 function vibrate() { | |
14 navigator.vibrate([100, 100, 100, 100, 100]); | |
Michael van Ouwerkerk
2013/07/03 10:47:55
I find this test really hard to read, with a count
kihong
2013/07/08 10:14:06
Thanks for your comments.
I'm changing my tests mo
| |
15 shouldBeTrue('internals.isVibrating()'); | |
16 cancelVibration(cancelingTime + count * 100); | |
17 } | |
18 | |
19 function cancelVibration(time) { | |
20 setTimeout(function() { | |
Michael van Ouwerkerk
2013/07/03 10:47:55
Tests should not wait for timeouts, they will run
kihong
2013/07/08 10:14:06
I changed my tests but I don't understand what you
Michael van Ouwerkerk
2013/07/10 16:10:05
The tests are much easier to read now, thank you.
| |
21 navigator.vibrate(0); | |
22 shouldBeFalse('internals.isVibrating()'); | |
23 if (count++ == 2) | |
24 finishJSTest(); | |
25 vibrate(); | |
26 }, time); | |
27 } | |
28 | |
29 shouldBeFalse('internals.isVibrating()'); | |
30 vibrate(); | |
31 window.jsTestIsAsync = true; | |
32 } else | |
Michael van Ouwerkerk
2013/07/03 10:47:55
Please use curly braces for the else clause, becau
kihong
2013/07/08 10:14:06
Done.
| |
33 debug('This test can not be run without the TestRunner'); | |
34 </script> | |
35 <script src="../fast/js/resources/js-test-post.js"></script> | |
36 </body> | |
37 </html> | |
OLD | NEW |