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 #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 <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "chrome/test/base/scoped_testing_local_state.h" | 16 #include "chrome/test/base/scoped_testing_local_state.h" |
| 17 #include "chrome/test/base/testing_profile.h" | |
| 17 | 18 |
| 18 class PrefServiceSyncable; | 19 class PrefServiceSyncable; |
| 19 class ProfileInfoCache; | 20 class ProfileInfoCache; |
| 20 class ProfileManager; | 21 class ProfileManager; |
| 21 class TestingBrowserProcess; | 22 class TestingBrowserProcess; |
| 22 class TestingProfile; | 23 class TestingProfile; |
| 23 | 24 |
| 24 // The TestingProfileManager is a TestingProfile factory for a multi-profile | 25 // The TestingProfileManager is a TestingProfile factory for a multi-profile |
| 25 // environment. It will bring up a full ProfileManager and attach it to the | 26 // environment. It will bring up a full ProfileManager and attach it to the |
| 26 // TestingBrowserProcess set up in your test. | 27 // TestingBrowserProcess set up in your test. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 40 bool SetUp() WARN_UNUSED_RESULT; | 41 bool SetUp() WARN_UNUSED_RESULT; |
| 41 | 42 |
| 42 // Creates a new TestingProfile whose data lives in a directory related to | 43 // Creates a new TestingProfile whose data lives in a directory related to |
| 43 // profile_name, which is a non-user-visible key for the test environment. | 44 // profile_name, which is a non-user-visible key for the test environment. |
| 44 // |prefs| is the PrefService used by the profile. If it is NULL, the profile | 45 // |prefs| is the PrefService used by the profile. If it is NULL, the profile |
| 45 // creates a PrefService on demand. | 46 // creates a PrefService on demand. |
| 46 // |user_name|, |avatar_id| and |managed_user_id| are passed along to the | 47 // |user_name|, |avatar_id| and |managed_user_id| are passed along to the |
| 47 // ProfileInfoCache and provide the user-visible profile metadata. This will | 48 // ProfileInfoCache and provide the user-visible profile metadata. This will |
| 48 // register the TestingProfile with the profile subsystem as well. The | 49 // register the TestingProfile with the profile subsystem as well. The |
| 49 // subsystem owns the Profile and returns a weak pointer. | 50 // subsystem owns the Profile and returns a weak pointer. |
| 51 // |factories| contains BCKSs to use with the newly created profile. | |
| 52 TestingProfile* CreateTestingProfileWithFactories( | |
| 53 const std::string& profile_name, | |
| 54 scoped_ptr<PrefServiceSyncable> prefs, | |
| 55 const string16& user_name, | |
| 56 int avatar_id, | |
| 57 const std::string& managed_user_id, | |
| 58 const TestingProfile::TestingFactories& factories); | |
| 59 | |
| 60 // Same as above, with no testing factories. | |
| 50 TestingProfile* CreateTestingProfile(const std::string& profile_name, | 61 TestingProfile* CreateTestingProfile(const std::string& profile_name, |
|
Paweł Hajdan Jr.
2013/11/18 19:59:33
Can we delete this and convert callers if there ar
| |
| 51 scoped_ptr<PrefServiceSyncable> prefs, | 62 scoped_ptr<PrefServiceSyncable> prefs, |
| 52 const string16& user_name, | 63 const string16& user_name, |
| 53 int avatar_id, | 64 int avatar_id, |
| 54 const std::string& managed_user_id); | 65 const std::string& managed_user_id); |
| 55 | 66 |
| 56 // Small helper for creating testing profiles. Just forwards to above. | 67 // Small helper for creating testing profiles. Just forwards to above. |
| 57 TestingProfile* CreateTestingProfile(const std::string& name); | 68 TestingProfile* CreateTestingProfile(const std::string& name); |
| 58 | 69 |
| 59 // Deletes a TestingProfile from the profile subsystem. | 70 // Deletes a TestingProfile from the profile subsystem. |
| 60 void DeleteTestingProfile(const std::string& profile_name); | 71 void DeleteTestingProfile(const std::string& profile_name); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 // Weak reference to the profile manager. | 105 // Weak reference to the profile manager. |
| 95 ProfileManager* profile_manager_; | 106 ProfileManager* profile_manager_; |
| 96 | 107 |
| 97 // Map of profile_name to TestingProfile* from CreateTestingProfile(). | 108 // Map of profile_name to TestingProfile* from CreateTestingProfile(). |
| 98 TestingProfilesMap testing_profiles_; | 109 TestingProfilesMap testing_profiles_; |
| 99 | 110 |
| 100 DISALLOW_COPY_AND_ASSIGN(TestingProfileManager); | 111 DISALLOW_COPY_AND_ASSIGN(TestingProfileManager); |
| 101 }; | 112 }; |
| 102 | 113 |
| 103 #endif // CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ | 114 #endif // CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ |
| OLD | NEW |