| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 loop_.QuitNow(); | 107 loop_.QuitNow(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 virtual void SetUp() { | 110 virtual void SetUp() { |
| 111 prefs_.reset(new TestingPrefService); | 111 prefs_.reset(new TestingPrefService); |
| 112 CloudPolicySubsystem::RegisterPrefs(prefs_.get()); | 112 CloudPolicySubsystem::RegisterPrefs(prefs_.get()); |
| 113 ((TestingBrowserProcess*) g_browser_process)->SetLocalState(prefs_.get()); | 113 ((TestingBrowserProcess*) g_browser_process)->SetLocalState(prefs_.get()); |
| 114 | 114 |
| 115 logger_.reset(new EventLogger); | 115 logger_.reset(new EventLogger); |
| 116 factory_.reset(new TestingPolicyURLFetcherFactory(logger_.get())); | 116 factory_.reset(new TestingPolicyURLFetcherFactory(logger_.get())); |
| 117 URLFetcher::set_factory(factory_.get()); | |
| 118 ASSERT_TRUE(temp_user_data_dir_.CreateUniqueTempDir()); | 117 ASSERT_TRUE(temp_user_data_dir_.CreateUniqueTempDir()); |
| 119 data_store_.reset(CloudPolicyDataStore::CreateForUserPolicies()); | 118 data_store_.reset(CloudPolicyDataStore::CreateForUserPolicies()); |
| 120 cache_ = new UserPolicyCache( | 119 cache_ = new UserPolicyCache( |
| 121 temp_user_data_dir_.path().AppendASCII("CloudPolicyControllerTest")); | 120 temp_user_data_dir_.path().AppendASCII("CloudPolicyControllerTest")); |
| 122 cloud_policy_subsystem_.reset(new TestingCloudPolicySubsystem( | 121 cloud_policy_subsystem_.reset(new TestingCloudPolicySubsystem( |
| 123 data_store_.get(), cache_, | 122 data_store_.get(), cache_, |
| 124 kDeviceManagementUrl, logger_.get())); | 123 kDeviceManagementUrl, logger_.get())); |
| 125 cloud_policy_subsystem_->CompleteInitialization( | 124 cloud_policy_subsystem_->CompleteInitialization( |
| 126 prefs::kDevicePolicyRefreshRate, 0); | 125 prefs::kDevicePolicyRefreshRate, 0); |
| 127 } | 126 } |
| 128 | 127 |
| 129 virtual void TearDown() { | 128 virtual void TearDown() { |
| 130 ((TestingBrowserProcess*) g_browser_process)->SetLocalState(NULL); | 129 static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState(NULL); |
| 131 cloud_policy_subsystem_->Shutdown(); | 130 cloud_policy_subsystem_->Shutdown(); |
| 132 cloud_policy_subsystem_.reset(); | 131 cloud_policy_subsystem_.reset(); |
| 133 data_store_.reset(); | 132 data_store_.reset(); |
| 134 factory_.reset(); | 133 factory_.reset(); |
| 135 logger_.reset(); | 134 logger_.reset(); |
| 136 prefs_.reset(); | 135 prefs_.reset(); |
| 137 } | 136 } |
| 138 | 137 |
| 139 void ExecuteTest() { | 138 void ExecuteTest() { |
| 140 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 ExecuteTest(); | 381 ExecuteTest(); |
| 383 VerifyTest("http://www.youtube.com"); | 382 VerifyTest("http://www.youtube.com"); |
| 384 } | 383 } |
| 385 | 384 |
| 386 INSTANTIATE_TEST_CASE_P( | 385 INSTANTIATE_TEST_CASE_P( |
| 387 CloudPolicySubsystemPolicyReregisterTestInstance, | 386 CloudPolicySubsystemPolicyReregisterTestInstance, |
| 388 CloudPolicySubsystemPolicyReregisterTest, | 387 CloudPolicySubsystemPolicyReregisterTest, |
| 389 testing::Values(401, 403, 410)); | 388 testing::Values(401, 403, 410)); |
| 390 | 389 |
| 391 } // policy | 390 } // policy |
| OLD | NEW |