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

Side by Side Diff: chrome_frame/test/test_server.cc

Issue 112433004: Update uses of UTF conversions in chrome_frame/, chromeos/, components/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/test_scrubber.cc ('k') | chrome_frame/test/test_with_web_server.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome_frame/test/test_server.h" 5 #include "chrome_frame/test/test_server.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <objbase.h> 8 #include <objbase.h>
9 #include <urlmon.h> 9 #include <urlmon.h>
10 10
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // extremely inefficient, but in one line and not that common... :) 251 // extremely inefficient, but in one line and not that common... :)
252 connections_.erase(std::find(connections_.begin(), connections_.end(), c)); 252 connections_.erase(std::find(connections_.begin(), connections_.end(), c));
253 delete c; 253 delete c;
254 } 254 }
255 } 255 }
256 256
257 HTTPTestServer::HTTPTestServer(int port, const std::wstring& address, 257 HTTPTestServer::HTTPTestServer(int port, const std::wstring& address,
258 base::FilePath root_dir) 258 base::FilePath root_dir)
259 : port_(port), address_(address), root_dir_(root_dir) { 259 : port_(port), address_(address), root_dir_(root_dir) {
260 net::EnsureWinsockInit(); 260 net::EnsureWinsockInit();
261 server_ = 261 server_ = net::TCPListenSocket::CreateAndListen(
262 net::TCPListenSocket::CreateAndListen(WideToUTF8(address), port, this); 262 base::WideToUTF8(address), port, this);
263 } 263 }
264 264
265 HTTPTestServer::~HTTPTestServer() { 265 HTTPTestServer::~HTTPTestServer() {
266 } 266 }
267 267
268 std::list<scoped_refptr<ConfigurableConnection>>::iterator 268 std::list<scoped_refptr<ConfigurableConnection>>::iterator
269 HTTPTestServer::FindConnection(const net::StreamListenSocket* socket) { 269 HTTPTestServer::FindConnection(const net::StreamListenSocket* socket) {
270 ConnectionList::iterator it; 270 ConnectionList::iterator it;
271 // Scan through the list searching for the desired socket. Along the way, 271 // Scan through the list searching for the desired socket. Along the way,
272 // erase any connections for which the corresponding socket has already been 272 // erase any connections for which the corresponding socket has already been
(...skipping 29 matching lines...) Expand all
302 const char* data, 302 const char* data,
303 int len) { 303 int len) {
304 scoped_refptr<ConfigurableConnection> connection = 304 scoped_refptr<ConfigurableConnection> connection =
305 ConnectionFromSocket(socket); 305 ConnectionFromSocket(socket);
306 if (connection) { 306 if (connection) {
307 std::string str(data, len); 307 std::string str(data, len);
308 connection->r_.OnDataReceived(str); 308 connection->r_.OnDataReceived(str);
309 if (connection->r_.AllContentReceived()) { 309 if (connection->r_.AllContentReceived()) {
310 VLOG(1) << __FUNCTION__ << ": " << connection->r_.method() << " " 310 VLOG(1) << __FUNCTION__ << ": " << connection->r_.method() << " "
311 << connection->r_.path(); 311 << connection->r_.path();
312 std::wstring path = UTF8ToWide(connection->r_.path()); 312 std::wstring path = base::UTF8ToWide(connection->r_.path());
313 if (LowerCaseEqualsASCII(connection->r_.method(), "post")) 313 if (LowerCaseEqualsASCII(connection->r_.method(), "post"))
314 this->Post(connection, path, connection->r_); 314 this->Post(connection, path, connection->r_);
315 else 315 else
316 this->Get(connection, path, connection->r_); 316 this->Get(connection, path, connection->r_);
317 } 317 }
318 } 318 }
319 } 319 }
320 320
321 void HTTPTestServer::DidClose(net::StreamListenSocket* socket) { 321 void HTTPTestServer::DidClose(net::StreamListenSocket* socket) {
322 ConnectionList::iterator it = FindConnection(socket); 322 ConnectionList::iterator it = FindConnection(socket);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 data_.append(content_length_header); 413 data_.append(content_length_header);
414 data_.append("\r\n"); 414 data_.append("\r\n");
415 } 415 }
416 416
417 base::MessageLoop::current()->PostDelayedTask( 417 base::MessageLoop::current()->PostDelayedTask(
418 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this), 418 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this),
419 base::TimeDelta::FromMilliseconds(options.timeout_)); 419 base::TimeDelta::FromMilliseconds(options.timeout_));
420 } 420 }
421 421
422 } // namespace test_server 422 } // namespace test_server
OLDNEW
« no previous file with comments | « chrome_frame/test/test_scrubber.cc ('k') | chrome_frame/test/test_with_web_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698