<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/js-test-resources/user-gesture-utils.js"></script>
<script>
function startTest(event) {
// Simulates a user click for vibrate to be allowed.
var element = document.getElementById("test");
simulateUserClick(element.offsetLeft + event.data.x + 2, element.offsetTop + event.data.y + 2);
}
function testVibrate() {
test(function () {
assert_true(navigator.vibrate(200));
}, "An iframe may call navigator.vibrate with user gesture.");
}
window.addEventListener("message", startTest, false);
</script>
</head>
<body>
<button id="test" onclick="testVibrate();">Click to vibrate</button>
</body>
</html>