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 <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 149 } |
150 if (!current_chunk.empty()) | 150 if (!current_chunk.empty()) |
151 chunks->push_back(current_chunk); | 151 chunks->push_back(current_chunk); |
152 } | 152 } |
153 | 153 |
154 void SetChildProcessLoggingExperimentList() { | 154 void SetChildProcessLoggingExperimentList() { |
155 std::vector<SelectedGroupId> name_group_ids; | 155 std::vector<SelectedGroupId> name_group_ids; |
156 GetFieldTrialSelectedGroupIds(&name_group_ids); | 156 GetFieldTrialSelectedGroupIds(&name_group_ids); |
157 std::vector<string16> experiment_strings(name_group_ids.size()); | 157 std::vector<string16> experiment_strings(name_group_ids.size()); |
158 for (size_t i = 0; i < name_group_ids.size(); ++i) { | 158 for (size_t i = 0; i < name_group_ids.size(); ++i) { |
159 // Wish there was a StringPrintf for string16... :-( | 159 experiment_strings[i] = UTF8ToUTF16(base::StringPrintf( |
160 experiment_strings[i] = WideToUTF16(base::StringPrintf( | 160 "%x-%x", name_group_ids[i].name, name_group_ids[i].group)); |
161 L"%x-%x", name_group_ids[i].name, name_group_ids[i].group)); | |
162 } | 161 } |
163 child_process_logging::SetExperimentList(experiment_strings); | 162 child_process_logging::SetExperimentList(experiment_strings); |
164 } | 163 } |
165 | 164 |
166 } // namespace experiments_helper | 165 } // namespace experiments_helper |
167 | 166 |
168 // Functions below are exposed for testing explicitly behind this namespace. | 167 // Functions below are exposed for testing explicitly behind this namespace. |
169 // They simply wrap existing functions in this file. | 168 // They simply wrap existing functions in this file. |
170 namespace testing { | 169 namespace testing { |
171 | 170 |
172 void TestGetFieldTrialSelectedGroupIdsForSelectedGroups( | 171 void TestGetFieldTrialSelectedGroupIdsForSelectedGroups( |
173 const base::FieldTrial::SelectedGroups& selected_groups, | 172 const base::FieldTrial::SelectedGroups& selected_groups, |
174 std::vector<experiments_helper::SelectedGroupId>* name_group_ids) { | 173 std::vector<experiments_helper::SelectedGroupId>* name_group_ids) { |
175 ::GetFieldTrialSelectedGroupIdsForSelectedGroups(selected_groups, | 174 ::GetFieldTrialSelectedGroupIdsForSelectedGroups(selected_groups, |
176 name_group_ids); | 175 name_group_ids); |
177 } | 176 } |
178 | 177 |
179 uint32 TestHashName(const std::string& name) { | 178 uint32 TestHashName(const std::string& name) { |
180 return ::HashName(name); | 179 return ::HashName(name); |
181 } | 180 } |
182 | 181 |
183 } // namespace testing | 182 } // namespace testing |
OLD | NEW |