OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/feature_policy/FeaturePolicy.h" | 5 #include "platform/feature_policy/FeaturePolicy.h" |
6 | 6 |
7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 // Origin strings used for tests | 10 // Origin strings used for tests |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 EXPECT_EQ(WebFeaturePolicyFeature::Payment, parsedPolicy[2].feature); | 112 EXPECT_EQ(WebFeaturePolicyFeature::Payment, parsedPolicy[2].feature); |
113 EXPECT_FALSE(parsedPolicy[2].matchesAllOrigins); | 113 EXPECT_FALSE(parsedPolicy[2].matchesAllOrigins); |
114 EXPECT_EQ(1UL, parsedPolicy[2].origins.size()); | 114 EXPECT_EQ(1UL, parsedPolicy[2].origins.size()); |
115 EXPECT_TRUE(m_originA->isSameSchemeHostPortAndSuborigin( | 115 EXPECT_TRUE(m_originA->isSameSchemeHostPortAndSuborigin( |
116 parsedPolicy[2].origins[0].get())); | 116 parsedPolicy[2].origins[0].get())); |
117 } | 117 } |
118 | 118 |
119 TEST_F(FeaturePolicyTest, ParseEmptyContainerPolicy) { | 119 TEST_F(FeaturePolicyTest, ParseEmptyContainerPolicy) { |
120 WebParsedFeaturePolicy containerPolicy = | 120 WebParsedFeaturePolicy containerPolicy = |
121 getContainerPolicyFromAllowedFeatures( | 121 getContainerPolicyFromAllowedFeatures( |
122 std::vector<WebFeaturePolicyFeature>({}), m_originA.get()); | 122 std::vector<WebFeaturePolicyFeature>({}), false, false, |
| 123 m_originA.get()); |
123 EXPECT_EQ(0UL, containerPolicy.size()); | 124 EXPECT_EQ(0UL, containerPolicy.size()); |
124 } | 125 } |
125 | 126 |
126 TEST_F(FeaturePolicyTest, ParseContainerPolicy) { | 127 TEST_F(FeaturePolicyTest, ParseContainerPolicy) { |
127 WebParsedFeaturePolicy containerPolicy = | 128 WebParsedFeaturePolicy containerPolicy = |
128 getContainerPolicyFromAllowedFeatures( | 129 getContainerPolicyFromAllowedFeatures( |
129 std::vector<WebFeaturePolicyFeature>( | 130 std::vector<WebFeaturePolicyFeature>( |
130 {WebFeaturePolicyFeature::Vibrate, | 131 {WebFeaturePolicyFeature::Vibrate, |
131 WebFeaturePolicyFeature::Payment}), | 132 WebFeaturePolicyFeature::Payment}), |
132 m_originA.get()); | 133 false, false, m_originA.get()); |
133 EXPECT_EQ(2UL, containerPolicy.size()); | 134 EXPECT_EQ(2UL, containerPolicy.size()); |
134 EXPECT_EQ(WebFeaturePolicyFeature::Vibrate, containerPolicy[0].feature); | 135 EXPECT_EQ(WebFeaturePolicyFeature::Vibrate, containerPolicy[0].feature); |
135 EXPECT_FALSE(containerPolicy[0].matchesAllOrigins); | 136 EXPECT_FALSE(containerPolicy[0].matchesAllOrigins); |
136 EXPECT_EQ(1UL, containerPolicy[0].origins.size()); | 137 EXPECT_EQ(1UL, containerPolicy[0].origins.size()); |
137 EXPECT_TRUE(m_originA->isSameSchemeHostPortAndSuborigin( | 138 EXPECT_TRUE(m_originA->isSameSchemeHostPortAndSuborigin( |
138 containerPolicy[0].origins[0].get())); | 139 containerPolicy[0].origins[0].get())); |
139 EXPECT_EQ(WebFeaturePolicyFeature::Payment, containerPolicy[1].feature); | 140 EXPECT_EQ(WebFeaturePolicyFeature::Payment, containerPolicy[1].feature); |
140 EXPECT_FALSE(containerPolicy[1].matchesAllOrigins); | 141 EXPECT_FALSE(containerPolicy[1].matchesAllOrigins); |
141 EXPECT_EQ(1UL, containerPolicy[1].origins.size()); | 142 EXPECT_EQ(1UL, containerPolicy[1].origins.size()); |
142 EXPECT_TRUE(m_originA->isSameSchemeHostPortAndSuborigin( | 143 EXPECT_TRUE(m_originA->isSameSchemeHostPortAndSuborigin( |
143 containerPolicy[1].origins[0].get())); | 144 containerPolicy[1].origins[0].get())); |
144 } | 145 } |
145 | 146 |
146 } // namespace blink | 147 } // namespace blink |
OLD | NEW |