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

Unified Diff: content/common/common_param_traits_unittest.cc

Issue 2838893002: Remove base::ListValue::Set(size_t, base::Value*) (Closed)
Patch Set: Fix Compilation Error Created 3 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
Index: content/common/common_param_traits_unittest.cc
diff --git a/content/common/common_param_traits_unittest.cc b/content/common/common_param_traits_unittest.cc
index fd6cd2af39f4fe42e9999a59126cf20945ca6af2..8e5c3232a69bd6454dbe847fd5dbab79b8be8938 100644
--- a/content/common/common_param_traits_unittest.cc
+++ b/content/common/common_param_traits_unittest.cc
@@ -88,9 +88,9 @@ TEST(IPCMessageTest, Bitmap) {
TEST(IPCMessageTest, ListValue) {
base::ListValue input;
- input.Set(0, new base::Value(42.42));
- input.Set(1, new base::Value("forty"));
- input.Set(2, base::MakeUnique<base::Value>());
+ input.AppendDouble(42.42);
+ input.AppendString("forty");
+ input.Append(base::MakeUnique<base::Value>());
IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
IPC::WriteParam(&msg, input);
@@ -111,20 +111,20 @@ TEST(IPCMessageTest, ListValue) {
TEST(IPCMessageTest, DictionaryValue) {
base::DictionaryValue input;
input.Set("null", base::MakeUnique<base::Value>());
- input.Set("bool", new base::Value(true));
- input.Set("int", new base::Value(42));
+ input.SetBoolean("bool", true);
+ input.SetInteger("int", 42);
- std::unique_ptr<base::DictionaryValue> subdict(new base::DictionaryValue());
- subdict->Set("str", new base::Value("forty two"));
- subdict->Set("bool", new base::Value(false));
+ auto subdict = base::MakeUnique<base::DictionaryValue>();
+ subdict->SetString("str", "forty two");
+ subdict->SetBoolean("bool", false);
- std::unique_ptr<base::ListValue> sublist(new base::ListValue());
- sublist->Set(0, new base::Value(42.42));
- sublist->Set(1, new base::Value("forty"));
- sublist->Set(2, new base::Value("two"));
- subdict->Set("list", sublist.release());
+ auto sublist = base::MakeUnique<base::ListValue>();
+ sublist->AppendDouble(42.42);
+ sublist->AppendString("forty");
+ sublist->AppendString("two");
+ subdict->Set("list", std::move(sublist));
- input.Set("dict", subdict.release());
+ input.Set("dict", std::move(subdict));
IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
IPC::WriteParam(&msg, input);

Powered by Google App Engine
This is Rietveld 408576698