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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/vibration/vibrate-on-top-page-before-during-after-user-gesture.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 <title>Testing vibrate 3 times on the top page</title>
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 function startTest()
9 {
10 test(function() {
11 assert_true(
12 navigator.vibrate(200),
13 "1. Vibrate w/o user gesture is deprecated and will be blocked in M60.");
14 });
15
16 // A manual click should enable vibrate.
17 var element = document.getElementById("test");
18 simulateUserClick(element.offsetLeft + 2, element.offsetTop + 2);
19 performTestWithClick();
20 }
21
22 function performTestWithClick()
23 {
24 test(function () {
25 assert_true(
26 navigator.vibrate(200),
27 "2. Vibrate triggered by user gesture succeeded.");
28 });
29 window.requestAnimationFrame(performTestAfterClick);
30 }
31
32 function performTestAfterClick()
33 {
34 test(function () {
35 assert_true(
36 navigator.vibrate(200),
37 "3. Vibrate after user gesture succeeded.");
38 });
39 }
40 </script>
41 </head>
42 <body onload="startTest();">
43 <button id="test">Click to vibrate</button>
44 </body>
45 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698