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

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: refactor SimulateUserClick 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 <script src="../../resources/testharness.js"></script>
mustaq 2017/04/13 19:05:04 Add a <title>?
binlu 2017/04/18 15:48:29 Done.
3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="../../resources/user-gesture-utils.js"></script>
2 <script> 5 <script>
3 'use strict'; 6 'use strict';
4 7
5 navigator.vibrate(1234); 8 function startTest() {
9 if (window.eventSender) {
10 var iframes = window.parent.document.getElementsByTagName('iframe');
11 // The last iframe.
12 var iframe = iframes[iframes.length-1];
13 var element = document.getElementById("test");
14 simulateUserClick(element.offsetLeft + iframe.offsetLeft + 2, element.offset Top + iframe.offsetTop + 2);
15 }
16 }
6 17
18 function testVibrate() {
19 test(function () {
20 assert_true(navigator.vibrate(200));
21 }, "An iframe may call navigator.vibrate with user gesture.");
22 }
7 </script> 23 </script>
24 <body onload="startTest();">
25 <button id="test" onclick="testVibrate();">Click to vibrate</button>
26 </body>
27 </html>
28
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698