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

Unified Diff: net/http/http_transaction_test_util.cc

Issue 455623003: stale-while-revalidate experimental implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 2 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 7d031d8023886c53ef20d3853676abe35bc140a6..dbbca6c3d9e9bff6c2c8cc8f808154bfe2df88c2 100644
--- a/net/http/http_transaction_test_util.cc
+++ b/net/http/http_transaction_test_util.cc
@@ -277,8 +277,13 @@ bool MockNetworkTransaction::IsReadyToRestartForAuth() {
if (!request_)
return false;
- // Only mock auth when the test asks for it.
- return request_->extra_headers.HasHeader("X-Require-Mock-Auth");
+ if (!request_->extra_headers.HasHeader("X-Require-Mock-Auth"))
+ return false;
+
+ // Allow the mock server to decide whether authentication is required or not.
+ std::string status_line = response_.headers->GetStatusLine();
+ return status_line.find(" 401 ") != std::string::npos ||
+ status_line.find(" 407 ") != std::string::npos;
}
int MockNetworkTransaction::Read(net::IOBuffer* buf, int buf_len,

Powered by Google App Engine
This is Rietveld 408576698