| 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_attributes_storage.h" |
| 10 #include "chrome/browser/profiles/profile_info_cache.h" | 11 #include "chrome/browser/profiles/profile_info_cache.h" |
| 11 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
| 12 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
| 13 #include "chrome/test/base/testing_browser_process.h" | 14 #include "chrome/test/base/testing_browser_process.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| 16 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
| 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 18 #endif | 19 #endif |
| 19 | 20 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 ProfileManager* TestingProfileManager::profile_manager() { | 224 ProfileManager* TestingProfileManager::profile_manager() { |
| 224 DCHECK(called_set_up_); | 225 DCHECK(called_set_up_); |
| 225 return profile_manager_; | 226 return profile_manager_; |
| 226 } | 227 } |
| 227 | 228 |
| 228 ProfileInfoCache* TestingProfileManager::profile_info_cache() { | 229 ProfileInfoCache* TestingProfileManager::profile_info_cache() { |
| 229 DCHECK(called_set_up_); | 230 DCHECK(called_set_up_); |
| 230 return &profile_manager_->GetProfileInfoCache(); | 231 return &profile_manager_->GetProfileInfoCache(); |
| 231 } | 232 } |
| 232 | 233 |
| 234 ProfileAttributesStorage* TestingProfileManager::profile_attributes_storage() { |
| 235 return profile_info_cache(); |
| 236 } |
| 237 |
| 233 void TestingProfileManager::SetUpInternal() { | 238 void TestingProfileManager::SetUpInternal() { |
| 234 ASSERT_FALSE(browser_process_->profile_manager()) | 239 ASSERT_FALSE(browser_process_->profile_manager()) |
| 235 << "ProfileManager already exists"; | 240 << "ProfileManager already exists"; |
| 236 | 241 |
| 237 // Set up the directory for profiles. | 242 // Set up the directory for profiles. |
| 238 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); | 243 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); |
| 239 | 244 |
| 240 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); | 245 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); |
| 241 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. | 246 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. |
| 242 | 247 |
| 243 profile_manager_->GetProfileInfoCache(). | 248 profile_manager_->GetProfileInfoCache(). |
| 244 set_disable_avatar_download_for_testing(true); | 249 set_disable_avatar_download_for_testing(true); |
| 245 called_set_up_ = true; | 250 called_set_up_ = true; |
| 246 } | 251 } |
| OLD | NEW |