blob: 3e9d33d5af94150a8153dd8f730d059cec2f135f [file] [log] [blame]
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description('Tests the cancelVibration after changing the value of pageVisibility to hidden.');
var visibilityState = document.visibilityState;
document.addEventListener('visibilitychange', function(e) {
if (document.visibilityState == 'hidden')
navigator.vibrate(0);
shouldBeFalse('internals.isVibrating()');
testRunner.setPageVisibility(visibilityState);
finishJSTest();
});
shouldBeFalse('internals.isVibrating()');
navigator.vibrate(10000);
if (window.testRunner) {
setTimeout(function() {
shouldBeTrue('internals.isVibrating()');
testRunner.setPageVisibility('hidden');
}, 0);
} else
debug('This test can not be run without the TestRunner');
window.jsTestIsAsync = true;
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>