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

Side by Side Diff: content/test/mock_google_streaming_server.cc

Issue 1820333003: Remove most uses of UnescapeRule::URL_SPECIAL_CHARS outside net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Oops Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/test/mock_google_streaming_server.h" 5 #include "content/test/mock_google_streaming_server.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 28 matching lines...) Expand all
39 MockGoogleStreamingServer::~MockGoogleStreamingServer() { 39 MockGoogleStreamingServer::~MockGoogleStreamingServer() {
40 } 40 }
41 41
42 void MockGoogleStreamingServer::OnRequestStart(int fetcher_id) { 42 void MockGoogleStreamingServer::OnRequestStart(int fetcher_id) {
43 if (fetcher_id != kDownstreamUrlFetcherId) 43 if (fetcher_id != kDownstreamUrlFetcherId)
44 return; 44 return;
45 45
46 // Extract request argument from the the request URI. 46 // Extract request argument from the the request URI.
47 std::string query = GetURLFetcher(true)->GetOriginalURL().query(); 47 std::string query = GetURLFetcher(true)->GetOriginalURL().query();
48 const net::UnescapeRule::Type kUnescapeAll = 48 const net::UnescapeRule::Type kUnescapeAll =
49 net::UnescapeRule::NORMAL | 49 net::UnescapeRule::NORMAL | net::UnescapeRule::SPACES |
50 net::UnescapeRule::SPACES | 50 net::UnescapeRule::PATH_SEPARATORS |
51 net::UnescapeRule::URL_SPECIAL_CHARS | 51 net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS |
52 net::UnescapeRule::REPLACE_PLUS_WITH_SPACE; 52 net::UnescapeRule::REPLACE_PLUS_WITH_SPACE;
53 for (const base::StringPiece& query_param : 53 for (const base::StringPiece& query_param :
54 base::SplitStringPiece(query, "&", base::KEEP_WHITESPACE, 54 base::SplitStringPiece(query, "&", base::KEEP_WHITESPACE,
55 base::SPLIT_WANT_NONEMPTY)) { 55 base::SPLIT_WANT_NONEMPTY)) {
56 std::vector<std::string> param_parts = base::SplitString( 56 std::vector<std::string> param_parts = base::SplitString(
57 query_param, "=", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); 57 query_param, "=", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
58 if (param_parts.size() != 2) 58 if (param_parts.size() != 2)
59 continue; 59 continue;
60 std::string param_key = net::UnescapeURLComponent(param_parts[0], 60 std::string param_key = net::UnescapeURLComponent(param_parts[0],
61 kUnescapeAll); 61 kUnescapeAll);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 // Can return NULL if the SpeechRecognizer has not requested the connection yet. 143 // Can return NULL if the SpeechRecognizer has not requested the connection yet.
144 net::TestURLFetcher* MockGoogleStreamingServer::GetURLFetcher( 144 net::TestURLFetcher* MockGoogleStreamingServer::GetURLFetcher(
145 bool downstream) const { 145 bool downstream) const {
146 return url_fetcher_factory_.GetFetcherByID( 146 return url_fetcher_factory_.GetFetcherByID(
147 downstream ? kDownstreamUrlFetcherId : kUpstreamUrlFetcherId); 147 downstream ? kDownstreamUrlFetcherId : kUpstreamUrlFetcherId);
148 } 148 }
149 149
150 } // namespace content 150 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698