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

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

Issue 624173002: replace OVERRIDE and FINAL with override and final in chrome/browser/[j-q]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 } // namespace 194 } // namespace
195 195
196 // Tests the cloud policy stack(s). 196 // Tests the cloud policy stack(s).
197 class CloudPolicyTest : public InProcessBrowserTest, 197 class CloudPolicyTest : public InProcessBrowserTest,
198 public PolicyService::Observer { 198 public PolicyService::Observer {
199 protected: 199 protected:
200 CloudPolicyTest() {} 200 CloudPolicyTest() {}
201 virtual ~CloudPolicyTest() {} 201 virtual ~CloudPolicyTest() {}
202 202
203 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 203 virtual void SetUpInProcessBrowserTestFixture() override {
204 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 204 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
205 ASSERT_NO_FATAL_FAILURE(SetServerPolicy(GetEmptyPolicy())); 205 ASSERT_NO_FATAL_FAILURE(SetServerPolicy(GetEmptyPolicy()));
206 206
207 test_server_.reset(new LocalPolicyTestServer(policy_file_path())); 207 test_server_.reset(new LocalPolicyTestServer(policy_file_path()));
208 ASSERT_TRUE(test_server_->Start()); 208 ASSERT_TRUE(test_server_->Start());
209 209
210 std::string url = test_server_->GetServiceURL().spec(); 210 std::string url = test_server_->GetServiceURL().spec();
211 211
212 CommandLine* command_line = CommandLine::ForCurrentProcess(); 212 CommandLine* command_line = CommandLine::ForCurrentProcess();
213 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, url); 213 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, url);
214 214
215 invalidation::ProfileInvalidationProviderFactory::GetInstance()-> 215 invalidation::ProfileInvalidationProviderFactory::GetInstance()->
216 RegisterTestingFactory(BuildFakeProfileInvalidationProvider); 216 RegisterTestingFactory(BuildFakeProfileInvalidationProvider);
217 } 217 }
218 218
219 virtual void SetUpOnMainThread() OVERRIDE { 219 virtual void SetUpOnMainThread() override {
220 ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service())) 220 ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service()))
221 << "Pre-existing policies in this machine will make this test fail."; 221 << "Pre-existing policies in this machine will make this test fail.";
222 222
223 BrowserPolicyConnector* connector = 223 BrowserPolicyConnector* connector =
224 g_browser_process->browser_policy_connector(); 224 g_browser_process->browser_policy_connector();
225 connector->ScheduleServiceInitialization(0); 225 connector->ScheduleServiceInitialization(0);
226 226
227 #if defined(OS_CHROMEOS) 227 #if defined(OS_CHROMEOS)
228 UserCloudPolicyManagerChromeOS* policy_manager = 228 UserCloudPolicyManagerChromeOS* policy_manager =
229 UserCloudPolicyManagerFactoryChromeOS::GetForProfile( 229 UserCloudPolicyManagerFactoryChromeOS::GetForProfile(
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 policy.size()); 303 policy.size());
304 ASSERT_EQ(static_cast<int>(policy.size()), result); 304 ASSERT_EQ(static_cast<int>(policy.size()), result);
305 } 305 }
306 306
307 base::FilePath policy_file_path() const { 307 base::FilePath policy_file_path() const {
308 return temp_dir_.path().AppendASCII("policy.json"); 308 return temp_dir_.path().AppendASCII("policy.json");
309 } 309 }
310 310
311 virtual void OnPolicyUpdated(const PolicyNamespace& ns, 311 virtual void OnPolicyUpdated(const PolicyNamespace& ns,
312 const PolicyMap& previous, 312 const PolicyMap& previous,
313 const PolicyMap& current) OVERRIDE { 313 const PolicyMap& current) override {
314 if (!on_policy_updated_.is_null()) { 314 if (!on_policy_updated_.is_null()) {
315 on_policy_updated_.Run(); 315 on_policy_updated_.Run();
316 on_policy_updated_.Reset(); 316 on_policy_updated_.Reset();
317 } 317 }
318 } 318 }
319 319
320 virtual void OnPolicyServiceInitialized(PolicyDomain domain) OVERRIDE {} 320 virtual void OnPolicyServiceInitialized(PolicyDomain domain) override {}
321 321
322 base::ScopedTempDir temp_dir_; 322 base::ScopedTempDir temp_dir_;
323 scoped_ptr<LocalPolicyTestServer> test_server_; 323 scoped_ptr<LocalPolicyTestServer> test_server_;
324 base::FilePath user_policy_key_file_; 324 base::FilePath user_policy_key_file_;
325 base::Closure on_policy_updated_; 325 base::Closure on_policy_updated_;
326 }; 326 };
327 327
328 IN_PROC_BROWSER_TEST_F(CloudPolicyTest, FetchPolicy) { 328 IN_PROC_BROWSER_TEST_F(CloudPolicyTest, FetchPolicy) {
329 PolicyService* policy_service = GetPolicyService(); 329 PolicyService* policy_service = GetPolicyService();
330 { 330 {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 482
483 // They should now serialize to the same bytes. 483 // They should now serialize to the same bytes.
484 std::string chrome_settings_serialized; 484 std::string chrome_settings_serialized;
485 std::string cloud_policy_serialized; 485 std::string cloud_policy_serialized;
486 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); 486 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized));
487 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); 487 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized));
488 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); 488 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized);
489 } 489 }
490 490
491 } // namespace policy 491 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/chrome_browser_policy_connector.h ('k') | chrome/browser/policy/cloud/cloud_policy_invalidator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698