| OLD | NEW |
| 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <objbase.h> | 6 #include <objbase.h> |
| 7 #include <urlmon.h> | 7 #include <urlmon.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 DCHECK(c); | 244 DCHECK(c); |
| 245 c->OnSocketClosed(); | 245 c->OnSocketClosed(); |
| 246 if (!FindResponse(c->request())) { | 246 if (!FindResponse(c->request())) { |
| 247 // extremely inefficient, but in one line and not that common... :) | 247 // extremely inefficient, but in one line and not that common... :) |
| 248 connections_.erase(std::find(connections_.begin(), connections_.end(), c)); | 248 connections_.erase(std::find(connections_.begin(), connections_.end(), c)); |
| 249 delete c; | 249 delete c; |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 HTTPTestServer::HTTPTestServer(int port, const std::wstring& address, | 253 HTTPTestServer::HTTPTestServer(int port, const std::wstring& address, |
| 254 FilePath root_dir) | 254 base::FilePath root_dir) |
| 255 : port_(port), address_(address), root_dir_(root_dir) { | 255 : port_(port), address_(address), root_dir_(root_dir) { |
| 256 net::EnsureWinsockInit(); | 256 net::EnsureWinsockInit(); |
| 257 server_ = | 257 server_ = |
| 258 net::TCPListenSocket::CreateAndListen(WideToUTF8(address), port, this); | 258 net::TCPListenSocket::CreateAndListen(WideToUTF8(address), port, this); |
| 259 } | 259 } |
| 260 | 260 |
| 261 HTTPTestServer::~HTTPTestServer() { | 261 HTTPTestServer::~HTTPTestServer() { |
| 262 server_ = NULL; | 262 server_ = NULL; |
| 263 } | 263 } |
| 264 | 264 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 data_.append(content_length_header); | 410 data_.append(content_length_header); |
| 411 data_.append("\r\n"); | 411 data_.append("\r\n"); |
| 412 } | 412 } |
| 413 | 413 |
| 414 MessageLoop::current()->PostDelayedTask( | 414 MessageLoop::current()->PostDelayedTask( |
| 415 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this), | 415 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this), |
| 416 base::TimeDelta::FromMilliseconds(options.timeout_)); | 416 base::TimeDelta::FromMilliseconds(options.timeout_)); |
| 417 } | 417 } |
| 418 | 418 |
| 419 } // namespace test_server | 419 } // namespace test_server |
| OLD | NEW |