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

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

Issue 11968032: Move 'theme' parsing out of Extension class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed IncognitoAutofillManagerTest unittest Created 7 years, 10 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
« no previous file with comments | « chrome/common/extensions/unpacker_unittest.cc ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_H_ 5 #ifndef CHROME_TEST_BASE_TESTING_PROFILE_H_
6 #define CHROME_TEST_BASE_TESTING_PROFILE_H_ 6 #define CHROME_TEST_BASE_TESTING_PROFILE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // GetExtensionSpecialStoragePolicy(). 77 // GetExtensionSpecialStoragePolicy().
78 void SetExtensionSpecialStoragePolicy( 78 void SetExtensionSpecialStoragePolicy(
79 scoped_refptr<ExtensionSpecialStoragePolicy> policy); 79 scoped_refptr<ExtensionSpecialStoragePolicy> policy);
80 80
81 // Sets the path to the directory to be used to hold profile data. 81 // Sets the path to the directory to be used to hold profile data.
82 void SetPath(const base::FilePath& path); 82 void SetPath(const base::FilePath& path);
83 83
84 // Sets the PrefService to be used by this profile. 84 // Sets the PrefService to be used by this profile.
85 void SetPrefService(scoped_ptr<PrefServiceSyncable> prefs); 85 void SetPrefService(scoped_ptr<PrefServiceSyncable> prefs);
86 86
87 // Sets the TestingProfile to be off-the-record by default.
88 void SetOffTheRecord();
89
90 // Creates the TestingProfile using previously-set settings. 87 // Creates the TestingProfile using previously-set settings.
91 scoped_ptr<TestingProfile> Build(); 88 scoped_ptr<TestingProfile> Build();
92 89
93 private: 90 private:
94 // If true, Build() has already been called. 91 // If true, Build() has already been called.
95 bool build_called_; 92 bool build_called_;
96 93
97 // Various staging variables where values are held until Build() is invoked. 94 // Various staging variables where values are held until Build() is invoked.
98 scoped_ptr<PrefServiceSyncable> pref_service_; 95 scoped_ptr<PrefServiceSyncable> pref_service_;
99 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy_; 96 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy_;
100 base::FilePath path_; 97 base::FilePath path_;
101 Delegate* delegate_; 98 Delegate* delegate_;
102 bool off_the_record_;
103 99
104 DISALLOW_COPY_AND_ASSIGN(Builder); 100 DISALLOW_COPY_AND_ASSIGN(Builder);
105 }; 101 };
106 102
107 // Multi-profile aware constructor that takes the path to a directory managed 103 // Multi-profile aware constructor that takes the path to a directory managed
108 // for this profile. This constructor is meant to be used by 104 // for this profile. This constructor is meant to be used by
109 // TestingProfileManager::CreateTestingProfile. If you need to create multi- 105 // TestingProfileManager::CreateTestingProfile. If you need to create multi-
110 // profile profiles, use that factory method instead of this directly. 106 // profile profiles, use that factory method instead of this directly.
111 // Exception: if you need to create multi-profile profiles for testing the 107 // Exception: if you need to create multi-profile profiles for testing the
112 // ProfileManager, then use the constructor below instead. 108 // ProfileManager, then use the constructor below instead.
113 explicit TestingProfile(const base::FilePath& path); 109 explicit TestingProfile(const base::FilePath& path);
114 110
115 // Multi-profile aware constructor that takes the path to a directory managed 111 // Multi-profile aware constructor that takes the path to a directory managed
116 // for this profile and a delegate. This constructor is meant to be used 112 // for this profile and a delegate. This constructor is meant to be used
117 // for unittesting the ProfileManager. 113 // for unittesting the ProfileManager.
118 TestingProfile(const base::FilePath& path, Delegate* delegate); 114 TestingProfile(const base::FilePath& path, Delegate* delegate);
119 115
120 // Full constructor allowing the setting of all possible instance data. 116 // Full constructor allowing the setting of all possible instance data.
121 // Callers should use Builder::Build() instead of invoking this constructor. 117 // Callers should use Builder::Build() instead of invoking this constructor.
122 TestingProfile(const base::FilePath& path, 118 TestingProfile(const base::FilePath& path,
123 Delegate* delegate, 119 Delegate* delegate,
124 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy, 120 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy,
125 scoped_ptr<PrefServiceSyncable> prefs, 121 scoped_ptr<PrefServiceSyncable> prefs);
126 bool off_the_record);
127 122
128 virtual ~TestingProfile(); 123 virtual ~TestingProfile();
129 124
130 // Creates the favicon service. Consequent calls would recreate the service. 125 // Creates the favicon service. Consequent calls would recreate the service.
131 void CreateFaviconService(); 126 void CreateFaviconService();
132 127
133 // Creates the history service. If |delete_file| is true, the history file is 128 // Creates the history service. If |delete_file| is true, the history file is
134 // deleted first, then the HistoryService is created. As TestingProfile 129 // deleted first, then the HistoryService is created. As TestingProfile
135 // deletes the directory containing the files used by HistoryService, this 130 // deletes the directory containing the files used by HistoryService, this
136 // only matters if you're recreating the HistoryService. If |no_db| is true, 131 // only matters if you're recreating the HistoryService. If |no_db| is true,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 virtual ExtensionSpecialStoragePolicy* 220 virtual ExtensionSpecialStoragePolicy*
226 GetExtensionSpecialStoragePolicy() OVERRIDE; 221 GetExtensionSpecialStoragePolicy() OVERRIDE;
227 // The CookieMonster will only be returned if a Context has been created. Do 222 // The CookieMonster will only be returned if a Context has been created. Do
228 // this by calling CreateRequestContext(). See the note at GetRequestContext 223 // this by calling CreateRequestContext(). See the note at GetRequestContext
229 // for more information. 224 // for more information.
230 net::CookieMonster* GetCookieMonster(); 225 net::CookieMonster* GetCookieMonster();
231 226
232 virtual policy::ManagedModePolicyProvider* 227 virtual policy::ManagedModePolicyProvider*
233 GetManagedModePolicyProvider() OVERRIDE; 228 GetManagedModePolicyProvider() OVERRIDE;
234 virtual policy::PolicyService* GetPolicyService() OVERRIDE; 229 virtual policy::PolicyService* GetPolicyService() OVERRIDE;
235 // Sets the profile's PrefService. If a pref service hasn't been explicitly 230
236 // set GetPrefs creates one, so normally you need not invoke this. If you need
237 // to set a pref service you must invoke this before GetPrefs.
238 // TestingPrefService takes ownership of |prefs|.
239 void SetPrefService(PrefServiceSyncable* prefs);
240 virtual PrefService* GetPrefs() OVERRIDE; 231 virtual PrefService* GetPrefs() OVERRIDE;
232
241 virtual history::TopSites* GetTopSites() OVERRIDE; 233 virtual history::TopSites* GetTopSites() OVERRIDE;
242 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; 234 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE;
243 235
244 void CreateRequestContext(); 236 void CreateRequestContext();
245 // Clears out the created request context (which must be done before shutting 237 // Clears out the created request context (which must be done before shutting
246 // down the IO thread to avoid leaks). 238 // down the IO thread to avoid leaks).
247 void ResetRequestContext(); 239 void ResetRequestContext();
248 240
249 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; 241 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE;
250 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( 242 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // testing. 368 // testing.
377 ProfileDependencyManager* profile_dependency_manager_; 369 ProfileDependencyManager* profile_dependency_manager_;
378 370
379 scoped_ptr<content::MockResourceContext> resource_context_; 371 scoped_ptr<content::MockResourceContext> resource_context_;
380 372
381 // Weak pointer to a delegate for indicating that a profile was created. 373 // Weak pointer to a delegate for indicating that a profile was created.
382 Delegate* delegate_; 374 Delegate* delegate_;
383 }; 375 };
384 376
385 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ 377 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/unpacker_unittest.cc ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698