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

Side by Side Diff: chrome/browser/policy/cloud/cloud_policy_browsertest.cc

Issue 1348903007: Revert of Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/callback.h" 5 #include "base/callback.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 18 matching lines...) Expand all
29 #include "components/keyed_service/core/keyed_service.h" 29 #include "components/keyed_service/core/keyed_service.h"
30 #include "components/policy/core/browser/browser_policy_connector.h" 30 #include "components/policy/core/browser/browser_policy_connector.h"
31 #include "components/policy/core/common/cloud/cloud_policy_client.h" 31 #include "components/policy/core/common/cloud/cloud_policy_client.h"
32 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 32 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
33 #include "components/policy/core/common/cloud/mock_cloud_policy_client.h" 33 #include "components/policy/core/common/cloud/mock_cloud_policy_client.h"
34 #include "components/policy/core/common/external_data_fetcher.h" 34 #include "components/policy/core/common/external_data_fetcher.h"
35 #include "components/policy/core/common/policy_map.h" 35 #include "components/policy/core/common/policy_map.h"
36 #include "components/policy/core/common/policy_service.h" 36 #include "components/policy/core/common/policy_service.h"
37 #include "components/policy/core/common/policy_switches.h" 37 #include "components/policy/core/common/policy_switches.h"
38 #include "components/policy/core/common/policy_test_utils.h" 38 #include "components/policy/core/common/policy_test_utils.h"
39 #include "components/policy/core/common/policy_types.h"
40 #include "content/public/browser/notification_service.h" 39 #include "content/public/browser/notification_service.h"
41 #include "content/public/browser/notification_source.h" 40 #include "content/public/browser/notification_source.h"
42 #include "content/public/test/test_utils.h" 41 #include "content/public/test/test_utils.h"
43 #include "net/url_request/url_request_context_getter.h" 42 #include "net/url_request/url_request_context_getter.h"
44 #include "policy/policy_constants.h" 43 #include "policy/policy_constants.h"
45 #include "policy/proto/chrome_settings.pb.h" 44 #include "policy/proto/chrome_settings.pb.h"
46 #include "policy/proto/cloud_policy.pb.h" 45 #include "policy/proto/cloud_policy.pb.h"
47 #include "policy/proto/device_management_backend.pb.h" 46 #include "policy/proto/device_management_backend.pb.h"
48 #include "testing/gmock/include/gmock/gmock.h" 47 #include "testing/gmock/include/gmock/gmock.h"
49 #include "testing/gtest/include/gtest/gtest.h" 48 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 homepage, 140 homepage,
142 GetTestUser(), 141 GetTestUser(),
143 key_version); 142 key_version);
144 } 143 }
145 144
146 void GetExpectedDefaultPolicy(PolicyMap* policy_map) { 145 void GetExpectedDefaultPolicy(PolicyMap* policy_map) {
147 #if defined(OS_CHROMEOS) 146 #if defined(OS_CHROMEOS)
148 policy_map->Set(key::kChromeOsMultiProfileUserBehavior, 147 policy_map->Set(key::kChromeOsMultiProfileUserBehavior,
149 POLICY_LEVEL_MANDATORY, 148 POLICY_LEVEL_MANDATORY,
150 POLICY_SCOPE_USER, 149 POLICY_SCOPE_USER,
151 POLICY_SOURCE_ENTERPRISE_DEFAULT,
152 new base::StringValue("primary-only"), 150 new base::StringValue("primary-only"),
153 NULL); 151 NULL);
154 policy_map->Set(key::kEasyUnlockAllowed, 152 policy_map->Set(key::kEasyUnlockAllowed,
155 POLICY_LEVEL_MANDATORY, 153 POLICY_LEVEL_MANDATORY,
156 POLICY_SCOPE_USER, 154 POLICY_SCOPE_USER,
157 POLICY_SOURCE_ENTERPRISE_DEFAULT,
158 new base::FundamentalValue(false), 155 new base::FundamentalValue(false),
159 NULL); 156 NULL);
160 policy_map->Set(key::kCaptivePortalAuthenticationIgnoresProxy, 157 policy_map->Set(key::kCaptivePortalAuthenticationIgnoresProxy,
161 POLICY_LEVEL_MANDATORY, 158 POLICY_LEVEL_MANDATORY,
162 POLICY_SCOPE_USER, 159 POLICY_SCOPE_USER,
163 POLICY_SOURCE_ENTERPRISE_DEFAULT,
164 new base::FundamentalValue(false), 160 new base::FundamentalValue(false),
165 NULL); 161 NULL);
166 #endif 162 #endif
167 } 163 }
168 164
169 void GetExpectedTestPolicy(PolicyMap* expected, const char* homepage) { 165 void GetExpectedTestPolicy(PolicyMap* expected, const char* homepage) {
170 expected->Set(key::kShowHomeButton, 166 expected->Set(key::kShowHomeButton,
171 POLICY_LEVEL_MANDATORY, 167 POLICY_LEVEL_MANDATORY,
172 POLICY_SCOPE_USER, 168 POLICY_SCOPE_USER,
173 POLICY_SOURCE_CLOUD,
174 new base::FundamentalValue(true), 169 new base::FundamentalValue(true),
175 NULL); 170 NULL);
176 expected->Set(key::kRestoreOnStartup, 171 expected->Set(key::kRestoreOnStartup,
177 POLICY_LEVEL_MANDATORY, 172 POLICY_LEVEL_MANDATORY,
178 POLICY_SCOPE_USER, 173 POLICY_SCOPE_USER,
179 POLICY_SOURCE_CLOUD,
180 new base::FundamentalValue(4), 174 new base::FundamentalValue(4),
181 NULL); 175 NULL);
182 base::ListValue list; 176 base::ListValue list;
183 list.AppendString("dev.chromium.org"); 177 list.AppendString("dev.chromium.org");
184 list.AppendString("youtube.com"); 178 list.AppendString("youtube.com");
185 expected->Set(key::kURLBlacklist, 179 expected->Set(
186 POLICY_LEVEL_MANDATORY, 180 key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
187 POLICY_SCOPE_USER, 181 list.DeepCopy(), NULL);
188 POLICY_SOURCE_CLOUD,
189 list.DeepCopy(),
190 nullptr);
191 expected->Set(key::kMaxInvalidationFetchDelay, 182 expected->Set(key::kMaxInvalidationFetchDelay,
192 POLICY_LEVEL_MANDATORY, 183 POLICY_LEVEL_MANDATORY,
193 POLICY_SCOPE_USER, 184 POLICY_SCOPE_USER,
194 POLICY_SOURCE_CLOUD,
195 new base::FundamentalValue(1000), 185 new base::FundamentalValue(1000),
196 NULL); 186 NULL);
197 expected->Set(key::kHomepageLocation, 187 expected->Set(key::kHomepageLocation,
198 POLICY_LEVEL_RECOMMENDED, 188 POLICY_LEVEL_RECOMMENDED,
199 POLICY_SCOPE_USER, 189 POLICY_SCOPE_USER,
200 POLICY_SOURCE_CLOUD,
201 new base::StringValue(homepage), 190 new base::StringValue(homepage),
202 NULL); 191 NULL);
203 #if defined(OS_CHROMEOS) 192 #if defined(OS_CHROMEOS)
204 expected->Set(key::kChromeOsMultiProfileUserBehavior, 193 expected->Set(key::kChromeOsMultiProfileUserBehavior,
205 POLICY_LEVEL_MANDATORY, 194 POLICY_LEVEL_MANDATORY,
206 POLICY_SCOPE_USER, 195 POLICY_SCOPE_USER,
207 POLICY_SOURCE_ENTERPRISE_DEFAULT,
208 new base::StringValue("primary-only"), 196 new base::StringValue("primary-only"),
209 NULL); 197 NULL);
210 expected->Set(key::kEasyUnlockAllowed, 198 expected->Set(key::kEasyUnlockAllowed,
211 POLICY_LEVEL_MANDATORY, 199 POLICY_LEVEL_MANDATORY,
212 POLICY_SCOPE_USER, 200 POLICY_SCOPE_USER,
213 POLICY_SOURCE_ENTERPRISE_DEFAULT,
214 new base::FundamentalValue(false), 201 new base::FundamentalValue(false),
215 NULL); 202 NULL);
216 expected->Set(key::kCaptivePortalAuthenticationIgnoresProxy, 203 expected->Set(key::kCaptivePortalAuthenticationIgnoresProxy,
217 POLICY_LEVEL_MANDATORY, 204 POLICY_LEVEL_MANDATORY,
218 POLICY_SCOPE_USER, 205 POLICY_SCOPE_USER,
219 POLICY_SOURCE_ENTERPRISE_DEFAULT,
220 new base::FundamentalValue(false), 206 new base::FundamentalValue(false),
221 NULL); 207 NULL);
222 #endif 208 #endif
223 } 209 }
224 210
225 } // namespace 211 } // namespace
226 212
227 // Tests the cloud policy stack(s). 213 // Tests the cloud policy stack(s).
228 class CloudPolicyTest : public InProcessBrowserTest, 214 class CloudPolicyTest : public InProcessBrowserTest,
229 public PolicyService::Observer { 215 public PolicyService::Observer {
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 500
515 // They should now serialize to the same bytes. 501 // They should now serialize to the same bytes.
516 std::string chrome_settings_serialized; 502 std::string chrome_settings_serialized;
517 std::string cloud_policy_serialized; 503 std::string cloud_policy_serialized;
518 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); 504 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized));
519 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); 505 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized));
520 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); 506 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized);
521 } 507 }
522 508
523 } // namespace policy 509 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/net/proxy_policy_handler_unittest.cc ('k') | chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698