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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "third_party/libjingle/source/talk/xmpp/constants.h" | 10 #include "third_party/libjingle/source/talk/xmpp/constants.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 "action='session-terminate' sid='2227053353' xmlns='urn:xmpp:jingle:1'>" | 307 "action='session-terminate' sid='2227053353' xmlns='urn:xmpp:jingle:1'>" |
308 "<reason><success/></reason></jingle><error type='modify'>" | 308 "<reason><success/></reason></jingle><error type='modify'>" |
309 "<item-not-found/><text xml:lang='en'>ErrorText</text></error></iq>" }, | 309 "<item-not-found/><text xml:lang='en'>ErrorText</text></error></iq>" }, |
310 { JingleMessageReply::UNEXPECTED_REQUEST, "", "<iq xmlns='jabber:client' " | 310 { JingleMessageReply::UNEXPECTED_REQUEST, "", "<iq xmlns='jabber:client' " |
311 "to='user@gmail.com/chromoting016DBB07' id='4' type='error'><jingle " | 311 "to='user@gmail.com/chromoting016DBB07' id='4' type='error'><jingle " |
312 "action='session-terminate' sid='2227053353' xmlns='urn:xmpp:jingle:1'>" | 312 "action='session-terminate' sid='2227053353' xmlns='urn:xmpp:jingle:1'>" |
313 "<reason><success/></reason></jingle><error type='modify'>" | 313 "<reason><success/></reason></jingle><error type='modify'>" |
314 "<unexpected-request/></error></iq>" }, | 314 "<unexpected-request/></error></iq>" }, |
315 }; | 315 }; |
316 | 316 |
317 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 317 for (size_t i = 0; i < arraysize(tests); ++i) { |
318 JingleMessageReply reply_msg; | 318 JingleMessageReply reply_msg; |
319 if (tests[i].error_text.empty()) { | 319 if (tests[i].error_text.empty()) { |
320 reply_msg = JingleMessageReply(tests[i].error); | 320 reply_msg = JingleMessageReply(tests[i].error); |
321 } else { | 321 } else { |
322 reply_msg = JingleMessageReply(tests[i].error, tests[i].error_text); | 322 reply_msg = JingleMessageReply(tests[i].error, tests[i].error_text); |
323 } | 323 } |
324 scoped_ptr<XmlElement> reply(reply_msg.ToXml(incoming_message.get())); | 324 scoped_ptr<XmlElement> reply(reply_msg.ToXml(incoming_message.get())); |
325 | 325 |
326 scoped_ptr<XmlElement> expected(XmlElement::ForStr(tests[i].expected_text)); | 326 scoped_ptr<XmlElement> expected(XmlElement::ForStr(tests[i].expected_text)); |
327 ASSERT_TRUE(expected.get()); | 327 ASSERT_TRUE(expected.get()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 EXPECT_FALSE(JingleMessage::IsJingleMessage(source_message.get())); | 365 EXPECT_FALSE(JingleMessage::IsJingleMessage(source_message.get())); |
366 | 366 |
367 JingleMessage message; | 367 JingleMessage message; |
368 std::string error; | 368 std::string error; |
369 EXPECT_FALSE(message.ParseXml(source_message.get(), &error)); | 369 EXPECT_FALSE(message.ParseXml(source_message.get(), &error)); |
370 EXPECT_FALSE(error.empty()); | 370 EXPECT_FALSE(error.empty()); |
371 } | 371 } |
372 | 372 |
373 } // namespace protocol | 373 } // namespace protocol |
374 } // namespace remoting | 374 } // namespace remoting |
OLD | NEW |