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

Unified Diff: base/feature_list_unittest.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 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
« no previous file with comments | « base/feature_list.cc ('k') | base/file_version_info_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/feature_list_unittest.cc
diff --git a/base/feature_list_unittest.cc b/base/feature_list_unittest.cc
index 58a7ebcab5982c147cb7b65b1e2c2fa80c47ba87..b49177f26e37e87a16c9082b1ed9ac63f7552a12 100644
--- a/base/feature_list_unittest.cc
+++ b/base/feature_list_unittest.cc
@@ -11,6 +11,7 @@
#include "base/format_macros.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -42,11 +43,11 @@ std::string SortFeatureListString(const std::string& feature_list) {
class FeatureListTest : public testing::Test {
public:
FeatureListTest() : feature_list_(nullptr) {
- RegisterFeatureListInstance(make_scoped_ptr(new FeatureList));
+ RegisterFeatureListInstance(WrapUnique(new FeatureList));
}
~FeatureListTest() override { ClearFeatureListInstance(); }
- void RegisterFeatureListInstance(scoped_ptr<FeatureList> feature_list) {
+ void RegisterFeatureListInstance(std::unique_ptr<FeatureList> feature_list) {
FeatureList::ClearInstanceForTesting();
feature_list_ = feature_list.get();
FeatureList::SetInstance(std::move(feature_list));
@@ -93,7 +94,7 @@ TEST_F(FeatureListTest, InitializeFromCommandLine) {
test_case.disable_features));
ClearFeatureListInstance();
- scoped_ptr<FeatureList> feature_list(new FeatureList);
+ std::unique_ptr<FeatureList> feature_list(new FeatureList);
feature_list->InitializeFromCommandLine(test_case.enable_features,
test_case.disable_features);
RegisterFeatureListInstance(std::move(feature_list));
@@ -149,7 +150,7 @@ TEST_F(FeatureListTest, FieldTrialOverrides) {
ClearFeatureListInstance();
FieldTrialList field_trial_list(nullptr);
- scoped_ptr<FeatureList> feature_list(new FeatureList);
+ std::unique_ptr<FeatureList> feature_list(new FeatureList);
FieldTrial* trial1 = FieldTrialList::CreateFieldTrial("TrialExample1", "A");
FieldTrial* trial2 = FieldTrialList::CreateFieldTrial("TrialExample2", "B");
@@ -181,7 +182,7 @@ TEST_F(FeatureListTest, FieldTrialOverrides) {
TEST_F(FeatureListTest, FieldTrialAssociateUseDefault) {
FieldTrialList field_trial_list(nullptr);
- scoped_ptr<FeatureList> feature_list(new FeatureList);
+ std::unique_ptr<FeatureList> feature_list(new FeatureList);
FieldTrial* trial1 = FieldTrialList::CreateFieldTrial("TrialExample1", "A");
FieldTrial* trial2 = FieldTrialList::CreateFieldTrial("TrialExample2", "B");
@@ -212,7 +213,7 @@ TEST_F(FeatureListTest, CommandLineTakesPrecedenceOverFieldTrial) {
ClearFeatureListInstance();
FieldTrialList field_trial_list(nullptr);
- scoped_ptr<FeatureList> feature_list(new FeatureList);
+ std::unique_ptr<FeatureList> feature_list(new FeatureList);
// The feature is explicitly enabled on the command-line.
feature_list->InitializeFromCommandLine(kFeatureOffByDefaultName, "");
@@ -236,7 +237,7 @@ TEST_F(FeatureListTest, IsFeatureOverriddenFromCommandLine) {
ClearFeatureListInstance();
FieldTrialList field_trial_list(nullptr);
- scoped_ptr<FeatureList> feature_list(new FeatureList);
+ std::unique_ptr<FeatureList> feature_list(new FeatureList);
// No features are overridden from the command line yet
EXPECT_FALSE(feature_list->IsFeatureOverriddenFromCommandLine(
@@ -311,7 +312,7 @@ TEST_F(FeatureListTest, AssociateReportingFieldTrial) {
ClearFeatureListInstance();
FieldTrialList field_trial_list(nullptr);
- scoped_ptr<FeatureList> feature_list(new FeatureList);
+ std::unique_ptr<FeatureList> feature_list(new FeatureList);
feature_list->InitializeFromCommandLine(test_case.enable_features,
test_case.disable_features);
@@ -354,7 +355,7 @@ TEST_F(FeatureListTest, AssociateReportingFieldTrial) {
TEST_F(FeatureListTest, GetFeatureOverrides) {
ClearFeatureListInstance();
FieldTrialList field_trial_list(nullptr);
- scoped_ptr<FeatureList> feature_list(new FeatureList);
+ std::unique_ptr<FeatureList> feature_list(new FeatureList);
feature_list->InitializeFromCommandLine("A,X", "D");
FieldTrial* trial = FieldTrialList::CreateFieldTrial("Trial", "Group");
@@ -375,7 +376,7 @@ TEST_F(FeatureListTest, GetFeatureOverrides) {
TEST_F(FeatureListTest, GetFeatureOverrides_UseDefault) {
ClearFeatureListInstance();
FieldTrialList field_trial_list(nullptr);
- scoped_ptr<FeatureList> feature_list(new FeatureList);
+ std::unique_ptr<FeatureList> feature_list(new FeatureList);
feature_list->InitializeFromCommandLine("A,X", "D");
FieldTrial* trial = FieldTrialList::CreateFieldTrial("Trial", "Group");
@@ -396,7 +397,7 @@ TEST_F(FeatureListTest, InitializeFromCommandLine_WithFieldTrials) {
ClearFeatureListInstance();
FieldTrialList field_trial_list(nullptr);
FieldTrialList::CreateFieldTrial("Trial", "Group");
- scoped_ptr<FeatureList> feature_list(new FeatureList);
+ std::unique_ptr<FeatureList> feature_list(new FeatureList);
feature_list->InitializeFromCommandLine("A,OffByDefault<Trial,X", "D");
RegisterFeatureListInstance(std::move(feature_list));
@@ -410,7 +411,7 @@ TEST_F(FeatureListTest, InitializeFromCommandLine_UseDefault) {
FieldTrialList field_trial_list(nullptr);
FieldTrialList::CreateFieldTrial("T1", "Group");
FieldTrialList::CreateFieldTrial("T2", "Group");
- scoped_ptr<FeatureList> feature_list(new FeatureList);
+ std::unique_ptr<FeatureList> feature_list(new FeatureList);
feature_list->InitializeFromCommandLine(
"A,*OffByDefault<T1,*OnByDefault<T2,X", "D");
RegisterFeatureListInstance(std::move(feature_list));
@@ -427,7 +428,7 @@ TEST_F(FeatureListTest, InitializeFromCommandLine_UseDefault) {
TEST_F(FeatureListTest, InitializeInstance) {
ClearFeatureListInstance();
- scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
+ std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
FeatureList::SetInstance(std::move(feature_list));
EXPECT_TRUE(FeatureList::IsEnabled(kFeatureOnByDefault));
EXPECT_FALSE(FeatureList::IsEnabled(kFeatureOffByDefault));
« no previous file with comments | « base/feature_list.cc ('k') | base/file_version_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698