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 10 matching lines...) Expand all Loading... |
21 #include "net/base/test_completion_callback.h" | 21 #include "net/base/test_completion_callback.h" |
22 #include "net/disk_cache/disk_cache.h" | 22 #include "net/disk_cache/disk_cache.h" |
23 #include "net/http/http_cache.h" | 23 #include "net/http/http_cache.h" |
24 #include "net/http/http_request_info.h" | 24 #include "net/http/http_request_info.h" |
25 #include "net/http/http_response_headers.h" | 25 #include "net/http/http_response_headers.h" |
26 #include "net/http/http_response_info.h" | 26 #include "net/http/http_response_info.h" |
27 | 27 |
28 namespace net { | 28 namespace net { |
29 class HttpRequestHeaders; | 29 class HttpRequestHeaders; |
30 class IOBuffer; | 30 class IOBuffer; |
| 31 struct HttpRequestInfo; |
31 } | 32 } |
32 | 33 |
33 //----------------------------------------------------------------------------- | 34 //----------------------------------------------------------------------------- |
34 // mock transaction data | 35 // mock transaction data |
35 | 36 |
36 // these flags may be combined to form the test_mode field | 37 // these flags may be combined to form the test_mode field |
37 enum { | 38 enum { |
38 TEST_MODE_NORMAL = 0, | 39 TEST_MODE_NORMAL = 0, |
39 TEST_MODE_SYNC_NET_START = 1 << 0, | 40 TEST_MODE_SYNC_NET_START = 1 << 0, |
40 TEST_MODE_SYNC_NET_READ = 1 << 1, | 41 TEST_MODE_SYNC_NET_READ = 1 << 1, |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 221 |
221 virtual void SetBeforeProxyHeadersSentCallback( | 222 virtual void SetBeforeProxyHeadersSentCallback( |
222 const BeforeProxyHeadersSentCallback& callback) OVERRIDE; | 223 const BeforeProxyHeadersSentCallback& callback) OVERRIDE; |
223 | 224 |
224 virtual int ResumeNetworkStart() OVERRIDE; | 225 virtual int ResumeNetworkStart() OVERRIDE; |
225 | 226 |
226 CreateHelper* websocket_handshake_stream_create_helper() { | 227 CreateHelper* websocket_handshake_stream_create_helper() { |
227 return websocket_handshake_stream_create_helper_; | 228 return websocket_handshake_stream_create_helper_; |
228 } | 229 } |
229 net::RequestPriority priority() const { return priority_; } | 230 net::RequestPriority priority() const { return priority_; } |
| 231 const net::HttpRequestInfo* request() const { return request_; } |
230 | 232 |
231 private: | 233 private: |
232 int StartInternal(const net::HttpRequestInfo* request, | 234 int StartInternal(const net::HttpRequestInfo* request, |
233 const net::CompletionCallback& callback, | 235 const net::CompletionCallback& callback, |
234 const net::BoundNetLog& net_log); | 236 const net::BoundNetLog& net_log); |
235 void CallbackLater(const net::CompletionCallback& callback, int result); | 237 void CallbackLater(const net::CompletionCallback& callback, int result); |
236 void RunCallback(const net::CompletionCallback& callback, int result); | 238 void RunCallback(const net::CompletionCallback& callback, int result); |
237 | 239 |
238 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_; | 240 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_; |
239 const net::HttpRequestInfo* request_; | 241 const net::HttpRequestInfo* request_; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 base::WeakPtr<MockNetworkTransaction> last_transaction_; | 302 base::WeakPtr<MockNetworkTransaction> last_transaction_; |
301 }; | 303 }; |
302 | 304 |
303 //----------------------------------------------------------------------------- | 305 //----------------------------------------------------------------------------- |
304 // helpers | 306 // helpers |
305 | 307 |
306 // read the transaction completely | 308 // read the transaction completely |
307 int ReadTransaction(net::HttpTransaction* trans, std::string* result); | 309 int ReadTransaction(net::HttpTransaction* trans, std::string* result); |
308 | 310 |
309 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 311 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
OLD | NEW |