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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/vibration/resources/vibrate-with-user-gesture-allowed.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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <script src="/js-test-resources/user-gesture-utils.js"></script>
7 <script>
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 eventSender.mouseMoveTo(element.offsetLeft + event.data.x + 2, element.offsetT op + event.data.y + 2);
14 eventSender.mouseDown();
15 eventSender.mouseUp();
mustaq 2017/04/13 19:05:04 Nuke eventSender.{mouseMoveTo,mosueDown,mouseUp} c
binlu 2017/04/13 19:55:27 Done.
16
17 simulateUserClick(element.offsetLeft + event.data.x + 2, element.offsetTop + e vent.data.y + 2);
18 }
19
20 function testVibrate() {
21 test(function () {
22 assert_true(navigator.vibrate(200));
23 }, "An iframe may call navigator.vibrate with user gesture.");
24 }
25
26 window.addEventListener("message", startTest, false);
27 </script>
28 </head>
29 <body>
30 <button id="test" onclick="testVibrate();">Click to vibrate</button>
31 </body>
32 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698