Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/vibration/resources/vibrate-from-iframe.html |
| diff --git a/third_party/WebKit/LayoutTests/vibration/resources/vibrate-from-iframe.html b/third_party/WebKit/LayoutTests/vibration/resources/vibrate-from-iframe.html |
| index 4bcf5f5895993c96940a697cc217f09086e45317..7507340d196a5156b976be402461a7699c01fd1f 100644 |
| --- a/third_party/WebKit/LayoutTests/vibration/resources/vibrate-from-iframe.html |
| +++ b/third_party/WebKit/LayoutTests/vibration/resources/vibrate-from-iframe.html |
| @@ -1,7 +1,28 @@ |
| <!DOCTYPE html> |
| +<script src="../../resources/testharness.js"></script> |
|
mustaq
2017/04/13 19:05:04
Add a <title>?
binlu
2017/04/18 15:48:29
Done.
|
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script src="../../resources/user-gesture-utils.js"></script> |
| <script> |
| 'use strict'; |
| -navigator.vibrate(1234); |
| +function startTest() { |
| + if (window.eventSender) { |
| + var iframes = window.parent.document.getElementsByTagName('iframe'); |
| + // The last iframe. |
| + var iframe = iframes[iframes.length-1]; |
| + var element = document.getElementById("test"); |
| + simulateUserClick(element.offsetLeft + iframe.offsetLeft + 2, element.offsetTop + iframe.offsetTop + 2); |
| + } |
| +} |
| +function testVibrate() { |
| + test(function () { |
| + assert_true(navigator.vibrate(200)); |
| + }, "An iframe may call navigator.vibrate with user gesture."); |
| +} |
| </script> |
| +<body onload="startTest();"> |
| +<button id="test" onclick="testVibrate();">Click to vibrate</button> |
| +</body> |
| +</html> |
| + |