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

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

Issue 10875064: Rename SyncNotifier->Invalidator and SyncNotifierObserver->InvalidationHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to ToT for landing 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
« no previous file with comments | « chrome/browser/sync/glue/bridged_invalidator.cc ('k') | chrome/browser/sync/glue/bridged_sync_notifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/bridged_invalidator_unittest.cc
diff --git a/chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc b/chrome/browser/sync/glue/bridged_invalidator_unittest.cc
similarity index 58%
rename from chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc
rename to chrome/browser/sync/glue/bridged_invalidator_unittest.cc
index a816148bb56d7b71badf33cfd4b9467a399ec629..a472de420a5a9da66e2ad2e1f593b3cc670ac1c6 100644
--- a/chrome/browser/sync/glue/bridged_sync_notifier_unittest.cc
+++ b/chrome/browser/sync/glue/bridged_invalidator_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/sync/glue/bridged_sync_notifier.h"
+#include "chrome/browser/sync/glue/bridged_invalidator.h"
#include <string>
@@ -14,9 +14,9 @@
#include "content/public/test/test_browser_thread.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/base/model_type_test_util.h"
-#include "sync/notifier/fake_sync_notifier.h"
-#include "sync/notifier/fake_sync_notifier_observer.h"
-#include "sync/notifier/sync_notifier.h"
+#include "sync/notifier/fake_invalidation_handler.h"
+#include "sync/notifier/fake_invalidator.h"
+#include "sync/notifier/invalidator.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -36,80 +36,80 @@ class MockChromeSyncNotificationBridge : public ChromeSyncNotificationBridge {
: ChromeSyncNotificationBridge(profile, sync_task_runner) {}
virtual ~MockChromeSyncNotificationBridge() {}
- MOCK_METHOD1(RegisterHandler, void(syncer::SyncNotifierObserver*));
+ MOCK_METHOD1(RegisterHandler, void(syncer::InvalidationHandler*));
MOCK_METHOD2(UpdateRegisteredIds,
- void(syncer::SyncNotifierObserver*,
+ void(syncer::InvalidationHandler*,
const syncer::ObjectIdSet&));
- MOCK_METHOD1(UnregisterHandler, void(syncer::SyncNotifierObserver*));
+ MOCK_METHOD1(UnregisterHandler, void(syncer::InvalidationHandler*));
};
// All tests just verify that each call is passed through to the delegate, with
// the exception of RegisterHandler, UnregisterHandler, and
// UpdateRegisteredIds, which also verifies the call is forwarded to the
// bridge.
-class BridgedSyncNotifierTest : public testing::Test {
+class BridgedInvalidatorTest : public testing::Test {
public:
- BridgedSyncNotifierTest()
+ BridgedInvalidatorTest()
: ui_thread_(BrowserThread::UI, &ui_loop_),
mock_bridge_(&mock_profile_, ui_loop_.message_loop_proxy()),
- // Owned by bridged_notifier_.
- fake_delegate_(new syncer::FakeSyncNotifier()),
- bridged_notifier_(&mock_bridge_, fake_delegate_) {}
- virtual ~BridgedSyncNotifierTest() {}
+ // Owned by bridged_invalidator_.
+ fake_delegate_(new syncer::FakeInvalidator()),
+ bridged_invalidator_(&mock_bridge_, fake_delegate_) {}
+ virtual ~BridgedInvalidatorTest() {}
protected:
MessageLoop ui_loop_;
content::TestBrowserThread ui_thread_;
NiceMock<ProfileMock> mock_profile_;
StrictMock<MockChromeSyncNotificationBridge> mock_bridge_;
- syncer::FakeSyncNotifier* fake_delegate_;
- BridgedSyncNotifier bridged_notifier_;
+ syncer::FakeInvalidator* fake_delegate_;
+ BridgedInvalidator bridged_invalidator_;
};
-TEST_F(BridgedSyncNotifierTest, RegisterHandler) {
+TEST_F(BridgedInvalidatorTest, RegisterHandler) {
const syncer::ObjectIdSet& ids =
syncer::ModelTypeSetToObjectIdSet(
syncer::ModelTypeSet(syncer::APPS, syncer::PREFERENCES));
- syncer::FakeSyncNotifierObserver observer;
- EXPECT_CALL(mock_bridge_, RegisterHandler(&observer));
- EXPECT_CALL(mock_bridge_, UpdateRegisteredIds(&observer, ids));
- EXPECT_CALL(mock_bridge_, UnregisterHandler(&observer));
+ syncer::FakeInvalidationHandler handler;
+ EXPECT_CALL(mock_bridge_, RegisterHandler(&handler));
+ EXPECT_CALL(mock_bridge_, UpdateRegisteredIds(&handler, ids));
+ EXPECT_CALL(mock_bridge_, UnregisterHandler(&handler));
- bridged_notifier_.RegisterHandler(&observer);
- EXPECT_TRUE(fake_delegate_->IsHandlerRegistered(&observer));
+ bridged_invalidator_.RegisterHandler(&handler);
+ EXPECT_TRUE(fake_delegate_->IsHandlerRegistered(&handler));
- bridged_notifier_.UpdateRegisteredIds(&observer, ids);
- EXPECT_EQ(ids, fake_delegate_->GetRegisteredIds(&observer));
+ bridged_invalidator_.UpdateRegisteredIds(&handler, ids);
+ EXPECT_EQ(ids, fake_delegate_->GetRegisteredIds(&handler));
- bridged_notifier_.UnregisterHandler(&observer);
- EXPECT_FALSE(fake_delegate_->IsHandlerRegistered(&observer));
+ bridged_invalidator_.UnregisterHandler(&handler);
+ EXPECT_FALSE(fake_delegate_->IsHandlerRegistered(&handler));
}
-TEST_F(BridgedSyncNotifierTest, SetUniqueId) {
+TEST_F(BridgedInvalidatorTest, SetUniqueId) {
const std::string& unique_id = "unique id";
- bridged_notifier_.SetUniqueId(unique_id);
+ bridged_invalidator_.SetUniqueId(unique_id);
EXPECT_EQ(unique_id, fake_delegate_->GetUniqueId());
}
-TEST_F(BridgedSyncNotifierTest, SetStateDeprecated) {
+TEST_F(BridgedInvalidatorTest, SetStateDeprecated) {
const std::string& state = "state";
- bridged_notifier_.SetStateDeprecated(state);
+ bridged_invalidator_.SetStateDeprecated(state);
EXPECT_EQ(state, fake_delegate_->GetStateDeprecated());
}
-TEST_F(BridgedSyncNotifierTest, UpdateCredentials) {
+TEST_F(BridgedInvalidatorTest, UpdateCredentials) {
const std::string& email = "email";
const std::string& token = "token";
- bridged_notifier_.UpdateCredentials(email, token);
+ bridged_invalidator_.UpdateCredentials(email, token);
EXPECT_EQ(email, fake_delegate_->GetCredentialsEmail());
EXPECT_EQ(token, fake_delegate_->GetCredentialsToken());
}
-TEST_F(BridgedSyncNotifierTest, SendNotification) {
+TEST_F(BridgedInvalidatorTest, SendNotification) {
const syncer::ModelTypeSet changed_types(
syncer::SESSIONS, syncer::EXTENSIONS);
- bridged_notifier_.SendNotification(changed_types);
+ bridged_invalidator_.SendNotification(changed_types);
EXPECT_TRUE(fake_delegate_->GetLastChangedTypes().Equals(changed_types));
}
« no previous file with comments | « chrome/browser/sync/glue/bridged_invalidator.cc ('k') | chrome/browser/sync/glue/bridged_sync_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698