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

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

Issue 1304843004: Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed another test. Created 5 years, 3 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/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"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "content/public/test/browser_test.h" 17 #include "content/public/test/browser_test.h"
17 #include "net/http/http_transaction_factory.h" 18 #include "net/http/http_transaction_factory.h"
18 #include "net/url_request/url_request_context.h" 19 #include "net/url_request/url_request_context.h"
19 #include "net/url_request/url_request_context_getter.h" 20 #include "net/url_request/url_request_context_getter.h"
20 #include "policy/policy_constants.h" 21 #include "policy/policy_constants.h"
21 22
22 namespace { 23 namespace {
23 24
24 void VerifyQuicEnabledStatus(net::URLRequestContextGetter* getter, 25 void VerifyQuicEnabledStatus(net::URLRequestContextGetter* getter,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 }; 78 };
78 79
79 // Policy QuicAllowed set to false. 80 // Policy QuicAllowed set to false.
80 class QuicAllowedPolicyIsFalse: public QuicAllowedPolicyTestBase { 81 class QuicAllowedPolicyIsFalse: public QuicAllowedPolicyTestBase {
81 public: 82 public:
82 QuicAllowedPolicyIsFalse() : QuicAllowedPolicyTestBase(){} 83 QuicAllowedPolicyIsFalse() : QuicAllowedPolicyTestBase(){}
83 84
84 protected: 85 protected:
85 void GetQuicAllowedPolicy(PolicyMap* values) override { 86 void GetQuicAllowedPolicy(PolicyMap* values) override {
86 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, 87 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
87 new base::FundamentalValue(false), NULL); 88 POLICY_SOURCE_CLOUD, new base::FundamentalValue(false), nullptr);
88 } 89 }
89 90
90 private: 91 private:
91 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsFalse); 92 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsFalse);
92 }; 93 };
93 94
94 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsFalse, QuicDisallowed) { 95 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsFalse, QuicDisallowed) {
95 VerifyQuicEnabledStatusInIOThread(false); 96 VerifyQuicEnabledStatusInIOThread(false);
96 } 97 }
97 98
98 // Policy QuicAllowed set to true. 99 // Policy QuicAllowed set to true.
99 class QuicAllowedPolicyIsTrue: public QuicAllowedPolicyTestBase { 100 class QuicAllowedPolicyIsTrue: public QuicAllowedPolicyTestBase {
100 public: 101 public:
101 QuicAllowedPolicyIsTrue() : QuicAllowedPolicyTestBase(){} 102 QuicAllowedPolicyIsTrue() : QuicAllowedPolicyTestBase(){}
102 103
103 protected: 104 protected:
104 void GetQuicAllowedPolicy(PolicyMap* values) override { 105 void GetQuicAllowedPolicy(PolicyMap* values) override {
105 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, 106 values->Set(key::kQuicAllowed, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
106 new base::FundamentalValue(true), NULL); 107 POLICY_SOURCE_CLOUD, new base::FundamentalValue(true), nullptr);
107 } 108 }
108 109
109 private: 110 private:
110 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsTrue); 111 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsTrue);
111 }; 112 };
112 113
113 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsTrue, QuicAllowed) { 114 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsTrue, QuicAllowed) {
114 VerifyQuicEnabledStatusInIOThread(true); 115 VerifyQuicEnabledStatusInIOThread(true);
115 } 116 }
116 117
117 // Policy QuicAllowed is not set. 118 // Policy QuicAllowed is not set.
118 class QuicAllowedPolicyIsNotSet: public QuicAllowedPolicyTestBase { 119 class QuicAllowedPolicyIsNotSet: public QuicAllowedPolicyTestBase {
119 public: 120 public:
120 QuicAllowedPolicyIsNotSet() : QuicAllowedPolicyTestBase(){} 121 QuicAllowedPolicyIsNotSet() : QuicAllowedPolicyTestBase(){}
121 122
122 protected: 123 protected:
123 void GetQuicAllowedPolicy(PolicyMap* values) override { 124 void GetQuicAllowedPolicy(PolicyMap* values) override {
124 } 125 }
125 126
126 private: 127 private:
127 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsNotSet); 128 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsNotSet);
128 }; 129 };
129 130
130 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsNotSet, NoQuicRegulations) { 131 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsNotSet, NoQuicRegulations) {
131 VerifyQuicEnabledStatusInIOThread(true); 132 VerifyQuicEnabledStatusInIOThread(true);
132 } 133 }
133 134
134 } // namespace policy 135 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/policy/policy_prefs_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698