Chromium Code Reviews| 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* http_request_info() const { | |
|
mef
2014/07/23 18:34:30
nit: nl above, maybe name it |request()| to match
Randy Smith (Not in Mondays)
2014/07/29 23:44:22
The nl doesn't fit to my eye with the relationship
mef
2014/07/30 17:14:58
Acknowledged.
| |
| 232 return request_; | |
| 233 } | |
| 230 | 234 |
| 231 private: | 235 private: |
| 232 int StartInternal(const net::HttpRequestInfo* request, | 236 int StartInternal(const net::HttpRequestInfo* request, |
| 233 const net::CompletionCallback& callback, | 237 const net::CompletionCallback& callback, |
| 234 const net::BoundNetLog& net_log); | 238 const net::BoundNetLog& net_log); |
| 235 void CallbackLater(const net::CompletionCallback& callback, int result); | 239 void CallbackLater(const net::CompletionCallback& callback, int result); |
| 236 void RunCallback(const net::CompletionCallback& callback, int result); | 240 void RunCallback(const net::CompletionCallback& callback, int result); |
| 237 | 241 |
| 238 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_; | 242 base::WeakPtrFactory<MockNetworkTransaction> weak_factory_; |
| 239 const net::HttpRequestInfo* request_; | 243 const net::HttpRequestInfo* request_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 base::WeakPtr<MockNetworkTransaction> last_transaction_; | 304 base::WeakPtr<MockNetworkTransaction> last_transaction_; |
| 301 }; | 305 }; |
| 302 | 306 |
| 303 //----------------------------------------------------------------------------- | 307 //----------------------------------------------------------------------------- |
| 304 // helpers | 308 // helpers |
| 305 | 309 |
| 306 // read the transaction completely | 310 // read the transaction completely |
| 307 int ReadTransaction(net::HttpTransaction* trans, std::string* result); | 311 int ReadTransaction(net::HttpTransaction* trans, std::string* result); |
| 308 | 312 |
| 309 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ | 313 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ |
| OLD | NEW |