| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 TestingProfilesMap::iterator it = testing_profiles_.find(name); | 142 TestingProfilesMap::iterator it = testing_profiles_.find(name); |
| 143 DCHECK(it != testing_profiles_.end()); | 143 DCHECK(it != testing_profiles_.end()); |
| 144 | 144 |
| 145 TestingProfile* profile = it->second; | 145 TestingProfile* profile = it->second; |
| 146 | 146 |
| 147 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); | 147 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); |
| 148 cache.DeleteProfileFromCache(profile->GetPath()); | 148 cache.DeleteProfileFromCache(profile->GetPath()); |
| 149 | 149 |
| 150 profile_manager_->profiles_info_.erase(profile->GetPath()); | 150 profile_manager_->profiles_info_.erase(profile->GetPath()); |
| 151 |
| 152 testing_profiles_.erase(it); |
| 151 } | 153 } |
| 152 | 154 |
| 153 void TestingProfileManager::DeleteAllTestingProfiles() { | 155 void TestingProfileManager::DeleteAllTestingProfiles() { |
| 154 for (TestingProfilesMap::iterator it = testing_profiles_.begin(); | 156 for (TestingProfilesMap::iterator it = testing_profiles_.begin(); |
| 155 it != testing_profiles_.end(); ++it) { | 157 it != testing_profiles_.end(); ++it) { |
| 156 TestingProfile* profile = it->second; | 158 TestingProfile* profile = it->second; |
| 157 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); | 159 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); |
| 158 cache.DeleteProfileFromCache(profile->GetPath()); | 160 cache.DeleteProfileFromCache(profile->GetPath()); |
| 159 } | 161 } |
| 160 testing_profiles_.clear(); | 162 testing_profiles_.clear(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 << "ProfileManager already exists"; | 206 << "ProfileManager already exists"; |
| 205 | 207 |
| 206 // Set up the directory for profiles. | 208 // Set up the directory for profiles. |
| 207 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); | 209 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); |
| 208 | 210 |
| 209 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); | 211 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); |
| 210 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. | 212 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. |
| 211 | 213 |
| 212 called_set_up_ = true; | 214 called_set_up_ = true; |
| 213 } | 215 } |
| OLD | NEW |