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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-vibrate-with-user-gesture-allowed.html

Issue 2642263006: Allow vibrate in cross-origin iframes with user gesture. (Closed)
Patch Set: git cl try Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/vibrate_in_cross_origin_iframe_blocked.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-vibrate-with-user-gesture-allowed.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-vibrate-with-user-gesture-allowed.html b/third_party/WebKit/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-vibrate-with-user-gesture-allowed.html
new file mode 100644
index 0000000000000000000000000000000000000000..2e17ce2a6cdcb1aa8038ce16fcf0cbb6b0d9d696
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-vibrate-with-user-gesture-allowed.html
@@ -0,0 +1,60 @@
+<html>
+<head>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script>
+ var test = async_test(
+ "Testing vibrate 3 times in a x-origin iframe: " +
+ " 1. blocked before user gesture;" +
+ " 2. succeed during the click event;" +
+ " 3. succeed after user click.");
+ function loaded()
+ {
+ document.getElementsByTagName('h4')[0].innerHTML = document.domain;
+ }
+
+ function startTest(event)
+ {
+ // A manual click should navigate.
+ if (window.eventSender) {
+ var button = document.getElementById("b");
+ eventSender.mouseMoveTo(button.offsetLeft + event.data.x + 2, button.offsetTop + event.data.y + 2);
+ test.step(function() {
+ assert_false(
+ navigator.vibrate(200),
+ "1. Blocked vibrate before user gesture.");
+ });
+
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+ }
+
+ function performTestAfterClick()
+ {
+ test.step(function () {
+ assert_true(
+ navigator.vibrate(200),
+ "3. Vibrate after user gesture succeeded.");
+ });
+ test.done();
+ }
+
+ function performTestWithClick()
+ {
+ test.step(function () {
+ assert_true(
+ navigator.vibrate(200),
+ "2. Vibrate triggered by user gesture succeeded.");
+ });
+ window.requestAnimationFrame(performTestAfterClick);
+ }
+
+ window.addEventListener("message", startTest, false);
+ </script>
+</head>
+<body onload="loaded();">
+ <h4>DOMAIN</h4>
+ <button id="b" onclick="performTestWithClick();">Perform Test</button>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/vibrate_in_cross_origin_iframe_blocked.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698