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

Unified Diff: sync/notifier/non_blocking_invalidation_notifier_unittest.cc

Issue 10702074: Refactor sync-specific parts out of SyncNotifier/SyncNotifierObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to HEAD 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
« no previous file with comments | « sync/notifier/non_blocking_invalidation_notifier.cc ('k') | sync/notifier/object_id_payload_map.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/non_blocking_invalidation_notifier_unittest.cc
diff --git a/sync/notifier/non_blocking_invalidation_notifier_unittest.cc b/sync/notifier/non_blocking_invalidation_notifier_unittest.cc
index 7a30f585fe48e5e4391fcfbf894ce3bd37b2295d..36f4532bb5d38b79ed2e6a29fa301855af0943e2 100644
--- a/sync/notifier/non_blocking_invalidation_notifier_unittest.cc
+++ b/sync/notifier/non_blocking_invalidation_notifier_unittest.cc
@@ -8,6 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/threading/thread.h"
+#include "google/cacheinvalidation/v2/types.pb.h"
#include "jingle/notifier/base/fake_base_task.h"
#include "net/url_request/url_request_test_util.h"
#include "sync/internal_api/public/base/model_type.h"
@@ -45,11 +46,10 @@ class NonBlockingInvalidationNotifierTest : public testing::Test {
std::string(), // initial_invalidation_state
MakeWeakHandle(base::WeakPtr<InvalidationStateTracker>()),
"fake_client_info"));
- invalidation_notifier_->AddObserver(&mock_observer_);
}
virtual void TearDown() {
- invalidation_notifier_->RemoveObserver(&mock_observer_);
+ invalidation_notifier_->UpdateRegisteredIds(&mock_observer_, ObjectIdSet());
invalidation_notifier_.reset();
request_context_getter_ = NULL;
io_thread_.Stop();
@@ -67,15 +67,16 @@ class NonBlockingInvalidationNotifierTest : public testing::Test {
TEST_F(NonBlockingInvalidationNotifierTest, Basic) {
InSequence dummy;
- ModelTypePayloadMap type_payloads;
- type_payloads[PREFERENCES] = "payload";
- type_payloads[BOOKMARKS] = "";
- type_payloads[AUTOFILL] = "";
+ ModelTypeSet models(PREFERENCES, BOOKMARKS, AUTOFILL);
+ invalidation_notifier_->UpdateRegisteredIds(
+ &mock_observer_, ModelTypeSetToObjectIdSet(models));
+ const ModelTypePayloadMap& type_payloads =
+ ModelTypePayloadMapFromEnumSet(models, "payload");
EXPECT_CALL(mock_observer_, OnNotificationsEnabled());
- EXPECT_CALL(mock_observer_,
- OnIncomingNotification(type_payloads,
- REMOTE_NOTIFICATION));
+ EXPECT_CALL(mock_observer_, OnIncomingNotification(
+ ModelTypePayloadMapToObjectIdPayloadMap(type_payloads),
+ REMOTE_NOTIFICATION));
EXPECT_CALL(mock_observer_,
OnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR));
EXPECT_CALL(mock_observer_,
@@ -86,8 +87,9 @@ TEST_F(NonBlockingInvalidationNotifierTest, Basic) {
invalidation_notifier_->UpdateCredentials("foo@bar.com", "fake_token");
invalidation_notifier_->OnNotificationsEnabled();
- invalidation_notifier_->OnIncomingNotification(type_payloads,
- REMOTE_NOTIFICATION);
+ invalidation_notifier_->OnIncomingNotification(
+ ModelTypePayloadMapToObjectIdPayloadMap(type_payloads),
+ REMOTE_NOTIFICATION);
invalidation_notifier_->OnNotificationsDisabled(
TRANSIENT_NOTIFICATION_ERROR);
invalidation_notifier_->OnNotificationsDisabled(
« no previous file with comments | « sync/notifier/non_blocking_invalidation_notifier.cc ('k') | sync/notifier/object_id_payload_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698