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

Unified Diff: sync/notifier/non_blocking_invalidation_notifier_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 | « sync/notifier/non_blocking_invalidation_notifier.cc ('k') | sync/notifier/non_blocking_invalidator.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
deleted file mode 100644
index a749b64971e94f3df5daf45efd9f9cc4cece5ecc..0000000000000000000000000000000000000000
--- a/sync/notifier/non_blocking_invalidation_notifier_unittest.cc
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "sync/notifier/non_blocking_invalidation_notifier.h"
-
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop.h"
-#include "base/threading/thread.h"
-#include "google/cacheinvalidation/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"
-#include "sync/internal_api/public/base/model_type_state_map.h"
-#include "sync/internal_api/public/util/weak_handle.h"
-#include "sync/notifier/fake_sync_notifier_observer.h"
-#include "sync/notifier/invalidation_state_tracker.h"
-#include "sync/notifier/object_id_state_map_test_util.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace syncer {
-
-namespace {
-
-using ::testing::InSequence;
-using ::testing::StrictMock;
-
-class NonBlockingInvalidationNotifierTest : public testing::Test {
- public:
- NonBlockingInvalidationNotifierTest() : io_thread_("Test IO thread") {}
-
- protected:
- virtual void SetUp() {
- base::Thread::Options options;
- options.message_loop_type = MessageLoop::TYPE_IO;
- io_thread_.StartWithOptions(options);
- request_context_getter_ =
- new TestURLRequestContextGetter(io_thread_.message_loop_proxy());
- notifier::NotifierOptions notifier_options;
- notifier_options.request_context_getter = request_context_getter_;
- invalidation_notifier_.reset(
- new NonBlockingInvalidationNotifier(
- notifier_options,
- InvalidationVersionMap(),
- std::string(), // initial_invalidation_state
- MakeWeakHandle(base::WeakPtr<InvalidationStateTracker>()),
- "fake_client_info"));
- invalidation_notifier_->RegisterHandler(&fake_observer_);
- }
-
- virtual void TearDown() {
- invalidation_notifier_->UnregisterHandler(&fake_observer_);
- invalidation_notifier_.reset();
- request_context_getter_ = NULL;
- io_thread_.Stop();
- ui_loop_.RunAllPending();
- }
-
- MessageLoop ui_loop_;
- base::Thread io_thread_;
- scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
- scoped_ptr<NonBlockingInvalidationNotifier> invalidation_notifier_;
- FakeSyncNotifierObserver fake_observer_;
- notifier::FakeBaseTask fake_base_task_;
-};
-
-// TODO(akalin): Add real unit tests (http://crbug.com/140410).
-
-TEST_F(NonBlockingInvalidationNotifierTest, Basic) {
- const ModelTypeSet models(PREFERENCES, BOOKMARKS, AUTOFILL);
- const ObjectIdStateMap& id_state_map =
- ModelTypeStateMapToObjectIdStateMap(
- ModelTypeSetToStateMap(models, "payload"));
-
- invalidation_notifier_->UpdateRegisteredIds(
- &fake_observer_, ModelTypeSetToObjectIdSet(models));
-
- invalidation_notifier_->SetStateDeprecated("fake_state");
- invalidation_notifier_->SetUniqueId("fake_id");
- invalidation_notifier_->UpdateCredentials("foo@bar.com", "fake_token");
-
- invalidation_notifier_->OnNotificationsEnabled();
- EXPECT_EQ(NO_NOTIFICATION_ERROR,
- fake_observer_.GetNotificationsDisabledReason());
-
- invalidation_notifier_->OnIncomingNotification(
- id_state_map, REMOTE_NOTIFICATION);
- EXPECT_THAT(id_state_map,
- Eq(fake_observer_.GetLastNotificationIdStateMap()));
- EXPECT_EQ(REMOTE_NOTIFICATION, fake_observer_.GetLastNotificationSource());
-
- invalidation_notifier_->OnNotificationsDisabled(
- TRANSIENT_NOTIFICATION_ERROR);
- EXPECT_EQ(TRANSIENT_NOTIFICATION_ERROR,
- fake_observer_.GetNotificationsDisabledReason());
-
- invalidation_notifier_->OnNotificationsDisabled(
- NOTIFICATION_CREDENTIALS_REJECTED);
- EXPECT_EQ(NOTIFICATION_CREDENTIALS_REJECTED,
- fake_observer_.GetNotificationsDisabledReason());
-
- ui_loop_.RunAllPending();
-}
-
-} // namespace
-
-} // namespace syncer
« no previous file with comments | « sync/notifier/non_blocking_invalidation_notifier.cc ('k') | sync/notifier/non_blocking_invalidator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698