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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-vibrate-with-user-gesture-allowed.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
(Empty)
1 <html>
2 <head>
3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script>
5 <script>
6 var test = async_test(
7 "Testing vibrate 3 times in a x-origin iframe: " +
8 " 1. blocked before user gesture;" +
9 " 2. succeed during the click event;" +
10 " 3. succeed after user click.");
11 function loaded()
12 {
13 document.getElementsByTagName('h4')[0].innerHTML = document.domain;
14 }
15
16 function startTest(event)
17 {
18 // A manual click should navigate.
19 if (window.eventSender) {
20 var button = document.getElementById("b");
21 eventSender.mouseMoveTo(button.offsetLeft + event.data.x + 2, bu tton.offsetTop + event.data.y + 2);
22 test.step(function() {
23 assert_false(
24 navigator.vibrate(200),
25 "1. Blocked vibrate before user gesture.");
26 });
27
28 eventSender.mouseDown();
29 eventSender.mouseUp();
30 }
31 }
32
33 function performTestAfterClick()
34 {
35 test.step(function () {
36 assert_true(
37 navigator.vibrate(200),
38 "3. Vibrate after user gesture succeeded.");
39 });
40 test.done();
41 }
42
43 function performTestWithClick()
44 {
45 test.step(function () {
46 assert_true(
47 navigator.vibrate(200),
48 "2. Vibrate triggered by user gesture succeeded.");
49 });
50 window.requestAnimationFrame(performTestAfterClick);
51 }
52
53 window.addEventListener("message", startTest, false);
54 </script>
55 </head>
56 <body onload="loaded();">
57 <h4>DOMAIN</h4>
58 <button id="b" onclick="performTestWithClick();">Perform Test</button>
59 </body>
60 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698