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 |
(...skipping 26 matching lines...) Expand all Loading... |
37 // This needs to be called in testing::Test::SetUp() to put the object in a | 37 // This needs to be called in testing::Test::SetUp() to put the object in a |
38 // valid state. Some work cannot be done in a constructor because it may | 38 // valid state. Some work cannot be done in a constructor because it may |
39 // call gtest asserts to verify setup. The result of this call can be used | 39 // call gtest asserts to verify setup. The result of this call can be used |
40 // to ASSERT before doing more SetUp work in the test. | 40 // to ASSERT before doing more SetUp work in the test. |
41 bool SetUp() WARN_UNUSED_RESULT; | 41 bool SetUp() WARN_UNUSED_RESULT; |
42 | 42 |
43 // 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 |
44 // 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. |
45 // |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 |
46 // creates a PrefService on demand. | 46 // creates a PrefService on demand. |
47 // |user_name|, |avatar_id| and |managed_user_id| are passed along to the | 47 // |user_name|, |avatar_id| and |supervised_user_id| are passed along to the |
48 // ProfileInfoCache and provide the user-visible profile metadata. This will | 48 // ProfileInfoCache and provide the user-visible profile metadata. This will |
49 // register the TestingProfile with the profile subsystem as well. The | 49 // register the TestingProfile with the profile subsystem as well. The |
50 // 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. | 51 // |factories| contains BCKSs to use with the newly created profile. |
52 TestingProfile* CreateTestingProfile( | 52 TestingProfile* CreateTestingProfile( |
53 const std::string& profile_name, | 53 const std::string& profile_name, |
54 scoped_ptr<PrefServiceSyncable> prefs, | 54 scoped_ptr<PrefServiceSyncable> prefs, |
55 const base::string16& user_name, | 55 const base::string16& user_name, |
56 int avatar_id, | 56 int avatar_id, |
57 const std::string& managed_user_id, | 57 const std::string& supervised_user_id, |
58 const TestingProfile::TestingFactories& factories); | 58 const TestingProfile::TestingFactories& factories); |
59 | 59 |
60 // Small helper for creating testing profiles. Just forwards to above. | 60 // Small helper for creating testing profiles. Just forwards to above. |
61 TestingProfile* CreateTestingProfile(const std::string& name); | 61 TestingProfile* CreateTestingProfile(const std::string& name); |
62 | 62 |
63 // Creates a new guest TestingProfile whose data lives in the guest profile | 63 // Creates a new guest TestingProfile whose data lives in the guest profile |
64 // test environment directory, as specified by the profile manager. | 64 // test environment directory, as specified by the profile manager. |
65 // This profile will not be added to the ProfileInfoCache. This will | 65 // This profile will not be added to the ProfileInfoCache. This will |
66 // register the TestingProfile with the profile subsystem as well. | 66 // register the TestingProfile with the profile subsystem as well. |
67 // The subsystem owns the Profile and returns a weak pointer. | 67 // The subsystem owns the Profile and returns a weak pointer. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // Weak reference to the profile manager. | 108 // Weak reference to the profile manager. |
109 ProfileManager* profile_manager_; | 109 ProfileManager* profile_manager_; |
110 | 110 |
111 // Map of profile_name to TestingProfile* from CreateTestingProfile(). | 111 // Map of profile_name to TestingProfile* from CreateTestingProfile(). |
112 TestingProfilesMap testing_profiles_; | 112 TestingProfilesMap testing_profiles_; |
113 | 113 |
114 DISALLOW_COPY_AND_ASSIGN(TestingProfileManager); | 114 DISALLOW_COPY_AND_ASSIGN(TestingProfileManager); |
115 }; | 115 }; |
116 | 116 |
117 #endif // CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ | 117 #endif // CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ |
OLD | NEW |