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

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

Issue 10824161: [Sync] Avoid unregistering object IDs on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove now-unneeded param 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..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) {

Powered by Google App Engine
This is Rietveld 408576698