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 "chrome/common/metrics/experiments_helper.h" | 5 #include "chrome/common/metrics/experiments_helper.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 return GroupMapAccessor::GetInstance()->GetID( | 119 return GroupMapAccessor::GetInstance()->GetID( |
120 MakeSelectedGroupId(trial_name, group_name)); | 120 MakeSelectedGroupId(trial_name, group_name)); |
121 } | 121 } |
122 | 122 |
123 void SetChildProcessLoggingExperimentList() { | 123 void SetChildProcessLoggingExperimentList() { |
124 std::vector<SelectedGroupId> name_group_ids; | 124 std::vector<SelectedGroupId> name_group_ids; |
125 GetFieldTrialSelectedGroupIds(&name_group_ids); | 125 GetFieldTrialSelectedGroupIds(&name_group_ids); |
126 std::vector<string16> experiment_strings(name_group_ids.size()); | 126 std::vector<string16> experiment_strings(name_group_ids.size()); |
127 for (size_t i = 0; i < name_group_ids.size(); ++i) { | 127 for (size_t i = 0; i < name_group_ids.size(); ++i) { |
128 // Wish there was a StringPrintf for string16... :-( | 128 // Wish there was a StringPrintf for string16... :-( |
129 experiment_strings[i] = WideToUTF16(base::StringPrintf( | 129 experiment_strings[i] = ASCIIToUTF16(base::StringPrintf( |
130 L"%x-%x", name_group_ids[i].name, name_group_ids[i].group)); | 130 "%x-%x", name_group_ids[i].name, name_group_ids[i].group)); |
131 } | 131 } |
132 child_process_logging::SetExperimentList(experiment_strings); | 132 child_process_logging::SetExperimentList(experiment_strings); |
133 } | 133 } |
134 | 134 |
135 } // namespace experiments_helper | 135 } // namespace experiments_helper |
136 | 136 |
137 // Functions below are exposed for testing explicitly behind this namespace. | 137 // Functions below are exposed for testing explicitly behind this namespace. |
138 // They simply wrap existing functions in this file. | 138 // They simply wrap existing functions in this file. |
139 namespace testing { | 139 namespace testing { |
140 | 140 |
141 void TestGetFieldTrialSelectedGroupIdsForSelectedGroups( | 141 void TestGetFieldTrialSelectedGroupIdsForSelectedGroups( |
142 const base::FieldTrial::SelectedGroups& selected_groups, | 142 const base::FieldTrial::SelectedGroups& selected_groups, |
143 std::vector<experiments_helper::SelectedGroupId>* name_group_ids) { | 143 std::vector<experiments_helper::SelectedGroupId>* name_group_ids) { |
144 ::GetFieldTrialSelectedGroupIdsForSelectedGroups(selected_groups, | 144 ::GetFieldTrialSelectedGroupIdsForSelectedGroups(selected_groups, |
145 name_group_ids); | 145 name_group_ids); |
146 } | 146 } |
147 | 147 |
148 uint32 TestHashName(const std::string& name) { | 148 uint32 TestHashName(const std::string& name) { |
149 return ::HashName(name); | 149 return ::HashName(name); |
150 } | 150 } |
151 | 151 |
152 } // namespace testing | 152 } // namespace testing |
OLD | NEW |