OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
12 #include "components/policy/core/browser/browser_policy_connector.h" | 12 #include "components/policy/core/browser/browser_policy_connector.h" |
13 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 13 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
14 #include "components/policy/core/common/policy_map.h" | 14 #include "components/policy/core/common/policy_map.h" |
15 #include "components/policy/core/common/policy_types.h" | |
16 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/test/browser_test.h" | 16 #include "content/public/test/browser_test.h" |
18 #include "net/http/http_transaction_factory.h" | 17 #include "net/http/http_transaction_factory.h" |
19 #include "net/url_request/url_request_context.h" | 18 #include "net/url_request/url_request_context.h" |
20 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
21 #include "policy/policy_constants.h" | 20 #include "policy/policy_constants.h" |
22 | 21 |
23 namespace { | 22 namespace { |
24 | 23 |
25 void VerifyQuicEnabledStatus(net::URLRequestContextGetter* getter, | 24 void VerifyQuicEnabledStatus(net::URLRequestContextGetter* getter, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 }; | 77 }; |
79 | 78 |
80 // Policy QuicAllowed set to false. | 79 // Policy QuicAllowed set to false. |
81 class QuicAllowedPolicyIsFalse: public QuicAllowedPolicyTestBase { | 80 class QuicAllowedPolicyIsFalse: public QuicAllowedPolicyTestBase { |
82 public: | 81 public: |
83 QuicAllowedPolicyIsFalse() : QuicAllowedPolicyTestBase(){} | 82 QuicAllowedPolicyIsFalse() : QuicAllowedPolicyTestBase(){} |
84 | 83 |
85 protected: | 84 protected: |
86 void GetQuicAllowedPolicy(PolicyMap* values) override { | 85 void GetQuicAllowedPolicy(PolicyMap* values) override { |
87 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 86 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
88 POLICY_SOURCE_CLOUD, new base::FundamentalValue(false), nullptr); | 87 new base::FundamentalValue(false), NULL); |
89 } | 88 } |
90 | 89 |
91 private: | 90 private: |
92 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsFalse); | 91 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsFalse); |
93 }; | 92 }; |
94 | 93 |
95 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsFalse, QuicDisallowed) { | 94 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsFalse, QuicDisallowed) { |
96 VerifyQuicEnabledStatusInIOThread(false); | 95 VerifyQuicEnabledStatusInIOThread(false); |
97 } | 96 } |
98 | 97 |
99 // Policy QuicAllowed set to true. | 98 // Policy QuicAllowed set to true. |
100 class QuicAllowedPolicyIsTrue: public QuicAllowedPolicyTestBase { | 99 class QuicAllowedPolicyIsTrue: public QuicAllowedPolicyTestBase { |
101 public: | 100 public: |
102 QuicAllowedPolicyIsTrue() : QuicAllowedPolicyTestBase(){} | 101 QuicAllowedPolicyIsTrue() : QuicAllowedPolicyTestBase(){} |
103 | 102 |
104 protected: | 103 protected: |
105 void GetQuicAllowedPolicy(PolicyMap* values) override { | 104 void GetQuicAllowedPolicy(PolicyMap* values) override { |
106 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 105 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
107 POLICY_SOURCE_CLOUD, new base::FundamentalValue(true), nullptr); | 106 new base::FundamentalValue(true), NULL); |
108 } | 107 } |
109 | 108 |
110 private: | 109 private: |
111 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsTrue); | 110 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsTrue); |
112 }; | 111 }; |
113 | 112 |
114 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsTrue, QuicAllowed) { | 113 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsTrue, QuicAllowed) { |
115 VerifyQuicEnabledStatusInIOThread(true); | 114 VerifyQuicEnabledStatusInIOThread(true); |
116 } | 115 } |
117 | 116 |
118 // Policy QuicAllowed is not set. | 117 // Policy QuicAllowed is not set. |
119 class QuicAllowedPolicyIsNotSet: public QuicAllowedPolicyTestBase { | 118 class QuicAllowedPolicyIsNotSet: public QuicAllowedPolicyTestBase { |
120 public: | 119 public: |
121 QuicAllowedPolicyIsNotSet() : QuicAllowedPolicyTestBase(){} | 120 QuicAllowedPolicyIsNotSet() : QuicAllowedPolicyTestBase(){} |
122 | 121 |
123 protected: | 122 protected: |
124 void GetQuicAllowedPolicy(PolicyMap* values) override { | 123 void GetQuicAllowedPolicy(PolicyMap* values) override { |
125 } | 124 } |
126 | 125 |
127 private: | 126 private: |
128 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsNotSet); | 127 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsNotSet); |
129 }; | 128 }; |
130 | 129 |
131 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsNotSet, NoQuicRegulations) { | 130 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsNotSet, NoQuicRegulations) { |
132 VerifyQuicEnabledStatusInIOThread(true); | 131 VerifyQuicEnabledStatusInIOThread(true); |
133 } | 132 } |
134 | 133 |
135 } // namespace policy | 134 } // namespace policy |
OLD | NEW |