| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 TestingProfilesMap::iterator it = testing_profiles_.find(name); | 161 TestingProfilesMap::iterator it = testing_profiles_.find(name); |
| 162 DCHECK(it != testing_profiles_.end()); | 162 DCHECK(it != testing_profiles_.end()); |
| 163 | 163 |
| 164 TestingProfile* profile = it->second; | 164 TestingProfile* profile = it->second; |
| 165 | 165 |
| 166 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); | 166 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); |
| 167 cache.DeleteProfileFromCache(profile->GetPath()); | 167 cache.DeleteProfileFromCache(profile->GetPath()); |
| 168 | 168 |
| 169 profile_manager_->profiles_info_.erase(profile->GetPath()); | 169 profile_manager_->profiles_info_.erase(profile->GetPath()); |
| 170 |
| 171 testing_profiles_.erase(it); |
| 170 } | 172 } |
| 171 | 173 |
| 172 void TestingProfileManager::DeleteAllTestingProfiles() { | 174 void TestingProfileManager::DeleteAllTestingProfiles() { |
| 173 for (TestingProfilesMap::iterator it = testing_profiles_.begin(); | 175 for (TestingProfilesMap::iterator it = testing_profiles_.begin(); |
| 174 it != testing_profiles_.end(); ++it) { | 176 it != testing_profiles_.end(); ++it) { |
| 175 TestingProfile* profile = it->second; | 177 TestingProfile* profile = it->second; |
| 176 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); | 178 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); |
| 177 cache.DeleteProfileFromCache(profile->GetPath()); | 179 cache.DeleteProfileFromCache(profile->GetPath()); |
| 178 } | 180 } |
| 179 testing_profiles_.clear(); | 181 testing_profiles_.clear(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 << "ProfileManager already exists"; | 235 << "ProfileManager already exists"; |
| 234 | 236 |
| 235 // Set up the directory for profiles. | 237 // Set up the directory for profiles. |
| 236 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); | 238 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); |
| 237 | 239 |
| 238 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); | 240 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); |
| 239 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. | 241 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. |
| 240 | 242 |
| 241 called_set_up_ = true; | 243 called_set_up_ = true; |
| 242 } | 244 } |
| OLD | NEW |