OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <head> | 2 <head> |
3 <title>Feature-Policy Vibrate Disabled</title> | 3 <title>Feature-Policy Vibrate Disabled</title> |
4 <script src="/resources/testharness.js"></script> | 4 <script src="/resources/testharness.js"></script> |
5 <script src="/resources/testharnessreport.js"></script> | 5 <script src="/resources/testharnessreport.js"></script> |
6 </head> | 6 <script src="/js-test-resources/user-gesture-utils.js"></script> |
7 <script> | 7 <script> |
8 test(function() { | 8 |
| 9 function startTest(event) { |
| 10 // Simulates a user click for vibrate to be allowed. |
| 11 // See: https://www.chromestatus.com/feature/5644273861001216. |
| 12 var element = document.getElementById("test"); |
| 13 simulateUserClick(element.offsetLeft + event.data.x + 2, element.offsetTop + e
vent.data.y + 2); |
| 14 } |
| 15 |
| 16 function testVibrate() { |
| 17 test(function () { |
9 assert_false(navigator.vibrate(200)); | 18 assert_false(navigator.vibrate(200)); |
10 }, 'No iframe may call navigator.vibrate when disabled.'); | 19 }, 'No iframe may call navigator.vibrate when disabled.'); |
| 20 } |
| 21 |
| 22 window.addEventListener("message", startTest, true); |
11 </script> | 23 </script> |
| 24 <body> |
| 25 <button id="test" onclick="testVibrate();">Click to vibrate</button> |
| 26 |
OLD | NEW |