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 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 class XmppEngineTest : public testing::Test { | 56 class XmppEngineTest : public testing::Test { |
57 public: | 57 public: |
58 XmppEngine* engine() { return engine_.get(); } | 58 XmppEngine* engine() { return engine_.get(); } |
59 XmppTestHandler* handler() { return handler_.get(); } | 59 XmppTestHandler* handler() { return handler_.get(); } |
60 virtual void SetUp() { | 60 virtual void SetUp() { |
61 engine_.reset(XmppEngine::Create()); | 61 engine_.reset(XmppEngine::Create()); |
62 handler_.reset(new XmppTestHandler(engine_.get())); | 62 handler_.reset(new XmppTestHandler(engine_.get())); |
63 | 63 |
64 Jid jid("david@my-server"); | 64 Jid jid("david@my-server"); |
65 rtc::InsecureCryptStringImpl pass; | 65 std::string pass("david"); |
66 pass.password() = "david"; | |
67 engine_->SetSessionHandler(handler_.get()); | 66 engine_->SetSessionHandler(handler_.get()); |
68 engine_->SetOutputHandler(handler_.get()); | 67 engine_->SetOutputHandler(handler_.get()); |
69 engine_->AddStanzaHandler(handler_.get()); | 68 engine_->AddStanzaHandler(handler_.get()); |
70 engine_->SetUser(jid); | 69 engine_->SetUser(jid); |
71 engine_->SetSaslHandler( | 70 engine_->SetSaslHandler( |
72 new buzz::PlainSaslHandler(jid, rtc::CryptString(pass), true)); | 71 new buzz::PlainSaslHandler(jid, pass, true)); |
73 } | 72 } |
74 virtual void TearDown() { | 73 virtual void TearDown() { |
75 handler_.reset(); | 74 handler_.reset(); |
76 engine_.reset(); | 75 engine_.reset(); |
77 } | 76 } |
78 void RunLogin(); | 77 void RunLogin(); |
79 | 78 |
80 private: | 79 private: |
81 std::unique_ptr<XmppEngine> engine_; | 80 std::unique_ptr<XmppEngine> engine_; |
82 std::unique_ptr<XmppTestHandler> handler_; | 81 std::unique_ptr<XmppTestHandler> handler_; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 input = "<iq type='result' id='3'><query xmlns='jabber:iq:roster'><item>bar" | 316 input = "<iq type='result' id='3'><query xmlns='jabber:iq:roster'><item>bar" |
318 "</item></query></iq>"; | 317 "</item></query></iq>"; |
319 engine()->HandleInput(input.c_str(), input.length()); | 318 engine()->HandleInput(input.c_str(), input.length()); |
320 EXPECT_EQ("<cli:iq type=\"result\" id=\"3\" xmlns:cli=\"jabber:client\">" | 319 EXPECT_EQ("<cli:iq type=\"result\" id=\"3\" xmlns:cli=\"jabber:client\">" |
321 "<query xmlns=\"jabber:iq:roster\"><item>bar</item></query>" | 320 "<query xmlns=\"jabber:iq:roster\"><item>bar</item></query>" |
322 "</cli:iq>", handler()->StanzaActivity()); | 321 "</cli:iq>", handler()->StanzaActivity()); |
323 EXPECT_EQ("", iq_response.IqResponseActivity()); | 322 EXPECT_EQ("", iq_response.IqResponseActivity()); |
324 EXPECT_EQ("", handler()->OutputActivity()); | 323 EXPECT_EQ("", handler()->OutputActivity()); |
325 EXPECT_EQ("", handler()->SessionActivity()); | 324 EXPECT_EQ("", handler()->SessionActivity()); |
326 } | 325 } |
OLD | NEW |