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

Unified Diff: chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc

Issue 218903005: Make push messaging not create InvalidationService for login and guest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make code resilient against tests that do not create the Default profile first. Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc
index add3e2c5a88dbc04ed7b0f7d55537e4230fec88a..239c38bf031d7c2202b6f7a9782ecb3386a1a9e0 100644
--- a/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc
+++ b/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc
@@ -17,7 +17,9 @@
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/sync/glue/device_info.h"
#include "chrome/browser/sync/glue/synced_device_tracker.h"
+#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
+#include "chrome/test/base/testing_profile_manager.h"
#include "components/sync_driver/sync_frontend.h"
#include "components/sync_driver/sync_prefs.h"
#include "components/user_prefs/pref_registry_syncable.h"
@@ -52,6 +54,8 @@ namespace browser_sync {
namespace {
+const char kTestProfileName[] = "test-profile";
+
ACTION_P(Signal, event) {
event->Signal();
}
@@ -130,16 +134,18 @@ class SyncBackendHostTest : public testing::Test {
protected:
SyncBackendHostTest()
: thread_bundle_(content::TestBrowserThreadBundle::REAL_IO_THREAD),
+ profile_manager_(TestingBrowserProcess::GetGlobal()),
fake_manager_(NULL) {}
virtual ~SyncBackendHostTest() {}
virtual void SetUp() OVERRIDE {
- profile_.reset(new TestingProfile());
+ ASSERT_TRUE(profile_manager_.SetUp());
+ profile_ = profile_manager_.CreateTestingProfile(kTestProfileName);
sync_prefs_.reset(new sync_driver::SyncPrefs(profile_->GetPrefs()));
backend_.reset(new SyncBackendHostImpl(
profile_->GetDebugName(),
- profile_.get(),
+ profile_,
sync_prefs_->AsWeakPtr()));
credentials_.email = "user@example.com";
credentials_.sync_token = "sync_token";
@@ -170,7 +176,8 @@ class SyncBackendHostTest : public testing::Test {
}
backend_.reset();
sync_prefs_.reset();
- profile_.reset();
+ profile_ = NULL;
+ profile_manager_.DeleteTestingProfile(kTestProfileName);
// Pump messages posted by the sync thread (which may end up
// posting on the IO thread).
base::RunLoop().RunUntilIdle();
@@ -238,7 +245,7 @@ class SyncBackendHostTest : public testing::Test {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_SYNC_REFRESH_LOCAL,
- content::Source<Profile>(profile_.get()),
+ content::Source<Profile>(profile_),
content::Details<syncer::ModelTypeSet>(&types));
}
@@ -255,7 +262,8 @@ class SyncBackendHostTest : public testing::Test {
content::TestBrowserThreadBundle thread_bundle_;
StrictMock<MockSyncFrontend> mock_frontend_;
syncer::SyncCredentials credentials_;
- scoped_ptr<TestingProfile> profile_;
+ TestingProfileManager profile_manager_;
+ TestingProfile* profile_;
scoped_ptr<sync_driver::SyncPrefs> sync_prefs_;
scoped_ptr<SyncBackendHost> backend_;
scoped_ptr<FakeSyncManagerFactory> fake_manager_factory_;
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_impl.cc ('k') | chrome/browser/sync/profile_sync_service_autofill_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698