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

Unified Diff: base/json/json_writer_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_value_serializer_unittest.cc ('k') | base/linux_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_writer_unittest.cc
diff --git a/base/json/json_writer_unittest.cc b/base/json/json_writer_unittest.cc
index a62b3ba989be95a99a4988d704c609e1fb8ed813..37ad2686843ee97e3b9f70bbaf41a8b18734dc8c 100644
--- a/base/json/json_writer_unittest.cc
+++ b/base/json/json_writer_unittest.cc
@@ -3,6 +3,8 @@
// found in the LICENSE file.
#include "base/json/json_writer.h"
+
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -55,11 +57,11 @@ TEST(JSONWriterTest, NestedTypes) {
// Writer unittests like empty list/dict nesting,
// list list nesting, etc.
DictionaryValue root_dict;
- scoped_ptr<ListValue> list(new ListValue());
- scoped_ptr<DictionaryValue> inner_dict(new DictionaryValue());
+ std::unique_ptr<ListValue> list(new ListValue());
+ std::unique_ptr<DictionaryValue> inner_dict(new DictionaryValue());
inner_dict->SetInteger("inner int", 10);
list->Append(std::move(inner_dict));
- list->Append(make_scoped_ptr(new ListValue()));
+ list->Append(WrapUnique(new ListValue()));
list->AppendBoolean(true);
root_dict.Set("list", std::move(list));
@@ -91,7 +93,7 @@ TEST(JSONWriterTest, KeysWithPeriods) {
DictionaryValue period_dict;
period_dict.SetIntegerWithoutPathExpansion("a.b", 3);
period_dict.SetIntegerWithoutPathExpansion("c", 2);
- scoped_ptr<DictionaryValue> period_dict2(new DictionaryValue());
+ std::unique_ptr<DictionaryValue> period_dict2(new DictionaryValue());
period_dict2->SetIntegerWithoutPathExpansion("g.h.i.j", 1);
period_dict.SetWithoutPathExpansion("d.e.f", std::move(period_dict2));
EXPECT_TRUE(JSONWriter::Write(period_dict, &output_js));
@@ -109,7 +111,7 @@ TEST(JSONWriterTest, BinaryValues) {
// Binary values should return errors unless suppressed via the
// OPTIONS_OMIT_BINARY_VALUES flag.
- scoped_ptr<Value> root(BinaryValue::CreateWithCopiedBuffer("asdf", 4));
+ std::unique_ptr<Value> root(BinaryValue::CreateWithCopiedBuffer("asdf", 4));
EXPECT_FALSE(JSONWriter::Write(*root, &output_js));
EXPECT_TRUE(JSONWriter::WriteWithOptions(
*root, JSONWriter::OPTIONS_OMIT_BINARY_VALUES, &output_js));
@@ -117,9 +119,9 @@ TEST(JSONWriterTest, BinaryValues) {
ListValue binary_list;
binary_list.Append(BinaryValue::CreateWithCopiedBuffer("asdf", 4));
- binary_list.Append(make_scoped_ptr(new FundamentalValue(5)));
+ binary_list.Append(WrapUnique(new FundamentalValue(5)));
binary_list.Append(BinaryValue::CreateWithCopiedBuffer("asdf", 4));
- binary_list.Append(make_scoped_ptr(new FundamentalValue(2)));
+ binary_list.Append(WrapUnique(new FundamentalValue(2)));
binary_list.Append(BinaryValue::CreateWithCopiedBuffer("asdf", 4));
EXPECT_FALSE(JSONWriter::Write(binary_list, &output_js));
EXPECT_TRUE(JSONWriter::WriteWithOptions(
@@ -128,13 +130,13 @@ TEST(JSONWriterTest, BinaryValues) {
DictionaryValue binary_dict;
binary_dict.Set(
- "a", make_scoped_ptr(BinaryValue::CreateWithCopiedBuffer("asdf", 4)));
+ "a", WrapUnique(BinaryValue::CreateWithCopiedBuffer("asdf", 4)));
binary_dict.SetInteger("b", 5);
binary_dict.Set(
- "c", make_scoped_ptr(BinaryValue::CreateWithCopiedBuffer("asdf", 4)));
+ "c", WrapUnique(BinaryValue::CreateWithCopiedBuffer("asdf", 4)));
binary_dict.SetInteger("d", 2);
binary_dict.Set(
- "e", make_scoped_ptr(BinaryValue::CreateWithCopiedBuffer("asdf", 4)));
+ "e", WrapUnique(BinaryValue::CreateWithCopiedBuffer("asdf", 4)));
EXPECT_FALSE(JSONWriter::Write(binary_dict, &output_js));
EXPECT_TRUE(JSONWriter::WriteWithOptions(
binary_dict, JSONWriter::OPTIONS_OMIT_BINARY_VALUES, &output_js));
« no previous file with comments | « base/json/json_value_serializer_unittest.cc ('k') | base/linux_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698