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 26 matching lines...) Expand all Loading... |
37 return exploded.year; | 37 return exploded.year; |
38 } | 38 } |
39 | 39 |
40 // FieldTrialList::Observer implementation for testing. | 40 // FieldTrialList::Observer implementation for testing. |
41 class TestFieldTrialObserver : public FieldTrialList::Observer { | 41 class TestFieldTrialObserver : public FieldTrialList::Observer { |
42 public: | 42 public: |
43 TestFieldTrialObserver() { | 43 TestFieldTrialObserver() { |
44 FieldTrialList::AddObserver(this); | 44 FieldTrialList::AddObserver(this); |
45 } | 45 } |
46 | 46 |
47 virtual ~TestFieldTrialObserver() { | 47 ~TestFieldTrialObserver() override { FieldTrialList::RemoveObserver(this); } |
48 FieldTrialList::RemoveObserver(this); | |
49 } | |
50 | 48 |
51 virtual void OnFieldTrialGroupFinalized(const std::string& trial, | 49 void OnFieldTrialGroupFinalized(const std::string& trial, |
52 const std::string& group) override { | 50 const std::string& group) override { |
53 trial_name_ = trial; | 51 trial_name_ = trial; |
54 group_name_ = group; | 52 group_name_ = group; |
55 } | 53 } |
56 | 54 |
57 const std::string& trial_name() const { return trial_name_; } | 55 const std::string& trial_name() const { return trial_name_; } |
58 const std::string& group_name() const { return group_name_; } | 56 const std::string& group_name() const { return group_name_; } |
59 | 57 |
60 private: | 58 private: |
61 std::string trial_name_; | 59 std::string trial_name_; |
62 std::string group_name_; | 60 std::string group_name_; |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 EXPECT_TRUE(active_groups.empty()); | 984 EXPECT_TRUE(active_groups.empty()); |
987 | 985 |
988 // The trial shouldn't be listed in the |StatesToString()| result. | 986 // The trial shouldn't be listed in the |StatesToString()| result. |
989 std::string states; | 987 std::string states; |
990 FieldTrialList::StatesToString(&states); | 988 FieldTrialList::StatesToString(&states); |
991 EXPECT_TRUE(states.empty()); | 989 EXPECT_TRUE(states.empty()); |
992 } | 990 } |
993 } | 991 } |
994 | 992 |
995 } // namespace base | 993 } // namespace base |
OLD | NEW |