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

Unified Diff: third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp

Issue 2739203002: Initial Implementation of Iframe Attribute for Feature Policy (Part 3) (Closed)
Patch Set: Bug fix: frame owner does not always exist. Created 3 years, 9 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/platform/feature_policy/FeaturePolicyTest.cpp
diff --git a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp
index 1924f0679906cd74fded939532760fcf7d911159..ae8756b514b6584346bf7eedf90de0140587949b 100644
--- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp
+++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp
@@ -116,4 +116,31 @@ TEST_F(FeaturePolicyTest, PolicyParsedCorrectly) {
parsedPolicy[2].origins[0].get()));
}
+TEST_F(FeaturePolicyTest, ParseEmptyContainerPolicy) {
+ WebParsedFeaturePolicy containerPolicy =
+ getContainerPolicyFromAllowedFeatures(
+ std::vector<WebFeaturePolicyFeature>({}), m_originA.get());
+ EXPECT_EQ(0UL, containerPolicy.size());
+}
+
+TEST_F(FeaturePolicyTest, ParseContainerPolicy) {
+ WebParsedFeaturePolicy containerPolicy =
+ getContainerPolicyFromAllowedFeatures(
+ std::vector<WebFeaturePolicyFeature>(
+ {WebFeaturePolicyFeature::Vibrate,
+ WebFeaturePolicyFeature::Payment}),
+ m_originA.get());
+ EXPECT_EQ(2UL, containerPolicy.size());
+ EXPECT_EQ(WebFeaturePolicyFeature::Vibrate, containerPolicy[0].feature);
+ EXPECT_FALSE(containerPolicy[0].matchesAllOrigins);
+ EXPECT_EQ(1UL, containerPolicy[0].origins.size());
+ EXPECT_TRUE(m_originA->isSameSchemeHostPortAndSuborigin(
+ containerPolicy[0].origins[0].get()));
+ EXPECT_EQ(WebFeaturePolicyFeature::Payment, containerPolicy[1].feature);
+ EXPECT_FALSE(containerPolicy[1].matchesAllOrigins);
+ EXPECT_EQ(1UL, containerPolicy[1].origins.size());
+ EXPECT_TRUE(m_originA->isSameSchemeHostPortAndSuborigin(
+ containerPolicy[1].origins[0].get()));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698