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

Unified Diff: net/http/http_stream_factory_test_util.cc

Issue 1952423002: JobController 2: Remove reference between HttpStreamFactoryImpl::Jobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Job_Controller_1
Patch Set: use unmocked Job::Start() and asyncronous Proxy resolution in tests Created 4 years, 5 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_stream_factory_test_util.cc
diff --git a/net/http/http_stream_factory_test_util.cc b/net/http/http_stream_factory_test_util.cc
index 9b988b1594f953e89906d8946f9686f23b4a711f..4f6657ae8aa5d1582b608d323a5090661dd697d7 100644
--- a/net/http/http_stream_factory_test_util.cc
+++ b/net/http/http_stream_factory_test_util.cc
@@ -62,7 +62,10 @@ MockHttpStreamFactoryImplJob::MockHttpStreamFactoryImplJob(
MockHttpStreamFactoryImplJob::~MockHttpStreamFactoryImplJob() {}
TestJobFactory::TestJobFactory()
- : main_job_(nullptr), alternative_job_(nullptr) {}
+ : main_job_(nullptr),
+ alternative_job_(nullptr),
+ disable_mocked_start_(false),
+ override_main_job_url_(false) {}
TestJobFactory::~TestJobFactory() {}
@@ -78,11 +81,21 @@ HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
GURL origin_url,
NetLog* net_log) {
DCHECK(!main_job_);
+
+ if (override_main_job_url_)
+ origin_url = main_job_alternative_url_;
+
main_job_ = new MockHttpStreamFactoryImplJob(
delegate, job_type, session, request_info, priority, SSLConfig(),
SSLConfig(), destination, origin_url, nullptr);
- EXPECT_CALL(*main_job_, Start(_)).Times(1);
+ if (disable_mocked_start_) {
+ EXPECT_CALL(*main_job_, Start(_))
+ .WillOnce(
+ Invoke(main_job_, &MockHttpStreamFactoryImplJob::UnmockedStart));
+ } else {
+ EXPECT_CALL(*main_job_, Start(_)).Times(1);
+ }
return main_job_;
}
@@ -104,7 +117,13 @@ HttpStreamFactoryImpl::Job* TestJobFactory::CreateJob(
delegate, job_type, session, request_info, priority, SSLConfig(),
SSLConfig(), destination, origin_url, alternative_service, nullptr);
- EXPECT_CALL(*alternative_job_, Start(_)).Times(1);
+ if (disable_mocked_start_) {
+ EXPECT_CALL(*alternative_job_, Start(_))
+ .WillOnce(Invoke(alternative_job_,
+ &MockHttpStreamFactoryImplJob::UnmockedStart));
+ } else {
+ EXPECT_CALL(*alternative_job_, Start(_)).Times(1);
+ }
return alternative_job_;
}

Powered by Google App Engine
This is Rietveld 408576698