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 |