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

Unified Diff: net/http/http_transaction_test_util.cc

Issue 2721933002: HttpCache::Transaction layer allowing parallel validation (Closed)
Patch Set: nit addressed 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
« no previous file with comments | « net/http/http_transaction_test_util.h ('k') | net/http/mock_http_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2d728cfb81fb364979d5cb5129823d0932f068fb 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) {
+ resume_start_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(!resume_start_callback_.is_null());
+ CallbackLater(resume_start_callback_, OK);
+ return ERR_IO_PENDING;
}
void MockNetworkTransaction::GetConnectionAttempts(
« no previous file with comments | « net/http/http_transaction_test_util.h ('k') | net/http/mock_http_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698