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

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

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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 <utility>
8
7 #include "base/feature_list.h" 9 #include "base/feature_list.h"
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/metrics/field_trial.h" 11 #include "base/metrics/field_trial.h"
10 #include "chrome/common/variations/fieldtrial_testing_config.h" 12 #include "chrome/common/variations/fieldtrial_testing_config.h"
11 #include "components/variations/variations_associated_data.h" 13 #include "components/variations/variations_associated_data.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 15
14 namespace chrome_variations { 16 namespace chrome_variations {
15 17
16 class VariationsUtilTest : public ::testing::Test { 18 class VariationsUtilTest : public ::testing::Test {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 {"TestStudy1", "TestGroup1", NULL, 0, enable_features, 2, NULL, 0}, 91 {"TestStudy1", "TestGroup1", NULL, 0, enable_features, 2, NULL, 0},
90 {"TestStudy2", "TestGroup2", NULL, 0, NULL, 0, disable_features, 2}}; 92 {"TestStudy2", "TestGroup2", NULL, 0, NULL, 0, disable_features, 2}};
91 93
92 const FieldTrialTestingConfig kConfig = { 94 const FieldTrialTestingConfig kConfig = {
93 array_kFieldTrialConfig_groups, 2, 95 array_kFieldTrialConfig_groups, 2,
94 }; 96 };
95 97
96 base::FeatureList::ClearInstanceForTesting(); 98 base::FeatureList::ClearInstanceForTesting();
97 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); 99 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
98 AssociateParamsFromFieldTrialConfig(kConfig, feature_list.get()); 100 AssociateParamsFromFieldTrialConfig(kConfig, feature_list.get());
99 base::FeatureList::SetInstance(feature_list.Pass()); 101 base::FeatureList::SetInstance(std::move(feature_list));
100 102
101 // Check the resulting feature and field trial states. Trials should not be 103 // Check the resulting feature and field trial states. Trials should not be
102 // active until their associated features are queried. 104 // active until their associated features are queried.
103 EXPECT_FALSE(base::FieldTrialList::IsTrialActive("TestStudy1")); 105 EXPECT_FALSE(base::FieldTrialList::IsTrialActive("TestStudy1"));
104 EXPECT_TRUE(base::FeatureList::IsEnabled(kFeatureA)); 106 EXPECT_TRUE(base::FeatureList::IsEnabled(kFeatureA));
105 EXPECT_TRUE(base::FeatureList::IsEnabled(kFeatureB)); 107 EXPECT_TRUE(base::FeatureList::IsEnabled(kFeatureB));
106 EXPECT_TRUE(base::FieldTrialList::IsTrialActive("TestStudy1")); 108 EXPECT_TRUE(base::FieldTrialList::IsTrialActive("TestStudy1"));
107 109
108 EXPECT_FALSE(base::FieldTrialList::IsTrialActive("TestStudy2")); 110 EXPECT_FALSE(base::FieldTrialList::IsTrialActive("TestStudy2"));
109 EXPECT_FALSE(base::FeatureList::IsEnabled(kFeatureC)); 111 EXPECT_FALSE(base::FeatureList::IsEnabled(kFeatureC));
110 EXPECT_FALSE(base::FeatureList::IsEnabled(kFeatureD)); 112 EXPECT_FALSE(base::FeatureList::IsEnabled(kFeatureD));
111 EXPECT_TRUE(base::FieldTrialList::IsTrialActive("TestStudy2")); 113 EXPECT_TRUE(base::FieldTrialList::IsTrialActive("TestStudy2"));
112 } 114 }
113 115
114 } // namespace chrome_variations 116 } // namespace chrome_variations
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698