Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "chrome/browser/profiles/profile_attributes_storage.h" | |
| 13 #include "chrome/browser/profiles/profile_info_cache.h" | 14 #include "chrome/browser/profiles/profile_info_cache.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
| 16 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
| 17 #include "components/syncable_prefs/pref_service_syncable.h" | 18 #include "components/syncable_prefs/pref_service_syncable.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 20 |
| 20 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
| 21 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 22 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 22 #endif | 23 #endif |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 ProfileManager* TestingProfileManager::profile_manager() { | 229 ProfileManager* TestingProfileManager::profile_manager() { |
| 229 DCHECK(called_set_up_); | 230 DCHECK(called_set_up_); |
| 230 return profile_manager_; | 231 return profile_manager_; |
| 231 } | 232 } |
| 232 | 233 |
| 233 ProfileInfoCache* TestingProfileManager::profile_info_cache() { | 234 ProfileInfoCache* TestingProfileManager::profile_info_cache() { |
| 234 DCHECK(called_set_up_); | 235 DCHECK(called_set_up_); |
| 235 return &profile_manager_->GetProfileInfoCache(); | 236 return &profile_manager_->GetProfileInfoCache(); |
| 236 } | 237 } |
| 237 | 238 |
| 239 ProfileAttributesStorage* TestingProfileManager::profile_attributes_storage() { | |
| 240 return profile_info_cache(); | |
|
sky
2016/01/20 16:19:55
Why do you need this function? Can't callers use p
lwchkg
2016/01/21 14:41:17
1. We plan to replace profile_info_cache() by this
| |
| 241 } | |
| 242 | |
| 238 void TestingProfileManager::SetUpInternal() { | 243 void TestingProfileManager::SetUpInternal() { |
| 239 ASSERT_FALSE(browser_process_->profile_manager()) | 244 ASSERT_FALSE(browser_process_->profile_manager()) |
| 240 << "ProfileManager already exists"; | 245 << "ProfileManager already exists"; |
| 241 | 246 |
| 242 // Set up the directory for profiles. | 247 // Set up the directory for profiles. |
| 243 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); | 248 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); |
| 244 | 249 |
| 245 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); | 250 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); |
| 246 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. | 251 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. |
| 247 | 252 |
| 248 profile_manager_->GetProfileInfoCache(). | 253 profile_manager_->GetProfileInfoCache(). |
| 249 set_disable_avatar_download_for_testing(true); | 254 set_disable_avatar_download_for_testing(true); |
| 250 called_set_up_ = true; | 255 called_set_up_ = true; |
| 251 } | 256 } |
| OLD | NEW |