OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_test_util.h" | 5 #include "net/http/http_transaction_test_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <unordered_map> | 8 #include <unordered_map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 void MockNetworkTransaction::SetBeforeHeadersSentCallback( | 481 void MockNetworkTransaction::SetBeforeHeadersSentCallback( |
482 const BeforeHeadersSentCallback& callback) {} | 482 const BeforeHeadersSentCallback& callback) {} |
483 | 483 |
484 int MockNetworkTransaction::ResumeNetworkStart() { | 484 int MockNetworkTransaction::ResumeNetworkStart() { |
485 // Should not get here. | 485 // Should not get here. |
486 return ERR_FAILED; | 486 return ERR_FAILED; |
487 } | 487 } |
488 | 488 |
489 void MockNetworkTransaction::GetConnectionAttempts( | 489 void MockNetworkTransaction::GetConnectionAttempts( |
490 ConnectionAttempts* out) const { | 490 ConnectionAttempts* out) const { |
491 NOTIMPLEMENTED(); | 491 // A mock transaction makes no connection attempts. |
| 492 return; |
492 } | 493 } |
493 | 494 |
494 void MockNetworkTransaction::CallbackLater(const CompletionCallback& callback, | 495 void MockNetworkTransaction::CallbackLater(const CompletionCallback& callback, |
495 int result) { | 496 int result) { |
496 base::ThreadTaskRunnerHandle::Get()->PostTask( | 497 base::ThreadTaskRunnerHandle::Get()->PostTask( |
497 FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback, | 498 FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback, |
498 weak_factory_.GetWeakPtr(), callback, result)); | 499 weak_factory_.GetWeakPtr(), callback, result)); |
499 } | 500 } |
500 | 501 |
501 void MockNetworkTransaction::RunCallback(const CompletionCallback& callback, | 502 void MockNetworkTransaction::RunCallback(const CompletionCallback& callback, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 content.append(buf->data(), rv); | 579 content.append(buf->data(), rv); |
579 else if (rv < 0) | 580 else if (rv < 0) |
580 return rv; | 581 return rv; |
581 } while (rv > 0); | 582 } while (rv > 0); |
582 | 583 |
583 result->swap(content); | 584 result->swap(content); |
584 return OK; | 585 return OK; |
585 } | 586 } |
586 | 587 |
587 } // namespace net | 588 } // namespace net |
OLD | NEW |