| 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/test/base/testing_profile_manager.h" | 5 #include "chrome/test/base/testing_profile_manager.h" |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/prefs/pref_service_syncable.h" | 9 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 10 #include "chrome/browser/profiles/profile_info_cache.h" | 10 #include "chrome/browser/profiles/profile_info_cache.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 | 172 |
| 173 void TestingProfileManager::DeleteProfileInfoCache() { | 173 void TestingProfileManager::DeleteProfileInfoCache() { |
| 174 profile_manager_->profile_info_cache_.reset(NULL); | 174 profile_manager_->profile_info_cache_.reset(NULL); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void TestingProfileManager::SetLoggedIn(bool logged_in) { | 177 void TestingProfileManager::SetLoggedIn(bool logged_in) { |
| 178 profile_manager_->logged_in_ = logged_in; | 178 profile_manager_->logged_in_ = logged_in; |
| 179 } | 179 } |
| 180 | 180 |
| 181 void TestingProfileManager::UpdateLastUser(Profile* last_active) { |
| 182 profile_manager_->UpdateLastUser(last_active); |
| 183 } |
| 184 |
| 181 const base::FilePath& TestingProfileManager::profiles_dir() { | 185 const base::FilePath& TestingProfileManager::profiles_dir() { |
| 182 DCHECK(called_set_up_); | 186 DCHECK(called_set_up_); |
| 183 return profiles_dir_.path(); | 187 return profiles_dir_.path(); |
| 184 } | 188 } |
| 185 | 189 |
| 186 ProfileManager* TestingProfileManager::profile_manager() { | 190 ProfileManager* TestingProfileManager::profile_manager() { |
| 187 DCHECK(called_set_up_); | 191 DCHECK(called_set_up_); |
| 188 return profile_manager_; | 192 return profile_manager_; |
| 189 } | 193 } |
| 190 | 194 |
| 191 ProfileInfoCache* TestingProfileManager::profile_info_cache() { | 195 ProfileInfoCache* TestingProfileManager::profile_info_cache() { |
| 192 DCHECK(called_set_up_); | 196 DCHECK(called_set_up_); |
| 193 return &profile_manager_->GetProfileInfoCache(); | 197 return &profile_manager_->GetProfileInfoCache(); |
| 194 } | 198 } |
| 195 | 199 |
| 196 void TestingProfileManager::SetUpInternal() { | 200 void TestingProfileManager::SetUpInternal() { |
| 197 ASSERT_FALSE(browser_process_->profile_manager()) | 201 ASSERT_FALSE(browser_process_->profile_manager()) |
| 198 << "ProfileManager already exists"; | 202 << "ProfileManager already exists"; |
| 199 | 203 |
| 200 // Set up the directory for profiles. | 204 // Set up the directory for profiles. |
| 201 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); | 205 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); |
| 202 | 206 |
| 203 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); | 207 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); |
| 204 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. | 208 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. |
| 205 | 209 |
| 206 called_set_up_ = true; | 210 called_set_up_ = true; |
| 207 } | 211 } |
| OLD | NEW |