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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 FieldTrialTest() : trial_list_(NULL) {} | 71 FieldTrialTest() : trial_list_(NULL) {} |
72 | 72 |
73 private: | 73 private: |
74 MessageLoop message_loop_; | 74 MessageLoop message_loop_; |
75 FieldTrialList trial_list_; | 75 FieldTrialList trial_list_; |
76 }; | 76 }; |
77 | 77 |
78 // Test registration, and also check that destructors are called for trials | 78 // Test registration, and also check that destructors are called for trials |
79 // (and that Valgrind doesn't catch us leaking). | 79 // (and that Valgrind doesn't catch us leaking). |
80 TEST_F(FieldTrialTest, Registration) { | 80 TEST_F(FieldTrialTest, Registration) { |
81 const char* name1 = "name 1 test"; | 81 const char name1[] = "name 1 test"; |
82 const char* name2 = "name 2 test"; | 82 const char name2[] = "name 2 test"; |
83 EXPECT_FALSE(FieldTrialList::Find(name1)); | 83 EXPECT_FALSE(FieldTrialList::Find(name1)); |
84 EXPECT_FALSE(FieldTrialList::Find(name2)); | 84 EXPECT_FALSE(FieldTrialList::Find(name2)); |
85 | 85 |
86 scoped_refptr<FieldTrial> trial1 = | 86 scoped_refptr<FieldTrial> trial1 = |
87 CreateFieldTrial(name1, 10, "default name 1 test", NULL); | 87 CreateFieldTrial(name1, 10, "default name 1 test", NULL); |
88 EXPECT_EQ(FieldTrial::kNotFinalized, trial1->group_); | 88 EXPECT_EQ(FieldTrial::kNotFinalized, trial1->group_); |
89 EXPECT_EQ(name1, trial1->trial_name()); | 89 EXPECT_EQ(name1, trial1->trial_name()); |
90 EXPECT_EQ("", trial1->group_name_internal()); | 90 EXPECT_EQ("", trial1->group_name_internal()); |
91 | 91 |
92 trial1->AppendGroup(std::string(), 7); | 92 trial1->AppendGroup(std::string(), 7); |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 EXPECT_TRUE(active_groups.empty()); | 986 EXPECT_TRUE(active_groups.empty()); |
987 | 987 |
988 // The trial shouldn't be listed in the |StatesToString()| result. | 988 // The trial shouldn't be listed in the |StatesToString()| result. |
989 std::string states; | 989 std::string states; |
990 FieldTrialList::StatesToString(&states); | 990 FieldTrialList::StatesToString(&states); |
991 EXPECT_TRUE(states.empty()); | 991 EXPECT_TRUE(states.empty()); |
992 } | 992 } |
993 } | 993 } |
994 | 994 |
995 } // namespace base | 995 } // namespace base |
OLD | NEW |