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

Unified Diff: components/signin/core/browser/account_tracker_service_unittest.cc

Issue 2287733002: Switch //components away from base::ListValue::Append(Value*) overload. (Closed)
Patch Set: rebase Created 4 years, 4 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: components/signin/core/browser/account_tracker_service_unittest.cc
diff --git a/components/signin/core/browser/account_tracker_service_unittest.cc b/components/signin/core/browser/account_tracker_service_unittest.cc
index b143b25873b415beb07deeb4ccede5612e97d100..e5cd2e3e898d16df5c527d39e266b51fd08730ee 100644
--- a/components/signin/core/browser/account_tracker_service_unittest.cc
+++ b/components/signin/core/browser/account_tracker_service_unittest.cc
@@ -3,6 +3,8 @@
// found in the LICENSE file.
#include <algorithm>
+#include <memory>
+#include <utility>
#include <vector>
#include "base/message_loop/message_loop.h"
@@ -905,17 +907,17 @@ TEST_F(AccountTrackerServiceTest, MigrateAccountIdToGaiaId) {
ListPrefUpdate update(&pref, AccountTrackerService::kAccountInfoPref);
- base::DictionaryValue* dict = new base::DictionaryValue();
- update->Append(dict);
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("account_id", base::UTF8ToUTF16(email_alpha));
dict->SetString("email", base::UTF8ToUTF16(email_alpha));
dict->SetString("gaia", base::UTF8ToUTF16(gaia_alpha));
+ update->Append(std::move(dict));
- dict = new base::DictionaryValue();
- update->Append(dict);
+ dict.reset(new base::DictionaryValue());
dict->SetString("account_id", base::UTF8ToUTF16(email_beta));
dict->SetString("email", base::UTF8ToUTF16(email_beta));
dict->SetString("gaia", base::UTF8ToUTF16(gaia_beta));
+ update->Append(std::move(dict));
std::unique_ptr<TestSigninClient> client;
client.reset(new TestSigninClient(&pref));
@@ -957,17 +959,16 @@ TEST_F(AccountTrackerServiceTest, CanNotMigrateAccountIdToGaiaId) {
ListPrefUpdate update(&pref, AccountTrackerService::kAccountInfoPref);
- base::DictionaryValue* dict = new base::DictionaryValue();
- update->Append(dict);
danakj 2016/08/26 22:59:24 this append got lost
dcheng 2016/08/26 23:03:38 Fixed this already in PS3 =)
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("account_id", base::UTF8ToUTF16(email_alpha));
dict->SetString("email", base::UTF8ToUTF16(email_alpha));
dict->SetString("gaia", base::UTF8ToUTF16(gaia_alpha));
- dict = new base::DictionaryValue();
- update->Append(dict);
+ dict.reset(new base::DictionaryValue());
dict->SetString("account_id", base::UTF8ToUTF16(email_beta));
dict->SetString("email", base::UTF8ToUTF16(email_beta));
dict->SetString("gaia", base::UTF8ToUTF16(std::string()));
+ update->Append(std::move(dict));
std::unique_ptr<TestSigninClient> client;
client.reset(new TestSigninClient(&pref));
@@ -1009,24 +1010,24 @@ TEST_F(AccountTrackerServiceTest, GaiaIdMigrationCrashInTheMiddle) {
ListPrefUpdate update(&pref, AccountTrackerService::kAccountInfoPref);
- base::DictionaryValue* dict = new base::DictionaryValue();
- update->Append(dict);
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("account_id", base::UTF8ToUTF16(email_alpha));
dict->SetString("email", base::UTF8ToUTF16(email_alpha));
dict->SetString("gaia", base::UTF8ToUTF16(gaia_alpha));
+ update->Append(std::move(dict));
- dict = new base::DictionaryValue();
- update->Append(dict);
+ dict.reset(new base::DictionaryValue());
dict->SetString("account_id", base::UTF8ToUTF16(email_beta));
dict->SetString("email", base::UTF8ToUTF16(email_beta));
dict->SetString("gaia", base::UTF8ToUTF16(gaia_beta));
+ update->Append(std::move(dict));
// Succeed miggrated account.
- dict = new base::DictionaryValue();
- update->Append(dict);
+ dict.reset(new base::DictionaryValue());
dict->SetString("account_id", base::UTF8ToUTF16(gaia_alpha));
dict->SetString("email", base::UTF8ToUTF16(email_alpha));
dict->SetString("gaia", base::UTF8ToUTF16(gaia_alpha));
+ update->Append(std::move(dict));
std::unique_ptr<TestSigninClient> client;
client.reset(new TestSigninClient(&pref));

Powered by Google App Engine
This is Rietveld 408576698