| 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 #ifndef NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 5 #ifndef NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
| 6 #define NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 6 #define NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
| 7 | 7 |
| 8 #include "net/http/http_transaction.h" | 8 #include "net/http/http_transaction.h" |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 : public net::HttpTransaction, | 165 : public net::HttpTransaction, |
| 166 public base::SupportsWeakPtr<MockNetworkTransaction> { | 166 public base::SupportsWeakPtr<MockNetworkTransaction> { |
| 167 typedef net::WebSocketHandshakeStreamBase::CreateHelper CreateHelper; | 167 typedef net::WebSocketHandshakeStreamBase::CreateHelper CreateHelper; |
| 168 public: | 168 public: |
| 169 MockNetworkTransaction(net::RequestPriority priority, | 169 MockNetworkTransaction(net::RequestPriority priority, |
| 170 MockNetworkLayer* factory); | 170 MockNetworkLayer* factory); |
| 171 virtual ~MockNetworkTransaction(); | 171 virtual ~MockNetworkTransaction(); |
| 172 | 172 |
| 173 virtual int Start(const net::HttpRequestInfo* request, | 173 virtual int Start(const net::HttpRequestInfo* request, |
| 174 const net::CompletionCallback& callback, | 174 const net::CompletionCallback& callback, |
| 175 const net::BoundNetLog& net_log) OVERRIDE; | 175 const net::BoundNetLog& net_log) override; |
| 176 | 176 |
| 177 virtual int RestartIgnoringLastError( | 177 virtual int RestartIgnoringLastError( |
| 178 const net::CompletionCallback& callback) OVERRIDE; | 178 const net::CompletionCallback& callback) override; |
| 179 | 179 |
| 180 virtual int RestartWithCertificate( | 180 virtual int RestartWithCertificate( |
| 181 net::X509Certificate* client_cert, | 181 net::X509Certificate* client_cert, |
| 182 const net::CompletionCallback& callback) OVERRIDE; | 182 const net::CompletionCallback& callback) override; |
| 183 | 183 |
| 184 virtual int RestartWithAuth( | 184 virtual int RestartWithAuth( |
| 185 const net::AuthCredentials& credentials, | 185 const net::AuthCredentials& credentials, |
| 186 const net::CompletionCallback& callback) OVERRIDE; | 186 const net::CompletionCallback& callback) override; |
| 187 | 187 |
| 188 virtual bool IsReadyToRestartForAuth() OVERRIDE; | 188 virtual bool IsReadyToRestartForAuth() override; |
| 189 | 189 |
| 190 virtual int Read(net::IOBuffer* buf, int buf_len, | 190 virtual int Read(net::IOBuffer* buf, int buf_len, |
| 191 const net::CompletionCallback& callback) OVERRIDE; | 191 const net::CompletionCallback& callback) override; |
| 192 | 192 |
| 193 virtual void StopCaching() OVERRIDE; | 193 virtual void StopCaching() override; |
| 194 | 194 |
| 195 virtual bool GetFullRequestHeaders( | 195 virtual bool GetFullRequestHeaders( |
| 196 net::HttpRequestHeaders* headers) const OVERRIDE; | 196 net::HttpRequestHeaders* headers) const override; |
| 197 | 197 |
| 198 virtual int64 GetTotalReceivedBytes() const OVERRIDE; | 198 virtual int64 GetTotalReceivedBytes() const override; |
| 199 | 199 |
| 200 virtual void DoneReading() OVERRIDE; | 200 virtual void DoneReading() override; |
| 201 | 201 |
| 202 virtual const net::HttpResponseInfo* GetResponseInfo() const OVERRIDE; | 202 virtual const net::HttpResponseInfo* GetResponseInfo() const override; |
| 203 | 203 |
| 204 virtual net::LoadState GetLoadState() const OVERRIDE; | 204 virtual net::LoadState GetLoadState() const override; |
| 205 | 205 |
| 206 virtual net::UploadProgress GetUploadProgress() const OVERRIDE; | 206 virtual net::UploadProgress GetUploadProgress() const override; |
| 207 | 207 |
| 208 virtual void SetQuicServerInfo( | 208 virtual void SetQuicServerInfo( |
| 209 net::QuicServerInfo* quic_server_info) OVERRIDE; | 209 net::QuicServerInfo* quic_server_info) override; |
| 210 | 210 |
| 211 virtual bool GetLoadTimingInfo( | 211 virtual bool GetLoadTimingInfo( |
| 212 net::LoadTimingInfo* load_timing_info) const OVERRIDE; | 212 net::LoadTimingInfo* load_timing_info) const override; |
| 213 | 213 |
| 214 virtual void SetPriority(net::RequestPriority priority) OVERRIDE; | 214 virtual void SetPriority(net::RequestPriority priority) override; |
| 215 | 215 |
| 216 virtual void SetWebSocketHandshakeStreamCreateHelper( | 216 virtual void SetWebSocketHandshakeStreamCreateHelper( |
| 217 CreateHelper* create_helper) OVERRIDE; | 217 CreateHelper* create_helper) override; |
| 218 | 218 |
| 219 virtual void SetBeforeNetworkStartCallback( | 219 virtual void SetBeforeNetworkStartCallback( |
| 220 const BeforeNetworkStartCallback& callback) OVERRIDE; | 220 const BeforeNetworkStartCallback& callback) override; |
| 221 | 221 |
| 222 virtual void SetBeforeProxyHeadersSentCallback( | 222 virtual void SetBeforeProxyHeadersSentCallback( |
| 223 const BeforeProxyHeadersSentCallback& callback) OVERRIDE; | 223 const BeforeProxyHeadersSentCallback& callback) override; |
| 224 | 224 |
| 225 virtual int ResumeNetworkStart() OVERRIDE; | 225 virtual int ResumeNetworkStart() override; |
| 226 | 226 |
| 227 CreateHelper* websocket_handshake_stream_create_helper() { | 227 CreateHelper* websocket_handshake_stream_create_helper() { |
| 228 return websocket_handshake_stream_create_helper_; | 228 return websocket_handshake_stream_create_helper_; |
| 229 } | 229 } |
| 230 net::RequestPriority priority() const { return priority_; } | 230 net::RequestPriority priority() const { return priority_; } |
| 231 const net::HttpRequestInfo* request() const { return request_; } | 231 const net::HttpRequestInfo* request() const { return request_; } |
| 232 | 232 |
| 233 private: | 233 private: |
| 234 int StartInternal(const net::HttpRequestInfo* request, | 234 int StartInternal(const net::HttpRequestInfo* request, |
| 235 const net::CompletionCallback& callback, | 235 const net::CompletionCallback& callback, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 // Makes last_transaction() return NULL until the next transaction | 286 // Makes last_transaction() return NULL until the next transaction |
| 287 // is created. | 287 // is created. |
| 288 void ClearLastTransaction() { | 288 void ClearLastTransaction() { |
| 289 last_transaction_.reset(); | 289 last_transaction_.reset(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 // net::HttpTransactionFactory: | 292 // net::HttpTransactionFactory: |
| 293 virtual int CreateTransaction( | 293 virtual int CreateTransaction( |
| 294 net::RequestPriority priority, | 294 net::RequestPriority priority, |
| 295 scoped_ptr<net::HttpTransaction>* trans) OVERRIDE; | 295 scoped_ptr<net::HttpTransaction>* trans) override; |
| 296 virtual net::HttpCache* GetCache() OVERRIDE; | 296 virtual net::HttpCache* GetCache() override; |
| 297 virtual net::HttpNetworkSession* GetSession() OVERRIDE; | 297 virtual net::HttpNetworkSession* GetSession() override; |
| 298 | 298 |
| 299 private: | 299 private: |
| 300 int transaction_count_; | 300 int transaction_count_; |
| 301 bool done_reading_called_; | 301 bool done_reading_called_; |
| 302 bool stop_caching_called_; | 302 bool stop_caching_called_; |
| 303 net::RequestPriority last_create_transaction_priority_; | 303 net::RequestPriority last_create_transaction_priority_; |
| 304 base::WeakPtr<MockNetworkTransaction> last_transaction_; | 304 base::WeakPtr<MockNetworkTransaction> last_transaction_; |
| 305 }; | 305 }; |
| 306 | 306 |
| 307 //----------------------------------------------------------------------------- | 307 //----------------------------------------------------------------------------- |
| 308 // helpers | 308 // helpers |
| 309 | 309 |
| 310 // read the transaction completely | 310 // read the transaction completely |
| 311 int ReadTransaction(net::HttpTransaction* trans, std::string* result); | 311 int ReadTransaction(net::HttpTransaction* trans, std::string* result); |
| 312 | 312 |
| 313 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 313 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
| OLD | NEW |