| 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 <memory> |
| 13 #include <sstream> | 13 #include <sstream> |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" | 16 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" |
| 17 #include "third_party/libjingle_xmpp/xmpp/constants.h" | 17 #include "third_party/libjingle_xmpp/xmpp/constants.h" |
| 18 #include "third_party/libjingle_xmpp/xmpp/plainsaslhandler.h" | 18 #include "third_party/libjingle_xmpp/xmpp/plainsaslhandler.h" |
| 19 #include "third_party/libjingle_xmpp/xmpp/saslplainmechanism.h" | 19 #include "third_party/libjingle_xmpp/xmpp/saslplainmechanism.h" |
| 20 #include "third_party/libjingle_xmpp/xmpp/util_unittest.h" | 20 #include "third_party/libjingle_xmpp/xmpp/util_unittest.h" |
| 21 #include "third_party/libjingle_xmpp/xmpp/xmppengine.h" | 21 #include "third_party/libjingle_xmpp/xmpp/xmppengine.h" |
| 22 #include "third_party/webrtc/base/cryptstring.h" | |
| 23 #include "third_party/webrtc/base/gunit.h" | 22 #include "third_party/webrtc/base/gunit.h" |
| 24 #include "third_party/webrtc/typedefs.h" | 23 #include "third_party/webrtc/typedefs.h" |
| 25 | 24 |
| 26 using buzz::Jid; | 25 using buzz::Jid; |
| 27 using buzz::QName; | 26 using buzz::QName; |
| 28 using buzz::XmlElement; | 27 using buzz::XmlElement; |
| 29 using buzz::XmppEngine; | 28 using buzz::XmppEngine; |
| 30 using buzz::XmppTestHandler; | 29 using buzz::XmppTestHandler; |
| 31 | 30 |
| 32 enum XlttStage { | 31 enum XlttStage { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 45 | 44 |
| 46 class XmppLoginTaskTest : public testing::Test { | 45 class XmppLoginTaskTest : public testing::Test { |
| 47 public: | 46 public: |
| 48 XmppEngine* engine() { return engine_.get(); } | 47 XmppEngine* engine() { return engine_.get(); } |
| 49 XmppTestHandler* handler() { return handler_.get(); } | 48 XmppTestHandler* handler() { return handler_.get(); } |
| 50 virtual void SetUp() { | 49 virtual void SetUp() { |
| 51 engine_.reset(XmppEngine::Create()); | 50 engine_.reset(XmppEngine::Create()); |
| 52 handler_.reset(new XmppTestHandler(engine_.get())); | 51 handler_.reset(new XmppTestHandler(engine_.get())); |
| 53 | 52 |
| 54 Jid jid("david@my-server"); | 53 Jid jid("david@my-server"); |
| 55 rtc::InsecureCryptStringImpl pass; | 54 std::string pass("david"); |
| 56 pass.password() = "david"; | |
| 57 engine_->SetSessionHandler(handler_.get()); | 55 engine_->SetSessionHandler(handler_.get()); |
| 58 engine_->SetOutputHandler(handler_.get()); | 56 engine_->SetOutputHandler(handler_.get()); |
| 59 engine_->AddStanzaHandler(handler_.get()); | 57 engine_->AddStanzaHandler(handler_.get()); |
| 60 engine_->SetUser(jid); | 58 engine_->SetUser(jid); |
| 61 engine_->SetSaslHandler( | 59 engine_->SetSaslHandler( |
| 62 new buzz::PlainSaslHandler(jid, rtc::CryptString(pass), true)); | 60 new buzz::PlainSaslHandler(jid, pass, true)); |
| 63 } | 61 } |
| 64 virtual void TearDown() { | 62 virtual void TearDown() { |
| 65 handler_.reset(); | 63 handler_.reset(); |
| 66 engine_.reset(); | 64 engine_.reset(); |
| 67 } | 65 } |
| 68 void RunPartialLogin(XlttStage startstage, XlttStage endstage); | 66 void RunPartialLogin(XlttStage startstage, XlttStage endstage); |
| 69 void SetTlsOptions(buzz::TlsOptions option); | 67 void SetTlsOptions(buzz::TlsOptions option); |
| 70 | 68 |
| 71 private: | 69 private: |
| 72 std::unique_ptr<XmppEngine> engine_; | 70 std::unique_ptr<XmppEngine> engine_; |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 "<text xml:lang=\"en\" xmlns=\"urn:ietf:params:xml:ns:xmpp-streams\">" | 624 "<text xml:lang=\"en\" xmlns=\"urn:ietf:params:xml:ns:xmpp-streams\">" |
| 627 "Some special application diagnostic information!" | 625 "Some special application diagnostic information!" |
| 628 "</text>" | 626 "</text>" |
| 629 "<escape-your-data xmlns=\"application-ns\"/>" | 627 "<escape-your-data xmlns=\"application-ns\"/>" |
| 630 "</str:error>", engine()->GetStreamError()->Str()); | 628 "</str:error>", engine()->GetStreamError()->Str()); |
| 631 | 629 |
| 632 TearDown(); | 630 TearDown(); |
| 633 SetUp(); | 631 SetUp(); |
| 634 } | 632 } |
| 635 } | 633 } |
| OLD | NEW |