Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5296)

Unified Diff: chrome/common/variations/experiment_labels_unittest.cc

Issue 1240183002: Update SplitString calls in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/service_process_util_unittest.cc ('k') | chrome/common/variations/variations_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/variations/experiment_labels_unittest.cc
diff --git a/chrome/common/variations/experiment_labels_unittest.cc b/chrome/common/variations/experiment_labels_unittest.cc
index 59ddbf7b97655cdd0e4d857332145b8d838f638b..bf35cca51fb6d1a8ebea8b44cf0a6dc037faa5f6 100644
--- a/chrome/common/variations/experiment_labels_unittest.cc
+++ b/chrome/common/variations/experiment_labels_unittest.cc
@@ -57,8 +57,9 @@ TEST(ExperimentLabelsTest, BuildGoogleUpdateExperimentLabel) {
for (size_t i = 0; i < arraysize(test_cases); ++i) {
// Parse the input groups.
base::FieldTrial::ActiveGroups groups;
- std::vector<std::string> group_data;
- base::SplitString(test_cases[i].active_group_pairs, '#', &group_data);
+ std::vector<std::string> group_data = base::SplitString(
+ test_cases[i].active_group_pairs, "#",
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
ASSERT_EQ(0U, group_data.size() % 2);
for (size_t j = 0; j < group_data.size(); j += 2) {
base::FieldTrial::ActiveGroup group;
@@ -68,26 +69,26 @@ TEST(ExperimentLabelsTest, BuildGoogleUpdateExperimentLabel) {
}
// Parse the expected output.
- std::vector<std::string> expected_ids_list;
- base::SplitString(test_cases[i].expected_ids, '#', &expected_ids_list);
+ std::vector<std::string> expected_ids_list = base::SplitString(
+ test_cases[i].expected_ids, "#",
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
std::string experiment_labels_string = base::UTF16ToUTF8(
BuildGoogleUpdateExperimentLabel(groups));
// Split the VariationIDs from the labels for verification below.
- std::vector<std::string> split_labels;
std::set<std::string> parsed_ids;
- base::SplitString(experiment_labels_string, ';', &split_labels);
- for (std::vector<std::string>::const_iterator it = split_labels.begin();
- it != split_labels.end(); ++it) {
+ for (const std::string& label : base::SplitString(
+ experiment_labels_string, ";",
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
// The ID is precisely between the '=' and '|' characters in each label.
- size_t index_of_equals = it->find('=');
- size_t index_of_pipe = it->find('|');
+ size_t index_of_equals = label.find('=');
+ size_t index_of_pipe = label.find('|');
ASSERT_NE(std::string::npos, index_of_equals);
ASSERT_NE(std::string::npos, index_of_pipe);
ASSERT_GT(index_of_pipe, index_of_equals);
- parsed_ids.insert(it->substr(index_of_equals + 1,
- index_of_pipe - index_of_equals - 1));
+ parsed_ids.insert(label.substr(index_of_equals + 1,
+ index_of_pipe - index_of_equals - 1));
}
// Verify that the resulting string contains each of the expected labels,
« no previous file with comments | « chrome/common/service_process_util_unittest.cc ('k') | chrome/common/variations/variations_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698