| 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 "net/http/http_transaction_unittest.h" | 5 #include "net/http/http_transaction_unittest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 const net::HttpResponseInfo* MockNetworkTransaction::GetResponseInfo() const { | 319 const net::HttpResponseInfo* MockNetworkTransaction::GetResponseInfo() const { |
| 320 return &response_; | 320 return &response_; |
| 321 } | 321 } |
| 322 | 322 |
| 323 net::LoadState MockNetworkTransaction::GetLoadState() const { | 323 net::LoadState MockNetworkTransaction::GetLoadState() const { |
| 324 if (data_cursor_) | 324 if (data_cursor_) |
| 325 return net::LOAD_STATE_READING_RESPONSE; | 325 return net::LOAD_STATE_READING_RESPONSE; |
| 326 return net::LOAD_STATE_IDLE; | 326 return net::LOAD_STATE_IDLE; |
| 327 } | 327 } |
| 328 | 328 |
| 329 uint64 MockNetworkTransaction::GetUploadProgress() const { | 329 net::UploadProgress MockNetworkTransaction::GetUploadProgress() const { |
| 330 return 0; | 330 return net::UploadProgress(); |
| 331 } | 331 } |
| 332 | 332 |
| 333 void MockNetworkTransaction::CallbackLater( | 333 void MockNetworkTransaction::CallbackLater( |
| 334 const net::CompletionCallback& callback, int result) { | 334 const net::CompletionCallback& callback, int result) { |
| 335 MessageLoop::current()->PostTask( | 335 MessageLoop::current()->PostTask( |
| 336 FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback, | 336 FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback, |
| 337 weak_factory_.GetWeakPtr(), callback, result)); | 337 weak_factory_.GetWeakPtr(), callback, result)); |
| 338 } | 338 } |
| 339 | 339 |
| 340 void MockNetworkTransaction::RunCallback( | 340 void MockNetworkTransaction::RunCallback( |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 384 |
| 385 if (rv > 0) | 385 if (rv > 0) |
| 386 content.append(buf->data(), rv); | 386 content.append(buf->data(), rv); |
| 387 else if (rv < 0) | 387 else if (rv < 0) |
| 388 return rv; | 388 return rv; |
| 389 } while (rv > 0); | 389 } while (rv > 0); |
| 390 | 390 |
| 391 result->swap(content); | 391 result->swap(content); |
| 392 return net::OK; | 392 return net::OK; |
| 393 } | 393 } |
| OLD | NEW |