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

Unified Diff: sync/internal_api/syncapi_unittest.cc

Issue 10702074: Refactor sync-specific parts out of SyncNotifier/SyncNotifierObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor cleanup Created 8 years, 5 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: sync/internal_api/syncapi_unittest.cc
diff --git a/sync/internal_api/syncapi_unittest.cc b/sync/internal_api/syncapi_unittest.cc
index 6fff8c5e9ea779ed57dcb72d5fddc267904e8eea..54ab5f98333fd84f3a6cec97d438882c6b05f62c 100644
--- a/sync/internal_api/syncapi_unittest.cc
+++ b/sync/internal_api/syncapi_unittest.cc
@@ -690,14 +690,13 @@ class SyncManagerObserverMock : public SyncManager::Observer {
class SyncNotifierMock : public syncer::SyncNotifier {
public:
- MOCK_METHOD1(AddObserver, void(syncer::SyncNotifierObserver*));
- MOCK_METHOD1(RemoveObserver, void(syncer::SyncNotifierObserver*));
+ MOCK_METHOD1(AddHandler, void(syncer::SyncNotifierObserver*));
+ MOCK_METHOD1(RemoveHandler, void(syncer::SyncNotifierObserver*));
+ MOCK_METHOD0(ReloadHandlers, void());
MOCK_METHOD1(SetUniqueId, void(const std::string&));
MOCK_METHOD1(SetStateDeprecated, void(const std::string&));
MOCK_METHOD2(UpdateCredentials,
void(const std::string&, const std::string&));
- MOCK_METHOD1(UpdateEnabledTypes,
- void(syncer::ModelTypeSet));
MOCK_METHOD1(SendNotification, void(syncer::ModelTypeSet));
};
@@ -736,16 +735,16 @@ class SyncManagerTest : public testing::Test,
credentials.sync_token = "sometoken";
sync_notifier_mock_ = new StrictMock<SyncNotifierMock>();
- EXPECT_CALL(*sync_notifier_mock_, AddObserver(_)).
+ EXPECT_CALL(*sync_notifier_mock_, AddHandler(_)).
WillOnce(Invoke(this, &SyncManagerTest::SyncNotifierAddObserver));
EXPECT_CALL(*sync_notifier_mock_, SetUniqueId(_));
EXPECT_CALL(*sync_notifier_mock_, SetStateDeprecated(""));
EXPECT_CALL(*sync_notifier_mock_,
UpdateCredentials(credentials.email, credentials.sync_token));
- EXPECT_CALL(*sync_notifier_mock_, UpdateEnabledTypes(_)).
+ EXPECT_CALL(*sync_notifier_mock_, ReloadHandlers()).
WillRepeatedly(
- Invoke(this, &SyncManagerTest::SyncNotifierUpdateEnabledTypes));
- EXPECT_CALL(*sync_notifier_mock_, RemoveObserver(_)).
+ Invoke(this, &SyncManagerTest::SyncNotifierReloadHandlers));
+ EXPECT_CALL(*sync_notifier_mock_, RemoveHandler(_)).
WillOnce(Invoke(this, &SyncManagerTest::SyncNotifierRemoveObserver));
sync_manager_.AddObserver(&observer_);
@@ -863,11 +862,15 @@ class SyncManagerTest : public testing::Test,
sync_notifier_observer_ = NULL;
}
- void SyncNotifierUpdateEnabledTypes(syncer::ModelTypeSet types) {
+ void SyncNotifierReloadHandlers() {
ModelSafeRoutingInfo routes;
GetModelSafeRoutingInfo(&routes);
const syncer::ModelTypeSet expected_types = GetRoutingInfoTypes(routes);
- EXPECT_TRUE(types.Equals(expected_types));
+
+ ASSERT_TRUE(sync_notifier_observer_);
+ EXPECT_EQ(ModelTypeSetToObjectIdSet(expected_types),
+ sync_notifier_observer_->GetHandledIds());
+
++update_enabled_types_call_count_;
}

Powered by Google App Engine
This is Rietveld 408576698