OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/metrics/field_trial.h" | 5 #include "base/metrics/field_trial.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 FieldTrialList::GetActiveFieldTrialGroups(&active_groups); | 983 FieldTrialList::GetActiveFieldTrialGroups(&active_groups); |
984 EXPECT_TRUE(active_groups.empty()); | 984 EXPECT_TRUE(active_groups.empty()); |
985 | 985 |
986 // The trial shouldn't be listed in the |StatesToString()| result. | 986 // The trial shouldn't be listed in the |StatesToString()| result. |
987 std::string states; | 987 std::string states; |
988 FieldTrialList::StatesToString(&states); | 988 FieldTrialList::StatesToString(&states); |
989 EXPECT_TRUE(states.empty()); | 989 EXPECT_TRUE(states.empty()); |
990 } | 990 } |
991 } | 991 } |
992 | 992 |
| 993 #if GTEST_HAS_DEATH_TEST |
| 994 TEST(FieldTrialDeathTest, OneTimeRandomizedTrialWithoutFieldTrialList) { |
| 995 // Trying to instantiate a one-time randomized field trial before the |
| 996 // FieldTrialList is created should crash. |
| 997 EXPECT_DEATH(FieldTrialList::FactoryGetFieldTrial( |
| 998 "OneTimeRandomizedTrialWithoutFieldTrialList", 100, kDefaultGroupName, |
| 999 base::FieldTrialList::kNoExpirationYear, 1, 1, |
| 1000 base::FieldTrial::ONE_TIME_RANDOMIZED, NULL), ""); |
| 1001 } |
| 1002 #endif |
| 1003 |
993 } // namespace base | 1004 } // namespace base |
OLD | NEW |