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

Unified Diff: jingle/notifier/listener/mediator_thread_mock.cc

Issue 6523032: Even more test cleanup. Some fixes to non-test code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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
Index: jingle/notifier/listener/mediator_thread_mock.cc
diff --git a/jingle/notifier/listener/mediator_thread_mock.cc b/jingle/notifier/listener/mediator_thread_mock.cc
new file mode 100644
index 0000000000000000000000000000000000000000..92543ddea316239ab60a14e718ac2569da1cfbec
--- /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

Powered by Google App Engine
This is Rietveld 408576698