| Index: third_party/WebKit/LayoutTests/http/tests/security/vibration/vibrate-on-top-page-before-during-after-user-gesture.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/vibration/vibrate-on-top-page-before-during-after-user-gesture.html
|
| similarity index 67%
|
| rename from third_party/WebKit/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-vibrate-with-user-gesture-allowed.html
|
| rename to third_party/WebKit/LayoutTests/http/tests/security/vibration/vibrate-on-top-page-before-during-after-user-gesture.html
|
| index 2e17ce2a6cdcb1aa8038ce16fcf0cbb6b0d9d696..b38637b906f3f4085ac758549f8ab81feab62114 100644
|
| --- 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/vibration/vibrate-on-top-page-before-during-after-user-gesture.html
|
| @@ -4,42 +4,28 @@
|
| <script src="/resources/testharnessreport.js"></script>
|
| <script>
|
| var test = async_test(
|
| - "Testing vibrate 3 times in a x-origin iframe: " +
|
| + "Testing vibrate 3 times on the top page: " +
|
| " 1. blocked before user gesture;" +
|
| " 2. succeed during the click event;" +
|
| " 3. succeed after user click.");
|
| - function loaded()
|
| + function startTest()
|
| {
|
| - 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);
|
| + var button = document.getElementById("test");
|
| + eventSender.mouseMoveTo(button.offsetLeft + 2, button.offsetTop + 2);
|
| test.step(function() {
|
| assert_false(
|
| navigator.vibrate(200),
|
| "1. Blocked vibrate before user gesture.");
|
| });
|
|
|
| + // A manual click should enable vibrate.
|
| eventSender.mouseDown();
|
| eventSender.mouseUp();
|
| + performTestWithClick();
|
| }
|
| }
|
|
|
| - function performTestAfterClick()
|
| - {
|
| - test.step(function () {
|
| - assert_true(
|
| - navigator.vibrate(200),
|
| - "3. Vibrate after user gesture succeeded.");
|
| - });
|
| - test.done();
|
| - }
|
| -
|
| function performTestWithClick()
|
| {
|
| test.step(function () {
|
| @@ -50,11 +36,18 @@
|
| window.requestAnimationFrame(performTestAfterClick);
|
| }
|
|
|
| - window.addEventListener("message", startTest, false);
|
| + function performTestAfterClick()
|
| + {
|
| + test.step(function () {
|
| + assert_true(
|
| + navigator.vibrate(200),
|
| + "3. Vibrate after user gesture succeeded.");
|
| + });
|
| + test.done();
|
| + }
|
| </script>
|
| </head>
|
| -<body onload="loaded();">
|
| - <h4>DOMAIN</h4>
|
| - <button id="b" onclick="performTestWithClick();">Perform Test</button>
|
| +<body onload="startTest();">
|
| + <button id="test">Click to vibrate</button>
|
| </body>
|
| </html>
|
|
|