summaryrefslogtreecommitdiffstats
path: root/sync/notifier/invalidation_notifier_unittest.cc
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 02:56:52 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 02:56:52 +0000
commit44828778fe3a022b32e8db1ac91ac6a2cbeb5578 (patch)
tree72a7d2dec5bc716903be1514cb4fc9692b23758d /sync/notifier/invalidation_notifier_unittest.cc
parentc570c99d715d6bd0a09c14784b31837daa184751 (diff)
downloadchromium_src-44828778fe3a022b32e8db1ac91ac6a2cbeb5578.zip
chromium_src-44828778fe3a022b32e8db1ac91ac6a2cbeb5578.tar.gz
chromium_src-44828778fe3a022b32e8db1ac91ac6a2cbeb5578.tar.bz2
Retry: Move some sync/notifier to components/invalidation
Moves many of the files in sync/notifier to components/invalidation. This change does not introduce any new dependencies. The relevant dependency rules both before and after this change should be: - chrome/browser/invalidation and chrome in general depend on components/invalidation. - components/invalidation depends on sync/notifier and sync in general. - sync/notifier, components/invalidation, and various parts of chrome all depend on sync/internal_api/public. The eventual goal is to move all of sync/notifier into components/invalidation. The invalidation-related parts of sync/internal_api/public should be moved to components/invalidation, too. This will allow us to remove the deopendencies from components/invalidation to sync, and remove sync's dependencies on cacheinvalidation and libjingle. This change is a regression in terms of shared library componentization. the files in the sync/notifier folder could be built as a shared library. The files in compononents/invalidation do not support this yet. The SYNC_EXPORT declarations in the moved files have been changed to INVALIDATION_EXPORT so as to not lose this information, but the macros are currently #defined to no-ops. This change does not attempt to rename any classes or namespaces. Many of the files ported from sync/notifier still use the syncer namespace. Some, like SyncSystemResources, still have names tied to their sync heritage. This will be addressed in future CLs. Some non-trivial or non-obvious changes include: - invalidator_state.h was moved to sync/internal_api/public/base so it could be shared by both sync/ and components/invalidation. This should be fixed in a future CL. - FromNotifierReason was split out of invalidator_state.h and moved to the newly-created components/invalidator_reason_util.h TBR=zea,rtenneti,mallinath,dcheng BUG=259559 Review URL: https://codereview.chromium.org/315433002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275305 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/notifier/invalidation_notifier_unittest.cc')
-rw-r--r--sync/notifier/invalidation_notifier_unittest.cc92
1 files changed, 0 insertions, 92 deletions
diff --git a/sync/notifier/invalidation_notifier_unittest.cc b/sync/notifier/invalidation_notifier_unittest.cc
deleted file mode 100644
index 75c6b3a..0000000
--- a/sync/notifier/invalidation_notifier_unittest.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2014 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/invalidation_notifier.h"
-
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
-#include "jingle/notifier/base/fake_base_task.h"
-#include "jingle/notifier/base/notifier_options.h"
-#include "jingle/notifier/listener/fake_push_client.h"
-#include "net/url_request/url_request_test_util.h"
-#include "sync/internal_api/public/base/model_type.h"
-#include "sync/internal_api/public/util/weak_handle.h"
-#include "sync/notifier/fake_invalidation_handler.h"
-#include "sync/notifier/fake_invalidation_state_tracker.h"
-#include "sync/notifier/invalidation_state_tracker.h"
-#include "sync/notifier/invalidator_test_template.h"
-#include "sync/notifier/push_client_channel.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace syncer {
-
-namespace {
-
-class InvalidationNotifierTestDelegate {
- public:
- InvalidationNotifierTestDelegate() {}
-
- ~InvalidationNotifierTestDelegate() {
- DestroyInvalidator();
- }
-
- void CreateInvalidator(
- const std::string& invalidator_client_id,
- const std::string& initial_state,
- const base::WeakPtr<InvalidationStateTracker>&
- invalidation_state_tracker) {
- DCHECK(!invalidator_.get());
- scoped_ptr<notifier::PushClient> push_client(
- new notifier::FakePushClient());
- scoped_ptr<SyncNetworkChannel> network_channel(
- new PushClientChannel(push_client.Pass()));
- invalidator_.reset(
- new InvalidationNotifier(
- network_channel.Pass(),
- invalidator_client_id,
- UnackedInvalidationsMap(),
- initial_state,
- MakeWeakHandle(invalidation_state_tracker),
- "fake_client_info"));
- }
-
- Invalidator* GetInvalidator() {
- return invalidator_.get();
- }
-
- void DestroyInvalidator() {
- // Stopping the invalidation notifier stops its scheduler, which deletes
- // any pending tasks without running them. Some tasks "run and delete"
- // another task, so they must be run in order to avoid leaking the inner
- // task. Stopping does not schedule any tasks, so it's both necessary and
- // sufficient to drain the task queue before stopping the notifier.
- message_loop_.RunUntilIdle();
- invalidator_.reset();
- }
-
- void WaitForInvalidator() {
- message_loop_.RunUntilIdle();
- }
-
- void TriggerOnInvalidatorStateChange(InvalidatorState state) {
- invalidator_->OnInvalidatorStateChange(state);
- }
-
- void TriggerOnIncomingInvalidation(
- const ObjectIdInvalidationMap& invalidation_map) {
- invalidator_->OnInvalidate(invalidation_map);
- }
-
- private:
- base::MessageLoop message_loop_;
- scoped_ptr<InvalidationNotifier> invalidator_;
-};
-
-INSTANTIATE_TYPED_TEST_CASE_P(
- InvalidationNotifierTest, InvalidatorTest,
- InvalidationNotifierTestDelegate);
-
-} // namespace
-
-} // namespace syncer