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

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 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
62 // Exception: if you need to create multi-profile profiles for testing the
63 // ProfileManager, then use the constructor below instead.
62 explicit TestingProfile(const FilePath& path); 64 explicit TestingProfile(const FilePath& path);
63 65
66 // Multi-profile aware constructor that takes the path to a directory managed
67 // for this profile and a delegate. This constructor is meant to be used
68 // for unittesting the ProfileManager.
69 TestingProfile(const FilePath& path, Delegate* delegate);
70
64 virtual ~TestingProfile(); 71 virtual ~TestingProfile();
65 72
66 // Creates the favicon service. Consequent calls would recreate the service. 73 // Creates the favicon service. Consequent calls would recreate the service.
67 void CreateFaviconService(); 74 void CreateFaviconService();
68 75
69 // Creates the history service. If |delete_file| is true, the history file is 76 // Creates the history service. If |delete_file| is true, the history file is
70 // deleted first, then the HistoryService is created. As TestingProfile 77 // deleted first, then the HistoryService is created. As TestingProfile
71 // deletes the directory containing the files used by HistoryService, this 78 // deletes the directory containing the files used by HistoryService, this
72 // only matters if you're recreating the HistoryService. If |no_db| is true, 79 // 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 80 // the history backend will fail to initialize its database; this is useful
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 protected: 304 protected:
298 base::Time start_time_; 305 base::Time start_time_;
299 scoped_ptr<PrefService> prefs_; 306 scoped_ptr<PrefService> prefs_;
300 // ref only for right type, lifecycle is managed by prefs_ 307 // ref only for right type, lifecycle is managed by prefs_
301 TestingPrefService* testing_prefs_; 308 TestingPrefService* testing_prefs_;
302 309
303 private: 310 private:
304 // Common initialization between the two constructors. 311 // Common initialization between the two constructors.
305 void Init(); 312 void Init();
306 313
314 // Finishes initialization when a profile is created asynchronously.
315 void FinishInit();
316
307 // Destroys favicon service if it has been created. 317 // Destroys favicon service if it has been created.
308 void DestroyFaviconService(); 318 void DestroyFaviconService();
309 319
310 // If the webdata service has been created, it is destroyed. This is invoked 320 // If the webdata service has been created, it is destroyed. This is invoked
311 // from the destructor. 321 // from the destructor.
312 void DestroyWebDataService(); 322 void DestroyWebDataService();
313 323
314 // Creates a TestingPrefService and associates it with the TestingProfile. 324 // Creates a TestingPrefService and associates it with the TestingProfile.
315 void CreateTestingPrefService(); 325 void CreateTestingPrefService();
316 326
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 416
407 // We keep a weak pointer to the dependency manager we want to notify on our 417 // We keep a weak pointer to the dependency manager we want to notify on our
408 // death. Defaults to the Singleton implementation but overridable for 418 // death. Defaults to the Singleton implementation but overridable for
409 // testing. 419 // testing.
410 ProfileDependencyManager* profile_dependency_manager_; 420 ProfileDependencyManager* profile_dependency_manager_;
411 421
412 scoped_refptr<ChromeAppCacheService> appcache_service_; 422 scoped_refptr<ChromeAppCacheService> appcache_service_;
413 423
414 // The QuotaManager, only available if set explicitly via SetQuotaManager. 424 // The QuotaManager, only available if set explicitly via SetQuotaManager.
415 scoped_refptr<quota::QuotaManager> quota_manager_; 425 scoped_refptr<quota::QuotaManager> quota_manager_;
426
427 // Weak pointer to a delegate for indicating that a profile was created.
428 Delegate* delegate_;
416 }; 429 };
417 430
418 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ 431 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698