| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/url_request/url_request_test_util.h" | 5 #include "net/url_request/url_request_test_util.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 error_count_(0), | 245 error_count_(0), |
| 246 created_requests_(0), | 246 created_requests_(0), |
| 247 destroyed_requests_(0) { | 247 destroyed_requests_(0) { |
| 248 } | 248 } |
| 249 | 249 |
| 250 TestNetworkDelegate::~TestNetworkDelegate() {} | 250 TestNetworkDelegate::~TestNetworkDelegate() {} |
| 251 | 251 |
| 252 int TestNetworkDelegate::OnBeforeURLRequest( | 252 int TestNetworkDelegate::OnBeforeURLRequest( |
| 253 net::URLRequest* request, | 253 net::URLRequest* request, |
| 254 net::CompletionCallback* callback, | 254 net::CompletionCallback* callback, |
| 255 GURL* new_url) { | 255 GURL* new_url ) { |
| 256 created_requests_++; | 256 created_requests_++; |
| 257 return net::OK; | 257 return net::OK; |
| 258 } | 258 } |
| 259 | 259 |
| 260 int TestNetworkDelegate::OnBeforeSendHeaders( | 260 int TestNetworkDelegate::OnBeforeSendHeaders( |
| 261 uint64 request_id, | 261 uint64 request_id, |
| 262 net::CompletionCallback* callback, | 262 net::CompletionCallback* callback, |
| 263 net::HttpRequestHeaders* headers) { | 263 net::HttpRequestHeaders* headers) { |
| 264 return net::OK; | 264 return net::OK; |
| 265 } | 265 } |
| 266 | 266 |
| 267 void TestNetworkDelegate::OnRequestSent( | 267 void TestNetworkDelegate::OnRequestSent( |
| 268 uint64 request_id, | 268 uint64 request_id, |
| 269 const net::HostPortPair& socket_address, | 269 const net::HostPortPair& socket_address, |
| 270 const net::HttpRequestHeaders& headers) { | 270 const net::HttpRequestHeaders& headers) { |
| 271 } | 271 } |
| 272 | 272 |
| 273 void TestNetworkDelegate::OnBeforeRedirect(net::URLRequest* request, | 273 void TestNetworkDelegate::OnBeforeRedirect(net::URLRequest* request, |
| 274 const GURL& new_location) { | 274 const GURL& new_location) { |
| 275 } | 275 } |
| 276 | 276 |
| 277 void TestNetworkDelegate::OnResponseStarted(net::URLRequest* request) { | 277 void TestNetworkDelegate::OnResponseStarted(net::URLRequest* request) { |
| 278 if (request->status().status() == net::URLRequestStatus::FAILED) { | 278 if (request->status().status() == net::URLRequestStatus::FAILED) { |
| 279 error_count_++; | 279 error_count_++; |
| 280 last_os_error_ = request->status().os_error(); | 280 last_os_error_ = request->status().os_error(); |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 void TestNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, |
| 285 int bytes_read) { |
| 286 } |
| 287 |
| 284 void TestNetworkDelegate::OnCompleted(net::URLRequest* request) { | 288 void TestNetworkDelegate::OnCompleted(net::URLRequest* request) { |
| 285 if (request->status().status() == net::URLRequestStatus::FAILED) { | 289 if (request->status().status() == net::URLRequestStatus::FAILED) { |
| 286 error_count_++; | 290 error_count_++; |
| 287 last_os_error_ = request->status().os_error(); | 291 last_os_error_ = request->status().os_error(); |
| 288 } | 292 } |
| 289 } | 293 } |
| 290 | 294 |
| 291 void TestNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) { | 295 void TestNetworkDelegate::OnURLRequestDestroyed( |
| 296 net::URLRequest* request) { |
| 292 destroyed_requests_++; | 297 destroyed_requests_++; |
| 293 } | 298 } |
| 294 | 299 |
| 295 void TestNetworkDelegate::OnHttpTransactionDestroyed(uint64 request_id) { | 300 void TestNetworkDelegate::OnHttpTransactionDestroyed(uint64 request_id) { |
| 296 } | 301 } |
| 297 | 302 |
| 298 net::URLRequestJob* TestNetworkDelegate::OnMaybeCreateURLRequestJob( | 303 net::URLRequestJob* TestNetworkDelegate::OnMaybeCreateURLRequestJob( |
| 299 net::URLRequest* request) { | 304 net::URLRequest* request) { |
| 300 return NULL; | 305 return NULL; |
| 301 } | 306 } |
| 302 | 307 |
| 303 void TestNetworkDelegate::OnPACScriptError(int line_number, | 308 void TestNetworkDelegate::OnPACScriptError(int line_number, |
| 304 const string16& error) { | 309 const string16& error) { |
| 305 } | 310 } |
| OLD | NEW |