| 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 #ifndef CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ | 5 #ifndef CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ |
| 6 #define CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ | 6 #define CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 17 #include "chrome/test/base/scoped_testing_local_state.h" | 17 #include "chrome/test/base/scoped_testing_local_state.h" |
| 18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 19 | 19 |
| 20 class ProfileInfoCache; | 20 class ProfileInfoCache; |
| 21 class ProfileAttributesStorage; | 21 class ProfileAttributesStorage; |
| 22 class ProfileManager; | 22 class ProfileManager; |
| 23 class TestingBrowserProcess; | 23 class TestingBrowserProcess; |
| 24 | 24 |
| 25 namespace syncable_prefs { | 25 namespace sync_preferences { |
| 26 class PrefServiceSyncable; | 26 class PrefServiceSyncable; |
| 27 } | 27 } |
| 28 | 28 |
| 29 // The TestingProfileManager is a TestingProfile factory for a multi-profile | 29 // The TestingProfileManager is a TestingProfile factory for a multi-profile |
| 30 // environment. It will bring up a full ProfileManager and attach it to the | 30 // environment. It will bring up a full ProfileManager and attach it to the |
| 31 // TestingBrowserProcess set up in your test. | 31 // TestingBrowserProcess set up in your test. |
| 32 // | 32 // |
| 33 // When a Profile is needed for testing, create it through the factory method | 33 // When a Profile is needed for testing, create it through the factory method |
| 34 // below instead of creating it via |new TestingProfile|. It is not possible | 34 // below instead of creating it via |new TestingProfile|. It is not possible |
| 35 // to register profiles created in that fashion with the ProfileManager. | 35 // to register profiles created in that fashion with the ProfileManager. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 48 // profile_name, which is a non-user-visible key for the test environment. | 48 // profile_name, which is a non-user-visible key for the test environment. |
| 49 // |prefs| is the PrefService used by the profile. If it is NULL, the profile | 49 // |prefs| is the PrefService used by the profile. If it is NULL, the profile |
| 50 // creates a PrefService on demand. | 50 // creates a PrefService on demand. |
| 51 // |user_name|, |avatar_id| and |supervised_user_id| are passed along to the | 51 // |user_name|, |avatar_id| and |supervised_user_id| are passed along to the |
| 52 // ProfileInfoCache and provide the user-visible profile metadata. This will | 52 // ProfileInfoCache and provide the user-visible profile metadata. This will |
| 53 // register the TestingProfile with the profile subsystem as well. The | 53 // register the TestingProfile with the profile subsystem as well. The |
| 54 // subsystem owns the Profile and returns a weak pointer. | 54 // subsystem owns the Profile and returns a weak pointer. |
| 55 // |factories| contains BCKSs to use with the newly created profile. | 55 // |factories| contains BCKSs to use with the newly created profile. |
| 56 TestingProfile* CreateTestingProfile( | 56 TestingProfile* CreateTestingProfile( |
| 57 const std::string& profile_name, | 57 const std::string& profile_name, |
| 58 std::unique_ptr<syncable_prefs::PrefServiceSyncable> prefs, | 58 std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs, |
| 59 const base::string16& user_name, | 59 const base::string16& user_name, |
| 60 int avatar_id, | 60 int avatar_id, |
| 61 const std::string& supervised_user_id, | 61 const std::string& supervised_user_id, |
| 62 const TestingProfile::TestingFactories& factories); | 62 const TestingProfile::TestingFactories& factories); |
| 63 | 63 |
| 64 // Small helper for creating testing profiles. Just forwards to above. | 64 // Small helper for creating testing profiles. Just forwards to above. |
| 65 TestingProfile* CreateTestingProfile(const std::string& name); | 65 TestingProfile* CreateTestingProfile(const std::string& name); |
| 66 | 66 |
| 67 // Creates a new guest TestingProfile whose data lives in the guest profile | 67 // Creates a new guest TestingProfile whose data lives in the guest profile |
| 68 // test environment directory, as specified by the profile manager. | 68 // test environment directory, as specified by the profile manager. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Weak reference to the profile manager. | 136 // Weak reference to the profile manager. |
| 137 ProfileManager* profile_manager_; | 137 ProfileManager* profile_manager_; |
| 138 | 138 |
| 139 // Map of profile_name to TestingProfile* from CreateTestingProfile(). | 139 // Map of profile_name to TestingProfile* from CreateTestingProfile(). |
| 140 TestingProfilesMap testing_profiles_; | 140 TestingProfilesMap testing_profiles_; |
| 141 | 141 |
| 142 DISALLOW_COPY_AND_ASSIGN(TestingProfileManager); | 142 DISALLOW_COPY_AND_ASSIGN(TestingProfileManager); |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 #endif // CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ | 145 #endif // CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ |
| OLD | NEW |