| 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/failing_http_transaction_factory.h" | 5 #include "net/http/failing_http_transaction_factory.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // to test interactions between cache and network. | 33 // to test interactions between cache and network. |
| 34 class FailingHttpTransaction : public HttpTransaction { | 34 class FailingHttpTransaction : public HttpTransaction { |
| 35 public: | 35 public: |
| 36 explicit FailingHttpTransaction(Error error); | 36 explicit FailingHttpTransaction(Error error); |
| 37 ~FailingHttpTransaction() override; | 37 ~FailingHttpTransaction() override; |
| 38 | 38 |
| 39 // HttpTransaction | 39 // HttpTransaction |
| 40 int Start(const HttpRequestInfo* request_info, | 40 int Start(const HttpRequestInfo* request_info, |
| 41 const CompletionCallback& callback, | 41 const CompletionCallback& callback, |
| 42 const NetLogWithSource& net_log) override; | 42 const NetLogWithSource& net_log) override; |
| 43 void Orphan(std::unique_ptr<HttpTransaction> trans) override; |
| 43 int RestartIgnoringLastError(const CompletionCallback& callback) override; | 44 int RestartIgnoringLastError(const CompletionCallback& callback) override; |
| 44 int RestartWithCertificate(X509Certificate* client_cert, | 45 int RestartWithCertificate(X509Certificate* client_cert, |
| 45 SSLPrivateKey* client_private_key, | 46 SSLPrivateKey* client_private_key, |
| 46 const CompletionCallback& callback) override; | 47 const CompletionCallback& callback) override; |
| 47 int RestartWithAuth(const AuthCredentials& credentials, | 48 int RestartWithAuth(const AuthCredentials& credentials, |
| 48 const CompletionCallback& callback) override; | 49 const CompletionCallback& callback) override; |
| 49 bool IsReadyToRestartForAuth() override; | 50 bool IsReadyToRestartForAuth() override; |
| 50 int Read(IOBuffer* buf, | 51 int Read(IOBuffer* buf, |
| 51 int buf_len, | 52 int buf_len, |
| 52 const CompletionCallback& callback) override; | 53 const CompletionCallback& callback) override; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 83 FailingHttpTransaction::~FailingHttpTransaction() {} | 84 FailingHttpTransaction::~FailingHttpTransaction() {} |
| 84 | 85 |
| 85 int FailingHttpTransaction::Start(const HttpRequestInfo* request_info, | 86 int FailingHttpTransaction::Start(const HttpRequestInfo* request_info, |
| 86 const CompletionCallback& callback, | 87 const CompletionCallback& callback, |
| 87 const NetLogWithSource& net_log) { | 88 const NetLogWithSource& net_log) { |
| 88 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 89 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 89 base::Bind(callback, error_)); | 90 base::Bind(callback, error_)); |
| 90 return ERR_IO_PENDING; | 91 return ERR_IO_PENDING; |
| 91 } | 92 } |
| 92 | 93 |
| 94 void FailingHttpTransaction::Orphan(std::unique_ptr<HttpTransaction> trans) { |
| 95 NOTREACHED(); |
| 96 return; |
| 97 } |
| 98 |
| 93 int FailingHttpTransaction::RestartIgnoringLastError( | 99 int FailingHttpTransaction::RestartIgnoringLastError( |
| 94 const CompletionCallback& callback) { | 100 const CompletionCallback& callback) { |
| 95 return ERR_FAILED; | 101 return ERR_FAILED; |
| 96 } | 102 } |
| 97 | 103 |
| 98 int FailingHttpTransaction::RestartWithCertificate( | 104 int FailingHttpTransaction::RestartWithCertificate( |
| 99 X509Certificate* client_cert, | 105 X509Certificate* client_cert, |
| 100 SSLPrivateKey* client_private_key, | 106 SSLPrivateKey* client_private_key, |
| 101 const CompletionCallback& callback) { | 107 const CompletionCallback& callback) { |
| 102 return ERR_FAILED; | 108 return ERR_FAILED; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 213 |
| 208 HttpCache* FailingHttpTransactionFactory::GetCache() { | 214 HttpCache* FailingHttpTransactionFactory::GetCache() { |
| 209 return NULL; | 215 return NULL; |
| 210 } | 216 } |
| 211 | 217 |
| 212 HttpNetworkSession* FailingHttpTransactionFactory::GetSession() { | 218 HttpNetworkSession* FailingHttpTransactionFactory::GetSession() { |
| 213 return session_; | 219 return session_; |
| 214 } | 220 } |
| 215 | 221 |
| 216 } // namespace net | 222 } // namespace net |
| OLD | NEW |