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

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

Issue 8565032: Fixing ProfileManagerTest to use the TestingProfile instead of a real profile. This will allow ea... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 class TestingProfile : public Profile { 53 class TestingProfile : public Profile {
54 public: 54 public:
55 // Default constructor that cannot be used with multi-profiles. 55 // Default constructor that cannot be used with multi-profiles.
56 TestingProfile(); 56 TestingProfile();
57 57
58 // Multi-profile aware constructor that takes the path to a directory managed 58 // Multi-profile aware constructor that takes the path to a directory managed
59 // for this profile. This constructor is meant to be used by 59 // for this profile. This constructor is meant to be used by
60 // TestingProfileManager::CreateTestingProfile. If you need to create multi- 60 // TestingProfileManager::CreateTestingProfile. If you need to create multi-
61 // profile profiles, use that factory method instead of this directly. 61 // profile profiles, use that factory method instead of this directly.
Miranda Callahan 2011/11/21 15:31:31 The comment here says that for multi-profile testi
rpetterson 2011/11/21 22:59:30 This comment isn't actually applicable here either
62 explicit TestingProfile(const FilePath& path); 62 explicit TestingProfile(const FilePath& path);
63 63
64 // Multi-profile aware constructor that takes the path to a directory managed
65 // for this profile and a delegate. This constructor is meant to be used
66 // for unittesting the ProfileManager.
67 TestingProfile(const FilePath& path, Delegate* delegate);
68
64 virtual ~TestingProfile(); 69 virtual ~TestingProfile();
65 70
66 // Creates the favicon service. Consequent calls would recreate the service. 71 // Creates the favicon service. Consequent calls would recreate the service.
67 void CreateFaviconService(); 72 void CreateFaviconService();
68 73
69 // Creates the history service. If |delete_file| is true, the history file is 74 // Creates the history service. If |delete_file| is true, the history file is
70 // deleted first, then the HistoryService is created. As TestingProfile 75 // deleted first, then the HistoryService is created. As TestingProfile
71 // deletes the directory containing the files used by HistoryService, this 76 // deletes the directory containing the files used by HistoryService, this
72 // only matters if you're recreating the HistoryService. If |no_db| is true, 77 // only matters if you're recreating the HistoryService. If |no_db| is true,
73 // the history backend will fail to initialize its database; this is useful 78 // the history backend will fail to initialize its database; this is useful
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 virtual SpeechInputPreferences* GetSpeechInputPreferences(); 226 virtual SpeechInputPreferences* GetSpeechInputPreferences();
222 virtual HostZoomMap* GetHostZoomMap(); 227 virtual HostZoomMap* GetHostZoomMap();
223 virtual bool HasProfileSyncService() const; 228 virtual bool HasProfileSyncService() const;
224 virtual std::wstring GetName(); 229 virtual std::wstring GetName();
225 virtual void SetName(const std::wstring& name) {} 230 virtual void SetName(const std::wstring& name) {}
226 virtual std::wstring GetID(); 231 virtual std::wstring GetID();
227 virtual void SetID(const std::wstring& id); 232 virtual void SetID(const std::wstring& id);
228 void set_last_session_exited_cleanly(bool value) { 233 void set_last_session_exited_cleanly(bool value) {
229 last_session_exited_cleanly_ = value; 234 last_session_exited_cleanly_ = value;
230 } 235 }
236 void set_enable_lazy_service_initialization(bool value) {
237 enable_lazy_service_initialization_ = value;
238 }
231 virtual bool DidLastSessionExitCleanly(); 239 virtual bool DidLastSessionExitCleanly();
232 virtual void MergeResourceString(int message_id, 240 virtual void MergeResourceString(int message_id,
233 std::wstring* output_string) {} 241 std::wstring* output_string) {}
234 virtual void MergeResourceInteger(int message_id, int* output_value) {} 242 virtual void MergeResourceInteger(int message_id, int* output_value) {}
235 virtual void MergeResourceBoolean(int message_id, bool* output_value) {} 243 virtual void MergeResourceBoolean(int message_id, bool* output_value) {}
236 virtual BookmarkModel* GetBookmarkModel(); 244 virtual BookmarkModel* GetBookmarkModel();
237 virtual bool IsSameProfile(Profile *p); 245 virtual bool IsSameProfile(Profile *p);
238 virtual base::Time GetStartTime() const; 246 virtual base::Time GetStartTime() const;
239 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry(); 247 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry();
240 virtual SpellCheckHost* GetSpellCheckHost(); 248 virtual SpellCheckHost* GetSpellCheckHost();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 protected: 298 protected:
291 base::Time start_time_; 299 base::Time start_time_;
292 scoped_ptr<PrefService> prefs_; 300 scoped_ptr<PrefService> prefs_;
293 // ref only for right type, lifecycle is managed by prefs_ 301 // ref only for right type, lifecycle is managed by prefs_
294 TestingPrefService* testing_prefs_; 302 TestingPrefService* testing_prefs_;
295 303
296 private: 304 private:
297 // Common initialization between the two constructors. 305 // Common initialization between the two constructors.
298 void Init(); 306 void Init();
299 307
308 // Finishes initialization when a profile is created asynchronously.
309 void FinishInit();
310
300 // Destroys favicon service if it has been created. 311 // Destroys favicon service if it has been created.
301 void DestroyFaviconService(); 312 void DestroyFaviconService();
302 313
303 // If the webdata service has been created, it is destroyed. This is invoked 314 // If the webdata service has been created, it is destroyed. This is invoked
304 // from the destructor. 315 // from the destructor.
305 void DestroyWebDataService(); 316 void DestroyWebDataService();
306 317
307 // Creates a TestingPrefService and associates it with the TestingProfile. 318 // Creates a TestingPrefService and associates it with the TestingProfile.
308 void CreateTestingPrefService(); 319 void CreateTestingPrefService();
309 320
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; 354 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_;
344 355
345 std::wstring id_; 356 std::wstring id_;
346 357
347 bool incognito_; 358 bool incognito_;
348 scoped_ptr<Profile> incognito_profile_; 359 scoped_ptr<Profile> incognito_profile_;
349 360
350 // Did the last session exit cleanly? Default is true. 361 // Did the last session exit cleanly? Default is true.
351 bool last_session_exited_cleanly_; 362 bool last_session_exited_cleanly_;
352 363
364 // Do we create services if they do not exist? Default is false.
365 bool enable_lazy_service_initialization_;
366
353 // FileSystemContext. Created lazily by GetFileSystemContext(). 367 // FileSystemContext. Created lazily by GetFileSystemContext().
354 scoped_refptr<fileapi::FileSystemContext> file_system_context_; 368 scoped_refptr<fileapi::FileSystemContext> file_system_context_;
355 369
356 // WebKitContext, lazily initialized by GetWebKitContext(). 370 // WebKitContext, lazily initialized by GetWebKitContext().
357 scoped_refptr<WebKitContext> webkit_context_; 371 scoped_refptr<WebKitContext> webkit_context_;
358 372
359 // The main database tracker for this profile. 373 // The main database tracker for this profile.
360 // Should be used only on the file thread. 374 // Should be used only on the file thread.
361 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; 375 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_;
362 376
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 413
400 // We keep a weak pointer to the dependency manager we want to notify on our 414 // We keep a weak pointer to the dependency manager we want to notify on our
401 // death. Defaults to the Singleton implementation but overridable for 415 // death. Defaults to the Singleton implementation but overridable for
402 // testing. 416 // testing.
403 ProfileDependencyManager* profile_dependency_manager_; 417 ProfileDependencyManager* profile_dependency_manager_;
404 418
405 scoped_refptr<ChromeAppCacheService> appcache_service_; 419 scoped_refptr<ChromeAppCacheService> appcache_service_;
406 420
407 // The QuotaManager, only available if set explicitly via SetQuotaManager. 421 // The QuotaManager, only available if set explicitly via SetQuotaManager.
408 scoped_refptr<quota::QuotaManager> quota_manager_; 422 scoped_refptr<quota::QuotaManager> quota_manager_;
423
424 // Weak pointer to a delegate for indicating that a profile was created.
425 Delegate* delegate_;
409 }; 426 };
410 427
411 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ 428 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698