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

Side by Side Diff: ios/web/public/test/http_server.mm

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ios/web/public/test/http_server.h" 5 #import "ios/web/public/test/http_server.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 GURL::Replacements replacements; 162 GURL::Replacements replacements;
163 replacements.SetHostStr(kLocalhostHost); 163 replacements.SetHostStr(kLocalhostHost);
164 164
165 const std::string port = std::string( 165 const std::string port = std::string(
166 base::IntToString(static_cast<int>(GetPort()))); 166 base::IntToString(static_cast<int>(GetPort())));
167 replacements.SetPortStr(port); 167 replacements.SetPortStr(port);
168 168
169 // It is necessary to prepend the host of the input URL so that URLs such 169 // It is necessary to prepend the host of the input URL so that URLs such
170 // as http://origin/foo, http://destination/foo can be disamgiguated. 170 // as http://origin/foo, http://destination/foo can be disamgiguated.
171 const std::string new_path = std::string(result.host() + result.path()); 171 const std::string new_path =
172 std::string(result.host() + result.path().as_string());
172 replacements.SetPathStr(new_path); 173 replacements.SetPathStr(new_path);
173 174
174 return result.ReplaceComponents(replacements); 175 return result.ReplaceComponents(replacements);
175 } 176 }
176 177
177 scoped_refptr<RefCountedResponseProviderWrapper> 178 scoped_refptr<RefCountedResponseProviderWrapper>
178 HttpServer::GetResponseProviderForRequest( 179 HttpServer::GetResponseProviderForRequest(
179 const web::ResponseProvider::Request& request) { 180 const web::ResponseProvider::Request& request) {
180 base::AutoLock autolock(provider_list_lock_); 181 base::AutoLock autolock(provider_list_lock_);
181 scoped_refptr<RefCountedResponseProviderWrapper> result; 182 scoped_refptr<RefCountedResponseProviderWrapper> result;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 port_ = port; 230 port_ = port;
230 } 231 }
231 232
232 NSUInteger HttpServer::GetPort() const { 233 NSUInteger HttpServer::GetPort() const {
233 base::AutoLock autolock(port_lock_); 234 base::AutoLock autolock(port_lock_);
234 return port_; 235 return port_;
235 } 236 }
236 237
237 } // namespace test 238 } // namespace test
238 } // namespace web 239 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698