Move JoinString to the base namespace.
Change "Separator" from string to StringPIece (most are constants). Remove char versions for symmetry with SplitString.
Update callers who pass empty separators to use a base::StringPiece()
Change chromecast/base/metrics/cast_metrics_helper.cc to not use JoinString at all and just append to the output (code is simpler and faster).
[email protected] for chromeos
Committed: https://crrev.com/0eabfa001ba06d3c66992b95b69a988ef0633992
Cr-Commit-Position: refs/heads/master@{#338762}
patch from issue 1223153003 at patchset 160001 (http://crrev.com/1223153003#ps160001)
BUG=
Review URL: https://codereview.chromium.org/1230243005
Cr-Commit-Position: refs/heads/master@{#338819}
diff --git a/ui/gfx/text_elider_unittest.cc b/ui/gfx/text_elider_unittest.cc
index 5eeea5c4..b0baa422 100644
--- a/ui/gfx/text_elider_unittest.cc
+++ b/ui/gfx/text_elider_unittest.cc
@@ -668,7 +668,8 @@
TRUNCATE_LONG_WORDS,
&lines));
if (cases[i].output) {
- const std::string result = UTF16ToUTF8(JoinString(lines, '|'));
+ const std::string result =
+ UTF16ToUTF8(base::JoinString(lines, ASCIIToUTF16("|")));
EXPECT_EQ(cases[i].output, result) << "Case " << i << " failed!";
} else {
EXPECT_TRUE(lines.empty()) << "Case " << i << " failed!";
@@ -715,7 +716,8 @@
wrap_behavior,
&lines));
if (cases[i].output) {
- const std::string result = UTF16ToUTF8(JoinString(lines, '|'));
+ const std::string result =
+ UTF16ToUTF8(base::JoinString(lines, base::ASCIIToUTF16("|")));
EXPECT_EQ(cases[i].output, result) << "Case " << i << " failed!";
} else {
EXPECT_TRUE(lines.empty()) << "Case " << i << " failed!";
@@ -784,7 +786,8 @@
&lines));
std::string expected_output(cases[i].output);
base::ReplaceSubstringsAfterOffset(&expected_output, 0, "...", kEllipsis);
- const std::string result = UTF16ToUTF8(JoinString(lines, '|'));
+ const std::string result =
+ UTF16ToUTF8(base::JoinString(lines, base::ASCIIToUTF16("|")));
EXPECT_EQ(expected_output, result) << "Case " << i << " failed!";
}
}