| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/protocol/jingle_messages.h" | 5 #include "remoting/protocol/jingle_messages.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 "<jingle action='session-info' " | 412 "<jingle action='session-info' " |
| 413 "sid='2227053353' xmlns='urn:xmpp:jingle:1' " | 413 "sid='2227053353' xmlns='urn:xmpp:jingle:1' " |
| 414 "from-channel='lcs' " | 414 "from-channel='lcs' " |
| 415 "from-endpoint-id='user@gmail.com/xBrnereror='>" | 415 "from-endpoint-id='user@gmail.com/xBrnereror='>" |
| 416 "<test-info>TestMessage</test-info>" | 416 "<test-info>TestMessage</test-info>" |
| 417 "</jingle>" | 417 "</jingle>" |
| 418 "</cli:iq>"; | 418 "</cli:iq>"; |
| 419 | 419 |
| 420 JingleMessage message; | 420 JingleMessage message; |
| 421 ParseFormatAndCompare(kTestSessionInfoMessage, &message); | 421 ParseFormatAndCompare(kTestSessionInfoMessage, &message); |
| 422 EXPECT_EQ(message.from.jid, "remoting@bot.talk.google.com"); | 422 EXPECT_EQ(message.from.jid(), "remoting@bot.talk.google.com"); |
| 423 EXPECT_EQ(message.from.channel, SignalingAddress::Channel::LCS); | 423 EXPECT_EQ(message.from.channel(), SignalingAddress::Channel::LCS); |
| 424 EXPECT_EQ(message.from.endpoint_id, "user@gmail.com/xBrnereror="); | 424 EXPECT_EQ(message.from.endpoint_id(), "user@gmail.com/xBrnereror="); |
| 425 EXPECT_EQ(message.from.id(), "user@gmail.com/xBrnereror="); | 425 EXPECT_EQ(message.from.id(), "user@gmail.com/xBrnereror="); |
| 426 | 426 |
| 427 EXPECT_EQ(message.to.jid, "user@gmail.com/chromiumsy5C6A652D"); | 427 EXPECT_EQ(message.to.jid(), "user@gmail.com/chromiumsy5C6A652D"); |
| 428 EXPECT_EQ(message.to.channel, SignalingAddress::Channel::XMPP); | 428 EXPECT_EQ(message.to.channel(), SignalingAddress::Channel::XMPP); |
| 429 EXPECT_EQ(message.to.endpoint_id, ""); | 429 EXPECT_EQ(message.to.endpoint_id(), ""); |
| 430 EXPECT_EQ(message.to.id(), "user@gmail.com/chromiumsy5C6A652D"); | 430 EXPECT_EQ(message.to.id(), "user@gmail.com/chromiumsy5C6A652D"); |
| 431 | 431 |
| 432 EXPECT_EQ(message.action, JingleMessage::SESSION_INFO); | 432 EXPECT_EQ(message.action, JingleMessage::SESSION_INFO); |
| 433 } | 433 } |
| 434 | 434 |
| 435 | 435 |
| 436 TEST(JingleMessageTest, IgnoreInvalidAddress) { | 436 TEST(JingleMessageTest, IgnoreInvalidAddress) { |
| 437 const char* kInvalidFromField = | 437 const char* kInvalidFromField = |
| 438 "<cli:iq from='evil@gmail.com' " | 438 "<cli:iq from='evil@gmail.com' " |
| 439 "to='victim@gmail.com/chromiumsy5C6A652D' type='set' " | 439 "to='victim@gmail.com/chromiumsy5C6A652D' type='set' " |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 expected.AddElement(new XmlElement(QName("google:remoting", "sometag"))); | 684 expected.AddElement(new XmlElement(QName("google:remoting", "sometag"))); |
| 685 expected.FirstElement()->SetBodyText("some-message"); | 685 expected.FirstElement()->SetBodyText("some-message"); |
| 686 std::string error; | 686 std::string error; |
| 687 EXPECT_TRUE(VerifyXml(&expected, message.attachments.get(), &error)) | 687 EXPECT_TRUE(VerifyXml(&expected, message.attachments.get(), &error)) |
| 688 << error; | 688 << error; |
| 689 } | 689 } |
| 690 } | 690 } |
| 691 | 691 |
| 692 } // namespace protocol | 692 } // namespace protocol |
| 693 } // namespace remoting | 693 } // namespace remoting |
| OLD | NEW |