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_TEST_UTIL_H_ | 5 #ifndef NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_ |
6 #define NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_ | 6 #define NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_ |
7 | 7 |
8 #include "net/http/http_transaction.h" | 8 #include "net/http/http_transaction.h" |
9 | 9 |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 base::Time response_time; | 76 base::Time response_time; |
77 const char* data; | 77 const char* data; |
78 int test_mode; | 78 int test_mode; |
79 MockTransactionHandler handler; | 79 MockTransactionHandler handler; |
80 MockTransactionReadHandler read_handler; | 80 MockTransactionReadHandler read_handler; |
81 scoped_refptr<X509Certificate> cert; | 81 scoped_refptr<X509Certificate> cert; |
82 CertStatus cert_status; | 82 CertStatus cert_status; |
83 int ssl_connection_status; | 83 int ssl_connection_status; |
84 // Value returned by MockNetworkTransaction::Start (potentially | 84 // Value returned by MockNetworkTransaction::Start (potentially |
85 // asynchronously if |!(test_mode & TEST_MODE_SYNC_NET_START)|.) | 85 // asynchronously if |!(test_mode & TEST_MODE_SYNC_NET_START)|.) |
86 Error return_code; | 86 Error start_return_code; |
| 87 // Value returned by MockNetworkTransaction::Read (potentially |
| 88 // asynchronously if |!(test_mode & TEST_MODE_SYNC_NET_START)|.) |
| 89 Error read_return_code; |
87 }; | 90 }; |
88 | 91 |
89 extern const MockTransaction kSimpleGET_Transaction; | 92 extern const MockTransaction kSimpleGET_Transaction; |
90 extern const MockTransaction kSimplePOST_Transaction; | 93 extern const MockTransaction kSimplePOST_Transaction; |
91 extern const MockTransaction kTypicalGET_Transaction; | 94 extern const MockTransaction kTypicalGET_Transaction; |
92 extern const MockTransaction kETagGET_Transaction; | 95 extern const MockTransaction kETagGET_Transaction; |
93 extern const MockTransaction kRangeGET_Transaction; | 96 extern const MockTransaction kRangeGET_Transaction; |
94 | 97 |
95 // returns the mock transaction for the given URL | 98 // returns the mock transaction for the given URL |
96 const MockTransaction* FindMockTransaction(const GURL& url); | 99 const MockTransaction* FindMockTransaction(const GURL& url); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 void SetBeforeHeadersSentCallback( | 237 void SetBeforeHeadersSentCallback( |
235 const BeforeHeadersSentCallback& callback) override; | 238 const BeforeHeadersSentCallback& callback) override; |
236 | 239 |
237 int ResumeNetworkStart() override; | 240 int ResumeNetworkStart() override; |
238 | 241 |
239 void GetConnectionAttempts(ConnectionAttempts* out) const override; | 242 void GetConnectionAttempts(ConnectionAttempts* out) const override; |
240 | 243 |
241 CreateHelper* websocket_handshake_stream_create_helper() { | 244 CreateHelper* websocket_handshake_stream_create_helper() { |
242 return websocket_handshake_stream_create_helper_; | 245 return websocket_handshake_stream_create_helper_; |
243 } | 246 } |
| 247 |
244 RequestPriority priority() const { return priority_; } | 248 RequestPriority priority() const { return priority_; } |
245 const HttpRequestInfo* request() const { return request_; } | 249 const HttpRequestInfo* request() const { return request_; } |
246 | 250 |
247 // Bogus value that will be returned by GetTotalReceivedBytes() if the | 251 // Bogus value that will be returned by GetTotalReceivedBytes() if the |
248 // MockNetworkTransaction was started. | 252 // MockNetworkTransaction was started. |
249 static const int64_t kTotalReceivedBytes; | 253 static const int64_t kTotalReceivedBytes; |
250 // Bogus value that will be returned by GetTotalSentBytes() if the | 254 // Bogus value that will be returned by GetTotalSentBytes() if the |
251 // MockNetworkTransaction was started. | 255 // MockNetworkTransaction was started. |
252 static const int64_t kTotalSentBytes; | 256 static const int64_t kTotalSentBytes; |
253 | 257 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 355 |
352 //----------------------------------------------------------------------------- | 356 //----------------------------------------------------------------------------- |
353 // helpers | 357 // helpers |
354 | 358 |
355 // read the transaction completely | 359 // read the transaction completely |
356 int ReadTransaction(HttpTransaction* trans, std::string* result); | 360 int ReadTransaction(HttpTransaction* trans, std::string* result); |
357 | 361 |
358 } // namespace net | 362 } // namespace net |
359 | 363 |
360 #endif // NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_ | 364 #endif // NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_ |
OLD | NEW |