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

Unified Diff: net/http/http_stream_factory_impl_request_unittest.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: Created 4 years, 7 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_impl_request_unittest.cc
diff --git a/net/http/http_stream_factory_impl_request_unittest.cc b/net/http/http_stream_factory_impl_request_unittest.cc
index 03eb2e52fdc4bdfc91272c77df8dc861303b9365..700948337812c5abdce5d1ce3eedac75b4c2f755 100644
--- a/net/http/http_stream_factory_impl_request_unittest.cc
+++ b/net/http/http_stream_factory_impl_request_unittest.cc
@@ -92,9 +92,12 @@ TEST_P(HttpStreamFactoryImplRequestTest, SetPriority) {
GURL original_url = factory->ApplyHostMappingRules(request_info.url, &server);
HttpStreamFactoryImpl::Job* job = new HttpStreamFactoryImpl::Job(
- job_controller, session.get(), request_info, DEFAULT_PRIORITY,
- SSLConfig(), SSLConfig(), server, original_url, NULL);
+ job_controller, HttpStreamFactoryImpl::NON_ALTERNATIVE, session.get(),
+ request_info, DEFAULT_PRIORITY, SSLConfig(), SSLConfig(), server,
+ original_url, NULL);
job_controller->AttachJob(job);
+ job_controller->main_job_ = job;
+
EXPECT_EQ(DEFAULT_PRIORITY, job->priority());
request.SetPriority(MEDIUM);
@@ -138,29 +141,33 @@ TEST_P(HttpStreamFactoryImplRequestTest, DelayMainJob) {
GURL original_url = factory->ApplyHostMappingRules(request_info.url, &server);
HttpStreamFactoryImpl::Job* job = new HttpStreamFactoryImpl::Job(
- job_controller, session.get(), request_info, DEFAULT_PRIORITY,
- SSLConfig(), SSLConfig(), server, original_url, NULL);
+ job_controller, HttpStreamFactoryImpl::NON_ALTERNATIVE, session.get(),
+ request_info, DEFAULT_PRIORITY, SSLConfig(), SSLConfig(), server,
+ original_url, NULL);
job_controller->AttachJob(job);
+ job_controller->main_job_ = job;
+
EXPECT_EQ(DEFAULT_PRIORITY, job->priority());
AlternativeService alternative_service(net::NPN_HTTP_2, server);
HttpStreamFactoryImpl::Job* alternative_job = new HttpStreamFactoryImpl::Job(
- job_controller, session.get(), request_info, DEFAULT_PRIORITY,
- SSLConfig(), SSLConfig(), server, original_url, alternative_service,
- NULL);
+ job_controller, HttpStreamFactoryImpl::ALTERNATIVE, session.get(),
+ request_info, DEFAULT_PRIORITY, SSLConfig(), SSLConfig(), server,
+ original_url, alternative_service, NULL);
job_controller->AttachJob(alternative_job);
+ job_controller->alternative_job_ = alternative_job;
- job->WaitFor(alternative_job);
+ job_controller->racing_ = true;
EXPECT_EQ(HttpStreamFactoryImpl::Job::STATE_NONE, job->next_state_);
// Test |alternative_job| resuming the |job| after delay.
int wait_time = 1;
base::TimeDelta delay = base::TimeDelta::FromMilliseconds(wait_time);
- job->Resume(alternative_job, delay);
+ job_controller->MaybeResumeOtherJob(alternative_job, delay);
- // Verify |job| has |wait_time_| and there is no |blocking_job_|
+ // Verify |job| has |wait_time_| and there is no blocking job.
EXPECT_EQ(delay, job->wait_time_);
- EXPECT_TRUE(!job->blocking_job_);
+ EXPECT_TRUE(!job_controller->racing());
// Start the |job| and verify |job|'s |wait_time_| is cleared.
job->Start(&request);

Powered by Google App Engine
This is Rietveld 408576698