Index: net/http/http_transaction_test_util.h |
diff --git a/net/http/http_transaction_test_util.h b/net/http/http_transaction_test_util.h |
index 716009f4b4b576ee95ab33acbd1d067abbd9139c..21d2b623cbb96c3acc3de64dc598cc9629077458 100644 |
--- a/net/http/http_transaction_test_util.h |
+++ b/net/http/http_transaction_test_util.h |
@@ -54,10 +54,14 @@ enum { |
TEST_MODE_SLOW_READ = 1 << 5 |
}; |
-typedef void (*MockTransactionHandler)(const HttpRequestInfo* request, |
- std::string* response_status, |
- std::string* response_headers, |
- std::string* response_data); |
+using MockTransactionReadHandler = int (*)(int64_t content_length, |
+ int64_t offset, |
+ IOBuffer* buf, |
+ int buf_len); |
+using MockTransactionHandler = void (*)(const HttpRequestInfo* request, |
+ std::string* response_status, |
+ std::string* response_headers, |
+ std::string* response_data); |
struct MockTransaction { |
const char* url; |
@@ -73,6 +77,7 @@ struct MockTransaction { |
const char* data; |
int test_mode; |
MockTransactionHandler handler; |
+ MockTransactionReadHandler read_handler; |
scoped_refptr<X509Certificate> cert; |
CertStatus cert_status; |
int ssl_connection_status; |
@@ -258,10 +263,13 @@ class MockNetworkTransaction |
const HttpRequestInfo* request_; |
HttpResponseInfo response_; |
std::string data_; |
- int data_cursor_; |
+ int64_t data_cursor_; |
+ int64_t content_length_; |
int test_mode_; |
RequestPriority priority_; |
+ MockTransactionReadHandler read_handler_; |
CreateHelper* websocket_handshake_stream_create_helper_; |
+ BeforeNetworkStartCallback before_network_start_callback_; |
base::WeakPtr<MockNetworkLayer> transaction_factory_; |
int64_t received_bytes_; |
int64_t sent_bytes_; |
@@ -289,6 +297,10 @@ class MockNetworkLayer : public HttpTransactionFactory, |
void TransactionDoneReading(); |
void TransactionStopCaching(); |
+ // Resets the transaction count. Can be called after test setup in order to |
+ // make test expectations independent of how test setup is performed. |
+ void ResetTransactionCount(); |
+ |
// Returns the last priority passed to CreateTransaction, or |
// DEFAULT_PRIORITY if it hasn't been called yet. |
RequestPriority last_create_transaction_priority() const { |