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" |
11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/common/chrome_constants.h" | 12 #include "chrome/common/chrome_constants.h" |
13 #include "chrome/test/base/testing_browser_process.h" | 13 #include "chrome/test/base/testing_browser_process.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 #if defined(OS_CHROMEOS) | 16 #if defined(OS_CHROMEOS) |
17 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
18 #endif | 18 #endif |
19 | 19 |
20 const char kGuestProfileName[] = "Guest"; | 20 const char kGuestProfileName[] = "Guest"; |
21 | 21 |
22 namespace testing { | 22 namespace testing { |
23 | 23 |
24 class ProfileManager : public ::ProfileManagerWithoutInit { | 24 class ProfileManager : public ::ProfileManagerWithoutInit { |
25 public: | 25 public: |
26 explicit ProfileManager(const base::FilePath& user_data_dir) | 26 explicit ProfileManager(const base::FilePath& user_data_dir) |
27 : ::ProfileManagerWithoutInit(user_data_dir) {} | 27 : ::ProfileManagerWithoutInit(user_data_dir) {} |
28 | 28 |
29 protected: | 29 protected: |
30 virtual Profile* CreateProfileHelper( | 30 Profile* CreateProfileHelper(const base::FilePath& file_path) override { |
31 const base::FilePath& file_path) override { | |
32 return new TestingProfile(file_path); | 31 return new TestingProfile(file_path); |
33 } | 32 } |
34 }; | 33 }; |
35 | 34 |
36 } // namespace testing | 35 } // namespace testing |
37 | 36 |
38 TestingProfileManager::TestingProfileManager(TestingBrowserProcess* process) | 37 TestingProfileManager::TestingProfileManager(TestingBrowserProcess* process) |
39 : called_set_up_(false), | 38 : called_set_up_(false), |
40 browser_process_(process), | 39 browser_process_(process), |
41 local_state_(process), | 40 local_state_(process), |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 << "ProfileManager already exists"; | 198 << "ProfileManager already exists"; |
200 | 199 |
201 // Set up the directory for profiles. | 200 // Set up the directory for profiles. |
202 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); | 201 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); |
203 | 202 |
204 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); | 203 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); |
205 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. | 204 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. |
206 | 205 |
207 called_set_up_ = true; | 206 called_set_up_ = true; |
208 } | 207 } |
OLD | NEW |