| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <iostream> | 11 #include <iostream> |
| 12 #include <memory> |
| 12 #include <sstream> | 13 #include <sstream> |
| 13 #include <string> | 14 #include <string> |
| 15 |
| 14 #include "webrtc/libjingle/xmllite/xmlelement.h" | 16 #include "webrtc/libjingle/xmllite/xmlelement.h" |
| 15 #include "webrtc/libjingle/xmpp/constants.h" | 17 #include "webrtc/libjingle/xmpp/constants.h" |
| 16 #include "webrtc/libjingle/xmpp/plainsaslhandler.h" | 18 #include "webrtc/libjingle/xmpp/plainsaslhandler.h" |
| 17 #include "webrtc/libjingle/xmpp/saslplainmechanism.h" | 19 #include "webrtc/libjingle/xmpp/saslplainmechanism.h" |
| 18 #include "webrtc/libjingle/xmpp/util_unittest.h" | 20 #include "webrtc/libjingle/xmpp/util_unittest.h" |
| 19 #include "webrtc/libjingle/xmpp/xmppengine.h" | 21 #include "webrtc/libjingle/xmpp/xmppengine.h" |
| 20 #include "webrtc/base/common.h" | 22 #include "webrtc/base/common.h" |
| 21 #include "webrtc/base/gunit.h" | 23 #include "webrtc/base/gunit.h" |
| 22 | 24 |
| 23 using buzz::Jid; | 25 using buzz::Jid; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 engine_->SetSaslHandler( | 72 engine_->SetSaslHandler( |
| 71 new buzz::PlainSaslHandler(jid, rtc::CryptString(pass), true)); | 73 new buzz::PlainSaslHandler(jid, rtc::CryptString(pass), true)); |
| 72 } | 74 } |
| 73 virtual void TearDown() { | 75 virtual void TearDown() { |
| 74 handler_.reset(); | 76 handler_.reset(); |
| 75 engine_.reset(); | 77 engine_.reset(); |
| 76 } | 78 } |
| 77 void RunLogin(); | 79 void RunLogin(); |
| 78 | 80 |
| 79 private: | 81 private: |
| 80 rtc::scoped_ptr<XmppEngine> engine_; | 82 std::unique_ptr<XmppEngine> engine_; |
| 81 rtc::scoped_ptr<XmppTestHandler> handler_; | 83 std::unique_ptr<XmppTestHandler> handler_; |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 void XmppEngineTest::RunLogin() { | 86 void XmppEngineTest::RunLogin() { |
| 85 // Connect | 87 // Connect |
| 86 EXPECT_EQ(XmppEngine::STATE_START, engine()->GetState()); | 88 EXPECT_EQ(XmppEngine::STATE_START, engine()->GetState()); |
| 87 engine()->Connect(); | 89 engine()->Connect(); |
| 88 EXPECT_EQ(XmppEngine::STATE_OPENING, engine()->GetState()); | 90 EXPECT_EQ(XmppEngine::STATE_OPENING, engine()->GetState()); |
| 89 | 91 |
| 90 EXPECT_EQ("[OPENING]", handler_->SessionActivity()); | 92 EXPECT_EQ("[OPENING]", handler_->SessionActivity()); |
| 91 | 93 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 input = "<iq type='result' id='3'><query xmlns='jabber:iq:roster'><item>bar" | 318 input = "<iq type='result' id='3'><query xmlns='jabber:iq:roster'><item>bar" |
| 317 "</item></query></iq>"; | 319 "</item></query></iq>"; |
| 318 engine()->HandleInput(input.c_str(), input.length()); | 320 engine()->HandleInput(input.c_str(), input.length()); |
| 319 EXPECT_EQ("<cli:iq type=\"result\" id=\"3\" xmlns:cli=\"jabber:client\">" | 321 EXPECT_EQ("<cli:iq type=\"result\" id=\"3\" xmlns:cli=\"jabber:client\">" |
| 320 "<query xmlns=\"jabber:iq:roster\"><item>bar</item></query>" | 322 "<query xmlns=\"jabber:iq:roster\"><item>bar</item></query>" |
| 321 "</cli:iq>", handler()->StanzaActivity()); | 323 "</cli:iq>", handler()->StanzaActivity()); |
| 322 EXPECT_EQ("", iq_response.IqResponseActivity()); | 324 EXPECT_EQ("", iq_response.IqResponseActivity()); |
| 323 EXPECT_EQ("", handler()->OutputActivity()); | 325 EXPECT_EQ("", handler()->OutputActivity()); |
| 324 EXPECT_EQ("", handler()->SessionActivity()); | 326 EXPECT_EQ("", handler()->SessionActivity()); |
| 325 } | 327 } |
| OLD | NEW |