OLD | NEW |
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 "base/feature_list.h" | 5 #include "base/feature_list.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 EXPECT_FALSE(FieldTrialList::IsTrialActive("T1")); | 418 EXPECT_FALSE(FieldTrialList::IsTrialActive("T1")); |
419 EXPECT_FALSE(FeatureList::IsEnabled(kFeatureOffByDefault)); | 419 EXPECT_FALSE(FeatureList::IsEnabled(kFeatureOffByDefault)); |
420 EXPECT_TRUE(FieldTrialList::IsTrialActive("T1")); | 420 EXPECT_TRUE(FieldTrialList::IsTrialActive("T1")); |
421 | 421 |
422 EXPECT_FALSE(FieldTrialList::IsTrialActive("T2")); | 422 EXPECT_FALSE(FieldTrialList::IsTrialActive("T2")); |
423 EXPECT_TRUE(FeatureList::IsEnabled(kFeatureOnByDefault)); | 423 EXPECT_TRUE(FeatureList::IsEnabled(kFeatureOnByDefault)); |
424 EXPECT_TRUE(FieldTrialList::IsTrialActive("T2")); | 424 EXPECT_TRUE(FieldTrialList::IsTrialActive("T2")); |
425 } | 425 } |
426 | 426 |
| 427 TEST_F(FeatureListTest, InitializeInstance) { |
| 428 ClearFeatureListInstance(); |
| 429 |
| 430 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| 431 FeatureList::SetInstance(std::move(feature_list)); |
| 432 EXPECT_TRUE(FeatureList::IsEnabled(kFeatureOnByDefault)); |
| 433 EXPECT_FALSE(FeatureList::IsEnabled(kFeatureOffByDefault)); |
| 434 |
| 435 // Initialize from command line if we haven't yet. |
| 436 FeatureList::InitializeInstance("", kFeatureOnByDefaultName); |
| 437 EXPECT_FALSE(FeatureList::IsEnabled(kFeatureOnByDefault)); |
| 438 EXPECT_FALSE(FeatureList::IsEnabled(kFeatureOffByDefault)); |
| 439 |
| 440 // Do not initialize from commandline if we have already. |
| 441 FeatureList::InitializeInstance(kFeatureOffByDefaultName, ""); |
| 442 EXPECT_FALSE(FeatureList::IsEnabled(kFeatureOnByDefault)); |
| 443 EXPECT_FALSE(FeatureList::IsEnabled(kFeatureOffByDefault)); |
| 444 } |
| 445 |
427 } // namespace base | 446 } // namespace base |
OLD | NEW |