OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 30 matching lines...) Expand all Loading... |
41 TEST_MODE_SYNC_CACHE_START | TEST_MODE_SYNC_CACHE_READ | | 41 TEST_MODE_SYNC_CACHE_START | TEST_MODE_SYNC_CACHE_READ | |
42 TEST_MODE_SYNC_CACHE_WRITE) | 42 TEST_MODE_SYNC_CACHE_WRITE) |
43 }; | 43 }; |
44 | 44 |
45 typedef void (*MockTransactionHandler)(const net::HttpRequestInfo* request, | 45 typedef void (*MockTransactionHandler)(const net::HttpRequestInfo* request, |
46 std::string* response_status, | 46 std::string* response_status, |
47 std::string* response_headers, | 47 std::string* response_headers, |
48 std::string* response_data); | 48 std::string* response_data); |
49 | 49 |
50 struct MockTransaction { | 50 struct MockTransaction { |
| 51 // Net error code returned as a result of starting the transaction. If not |
| 52 // net::OK, all response-related fields will be ignored. Must not be |
| 53 // ERR_IO_PENDING. |
| 54 net::Error start_result; |
| 55 |
51 const char* url; | 56 const char* url; |
52 const char* method; | 57 const char* method; |
53 // If |request_time| is unspecified, the current time will be used. | 58 // If |request_time| is unspecified, the current time will be used. |
54 base::Time request_time; | 59 base::Time request_time; |
55 const char* request_headers; | 60 const char* request_headers; |
56 int load_flags; | 61 int load_flags; |
57 const char* status; | 62 const char* status; |
58 const char* response_headers; | 63 const char* response_headers; |
59 // If |response_time| is unspecified, the current time will be used. | 64 // If |response_time| is unspecified, the current time will be used. |
60 base::Time response_time; | 65 base::Time response_time; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 bool done_reading_called_; | 225 bool done_reading_called_; |
221 }; | 226 }; |
222 | 227 |
223 //----------------------------------------------------------------------------- | 228 //----------------------------------------------------------------------------- |
224 // helpers | 229 // helpers |
225 | 230 |
226 // read the transaction completely | 231 // read the transaction completely |
227 int ReadTransaction(net::HttpTransaction* trans, std::string* result); | 232 int ReadTransaction(net::HttpTransaction* trans, std::string* result); |
228 | 233 |
229 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 234 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
OLD | NEW |