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

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

Issue 10823037: Revert r148496 "Refactor sync-specific parts out of SyncNotifier/SyncNotifierObserver" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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: chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc
diff --git a/chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc b/chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc
index 7347eacd9617d6184e2dec33c36e803e1d8c4336..e12de05edd0613f56b81f801565f1b445425f50d 100644
--- a/chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc
+++ b/chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc
@@ -35,8 +35,8 @@ class MockChromeSyncNotificationBridge : public ChromeSyncNotificationBridge {
: ChromeSyncNotificationBridge(profile, sync_task_runner) {}
virtual ~MockChromeSyncNotificationBridge() {}
- MOCK_METHOD2(UpdateRegisteredIds, void(syncer::SyncNotifierObserver*,
- const syncer::ObjectIdSet&));
+ MOCK_METHOD1(AddObserver, void(syncer::SyncNotifierObserver*));
+ MOCK_METHOD1(RemoveObserver, void(syncer::SyncNotifierObserver*));
};
class MockSyncNotifier : public syncer::SyncNotifier {
@@ -44,17 +44,18 @@ class MockSyncNotifier : public syncer::SyncNotifier {
MockSyncNotifier() {}
virtual ~MockSyncNotifier() {}
- MOCK_METHOD2(UpdateRegisteredIds,
- void(syncer::SyncNotifierObserver*, const syncer::ObjectIdSet&));
+ MOCK_METHOD1(AddObserver, void(syncer::SyncNotifierObserver*));
+ MOCK_METHOD1(RemoveObserver, void(syncer::SyncNotifierObserver*));
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));
};
// All tests just verify that each call is passed through to the delegate, with
-// the exception of UpdateRegisteredIds, which also verifies the call is
-// forwarded to the bridge.
+// the exception of AddObserver/RemoveObserver, which also verify the observer
+// is registered with the bridge.
class BridgedSyncNotifierTest : public testing::Test {
public:
BridgedSyncNotifierTest()
@@ -73,13 +74,18 @@ class BridgedSyncNotifierTest : public testing::Test {
BridgedSyncNotifier bridged_notifier_;
};
-TEST_F(BridgedSyncNotifierTest, UpdateRegisteredIds) {
+TEST_F(BridgedSyncNotifierTest, AddObserver) {
syncer::MockSyncNotifierObserver observer;
- EXPECT_CALL(mock_bridge_, UpdateRegisteredIds(
- &observer, syncer::ObjectIdSet()));
- EXPECT_CALL(*mock_delegate_, UpdateRegisteredIds(
- &observer, syncer::ObjectIdSet()));
- bridged_notifier_.UpdateRegisteredIds(&observer, syncer::ObjectIdSet());
+ EXPECT_CALL(mock_bridge_, AddObserver(&observer));
+ EXPECT_CALL(*mock_delegate_, AddObserver(&observer));
+ bridged_notifier_.AddObserver(&observer);
+}
+
+TEST_F(BridgedSyncNotifierTest, RemoveObserver) {
+ syncer::MockSyncNotifierObserver observer;
+ EXPECT_CALL(mock_bridge_, RemoveObserver(&observer));
+ EXPECT_CALL(*mock_delegate_, RemoveObserver(&observer));
+ bridged_notifier_.RemoveObserver(&observer);
}
TEST_F(BridgedSyncNotifierTest, SetUniqueId) {
@@ -101,6 +107,13 @@ TEST_F(BridgedSyncNotifierTest, UpdateCredentials) {
bridged_notifier_.UpdateCredentials(email, token);
}
+TEST_F(BridgedSyncNotifierTest, UpdateEnabledTypes) {
+ syncer::ModelTypeSet enabled_types(syncer::BOOKMARKS, syncer::PREFERENCES);
+ EXPECT_CALL(*mock_delegate_,
+ UpdateEnabledTypes(HasModelTypes(enabled_types)));
+ bridged_notifier_.UpdateEnabledTypes(enabled_types);
+}
+
TEST_F(BridgedSyncNotifierTest, SendNotification) {
syncer::ModelTypeSet changed_types(syncer::SESSIONS, syncer::EXTENSIONS);
EXPECT_CALL(*mock_delegate_, SendNotification(HasModelTypes(changed_types)));
« no previous file with comments | « chrome/browser/sync/glue/bridged_sync_notifier.cc ('k') | chrome/browser/sync/glue/chrome_sync_notification_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698