autofill_xml_parser_unittest.cc revision c407dc5cd9bdc5668497f21b26b09d988ab439de
180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Copyright (c) 2010 The Chromium Authors. All rights reserved. 280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Use of this source code is governed by a BSD-style license that can be 380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// found in the LICENSE file. 480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include <string> 680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include <vector> 7910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger 880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "chrome/browser/autofill/autofill_xml_parser.h" 9910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger#include "chrome/browser/autofill/field_types.h" 1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "testing/gtest/include/gtest/gtest.h" 1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "third_party/libjingle/source/talk/xmllite/xmlparser.h" 1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querunamespace { 1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruTEST(AutoFillQueryXmlParserTest, BasicQuery) { 1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // An XML string representing a basic query response. 1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru std::string xml = "<autofillqueryresponse>" 18910f694aefb0b671dd8522a9afe9b6be645701c1Derek Sollenberger "<field autofilltype=\"0\" />" 1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "<field autofilltype=\"1\" />" 2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "<field autofilltype=\"3\" />" 2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "<field autofilltype=\"2\" />" 2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "</autofillqueryresponse>"; 2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // Create a vector of AutoFillFieldTypes, to assign the parsed field types to. 2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru std::vector<AutoFillFieldType> field_types; 2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru UploadRequired upload_required = USE_UPLOAD_RATES; 2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // Create a parser. 2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AutoFillQueryXmlParser parse_handler(&field_types, &upload_required); 3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru buzz::XmlParser parser(&parse_handler); 3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser.Parse(xml.c_str(), xml.length(), true); 3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_TRUE(parse_handler.succeeded()); 3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(upload_required, USE_UPLOAD_RATES); 3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ASSERT_EQ(4U, field_types.size()); 3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(NO_SERVER_DATA, field_types[0]); 3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(UNKNOWN_TYPE, field_types[1]); 3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(NAME_FIRST, field_types[2]); 3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(EMPTY_TYPE, field_types[3]); 3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Test parsing the upload required attribute. 4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruTEST(AutoFillQueryXmlParserTest, TestUploadRequired) { 4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru std::vector<AutoFillFieldType> field_types; 4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru UploadRequired upload_required = USE_UPLOAD_RATES; 4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru std::string xml = "<autofillqueryresponse uploadrequired=\"true\">" 4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "<field autofilltype=\"0\" />" 4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "</autofillqueryresponse>"; 4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru scoped_ptr<AutoFillQueryXmlParser> parse_handler( 5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru new AutoFillQueryXmlParser(&field_types, &upload_required)); 5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru scoped_ptr<buzz::XmlParser> parser(new buzz::XmlParser(parse_handler.get())); 5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser->Parse(xml.c_str(), xml.length(), true); 5480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_TRUE(parse_handler->succeeded()); 5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(UPLOAD_REQUIRED, upload_required); 5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ASSERT_EQ(1U, field_types.size()); 5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(NO_SERVER_DATA, field_types[0]); 5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 59096defe64d408e54474fe19f418c95bf1a554fc7Derek Sollenberger field_types.clear(); 6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru xml = "<autofillqueryresponse uploadrequired=\"false\">" 6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "<field autofilltype=\"0\" />" 6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "</autofillqueryresponse>"; 6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parse_handler.reset( 6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru new AutoFillQueryXmlParser(&field_types, &upload_required)); 6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser.reset(new buzz::XmlParser(parse_handler.get())); 6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser->Parse(xml.c_str(), xml.length(), true); 6880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_TRUE(parse_handler->succeeded()); 6980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(upload_required, UPLOAD_NOT_REQUIRED); 7080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ASSERT_EQ(1U, field_types.size()); 7180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(NO_SERVER_DATA, field_types[0]); 7280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 7380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru field_types.clear(); 7480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru xml = "<autofillqueryresponse uploadrequired=\"bad_value\">" 7580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "<field autofilltype=\"0\" />" 7680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "</autofillqueryresponse>"; 7780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 7880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parse_handler.reset( 7980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru new AutoFillQueryXmlParser(&field_types, &upload_required)); 8080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser.reset(new buzz::XmlParser(parse_handler.get())); 8180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser->Parse(xml.c_str(), xml.length(), true); 8280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_TRUE(parse_handler->succeeded()); 8380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(upload_required, USE_UPLOAD_RATES); 8480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ASSERT_EQ(1U, field_types.size()); 8580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(NO_SERVER_DATA, field_types[0]); 8680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 8780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 8880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Test badly formed XML queries. 8980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruTEST(AutoFillQueryXmlParserTest, ParseErrors) { 9080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru std::vector<AutoFillFieldType> field_types; 9180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru UploadRequired upload_required = USE_UPLOAD_RATES; 9280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 9380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // Test no AutoFill type. 9480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru std::string xml = "<autofillqueryresponse>" 9580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "<field/>" 9680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "</autofillqueryresponse>"; 9780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 9880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru scoped_ptr<AutoFillQueryXmlParser> parse_handler( 9980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru new AutoFillQueryXmlParser(&field_types, &upload_required)); 10080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru scoped_ptr<buzz::XmlParser> parser(new buzz::XmlParser(parse_handler.get())); 10180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser->Parse(xml.c_str(), xml.length(), true); 10280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_FALSE(parse_handler->succeeded()); 10380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(upload_required, USE_UPLOAD_RATES); 10480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ASSERT_EQ(0U, field_types.size()); 10580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 10680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // Test an incorrect AutoFill type. 10780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru xml = "<autofillqueryresponse>" 10880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "<field autofilltype=\"307\"/>" 10980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "</autofillqueryresponse>"; 11080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 11180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parse_handler.reset( 11280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru new AutoFillQueryXmlParser(&field_types, &upload_required)); 11380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser.reset(new buzz::XmlParser(parse_handler.get())); 11480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser->Parse(xml.c_str(), xml.length(), true); 11580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_TRUE(parse_handler->succeeded()); 11680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(upload_required, USE_UPLOAD_RATES); 11780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ASSERT_EQ(1U, field_types.size()); 11880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // AutoFillType was out of range and should be set to NO_SERVER_DATA. 11980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(NO_SERVER_DATA, field_types[0]); 12080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 12180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // Test an incorrect AutoFill type. 12280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru field_types.clear(); 12380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru xml = "<autofillqueryresponse>" 12480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "<field autofilltype=\"No Type\"/>" 12580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "</autofillqueryresponse>"; 12680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 12780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // Parse fails but an entry is still added to field_types. 12880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parse_handler.reset( 12980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru new AutoFillQueryXmlParser(&field_types, &upload_required)); 13080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser.reset(new buzz::XmlParser(parse_handler.get())); 13180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser->Parse(xml.c_str(), xml.length(), true); 13280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_FALSE(parse_handler->succeeded()); 13380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(upload_required, USE_UPLOAD_RATES); 13480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ASSERT_EQ(1U, field_types.size()); 13580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_EQ(NO_SERVER_DATA, field_types[0]); 13680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 13780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 13880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Test successfull upload response. 13980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruTEST(AutoFillUploadXmlParser, TestSuccessfulResponse) { 14080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru std::string xml = "<autofilluploadresponse positiveuploadrate=\"0.5\" " 14180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "negativeuploadrate=\"0.3\"/>"; 14280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru double positive = 0; 14380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru double negative = 0; 14480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AutoFillUploadXmlParser parse_handler(&positive, &negative); 14580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru buzz::XmlParser parser(&parse_handler); 14680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser.Parse(xml.c_str(), xml.length(), true); 14780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_TRUE(parse_handler.succeeded()); 14880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_DOUBLE_EQ(0.5, positive); 14980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_DOUBLE_EQ(0.3, negative); 15080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 15180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 15280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Test failed upload response. 15380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruTEST(AutoFillUploadXmlParser, TestFailedResponse) { 15480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru std::string xml = "<autofilluploadresponse positiveuploadrate=\"\" " 15580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "negativeuploadrate=\"0.3\"/>"; 15680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru double positive = 0; 15780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru double negative = 0; 15880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru scoped_ptr<AutoFillUploadXmlParser> parse_handler( 15980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru new AutoFillUploadXmlParser(&positive, &negative)); 16080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru scoped_ptr<buzz::XmlParser> parser(new buzz::XmlParser(parse_handler.get())); 16180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser->Parse(xml.c_str(), xml.length(), true); 16280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_TRUE(!parse_handler->succeeded()); 16380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_DOUBLE_EQ(0, positive); 16480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_DOUBLE_EQ(0.3, negative); // Partially parsed. 16580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru negative = 0; 16680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 16780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru xml = "<autofilluploadresponse positiveuploadrate=\"0.5\" " 16880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "negativeuploadrate=\"0.3\""; 16980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parse_handler.reset(new AutoFillUploadXmlParser(&positive, &negative)); 17080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser.reset(new buzz::XmlParser(parse_handler.get())); 17180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser->Parse(xml.c_str(), xml.length(), true); 17280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_TRUE(!parse_handler->succeeded()); 17380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_DOUBLE_EQ(0, positive); 17480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_DOUBLE_EQ(0, negative); 17580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 17680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru xml = "bad data"; 17780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parse_handler.reset(new AutoFillUploadXmlParser(&positive, &negative)); 17880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser.reset(new buzz::XmlParser(parse_handler.get())); 17980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser->Parse(xml.c_str(), xml.length(), true); 18080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_TRUE(!parse_handler->succeeded()); 18180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_DOUBLE_EQ(0, positive); 18280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_DOUBLE_EQ(0, negative); 18380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 18480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru xml = ""; 18580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parse_handler.reset(new AutoFillUploadXmlParser(&positive, &negative)); 18680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser.reset(new buzz::XmlParser(parse_handler.get())); 18780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru parser->Parse(xml.c_str(), xml.length(), true); 18880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_TRUE(!parse_handler->succeeded()); 18980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_DOUBLE_EQ(0, positive); 19080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru EXPECT_DOUBLE_EQ(0, negative); 19180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 19280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 19380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} // namespace 19480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru