Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Unified Diff: net/http/http_transaction_test_util.h

Issue 2089783002: [net/cache] Avoid the cache for responses exceeding 2GB. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build for configurations where DCHECK is disabled. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/http/http_transaction_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/http/http_transaction_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698