OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/ref_counted.h" |
| 6 #include "base/string_util.h" |
| 7 #include "media/base/data_buffer.h" |
| 8 #include "remoting/jingle_glue/iq_request.h" |
| 9 #include "talk/xmllite/xmlelement.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 |
| 13 namespace remoting { |
| 14 |
| 15 TEST(IqRequestTest, MakeIqStanza) { |
| 16 const char* kMessageId = "0"; |
| 17 const char* kNamespace = "chromium:testns"; |
| 18 const char* kNamespacePrefix = "tes"; |
| 19 const char* kBodyTag = "test"; |
| 20 const char* kType = "get"; |
| 21 const char* kTo = "user@domain.com"; |
| 22 |
| 23 std::string expected_xml_string = |
| 24 StringPrintf( |
| 25 "<cli:iq type=\"%s\" to=\"%s\" id=\"%s\" " |
| 26 "xmlns:cli=\"jabber:client\">" |
| 27 "<%s:%s xmlns:%s=\"%s\"/>" |
| 28 "</cli:iq>", |
| 29 kType, kTo, kMessageId, kNamespacePrefix, kBodyTag, |
| 30 kNamespacePrefix, kNamespace); |
| 31 |
| 32 buzz::XmlElement* iq_body = |
| 33 new buzz::XmlElement(buzz::QName(kNamespace, kBodyTag)); |
| 34 scoped_ptr<buzz::XmlElement> stanza( |
| 35 IqRequest::MakeIqStanza(kType, kTo, iq_body, kMessageId)); |
| 36 |
| 37 EXPECT_EQ(expected_xml_string, stanza->Str()); |
| 38 } |
| 39 |
| 40 } // namespace remoting |
OLD | NEW |