| Index: third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/vibrate-enabledforall.php
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/vibrate-enabledforall.php b/third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/vibrate-enabledforall.php
|
| index 0fcaee73b87d4836b59ba1d9b27d7fa692f7dff0..b7b9db2c30d77b27abb5e4aa100e14c6093100b8 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/vibrate-enabledforall.php
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/vibrate-enabledforall.php
|
| @@ -10,28 +10,39 @@ Header("Feature-Policy: {\"vibrate\": [\"*\"]}");
|
| ?>
|
|
|
| <!DOCTYPE html>
|
| -<html>
|
| -<head>
|
| <script src="../../resources/testharness.js"></script>
|
| <script src="../../resources/testharnessreport.js"></script>
|
| +<iframe></iframe>
|
| <script>
|
| -if (window.testRunner) {
|
| - testRunner.dumpAsText();
|
| - testRunner.dumpChildFramesAsText();
|
| +var srcs = [
|
| + "resources/feature-policy-vibrate.html",
|
| + "http://localhost:8000/feature-policy-experimental-features/resources/feature-policy-vibrate.html"];
|
| +
|
| +function sendClick() {
|
| + // The iframe uses eventSender to emulate a user navigatation, which requires
|
| + // absolute coordinates.
|
| + this.contentWindow.postMessage({x: this.offsetLeft, y: this.offsetTop}, "*");
|
| }
|
|
|
| -function loaded() {
|
| - var iframes = document.getElementsByTagName('iframe');
|
| - for (var i = 0; i < iframes.length; ++i) {
|
| - var iframe = iframes[i];
|
| - // The iframe uses eventSender to emulate a user navigatation, which requires absolute coordinates.
|
| - iframe.contentWindow.postMessage({x: iframe.offsetLeft, y: iframe.offsetTop}, "*");
|
| +window.onload = function () {
|
| + var iframe = document.querySelector('iframe');
|
| + iframe.addEventListener('load', sendClick);
|
| + function loadFrame(src) {
|
| + promise_test(function() {
|
| + iframe.src = src;
|
| + return new Promise(function(resolve, reject) {
|
| + window.addEventListener('message', function(e) {
|
| + if (e.data.type === 'result') {
|
| + resolve(e.data);
|
| + }
|
| + });
|
| + }).then(function(data) {
|
| + assert_true(data.enabled, 'navigator.vibrate():');
|
| + });
|
| + }, 'Navigator.vibrate enabled for all on URL: ' + src);
|
| + }
|
| + for (var src of srcs) {
|
| + loadFrame(src);
|
| }
|
| }
|
| </script>
|
| -</head>
|
| -<body onload="loaded();">
|
| -<iframe id="f1" src="resources/feature-policy-vibrate-enabled.html"></iframe>
|
| -<iframe id="f2" src="http://localhost:8000/feature-policy-experimental-features/resources/feature-policy-vibrate-enabled.html"></iframe>
|
| -</body>
|
| -</html>
|
|
|