OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | |
3 <head> | |
4 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
5 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="resources/helper.js"></script> |
| 5 <iframe allow="vibrate"></iframe> |
6 <script> | 6 <script> |
7 if (window.testRunner) { | 7 var srcs = [ |
8 testRunner.dumpAsText(); | 8 "resources/feature-policy-vibrate.html", |
9 testRunner.dumpChildFramesAsText(); | 9 "http://localhost:8000/feature-policy-experimental-features/resources/feature-
policy-vibrate.html"]; |
10 } | |
11 | 10 |
12 function loaded() { | 11 window.onload = function () { |
13 var iframes = document.getElementsByTagName('iframe'); | 12 var iframe = document.querySelector('iframe'); |
14 for (var i = 0; i < iframes.length; ++i) { // < 1; ++i) { // | 13 iframe.addEventListener('load', sendClick); |
15 var iframe = iframes[i]; | 14 function loadFrame(src) { |
16 // The iframe uses eventSender to emulate a user navigatation, which require
s absolute coordinates. | 15 promise_test(function() { |
17 iframe.contentWindow.postMessage({x: iframe.offsetLeft, y: iframe.offsetTop}
, "*"); | 16 iframe.src = src; |
| 17 return new Promise(function(resolve, reject) { |
| 18 window.addEventListener('message', function(e) { |
| 19 if (e.data.type === 'result') { |
| 20 resolve(e.data); |
| 21 } |
| 22 }); |
| 23 }).then(function(data) { |
| 24 assert_true(data.enabled, 'navigator.vibrate():'); |
| 25 }); |
| 26 }, 'Navigator.vibrate enabled by container policy on URL: ' + src); |
| 27 } |
| 28 for (var src of srcs) { |
| 29 loadFrame(src); |
18 } | 30 } |
19 } | 31 } |
20 </script> | 32 </script> |
21 </head> | |
22 <body onload="loaded();"> | |
23 <iframe id="f1" src="resources/feature-policy-vibrate-enabled.html" allow="vibra
te"></iframe> | |
24 <iframe id="f2" src="http://localhost:8000/feature-policy/feature-policy-vibrate
-enabled.html" allow="vibrate"></iframe> | |
25 </body> | |
26 </html> | |
OLD | NEW |