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

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

Issue 15580002: Make use of InvalidationService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 6 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
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host.cc ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/sync_backend_host_unittest.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_unittest.cc
index 423a491f16f669c6be7513dc1957fe6d27f9ca40..d694bc0d910134dfa58a2daa0e131540c7c8b4fb 100644
--- a/chrome/browser/sync/glue/sync_backend_host_unittest.cc
+++ b/chrome/browser/sync/glue/sync_backend_host_unittest.cc
@@ -146,13 +146,10 @@ class SyncBackendHostTest : public testing::Test {
profile_.reset(new TestingProfile());
profile_->CreateRequestContext();
sync_prefs_.reset(new SyncPrefs(profile_->GetPrefs()));
- invalidator_storage_.reset(new invalidation::InvalidatorStorage(
- profile_->GetPrefs()));
backend_.reset(new SyncBackendHost(
profile_->GetDebugName(),
profile_.get(),
- sync_prefs_->AsWeakPtr(),
- invalidator_storage_->AsWeakPtr()));
+ sync_prefs_->AsWeakPtr()));
credentials_.email = "user@example.com";
credentials_.sync_token = "sync_token";
@@ -178,7 +175,6 @@ class SyncBackendHostTest : public testing::Test {
}
backend_.reset();
sync_prefs_.reset();
- invalidator_storage_.reset();
profile_.reset();
// Pump messages posted by the sync thread (which may end up
// posting on the IO thread).
@@ -266,7 +262,6 @@ class SyncBackendHostTest : public testing::Test {
syncer::TestUnrecoverableErrorHandler handler_;
scoped_ptr<TestingProfile> profile_;
scoped_ptr<SyncPrefs> sync_prefs_;
- scoped_ptr<invalidation::InvalidatorStorage> invalidator_storage_;
scoped_ptr<SyncBackendHost> backend_;
FakeSyncManager* fake_manager_;
FakeSyncManagerFactory fake_manager_factory_;
@@ -594,76 +589,6 @@ TEST_F(SyncBackendHostTest, NewlySupportedTypesWithPartialTypes) {
enabled_types_).Empty());
}
-// Register for some IDs and trigger an invalidation. This should
-// propagate all the way to the frontend.
-TEST_F(SyncBackendHostTest, Invalidate) {
- InitializeBackend(true);
-
- syncer::ObjectIdSet ids;
- ids.insert(invalidation::ObjectId(1, "id1"));
- ids.insert(invalidation::ObjectId(2, "id2"));
- const syncer::ObjectIdInvalidationMap& invalidation_map =
- syncer::ObjectIdSetToInvalidationMap(ids, "payload");
-
- EXPECT_CALL(
- mock_frontend_,
- OnIncomingInvalidation(invalidation_map))
- .WillOnce(InvokeWithoutArgs(QuitMessageLoop));
-
- backend_->UpdateRegisteredInvalidationIds(ids);
- fake_manager_->Invalidate(invalidation_map);
- ui_loop_.PostDelayedTask(
- FROM_HERE, ui_loop_.QuitClosure(), TestTimeouts::action_timeout());
- ui_loop_.Run();
-}
-
-// Register for some IDs and update the invalidator state. This
-// should propagate all the way to the frontend.
-TEST_F(SyncBackendHostTest, UpdateInvalidatorState) {
- InitializeBackend(true);
-
- EXPECT_CALL(mock_frontend_,
- OnInvalidatorStateChange(syncer::INVALIDATIONS_ENABLED))
- .WillOnce(InvokeWithoutArgs(QuitMessageLoop));
-
- syncer::ObjectIdSet ids;
- ids.insert(invalidation::ObjectId(3, "id3"));
- backend_->UpdateRegisteredInvalidationIds(ids);
- fake_manager_->UpdateInvalidatorState(syncer::INVALIDATIONS_ENABLED);
- ui_loop_.PostDelayedTask(
- FROM_HERE, ui_loop_.QuitClosure(), TestTimeouts::action_timeout());
- ui_loop_.Run();
-}
-
-// Call StopSyncingForShutdown() on the backend and fire some invalidations
-// before calling Shutdown(). Then start up and shut down the backend again.
-// Those notifications shouldn't propagate to the frontend.
-TEST_F(SyncBackendHostTest, InvalidationsAfterStopSyncingForShutdown) {
- InitializeBackend(true);
-
- syncer::ObjectIdSet ids;
- ids.insert(invalidation::ObjectId(5, "id5"));
- backend_->UpdateRegisteredInvalidationIds(ids);
-
- backend_->StopSyncingForShutdown();
-
- // Should not trigger anything.
- fake_manager_->UpdateInvalidatorState(syncer::TRANSIENT_INVALIDATION_ERROR);
- fake_manager_->UpdateInvalidatorState(syncer::INVALIDATIONS_ENABLED);
- const syncer::ObjectIdInvalidationMap& invalidation_map =
- syncer::ObjectIdSetToInvalidationMap(ids, "payload");
- fake_manager_->Invalidate(invalidation_map);
-
- // Make sure the above calls take effect before we continue.
- fake_manager_->WaitForSyncThread();
-
- backend_->Shutdown(false);
- backend_.reset();
-
- TearDown();
- SetUp();
-}
-
// Ensure the device info tracker is initialized properly on startup.
TEST_F(SyncBackendHostTest, InitializeDeviceInfo) {
ASSERT_EQ(NULL, backend_->GetSyncedDeviceTracker());
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host.cc ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698