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

Unified Diff: net/http/http_transaction_test_util.cc

Issue 2721933002: HttpCache::Transaction layer allowing parallel validation (Closed)
Patch Set: Truncation and StopCaching changes. Created 3 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
Index: net/http/http_transaction_test_util.cc
diff --git a/net/http/http_transaction_test_util.cc b/net/http/http_transaction_test_util.cc
index a5b57461df5a2e49568fa045bc285f9d01e006bc..fa42dd78f5a0c19cce3d4a0c0329ce8f08742cb5 100644
--- a/net/http/http_transaction_test_util.cc
+++ b/net/http/http_transaction_test_util.cc
@@ -409,13 +409,6 @@ int MockNetworkTransaction::StartInternal(const HttpRequestInfo* request,
if (!t)
return ERR_FAILED;
- if (!before_network_start_callback_.is_null()) {
- bool defer = false;
- before_network_start_callback_.Run(&defer);
- if (defer)
- return net::ERR_IO_PENDING;
- }
-
test_mode_ = t->test_mode;
// Return immediately if we're returning an error.
@@ -466,6 +459,16 @@ int MockNetworkTransaction::StartInternal(const HttpRequestInfo* request,
if (request_->load_flags & LOAD_PREFETCH)
response_.unused_since_prefetch = true;
+ // Pause and resume.
+ if (!before_network_start_callback_.is_null()) {
+ bool defer = false;
+ before_network_start_callback_.Run(&defer);
+ if (defer) {
+ callback_ = callback;
+ return net::ERR_IO_PENDING;
+ }
+ }
+
if (test_mode_ & TEST_MODE_SYNC_NET_START)
return OK;
@@ -482,8 +485,9 @@ void MockNetworkTransaction::SetBeforeHeadersSentCallback(
const BeforeHeadersSentCallback& callback) {}
int MockNetworkTransaction::ResumeNetworkStart() {
- // Should not get here.
- return ERR_FAILED;
+ DCHECK(!callback_.is_null());
+ CallbackLater(callback_, OK);
+ return ERR_IO_PENDING;
}
void MockNetworkTransaction::GetConnectionAttempts(

Powered by Google App Engine
This is Rietveld 408576698