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

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

Issue 2546533003: Respect QuicAllowed policy for new streams (Closed)
Patch Set: Formatting in browsertest Created 3 years, 11 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"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/policy/profile_policy_connector_factory.h"
13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/profiles/profiles_state.h"
16 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
17 #include "chrome/browser/ui/browser.h"
12 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/base/in_process_browser_test.h" 19 #include "chrome/test/base/in_process_browser_test.h"
14 #include "components/policy/core/browser/browser_policy_connector.h" 20 #include "components/policy/core/browser/browser_policy_connector.h"
15 #include "components/policy/core/common/mock_configuration_policy_provider.h" 21 #include "components/policy/core/common/mock_configuration_policy_provider.h"
16 #include "components/policy/core/common/policy_map.h" 22 #include "components/policy/core/common/policy_map.h"
17 #include "components/policy/core/common/policy_types.h" 23 #include "components/policy/core/common/policy_types.h"
18 #include "components/policy/policy_constants.h" 24 #include "components/policy/policy_constants.h"
19 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
20 #include "content/public/test/browser_test.h" 26 #include "content/public/test/browser_test.h"
21 #include "net/http/http_transaction_factory.h" 27 #include "net/http/http_transaction_factory.h"
22 #include "net/url_request/url_request_context.h" 28 #include "net/url_request/url_request_context.h"
23 #include "net/url_request/url_request_context_getter.h" 29 #include "net/url_request/url_request_context_getter.h"
24 30
31 #if defined(OS_CHROMEOS)
32 #include "chromeos/chromeos_switches.h"
33 #endif
34
25 namespace { 35 namespace {
26 36
27 void VerifyQuicEnabledStatus(net::URLRequestContextGetter* getter, 37 // Checks if QUIC is enabled for new streams in the passed |context|.
28 bool quic_enabled_expected, 38 bool IsQuicEnabled(net::URLRequestContextGetter* context) {
29 const base::Closure& done_callback) { 39 return context->GetURLRequestContext()
30 net::URLRequestContext* context = getter->GetURLRequestContext(); 40 ->http_transaction_factory()
31 bool quic_enabled = context->http_transaction_factory()->GetSession()-> 41 ->GetSession()
32 params().enable_quic; 42 ->IsQuicEnabled();
33 EXPECT_EQ(quic_enabled_expected, quic_enabled); 43 }
44
45 // Verifies QUIC enablement for new streams in the passed |profile_context|.
46 // |done_callback| is used to indicate that the browser test may continue.
47 void VerifyProfileQuicEnabledOnIOThread(
48 net::URLRequestContextGetter* profile_context,
49 bool quic_enabled_expected,
50 const base::Closure& done_callback) {
51 bool quic_enabled_profile = IsQuicEnabled(profile_context);
52 EXPECT_EQ(quic_enabled_expected, quic_enabled_profile);
34 53
35 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 54 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
36 done_callback); 55 done_callback);
37 } 56 }
38 57
39 void VerifyQuicEnabledStatusInIOThread(bool quic_enabled_expected) { 58 // Verifies QUIC enablement for new streams in the passed |profile|.
59 void VerifyProfileQuicEnabled(Profile* profile, bool quic_enabled_expected) {
mmenke 2017/01/10 18:03:38 For slightly easier testing, I suggest: bool IsQu
pmarko 2017/01/10 20:47:05 Good idea. As discussed offline, I've named them I
40 base::RunLoop run_loop; 60 base::RunLoop run_loop;
61 net::URLRequestContextGetter* profile_context = profile->GetRequestContext();
62
41 content::BrowserThread::PostTask( 63 content::BrowserThread::PostTask(
42 content::BrowserThread::IO, FROM_HERE, 64 content::BrowserThread::IO, FROM_HERE,
43 base::Bind(VerifyQuicEnabledStatus, 65 base::Bind(VerifyProfileQuicEnabledOnIOThread,
44 base::RetainedRef(g_browser_process->system_request_context()), 66 base::RetainedRef(profile_context), quic_enabled_expected,
67 run_loop.QuitClosure()));
68 run_loop.Run();
69 }
70
71 // Verifies QUIC enablement for new streams in the passed |system_context| and
72 // |safe_browsing_context|.
73 // |done_callback| is used to indicate that the browser test may continue.
74 void VerifyGlobalQuicEnabledOnIOThread(
75 net::URLRequestContextGetter* system_context,
76 scoped_refptr<net::URLRequestContextGetter> safe_browsing_context,
77 bool quic_enabled_expected,
78 const base::Closure& done_callback) {
79 bool quic_enabled_system = IsQuicEnabled(system_context);
80 EXPECT_EQ(quic_enabled_expected, quic_enabled_system);
81
82 bool quic_enabled_safe_browsing = IsQuicEnabled(safe_browsing_context.get());
83 EXPECT_EQ(quic_enabled_expected, quic_enabled_safe_browsing);
84
85 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
86 done_callback);
87 }
88
89 // Verifies QUIC enablement for globally owned HttpNetworkSessions.
90 void VerifyGlobalQuicEnabled(bool quic_enabled_expected) {
91 base::RunLoop run_loop;
92 net::URLRequestContextGetter* system_context =
93 g_browser_process->system_request_context();
94 scoped_refptr<net::URLRequestContextGetter> safe_browsing_context =
95 g_browser_process->safe_browsing_service()->url_request_context();
96
97 content::BrowserThread::PostTask(
98 content::BrowserThread::IO, FROM_HERE,
99 base::Bind(VerifyGlobalQuicEnabledOnIOThread,
100 base::RetainedRef(system_context), safe_browsing_context,
45 quic_enabled_expected, run_loop.QuitClosure())); 101 quic_enabled_expected, run_loop.QuitClosure()));
46 run_loop.Run(); 102 run_loop.Run();
47 } 103 }
48 104
105 // This class is used to create an additional Profile during tests. Its main
106 // purpose is to wait while Profile creation is in progress, store the Profile
107 // instance passed in the OnProfileInitialized callback, and return it.
108 class AdditionalProfileCreator {
mmenke 2017/01/10 18:03:38 optional: Could get rid of this class, and use a
pmarko 2017/01/10 20:47:05 Done.
109 public:
110 // Create a new Profile. Blocks until Profile creation is done and returns the
111 // newly created Profile.
112 Profile* Create() {
113 ProfileManager* profile_manager = g_browser_process->profile_manager();
114
115 // Create an additional profile.
116 base::FilePath path_profile =
117 profile_manager->GenerateNextProfileDirectoryPath();
118 base::RunLoop run_loop;
119 profile_manager->CreateProfileAsync(
120 path_profile,
121 base::Bind(&AdditionalProfileCreator::OnProfileInitialized,
122 base::Unretained(this), run_loop.QuitClosure()),
123 base::string16(), std::string(), std::string());
124
125 // Run the message loop to allow profile creation to take place; the loop is
126 // terminated by OnUnblockOnProfileCreation when the profile is created.
127 run_loop.Run();
128
129 return created_profile_;
130 }
131
132 private:
133 void OnProfileInitialized(const base::Closure& closure,
134 Profile* profile,
135 Profile::CreateStatus status) {
136 if (status == Profile::CREATE_STATUS_INITIALIZED) {
137 created_profile_ = profile;
138 closure.Run();
139 }
140 }
141
142 // Stores the created profile (passed into OnProfileInitialzed callback).
143 Profile* created_profile_;
144 };
145
49 } // namespace 146 } // namespace
50 147
51 namespace policy { 148 namespace policy {
52 149
53 // The tests are based on the assumption that command line flag kEnableQuic 150 // The tests are based on the assumption that command line flag kEnableQuic
54 // guarantees that QUIC protocol is enabled which is the case at the moment 151 // guarantees that QUIC protocol is enabled which is the case at the moment
55 // when these are being written. 152 // when these are being written.
56 class QuicAllowedPolicyTestBase: public InProcessBrowserTest { 153 class QuicAllowedPolicyTestBase: public InProcessBrowserTest {
57 public: 154 public:
58 QuicAllowedPolicyTestBase() : InProcessBrowserTest(){} 155 QuicAllowedPolicyTestBase() : InProcessBrowserTest() {}
59 156
60 protected: 157 protected:
61 void SetUpInProcessBrowserTestFixture() override { 158 void SetUpInProcessBrowserTestFixture() override {
62 base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableQuic); 159 base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableQuic);
63 EXPECT_CALL(provider_, IsInitializationComplete(testing::_)) 160 EXPECT_CALL(provider_, IsInitializationComplete(testing::_))
64 .WillRepeatedly(testing::Return(true)); 161 .WillRepeatedly(testing::Return(true));
65 162
66 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); 163 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
67 PolicyMap values; 164 PolicyMap values;
68 GetQuicAllowedPolicy(&values); 165 GetQuicAllowedPolicy(&values);
69 provider_.UpdateChromePolicy(values); 166 provider_.UpdateChromePolicy(values);
70 } 167 }
71 168
72 virtual void GetQuicAllowedPolicy(PolicyMap* values) = 0; 169 virtual void GetQuicAllowedPolicy(PolicyMap* values) = 0;
73 170
74 private: 171 private:
75 MockConfigurationPolicyProvider provider_; 172 MockConfigurationPolicyProvider provider_;
76 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyTestBase); 173 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyTestBase);
77 }; 174 };
78 175
79 // Policy QuicAllowed set to false. 176 // Policy QuicAllowed set to false.
80 class QuicAllowedPolicyIsFalse: public QuicAllowedPolicyTestBase { 177 class QuicAllowedPolicyIsFalse: public QuicAllowedPolicyTestBase {
81 public: 178 public:
82 QuicAllowedPolicyIsFalse() : QuicAllowedPolicyTestBase(){} 179 QuicAllowedPolicyIsFalse() : QuicAllowedPolicyTestBase() {}
83 180
84 protected: 181 protected:
85 void GetQuicAllowedPolicy(PolicyMap* values) override { 182 void GetQuicAllowedPolicy(PolicyMap* values) override {
86 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, 183 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
87 POLICY_SOURCE_CLOUD, 184 POLICY_SOURCE_CLOUD,
88 base::MakeUnique<base::FundamentalValue>(false), nullptr); 185 base::MakeUnique<base::FundamentalValue>(false), nullptr);
89 } 186 }
90 187
91 private: 188 private:
92 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsFalse); 189 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsFalse);
93 }; 190 };
94 191
95 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsFalse, QuicDisallowed) { 192 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsFalse, QuicDisallowed) {
96 VerifyQuicEnabledStatusInIOThread(false); 193 VerifyGlobalQuicEnabled(false);
194 VerifyProfileQuicEnabled(browser()->profile(), false);
97 } 195 }
98 196
99 // Policy QuicAllowed set to true. 197 // Policy QuicAllowed set to true.
100 class QuicAllowedPolicyIsTrue: public QuicAllowedPolicyTestBase { 198 class QuicAllowedPolicyIsTrue: public QuicAllowedPolicyTestBase {
101 public: 199 public:
102 QuicAllowedPolicyIsTrue() : QuicAllowedPolicyTestBase(){} 200 QuicAllowedPolicyIsTrue() : QuicAllowedPolicyTestBase() {}
103 201
104 protected: 202 protected:
105 void GetQuicAllowedPolicy(PolicyMap* values) override { 203 void GetQuicAllowedPolicy(PolicyMap* values) override {
106 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, 204 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
107 POLICY_SOURCE_CLOUD, 205 POLICY_SOURCE_CLOUD,
108 base::MakeUnique<base::FundamentalValue>(true), nullptr); 206 base::MakeUnique<base::FundamentalValue>(true), nullptr);
109 } 207 }
110 208
111 private: 209 private:
112 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsTrue); 210 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsTrue);
113 }; 211 };
114 212
115 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsTrue, QuicAllowed) { 213 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsTrue, QuicAllowed) {
116 VerifyQuicEnabledStatusInIOThread(true); 214 VerifyGlobalQuicEnabled(true);
215 VerifyProfileQuicEnabled(browser()->profile(), true);
117 } 216 }
118 217
119 // Policy QuicAllowed is not set. 218 // Policy QuicAllowed is not set.
120 class QuicAllowedPolicyIsNotSet: public QuicAllowedPolicyTestBase { 219 class QuicAllowedPolicyIsNotSet: public QuicAllowedPolicyTestBase {
121 public: 220 public:
122 QuicAllowedPolicyIsNotSet() : QuicAllowedPolicyTestBase(){} 221 QuicAllowedPolicyIsNotSet() : QuicAllowedPolicyTestBase() {}
123 222
124 protected: 223 protected:
125 void GetQuicAllowedPolicy(PolicyMap* values) override { 224 void GetQuicAllowedPolicy(PolicyMap* values) override {
126 } 225 }
127 226
128 private: 227 private:
129 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsNotSet); 228 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsNotSet);
130 }; 229 };
131 230
132 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsNotSet, NoQuicRegulations) { 231 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsNotSet, NoQuicRegulations) {
133 VerifyQuicEnabledStatusInIOThread(true); 232 VerifyGlobalQuicEnabled(true);
233 VerifyProfileQuicEnabled(browser()->profile(), true);
234 }
235
236 // Policy QuicAllowed is set dynamically after profile creation.
237 // Supports creation of an additional profile.
238 class QuicAllowedPolicyDynamicTest : public InProcessBrowserTest {
239 public:
240 QuicAllowedPolicyDynamicTest()
241 : InProcessBrowserTest(), profile_1_(nullptr), profile_2_(nullptr) {}
242
243 protected:
244 void SetUpCommandLine(base::CommandLine* command_line) override {
245 // See TODO.
mmenke 2017/01/10 18:03:38 Also, which TODO?
mmenke 2017/01/10 18:03:38 Indent here is weird. Maybe move down a line?
pmarko 2017/01/10 20:47:05 My bad, removed.
246 #if defined(OS_CHROMEOS)
247 command_line->AppendSwitch(
248 chromeos::switches::kIgnoreUserProfileMappingForTests);
249 #endif
250 }
251
252 void SetUpInProcessBrowserTestFixture() override {
253 // Set the overriden policy provider for the first Profile (profile_1_).
254 EXPECT_CALL(policy_for_profile_1_, IsInitializationComplete(testing::_))
255 .WillRepeatedly(testing::Return(true));
256 policy::ProfilePolicyConnectorFactory::GetInstance()
257 ->PushProviderForTesting(&policy_for_profile_1_);
258 }
259
260 void SetUpOnMainThread() override { profile_1_ = browser()->profile(); }
261
262 // Creates a second Profile for testing. The Profile can then be accessed by
263 // profile_2() and its policy by policy_for_profile_2().
264 void CreateSecondProfile() {
265 EXPECT_FALSE(profile_2_);
266
267 EXPECT_CALL(policy_for_profile_2_, IsInitializationComplete(testing::_))
268 .WillRepeatedly(testing::Return(true));
269 policy::ProfilePolicyConnectorFactory::GetInstance()
270 ->PushProviderForTesting(&policy_for_profile_2_);
271
272 AdditionalProfileCreator additional_profile_creator;
273 profile_2_ = additional_profile_creator.Create();
274
275 // Make sure second profile creation does what we think it does.
276 EXPECT_TRUE(profile_1() != profile_2());
277 }
278
279 // Sets the QuicAllowed policy for a Profile.
280 // |provider| is supposed to be the MockConfigurationPolicyProvider for the
281 // Profile, as returned by policy_for_profile_1() / policy_for_profile_2().
282 void SetQuicAllowedPolicy(MockConfigurationPolicyProvider* provider,
283 bool value) {
284 PolicyMap policy_map;
285 policy_map.Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
286 POLICY_SOURCE_CLOUD,
287 base::MakeUnique<base::FundamentalValue>(value), nullptr);
288 provider->UpdateChromePolicy(policy_map);
289 base::RunLoop().RunUntilIdle();
290 }
291
292 // Removes all policies for a Profile.
293 // |provider| is supposed to be the MockConfigurationPolicyProvider for the
294 // Profile, as returned by policy_for_profile_1() / policy_for_profile_2().
295 void RemoveAllPolicies(MockConfigurationPolicyProvider* provider) {
296 PolicyMap policy_map;
297 provider->UpdateChromePolicy(policy_map);
298 base::RunLoop().RunUntilIdle();
299 }
300
301 // Returns the first Profile.
302 Profile* profile_1() { return profile_1_; }
303
304 // Returns the second Profile. May only be called after CreateSecondProfile
305 // has been called.
306 Profile* profile_2() {
307 // Only valid after CreateSecondProfile() has been called.
308 EXPECT_TRUE(profile_2_);
309 return profile_2_;
310 }
311
312 // Returns the MockConfigurationPolicyProvider for profile_1.
313 MockConfigurationPolicyProvider* policy_for_profile_1() {
314 return &policy_for_profile_1_;
315 }
316
317 // Returns the MockConfigurationPolicyProvider for profile_2.
318 MockConfigurationPolicyProvider* policy_for_profile_2() {
319 return &policy_for_profile_2_;
320 }
321
322 private:
323 // The first profile.
324 Profile* profile_1_;
325 // The second profile. Only valid after CreateSecondProfile() has been called.
326 Profile* profile_2_;
327
328 // Mock Policy for profile_1_.
329 MockConfigurationPolicyProvider policy_for_profile_1_;
330 // Mock Policy for profile_2_.
331 MockConfigurationPolicyProvider policy_for_profile_2_;
332
333 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyDynamicTest);
334 };
335
336 // QUIC is disallowed by policy after the profile has been initialized.
337 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyDynamicTest, QuicAllowedFalseThenTrue) {
338 // After browser start, QuicAllowed=false comes in dynamically
339 SetQuicAllowedPolicy(policy_for_profile_1(), false);
340 VerifyGlobalQuicEnabled(false);
341 VerifyProfileQuicEnabled(profile_1(), false);
342
343 // Set the QuicAllowed policy to true again
344 SetQuicAllowedPolicy(policy_for_profile_1(), true);
345 // Effectively, QUIC is sitll disabled because QUIC re-enabling is not
mmenke 2017/01/10 18:03:38 nit: still
pmarko 2017/01/10 20:47:05 Done.
346 // supported.
347 VerifyGlobalQuicEnabled(false);
348 VerifyProfileQuicEnabled(profile_1(), false);
349
350 // Completely remove the QuicAllowed policy
351 RemoveAllPolicies(policy_for_profile_1());
352 // Effectively, QUIC is still disabled because QUIC re-enabling is not
353 // supported.
354 VerifyGlobalQuicEnabled(false);
355 VerifyProfileQuicEnabled(profile_1(), false);
356
357 // QuicAllowed=false is set again
358 SetQuicAllowedPolicy(policy_for_profile_1(), false);
359 VerifyGlobalQuicEnabled(false);
360 VerifyProfileQuicEnabled(profile_1(), false);
361 }
362
363 // QUIC is allowed, then disallowed by policy after the profile has been
364 // initialized.
365 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyDynamicTest, QuicAllowedTrueThenFalse) {
366 // After browser start, QuicAllowed=true comes in dynamically
367 SetQuicAllowedPolicy(policy_for_profile_1(), true);
368 VerifyGlobalQuicEnabled(true);
369 VerifyProfileQuicEnabled(profile_1(), true);
370
371 // Completely remove the QuicAllowed policy
372 RemoveAllPolicies(policy_for_profile_1());
373 VerifyGlobalQuicEnabled(true);
374 VerifyProfileQuicEnabled(profile_1(), true);
375
376 // Set the QuicAllowed policy to true again
377 SetQuicAllowedPolicy(policy_for_profile_1(), true);
378 // Effectively, QUIC is sitll disabled because QUIC re-enabling is not
379 // supported.
380 VerifyGlobalQuicEnabled(true);
381 VerifyProfileQuicEnabled(profile_1(), true);
382
383 // Now set QuicAllowed=false
384 SetQuicAllowedPolicy(policy_for_profile_1(), false);
385 VerifyGlobalQuicEnabled(false);
386 VerifyProfileQuicEnabled(profile_1(), false);
387 }
388
389 // A second Profile is created when QuicAllowed=false policy is in effect for
390 // the first profile.
391 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyDynamicTest,
392 SecondProfileCreatedWhenQuicAllowedFalse) {
393 // If multiprofile mode is not enabled, you can't switch between profiles.
394 if (!profiles::IsMultipleProfilesEnabled())
395 return;
396
397 SetQuicAllowedPolicy(policy_for_profile_1(), false);
398 VerifyGlobalQuicEnabled(false);
399 VerifyProfileQuicEnabled(profile_1(), false);
400
401 CreateSecondProfile();
402
403 // QUIC is disabled in both profiles
404 VerifyGlobalQuicEnabled(false);
405 VerifyProfileQuicEnabled(profile_1(), false);
406 VerifyProfileQuicEnabled(profile_2(), false);
407 }
408
409 // A second Profile is created when no QuicAllowed policy is in effect for the
410 // first profile.
411 // Then QuicAllowed=false policy is dynamically set for both profiles.
412 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyDynamicTest,
413 QuicAllowedFalseAfterTwoProfilesCreated) {
414 // If multiprofile mode is not enabled, you can't switch between profiles.
415 if (!profiles::IsMultipleProfilesEnabled())
416 return;
417
418 CreateSecondProfile();
419
420 // QUIC is enabled in both profiles
421 VerifyGlobalQuicEnabled(true);
422 VerifyProfileQuicEnabled(profile_1(), true);
423 VerifyProfileQuicEnabled(profile_2(), true);
424
425 // Disable QUIC in first profile
426 SetQuicAllowedPolicy(policy_for_profile_1(), false);
427 VerifyGlobalQuicEnabled(false);
428 VerifyProfileQuicEnabled(profile_1(), false);
429 VerifyProfileQuicEnabled(profile_2(), true);
430
431 // Disable QUIC in second profile
432 SetQuicAllowedPolicy(policy_for_profile_2(), false);
433 VerifyGlobalQuicEnabled(false);
434 VerifyProfileQuicEnabled(profile_1(), false);
435 VerifyProfileQuicEnabled(profile_2(), false);
134 } 436 }
135 437
136 } // namespace policy 438 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698