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

Unified Diff: chromeos/network/managed_network_configuration_handler_unittest.cc

Issue 2843813002: Remove SetWithoutPathExpansion (Closed)
Patch Set: Fix CrOS 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: chromeos/network/managed_network_configuration_handler_unittest.cc
diff --git a/chromeos/network/managed_network_configuration_handler_unittest.cc b/chromeos/network/managed_network_configuration_handler_unittest.cc
index abdf830aa0aa7c4e8391bceac14ee855ddbfcddc..8bacda562f8ae450fe5ddb03ee190e68449fc997 100644
--- a/chromeos/network/managed_network_configuration_handler_unittest.cc
+++ b/chromeos/network/managed_network_configuration_handler_unittest.cc
@@ -10,6 +10,7 @@
#include "base/bind_helpers.h"
#include "base/location.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
@@ -99,8 +100,8 @@ class ShillProfileTestClient {
if (profile_entries_.HasKey(profile_path))
return;
- base::DictionaryValue* profile = new base::DictionaryValue;
- profile_entries_.SetWithoutPathExpansion(profile_path, profile);
+ profile_entries_.SetWithoutPathExpansion(
+ profile_path, base::MakeUnique<base::DictionaryValue>());
profile_to_user_[profile_path] = userhash;
}
@@ -111,10 +112,10 @@ class ShillProfileTestClient {
profile_entries_.GetDictionaryWithoutPathExpansion(profile_path, &entries);
ASSERT_TRUE(entries);
- base::DictionaryValue* new_entry = entry.DeepCopy();
+ std::unique_ptr<base::DictionaryValue> new_entry = entry.CreateDeepCopy();
new_entry->SetStringWithoutPathExpansion(shill::kProfileProperty,
profile_path);
- entries->SetWithoutPathExpansion(entry_path, new_entry);
+ entries->SetWithoutPathExpansion(entry_path, std::move(new_entry));
}
void GetProperties(const dbus::ObjectPath& profile_path,
@@ -126,12 +127,13 @@ class ShillProfileTestClient {
ASSERT_TRUE(entries);
std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue);
- base::ListValue* entry_paths = new base::ListValue;
- result->SetWithoutPathExpansion(shill::kEntriesProperty, entry_paths);
+ auto entry_paths = base::MakeUnique<base::ListValue>();
for (base::DictionaryValue::Iterator it(*entries); !it.IsAtEnd();
it.Advance()) {
entry_paths->AppendString(it.key());
}
+ result->SetWithoutPathExpansion(shill::kEntriesProperty,
+ std::move(entry_paths));
ASSERT_TRUE(base::ContainsKey(profile_to_user_, profile_path.value()));
const std::string& userhash = profile_to_user_[profile_path.value()];

Powered by Google App Engine
This is Rietveld 408576698