| 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 06c9445170cefce394935fc4feef2753d9080231..03eb2e52fdc4bdfc91272c77df8dc861303b9365 100644
|
| --- a/net/http/http_stream_factory_impl_request_unittest.cc
|
| +++ b/net/http/http_stream_factory_impl_request_unittest.cc
|
| @@ -7,6 +7,7 @@
|
| #include <memory>
|
|
|
| #include "net/http/http_stream_factory_impl_job.h"
|
| +#include "net/http/http_stream_factory_impl_job_controller.h"
|
| #include "net/proxy/proxy_info.h"
|
| #include "net/proxy/proxy_service.h"
|
| #include "net/spdy/spdy_test_util_common.h"
|
| @@ -75,11 +76,15 @@ TEST_P(HttpStreamFactoryImplRequestTest, SetPriority) {
|
| SpdySessionDependencies::SpdyCreateSession(&session_deps);
|
| HttpStreamFactoryImpl* factory =
|
| static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory());
|
| + HttpStreamFactoryImpl::JobController* job_controller =
|
| + new HttpStreamFactoryImpl::JobController(factory);
|
| + factory->job_controller_set_.insert(job_controller);
|
|
|
| DoNothingRequestDelegate request_delegate;
|
| HttpStreamFactoryImpl::Request request(
|
| - GURL(), factory, &request_delegate, NULL, BoundNetLog(),
|
| + GURL(), job_controller, &request_delegate, NULL, BoundNetLog(),
|
| HttpStreamFactoryImpl::Request::HTTP_STREAM);
|
| + job_controller->request_ = &request;
|
|
|
| HttpRequestInfo request_info;
|
|
|
| @@ -87,17 +92,17 @@ TEST_P(HttpStreamFactoryImplRequestTest, SetPriority) {
|
| GURL original_url = factory->ApplyHostMappingRules(request_info.url, &server);
|
|
|
| HttpStreamFactoryImpl::Job* job = new HttpStreamFactoryImpl::Job(
|
| - factory, session.get(), request_info, DEFAULT_PRIORITY, SSLConfig(),
|
| - SSLConfig(), server, original_url, NULL);
|
| - request.AttachJob(job);
|
| + job_controller, session.get(), request_info, DEFAULT_PRIORITY,
|
| + SSLConfig(), SSLConfig(), server, original_url, NULL);
|
| + job_controller->AttachJob(job);
|
| EXPECT_EQ(DEFAULT_PRIORITY, job->priority());
|
|
|
| request.SetPriority(MEDIUM);
|
| EXPECT_EQ(MEDIUM, job->priority());
|
|
|
| // Make |job| the bound job.
|
| - request.OnStreamFailed(job, ERR_FAILED, SSLConfig(), SSL_FAILURE_NONE);
|
| -
|
| + job_controller->OnStreamFailed(job, ERR_FAILED, SSLConfig(),
|
| + SSL_FAILURE_NONE);
|
| request.SetPriority(IDLE);
|
| EXPECT_EQ(IDLE, job->priority());
|
| }
|
| @@ -115,6 +120,9 @@ TEST_P(HttpStreamFactoryImplRequestTest, DelayMainJob) {
|
|
|
| HttpStreamFactoryImpl* factory =
|
| static_cast<HttpStreamFactoryImpl*>(session->http_stream_factory());
|
| + HttpStreamFactoryImpl::JobController* job_controller =
|
| + new HttpStreamFactoryImpl::JobController(factory);
|
| + factory->job_controller_set_.insert(job_controller);
|
|
|
| DoNothingRequestDelegate request_delegate;
|
| HttpRequestInfo request_info;
|
| @@ -122,23 +130,25 @@ TEST_P(HttpStreamFactoryImplRequestTest, DelayMainJob) {
|
| request_info.url = GURL("http://www.google.com");
|
|
|
| HttpStreamFactoryImpl::Request request(
|
| - request_info.url, factory, &request_delegate, NULL, BoundNetLog(),
|
| + request_info.url, job_controller, &request_delegate, NULL, BoundNetLog(),
|
| HttpStreamFactoryImpl::Request::HTTP_STREAM);
|
| + job_controller->request_ = &request;
|
|
|
| HostPortPair server = HostPortPair::FromURL(request_info.url);
|
| GURL original_url = factory->ApplyHostMappingRules(request_info.url, &server);
|
|
|
| HttpStreamFactoryImpl::Job* job = new HttpStreamFactoryImpl::Job(
|
| - factory, session.get(), request_info, DEFAULT_PRIORITY, SSLConfig(),
|
| - SSLConfig(), server, original_url, NULL);
|
| - request.AttachJob(job);
|
| + job_controller, session.get(), request_info, DEFAULT_PRIORITY,
|
| + SSLConfig(), SSLConfig(), server, original_url, NULL);
|
| + job_controller->AttachJob(job);
|
| EXPECT_EQ(DEFAULT_PRIORITY, job->priority());
|
|
|
| AlternativeService alternative_service(net::NPN_HTTP_2, server);
|
| HttpStreamFactoryImpl::Job* alternative_job = new HttpStreamFactoryImpl::Job(
|
| - factory, session.get(), request_info, DEFAULT_PRIORITY, SSLConfig(),
|
| - SSLConfig(), server, original_url, alternative_service, NULL);
|
| - request.AttachJob(alternative_job);
|
| + job_controller, session.get(), request_info, DEFAULT_PRIORITY,
|
| + SSLConfig(), SSLConfig(), server, original_url, alternative_service,
|
| + NULL);
|
| + job_controller->AttachJob(alternative_job);
|
|
|
| job->WaitFor(alternative_job);
|
| EXPECT_EQ(HttpStreamFactoryImpl::Job::STATE_NONE, job->next_state_);
|
|
|