Index: third_party/WebKit/LayoutTests/http/tests/feature-policy/resources/feature-policy-vibrate-enabled.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/feature-policy/resources/feature-policy-vibrate-enabled.html b/third_party/WebKit/LayoutTests/http/tests/feature-policy/resources/feature-policy-vibrate-enabled.html |
index 81d57692cb5f314a039e16df4052865a942c0faa..7ca7d9844669dc9dbadb3168b37612250cd01b46 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/feature-policy/resources/feature-policy-vibrate-enabled.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/feature-policy/resources/feature-policy-vibrate-enabled.html |
@@ -1,11 +1,26 @@ |
<!DOCTYPE html> |
<head> |
- <title>Feature-Policy Vibrate Enabled</title> |
- <script src="/resources/testharness.js"></script> |
- <script src="/resources/testharnessreport.js"></script> |
-</head> |
+<title>Feature-Policy Vibrate Enabled</title> |
+<script src="/resources/testharness.js"></script> |
+<script src="/resources/testharnessreport.js"></script> |
+<script src="/js-test-resources/user-gesture-utils.js"></script> |
<script> |
- test(function() { |
- assert_true(navigator.vibrate(200)); |
+ |
+function startTest(event) { |
+ // Simulates a user click for vibrate to be allowed. |
+ // See: https://www.chromestatus.com/feature/5644273861001216. |
+ simulateUserClick('test', event); |
+} |
+ |
+function testVibrate() { |
+ test(function () { |
+ assert_true(navigator.vibrate(200)); |
}, 'Any iframe may call navigator.vibrate when enabled.'); |
+} |
+ |
+window.addEventListener("message", startTest, false); |
</script> |
+<body> |
+<button id="test" onclick="testVibrate();">Click to vibrate</button> |
+</body> |
+</html> |