diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-11 21:26:39 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-11 21:26:39 +0000 |
commit | 483c93e7add9ba7e493646c6db4b4c40bf6054ab (patch) | |
tree | c9e181de74bf5e0fa392e38624743c3a6525ed4c /chrome/test/sync | |
parent | 433f6af9e47312bfbe3ed4ddc2b5a3a59dc1b125 (diff) | |
download | chromium_src-483c93e7add9ba7e493646c6db4b4c40bf6054ab.zip chromium_src-483c93e7add9ba7e493646c6db4b4c40bf6054ab.tar.gz chromium_src-483c93e7add9ba7e493646c6db4b4c40bf6054ab.tar.bz2 |
sync: use ObserverList instead of EventChannel (deprecated) for syncer events.
Remove the relay_channel and syncer_event_channel in favor of having
listeners live on the SyncSessionContext and be notified
directly.
Remove some unnecessary event types and variables.
BUG=26339
TEST=sync_unit_tests
Review URL: http://codereview.chromium.org/3538011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62187 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/sync')
-rw-r--r-- | chrome/test/sync/engine/syncer_command_test.h | 3 | ||||
-rw-r--r-- | chrome/test/sync/sessions/test_scoped_session_event_listener.h | 36 |
2 files changed, 38 insertions, 1 deletions
diff --git a/chrome/test/sync/engine/syncer_command_test.h b/chrome/test/sync/engine/syncer_command_test.h index 02ea57d..faeb4b5 100644 --- a/chrome/test/sync/engine/syncer_command_test.h +++ b/chrome/test/sync/engine/syncer_command_test.h @@ -94,7 +94,8 @@ class SyncerCommandTestWithParam : public testing::TestWithParam<T>, void ResetContext() { context_.reset(new sessions::SyncSessionContext( - mock_server_.get(), syncdb_->manager(), registrar())); + mock_server_.get(), syncdb_->manager(), registrar(), + std::vector<SyncEngineEventListener*>())); context_->set_account_name(syncdb_->name()); ClearSession(); } diff --git a/chrome/test/sync/sessions/test_scoped_session_event_listener.h b/chrome/test/sync/sessions/test_scoped_session_event_listener.h new file mode 100644 index 0000000..9ede09b --- /dev/null +++ b/chrome/test/sync/sessions/test_scoped_session_event_listener.h @@ -0,0 +1,36 @@ +// Copyright (c) 2010 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. + +#ifndef CHROME_TEST_SYNC_SESSIONS_TEST_SCOPED_SESSION_EVENT_LISTENER_H_ +#define CHROME_TEST_SYNC_SESSIONS_TEST_SCOPED_SESSION_EVENT_LISTENER_H_ +#pragma once + +#include "chrome/browser/sync/sessions/sync_session_context.h" + +namespace browser_sync { +namespace sessions { + +// Installs a SyncEventListener to a given session context for the lifetime of +// the TestScopedSessionEventListener. +class TestScopedSessionEventListener { + public: + TestScopedSessionEventListener( + SyncSessionContext* context, + SyncEngineEventListener* listener) + : context_(context), listener_(listener) { + context->listeners_.AddObserver(listener); + } + ~TestScopedSessionEventListener() { + context_->listeners_.RemoveObserver(listener_); + } + private: + SyncSessionContext* context_; + SyncEngineEventListener* listener_; + DISALLOW_COPY_AND_ASSIGN(TestScopedSessionEventListener); +}; + +} // namespace sessions +} // namespace browser_sync + +#endif // CHROME_TEST_SYNC_SESSIONS_TEST_SCOPED_SESSION_EVENT_LISTENER_H_ |