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

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_test_helper.cc

Issue 14927015: Translate device-local account IDs to user IDs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
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 "chrome/browser/chromeos/settings/device_settings_test_helper.h" 5 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/threading/sequenced_worker_pool.h" 9 #include "base/threading/sequenced_worker_pool.h"
10 #include "chrome/browser/chromeos/settings/device_settings_service.h" 10 #include "chrome/browser/chromeos/settings/device_settings_service.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 ScopedDeviceSettingsTestHelper::~ScopedDeviceSettingsTestHelper() { 176 ScopedDeviceSettingsTestHelper::~ScopedDeviceSettingsTestHelper() {
177 Flush(); 177 Flush();
178 DeviceSettingsService::Get()->UnsetSessionManager(); 178 DeviceSettingsService::Get()->UnsetSessionManager();
179 DeviceSettingsService::Shutdown(); 179 DeviceSettingsService::Shutdown();
180 } 180 }
181 181
182 DeviceSettingsTestBase::DeviceSettingsTestBase() 182 DeviceSettingsTestBase::DeviceSettingsTestBase()
183 : loop_(MessageLoop::TYPE_UI), 183 : loop_(MessageLoop::TYPE_UI),
184 ui_thread_(content::BrowserThread::UI, &loop_), 184 ui_thread_(content::BrowserThread::UI, &loop_),
185 file_thread_(content::BrowserThread::FILE, &loop_), 185 file_thread_(content::BrowserThread::FILE, &loop_),
186 owner_key_util_(new MockOwnerKeyUtil()) {} 186 owner_key_util_(new MockOwnerKeyUtil()) {
187 DeviceSettingsService::Initialize();
188 }
187 189
188 DeviceSettingsTestBase::~DeviceSettingsTestBase() { 190 DeviceSettingsTestBase::~DeviceSettingsTestBase() {
189 base::RunLoop().RunUntilIdle(); 191 base::RunLoop().RunUntilIdle();
192 DeviceSettingsService::Shutdown();
190 } 193 }
191 194
192 void DeviceSettingsTestBase::SetUp() { 195 void DeviceSettingsTestBase::SetUp() {
193 device_policy_.payload().mutable_metrics_enabled()->set_metrics_enabled( 196 device_policy_.payload().mutable_metrics_enabled()->set_metrics_enabled(
194 false); 197 false);
195 owner_key_util_->SetPublicKeyFromPrivateKey(device_policy_.signing_key()); 198 owner_key_util_->SetPublicKeyFromPrivateKey(device_policy_.signing_key());
196 device_policy_.Build(); 199 device_policy_.Build();
197 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob()); 200 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob());
198 device_settings_service_.SetSessionManager(&device_settings_test_helper_, 201 DeviceSettingsService::Get()->SetSessionManager(&device_settings_test_helper_,
199 owner_key_util_); 202 owner_key_util_);
200 } 203 }
201 204
202 void DeviceSettingsTestBase::TearDown() { 205 void DeviceSettingsTestBase::TearDown() {
203 FlushDeviceSettings(); 206 FlushDeviceSettings();
204 device_settings_service_.UnsetSessionManager(); 207 DeviceSettingsService::Get()->UnsetSessionManager();
205 } 208 }
206 209
207 void DeviceSettingsTestBase::FlushDeviceSettings() { 210 void DeviceSettingsTestBase::FlushDeviceSettings() {
208 device_settings_test_helper_.Flush(); 211 device_settings_test_helper_.Flush();
209 } 212 }
210 213
211 void DeviceSettingsTestBase::ReloadDeviceSettings() { 214 void DeviceSettingsTestBase::ReloadDeviceSettings() {
212 device_settings_service_.OwnerKeySet(true); 215 DeviceSettingsService::Get()->OwnerKeySet(true);
213 FlushDeviceSettings(); 216 FlushDeviceSettings();
214 } 217 }
215 218
216 } // namespace chromeos 219 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698