OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/variations/active_field_trials.h" | 5 #include "components/variations/active_field_trials.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 const std::vector<ActiveGroupId> name_group_ids, | 33 const std::vector<ActiveGroupId> name_group_ids, |
34 std::vector<std::string>* output) { | 34 std::vector<std::string>* output) { |
35 for (const auto& active_group_id : name_group_ids) { | 35 for (const auto& active_group_id : name_group_ids) { |
36 output->push_back(base::StringPrintf("%x-%x", active_group_id.name, | 36 output->push_back(base::StringPrintf("%x-%x", active_group_id.name, |
37 active_group_id.group)); | 37 active_group_id.group)); |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 ActiveGroupId MakeActiveGroupId(const std::string& trial_name, | 43 ActiveGroupId MakeActiveGroupId(base::StringPiece trial_name, |
44 const std::string& group_name) { | 44 base::StringPiece group_name) { |
45 ActiveGroupId id; | 45 ActiveGroupId id; |
46 id.name = metrics::HashName(trial_name); | 46 id.name = metrics::HashName(trial_name); |
47 id.group = metrics::HashName(group_name); | 47 id.group = metrics::HashName(group_name); |
48 return id; | 48 return id; |
49 } | 49 } |
50 | 50 |
51 void GetFieldTrialActiveGroupIds( | 51 void GetFieldTrialActiveGroupIds( |
52 std::vector<ActiveGroupId>* name_group_ids) { | 52 std::vector<ActiveGroupId>* name_group_ids) { |
53 DCHECK(name_group_ids->empty()); | 53 DCHECK(name_group_ids->empty()); |
54 // A note on thread safety: Since GetActiveFieldTrialGroups() is thread | 54 // A note on thread safety: Since GetActiveFieldTrialGroups() is thread |
(...skipping 24 matching lines...) Expand all Loading... |
79 void TestGetFieldTrialActiveGroupIds( | 79 void TestGetFieldTrialActiveGroupIds( |
80 const base::FieldTrial::ActiveGroups& active_groups, | 80 const base::FieldTrial::ActiveGroups& active_groups, |
81 std::vector<ActiveGroupId>* name_group_ids) { | 81 std::vector<ActiveGroupId>* name_group_ids) { |
82 GetFieldTrialActiveGroupIdsForActiveGroups(active_groups, | 82 GetFieldTrialActiveGroupIdsForActiveGroups(active_groups, |
83 name_group_ids); | 83 name_group_ids); |
84 } | 84 } |
85 | 85 |
86 } // namespace testing | 86 } // namespace testing |
87 | 87 |
88 } // namespace variations | 88 } // namespace variations |
OLD | NEW |