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 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 183 profile_manager_->UpdateLastUser(last_active); |
| 184 #endif |
| 185 } |
| 186 |
181 const base::FilePath& TestingProfileManager::profiles_dir() { | 187 const base::FilePath& TestingProfileManager::profiles_dir() { |
182 DCHECK(called_set_up_); | 188 DCHECK(called_set_up_); |
183 return profiles_dir_.path(); | 189 return profiles_dir_.path(); |
184 } | 190 } |
185 | 191 |
186 ProfileManager* TestingProfileManager::profile_manager() { | 192 ProfileManager* TestingProfileManager::profile_manager() { |
187 DCHECK(called_set_up_); | 193 DCHECK(called_set_up_); |
188 return profile_manager_; | 194 return profile_manager_; |
189 } | 195 } |
190 | 196 |
191 ProfileInfoCache* TestingProfileManager::profile_info_cache() { | 197 ProfileInfoCache* TestingProfileManager::profile_info_cache() { |
192 DCHECK(called_set_up_); | 198 DCHECK(called_set_up_); |
193 return &profile_manager_->GetProfileInfoCache(); | 199 return &profile_manager_->GetProfileInfoCache(); |
194 } | 200 } |
195 | 201 |
196 void TestingProfileManager::SetUpInternal() { | 202 void TestingProfileManager::SetUpInternal() { |
197 ASSERT_FALSE(browser_process_->profile_manager()) | 203 ASSERT_FALSE(browser_process_->profile_manager()) |
198 << "ProfileManager already exists"; | 204 << "ProfileManager already exists"; |
199 | 205 |
200 // Set up the directory for profiles. | 206 // Set up the directory for profiles. |
201 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); | 207 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); |
202 | 208 |
203 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); | 209 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); |
204 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. | 210 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. |
205 | 211 |
206 called_set_up_ = true; | 212 called_set_up_ = true; |
207 } | 213 } |
OLD | NEW |