Index: jingle/notifier/base/fake_base_task.cc |
=================================================================== |
--- jingle/notifier/base/fake_base_task.cc (revision 119260) |
+++ jingle/notifier/base/fake_base_task.cc (working copy) |
@@ -2,6 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "base/compiler_specific.h" |
#include "jingle/notifier/base/fake_base_task.h" |
#include "jingle/notifier/base/weak_xmpp_client.h" |
#include "talk/xmpp/asyncsocket.h" |
@@ -26,10 +27,36 @@ |
MOCK_METHOD1(StartTls, bool(const std::string&)); |
}; |
+} // namespace notifier |
+ |
+namespace { |
+ |
+// Extends WeakXmppClient to make jid() return a full jid, as required by |
+// PushNotificationsSubscribeTask. |
+class FakeWeakXmppClient : public notifier::WeakXmppClient { |
+ public: |
+ explicit FakeWeakXmppClient(talk_base::TaskParent* parent) |
+ : notifier::WeakXmppClient(parent), |
+ jid_("test@example.com/testresource") {} |
+ |
+ virtual ~FakeWeakXmppClient() {} |
+ |
+ virtual const buzz::Jid& jid() const OVERRIDE { |
+ return jid_; |
+ } |
+ |
+ private: |
+ buzz::Jid jid_; |
+}; |
+ |
+} // namespace |
+ |
+namespace notifier { |
+ |
FakeBaseTask::FakeBaseTask() { |
// Owned by |task_pump_|. |
- notifier::WeakXmppClient* weak_xmpp_client = |
- new notifier::WeakXmppClient(&task_pump_); |
+ FakeWeakXmppClient* weak_xmpp_client = |
+ new FakeWeakXmppClient(&task_pump_); |
weak_xmpp_client->Start(); |
buzz::XmppClientSettings settings; |