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

Unified Diff: base/json/json_parser_unittest.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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 | « base/json/json_parser.cc ('k') | base/json/json_reader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_parser_unittest.cc
diff --git a/base/json/json_parser_unittest.cc b/base/json/json_parser_unittest.cc
index da86b332ea2afd846ea8f6960a8ac082802040d1..30255ca46126dd89ad0e8471f67eaa4d26bcf39a 100644
--- a/base/json/json_parser_unittest.cc
+++ b/base/json/json_parser_unittest.cc
@@ -6,8 +6,9 @@
#include <stddef.h>
+#include <memory>
+
#include "base/json/json_reader.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -34,7 +35,7 @@ class JSONParserTest : public testing::Test {
TEST_F(JSONParserTest, NextChar) {
std::string input("Hello world");
- scoped_ptr<JSONParser> parser(NewTestParser(input));
+ std::unique_ptr<JSONParser> parser(NewTestParser(input));
EXPECT_EQ('H', *parser->pos_);
for (size_t i = 1; i < input.length(); ++i) {
@@ -45,8 +46,8 @@ TEST_F(JSONParserTest, NextChar) {
TEST_F(JSONParserTest, ConsumeString) {
std::string input("\"test\",|");
- scoped_ptr<JSONParser> parser(NewTestParser(input));
- scoped_ptr<Value> value(parser->ConsumeString());
+ std::unique_ptr<JSONParser> parser(NewTestParser(input));
+ std::unique_ptr<Value> value(parser->ConsumeString());
EXPECT_EQ('"', *parser->pos_);
TestLastThree(parser.get());
@@ -59,8 +60,8 @@ TEST_F(JSONParserTest, ConsumeString) {
TEST_F(JSONParserTest, ConsumeList) {
std::string input("[true, false],|");
- scoped_ptr<JSONParser> parser(NewTestParser(input));
- scoped_ptr<Value> value(parser->ConsumeList());
+ std::unique_ptr<JSONParser> parser(NewTestParser(input));
+ std::unique_ptr<Value> value(parser->ConsumeList());
EXPECT_EQ(']', *parser->pos_);
TestLastThree(parser.get());
@@ -73,8 +74,8 @@ TEST_F(JSONParserTest, ConsumeList) {
TEST_F(JSONParserTest, ConsumeDictionary) {
std::string input("{\"abc\":\"def\"},|");
- scoped_ptr<JSONParser> parser(NewTestParser(input));
- scoped_ptr<Value> value(parser->ConsumeDictionary());
+ std::unique_ptr<JSONParser> parser(NewTestParser(input));
+ std::unique_ptr<Value> value(parser->ConsumeDictionary());
EXPECT_EQ('}', *parser->pos_);
TestLastThree(parser.get());
@@ -90,8 +91,8 @@ TEST_F(JSONParserTest, ConsumeDictionary) {
TEST_F(JSONParserTest, ConsumeLiterals) {
// Literal |true|.
std::string input("true,|");
- scoped_ptr<JSONParser> parser(NewTestParser(input));
- scoped_ptr<Value> value(parser->ConsumeLiteral());
+ std::unique_ptr<JSONParser> parser(NewTestParser(input));
+ std::unique_ptr<Value> value(parser->ConsumeLiteral());
EXPECT_EQ('e', *parser->pos_);
TestLastThree(parser.get());
@@ -128,8 +129,8 @@ TEST_F(JSONParserTest, ConsumeLiterals) {
TEST_F(JSONParserTest, ConsumeNumbers) {
// Integer.
std::string input("1234,|");
- scoped_ptr<JSONParser> parser(NewTestParser(input));
- scoped_ptr<Value> value(parser->ConsumeNumber());
+ std::unique_ptr<JSONParser> parser(NewTestParser(input));
+ std::unique_ptr<Value> value(parser->ConsumeNumber());
EXPECT_EQ('4', *parser->pos_);
TestLastThree(parser.get());
@@ -205,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;
- scoped_ptr<Value> root = JSONReader::ReadAndReturnError(
+ std::unique_ptr<Value> root = JSONReader::ReadAndReturnError(
"[42]", JSON_PARSE_RFC, &error_code, &error_message);
EXPECT_TRUE(error_message.empty());
EXPECT_EQ(0, error_code);
@@ -309,7 +310,7 @@ TEST_F(JSONParserTest, Decode4ByteUtf8Char) {
"[\"😇\",[],[],[],{\"google:suggesttype\":[]}]";
std::string error_message;
int error_code = 0;
- scoped_ptr<Value> root = JSONReader::ReadAndReturnError(
+ std::unique_ptr<Value> root = JSONReader::ReadAndReturnError(
kUtf8Data, JSON_PARSE_RFC, &error_code, &error_message);
EXPECT_TRUE(root.get()) << error_message;
}
« no previous file with comments | « base/json/json_parser.cc ('k') | base/json/json_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698