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

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

Issue 2026123002: [Chromoting] Use google:remoting namespace to export remoting specific error codes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve review comments Created 4 years, 6 months 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.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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 ASSERT_TRUE(source_message.get()); 559 ASSERT_TRUE(source_message.get());
560 560
561 EXPECT_FALSE(JingleMessage::IsJingleMessage(source_message.get())); 561 EXPECT_FALSE(JingleMessage::IsJingleMessage(source_message.get()));
562 562
563 JingleMessage message; 563 JingleMessage message;
564 std::string error; 564 std::string error;
565 EXPECT_FALSE(message.ParseXml(source_message.get(), &error)); 565 EXPECT_FALSE(message.ParseXml(source_message.get(), &error));
566 EXPECT_FALSE(error.empty()); 566 EXPECT_FALSE(error.empty());
567 } 567 }
568 568
569 TEST(JingleMessageTest, RemotingErrorCode) {
570 const char* kTestSessionTerminateMessageBegin =
571 "<cli:iq from='user@gmail.com/chromoting016DBB07' "
572 "to='user@gmail.com/chromiumsy5C6A652D' type='set' "
573 "xmlns:cli='jabber:client'><jingle action='session-terminate' "
574 "sid='2227053353' xmlns='urn:xmpp:jingle:1'><reason><decline/></reason>"
575 "<gr:error-code xmlns:gr='google:remoting'>";
576 const char* kTestSessionTerminateMessageEnd =
577 "</gr:error-code>"
578 "</jingle></cli:iq>";
579
580 for (int i = OK; i <= ERROR_CODE_MAX; i++) {
581 ErrorCode error = static_cast<ErrorCode>(i);
582 std::string message_str = kTestSessionTerminateMessageBegin;
583 message_str.append(ErrorCodeToString(error));
584 message_str.append(kTestSessionTerminateMessageEnd);
585 JingleMessage message;
586 if (error == UNKNOWN_ERROR) {
587 // We do not include UNKNOWN_ERROR in xml output, so VerifyXml will fail.
588 ParseJingleMessageFromXml(message_str.c_str(), &message);
589 } else {
590 ParseFormatAndCompare(message_str.c_str(), &message);
591 }
592
593 EXPECT_EQ(message.action, JingleMessage::SESSION_TERMINATE);
594 EXPECT_EQ(message.reason, JingleMessage::DECLINE);
595 EXPECT_EQ(message.error_code, error);
596 }
597 }
598
569 } // namespace protocol 599 } // namespace protocol
570 } // namespace remoting 600 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_messages.cc ('k') | remoting/protocol/jingle_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698