diff options
Diffstat (limited to 'third_party/chromium/base/json/json_parser_unittest.cc')
-rw-r--r-- | third_party/chromium/base/json/json_parser_unittest.cc | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/third_party/chromium/base/json/json_parser_unittest.cc b/third_party/chromium/base/json/json_parser_unittest.cc index a6c360d..956e277 100644 --- a/third_party/chromium/base/json/json_parser_unittest.cc +++ b/third_party/chromium/base/json/json_parser_unittest.cc @@ -6,11 +6,10 @@ #include <stddef.h> -#include <memory> - #include <gtest/gtest.h> #include "base/json/json_reader.h" +#include "base/memory/scoped_ptr.h" #include "base/values.h" namespace base { @@ -36,7 +35,7 @@ class JSONParserTest : public testing::Test { TEST_F(JSONParserTest, NextChar) { std::string input("Hello world"); - std::unique_ptr<JSONParser> parser(NewTestParser(input)); + scoped_ptr<JSONParser> parser(NewTestParser(input)); EXPECT_EQ('H', *parser->pos_); for (size_t i = 1; i < input.length(); ++i) { @@ -47,8 +46,8 @@ TEST_F(JSONParserTest, NextChar) { TEST_F(JSONParserTest, ConsumeString) { std::string input("\"test\",|"); - std::unique_ptr<JSONParser> parser(NewTestParser(input)); - std::unique_ptr<Value> value(parser->ConsumeString()); + scoped_ptr<JSONParser> parser(NewTestParser(input)); + scoped_ptr<Value> value(parser->ConsumeString()); EXPECT_EQ('"', *parser->pos_); TestLastThree(parser.get()); @@ -61,8 +60,8 @@ TEST_F(JSONParserTest, ConsumeString) { TEST_F(JSONParserTest, ConsumeList) { std::string input("[true, false],|"); - std::unique_ptr<JSONParser> parser(NewTestParser(input)); - std::unique_ptr<Value> value(parser->ConsumeList()); + scoped_ptr<JSONParser> parser(NewTestParser(input)); + scoped_ptr<Value> value(parser->ConsumeList()); EXPECT_EQ(']', *parser->pos_); TestLastThree(parser.get()); @@ -75,8 +74,8 @@ TEST_F(JSONParserTest, ConsumeList) { TEST_F(JSONParserTest, ConsumeDictionary) { std::string input("{\"abc\":\"def\"},|"); - std::unique_ptr<JSONParser> parser(NewTestParser(input)); - std::unique_ptr<Value> value(parser->ConsumeDictionary()); + scoped_ptr<JSONParser> parser(NewTestParser(input)); + scoped_ptr<Value> value(parser->ConsumeDictionary()); EXPECT_EQ('}', *parser->pos_); TestLastThree(parser.get()); @@ -92,8 +91,8 @@ TEST_F(JSONParserTest, ConsumeDictionary) { TEST_F(JSONParserTest, ConsumeLiterals) { // Literal |true|. std::string input("true,|"); - std::unique_ptr<JSONParser> parser(NewTestParser(input)); - std::unique_ptr<Value> value(parser->ConsumeLiteral()); + scoped_ptr<JSONParser> parser(NewTestParser(input)); + scoped_ptr<Value> value(parser->ConsumeLiteral()); EXPECT_EQ('e', *parser->pos_); TestLastThree(parser.get()); @@ -130,8 +129,8 @@ TEST_F(JSONParserTest, ConsumeLiterals) { TEST_F(JSONParserTest, ConsumeNumbers) { // Integer. std::string input("1234,|"); - std::unique_ptr<JSONParser> parser(NewTestParser(input)); - std::unique_ptr<Value> value(parser->ConsumeNumber()); + scoped_ptr<JSONParser> parser(NewTestParser(input)); + scoped_ptr<Value> value(parser->ConsumeNumber()); EXPECT_EQ('4', *parser->pos_); TestLastThree(parser.get()); @@ -207,7 +206,7 @@ TEST_F(JSONParserTest, ErrorMessages) { // Error strings should not be modified in case of success. std::string error_message; int error_code = 0; - std::unique_ptr<Value> root = JSONReader::ReadAndReturnError( + scoped_ptr<Value> root = JSONReader::ReadAndReturnError( "[42]", JSON_PARSE_RFC, &error_code, &error_message); EXPECT_TRUE(error_message.empty()); EXPECT_EQ(0, error_code); @@ -311,7 +310,7 @@ TEST_F(JSONParserTest, Decode4ByteUtf8Char) { "[\"😇\",[],[],[],{\"google:suggesttype\":[]}]"; std::string error_message; int error_code = 0; - std::unique_ptr<Value> root = JSONReader::ReadAndReturnError( + scoped_ptr<Value> root = JSONReader::ReadAndReturnError( kUtf8Data, JSON_PARSE_RFC, &error_code, &error_message); EXPECT_TRUE(root.get()) << error_message; } |