| Index: third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/vibrate-allowed-by-container-policy.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/vibrate-allowed-by-container-policy.html b/third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/vibrate-allowed-by-container-policy.html
|
| index 13a7112406c7dcfd5b037744824a22ec8174d13d..20b64b46976299d67deb8c796875d44220fd54db 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/vibrate-allowed-by-container-policy.html
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/vibrate-allowed-by-container-policy.html
|
| @@ -1,26 +1,32 @@
|
| <!DOCTYPE html>
|
| -<html>
|
| -<head>
|
| <script src="../../resources/testharness.js"></script>
|
| <script src="../../resources/testharnessreport.js"></script>
|
| +<script src="resources/helper.js"></script>
|
| +<iframe allow="vibrate"></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 loaded() {
|
| - var iframes = document.getElementsByTagName('iframe');
|
| - for (var i = 0; i < iframes.length; ++i) { // < 1; ++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 by container policy 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" allow="vibrate"></iframe>
|
| -<iframe id="f2" src="http://localhost:8000/feature-policy/feature-policy-vibrate-enabled.html" allow="vibrate"></iframe>
|
| -</body>
|
| -</html>
|
|
|