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

Unified Diff: ipc/ipc_message_unittest.cc

Issue 2911033002: Remove raw base::DictionaryValue::Set (Closed)
Patch Set: Proper Windows Fix Created 3 years, 6 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: ipc/ipc_message_unittest.cc
diff --git a/ipc/ipc_message_unittest.cc b/ipc/ipc_message_unittest.cc
index 8e59e00c859fb31a9850f0fd8d2e6fa661cb9da8..4e5bf07a23b76f95d6ab79774c28e6311fdc8f94 100644
--- a/ipc/ipc_message_unittest.cc
+++ b/ipc/ipc_message_unittest.cc
@@ -10,6 +10,7 @@
#include <limits>
#include <memory>
+#include <utility>
#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -89,21 +90,21 @@ 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);
input.SetIntegerWithoutPathExpansion("int.with.dot", 43);
- 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());
+ auto sublist = base::MakeUnique<base::ListValue>();
sublist->AppendDouble(42.42);
sublist->AppendString("forty");
sublist->AppendString("two");
- subdict->Set("list", sublist.release());
+ 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