Chromium Code Reviews| 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 27fb05b5e0208118044f4e55dc911f6db51f0ba5..40edbee12396e60e46fb1e6e9033cc54ee4fd93f 100644 |
| --- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp |
| +++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicyTest.cpp |
| @@ -675,7 +675,7 @@ TEST_F(FeaturePolicyTest, TestFeaturesAreIndependent) { |
| // | | +-------------+ | | |
| // | +-------------------------------------------+ | |
| // +-----------------------------------------------+ |
| - // Vibrate feature should be enabled in all frames; Docwrite feature |
| + // Default-self feature should be enabled in all frames; Default-on feature |
| // should be enabled in frame 1, and disabled in frames 2 and 3. |
| Vector<String> messages; |
| std::unique_ptr<FeaturePolicy> policy1 = |
| @@ -699,4 +699,25 @@ TEST_F(FeaturePolicyTest, TestFeaturesAreIndependent) { |
| EXPECT_FALSE(policy3->isFeatureEnabled(kDefaultOnFeature)); |
| } |
| +TEST_F(FeaturePolicyTest, TestFeatureEnabledForOrigin) { |
|
raymes
2016/11/16 02:55:39
Hmm - is this not covered by other tests?
iclelland
2016/11/16 04:41:04
Only implicitly; feature policy inheritance would
raymes
2016/11/16 23:10:14
Ah ok that makes sense!
|
| + // +-----------------------------------------------+ |
| + // |(1) Origin A | |
| + // |Policy: {"default-off": ["self", "Origin B"]} | |
| + // +-----------------------------------------------+ |
| + // Features should be enabled by the policy in frame 1 for origins A and B, |
| + // and disabled for origin c. |
|
raymes
2016/11/16 02:55:39
nit: C
raymes
2016/11/16 23:10:14
nit: C
iclelland
2016/11/17 04:13:32
Done.
|
| + Vector<String> messages; |
| + std::unique_ptr<FeaturePolicy> policy1 = |
| + createFromParentPolicy(nullptr, m_originA); |
| + policy1->setHeaderPolicy("{\"default-off\": [\"self\", \"" ORIGIN_B "\"]}", |
| + messages); |
| + EXPECT_EQ(0UL, messages.size()); |
| + EXPECT_TRUE( |
| + policy1->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originA)); |
| + EXPECT_TRUE( |
| + policy1->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originB)); |
| + EXPECT_FALSE( |
| + policy1->isFeatureEnabledForOrigin(kDefaultOffFeature, *m_originC)); |
| +} |
| + |
| } // namespace blink |