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

Unified Diff: components/user_prefs/tracked/segregated_pref_store_unittest.cc

Issue 1908143002: Convert //components/user_prefs from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore the rightful glory of <windows.h> Created 4 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: components/user_prefs/tracked/segregated_pref_store_unittest.cc
diff --git a/components/user_prefs/tracked/segregated_pref_store_unittest.cc b/components/user_prefs/tracked/segregated_pref_store_unittest.cc
index da8df8fa1a80d4942a377619dc2f771565155a24..f3efce22f727a73102245a1c43813c01e4f21a3f 100644
--- a/components/user_prefs/tracked/segregated_pref_store_unittest.cc
+++ b/components/user_prefs/tracked/segregated_pref_store_unittest.cc
@@ -4,14 +4,15 @@
#include "components/user_prefs/tracked/segregated_pref_store.h"
+#include <memory>
#include <set>
#include <string>
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "components/prefs/persistent_pref_store.h"
#include "components/prefs/pref_store_observer_mock.h"
@@ -79,7 +80,8 @@ class SegregatedPrefStoreTest : public testing::Test {
void TearDown() override { segregated_store_->RemoveObserver(&observer_); }
protected:
- scoped_ptr<PersistentPrefStore::ReadErrorDelegate> GetReadErrorDelegate() {
+ std::unique_ptr<PersistentPrefStore::ReadErrorDelegate>
+ GetReadErrorDelegate() {
EXPECT_TRUE(read_error_delegate_);
return std::move(read_error_delegate_);
}
@@ -93,7 +95,7 @@ class SegregatedPrefStoreTest : public testing::Test {
MockReadErrorDelegate::Data read_error_delegate_data_;
private:
- scoped_ptr<MockReadErrorDelegate> read_error_delegate_;
+ std::unique_ptr<MockReadErrorDelegate> read_error_delegate_;
};
TEST_F(SegregatedPrefStoreTest, StoreValues) {
@@ -102,10 +104,10 @@ TEST_F(SegregatedPrefStoreTest, StoreValues) {
// Properly stores new values.
segregated_store_->SetValue(kSelectedPref,
- make_scoped_ptr(new base::StringValue(kValue1)),
+ base::WrapUnique(new base::StringValue(kValue1)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
segregated_store_->SetValue(kUnselectedPref,
- make_scoped_ptr(new base::StringValue(kValue2)),
+ base::WrapUnique(new base::StringValue(kValue2)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
ASSERT_TRUE(selected_store_->GetValue(kSelectedPref, NULL));
@@ -127,10 +129,10 @@ TEST_F(SegregatedPrefStoreTest, StoreValues) {
TEST_F(SegregatedPrefStoreTest, ReadValues) {
selected_store_->SetValue(kSelectedPref,
- make_scoped_ptr(new base::StringValue(kValue1)),
+ base::WrapUnique(new base::StringValue(kValue1)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
default_store_->SetValue(kUnselectedPref,
- make_scoped_ptr(new base::StringValue(kValue2)),
+ base::WrapUnique(new base::StringValue(kValue2)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
// Works properly with values that are already there.
@@ -155,11 +157,11 @@ TEST_F(SegregatedPrefStoreTest, Observer) {
EXPECT_TRUE(observer_.initialization_success);
EXPECT_TRUE(observer_.changed_keys.empty());
segregated_store_->SetValue(kSelectedPref,
- make_scoped_ptr(new base::StringValue(kValue1)),
+ base::WrapUnique(new base::StringValue(kValue1)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
observer_.VerifyAndResetChangedKey(kSelectedPref);
segregated_store_->SetValue(kUnselectedPref,
- make_scoped_ptr(new base::StringValue(kValue2)),
+ base::WrapUnique(new base::StringValue(kValue2)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
observer_.VerifyAndResetChangedKey(kUnselectedPref);
}
« no previous file with comments | « components/user_prefs/tracked/segregated_pref_store.cc ('k') | components/user_prefs/tracked/tracked_preferences_migration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698