| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/profiles/profile_info_cache.h" | 10 #include "chrome/browser/profiles/profile_info_cache.h" |
| 11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
| 12 #include "chrome/test/base/testing_browser_process.h" | 12 #include "chrome/test/base/testing_browser_process.h" |
| 13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 namespace testing { | 16 namespace testing { |
| 17 | 17 |
| 18 class ProfileManager : public ::ProfileManager { | 18 class ProfileManager : public ::ProfileManager { |
| 19 public: | 19 public: |
| 20 explicit ProfileManager(const FilePath& user_data_dir) | 20 explicit ProfileManager(const FilePath& user_data_dir) |
| 21 : ::ProfileManager(user_data_dir) {} | 21 : ::ProfileManager(user_data_dir) {} |
| 22 | 22 |
| 23 protected: | 23 protected: |
| 24 virtual Profile* CreateProfile(const FilePath& file_path) { | 24 virtual Profile* CreateProfileHelper(const FilePath& file_path) OVERRIDE { |
| 25 return new TestingProfile(file_path); | 25 return new TestingProfile(file_path); |
| 26 } | 26 } |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 } // namespace testing | 29 } // namespace testing |
| 30 | 30 |
| 31 TestingProfileManager::TestingProfileManager(TestingBrowserProcess* process) | 31 TestingProfileManager::TestingProfileManager(TestingBrowserProcess* process) |
| 32 : called_set_up_(false), | 32 : called_set_up_(false), |
| 33 browser_process_(process), | 33 browser_process_(process), |
| 34 local_state_(process) { | 34 local_state_(process) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 << "ProfileManager already exists"; | 106 << "ProfileManager already exists"; |
| 107 | 107 |
| 108 // Set up the directory for profiles. | 108 // Set up the directory for profiles. |
| 109 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); | 109 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); |
| 110 | 110 |
| 111 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); | 111 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); |
| 112 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. | 112 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. |
| 113 | 113 |
| 114 called_set_up_ = true; | 114 called_set_up_ = true; |
| 115 } | 115 } |
| OLD | NEW |