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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/feature-policy-experimental-features/vibrate-allowed-by-container-policy.html

Issue 2855133004: Re-enable feature policy layout tests after bug fix. (Closed)
Patch Set: Rebased FlagExpectations/site-per-process Created 3 years, 8 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
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..6be5b10449031a3a9f5b1323b50c916fab4876c1 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,37 @@
<!DOCTYPE html>
-<html>
-<head>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.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 sendClick() {
iclelland 2017/05/18 19:40:59 This function could probably be moved into a littl
lunalu1 2017/05/19 20:54:08 Done
+ // 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) { // < 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);
iclelland 2017/05/18 19:36:12 Will/could this set the iframe src attribute a sec
iclelland 2017/05/18 19:56:58 I had a look, to re-learn how promise_test worked,
lunalu1 2017/05/19 20:54:08 :)
}
}
</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>

Powered by Google App Engine
This is Rietveld 408576698