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

Side by Side Diff: chrome/common/variations/variations_util_unittest.cc

Issue 1880143002: Convert chrome/common to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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 unified diff | Download patch
« no previous file with comments | « chrome/common/service_process_util_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/variations/variations_util.h" 5 #include "chrome/common/variations/variations_util.h"
6 6
7 #include <memory>
7 #include <utility> 8 #include <utility>
8 9
9 #include "base/feature_list.h" 10 #include "base/feature_list.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "chrome/common/variations/fieldtrial_testing_config.h" 13 #include "chrome/common/variations/fieldtrial_testing_config.h"
14 #include "components/variations/variations_associated_data.h" 14 #include "components/variations/variations_associated_data.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace chrome_variations { 17 namespace chrome_variations {
18 18
19 class VariationsUtilTest : public ::testing::Test { 19 class VariationsUtilTest : public ::testing::Test {
20 public: 20 public:
21 VariationsUtilTest() : field_trial_list_(NULL) {} 21 VariationsUtilTest() : field_trial_list_(NULL) {}
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 const FieldTrialTestingGroup array_kFieldTrialConfig_groups[] = { 98 const FieldTrialTestingGroup array_kFieldTrialConfig_groups[] = {
99 {"TestStudy1", "TestGroup1", NULL, 0, enable_features, 2, NULL, 0}, 99 {"TestStudy1", "TestGroup1", NULL, 0, enable_features, 2, NULL, 0},
100 {"TestStudy2", "TestGroup2", NULL, 0, NULL, 0, disable_features, 2}}; 100 {"TestStudy2", "TestGroup2", NULL, 0, NULL, 0, disable_features, 2}};
101 101
102 const FieldTrialTestingConfig kConfig = { 102 const FieldTrialTestingConfig kConfig = {
103 array_kFieldTrialConfig_groups, 2, 103 array_kFieldTrialConfig_groups, 2,
104 }; 104 };
105 105
106 base::FeatureList::ClearInstanceForTesting(); 106 base::FeatureList::ClearInstanceForTesting();
107 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); 107 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
108 AssociateParamsFromFieldTrialConfig(kConfig, feature_list.get()); 108 AssociateParamsFromFieldTrialConfig(kConfig, feature_list.get());
109 base::FeatureList::SetInstance(std::move(feature_list)); 109 base::FeatureList::SetInstance(std::move(feature_list));
110 110
111 // Check the resulting feature and field trial states. Trials should not be 111 // Check the resulting feature and field trial states. Trials should not be
112 // active until their associated features are queried. 112 // active until their associated features are queried.
113 EXPECT_FALSE(base::FieldTrialList::IsTrialActive("TestStudy1")); 113 EXPECT_FALSE(base::FieldTrialList::IsTrialActive("TestStudy1"));
114 EXPECT_TRUE(base::FeatureList::IsEnabled(kFeatureA)); 114 EXPECT_TRUE(base::FeatureList::IsEnabled(kFeatureA));
115 EXPECT_TRUE(base::FeatureList::IsEnabled(kFeatureB)); 115 EXPECT_TRUE(base::FeatureList::IsEnabled(kFeatureB));
116 EXPECT_TRUE(base::FieldTrialList::IsTrialActive("TestStudy1")); 116 EXPECT_TRUE(base::FieldTrialList::IsTrialActive("TestStudy1"));
117 117
118 EXPECT_FALSE(base::FieldTrialList::IsTrialActive("TestStudy2")); 118 EXPECT_FALSE(base::FieldTrialList::IsTrialActive("TestStudy2"));
119 EXPECT_FALSE(base::FeatureList::IsEnabled(kFeatureC)); 119 EXPECT_FALSE(base::FeatureList::IsEnabled(kFeatureC));
120 EXPECT_FALSE(base::FeatureList::IsEnabled(kFeatureD)); 120 EXPECT_FALSE(base::FeatureList::IsEnabled(kFeatureD));
121 EXPECT_TRUE(base::FieldTrialList::IsTrialActive("TestStudy2")); 121 EXPECT_TRUE(base::FieldTrialList::IsTrialActive("TestStudy2"));
122 } 122 }
123 123
124 } // namespace chrome_variations 124 } // namespace chrome_variations
OLDNEW
« no previous file with comments | « chrome/common/service_process_util_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698