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..f89d9547910bb523f49bc1a7d8205fcadc1b0519 100644 |
--- a/chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc |
+++ b/chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc |
@@ -27,6 +27,8 @@ using ::testing::StrictMock; |
using content::BrowserThread; |
using syncer::HasModelTypes; |
+const char kHandlerName[] = "MockObserver"; |
+ |
class MockChromeSyncNotificationBridge : public ChromeSyncNotificationBridge { |
public: |
MockChromeSyncNotificationBridge( |
@@ -35,8 +37,10 @@ class MockChromeSyncNotificationBridge : public ChromeSyncNotificationBridge { |
: ChromeSyncNotificationBridge(profile, sync_task_runner) {} |
virtual ~MockChromeSyncNotificationBridge() {} |
- MOCK_METHOD2(UpdateRegisteredIds, void(syncer::SyncNotifierObserver*, |
- const syncer::ObjectIdSet&)); |
+ MOCK_METHOD2(SetHandler, |
+ void(const std::string&, syncer::SyncNotifierObserver*)); |
+ MOCK_METHOD2(UpdateRegisteredIds, |
+ void(const std::string&, const syncer::ObjectIdSet&)); |
}; |
class MockSyncNotifier : public syncer::SyncNotifier { |
@@ -44,17 +48,19 @@ class MockSyncNotifier : public syncer::SyncNotifier { |
MockSyncNotifier() {} |
virtual ~MockSyncNotifier() {} |
+ MOCK_METHOD2(SetHandler, |
+ void(const std::string&, syncer::SyncNotifierObserver*)); |
MOCK_METHOD2(UpdateRegisteredIds, |
- void(syncer::SyncNotifierObserver*, const syncer::ObjectIdSet&)); |
+ void(const std::string&, const syncer::ObjectIdSet&)); |
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(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. |
+// All tests just verify that each call is passed through to the |
+// delegate, with the exception of SetHandler and UpdateRegisteredIds, |
+// which also verifies the call is forwarded to the bridge. |
class BridgedSyncNotifierTest : public testing::Test { |
public: |
BridgedSyncNotifierTest() |
@@ -73,13 +79,19 @@ class BridgedSyncNotifierTest : public testing::Test { |
BridgedSyncNotifier bridged_notifier_; |
}; |
-TEST_F(BridgedSyncNotifierTest, UpdateRegisteredIds) { |
+TEST_F(BridgedSyncNotifierTest, SetHandler) { |
syncer::MockSyncNotifierObserver observer; |
+ EXPECT_CALL(mock_bridge_, SetHandler(kHandlerName, &observer)); |
+ EXPECT_CALL(*mock_delegate_, SetHandler(kHandlerName, &observer)); |
+ bridged_notifier_.SetHandler(kHandlerName, &observer); |
+} |
+ |
+TEST_F(BridgedSyncNotifierTest, UpdateRegisteredIds) { |
EXPECT_CALL(mock_bridge_, UpdateRegisteredIds( |
- &observer, syncer::ObjectIdSet())); |
+ kHandlerName, syncer::ObjectIdSet())); |
EXPECT_CALL(*mock_delegate_, UpdateRegisteredIds( |
- &observer, syncer::ObjectIdSet())); |
- bridged_notifier_.UpdateRegisteredIds(&observer, syncer::ObjectIdSet()); |
+ kHandlerName, syncer::ObjectIdSet())); |
+ bridged_notifier_.UpdateRegisteredIds(kHandlerName, syncer::ObjectIdSet()); |
} |
TEST_F(BridgedSyncNotifierTest, SetUniqueId) { |