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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 if (net_log.net_log()) | 405 if (net_log.net_log()) |
406 socket_log_id_ = net_log.net_log()->NextID(); | 406 socket_log_id_ = net_log.net_log()->NextID(); |
407 | 407 |
408 if (test_mode_ & TEST_MODE_SYNC_NET_START) | 408 if (test_mode_ & TEST_MODE_SYNC_NET_START) |
409 return net::OK; | 409 return net::OK; |
410 | 410 |
411 CallbackLater(callback, net::OK); | 411 CallbackLater(callback, net::OK); |
412 return net::ERR_IO_PENDING; | 412 return net::ERR_IO_PENDING; |
413 } | 413 } |
414 | 414 |
| 415 void MockNetworkTransaction::SetBeforeNetworkStartCallback( |
| 416 const BeforeNetworkStartCallback& callback) { |
| 417 } |
| 418 |
| 419 int MockNetworkTransaction::ResumeNetworkStart() { |
| 420 // Should not get here. |
| 421 return net::ERR_FAILED; |
| 422 } |
| 423 |
415 void MockNetworkTransaction::CallbackLater( | 424 void MockNetworkTransaction::CallbackLater( |
416 const net::CompletionCallback& callback, int result) { | 425 const net::CompletionCallback& callback, int result) { |
417 base::MessageLoop::current()->PostTask( | 426 base::MessageLoop::current()->PostTask( |
418 FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback, | 427 FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback, |
419 weak_factory_.GetWeakPtr(), callback, result)); | 428 weak_factory_.GetWeakPtr(), callback, result)); |
420 } | 429 } |
421 | 430 |
422 void MockNetworkTransaction::RunCallback( | 431 void MockNetworkTransaction::RunCallback( |
423 const net::CompletionCallback& callback, int result) { | 432 const net::CompletionCallback& callback, int result) { |
424 callback.Run(result); | 433 callback.Run(result); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 481 |
473 if (rv > 0) | 482 if (rv > 0) |
474 content.append(buf->data(), rv); | 483 content.append(buf->data(), rv); |
475 else if (rv < 0) | 484 else if (rv < 0) |
476 return rv; | 485 return rv; |
477 } while (rv > 0); | 486 } while (rv > 0); |
478 | 487 |
479 result->swap(content); | 488 result->swap(content); |
480 return net::OK; | 489 return net::OK; |
481 } | 490 } |
OLD | NEW |