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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libjingle_xmpp/xmllite/xmlprinter_unittest.cc
diff --git a/third_party/libjingle_xmpp/xmllite/xmlprinter_unittest.cc b/third_party/libjingle_xmpp/xmllite/xmlprinter_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f40491d04b2ebacfc8dd9902839565afa5cda3a1
--- /dev/null
+++ b/third_party/libjingle_xmpp/xmllite/xmlprinter_unittest.cc
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2004 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "third_party/libjingle_xmpp/xmllite/xmlprinter.h"
+
+#include <sstream>
+#include <string>
+
+#include "third_party/libjingle_xmpp/xmllite/qname.h"
+#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
+#include "third_party/libjingle_xmpp/xmllite/xmlnsstack.h"
+#include "third_party/webrtc/base/common.h"
+#include "third_party/webrtc/base/gunit.h"
+
+using buzz::QName;
+using buzz::XmlElement;
+using buzz::XmlnsStack;
+using buzz::XmlPrinter;
+
+TEST(XmlPrinterTest, TestBasicPrinting) {
+ XmlElement elt(QName("google:test", "first"));
+ std::stringstream ss;
+ XmlPrinter::PrintXml(&ss, &elt);
+ EXPECT_EQ("<test:first xmlns:test=\"google:test\"/>", ss.str());
+}
+
+TEST(XmlPrinterTest, TestNamespacedPrinting) {
+ XmlElement elt(QName("google:test", "first"));
+ elt.AddElement(new XmlElement(QName("nested:test", "second")));
+ std::stringstream ss;
+
+ XmlnsStack ns_stack;
+ ns_stack.AddXmlns("gg", "google:test");
+ ns_stack.AddXmlns("", "nested:test");
+
+ XmlPrinter::PrintXml(&ss, &elt, &ns_stack);
+ EXPECT_EQ("<gg:first><second/></gg:first>", ss.str());
+}
« 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