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

Unified Diff: sync/internal_api/sync_manager_impl_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 | « sync/internal_api/sync_manager_impl.cc ('k') | sync/internal_api/test/fake_sync_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/sync_manager_impl_unittest.cc
diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc
index a1ddd7f94ba87615f50e1c5d8e3e6cfa64cc769c..2085ec32b0b42375dfb7991e2dca5e643957f3f9 100644
--- a/sync/internal_api/sync_manager_impl_unittest.cc
+++ b/sync/internal_api/sync_manager_impl_unittest.cc
@@ -46,7 +46,6 @@
#include "sync/js/js_reply_handler.h"
#include "sync/js/js_test_util.h"
#include "sync/notifier/fake_invalidation_handler.h"
-#include "sync/notifier/fake_invalidator.h"
#include "sync/notifier/invalidation_handler.h"
#include "sync/notifier/invalidator.h"
#include "sync/protocol/bookmark_specifics.pb.h"
@@ -789,14 +788,12 @@ class SyncManagerTest : public testing::Test,
};
SyncManagerTest()
- : fake_invalidator_(NULL),
- sync_manager_("Test sync manager") {
+ : sync_manager_("Test sync manager") {
switches_.encryption_method =
InternalComponentsFactory::ENCRYPTION_KEYSTORE;
}
virtual ~SyncManagerTest() {
- EXPECT_FALSE(fake_invalidator_);
}
// Test implementation.
@@ -807,8 +804,6 @@ class SyncManagerTest : public testing::Test,
credentials.email = "foo@bar.com";
credentials.sync_token = "sometoken";
- fake_invalidator_ = new FakeInvalidator();
-
sync_manager_.AddObserver(&manager_observer_);
EXPECT_CALL(manager_observer_, OnInitializationComplete(_, _, _, _)).
WillOnce(SaveArg<0>(&js_backend_));
@@ -831,7 +826,6 @@ class SyncManagerTest : public testing::Test,
&extensions_activity_monitor_,
this,
credentials,
- scoped_ptr<Invalidator>(fake_invalidator_),
"fake_invalidator_client_id",
std::string(),
std::string(), // bootstrap tokens
@@ -851,17 +845,11 @@ class SyncManagerTest : public testing::Test,
sync_manager_.GetUserShare(), i->first);
}
PumpLoop();
-
- EXPECT_TRUE(fake_invalidator_->IsHandlerRegistered(&sync_manager_));
}
void TearDown() {
sync_manager_.RemoveObserver(&manager_observer_);
sync_manager_.ShutdownOnSyncThread();
- // We can't assert that |sync_manager_| isn't registered with
- // |fake_invalidator_| anymore because |fake_invalidator_| is now
- // destroyed.
- fake_invalidator_ = NULL;
PumpLoop();
}
@@ -1027,7 +1015,6 @@ class SyncManagerTest : public testing::Test,
protected:
FakeEncryptor encryptor_;
TestUnrecoverableErrorHandler handler_;
- FakeInvalidator* fake_invalidator_;
SyncManagerImpl sync_manager_;
WeakHandle<JsBackend> js_backend_;
StrictMock<SyncManagerObserverMock> manager_observer_;
@@ -1035,29 +1022,6 @@ class SyncManagerTest : public testing::Test,
InternalComponentsFactory::Switches switches_;
};
-TEST_F(SyncManagerTest, UpdateEnabledTypes) {
- ModelSafeRoutingInfo routes;
- GetModelSafeRoutingInfo(&routes);
- const ModelTypeSet enabled_types = GetRoutingInfoTypes(routes);
- sync_manager_.UpdateEnabledTypes(enabled_types);
- EXPECT_EQ(ModelTypeSetToObjectIdSet(enabled_types),
- fake_invalidator_->GetRegisteredIds(&sync_manager_));
-}
-
-TEST_F(SyncManagerTest, RegisterInvalidationHandler) {
- FakeInvalidationHandler fake_handler;
- sync_manager_.RegisterInvalidationHandler(&fake_handler);
- EXPECT_TRUE(fake_invalidator_->IsHandlerRegistered(&fake_handler));
-
- const ObjectIdSet& ids =
- ModelTypeSetToObjectIdSet(ModelTypeSet(BOOKMARKS, PREFERENCES));
- sync_manager_.UpdateRegisteredInvalidationIds(&fake_handler, ids);
- EXPECT_EQ(ids, fake_invalidator_->GetRegisteredIds(&fake_handler));
-
- sync_manager_.UnregisterInvalidationHandler(&fake_handler);
- EXPECT_FALSE(fake_invalidator_->IsHandlerRegistered(&fake_handler));
-}
-
TEST_F(SyncManagerTest, ProcessJsMessage) {
const JsArgList kNoArgs;
@@ -1362,14 +1326,6 @@ TEST_F(SyncManagerTest, OnInvalidatorStateChangeJsEvents) {
base::DictionaryValue auth_error_details;
auth_error_details.SetString("status", "CONNECTION_AUTH_ERROR");
- EXPECT_CALL(manager_observer_,
- OnConnectionStatusChange(CONNECTION_AUTH_ERROR));
-
- EXPECT_CALL(
- event_handler,
- HandleJsEvent("onConnectionStatusChange",
- HasDetailsAsDictionary(auth_error_details)));
-
EXPECT_CALL(event_handler,
HandleJsEvent("onNotificationStateChange",
HasDetailsAsDictionary(enabled_details)));
@@ -1410,22 +1366,6 @@ TEST_F(SyncManagerTest, OnInvalidatorStateChangeJsEvents) {
PumpLoop();
}
-// Simulate the invalidator's credentials being rejected. That should
-// also clear the sync token.
-TEST_F(SyncManagerTest, OnInvalidatorStateChangeCredentialsRejected) {
- EXPECT_CALL(manager_observer_,
- OnConnectionStatusChange(CONNECTION_AUTH_ERROR));
-
- EXPECT_FALSE(sync_manager_.GetHasInvalidAuthTokenForTest());
-
- SimulateInvalidatorStateChangeForTest(INVALIDATION_CREDENTIALS_REJECTED);
-
- EXPECT_TRUE(sync_manager_.GetHasInvalidAuthTokenForTest());
-
- // Should trigger the replies.
- PumpLoop();
-}
-
TEST_F(SyncManagerTest, OnIncomingNotification) {
StrictMock<MockJsEventHandler> event_handler;
« no previous file with comments | « sync/internal_api/sync_manager_impl.cc ('k') | sync/internal_api/test/fake_sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698