| OLD | NEW |
| 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/message_loop.h" | 7 #include "base/message_loop/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/ownership/owner_settings_service_chromeos.h" | 10 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 void DeviceSettingsTestBase::FlushDeviceSettings() { | 240 void DeviceSettingsTestBase::FlushDeviceSettings() { |
| 241 device_settings_test_helper_.Flush(); | 241 device_settings_test_helper_.Flush(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void DeviceSettingsTestBase::ReloadDeviceSettings() { | 244 void DeviceSettingsTestBase::ReloadDeviceSettings() { |
| 245 device_settings_service_.OwnerKeySet(true); | 245 device_settings_service_.OwnerKeySet(true); |
| 246 FlushDeviceSettings(); | 246 FlushDeviceSettings(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void DeviceSettingsTestBase::InitOwner(const std::string& user_id, | 249 void DeviceSettingsTestBase::InitOwner(const AccountId& account_id, |
| 250 bool tpm_is_ready) { | 250 bool tpm_is_ready) { |
| 251 const user_manager::User* user = user_manager_->FindUser(user_id); | 251 const user_manager::User* user = user_manager_->FindUser(account_id); |
| 252 if (!user) { | 252 if (!user) { |
| 253 user = user_manager_->AddUser(user_id); | 253 user = user_manager_->AddUser(account_id); |
| 254 profile_->set_profile_name(user_id); | 254 profile_->set_profile_name(account_id.GetUserEmail()); |
| 255 | 255 |
| 256 ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, | 256 ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, |
| 257 profile_.get()); | 257 profile_.get()); |
| 258 ProfileHelper::Get()->SetProfileToUserMappingForTesting( | 258 ProfileHelper::Get()->SetProfileToUserMappingForTesting( |
| 259 const_cast<user_manager::User*>(user)); | 259 const_cast<user_manager::User*>(user)); |
| 260 } | 260 } |
| 261 OwnerSettingsServiceChromeOS* service = | 261 OwnerSettingsServiceChromeOS* service = |
| 262 OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(profile_.get()); | 262 OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(profile_.get()); |
| 263 CHECK(service); | 263 CHECK(service); |
| 264 if (tpm_is_ready) | 264 if (tpm_is_ready) |
| 265 service->OnTPMTokenReady(true /* token is enabled */); | 265 service->OnTPMTokenReady(true /* token is enabled */); |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace chromeos | 268 } // namespace chromeos |
| OLD | NEW |