Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: chrome/test/base/testing_profile_manager.h

Issue 1242793005: Refactor most c/b/profiles calls to ProfileInfoCache. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows unit test and ChromeOS build Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/test/base/testing_profile.h"
18 18
19 class PrefServiceSyncable; 19 class PrefServiceSyncable;
20 class ProfileInfoCache; 20 class ProfileInfoCache;
21 class ProfileAttributesStorage;
21 class ProfileManager; 22 class ProfileManager;
22 class TestingBrowserProcess; 23 class TestingBrowserProcess;
23 class TestingProfile; 24 class TestingProfile;
24 25
25 // The TestingProfileManager is a TestingProfile factory for a multi-profile 26 // The TestingProfileManager is a TestingProfile factory for a multi-profile
26 // environment. It will bring up a full ProfileManager and attach it to the 27 // environment. It will bring up a full ProfileManager and attach it to the
27 // TestingBrowserProcess set up in your test. 28 // TestingBrowserProcess set up in your test.
28 // 29 //
29 // When a Profile is needed for testing, create it through the factory method 30 // When a Profile is needed for testing, create it through the factory method
30 // below instead of creating it via |new TestingProfile|. It is not possible 31 // below instead of creating it via |new TestingProfile|. It is not possible
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // Sets ProfileManager's logged_in state. This is only useful on ChromeOS. 95 // Sets ProfileManager's logged_in state. This is only useful on ChromeOS.
95 void SetLoggedIn(bool logged_in); 96 void SetLoggedIn(bool logged_in);
96 97
97 // Sets the last used profile; also sets the active time to now. 98 // Sets the last used profile; also sets the active time to now.
98 void UpdateLastUser(Profile* last_active); 99 void UpdateLastUser(Profile* last_active);
99 100
100 // Helper accessors. 101 // Helper accessors.
101 const base::FilePath& profiles_dir(); 102 const base::FilePath& profiles_dir();
102 ProfileManager* profile_manager(); 103 ProfileManager* profile_manager();
103 ProfileInfoCache* profile_info_cache(); 104 ProfileInfoCache* profile_info_cache();
105 ProfileAttributesStorage* profile_attributes_storage();
104 106
105 private: 107 private:
106 typedef std::map<std::string, TestingProfile*> TestingProfilesMap; 108 typedef std::map<std::string, TestingProfile*> TestingProfilesMap;
107 109
108 // Does the actual ASSERT-checked SetUp work. This function cannot have a 110 // Does the actual ASSERT-checked SetUp work. This function cannot have a
109 // return value, so it sets the |called_set_up_| flag on success and that is 111 // return value, so it sets the |called_set_up_| flag on success and that is
110 // returned in the public SetUp. 112 // returned in the public SetUp.
111 void SetUpInternal(); 113 void SetUpInternal();
112 114
113 // Whether SetUp() was called to put the object in a valid state. 115 // Whether SetUp() was called to put the object in a valid state.
(...skipping 11 matching lines...) Expand all
125 // Weak reference to the profile manager. 127 // Weak reference to the profile manager.
126 ProfileManager* profile_manager_; 128 ProfileManager* profile_manager_;
127 129
128 // Map of profile_name to TestingProfile* from CreateTestingProfile(). 130 // Map of profile_name to TestingProfile* from CreateTestingProfile().
129 TestingProfilesMap testing_profiles_; 131 TestingProfilesMap testing_profiles_;
130 132
131 DISALLOW_COPY_AND_ASSIGN(TestingProfileManager); 133 DISALLOW_COPY_AND_ASSIGN(TestingProfileManager);
132 }; 134 };
133 135
134 #endif // CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_ 136 #endif // CHROME_TEST_BASE_TESTING_PROFILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698