Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: third_party/WebKit/LayoutTests/vibration/resources/vibrate-from-iframe.html

Issue 2778693004: Remove navigator.vibrate without user gesture. (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <head>
3 <title>Test vibrate with user gesture in same-origin iframe</title>
4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 <script src="../../resources/user-gesture-utils.js"></script>
2 <script> 7 <script>
3 'use strict'; 8 'use strict';
4 9
5 navigator.vibrate(1234); 10 function startTest() {
11 if (window.eventSender) {
12 var iframes = window.parent.document.getElementsByTagName('iframe');
13 // The last iframe.
14 var iframe = iframes[iframes.length-1];
15 // Simulates a user click for vibrate to be allowed.
16 var element = document.getElementById("test");
17 simulateUserClick(element.offsetLeft + iframe.offsetLeft + 2, element.offset Top + iframe.offsetTop + 2);
18 }
19 }
6 20
21 function testVibrate() {
22 test(function () {
23 assert_true(navigator.vibrate(200));
24 }, "An iframe may call navigator.vibrate with user gesture.");
25 }
7 </script> 26 </script>
27 </head>
28 <body onload="startTest();">
29 <button id="test" onclick="testVibrate();">Click to vibrate</button>
30 </body>
31 </html>
32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698