Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Side by Side Diff: remoting/protocol/jingle_messages_unittest.cc

Issue 2591953002: Update SignalingAddress to normalize all JIDs. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/protocol/jingle_messages.cc ('k') | remoting/protocol/jingle_session_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 "<jingle action='session-info' " 411 "<jingle action='session-info' "
412 "sid='2227053353' xmlns='urn:xmpp:jingle:1' " 412 "sid='2227053353' xmlns='urn:xmpp:jingle:1' "
413 "from-channel='lcs' " 413 "from-channel='lcs' "
414 "from-endpoint-id='user@gmail.com/xBrnereror='>" 414 "from-endpoint-id='user@gmail.com/xBrnereror='>"
415 "<test-info>TestMessage</test-info>" 415 "<test-info>TestMessage</test-info>"
416 "</jingle>" 416 "</jingle>"
417 "</cli:iq>"; 417 "</cli:iq>";
418 418
419 JingleMessage message; 419 JingleMessage message;
420 ParseFormatAndCompare(kTestSessionInfoMessage, &message); 420 ParseFormatAndCompare(kTestSessionInfoMessage, &message);
421 EXPECT_EQ(message.from.jid, "remoting@bot.talk.google.com"); 421 EXPECT_EQ(message.from.jid(), "remoting@bot.talk.google.com");
422 EXPECT_EQ(message.from.channel, SignalingAddress::Channel::LCS); 422 EXPECT_EQ(message.from.channel(), SignalingAddress::Channel::LCS);
423 EXPECT_EQ(message.from.endpoint_id, "user@gmail.com/xBrnereror="); 423 EXPECT_EQ(message.from.endpoint_id(), "user@gmail.com/xBrnereror=");
424 EXPECT_EQ(message.from.id(), "user@gmail.com/xBrnereror="); 424 EXPECT_EQ(message.from.id(), "user@gmail.com/xBrnereror=");
425 425
426 EXPECT_EQ(message.to.jid, "user@gmail.com/chromiumsy5C6A652D"); 426 EXPECT_EQ(message.to.jid(), "user@gmail.com/chromiumsy5C6A652D");
427 EXPECT_EQ(message.to.channel, SignalingAddress::Channel::XMPP); 427 EXPECT_EQ(message.to.channel(), SignalingAddress::Channel::XMPP);
428 EXPECT_EQ(message.to.endpoint_id, ""); 428 EXPECT_EQ(message.to.endpoint_id(), "");
429 EXPECT_EQ(message.to.id(), "user@gmail.com/chromiumsy5C6A652D"); 429 EXPECT_EQ(message.to.id(), "user@gmail.com/chromiumsy5C6A652D");
430 430
431 EXPECT_EQ(message.action, JingleMessage::SESSION_INFO); 431 EXPECT_EQ(message.action, JingleMessage::SESSION_INFO);
432 } 432 }
433 433
434 434
435 TEST(JingleMessageTest, IgnoreInvalidAddress) { 435 TEST(JingleMessageTest, IgnoreInvalidAddress) {
436 const char* kInvalidFromField = 436 const char* kInvalidFromField =
437 "<cli:iq from='evil@gmail.com' " 437 "<cli:iq from='evil@gmail.com' "
438 "to='victim@gmail.com/chromiumsy5C6A652D' type='set' " 438 "to='victim@gmail.com/chromiumsy5C6A652D' type='set' "
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 } 618 }
619 619
620 EXPECT_EQ(message.action, JingleMessage::SESSION_TERMINATE); 620 EXPECT_EQ(message.action, JingleMessage::SESSION_TERMINATE);
621 EXPECT_EQ(message.reason, JingleMessage::DECLINE); 621 EXPECT_EQ(message.reason, JingleMessage::DECLINE);
622 EXPECT_EQ(message.error_code, error); 622 EXPECT_EQ(message.error_code, error);
623 } 623 }
624 } 624 }
625 625
626 } // namespace protocol 626 } // namespace protocol
627 } // namespace remoting 627 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_messages.cc ('k') | remoting/protocol/jingle_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698