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 25 matching lines...) Expand all Loading... |
36 // these flags may be combined to form the test_mode field | 36 // these flags may be combined to form the test_mode field |
37 enum { | 37 enum { |
38 TEST_MODE_NORMAL = 0, | 38 TEST_MODE_NORMAL = 0, |
39 TEST_MODE_SYNC_NET_START = 1 << 0, | 39 TEST_MODE_SYNC_NET_START = 1 << 0, |
40 TEST_MODE_SYNC_NET_READ = 1 << 1, | 40 TEST_MODE_SYNC_NET_READ = 1 << 1, |
41 TEST_MODE_SYNC_CACHE_START = 1 << 2, | 41 TEST_MODE_SYNC_CACHE_START = 1 << 2, |
42 TEST_MODE_SYNC_CACHE_READ = 1 << 3, | 42 TEST_MODE_SYNC_CACHE_READ = 1 << 3, |
43 TEST_MODE_SYNC_CACHE_WRITE = 1 << 4, | 43 TEST_MODE_SYNC_CACHE_WRITE = 1 << 4, |
44 TEST_MODE_SYNC_ALL = (TEST_MODE_SYNC_NET_START | TEST_MODE_SYNC_NET_READ | | 44 TEST_MODE_SYNC_ALL = (TEST_MODE_SYNC_NET_START | TEST_MODE_SYNC_NET_READ | |
45 TEST_MODE_SYNC_CACHE_START | TEST_MODE_SYNC_CACHE_READ | | 45 TEST_MODE_SYNC_CACHE_START | TEST_MODE_SYNC_CACHE_READ | |
46 TEST_MODE_SYNC_CACHE_WRITE) | 46 TEST_MODE_SYNC_CACHE_WRITE), |
| 47 TEST_MODE_SLOW_READ = 1 << 5 |
47 }; | 48 }; |
48 | 49 |
49 typedef void (*MockTransactionHandler)(const net::HttpRequestInfo* request, | 50 typedef void (*MockTransactionHandler)(const net::HttpRequestInfo* request, |
50 std::string* response_status, | 51 std::string* response_status, |
51 std::string* response_headers, | 52 std::string* response_headers, |
52 std::string* response_data); | 53 std::string* response_data); |
53 | 54 |
54 struct MockTransaction { | 55 struct MockTransaction { |
55 const char* url; | 56 const char* url; |
56 const char* method; | 57 const char* method; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 base::WeakPtr<MockNetworkTransaction> last_transaction_; | 297 base::WeakPtr<MockNetworkTransaction> last_transaction_; |
297 }; | 298 }; |
298 | 299 |
299 //----------------------------------------------------------------------------- | 300 //----------------------------------------------------------------------------- |
300 // helpers | 301 // helpers |
301 | 302 |
302 // read the transaction completely | 303 // read the transaction completely |
303 int ReadTransaction(net::HttpTransaction* trans, std::string* result); | 304 int ReadTransaction(net::HttpTransaction* trans, std::string* result); |
304 | 305 |
305 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 306 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
OLD | NEW |