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

Unified Diff: chrome/browser/supervised_user/child_accounts/family_info_fetcher_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: chrome/browser/supervised_user/child_accounts/family_info_fetcher_unittest.cc
diff --git a/chrome/browser/supervised_user/child_accounts/family_info_fetcher_unittest.cc b/chrome/browser/supervised_user/child_accounts/family_info_fetcher_unittest.cc
index 37ff63961ab1159a5e6487523ee95d298eb04755..721f7f5c11fdc7c183902e920010602122e75e16 100644
--- a/chrome/browser/supervised_user/child_accounts/family_info_fetcher_unittest.cc
+++ b/chrome/browser/supervised_user/child_accounts/family_info_fetcher_unittest.cc
@@ -48,13 +48,13 @@ namespace {
std::string BuildGetFamilyProfileResponse(
const FamilyInfoFetcher::FamilyProfile& family) {
base::DictionaryValue dict;
- base::DictionaryValue* family_dict = new base::DictionaryValue;
+ auto family_dict = base::MakeUnique<base::DictionaryValue>();
family_dict->SetStringWithoutPathExpansion("familyId", family.id);
std::unique_ptr<base::DictionaryValue> profile_dict =
base::MakeUnique<base::DictionaryValue>();
profile_dict->SetStringWithoutPathExpansion("name", family.name);
family_dict->SetWithoutPathExpansion("profile", std::move(profile_dict));
- dict.SetWithoutPathExpansion("family", family_dict);
+ dict.SetWithoutPathExpansion("family", std::move(family_dict));
std::string result;
base::JSONWriter::Write(dict, &result);
return result;
@@ -62,8 +62,8 @@ std::string BuildGetFamilyProfileResponse(
std::string BuildEmptyGetFamilyProfileResponse() {
base::DictionaryValue dict;
- base::DictionaryValue* family_dict = new base::DictionaryValue;
- dict.SetWithoutPathExpansion("family", family_dict);
+ dict.SetWithoutPathExpansion("family",
+ base::MakeUnique<base::DictionaryValue>());
std::string result;
base::JSONWriter::Write(dict, &result);
return result;
@@ -72,7 +72,7 @@ std::string BuildEmptyGetFamilyProfileResponse() {
std::string BuildGetFamilyMembersResponse(
const std::vector<FamilyInfoFetcher::FamilyMember>& members) {
base::DictionaryValue dict;
- base::ListValue* list = new base::ListValue;
+ auto list = base::MakeUnique<base::ListValue>();
for (size_t i = 0; i < members.size(); i++) {
const FamilyInfoFetcher::FamilyMember& member = members[i];
std::unique_ptr<base::DictionaryValue> member_dict(
@@ -85,7 +85,7 @@ std::string BuildGetFamilyMembersResponse(
!member.email.empty() ||
!member.profile_url.empty() ||
!member.profile_image_url.empty()) {
- base::DictionaryValue* profile_dict = new base::DictionaryValue;
+ auto profile_dict = base::MakeUnique<base::DictionaryValue>();
if (!member.display_name.empty())
profile_dict->SetStringWithoutPathExpansion("displayName",
member.display_name);
@@ -99,11 +99,11 @@ std::string BuildGetFamilyMembersResponse(
profile_dict->SetStringWithoutPathExpansion("profileImageUrl",
member.profile_image_url);
- member_dict->SetWithoutPathExpansion("profile", profile_dict);
+ member_dict->SetWithoutPathExpansion("profile", std::move(profile_dict));
}
list->Append(std::move(member_dict));
}
- dict.SetWithoutPathExpansion("members", list);
+ dict.SetWithoutPathExpansion("members", std::move(list));
std::string result;
base::JSONWriter::Write(dict, &result);
return result;

Powered by Google App Engine
This is Rietveld 408576698