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. |
50 TestingProfile* CreateTestingProfile(const std::string& profile_name, | 51 // |factories| contains BCKSs to use with the newly created profile. |
51 scoped_ptr<PrefServiceSyncable> prefs, | 52 TestingProfile* CreateTestingProfile( |
52 const string16& user_name, | 53 const std::string& profile_name, |
53 int avatar_id, | 54 scoped_ptr<PrefServiceSyncable> prefs, |
54 const std::string& managed_user_id); | 55 const string16& user_name, |
| 56 int avatar_id, |
| 57 const std::string& managed_user_id, |
| 58 const TestingProfile::TestingFactories& factories); |
55 | 59 |
56 // Small helper for creating testing profiles. Just forwards to above. | 60 // Small helper for creating testing profiles. Just forwards to above. |
57 TestingProfile* CreateTestingProfile(const std::string& name); | 61 TestingProfile* CreateTestingProfile(const std::string& name); |
58 | 62 |
59 // Deletes a TestingProfile from the profile subsystem. | 63 // Deletes a TestingProfile from the profile subsystem. |
60 void DeleteTestingProfile(const std::string& profile_name); | 64 void DeleteTestingProfile(const std::string& profile_name); |
61 | 65 |
62 // Deletes the cache instance. This is useful for testing that the cache is | 66 // Deletes the cache instance. This is useful for testing that the cache is |
63 // properly persisting data. | 67 // properly persisting data. |
64 void DeleteProfileInfoCache(); | 68 void DeleteProfileInfoCache(); |
(...skipping 29 matching lines...) Expand all Loading... |
94 // Weak reference to the profile manager. | 98 // Weak reference to the profile manager. |
95 ProfileManager* profile_manager_; | 99 ProfileManager* profile_manager_; |
96 | 100 |
97 // Map of profile_name to TestingProfile* from CreateTestingProfile(). | 101 // Map of profile_name to TestingProfile* from CreateTestingProfile(). |
98 TestingProfilesMap testing_profiles_; | 102 TestingProfilesMap testing_profiles_; |
99 | 103 |
100 DISALLOW_COPY_AND_ASSIGN(TestingProfileManager); | 104 DISALLOW_COPY_AND_ASSIGN(TestingProfileManager); |
101 }; | 105 }; |
102 | 106 |
103 #endif // CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ | 107 #endif // CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ |
OLD | NEW |