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

Unified Diff: chrome/test/base/testing_profile.cc

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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/base/testing_profile.cc
===================================================================
--- chrome/test/base/testing_profile.cc (revision 111186)
+++ chrome/test/base/testing_profile.cc (working copy)
@@ -132,7 +132,8 @@
testing_prefs_(NULL),
incognito_(false),
last_session_exited_cleanly_(true),
- profile_dependency_manager_(ProfileDependencyManager::GetInstance()) {
+ profile_dependency_manager_(ProfileDependencyManager::GetInstance()),
+ delegate_(NULL) {
if (!temp_dir_.CreateUniqueTempDir()) {
LOG(ERROR) << "Failed to create unique temporary directory.";
@@ -160,6 +161,7 @@
profile_path_ = temp_dir_.path();
Init();
+ FinishInit();
}
TestingProfile::TestingProfile(const FilePath& path)
@@ -168,21 +170,47 @@
incognito_(false),
last_session_exited_cleanly_(true),
profile_path_(path),
- profile_dependency_manager_(ProfileDependencyManager::GetInstance()) {
+ profile_dependency_manager_(ProfileDependencyManager::GetInstance()),
+ delegate_(NULL) {
Init();
+ FinishInit();
}
+TestingProfile::TestingProfile(const FilePath& path,
+ Delegate* delegate)
+ : start_time_(Time::Now()),
+ testing_prefs_(NULL),
+ incognito_(false),
+ last_session_exited_cleanly_(true),
+ profile_path_(path),
+ profile_dependency_manager_(ProfileDependencyManager::GetInstance()),
+ delegate_(delegate) {
+ Init();
+ if (delegate_) {
+ MessageLoop::current()->PostTask(FROM_HERE,
+ base::Bind(&TestingProfile::FinishInit,
+ base::Unretained(this)));
+ } else {
+ FinishInit();
+ }
+}
+
void TestingProfile::Init() {
profile_dependency_manager_->CreateProfileServices(this, true);
// Install profile keyed service factory hooks for dummy/test services
DesktopNotificationServiceFactory::GetInstance()->SetTestingFactory(
this, CreateTestDesktopNotificationService);
+}
+void TestingProfile::FinishInit() {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_PROFILE_CREATED,
content::Source<Profile>(static_cast<Profile*>(this)),
content::NotificationService::NoDetails());
+
+ if (delegate_)
+ delegate_->OnProfileCreated(this, true);
}
TestingProfile::~TestingProfile() {

Powered by Google App Engine
This is Rietveld 408576698