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

Unified Diff: net/url_request/url_request_test_util.cc

Issue 1888963004: Add HttpProtocolHandler and convert everything to use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-supports-scheme
Patch Set: even more rebase Created 4 years, 8 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/url_request/url_request_test_util.cc
diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc
index 3f9ffb53fef1f3f9758b9cdef15cbfad1072443d..bf984948257da8559c737604e8168ed5561e05d9 100644
--- a/net/url_request/url_request_test_util.cc
+++ b/net/url_request/url_request_test_util.cc
@@ -25,6 +25,7 @@
#include "net/http/transport_security_state.h"
#include "net/ssl/channel_id_service.h"
#include "net/ssl/default_channel_id_store.h"
+#include "net/url_request/http_protocol_handler.h"
#include "net/url_request/static_http_user_agent_settings.h"
#include "net/url_request/url_request_job.h"
#include "net/url_request/url_request_job_factory_impl.h"
@@ -139,7 +140,7 @@ void TestURLRequestContext::Init() {
}
if (!job_factory()) {
context_storage_.set_job_factory(
- base::WrapUnique(new URLRequestJobFactoryImpl()));
+ URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers());
}
}
@@ -647,14 +648,19 @@ bool TestNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader(
return cancel_request_with_policy_violating_referrer_;
}
-TestJobInterceptor::TestJobInterceptor() {}
+TestJobInterceptor::TestJobInterceptor() {
+ http_protocol_handler_ = base::WrapUnique(new HttpProtocolHandler);
+}
TestJobInterceptor::~TestJobInterceptor() {}
URLRequestJob* TestJobInterceptor::MaybeCreateJob(
URLRequest* request,
NetworkDelegate* network_delegate) const {
- return main_intercept_job_.release();
+ URLRequestJob* job = main_intercept_job_.release();
+ if (job)
+ return job;
+ return http_protocol_handler_->MaybeCreateJob(request, network_delegate);
mmenke 2016/04/21 20:58:01 How hard would it be to make TestJobInterceptor a
mgersh 2016/04/22 20:27:15 It's enough work that I'd rather not bundle it wit
mmenke 2016/04/22 20:41:04 Unconditionally calling directly into our own priv
mgersh 2016/04/27 16:13:52 Okay, I changed it to an interceptor here.
}
void TestJobInterceptor::set_main_intercept_job(

Powered by Google App Engine
This is Rietveld 408576698