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

Side by Side Diff: third_party/libjingle_xmpp/xmllite/xmlprinter_unittest.cc

Issue 2443903004: Add xmllite and xmpp sources to third_party/ (Closed)
Patch Set: Explicitly use webrtc_overrides/webrtc/base/logging.h Created 3 years, 11 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 | « third_party/libjingle_xmpp/xmllite/xmlprinter.cc ('k') | third_party/libjingle_xmpp/xmpp/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "third_party/libjingle_xmpp/xmllite/xmlprinter.h"
12
13 #include <sstream>
14 #include <string>
15
16 #include "third_party/libjingle_xmpp/xmllite/qname.h"
17 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
18 #include "third_party/libjingle_xmpp/xmllite/xmlnsstack.h"
19 #include "third_party/webrtc/base/common.h"
20 #include "third_party/webrtc/base/gunit.h"
21
22 using buzz::QName;
23 using buzz::XmlElement;
24 using buzz::XmlnsStack;
25 using buzz::XmlPrinter;
26
27 TEST(XmlPrinterTest, TestBasicPrinting) {
28 XmlElement elt(QName("google:test", "first"));
29 std::stringstream ss;
30 XmlPrinter::PrintXml(&ss, &elt);
31 EXPECT_EQ("<test:first xmlns:test=\"google:test\"/>", ss.str());
32 }
33
34 TEST(XmlPrinterTest, TestNamespacedPrinting) {
35 XmlElement elt(QName("google:test", "first"));
36 elt.AddElement(new XmlElement(QName("nested:test", "second")));
37 std::stringstream ss;
38
39 XmlnsStack ns_stack;
40 ns_stack.AddXmlns("gg", "google:test");
41 ns_stack.AddXmlns("", "nested:test");
42
43 XmlPrinter::PrintXml(&ss, &elt, &ns_stack);
44 EXPECT_EQ("<gg:first><second/></gg:first>", ss.str());
45 }
OLDNEW
« no previous file with comments | « third_party/libjingle_xmpp/xmllite/xmlprinter.cc ('k') | third_party/libjingle_xmpp/xmpp/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698