From 8cc24ae2b51f9db4a16011eb1ab7dbfca0eb6d54 Mon Sep 17 00:00:00 2001 From: brettw Date: Mon, 6 Jul 2015 16:53:00 -0700 Subject: Replace remaining Tokenize calls to SplitString SplitString is now more general and does the job of Tokenize with specific parameters. The biggest change is in time_util.cc where the old return pattern better matched how the code was structured. With the new style the conditionals are more nested. Some simple cases were changed to StringPieces when copies were not required. BUG=506920, 506255 Review URL: https://codereview.chromium.org/1219263002 Cr-Commit-Position: refs/heads/master@{#337520} --- media/blink/cache_util_unittest.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'media/blink') diff --git a/media/blink/cache_util_unittest.cc b/media/blink/cache_util_unittest.cc index 7ea2f13..56dc49e 100644 --- a/media/blink/cache_util_unittest.cc +++ b/media/blink/cache_util_unittest.cc @@ -8,6 +8,7 @@ #include "base/format_macros.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "testing/gtest/include/gtest/gtest.h" @@ -33,13 +34,13 @@ static WebURLResponse CreateResponse(const GRFUTestCase& test) { response.initialize(); response.setHTTPVersion(test.version); response.setHTTPStatusCode(test.status_code); - std::vector lines; - Tokenize(test.headers, "\n", &lines); - for (size_t i = 0; i < lines.size(); ++i) { - size_t colon = lines[i].find(": "); + for (const std::string& line : + base::SplitString(test.headers, "\n", base::KEEP_WHITESPACE, + base::SPLIT_WANT_NONEMPTY)) { + size_t colon = line.find(": "); response.addHTTPHeaderField( - WebString::fromUTF8(lines[i].substr(0, colon)), - WebString::fromUTF8(lines[i].substr(colon + 2))); + WebString::fromUTF8(line.substr(0, colon)), + WebString::fromUTF8(line.substr(colon + 2))); } return response; } -- cgit v1.1