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

Unified Diff: dbus/values_util_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
« no previous file with comments | « content/browser/tracing/etw_tracing_agent_win.cc ('k') | device/geolocation/network_location_request.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/values_util_unittest.cc
diff --git a/dbus/values_util_unittest.cc b/dbus/values_util_unittest.cc
index 0cc7d9164f85d8ec3caa97dafb78680a31ffdd57..a4854dc40f47cd5090f22ce083ed388d38f32788 100644
--- a/dbus/values_util_unittest.cc
+++ b/dbus/values_util_unittest.cc
@@ -14,6 +14,7 @@
#include "base/json/json_writer.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "dbus/message.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -516,11 +517,11 @@ TEST(ValuesUtilTest, AppendDictionary) {
const double kDoubleValue = 4.9;
const std::string kStringValue = "fifty";
- base::ListValue* list_value = new base::ListValue();
+ auto list_value = base::MakeUnique<base::ListValue>();
list_value->AppendBoolean(kBoolValue);
list_value->AppendInteger(kInt32Value);
- base::DictionaryValue* dictionary_value = new base::DictionaryValue();
+ auto dictionary_value = base::MakeUnique<base::DictionaryValue>();
dictionary_value->SetBoolean(kKey1, kBoolValue);
dictionary_value->SetInteger(kKey2, kDoubleValue);
@@ -529,8 +530,8 @@ TEST(ValuesUtilTest, AppendDictionary) {
test_dictionary.SetInteger(kKey2, kInt32Value);
test_dictionary.SetDouble(kKey3, kDoubleValue);
test_dictionary.SetString(kKey4, kStringValue);
- test_dictionary.Set(kKey5, list_value); // takes ownership
- test_dictionary.Set(kKey6, dictionary_value); // takes ownership
+ test_dictionary.Set(kKey5, std::move(list_value));
+ test_dictionary.Set(kKey6, std::move(dictionary_value));
std::unique_ptr<Response> response(Response::CreateEmpty());
MessageWriter writer(response.get());
@@ -563,11 +564,11 @@ TEST(ValuesUtilTest, AppendDictionaryAsVariant) {
const double kDoubleValue = 4.9;
const std::string kStringValue = "fifty";
- base::ListValue* list_value = new base::ListValue();
+ auto list_value = base::MakeUnique<base::ListValue>();
list_value->AppendBoolean(kBoolValue);
list_value->AppendInteger(kInt32Value);
- base::DictionaryValue* dictionary_value = new base::DictionaryValue();
+ auto dictionary_value = base::MakeUnique<base::DictionaryValue>();
dictionary_value->SetBoolean(kKey1, kBoolValue);
dictionary_value->SetInteger(kKey2, kDoubleValue);
@@ -576,8 +577,8 @@ TEST(ValuesUtilTest, AppendDictionaryAsVariant) {
test_dictionary.SetInteger(kKey2, kInt32Value);
test_dictionary.SetDouble(kKey3, kDoubleValue);
test_dictionary.SetString(kKey4, kStringValue);
- test_dictionary.Set(kKey5, list_value); // takes ownership
- test_dictionary.Set(kKey6, dictionary_value); // takes ownership
+ test_dictionary.Set(kKey5, std::move(list_value));
+ test_dictionary.Set(kKey6, std::move(dictionary_value));
std::unique_ptr<Response> response(Response::CreateEmpty());
MessageWriter writer(response.get());
« no previous file with comments | « content/browser/tracing/etw_tracing_agent_win.cc ('k') | device/geolocation/network_location_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698