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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 const net::HttpResponseInfo* MockNetworkTransaction::GetResponseInfo() const { | 308 const net::HttpResponseInfo* MockNetworkTransaction::GetResponseInfo() const { |
309 return &response_; | 309 return &response_; |
310 } | 310 } |
311 | 311 |
312 net::LoadState MockNetworkTransaction::GetLoadState() const { | 312 net::LoadState MockNetworkTransaction::GetLoadState() const { |
313 if (data_cursor_) | 313 if (data_cursor_) |
314 return net::LOAD_STATE_READING_RESPONSE; | 314 return net::LOAD_STATE_READING_RESPONSE; |
315 return net::LOAD_STATE_IDLE; | 315 return net::LOAD_STATE_IDLE; |
316 } | 316 } |
317 | 317 |
318 uint64 MockNetworkTransaction::GetUploadProgress() const { | 318 net::UploadProgress MockNetworkTransaction::GetUploadProgress() const { |
319 return 0; | 319 return net::UploadProgress(); |
320 } | 320 } |
321 | 321 |
322 void MockNetworkTransaction::CallbackLater( | 322 void MockNetworkTransaction::CallbackLater( |
323 const net::CompletionCallback& callback, int result) { | 323 const net::CompletionCallback& callback, int result) { |
324 MessageLoop::current()->PostTask( | 324 MessageLoop::current()->PostTask( |
325 FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback, | 325 FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback, |
326 weak_factory_.GetWeakPtr(), callback, result)); | 326 weak_factory_.GetWeakPtr(), callback, result)); |
327 } | 327 } |
328 | 328 |
329 void MockNetworkTransaction::RunCallback( | 329 void MockNetworkTransaction::RunCallback( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 373 |
374 if (rv > 0) | 374 if (rv > 0) |
375 content.append(buf->data(), rv); | 375 content.append(buf->data(), rv); |
376 else if (rv < 0) | 376 else if (rv < 0) |
377 return rv; | 377 return rv; |
378 } while (rv > 0); | 378 } while (rv > 0); |
379 | 379 |
380 result->swap(content); | 380 result->swap(content); |
381 return net::OK; | 381 return net::OK; |
382 } | 382 } |
OLD | NEW |