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

Unified Diff: chrome/browser/ui/webui/options/preferences_browsertest.cc

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: MakeUnique 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: chrome/browser/ui/webui/options/preferences_browsertest.cc
diff --git a/chrome/browser/ui/webui/options/preferences_browsertest.cc b/chrome/browser/ui/webui/options/preferences_browsertest.cc
index 72355ffb77015962846f21046ecf36f9d532e194..444c9dbbf640c05dcf306cb43c2dbe144616051f 100644
--- a/chrome/browser/ui/webui/options/preferences_browsertest.cc
+++ b/chrome/browser/ui/webui/options/preferences_browsertest.cc
@@ -9,6 +9,7 @@
#include <iostream>
#include <memory>
#include <sstream>
+#include <utility>
#include "base/callback.h"
#include "base/json/json_reader.h"
@@ -756,22 +757,22 @@ IN_PROC_BROWSER_TEST_F(ManagedPreferencesBrowserTest,
// List pref.
pref_names_.push_back(chromeos::kAccountsPrefUsers);
base::ListValue* list = new base::ListValue;
- list->Append(new base::StringValue("me@google.com"));
- list->Append(new base::StringValue("you@google.com"));
+ list->AppendString("me@google.com");
+ list->AppendString("you@google.com");
non_default_values_.push_back(list);
list = new base::ListValue;
- base::DictionaryValue* dict = new base::DictionaryValue;
+ auto dict = base::MakeUnique<base::DictionaryValue>();
dict->SetString("username", "me@google.com");
dict->SetString("name", "me@google.com");
dict->SetString("email", "");
dict->SetBoolean("owner", false);
- list->Append(dict);
- dict = new base::DictionaryValue;
+ list->Append(std::move(dict));
+ dict = base::MakeUnique<base::DictionaryValue>();
dict->SetString("username", "you@google.com");
dict->SetString("name", "you@google.com");
dict->SetString("email", "");
dict->SetBoolean("owner", false);
- list->Append(dict);
+ list->Append(std::move(dict));
decorated_non_default_values.push_back(list);
chromeos::CrosSettings* cros_settings = chromeos::CrosSettings::Get();
@@ -950,8 +951,8 @@ IN_PROC_BROWSER_TEST_F(ProxyPreferencesBrowserTest, ChromeOSInitializeProxy) {
// List pref.
pref_names_.push_back(chromeos::kProxyIgnoreList);
base::ListValue* list = new base::ListValue();
- list->Append(new base::StringValue("*.google.com"));
- list->Append(new base::StringValue("1.2.3.4:22"));
+ list->AppendString("*.google.com");
+ list->AppendString("1.2.3.4:22");
non_default_values_.push_back(list);
// Verify that no policy is presented to the UI. This must be verified on the

Powered by Google App Engine
This is Rietveld 408576698