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_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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 void SetGuestSession(bool guest); | 209 void SetGuestSession(bool guest); |
210 | 210 |
211 TestingPrefServiceSyncable* GetTestingPrefService(); | 211 TestingPrefServiceSyncable* GetTestingPrefService(); |
212 | 212 |
213 // Called on the parent of an incognito |profile|. Usually called from the | 213 // Called on the parent of an incognito |profile|. Usually called from the |
214 // constructor of an incognito TestingProfile, but can also be used by tests | 214 // constructor of an incognito TestingProfile, but can also be used by tests |
215 // to provide an OffTheRecordProfileImpl instance. | 215 // to provide an OffTheRecordProfileImpl instance. |
216 void SetOffTheRecordProfile(scoped_ptr<Profile> profile); | 216 void SetOffTheRecordProfile(scoped_ptr<Profile> profile); |
217 | 217 |
218 // content::BrowserContext | 218 // content::BrowserContext |
219 virtual base::FilePath GetPath() const OVERRIDE; | 219 virtual base::FilePath GetPath() const override; |
220 virtual scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() OVERRIDE; | 220 virtual scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override; |
221 virtual bool IsOffTheRecord() const OVERRIDE; | 221 virtual bool IsOffTheRecord() const override; |
222 virtual content::DownloadManagerDelegate* | 222 virtual content::DownloadManagerDelegate* |
223 GetDownloadManagerDelegate() OVERRIDE; | 223 GetDownloadManagerDelegate() override; |
224 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; | 224 virtual net::URLRequestContextGetter* GetRequestContext() override; |
225 virtual net::URLRequestContextGetter* CreateRequestContext( | 225 virtual net::URLRequestContextGetter* CreateRequestContext( |
226 content::ProtocolHandlerMap* protocol_handlers, | 226 content::ProtocolHandlerMap* protocol_handlers, |
227 content::URLRequestInterceptorScopedVector request_interceptors) OVERRIDE; | 227 content::URLRequestInterceptorScopedVector request_interceptors) override; |
228 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( | 228 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( |
229 int renderer_child_id) OVERRIDE; | 229 int renderer_child_id) override; |
230 virtual content::ResourceContext* GetResourceContext() OVERRIDE; | 230 virtual content::ResourceContext* GetResourceContext() override; |
231 virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE; | 231 virtual content::BrowserPluginGuestManager* GetGuestManager() override; |
232 virtual storage::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; | 232 virtual storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; |
233 virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE; | 233 virtual content::PushMessagingService* GetPushMessagingService() override; |
234 virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() OVERRIDE; | 234 virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() override; |
235 | 235 |
236 virtual TestingProfile* AsTestingProfile() OVERRIDE; | 236 virtual TestingProfile* AsTestingProfile() override; |
237 | 237 |
238 // Profile | 238 // Profile |
239 virtual std::string GetProfileName() OVERRIDE; | 239 virtual std::string GetProfileName() override; |
240 virtual ProfileType GetProfileType() const OVERRIDE; | 240 virtual ProfileType GetProfileType() const override; |
241 | 241 |
242 // DEPRECATED, because it's fragile to change a profile from non-incognito | 242 // DEPRECATED, because it's fragile to change a profile from non-incognito |
243 // to incognito after the ProfileKeyedServices have been created (some | 243 // to incognito after the ProfileKeyedServices have been created (some |
244 // ProfileKeyedServices either should not exist in incognito mode, or will | 244 // ProfileKeyedServices either should not exist in incognito mode, or will |
245 // crash when they try to get references to other services they depend on, | 245 // crash when they try to get references to other services they depend on, |
246 // but do not exist in incognito mode). | 246 // but do not exist in incognito mode). |
247 // TODO(atwilson): Remove this API (http://crbug.com/277296). | 247 // TODO(atwilson): Remove this API (http://crbug.com/277296). |
248 // | 248 // |
249 // Changes a profile's to/from incognito mode temporarily - profile will be | 249 // Changes a profile's to/from incognito mode temporarily - profile will be |
250 // returned to non-incognito before destruction to allow services to | 250 // returned to non-incognito before destruction to allow services to |
251 // properly shutdown. This is only supported for legacy tests - new tests | 251 // properly shutdown. This is only supported for legacy tests - new tests |
252 // should create a true incognito profile using Builder::SetIncognito() or | 252 // should create a true incognito profile using Builder::SetIncognito() or |
253 // by using the TestingProfile constructor that allows setting the incognito | 253 // by using the TestingProfile constructor that allows setting the incognito |
254 // flag. | 254 // flag. |
255 void ForceIncognito(bool force_incognito) { | 255 void ForceIncognito(bool force_incognito) { |
256 force_incognito_ = force_incognito; | 256 force_incognito_ = force_incognito; |
257 } | 257 } |
258 | 258 |
259 virtual Profile* GetOffTheRecordProfile() OVERRIDE; | 259 virtual Profile* GetOffTheRecordProfile() override; |
260 virtual void DestroyOffTheRecordProfile() OVERRIDE {} | 260 virtual void DestroyOffTheRecordProfile() override {} |
261 virtual bool HasOffTheRecordProfile() OVERRIDE; | 261 virtual bool HasOffTheRecordProfile() override; |
262 virtual Profile* GetOriginalProfile() OVERRIDE; | 262 virtual Profile* GetOriginalProfile() override; |
263 virtual bool IsSupervised() OVERRIDE; | 263 virtual bool IsSupervised() override; |
264 #if defined(ENABLE_EXTENSIONS) | 264 #if defined(ENABLE_EXTENSIONS) |
265 void SetExtensionSpecialStoragePolicy( | 265 void SetExtensionSpecialStoragePolicy( |
266 ExtensionSpecialStoragePolicy* extension_special_storage_policy); | 266 ExtensionSpecialStoragePolicy* extension_special_storage_policy); |
267 #endif | 267 #endif |
268 virtual ExtensionSpecialStoragePolicy* | 268 virtual ExtensionSpecialStoragePolicy* |
269 GetExtensionSpecialStoragePolicy() OVERRIDE; | 269 GetExtensionSpecialStoragePolicy() override; |
270 // TODO(ajwong): Remove this API in favor of directly retrieving the | 270 // TODO(ajwong): Remove this API in favor of directly retrieving the |
271 // CookieStore from the StoragePartition after ExtensionURLRequestContext | 271 // CookieStore from the StoragePartition after ExtensionURLRequestContext |
272 // has been removed. | 272 // has been removed. |
273 net::CookieMonster* GetCookieMonster(); | 273 net::CookieMonster* GetCookieMonster(); |
274 | 274 |
275 virtual PrefService* GetPrefs() OVERRIDE; | 275 virtual PrefService* GetPrefs() override; |
276 | 276 |
277 virtual history::TopSites* GetTopSites() OVERRIDE; | 277 virtual history::TopSites* GetTopSites() override; |
278 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; | 278 virtual history::TopSites* GetTopSitesWithoutCreating() override; |
279 | 279 |
280 virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; | 280 virtual net::URLRequestContextGetter* GetMediaRequestContext() override; |
281 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 281 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
282 int renderer_child_id) OVERRIDE; | 282 int renderer_child_id) override; |
283 virtual net::URLRequestContextGetter* | 283 virtual net::URLRequestContextGetter* |
284 GetRequestContextForExtensions() OVERRIDE; | 284 GetRequestContextForExtensions() override; |
285 virtual net::URLRequestContextGetter* | 285 virtual net::URLRequestContextGetter* |
286 GetMediaRequestContextForStoragePartition( | 286 GetMediaRequestContextForStoragePartition( |
287 const base::FilePath& partition_path, | 287 const base::FilePath& partition_path, |
288 bool in_memory) OVERRIDE; | 288 bool in_memory) override; |
289 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( | 289 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
290 const base::FilePath& partition_path, | 290 const base::FilePath& partition_path, |
291 bool in_memory, | 291 bool in_memory, |
292 content::ProtocolHandlerMap* protocol_handlers, | 292 content::ProtocolHandlerMap* protocol_handlers, |
293 content::URLRequestInterceptorScopedVector request_interceptors) OVERRIDE; | 293 content::URLRequestInterceptorScopedVector request_interceptors) override; |
294 virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; | 294 virtual net::SSLConfigService* GetSSLConfigService() override; |
295 virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; | 295 virtual HostContentSettingsMap* GetHostContentSettingsMap() override; |
296 void set_last_session_exited_cleanly(bool value) { | 296 void set_last_session_exited_cleanly(bool value) { |
297 last_session_exited_cleanly_ = value; | 297 last_session_exited_cleanly_ = value; |
298 } | 298 } |
299 virtual bool IsSameProfile(Profile *p) OVERRIDE; | 299 virtual bool IsSameProfile(Profile *p) override; |
300 virtual base::Time GetStartTime() const OVERRIDE; | 300 virtual base::Time GetStartTime() const override; |
301 virtual base::FilePath last_selected_directory() OVERRIDE; | 301 virtual base::FilePath last_selected_directory() override; |
302 virtual void set_last_selected_directory(const base::FilePath& path) OVERRIDE; | 302 virtual void set_last_selected_directory(const base::FilePath& path) override; |
303 virtual bool WasCreatedByVersionOrLater(const std::string& version) OVERRIDE; | 303 virtual bool WasCreatedByVersionOrLater(const std::string& version) override; |
304 virtual bool IsGuestSession() const OVERRIDE; | 304 virtual bool IsGuestSession() const override; |
305 virtual void SetExitType(ExitType exit_type) OVERRIDE {} | 305 virtual void SetExitType(ExitType exit_type) override {} |
306 virtual ExitType GetLastSessionExitType() OVERRIDE; | 306 virtual ExitType GetLastSessionExitType() override; |
307 #if defined(OS_CHROMEOS) | 307 #if defined(OS_CHROMEOS) |
308 virtual void ChangeAppLocale(const std::string&, | 308 virtual void ChangeAppLocale(const std::string&, |
309 AppLocaleChangedVia) OVERRIDE { | 309 AppLocaleChangedVia) override { |
310 } | 310 } |
311 virtual void OnLogin() OVERRIDE { | 311 virtual void OnLogin() override { |
312 } | 312 } |
313 virtual void InitChromeOSPreferences() OVERRIDE { | 313 virtual void InitChromeOSPreferences() override { |
314 } | 314 } |
315 #endif // defined(OS_CHROMEOS) | 315 #endif // defined(OS_CHROMEOS) |
316 | 316 |
317 virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE; | 317 virtual PrefProxyConfigTracker* GetProxyConfigTracker() override; |
318 | 318 |
319 // Schedules a task on the history backend and runs a nested loop until the | 319 // Schedules a task on the history backend and runs a nested loop until the |
320 // task is processed. This has the effect of blocking the caller until the | 320 // task is processed. This has the effect of blocking the caller until the |
321 // history service processes all pending requests. | 321 // history service processes all pending requests. |
322 void BlockUntilHistoryProcessesPendingRequests(); | 322 void BlockUntilHistoryProcessesPendingRequests(); |
323 | 323 |
324 virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE; | 324 virtual chrome_browser_net::Predictor* GetNetworkPredictor() override; |
325 virtual DevToolsNetworkController* GetDevToolsNetworkController() OVERRIDE; | 325 virtual DevToolsNetworkController* GetDevToolsNetworkController() override; |
326 virtual void ClearNetworkingHistorySince( | 326 virtual void ClearNetworkingHistorySince( |
327 base::Time time, | 327 base::Time time, |
328 const base::Closure& completion) OVERRIDE; | 328 const base::Closure& completion) override; |
329 virtual GURL GetHomePage() OVERRIDE; | 329 virtual GURL GetHomePage() override; |
330 | 330 |
331 virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; | 331 virtual PrefService* GetOffTheRecordPrefs() override; |
332 | 332 |
333 void set_profile_name(const std::string& profile_name) { | 333 void set_profile_name(const std::string& profile_name) { |
334 profile_name_ = profile_name; | 334 profile_name_ = profile_name; |
335 } | 335 } |
336 | 336 |
337 protected: | 337 protected: |
338 base::Time start_time_; | 338 base::Time start_time_; |
339 scoped_ptr<PrefServiceSyncable> prefs_; | 339 scoped_ptr<PrefServiceSyncable> prefs_; |
340 // ref only for right type, lifecycle is managed by prefs_ | 340 // ref only for right type, lifecycle is managed by prefs_ |
341 TestingPrefServiceSyncable* testing_prefs_; | 341 TestingPrefServiceSyncable* testing_prefs_; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 413 |
414 // Weak pointer to a delegate for indicating that a profile was created. | 414 // Weak pointer to a delegate for indicating that a profile was created. |
415 Delegate* delegate_; | 415 Delegate* delegate_; |
416 | 416 |
417 std::string profile_name_; | 417 std::string profile_name_; |
418 | 418 |
419 scoped_ptr<policy::PolicyService> policy_service_; | 419 scoped_ptr<policy::PolicyService> policy_service_; |
420 }; | 420 }; |
421 | 421 |
422 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ | 422 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ |
OLD | NEW |