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

Unified Diff: chrome/browser/prefs/session_startup_pref_unittest.cc

Issue 2782553004: Move TestingPrefService to use unique_ptr<Value> (Closed)
Patch Set: comments Created 3 years, 9 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/prefs/session_startup_pref_unittest.cc
diff --git a/chrome/browser/prefs/session_startup_pref_unittest.cc b/chrome/browser/prefs/session_startup_pref_unittest.cc
index ebe69c2b3436a87bcbfcc681b1dd43e059d9a1a1..b025f0ef5cc2c9da7248375f897a8cbcc2ed7f9a 100644
--- a/chrome/browser/prefs/session_startup_pref_unittest.cc
+++ b/chrome/browser/prefs/session_startup_pref_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/prefs/session_startup_pref.h"
+#include "base/memory/ptr_util.h"
#include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
@@ -26,10 +27,11 @@ class SessionStartupPrefTest : public testing::Test {
};
TEST_F(SessionStartupPrefTest, URLListIsFixedUp) {
- base::ListValue* url_pref_list = new base::ListValue;
+ auto url_pref_list = base::MakeUnique<base::ListValue>();
url_pref_list->Set(0, new base::Value("google.com"));
url_pref_list->Set(1, new base::Value("chromium.org"));
- pref_service_->SetUserPref(prefs::kURLsToRestoreOnStartup, url_pref_list);
+ pref_service_->SetUserPref(prefs::kURLsToRestoreOnStartup,
+ std::move(url_pref_list));
SessionStartupPref result =
SessionStartupPref::GetStartupPref(pref_service_.get());
@@ -39,16 +41,17 @@ TEST_F(SessionStartupPrefTest, URLListIsFixedUp) {
}
TEST_F(SessionStartupPrefTest, URLListManagedOverridesUser) {
- base::ListValue* url_pref_list1 = new base::ListValue;
+ auto url_pref_list1 = base::MakeUnique<base::ListValue>();
url_pref_list1->Set(0, new base::Value("chromium.org"));
- pref_service_->SetUserPref(prefs::kURLsToRestoreOnStartup, url_pref_list1);
+ pref_service_->SetUserPref(prefs::kURLsToRestoreOnStartup,
+ std::move(url_pref_list1));
- base::ListValue* url_pref_list2 = new base::ListValue;
+ auto url_pref_list2 = base::MakeUnique<base::ListValue>();
url_pref_list2->Set(0, new base::Value("chromium.org"));
url_pref_list2->Set(1, new base::Value("chromium.org"));
url_pref_list2->Set(2, new base::Value("chromium.org"));
pref_service_->SetManagedPref(prefs::kURLsToRestoreOnStartup,
- url_pref_list2);
+ std::move(url_pref_list2));
SessionStartupPref result =
SessionStartupPref::GetStartupPref(pref_service_.get());

Powered by Google App Engine
This is Rietveld 408576698