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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "net/base/load_timing_info.h" | 11 #include "net/base/load_timing_info.h" |
12 #include "net/base/upload_progress.h" | 12 #include "net/base/upload_progress.h" |
| 13 #include "net/socket/connection_attempts.h" |
13 | 14 |
14 namespace net { | 15 namespace net { |
15 | 16 |
16 class AuthCredentials; | 17 class AuthCredentials; |
17 class BoundNetLog; | 18 class BoundNetLog; |
18 class HttpRequestHeaders; | 19 class HttpRequestHeaders; |
19 class IOBuffer; | 20 class IOBuffer; |
20 class X509Certificate; | 21 class X509Certificate; |
21 | 22 |
22 struct HttpRequestInfo; | 23 struct HttpRequestInfo; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 void SetQuicServerInfo(QuicServerInfo* quic_server_info) override; | 55 void SetQuicServerInfo(QuicServerInfo* quic_server_info) override; |
55 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; | 56 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; |
56 void SetPriority(RequestPriority priority) override; | 57 void SetPriority(RequestPriority priority) override; |
57 void SetWebSocketHandshakeStreamCreateHelper( | 58 void SetWebSocketHandshakeStreamCreateHelper( |
58 WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; | 59 WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; |
59 void SetBeforeNetworkStartCallback( | 60 void SetBeforeNetworkStartCallback( |
60 const BeforeNetworkStartCallback& callback) override; | 61 const BeforeNetworkStartCallback& callback) override; |
61 void SetBeforeProxyHeadersSentCallback( | 62 void SetBeforeProxyHeadersSentCallback( |
62 const BeforeProxyHeadersSentCallback& callback) override; | 63 const BeforeProxyHeadersSentCallback& callback) override; |
63 int ResumeNetworkStart() override; | 64 int ResumeNetworkStart() override; |
| 65 void GetConnectionAttempts(ConnectionAttempts* out) const override; |
64 | 66 |
65 private: | 67 private: |
66 Error error_; | 68 Error error_; |
67 }; | 69 }; |
68 | 70 |
69 FailingHttpTransaction::FailingHttpTransaction(Error error) : error_(error) { | 71 FailingHttpTransaction::FailingHttpTransaction(Error error) : error_(error) { |
70 DCHECK_LT(error, OK); | 72 DCHECK_LT(error, OK); |
71 } | 73 } |
72 | 74 |
73 FailingHttpTransaction::~FailingHttpTransaction() {} | 75 FailingHttpTransaction::~FailingHttpTransaction() {} |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 158 |
157 void FailingHttpTransaction::SetBeforeProxyHeadersSentCallback( | 159 void FailingHttpTransaction::SetBeforeProxyHeadersSentCallback( |
158 const BeforeProxyHeadersSentCallback& callback) { | 160 const BeforeProxyHeadersSentCallback& callback) { |
159 } | 161 } |
160 | 162 |
161 int FailingHttpTransaction::ResumeNetworkStart() { | 163 int FailingHttpTransaction::ResumeNetworkStart() { |
162 NOTREACHED(); | 164 NOTREACHED(); |
163 return ERR_FAILED; | 165 return ERR_FAILED; |
164 } | 166 } |
165 | 167 |
| 168 void FailingHttpTransaction::GetConnectionAttempts( |
| 169 ConnectionAttempts* out) const { |
| 170 NOTIMPLEMENTED(); |
| 171 } |
| 172 |
166 } // namespace | 173 } // namespace |
167 | 174 |
168 FailingHttpTransactionFactory::FailingHttpTransactionFactory( | 175 FailingHttpTransactionFactory::FailingHttpTransactionFactory( |
169 HttpNetworkSession* session, | 176 HttpNetworkSession* session, |
170 Error error) : session_(session), error_(error) { | 177 Error error) : session_(session), error_(error) { |
171 DCHECK_LT(error, OK); | 178 DCHECK_LT(error, OK); |
172 } | 179 } |
173 | 180 |
174 FailingHttpTransactionFactory::~FailingHttpTransactionFactory() {} | 181 FailingHttpTransactionFactory::~FailingHttpTransactionFactory() {} |
175 | 182 |
176 // HttpTransactionFactory: | 183 // HttpTransactionFactory: |
177 int FailingHttpTransactionFactory::CreateTransaction( | 184 int FailingHttpTransactionFactory::CreateTransaction( |
178 RequestPriority priority, | 185 RequestPriority priority, |
179 scoped_ptr<HttpTransaction>* trans) { | 186 scoped_ptr<HttpTransaction>* trans) { |
180 trans->reset(new FailingHttpTransaction(error_)); | 187 trans->reset(new FailingHttpTransaction(error_)); |
181 return OK; | 188 return OK; |
182 } | 189 } |
183 | 190 |
184 HttpCache* FailingHttpTransactionFactory::GetCache() { | 191 HttpCache* FailingHttpTransactionFactory::GetCache() { |
185 return NULL; | 192 return NULL; |
186 } | 193 } |
187 | 194 |
188 HttpNetworkSession* FailingHttpTransactionFactory::GetSession() { | 195 HttpNetworkSession* FailingHttpTransactionFactory::GetSession() { |
189 return session_; | 196 return session_; |
190 } | 197 } |
191 | 198 |
192 } // namespace net | 199 } // namespace net |
193 | 200 |
OLD | NEW |