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

Unified Diff: chromeos/network/network_util_unittest.cc

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: headers Created 4 years, 2 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: chromeos/network/network_util_unittest.cc
diff --git a/chromeos/network/network_util_unittest.cc b/chromeos/network/network_util_unittest.cc
index 032c08c8def2191355eb704b0b595b2dda1bf51b..02521995ffad743db77130e9f98f795cb9367753 100644
--- a/chromeos/network/network_util_unittest.cc
+++ b/chromeos/network/network_util_unittest.cc
@@ -6,6 +6,9 @@
#include <stddef.h>
+#include <memory>
+#include <utility>
+
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -118,24 +121,25 @@ TEST_F(NetworkUtilTest, ParseScanResults) {
// Scan result has no network id.
list.Clear();
- base::DictionaryValue* dict_value = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> dict_value(
+ new base::DictionaryValue());
dict_value->SetString(shill::kStatusProperty, "available");
- list.Append(dict_value);
+ list.Append(std::move(dict_value));
EXPECT_TRUE(ParseCellularScanResults(list, &scan_results));
EXPECT_TRUE(scan_results.empty());
// Mixed parse results.
- dict_value = new base::DictionaryValue();
+ dict_value.reset(new base::DictionaryValue());
dict_value->SetString(shill::kNetworkIdProperty, "000001");
dict_value->SetString(shill::kStatusProperty, "unknown");
dict_value->SetString(shill::kTechnologyProperty, "GSM");
- list.Append(dict_value);
+ list.Append(std::move(dict_value));
- dict_value = new base::DictionaryValue();
+ dict_value.reset(new base::DictionaryValue());
dict_value->SetString(shill::kNetworkIdProperty, "000002");
dict_value->SetString(shill::kStatusProperty, "available");
dict_value->SetString(shill::kLongNameProperty, "Long Name");
- list.Append(dict_value);
+ list.Append(std::move(dict_value));
EXPECT_TRUE(ParseCellularScanResults(list, &scan_results));
EXPECT_EQ(static_cast<size_t>(2), scan_results.size());

Powered by Google App Engine
This is Rietveld 408576698