diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 22:10:01 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 22:10:01 +0000 |
commit | 8d167c212898cb233c51abf13913541c86cfd9ae (patch) | |
tree | f33768df22c405d0ea3e3521a14fc03f565fc07d /jingle | |
parent | dce08b668bed17b26e497ca56129538ba3da0b42 (diff) | |
download | chromium_src-8d167c212898cb233c51abf13913541c86cfd9ae.zip chromium_src-8d167c212898cb233c51abf13913541c86cfd9ae.tar.gz chromium_src-8d167c212898cb233c51abf13913541c86cfd9ae.tar.bz2 |
Even more test cleanup. Some fixes to non-test code that's regressed.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/6523032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r-- | jingle/jingle.gyp | 3 | ||||
-rw-r--r-- | jingle/notifier/listener/mediator_thread_mock.cc | 79 | ||||
-rw-r--r-- | jingle/notifier/listener/mediator_thread_mock.h | 82 |
3 files changed, 103 insertions, 61 deletions
diff --git a/jingle/jingle.gyp b/jingle/jingle.gyp index 553e70e..9af72b4 100644 --- a/jingle/jingle.gyp +++ b/jingle/jingle.gyp @@ -50,7 +50,6 @@ 'notifier/listener/mediator_thread.h', 'notifier/listener/mediator_thread_impl.cc', 'notifier/listener/mediator_thread_impl.h', - 'notifier/listener/mediator_thread_mock.h', 'notifier/listener/notification_constants.cc', 'notifier/listener/notification_constants.h', 'notifier/listener/notification_defines.cc', @@ -116,6 +115,8 @@ 'notifier/base/xmpp_connection_unittest.cc', 'notifier/base/weak_xmpp_client_unittest.cc', 'notifier/communicator/xmpp_connection_generator_unittest.cc', + 'notifier/listener/mediator_thread_mock.cc', + 'notifier/listener/mediator_thread_mock.h', 'notifier/listener/push_notifications_subscribe_task_unittest.cc', 'notifier/listener/talk_mediator_unittest.cc', 'notifier/listener/send_update_task_unittest.cc', diff --git a/jingle/notifier/listener/mediator_thread_mock.cc b/jingle/notifier/listener/mediator_thread_mock.cc new file mode 100644 index 0000000..92543dd --- /dev/null +++ b/jingle/notifier/listener/mediator_thread_mock.cc @@ -0,0 +1,79 @@ +// Copyright (c) 2011 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 "jingle/notifier/listener/mediator_thread_mock.h" + +#include "talk/xmpp/xmppclientsettings.h" + +namespace notifier { + +MockMediatorThread::MockMediatorThread() : observer_(NULL) { + Reset(); +} + +MockMediatorThread::~MockMediatorThread() {} + +void MockMediatorThread::Reset() { + login_calls = 0; + logout_calls = 0; + start_calls = 0; + subscribe_calls = 0; + listen_calls = 0; + send_calls = 0; +} + +void MockMediatorThread::AddObserver(Observer* observer) { + observer_ = observer; +} + +void MockMediatorThread::RemoveObserver(Observer* observer) { + observer_ = NULL; +} + +// Overridden from MediatorThread +void MockMediatorThread::Login(const buzz::XmppClientSettings& settings) { + login_calls++; + if (observer_) { + observer_->OnConnectionStateChange(true); + } +} + +void MockMediatorThread::Logout() { + logout_calls++; + if (observer_) { + observer_->OnConnectionStateChange(false); + } +} + +void MockMediatorThread::Start() { + start_calls++; +} + +void MockMediatorThread::SubscribeForUpdates( + const std::vector<std::string>& subscribed_services_list) { + subscribe_calls++; + if (observer_) { + observer_->OnSubscriptionStateChange(true); + } +} + +void MockMediatorThread::ListenForUpdates() { + listen_calls++; +} + +void MockMediatorThread::SendNotification(const OutgoingNotificationData &) { + send_calls++; + if (observer_) { + observer_->OnOutgoingNotification(); + } +} + +void MockMediatorThread::ReceiveNotification( + const IncomingNotificationData& data) { + if (observer_) { + observer_->OnIncomingNotification(data); + } +} + +} // namespace notifier diff --git a/jingle/notifier/listener/mediator_thread_mock.h b/jingle/notifier/listener/mediator_thread_mock.h index 99b880e..897570a 100644 --- a/jingle/notifier/listener/mediator_thread_mock.h +++ b/jingle/notifier/listener/mediator_thread_mock.h @@ -13,81 +13,43 @@ #include <vector> #include "jingle/notifier/listener/mediator_thread.h" -#include "talk/xmpp/xmppclientsettings.h" + +namespace buzz { +class XmppClientSettings; +} namespace notifier { class MockMediatorThread : public MediatorThread { public: - MockMediatorThread() : observer_(NULL) { - Reset(); - } + MockMediatorThread(); - virtual ~MockMediatorThread() {} + virtual ~MockMediatorThread(); - void Reset() { - login_calls = 0; - logout_calls = 0; - start_calls = 0; - subscribe_calls = 0; - listen_calls = 0; - send_calls = 0; - } + void Reset(); - virtual void AddObserver(Observer* observer) { - observer_ = observer; - } + virtual void AddObserver(Observer* observer); - virtual void RemoveObserver(Observer* observer) { - observer_ = NULL; - } + virtual void RemoveObserver(Observer* observer); // Overridden from MediatorThread - virtual void Login(const buzz::XmppClientSettings& settings) { - login_calls++; - if (observer_) { - observer_->OnConnectionStateChange(true); - } - } - - virtual void Logout() { - logout_calls++; - if (observer_) { - observer_->OnConnectionStateChange(false); - } - } - - virtual void Start() { - start_calls++; - } + virtual void Login(const buzz::XmppClientSettings& settings); + + virtual void Logout(); + + virtual void Start(); virtual void SubscribeForUpdates( - const std::vector<std::string>& subscribed_services_list) { - subscribe_calls++; - if (observer_) { - observer_->OnSubscriptionStateChange(true); - } - } - - virtual void ListenForUpdates() { - listen_calls++; - } - - virtual void SendNotification(const OutgoingNotificationData &) { - send_calls++; - if (observer_) { - observer_->OnOutgoingNotification(); - } - } - - void ReceiveNotification(const IncomingNotificationData& data) { - if (observer_) { - observer_->OnIncomingNotification(data); - } - } + const std::vector<std::string>& subscribed_services_list); + + virtual void ListenForUpdates(); + + virtual void SendNotification(const OutgoingNotificationData &); + + void ReceiveNotification(const IncomingNotificationData& data); Observer* observer_; - // Intneral State + // Internal State int login_calls; int logout_calls; int start_calls; |