| Index: net/http/http_stream_factory_impl_job_controller_unittest.cc
|
| diff --git a/net/http/http_stream_factory_impl_job_controller_unittest.cc b/net/http/http_stream_factory_impl_job_controller_unittest.cc
|
| index 6024ac0c087968780dcd4155ba1bafe70883ed0e..1c787fa7501575259f1dd9b474e184277e02d2ef 100644
|
| --- a/net/http/http_stream_factory_impl_job_controller_unittest.cc
|
| +++ b/net/http/http_stream_factory_impl_job_controller_unittest.cc
|
| @@ -9,6 +9,7 @@
|
|
|
| #include "base/memory/ptr_util.h"
|
| #include "base/run_loop.h"
|
| +#include "base/strings/stringprintf.h"
|
| #include "base/test/histogram_tester.h"
|
| #include "base/test/scoped_feature_list.h"
|
| #include "base/test/scoped_mock_time_message_loop_task_runner.h"
|
| @@ -141,6 +142,12 @@ class HttpStreamFactoryImplJobPeer {
|
| static int GetNumStreams(const HttpStreamFactoryImpl::Job* job) {
|
| return job->num_streams_;
|
| }
|
| +
|
| + // Return SpdySessionKey of |job|.
|
| + static const SpdySessionKey GetSpdySessionKey(
|
| + const HttpStreamFactoryImpl::Job* job) {
|
| + return job->GetSpdySessionKey();
|
| + }
|
| };
|
|
|
| class JobControllerPeer {
|
| @@ -725,6 +732,45 @@ TEST_F(HttpStreamFactoryImplJobControllerTest,
|
| EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_));
|
| }
|
|
|
| +TEST_F(HttpStreamFactoryImplJobControllerTest,
|
| + SpdySessionKeyHasOriginHostPortPair) {
|
| + session_deps_.enable_http2_alternative_service = true;
|
| +
|
| + const char origin_host[] = "www.example.org";
|
| + const uint16_t origin_port = 443;
|
| + const char alternative_host[] = "mail.example.org";
|
| + const uint16_t alternative_port = 123;
|
| +
|
| + HttpRequestInfo request_info;
|
| + request_info.method = "GET";
|
| + request_info.url =
|
| + GURL(base::StringPrintf("https://%s:%u", origin_host, origin_port));
|
| + Initialize(request_info);
|
| +
|
| + url::SchemeHostPort server(request_info.url);
|
| + AlternativeService alternative_service(kProtoHTTP2, alternative_host,
|
| + alternative_port);
|
| + SetAlternativeService(request_info, alternative_service);
|
| +
|
| + request_.reset(
|
| + job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(),
|
| + HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY));
|
| +
|
| + HostPortPair main_host_port_pair =
|
| + HttpStreamFactoryImplJobPeer::GetSpdySessionKey(
|
| + job_controller_->main_job())
|
| + .host_port_pair();
|
| + EXPECT_EQ(origin_host, main_host_port_pair.host());
|
| + EXPECT_EQ(origin_port, main_host_port_pair.port());
|
| +
|
| + HostPortPair alternative_host_port_pair =
|
| + HttpStreamFactoryImplJobPeer::GetSpdySessionKey(
|
| + job_controller_->alternative_job())
|
| + .host_port_pair();
|
| + EXPECT_EQ(origin_host, alternative_host_port_pair.host());
|
| + EXPECT_EQ(origin_port, alternative_host_port_pair.port());
|
| +}
|
| +
|
| // Tests that if an orphaned job completes after |request_| is gone,
|
| // JobController will be cleaned up.
|
| TEST_F(HttpStreamFactoryImplJobControllerTest,
|
|
|