Index: third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/resources/feature-policy-vibrate.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/resources/feature-policy-vibrate.html b/third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/resources/feature-policy-vibrate.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ac1781d2e8df0f160dec4b9d1d3347c2bd2191cf |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/resources/feature-policy-vibrate.html |
@@ -0,0 +1,26 @@ |
+<!DOCTYPE html> |
+<title>Feature-Policy Vibrate</title> |
+<script src="/js-test-resources/user-gesture-utils.js"></script> |
+<button id="test">Click to vibrate</button> |
+<script> |
+function startTest(event) { |
+ // Simulates a user click for vibrate to be allowed. |
+ var element = document.getElementById('test'); |
+ document.querySelector('button').addEventListener('click', testVibrate); |
+ simulateUserClick(element.offsetLeft + event.data.x + 2, |
+ element.offsetTop + event.data.y + 2); |
+} |
+ |
+function testVibrate() { |
+ if (navigator.vibrate(200)) { |
+ parent.postMessage({ type: 'result', enabled: true }, '*'); |
+ } else { |
+ parent.postMessage({ type: 'result', enabled: false }, '*'); |
+ } |
+} |
+ |
+window.addEventListener('message', startTest, true); |
+window.addEventListener('load', function() { |
+ parent.postMessage({ type: 'onload'}, '*'); |
+}); |
+</script> |