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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/jingle_messages.cc ('k') | remoting/protocol/jingle_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/jingle_messages_unittest.cc
diff --git a/remoting/protocol/jingle_messages_unittest.cc b/remoting/protocol/jingle_messages_unittest.cc
index 50fb2f6b55ec0db5f8c8816c77cd0a4dc34ab787..4225e65b77f4aa4f67186cc9cca68e02c6d5e892 100644
--- a/remoting/protocol/jingle_messages_unittest.cc
+++ b/remoting/protocol/jingle_messages_unittest.cc
@@ -566,5 +566,35 @@ TEST(JingleMessageTest, ErrorMessage) {
EXPECT_FALSE(error.empty());
}
+TEST(JingleMessageTest, RemotingErrorCode) {
+ const char* kTestSessionTerminateMessageBegin =
+ "<cli:iq from='user@gmail.com/chromoting016DBB07' "
+ "to='user@gmail.com/chromiumsy5C6A652D' type='set' "
+ "xmlns:cli='jabber:client'><jingle action='session-terminate' "
+ "sid='2227053353' xmlns='urn:xmpp:jingle:1'><reason><decline/></reason>"
+ "<gr:error-code xmlns:gr='google:remoting'>";
+ const char* kTestSessionTerminateMessageEnd =
+ "</gr:error-code>"
+ "</jingle></cli:iq>";
+
+ for (int i = OK; i <= ERROR_CODE_MAX; i++) {
+ ErrorCode error = static_cast<ErrorCode>(i);
+ std::string message_str = kTestSessionTerminateMessageBegin;
+ message_str.append(ErrorCodeToString(error));
+ message_str.append(kTestSessionTerminateMessageEnd);
+ JingleMessage message;
+ if (error == UNKNOWN_ERROR) {
+ // We do not include UNKNOWN_ERROR in xml output, so VerifyXml will fail.
+ ParseJingleMessageFromXml(message_str.c_str(), &message);
+ } else {
+ ParseFormatAndCompare(message_str.c_str(), &message);
+ }
+
+ EXPECT_EQ(message.action, JingleMessage::SESSION_TERMINATE);
+ EXPECT_EQ(message.reason, JingleMessage::DECLINE);
+ EXPECT_EQ(message.error_code, error);
+ }
+}
+
} // namespace protocol
} // namespace remoting
« 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