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

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

Powered by Google App Engine
This is Rietveld 408576698