Chromium Code Reviews| Index: LayoutTests/vibration/cancelVibration-during-pattern-vibrating.html |
| diff --git a/LayoutTests/vibration/cancelVibration-during-pattern-vibrating.html b/LayoutTests/vibration/cancelVibration-during-pattern-vibrating.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bdacc3d246ff89625824405db54a3ce928b95c3a |
| --- /dev/null |
| +++ b/LayoutTests/vibration/cancelVibration-during-pattern-vibrating.html |
| @@ -0,0 +1,37 @@ |
| +<html> |
| +<head> |
| +<script src="../fast/js/resources/js-test-pre.js"></script> |
| +</head> |
| +<body> |
| +<script> |
| +description('Tests the cancelVibration during pattern vibration is working.'); |
| + |
| +var count = 0; |
| +var cancelingTime = 80; |
| + |
| +if (window.testRunner) { |
| + function vibrate() { |
| + 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
|
| + shouldBeTrue('internals.isVibrating()'); |
| + cancelVibration(cancelingTime + count * 100); |
| + } |
| + |
| + function cancelVibration(time) { |
| + 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.
|
| + navigator.vibrate(0); |
| + shouldBeFalse('internals.isVibrating()'); |
| + if (count++ == 2) |
| + finishJSTest(); |
| + vibrate(); |
| + }, time); |
| + } |
| + |
| + shouldBeFalse('internals.isVibrating()'); |
| + vibrate(); |
| + window.jsTestIsAsync = true; |
| +} 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.
|
| + debug('This test can not be run without the TestRunner'); |
| +</script> |
| +<script src="../fast/js/resources/js-test-post.js"></script> |
| +</body> |
| +</html> |