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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-enabledforself.php

Issue 2499373002: Implementation for feature policy - fullscreen (Closed)
Patch Set: Bug fix: handling the case when frame parent does not exist Created 4 years 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/fullscreen-enabledforself.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-enabledforself.php b/third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-enabledforself.php
new file mode 100644
index 0000000000000000000000000000000000000000..422961320880aca98568ca6cfd8f5625acd88637
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/feature-policy/fullscreen-enabledforself.php
@@ -0,0 +1,49 @@
+<?php
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This test ensures that fullscreen feature when enabled for self only works
+// in the same orgin but not cross origins when allowfullscreen is set. No
+// iframe may call it when allowfullscreen is not set.
+
+Header("Feature-Policy: {\"fullscreen\": [\"self\"]}");
+?>
+
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<iframe id="f1"></iframe>
+<iframe id="f2" allowfullscreen></iframe>
+<script>
+var srcs = [
+ "resources/feature-policy-fullscreen.html",
+ "http://localhost:8000/feature-policy/resources/feature-policy-fullscreen.html"
+];
+var f1 = document.getElementById('f1');
+var f2 = document.getElementById('f2');
+
+function loadFrames(iframe) {
+ for (var src of srcs) {
+ promise_test(function(t) {
+ iframe.src = src;
+ return new Promise(function(resolve, reject) {
+ window.addEventListener('message', function(e) {
+ resolve(e.data);
+ }, { once: true });
+ }).then(function(data) {
+ if (src === srcs[0] || iframe.id === "f2") {
+ assert_true(data.enabled, 'Document.fullscreenEnabled:');
+ assert_equals(data.type, 'change', 'Document.requestFullscreen():');
+ } else {
+ assert_false(data.enabled, 'Document.fullscreenEnabled:');
+ assert_equals(data.type, 'error', 'Document.requestFullscreen():');
+ }
+ });
+ }, 'Fullscreen enabled for self on URL: ' + src + ' with allowfullscreen = ' + iframe.allowFullscreen);
+ }
+}
+
+loadFrames(f1);
+loadFrames(f2);
+</script>

Powered by Google App Engine
This is Rietveld 408576698