Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: chrome/browser/policy/policy_network_browsertest.cc

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 }; 120 };
121 121
122 // Policy QuicAllowed set to false. 122 // Policy QuicAllowed set to false.
123 class QuicAllowedPolicyIsFalse: public QuicAllowedPolicyTestBase { 123 class QuicAllowedPolicyIsFalse: public QuicAllowedPolicyTestBase {
124 public: 124 public:
125 QuicAllowedPolicyIsFalse() : QuicAllowedPolicyTestBase() {} 125 QuicAllowedPolicyIsFalse() : QuicAllowedPolicyTestBase() {}
126 126
127 protected: 127 protected:
128 void GetQuicAllowedPolicy(PolicyMap* values) override { 128 void GetQuicAllowedPolicy(PolicyMap* values) override {
129 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, 129 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
130 POLICY_SOURCE_CLOUD, 130 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false),
131 base::MakeUnique<base::FundamentalValue>(false), nullptr); 131 nullptr);
132 } 132 }
133 133
134 private: 134 private:
135 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsFalse); 135 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsFalse);
136 }; 136 };
137 137
138 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsFalse, QuicDisallowed) { 138 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsFalse, QuicDisallowed) {
139 EXPECT_FALSE(IsQuicEnabled(system_request_context())); 139 EXPECT_FALSE(IsQuicEnabled(system_request_context()));
140 EXPECT_FALSE(IsQuicEnabled(safe_browsing_service_request_context())); 140 EXPECT_FALSE(IsQuicEnabled(safe_browsing_service_request_context()));
141 EXPECT_FALSE(IsQuicEnabled(browser()->profile()->GetRequestContext())); 141 EXPECT_FALSE(IsQuicEnabled(browser()->profile()->GetRequestContext()));
142 } 142 }
143 143
144 // Policy QuicAllowed set to true. 144 // Policy QuicAllowed set to true.
145 class QuicAllowedPolicyIsTrue: public QuicAllowedPolicyTestBase { 145 class QuicAllowedPolicyIsTrue: public QuicAllowedPolicyTestBase {
146 public: 146 public:
147 QuicAllowedPolicyIsTrue() : QuicAllowedPolicyTestBase() {} 147 QuicAllowedPolicyIsTrue() : QuicAllowedPolicyTestBase() {}
148 148
149 protected: 149 protected:
150 void GetQuicAllowedPolicy(PolicyMap* values) override { 150 void GetQuicAllowedPolicy(PolicyMap* values) override {
151 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, 151 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
152 POLICY_SOURCE_CLOUD, 152 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true),
153 base::MakeUnique<base::FundamentalValue>(true), nullptr); 153 nullptr);
154 } 154 }
155 155
156 private: 156 private:
157 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsTrue); 157 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsTrue);
158 }; 158 };
159 159
160 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsTrue, QuicAllowed) { 160 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsTrue, QuicAllowed) {
161 EXPECT_TRUE(IsQuicEnabled(system_request_context())); 161 EXPECT_TRUE(IsQuicEnabled(system_request_context()));
162 EXPECT_TRUE(IsQuicEnabled(safe_browsing_service_request_context())); 162 EXPECT_TRUE(IsQuicEnabled(safe_browsing_service_request_context()));
163 EXPECT_TRUE(IsQuicEnabled(browser()->profile()->GetRequestContext())); 163 EXPECT_TRUE(IsQuicEnabled(browser()->profile()->GetRequestContext()));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 EXPECT_TRUE(profile_1() != profile_2()); 240 EXPECT_TRUE(profile_1() != profile_2());
241 } 241 }
242 242
243 // Sets the QuicAllowed policy for a Profile. 243 // Sets the QuicAllowed policy for a Profile.
244 // |provider| is supposed to be the MockConfigurationPolicyProvider for the 244 // |provider| is supposed to be the MockConfigurationPolicyProvider for the
245 // Profile, as returned by policy_for_profile_1() / policy_for_profile_2(). 245 // Profile, as returned by policy_for_profile_1() / policy_for_profile_2().
246 void SetQuicAllowedPolicy(MockConfigurationPolicyProvider* provider, 246 void SetQuicAllowedPolicy(MockConfigurationPolicyProvider* provider,
247 bool value) { 247 bool value) {
248 PolicyMap policy_map; 248 PolicyMap policy_map;
249 policy_map.Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 249 policy_map.Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
250 POLICY_SOURCE_CLOUD, 250 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(value),
251 base::MakeUnique<base::FundamentalValue>(value), nullptr); 251 nullptr);
252 provider->UpdateChromePolicy(policy_map); 252 provider->UpdateChromePolicy(policy_map);
253 base::RunLoop().RunUntilIdle(); 253 base::RunLoop().RunUntilIdle();
254 } 254 }
255 255
256 // Removes all policies for a Profile. 256 // Removes all policies for a Profile.
257 // |provider| is supposed to be the MockConfigurationPolicyProvider for the 257 // |provider| is supposed to be the MockConfigurationPolicyProvider for the
258 // Profile, as returned by policy_for_profile_1() / policy_for_profile_2(). 258 // Profile, as returned by policy_for_profile_1() / policy_for_profile_2().
259 void RemoveAllPolicies(MockConfigurationPolicyProvider* provider) { 259 void RemoveAllPolicies(MockConfigurationPolicyProvider* provider) {
260 PolicyMap policy_map; 260 PolicyMap policy_map;
261 provider->UpdateChromePolicy(policy_map); 261 provider->UpdateChromePolicy(policy_map);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 406
407 // Disable QUIC in second profile 407 // Disable QUIC in second profile
408 SetQuicAllowedPolicy(policy_for_profile_2(), false); 408 SetQuicAllowedPolicy(policy_for_profile_2(), false);
409 EXPECT_FALSE(IsQuicEnabled(system_request_context())); 409 EXPECT_FALSE(IsQuicEnabled(system_request_context()));
410 EXPECT_FALSE(IsQuicEnabled(safe_browsing_service_request_context())); 410 EXPECT_FALSE(IsQuicEnabled(safe_browsing_service_request_context()));
411 EXPECT_FALSE(IsQuicEnabled(profile_1()->GetRequestContext())); 411 EXPECT_FALSE(IsQuicEnabled(profile_1()->GetRequestContext()));
412 EXPECT_FALSE(IsQuicEnabled(profile_2()->GetRequestContext())); 412 EXPECT_FALSE(IsQuicEnabled(profile_2()->GetRequestContext()));
413 } 413 }
414 414
415 } // namespace policy 415 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/policy/policy_startup_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698