2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #ifndef WEBRTC_LIBJINGLE_XMPP_UTIL_UNITTEST_H_
12 #define WEBRTC_LIBJINGLE_XMPP_UTIL_UNITTEST_H_
16 #include "webrtc/libjingle/xmpp/xmppengine.h"
20 // This class captures callbacks from engine.
21 class XmppTestHandler : public XmppOutputHandler, public XmppSessionHandler,
22 public XmppStanzaHandler {
24 explicit XmppTestHandler(XmppEngine* engine) : engine_(engine) {}
25 virtual ~XmppTestHandler() {}
27 void SetEngine(XmppEngine* engine);
30 virtual void WriteOutput(const char * bytes, size_t len);
31 virtual void StartTls(const std::string & cname);
32 virtual void CloseConnection();
35 virtual void OnStateChange(int state);
38 virtual bool HandleStanza(const XmlElement* stanza);
40 std::string OutputActivity();
41 std::string SessionActivity();
42 std::string StanzaActivity();
46 std::stringstream output_;
47 std::stringstream session_;
48 std::stringstream stanza_;
53 inline std::ostream& operator<<(std::ostream& os, const buzz::Jid& jid) {
58 #endif // WEBRTC_LIBJINGLE_XMPP_UTIL_UNITTEST_H_