diff options
author | pkasting <pkasting@chromium.org> | 2015-08-06 18:29:50 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-07 01:30:28 +0000 |
commit | c4afb05f67511e980cd13c021abf26e04b902977 (patch) | |
tree | 125f79c7a354095c4519128b0fe2c9983f644152 /google_apis | |
parent | ac97e8e270e8783230272fa07d18d360d2409d5f (diff) | |
download | chromium_src-c4afb05f67511e980cd13c021abf26e04b902977.zip chromium_src-c4afb05f67511e980cd13c021abf26e04b902977.tar.gz chromium_src-c4afb05f67511e980cd13c021abf26e04b902977.tar.bz2 |
Revert of Update SplitString calls to new form (patchset #5 id:80001 of https://codereview.chromium.org/1272823003/ )
Reason for revert:
Caused Blink layout test failures in media/encrypted-media/encrypted-media-requestmediakeysystemaccess.html :
http://test-results.appspot.com/dashboards/flakiness_dashboard.html#showExpectations=true&tests=media%2Fencrypted-media%2Fencrypted-media-requestmediakeysystemaccess.html
Original issue's description:
> Update SplitString calls to new form
>
> Uses the new form for most (but not quite all) of the remaining users of the old form.
>
> Changes media mime util codec list parsing to expect no result from the string "," rather than two empty strings. The old SplitString call had a special case where if the input was empty, it would return empty, but if it had one split character, it would return two empty strings as results.
>
> The new one lets you choose but the options are either (1) empty string -> one empty string and "," -> two empty strings, or (2) map both to no results for when you don't want empty results. I'm pretty sure media codec parsing actually wants the latter behavior, so I updated the call to discard empty results and MimeUtilTest.ParseCodecString is updated.
>
> Committed: https://crrev.com/0aa7c64253cca8b636d52d1d01d94f96ab9c13fa
> Cr-Commit-Position: refs/heads/master@{#342238}
TBR=sky@chromium.org,dalecurtis@chromium.org,brettw@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/1278973003
Cr-Commit-Position: refs/heads/master@{#342257}
Diffstat (limited to 'google_apis')
-rw-r--r-- | google_apis/drive/test_util.cc | 9 | ||||
-rw-r--r-- | google_apis/gaia/fake_gaia.cc | 20 | ||||
-rw-r--r-- | google_apis/gaia/gaia_auth_fetcher.cc | 4 | ||||
-rw-r--r-- | google_apis/gaia/gaia_auth_util.cc | 5 |
4 files changed, 22 insertions, 16 deletions
diff --git a/google_apis/drive/test_util.cc b/google_apis/drive/test_util.cc index e77aedf..ae96409 100644 --- a/google_apis/drive/test_util.cc +++ b/google_apis/drive/test_util.cc @@ -133,16 +133,17 @@ bool ParseContentRangeHeader(const std::string& value, if (!RemovePrefix(value, "bytes ", &remaining)) return false; - std::vector<base::StringPiece> parts = base::SplitStringPiece( - remaining, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + base::SplitString(remaining, '/', &parts); if (parts.size() != 2U) return false; + const std::string range = parts[0]; if (!base::StringToInt64(parts[1], length)) return false; - parts = base::SplitStringPiece(parts[0], "-", base::TRIM_WHITESPACE, - base::SPLIT_WANT_ALL); + parts.clear(); + base::SplitString(range, '-', &parts); if (parts.size() != 2U) return false; diff --git a/google_apis/gaia/fake_gaia.cc b/google_apis/gaia/fake_gaia.cc index d24158c..6749393 100644 --- a/google_apis/gaia/fake_gaia.cc +++ b/google_apis/gaia/fake_gaia.cc @@ -71,13 +71,17 @@ typedef std::map<std::string, std::string> CookieMap; // Parses cookie name-value map our of |request|. CookieMap GetRequestCookies(const HttpRequest& request) { CookieMap result; - auto iter = request.headers.find("Cookie"); + std::map<std::string, std::string>::const_iterator iter = + request.headers.find("Cookie"); if (iter != request.headers.end()) { - for (const std::string& cookie_line : - base::SplitString(iter->second, " ", base::TRIM_WHITESPACE, - base::SPLIT_WANT_ALL)) { - std::vector<std::string> name_value = base::SplitString( - cookie_line, "=", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> cookie_nv_pairs; + base::SplitString(iter->second, ' ', &cookie_nv_pairs); + for(std::vector<std::string>::const_iterator cookie_line = + cookie_nv_pairs.begin(); + cookie_line != cookie_nv_pairs.end(); + ++cookie_line) { + std::vector<std::string> name_value; + base::SplitString(*cookie_line, '=', &name_value); if (name_value.size() != 2) continue; @@ -437,8 +441,8 @@ const FakeGaia::AccessTokenInfo* FakeGaia::FindAccessTokenInfo( if (auth_token.empty() || client_id.empty()) return NULL; - std::vector<std::string> scope_list = base::SplitString( - scope_string, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> scope_list; + base::SplitString(scope_string, ' ', &scope_list); ScopeSet scopes(scope_list.begin(), scope_list.end()); for (AccessTokenInfoMap::const_iterator entry( diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc index 086414f..04ebd6e 100644 --- a/google_apis/gaia/gaia_auth_fetcher.cc +++ b/google_apis/gaia/gaia_auth_fetcher.cc @@ -508,8 +508,8 @@ bool GaiaAuthFetcher::ParseClientLoginToOAuth2Response( // static bool GaiaAuthFetcher::ParseClientLoginToOAuth2Cookie(const std::string& cookie, std::string* auth_code) { - std::vector<std::string> parts = base::SplitString( - cookie, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + base::SplitString(cookie, ';', &parts); // Per documentation, the cookie should have Secure and HttpOnly. if (!CookiePartsContains(parts, kClientLoginToOAuth2CookiePartSecure) || !CookiePartsContains(parts, kClientLoginToOAuth2CookiePartHttpOnly)) { diff --git a/google_apis/gaia/gaia_auth_util.cc b/google_apis/gaia/gaia_auth_util.cc index cc5e17c..5464da6 100644 --- a/google_apis/gaia/gaia_auth_util.cc +++ b/google_apis/gaia/gaia_auth_util.cc @@ -21,8 +21,9 @@ const char kGooglemailDomain[] = "googlemail.com"; std::string CanonicalizeEmailImpl(const std::string& email_address, bool change_googlemail_to_gmail) { - std::vector<std::string> parts = base::SplitString( - email_address, "@", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector<std::string> parts; + char at = '@'; + base::SplitString(email_address, at, &parts); if (parts.size() != 2U) { NOTREACHED() << "expecting exactly one @, but got " << (parts.empty() ? 0 : parts.size() - 1) |