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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/security/vibration/resources/vibrate-with-user-gesture-allowed.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/vibration/resources/vibrate-with-user-gesture-allowed.html b/third_party/WebKit/LayoutTests/http/tests/security/vibration/resources/vibrate-with-user-gesture-allowed.html
new file mode 100644
index 0000000000000000000000000000000000000000..4dcbe74fa914a74e6df553451117969437b98bed
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/vibration/resources/vibrate-with-user-gesture-allowed.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/js-test-resources/user-gesture-utils.js"></script>
+<script>
+
+function startTest(event) {
+ // Simulates a user click for vibrate to be allowed.
+ // See: https://www.chromestatus.com/feature/5644273861001216.
+ simulateUserClick('test', event);
+}
+
+function testVibrate() {
+ test(function () {
+ assert_true(navigator.vibrate(200));
+ }, "An iframe may call navigator.vibrate with user gesture.");
+}
+
+window.addEventListener("message", startTest, false);
+</script>
+</head>
+<body>
+<button id="test" onclick="testVibrate();">Click to vibrate</button>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698