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

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: Work around brittle unit test Created 8 years, 4 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..8863be448411ef26500ccb9b1a1e00918050d0f4 100644
--- a/chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc
+++ b/chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc
@@ -35,8 +35,11 @@ class MockChromeSyncNotificationBridge : public ChromeSyncNotificationBridge {
: ChromeSyncNotificationBridge(profile, sync_task_runner) {}
virtual ~MockChromeSyncNotificationBridge() {}
- MOCK_METHOD2(UpdateRegisteredIds, void(syncer::SyncNotifierObserver*,
- const syncer::ObjectIdSet&));
+ MOCK_METHOD1(RegisterHandler, void(syncer::SyncNotifierObserver*));
+ MOCK_METHOD2(UpdateRegisteredIds,
+ void(syncer::SyncNotifierObserver*,
+ const syncer::ObjectIdSet&));
+ MOCK_METHOD1(UnregisterHandler, void(syncer::SyncNotifierObserver*));
};
class MockSyncNotifier : public syncer::SyncNotifier {
@@ -44,8 +47,11 @@ class MockSyncNotifier : public syncer::SyncNotifier {
MockSyncNotifier() {}
virtual ~MockSyncNotifier() {}
+ MOCK_METHOD1(RegisterHandler, void(syncer::SyncNotifierObserver*));
MOCK_METHOD2(UpdateRegisteredIds,
- void(syncer::SyncNotifierObserver*, const syncer::ObjectIdSet&));
+ void(syncer::SyncNotifierObserver*,
+ const syncer::ObjectIdSet&));
+ MOCK_METHOD1(UnregisterHandler, 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&));
@@ -53,8 +59,9 @@ class MockSyncNotifier : public syncer::SyncNotifier {
};
// 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 RegisterHandler, UnregisterHandler, and
+// UpdateRegisteredIds, which also verifies the call is forwarded to the
+// bridge.
class BridgedSyncNotifierTest : public testing::Test {
public:
BridgedSyncNotifierTest()
@@ -73,13 +80,26 @@ class BridgedSyncNotifierTest : public testing::Test {
BridgedSyncNotifier bridged_notifier_;
};
-TEST_F(BridgedSyncNotifierTest, UpdateRegisteredIds) {
+TEST_F(BridgedSyncNotifierTest, RegisterHandler) {
syncer::MockSyncNotifierObserver observer;
+ EXPECT_CALL(mock_bridge_, RegisterHandler(&observer));
+ EXPECT_CALL(*mock_delegate_, RegisterHandler(&observer));
+ bridged_notifier_.RegisterHandler(&observer);
+}
+
+TEST_F(BridgedSyncNotifierTest, UpdateRegisteredIds) {
EXPECT_CALL(mock_bridge_, UpdateRegisteredIds(
- &observer, syncer::ObjectIdSet()));
+ NULL, syncer::ObjectIdSet()));
EXPECT_CALL(*mock_delegate_, UpdateRegisteredIds(
- &observer, syncer::ObjectIdSet()));
- bridged_notifier_.UpdateRegisteredIds(&observer, syncer::ObjectIdSet());
+ NULL, syncer::ObjectIdSet()));
+ bridged_notifier_.UpdateRegisteredIds(NULL, syncer::ObjectIdSet());
+}
+
+TEST_F(BridgedSyncNotifierTest, UnregisterHandler) {
+ syncer::MockSyncNotifierObserver observer;
+ EXPECT_CALL(mock_bridge_, UnregisterHandler(&observer));
+ EXPECT_CALL(*mock_delegate_, UnregisterHandler(&observer));
+ bridged_notifier_.UnregisterHandler(&observer);
}
TEST_F(BridgedSyncNotifierTest, SetUniqueId) {
« 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