| 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 "content/common/feature_policy/feature_policy.h" | 5 #include "content/common/feature_policy/feature_policy.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "url/gurl.h" | 8 #include "url/gurl.h" |
| 9 | 9 |
| 10 // Origin strings used for tests | 10 // Origin strings used for tests |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 FeaturePolicyTest() | 50 FeaturePolicyTest() |
| 51 : featureList_({{kDefaultOnFeature, &kDefaultOnFeatureDfn}, | 51 : featureList_({{kDefaultOnFeature, &kDefaultOnFeatureDfn}, |
| 52 {kDefaultSelfFeature, &kDefaultSelfFeatureDfn}, | 52 {kDefaultSelfFeature, &kDefaultSelfFeatureDfn}, |
| 53 {kDefaultOffFeature, &kDefaultOffFeatureDfn}}) {} | 53 {kDefaultOffFeature, &kDefaultOffFeatureDfn}}) {} |
| 54 | 54 |
| 55 ~FeaturePolicyTest() override {} | 55 ~FeaturePolicyTest() override {} |
| 56 | 56 |
| 57 std::unique_ptr<FeaturePolicy> CreateFromParentPolicy( | 57 std::unique_ptr<FeaturePolicy> CreateFromParentPolicy( |
| 58 const FeaturePolicy* parent, | 58 const FeaturePolicy* parent, |
| 59 url::Origin origin) { | 59 url::Origin origin) { |
| 60 return FeaturePolicy::CreateFromParentPolicy(parent, origin, featureList_); | 60 return FeaturePolicy::CreateFromParentPolicy(parent, nullptr, origin, |
| 61 featureList_); |
| 61 } | 62 } |
| 62 | 63 |
| 63 url::Origin originA_ = url::Origin(GURL(ORIGIN_A)); | 64 url::Origin originA_ = url::Origin(GURL(ORIGIN_A)); |
| 64 url::Origin originB_ = url::Origin(GURL(ORIGIN_B)); | 65 url::Origin originB_ = url::Origin(GURL(ORIGIN_B)); |
| 65 url::Origin originC_ = url::Origin(GURL(ORIGIN_C)); | 66 url::Origin originC_ = url::Origin(GURL(ORIGIN_C)); |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 // Contains the list of controlled features, so that we are guaranteed to | 69 // Contains the list of controlled features, so that we are guaranteed to |
| 69 // have at least one of each kind of default behaviour represented. | 70 // have at least one of each kind of default behaviour represented. |
| 70 FeaturePolicy::FeatureList featureList_; | 71 FeaturePolicy::FeatureList featureList_; |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 std::unique_ptr<FeaturePolicy> policy1 = | 637 std::unique_ptr<FeaturePolicy> policy1 = |
| 637 CreateFromParentPolicy(nullptr, originA_); | 638 CreateFromParentPolicy(nullptr, originA_); |
| 638 policy1->SetHeaderPolicy({{{"default-off", false, {originA_, originB_}}}}); | 639 policy1->SetHeaderPolicy({{{"default-off", false, {originA_, originB_}}}}); |
| 639 EXPECT_TRUE(policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, originA_)); | 640 EXPECT_TRUE(policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, originA_)); |
| 640 EXPECT_TRUE(policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, originB_)); | 641 EXPECT_TRUE(policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, originB_)); |
| 641 EXPECT_FALSE( | 642 EXPECT_FALSE( |
| 642 policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, originC_)); | 643 policy1->IsFeatureEnabledForOrigin(kDefaultOffFeature, originC_)); |
| 643 } | 644 } |
| 644 | 645 |
| 645 } // namespace content | 646 } // namespace content |
| OLD | NEW |