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

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

Issue 2767983003: Initial Implementation of Iframe Attribute for Feature Policy (Part 4) (Closed)
Patch Set: Added container policy tests for vibrate 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/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 f3dfdb035398e808810f1ab2726435ed3d683922..38957c9c56bcd6a631f218618f1bd292414002e3 100644
--- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp
+++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp
@@ -127,7 +127,8 @@ TEST_F(FeaturePolicyTest, PolicyParsedCorrectly) {
TEST_F(FeaturePolicyTest, ParseEmptyContainerPolicy) {
WebParsedFeaturePolicy container_policy =
GetContainerPolicyFromAllowedFeatures(
- std::vector<WebFeaturePolicyFeature>({}), origin_a_.Get());
+ std::vector<WebFeaturePolicyFeature>({}), false, false,
+ origin_a_.Get());
EXPECT_EQ(0UL, container_policy.size());
}
@@ -137,7 +138,7 @@ TEST_F(FeaturePolicyTest, ParseContainerPolicy) {
std::vector<WebFeaturePolicyFeature>(
{WebFeaturePolicyFeature::kVibrate,
WebFeaturePolicyFeature::kPayment}),
- origin_a_.Get());
+ false, false, origin_a_.Get());
EXPECT_EQ(2UL, container_policy.size());
EXPECT_EQ(WebFeaturePolicyFeature::kVibrate, container_policy[0].feature);
EXPECT_FALSE(container_policy[0].matches_all_origins);
@@ -151,4 +152,26 @@ TEST_F(FeaturePolicyTest, ParseContainerPolicy) {
container_policy[1].origins[0].Get()));
}
+TEST_F(FeaturePolicyTest, ParseContainerPolicyWithAllowAttributes) {
iclelland 2017/04/25 17:19:55 Can you add two more similar tests here? One where
+ WebParsedFeaturePolicy container_policy =
+ GetContainerPolicyFromAllowedFeatures(
+ std::vector<WebFeaturePolicyFeature>(
+ {WebFeaturePolicyFeature::kVibrate,
+ WebFeaturePolicyFeature::kPayment}),
+ true, true, origin_a_.Get());
+ EXPECT_EQ(3UL, container_policy.size());
+ EXPECT_EQ(WebFeaturePolicyFeature::kPayment, container_policy[0].feature);
+ EXPECT_FALSE(container_policy[0].matches_all_origins);
+ EXPECT_EQ(1UL, container_policy[0].origins.size());
+ EXPECT_TRUE(origin_a_->IsSameSchemeHostPortAndSuborigin(
+ container_policy[0].origins[0].Get()));
+ EXPECT_EQ(WebFeaturePolicyFeature::kFullscreen, container_policy[1].feature);
+ EXPECT_TRUE(container_policy[1].matches_all_origins);
+ EXPECT_EQ(WebFeaturePolicyFeature::kVibrate, container_policy[2].feature);
+ EXPECT_FALSE(container_policy[2].matches_all_origins);
+ EXPECT_EQ(1UL, container_policy[2].origins.size());
+ EXPECT_TRUE(origin_a_->IsSameSchemeHostPortAndSuborigin(
+ container_policy[2].origins[0].Get()));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698