| Index: third_party/xmllite/xmlprinter_unittest.cc
|
| diff --git a/third_party/xmllite/xmlprinter_unittest.cc b/third_party/xmllite/xmlprinter_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6767b2a5baf26becb6b9cab916d220146212ee3e
|
| --- /dev/null
|
| +++ b/third_party/xmllite/xmlprinter_unittest.cc
|
| @@ -0,0 +1,39 @@
|
| +// Copyright 2004 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "third_party/xmllite/xmlprinter.h"
|
| +
|
| +#include <sstream>
|
| +#include <string>
|
| +
|
| +#include "third_party/xmllite/qname.h"
|
| +#include "third_party/xmllite/xmlelement.h"
|
| +#include "third_party/xmllite/xmlnsstack.h"
|
| +#include "webrtc/base/common.h"
|
| +#include "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());
|
| +}
|
|
|