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

Unified Diff: dbus/values_util_unittest.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 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/common/font_list_pango.cc ('k') | extensions/browser/api/serial/serial_apitest.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 8d04bcab876572fd5d92f93846fab47b14a7076a..d310d68a48534f2a16ed892e20950b162d17fdd3 100644
--- a/dbus/values_util_unittest.cc
+++ b/dbus/values_util_unittest.cc
@@ -9,6 +9,7 @@
#include <cmath>
#include <memory>
+#include <utility>
#include <vector>
#include "base/json/json_writer.h"
@@ -613,11 +614,12 @@ TEST(ValuesUtilTest, AppendList) {
const double kDoubleValue = 4.9;
const std::string kStringValue = "fifty";
- base::ListValue* list_value = new base::ListValue();
+ std::unique_ptr<base::ListValue> list_value(new base::ListValue());
list_value->AppendBoolean(kBoolValue);
list_value->AppendInteger(kInt32Value);
- base::DictionaryValue* dictionary_value = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> dictionary_value(
+ new base::DictionaryValue());
dictionary_value->SetBoolean(kKey1, kBoolValue);
dictionary_value->SetInteger(kKey2, kDoubleValue);
@@ -626,8 +628,8 @@ TEST(ValuesUtilTest, AppendList) {
test_list.AppendInteger(kInt32Value);
test_list.AppendDouble(kDoubleValue);
test_list.AppendString(kStringValue);
- test_list.Append(list_value); // takes ownership
- test_list.Append(dictionary_value); // takes ownership
+ test_list.Append(std::move(list_value));
+ test_list.Append(std::move(dictionary_value));
std::unique_ptr<Response> response(Response::CreateEmpty());
MessageWriter writer(response.get());
@@ -656,11 +658,12 @@ TEST(ValuesUtilTest, AppendListAsVariant) {
const double kDoubleValue = 4.9;
const std::string kStringValue = "fifty";
- base::ListValue* list_value = new base::ListValue();
+ std::unique_ptr<base::ListValue> list_value(new base::ListValue());
list_value->AppendBoolean(kBoolValue);
list_value->AppendInteger(kInt32Value);
- base::DictionaryValue* dictionary_value = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> dictionary_value(
+ new base::DictionaryValue());
dictionary_value->SetBoolean(kKey1, kBoolValue);
dictionary_value->SetInteger(kKey2, kDoubleValue);
@@ -669,8 +672,8 @@ TEST(ValuesUtilTest, AppendListAsVariant) {
test_list.AppendInteger(kInt32Value);
test_list.AppendDouble(kDoubleValue);
test_list.AppendString(kStringValue);
- test_list.Append(list_value); // takes ownership
- test_list.Append(dictionary_value); // takes ownership
+ test_list.Append(std::move(list_value));
+ test_list.Append(std::move(dictionary_value));
std::unique_ptr<Response> response(Response::CreateEmpty());
MessageWriter writer(response.get());
« no previous file with comments | « content/common/font_list_pango.cc ('k') | extensions/browser/api/serial/serial_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698