diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-16 11:45:35 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-17 08:59:23 +0000 |
commit | 552906b0f222c5d5dd11b9fd73829d510980461a (patch) | |
tree | 3a11e6ed0538a81dd83b20cf3a4783e297f26d91 /chromium/net/http/http_stream_factory_job_controller_unittest.cc | |
parent | 1b05827804eaf047779b597718c03e7d38344261 (diff) | |
download | qtwebengine-chromium-552906b0f222c5d5dd11b9fd73829d510980461a.tar.gz |
BASELINE: Update Chromium to 83.0.4103.122
Change-Id: Ie3a82f5bb0076eec2a7c6a6162326b4301ee291e
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/net/http/http_stream_factory_job_controller_unittest.cc')
-rw-r--r-- | chromium/net/http/http_stream_factory_job_controller_unittest.cc | 90 |
1 files changed, 48 insertions, 42 deletions
diff --git a/chromium/net/http/http_stream_factory_job_controller_unittest.cc b/chromium/net/http/http_stream_factory_job_controller_unittest.cc index 6052667d476..1dfc39f5173 100644 --- a/chromium/net/http/http_stream_factory_job_controller_unittest.cc +++ b/chromium/net/http/http_stream_factory_job_controller_unittest.cc @@ -35,10 +35,10 @@ #include "net/log/net_log_with_source.h" #include "net/log/test_net_log.h" #include "net/log/test_net_log_util.h" +#include "net/proxy_resolution/configured_proxy_resolution_service.h" #include "net/proxy_resolution/mock_proxy_resolver.h" #include "net/proxy_resolution/proxy_config_service_fixed.h" #include "net/proxy_resolution/proxy_info.h" -#include "net/proxy_resolution/proxy_resolution_service.h" #include "net/quic/mock_crypto_client_stream_factory.h" #include "net/quic/mock_quic_context.h" #include "net/quic/mock_quic_data.h" @@ -234,7 +234,7 @@ class HttpStreamFactoryJobControllerTest : public TestWithTaskEnvironment { if (use_alternative_proxy_) { std::unique_ptr<ProxyResolutionService> proxy_resolution_service = - ProxyResolutionService::CreateFixedFromPacResult( + ConfiguredProxyResolutionService::CreateFixedFromPacResult( "HTTPS myproxy.org:443", TRAFFIC_ANNOTATION_FOR_TESTS); session_deps_.proxy_resolution_service = std::move(proxy_resolution_service); @@ -325,7 +325,8 @@ class HttpStreamFactoryJobControllerTest : public TestWithTaskEnvironment { TestJobFactory job_factory_; MockHttpStreamRequestDelegate request_delegate_; MockQuicContext quic_context_; - SpdySessionDependencies session_deps_{ProxyResolutionService::CreateDirect()}; + SpdySessionDependencies session_deps_{ + ConfiguredProxyResolutionService::CreateDirect()}; std::unique_ptr<HttpNetworkSession> session_; HttpStreamFactory* factory_ = nullptr; HttpStreamFactory::JobController* job_controller_ = nullptr; @@ -358,18 +359,20 @@ TEST_F(HttpStreamFactoryJobControllerTest, ProxyResolutionFailsSync) { ProxyConfig proxy_config; proxy_config.set_pac_url(GURL("http://fooproxyurl")); proxy_config.set_pac_mandatory(true); - session_deps_.proxy_resolution_service.reset(new ProxyResolutionService( - std::make_unique<ProxyConfigServiceFixed>(ProxyConfigWithAnnotation( - proxy_config, TRAFFIC_ANNOTATION_FOR_TESTS)), - std::make_unique<FailingProxyResolverFactory>(), nullptr)); + session_deps_.proxy_resolution_service.reset( + new ConfiguredProxyResolutionService( + std::make_unique<ProxyConfigServiceFixed>(ProxyConfigWithAnnotation( + proxy_config, TRAFFIC_ANNOTATION_FOR_TESTS)), + std::make_unique<FailingProxyResolverFactory>(), nullptr)); HttpRequestInfo request_info; request_info.method = "GET"; request_info.url = GURL("http://www.google.com"); Initialize(request_info); - EXPECT_CALL(request_delegate_, - OnStreamFailed(ERR_MANDATORY_PROXY_CONFIGURATION_FAILED, _, _, _)) + EXPECT_CALL( + request_delegate_, + OnStreamFailed(ERR_MANDATORY_PROXY_CONFIGURATION_FAILED, _, _, _, _)) .Times(1); request_ = job_controller_->Start(&request_delegate_, nullptr, net_log_.bound(), @@ -394,10 +397,11 @@ TEST_F(HttpStreamFactoryJobControllerTest, ProxyResolutionFailsAsync) { MockAsyncProxyResolverFactory* proxy_resolver_factory = new MockAsyncProxyResolverFactory(false); MockAsyncProxyResolver resolver; - session_deps_.proxy_resolution_service.reset(new ProxyResolutionService( - std::make_unique<ProxyConfigServiceFixed>(ProxyConfigWithAnnotation( - proxy_config, TRAFFIC_ANNOTATION_FOR_TESTS)), - base::WrapUnique(proxy_resolver_factory), nullptr)); + session_deps_.proxy_resolution_service.reset( + new ConfiguredProxyResolutionService( + std::make_unique<ProxyConfigServiceFixed>(ProxyConfigWithAnnotation( + proxy_config, TRAFFIC_ANNOTATION_FOR_TESTS)), + base::WrapUnique(proxy_resolver_factory), nullptr)); HttpRequestInfo request_info; request_info.method = "GET"; request_info.url = GURL("http://www.google.com"); @@ -414,8 +418,9 @@ TEST_F(HttpStreamFactoryJobControllerTest, ProxyResolutionFailsAsync) { EXPECT_EQ(LOAD_STATE_RESOLVING_PROXY_FOR_URL, job_controller_->GetLoadState()); - EXPECT_CALL(request_delegate_, - OnStreamFailed(ERR_MANDATORY_PROXY_CONFIGURATION_FAILED, _, _, _)) + EXPECT_CALL( + request_delegate_, + OnStreamFailed(ERR_MANDATORY_PROXY_CONFIGURATION_FAILED, _, _, _, _)) .Times(1); proxy_resolver_factory->pending_requests()[0]->CompleteNowWithForwarder( ERR_FAILED, &resolver); @@ -426,7 +431,7 @@ TEST_F(HttpStreamFactoryJobControllerTest, ProxyResolutionFailsAsync) { TEST_F(HttpStreamFactoryJobControllerTest, NoSupportedProxies) { session_deps_.proxy_resolution_service = - ProxyResolutionService::CreateFixedFromPacResult( + ConfiguredProxyResolutionService::CreateFixedFromPacResult( "QUIC myproxy.org:443", TRAFFIC_ANNOTATION_FOR_TESTS); session_deps_.enable_quic = false; HttpRequestInfo request_info; @@ -436,7 +441,7 @@ TEST_F(HttpStreamFactoryJobControllerTest, NoSupportedProxies) { Initialize(request_info); EXPECT_CALL(request_delegate_, - OnStreamFailed(ERR_NO_SUPPORTED_PROXIES, _, _, _)) + OnStreamFailed(ERR_NO_SUPPORTED_PROXIES, _, _, _, _)) .Times(1); request_ = job_controller_->Start(&request_delegate_, nullptr, net_log_.bound(), @@ -485,7 +490,7 @@ class JobControllerReconsiderProxyAfterErrorTest }; INSTANTIATE_TEST_SUITE_P( - /* no prefix */, + All, JobControllerReconsiderProxyAfterErrorTest, ::testing::Combine(::testing::Bool(), testing::ValuesIn(proxy_test_mock_errors))); @@ -501,8 +506,8 @@ TEST_P(JobControllerReconsiderProxyAfterErrorTest, ReconsiderProxyAfterError) { const bool set_alternative_proxy_server = ::testing::get<0>(GetParam()); const int mock_error = ::testing::get<1>(GetParam()); - std::unique_ptr<ProxyResolutionService> proxy_resolution_service = - ProxyResolutionService::CreateFixedFromPacResult( + std::unique_ptr<ConfiguredProxyResolutionService> proxy_resolution_service = + ConfiguredProxyResolutionService::CreateFixedFromPacResult( "HTTPS badproxy:99; HTTPS badfallbackproxy:98; DIRECT", TRAFFIC_ANNOTATION_FOR_TESTS); auto test_proxy_delegate = std::make_unique<TestProxyDelegate>(); @@ -603,8 +608,8 @@ TEST_P(JobControllerReconsiderProxyAfterErrorTest, ReconsiderProxyAfterError) { // Tests that ERR_MSG_TOO_BIG is retryable for QUIC proxy. TEST_F(JobControllerReconsiderProxyAfterErrorTest, ReconsiderErrMsgTooBig) { session_deps_.socket_factory->UseMockProxyClientSockets(); - std::unique_ptr<ProxyResolutionService> proxy_resolution_service = - ProxyResolutionService::CreateFixedFromPacResult( + std::unique_ptr<ConfiguredProxyResolutionService> proxy_resolution_service = + ConfiguredProxyResolutionService::CreateFixedFromPacResult( "QUIC badproxy:99; DIRECT", TRAFFIC_ANNOTATION_FOR_TESTS); // Before starting the test, verify that there are no proxies marked as bad. @@ -651,8 +656,8 @@ TEST_F(JobControllerReconsiderProxyAfterErrorTest, ReconsiderErrMsgTooBig) { TEST_F(JobControllerReconsiderProxyAfterErrorTest, DoNotReconsiderErrMsgTooBig) { session_deps_.socket_factory->UseMockProxyClientSockets(); - std::unique_ptr<ProxyResolutionService> proxy_resolution_service = - ProxyResolutionService::CreateFixedFromPacResult( + std::unique_ptr<ConfiguredProxyResolutionService> proxy_resolution_service = + ConfiguredProxyResolutionService::CreateFixedFromPacResult( "HTTPS badproxy:99; DIRECT", TRAFFIC_ANNOTATION_FOR_TESTS); // Before starting the test, verify that there are no proxies marked as bad. @@ -675,7 +680,7 @@ TEST_F(JobControllerReconsiderProxyAfterErrorTest, Initialize(std::move(proxy_resolution_service)); ProxyInfo used_proxy_info; - EXPECT_CALL(request_delegate_, OnStreamFailed(ERR_MSG_TOO_BIG, _, _, _)) + EXPECT_CALL(request_delegate_, OnStreamFailed(ERR_MSG_TOO_BIG, _, _, _, _)) .Times(1); std::unique_ptr<HttpStreamRequest> request = @@ -700,7 +705,7 @@ TEST_F(JobControllerReconsiderProxyAfterErrorTest, SecondMainJobIsStartedAfterAltProxyServerJobFailed) { // Configure the proxies and initialize the test. std::unique_ptr<ProxyResolutionService> proxy_resolution_service = - ProxyResolutionService::CreateFixedFromPacResult( + ConfiguredProxyResolutionService::CreateFixedFromPacResult( "HTTPS myproxy.org:443; DIRECT", TRAFFIC_ANNOTATION_FOR_TESTS); auto test_proxy_delegate = std::make_unique<TestProxyDelegate>(); @@ -743,7 +748,7 @@ TEST_F(JobControllerReconsiderProxyAfterErrorTest, SetAlternativeService(request_info, alternative_service); EXPECT_CALL(request_delegate_, OnStreamReadyImpl(_, _, _)).Times(1); - EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _)).Times(0); + EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _, _)).Times(0); // Create the job controller. std::unique_ptr<HttpStreamRequest> request = @@ -778,7 +783,8 @@ TEST_F(HttpStreamFactoryJobControllerTest, OnStreamFailedWithNoAlternativeJob) { // There's no other alternative job. Thus when stream failed, it should // notify Request of the stream failure. - EXPECT_CALL(request_delegate_, OnStreamFailed(ERR_FAILED, _, _, _)).Times(1); + EXPECT_CALL(request_delegate_, OnStreamFailed(ERR_FAILED, _, _, _, _)) + .Times(1); base::RunLoop().RunUntilIdle(); } @@ -1020,7 +1026,7 @@ void HttpStreamFactoryJobControllerTest::TestOnStreamFailedForBothJobs( // The failure of second Job should be reported to Request as there's no more // pending Job to serve the Request. - EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _)).Times(1); + EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _, _)).Times(1); base::RunLoop().RunUntilIdle(); VerifyBrokenAlternateProtocolMapping(request_info, false); request_.reset(); @@ -1080,7 +1086,7 @@ void HttpStreamFactoryJobControllerTest::TestAltJobFailsAfterMainJobSucceeded( EXPECT_CALL(request_delegate_, OnStreamReadyImpl(_, _, _)); // JobController shouldn't report the status of second job as request // is already successfully served. - EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _)).Times(0); + EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _, _)).Times(0); base::RunLoop().RunUntilIdle(); @@ -1316,7 +1322,7 @@ void HttpStreamFactoryJobControllerTest::TestAltJobSucceedsAfterMainJobFailed( SetAlternativeService(request_info, alternative_service); // |main_job| fails but should not report status to Request. - EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _)).Times(0); + EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _, _)).Times(0); request_ = job_controller_->Start(&request_delegate_, nullptr, net_log_.bound(), @@ -1385,7 +1391,7 @@ void HttpStreamFactoryJobControllerTest:: SetAlternativeService(request_info, alternative_service); // |main_job| fails but should not report status to Request. - EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _)).Times(0); + EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _, _)).Times(0); request_ = job_controller_->Start(&request_delegate_, nullptr, net_log_.bound(), @@ -1610,7 +1616,7 @@ void HttpStreamFactoryJobControllerTest::TestMainJobSucceedsAfterAltJobFailed( EXPECT_TRUE(job_controller_->alternative_job()); // |alternative_job| fails but should not report status to Request. - EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _)).Times(0); + EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _, _)).Times(0); // |main_job| succeeds and should report status to Request. EXPECT_CALL(request_delegate_, OnStreamReadyImpl(_, _, _)); @@ -1677,7 +1683,7 @@ TEST_F(HttpStreamFactoryJobControllerTest, EXPECT_TRUE(job_controller_->alternative_job()); // |alternative_job| fails but should not report status to Request. - EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _)).Times(0); + EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _, _)).Times(0); // |main_job| succeeds and should report status to Request. EXPECT_CALL(request_delegate_, OnStreamReadyImpl(_, _, _)); base::RunLoop().RunUntilIdle(); @@ -1719,7 +1725,7 @@ TEST_F(HttpStreamFactoryJobControllerTest, GetLoadStateAfterMainJobFailed) { // |main_job| fails but should not report status to Request. // The alternative job will mark the main job complete. - EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _)).Times(0); + EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _, _)).Times(0); base::RunLoop().RunUntilIdle(); @@ -1865,7 +1871,7 @@ TEST_F(HttpStreamFactoryJobControllerTest, HostResolutionHang) { // Unpause mock quic data. // Will cause |alternative_job| to fail, but its failure should not be // reported to Request. - EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _)).Times(0); + EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _, _)).Times(0); // OnStreamFailed will post a task to resume the main job immediately but // won't call Resume() on the main job since it's been resumed already. EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(0); @@ -1937,9 +1943,9 @@ TEST_F(HttpStreamFactoryJobControllerTest, DelayedTCP) { // Regression test for crbug.com/789560. TEST_F(HttpStreamFactoryJobControllerTest, ResumeMainJobLaterCanceled) { - std::unique_ptr<ProxyResolutionService> proxy_resolution_service = - ProxyResolutionService::CreateDirect(); - ProxyResolutionService* proxy_resolution_service_raw = + std::unique_ptr<ConfiguredProxyResolutionService> proxy_resolution_service = + ConfiguredProxyResolutionService::CreateDirect(); + ConfiguredProxyResolutionService* proxy_resolution_service_raw = proxy_resolution_service.get(); session_deps_.proxy_resolution_service = std::move(proxy_resolution_service); @@ -2410,7 +2416,7 @@ TEST_F(HttpStreamFactoryJobControllerTest, // JobController shouldn't report the status of alternative server job as // request is already successfully served. - EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _)).Times(0); + EXPECT_CALL(request_delegate_, OnStreamFailed(_, _, _, _, _)).Times(0); job_controller_->OnStreamFailed(job_factory_.alternative_job(), ERR_FAILED, SSLConfig()); @@ -3102,7 +3108,7 @@ class HttpStreamFactoryJobControllerMisdirectedRequestRetry public ::testing::WithParamInterface<::testing::tuple<bool, bool>> {}; INSTANTIATE_TEST_SUITE_P( - /* no prefix */, + All, HttpStreamFactoryJobControllerMisdirectedRequestRetry, ::testing::Combine(::testing::Bool(), ::testing::Bool())); @@ -3197,7 +3203,7 @@ class HttpStreamFactoryJobControllerPreconnectTest }; INSTANTIATE_TEST_SUITE_P( - /* no prefix */, + All, HttpStreamFactoryJobControllerPreconnectTest, ::testing::Bool()); |