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

Unified Diff: third_party/WebKit/Source/core/html/HTMLFrameElementTest.cpp

Issue 2923563003: Move container policy logic to frame owner classes. (Closed)
Patch Set: Addressing nits Created 3 years, 6 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/Source/core/html/HTMLFrameElementTest.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLFrameElementTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..68f4809fe24e9a49d621edd1983ef80d83d4774f
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/HTMLFrameElementTest.cpp
@@ -0,0 +1,37 @@
+// Copyright 2017 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.
+
+#include "core/html/HTMLFrameElement.h"
+
+#include "core/dom/Document.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+class HTMLFrameElementTest : public ::testing::Test {};
+
+// Test that the correct container policy is constructed on a frame element.
+// Frame elements do not have any container-policy related attributes, but the
+// fullscreen feature should be unconditionally disabled.
+TEST_F(HTMLFrameElementTest, DefaultContainerPolicy) {
+ Document* document = Document::Create();
+ KURL document_url = KURL(KURL(), "http://example.com");
+ document->SetURL(document_url);
+ document->UpdateSecurityOrigin(SecurityOrigin::Create(document_url));
+
+ HTMLFrameElement* frame_element = HTMLFrameElement::Create(*document);
+
+ frame_element->setAttribute(HTMLNames::srcAttr, "http://example.net/");
+ frame_element->UpdateContainerPolicyForTests();
+
+ const WebParsedFeaturePolicy& container_policy =
+ frame_element->ContainerPolicy();
+ EXPECT_EQ(1UL, container_policy.size());
+ // Fullscreen should be disabled in this frame
+ EXPECT_EQ(WebFeaturePolicyFeature::kFullscreen, container_policy[0].feature);
+ EXPECT_FALSE(container_policy[0].matches_all_origins);
+ EXPECT_EQ(0UL, container_policy[0].origins.size());
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698