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 22 matching lines...) Expand all Loading... |
33 "1.0", | 33 "1.0", |
34 "{\"vibrate\": \"Not a JSON array\"}", | 34 "{\"vibrate\": \"Not a JSON array\"}", |
35 "{\"vibrate\": [\"*\"], \"payment\": \"Not a JSON array\"}"}; | 35 "{\"vibrate\": [\"*\"], \"payment\": \"Not a JSON array\"}"}; |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 class FeaturePolicyTest : public ::testing::Test { | 39 class FeaturePolicyTest : public ::testing::Test { |
40 protected: | 40 protected: |
41 FeaturePolicyTest() {} | 41 FeaturePolicyTest() {} |
42 | 42 |
43 ~FeaturePolicyTest() { | 43 ~FeaturePolicyTest() {} |
44 } | |
45 | 44 |
46 RefPtr<SecurityOrigin> origin_a_ = SecurityOrigin::CreateFromString(ORIGIN_A); | 45 RefPtr<SecurityOrigin> origin_a_ = SecurityOrigin::CreateFromString(ORIGIN_A); |
47 RefPtr<SecurityOrigin> origin_b_ = SecurityOrigin::CreateFromString(ORIGIN_B); | 46 RefPtr<SecurityOrigin> origin_b_ = SecurityOrigin::CreateFromString(ORIGIN_B); |
48 RefPtr<SecurityOrigin> origin_c_ = SecurityOrigin::CreateFromString(ORIGIN_C); | 47 RefPtr<SecurityOrigin> origin_c_ = SecurityOrigin::CreateFromString(ORIGIN_C); |
49 | 48 |
50 const FeatureNameMap test_feature_name_map = { | 49 const FeatureNameMap test_feature_name_map = { |
51 {"fullscreen", blink::WebFeaturePolicyFeature::kFullscreen}, | 50 {"fullscreen", blink::WebFeaturePolicyFeature::kFullscreen}, |
52 {"payment", blink::WebFeaturePolicyFeature::kPayment}, | 51 {"payment", blink::WebFeaturePolicyFeature::kPayment}, |
53 {"vibrate", blink::WebFeaturePolicyFeature::kVibrate}}; | 52 {"vibrate", blink::WebFeaturePolicyFeature::kVibrate}}; |
54 }; | 53 }; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 EXPECT_EQ(WebFeaturePolicyFeature::kPayment, container_policy[1].feature); | 193 EXPECT_EQ(WebFeaturePolicyFeature::kPayment, container_policy[1].feature); |
195 EXPECT_FALSE(container_policy[1].matches_all_origins); | 194 EXPECT_FALSE(container_policy[1].matches_all_origins); |
196 EXPECT_EQ(1UL, container_policy[1].origins.size()); | 195 EXPECT_EQ(1UL, container_policy[1].origins.size()); |
197 EXPECT_TRUE(origin_a_->IsSameSchemeHostPortAndSuborigin( | 196 EXPECT_TRUE(origin_a_->IsSameSchemeHostPortAndSuborigin( |
198 container_policy[1].origins[0].Get())); | 197 container_policy[1].origins[0].Get())); |
199 EXPECT_EQ(WebFeaturePolicyFeature::kFullscreen, container_policy[2].feature); | 198 EXPECT_EQ(WebFeaturePolicyFeature::kFullscreen, container_policy[2].feature); |
200 EXPECT_TRUE(container_policy[2].matches_all_origins); | 199 EXPECT_TRUE(container_policy[2].matches_all_origins); |
201 } | 200 } |
202 | 201 |
203 } // namespace blink | 202 } // namespace blink |
OLD | NEW |