| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_stream_factory_impl_job_controller.h" | 5 #include "net/http/http_stream_factory_impl_job_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> |
| 9 #include <utility> |
| 8 #include <vector> | 10 #include <vector> |
| 9 | 11 |
| 10 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 11 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 12 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 13 #include "base/test/histogram_tester.h" | 15 #include "base/test/histogram_tester.h" |
| 14 #include "base/test/scoped_feature_list.h" | 16 #include "base/test/scoped_feature_list.h" |
| 15 #include "base/test/scoped_mock_time_message_loop_task_runner.h" | 17 #include "base/test/scoped_mock_time_message_loop_task_runner.h" |
| 16 #include "base/threading/platform_thread.h" | 18 #include "base/threading/platform_thread.h" |
| 17 #include "net/base/test_proxy_delegate.h" | 19 #include "net/base/test_proxy_delegate.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 base::WrapUnique(new FailingProxyResolverFactory), nullptr)); | 309 base::WrapUnique(new FailingProxyResolverFactory), nullptr)); |
| 308 HttpRequestInfo request_info; | 310 HttpRequestInfo request_info; |
| 309 request_info.method = "GET"; | 311 request_info.method = "GET"; |
| 310 request_info.url = GURL("http://www.google.com"); | 312 request_info.url = GURL("http://www.google.com"); |
| 311 | 313 |
| 312 Initialize(request_info); | 314 Initialize(request_info); |
| 313 | 315 |
| 314 EXPECT_CALL(request_delegate_, | 316 EXPECT_CALL(request_delegate_, |
| 315 OnStreamFailed(ERR_MANDATORY_PROXY_CONFIGURATION_FAILED, _)) | 317 OnStreamFailed(ERR_MANDATORY_PROXY_CONFIGURATION_FAILED, _)) |
| 316 .Times(1); | 318 .Times(1); |
| 317 request_.reset( | 319 request_ = |
| 318 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 320 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 319 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 321 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 320 | 322 |
| 321 EXPECT_FALSE(job_controller_->main_job()); | 323 EXPECT_FALSE(job_controller_->main_job()); |
| 322 EXPECT_FALSE(job_controller_->alternative_job()); | 324 EXPECT_FALSE(job_controller_->alternative_job()); |
| 323 | 325 |
| 324 // Make sure calling GetLoadState() when before job creation does not crash. | 326 // Make sure calling GetLoadState() when before job creation does not crash. |
| 325 // Regression test for crbug.com/723920. | 327 // Regression test for crbug.com/723920. |
| 326 EXPECT_EQ(LOAD_STATE_IDLE, job_controller_->GetLoadState()); | 328 EXPECT_EQ(LOAD_STATE_IDLE, job_controller_->GetLoadState()); |
| 327 | 329 |
| 328 base::RunLoop().RunUntilIdle(); | 330 base::RunLoop().RunUntilIdle(); |
| 329 request_.reset(); | 331 request_.reset(); |
| 330 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); | 332 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); |
| 331 } | 333 } |
| 332 | 334 |
| 333 TEST_F(HttpStreamFactoryImplJobControllerTest, ProxyResolutionFailsAsync) { | 335 TEST_F(HttpStreamFactoryImplJobControllerTest, ProxyResolutionFailsAsync) { |
| 334 ProxyConfig proxy_config; | 336 ProxyConfig proxy_config; |
| 335 proxy_config.set_pac_url(GURL("http://fooproxyurl")); | 337 proxy_config.set_pac_url(GURL("http://fooproxyurl")); |
| 336 proxy_config.set_pac_mandatory(true); | 338 proxy_config.set_pac_mandatory(true); |
| 337 MockAsyncProxyResolverFactory* proxy_resolver_factory = | 339 MockAsyncProxyResolverFactory* proxy_resolver_factory = |
| 338 new MockAsyncProxyResolverFactory(false); | 340 new MockAsyncProxyResolverFactory(false); |
| 339 MockAsyncProxyResolver resolver; | 341 MockAsyncProxyResolver resolver; |
| 340 session_deps_.proxy_service.reset( | 342 session_deps_.proxy_service.reset( |
| 341 new ProxyService(base::MakeUnique<ProxyConfigServiceFixed>(proxy_config), | 343 new ProxyService(base::MakeUnique<ProxyConfigServiceFixed>(proxy_config), |
| 342 base::WrapUnique(proxy_resolver_factory), nullptr)); | 344 base::WrapUnique(proxy_resolver_factory), nullptr)); |
| 343 HttpRequestInfo request_info; | 345 HttpRequestInfo request_info; |
| 344 request_info.method = "GET"; | 346 request_info.method = "GET"; |
| 345 request_info.url = GURL("http://www.google.com"); | 347 request_info.url = GURL("http://www.google.com"); |
| 346 | 348 |
| 347 Initialize(request_info); | 349 Initialize(request_info); |
| 348 | 350 |
| 349 request_.reset( | 351 request_ = |
| 350 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 352 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 351 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 353 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 352 | 354 |
| 353 EXPECT_FALSE(job_controller_->main_job()); | 355 EXPECT_FALSE(job_controller_->main_job()); |
| 354 EXPECT_FALSE(job_controller_->alternative_job()); | 356 EXPECT_FALSE(job_controller_->alternative_job()); |
| 355 | 357 |
| 356 EXPECT_EQ(LOAD_STATE_RESOLVING_PROXY_FOR_URL, | 358 EXPECT_EQ(LOAD_STATE_RESOLVING_PROXY_FOR_URL, |
| 357 job_controller_->GetLoadState()); | 359 job_controller_->GetLoadState()); |
| 358 | 360 |
| 359 EXPECT_CALL(request_delegate_, | 361 EXPECT_CALL(request_delegate_, |
| 360 OnStreamFailed(ERR_MANDATORY_PROXY_CONFIGURATION_FAILED, _)) | 362 OnStreamFailed(ERR_MANDATORY_PROXY_CONFIGURATION_FAILED, _)) |
| 361 .Times(1); | 363 .Times(1); |
| 362 proxy_resolver_factory->pending_requests()[0]->CompleteNowWithForwarder( | 364 proxy_resolver_factory->pending_requests()[0]->CompleteNowWithForwarder( |
| 363 ERR_FAILED, &resolver); | 365 ERR_FAILED, &resolver); |
| 364 base::RunLoop().RunUntilIdle(); | 366 base::RunLoop().RunUntilIdle(); |
| 365 request_.reset(); | 367 request_.reset(); |
| 366 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); | 368 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); |
| 367 } | 369 } |
| 368 | 370 |
| 369 TEST_F(HttpStreamFactoryImplJobControllerTest, NoSupportedProxies) { | 371 TEST_F(HttpStreamFactoryImplJobControllerTest, NoSupportedProxies) { |
| 370 session_deps_.proxy_service = | 372 session_deps_.proxy_service = |
| 371 ProxyService::CreateFixedFromPacResult("QUIC myproxy.org:443"); | 373 ProxyService::CreateFixedFromPacResult("QUIC myproxy.org:443"); |
| 372 session_deps_.enable_quic = false; | 374 session_deps_.enable_quic = false; |
| 373 HttpRequestInfo request_info; | 375 HttpRequestInfo request_info; |
| 374 request_info.method = "GET"; | 376 request_info.method = "GET"; |
| 375 request_info.url = GURL("http://www.google.com"); | 377 request_info.url = GURL("http://www.google.com"); |
| 376 | 378 |
| 377 Initialize(request_info); | 379 Initialize(request_info); |
| 378 | 380 |
| 379 EXPECT_CALL(request_delegate_, OnStreamFailed(ERR_NO_SUPPORTED_PROXIES, _)) | 381 EXPECT_CALL(request_delegate_, OnStreamFailed(ERR_NO_SUPPORTED_PROXIES, _)) |
| 380 .Times(1); | 382 .Times(1); |
| 381 request_.reset( | 383 request_ = |
| 382 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 384 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 383 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 385 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 384 | 386 |
| 385 EXPECT_FALSE(job_controller_->main_job()); | 387 EXPECT_FALSE(job_controller_->main_job()); |
| 386 EXPECT_FALSE(job_controller_->alternative_job()); | 388 EXPECT_FALSE(job_controller_->alternative_job()); |
| 387 | 389 |
| 388 base::RunLoop().RunUntilIdle(); | 390 base::RunLoop().RunUntilIdle(); |
| 389 request_.reset(); | 391 request_.reset(); |
| 390 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); | 392 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); |
| 391 } | 393 } |
| 392 | 394 |
| 393 class JobControllerReconsiderProxyAfterErrorTest | 395 class JobControllerReconsiderProxyAfterErrorTest |
| (...skipping 12 matching lines...) Expand all Loading... |
| 406 } | 408 } |
| 407 | 409 |
| 408 std::unique_ptr<HttpStreamRequest> CreateJobController( | 410 std::unique_ptr<HttpStreamRequest> CreateJobController( |
| 409 const HttpRequestInfo& request_info) { | 411 const HttpRequestInfo& request_info) { |
| 410 HttpStreamFactoryImpl::JobController* job_controller = | 412 HttpStreamFactoryImpl::JobController* job_controller = |
| 411 new HttpStreamFactoryImpl::JobController( | 413 new HttpStreamFactoryImpl::JobController( |
| 412 factory_, &request_delegate_, session_.get(), &default_job_factory_, | 414 factory_, &request_delegate_, session_.get(), &default_job_factory_, |
| 413 request_info, is_preconnect_, enable_ip_based_pooling_, | 415 request_info, is_preconnect_, enable_ip_based_pooling_, |
| 414 enable_alternative_services_, SSLConfig(), SSLConfig()); | 416 enable_alternative_services_, SSLConfig(), SSLConfig()); |
| 415 HttpStreamFactoryImplPeer::AddJobController(factory_, job_controller); | 417 HttpStreamFactoryImplPeer::AddJobController(factory_, job_controller); |
| 416 return base::WrapUnique(job_controller->Start( | 418 return job_controller->Start( |
| 417 &request_delegate_, nullptr, NetLogWithSource(), | 419 &request_delegate_, nullptr, NetLogWithSource(), |
| 418 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 420 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 419 } | 421 } |
| 420 | 422 |
| 421 private: | 423 private: |
| 422 // Use real Jobs so that Job::Resume() is not mocked out. When main job is | 424 // Use real Jobs so that Job::Resume() is not mocked out. When main job is |
| 423 // resumed it will use mock socket data. | 425 // resumed it will use mock socket data. |
| 424 HttpStreamFactoryImpl::JobFactory default_job_factory_; | 426 HttpStreamFactoryImpl::JobFactory default_job_factory_; |
| 425 }; | 427 }; |
| 426 | 428 |
| 427 INSTANTIATE_TEST_CASE_P( | 429 INSTANTIATE_TEST_CASE_P( |
| 428 /* no prefix */, | 430 /* no prefix */, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 OnStreamFailedWithNoAlternativeJob) { | 547 OnStreamFailedWithNoAlternativeJob) { |
| 546 tcp_data_ = base::MakeUnique<SequencedSocketData>(nullptr, 0, nullptr, 0); | 548 tcp_data_ = base::MakeUnique<SequencedSocketData>(nullptr, 0, nullptr, 0); |
| 547 tcp_data_->set_connect_data(MockConnect(ASYNC, ERR_FAILED)); | 549 tcp_data_->set_connect_data(MockConnect(ASYNC, ERR_FAILED)); |
| 548 | 550 |
| 549 HttpRequestInfo request_info; | 551 HttpRequestInfo request_info; |
| 550 request_info.method = "GET"; | 552 request_info.method = "GET"; |
| 551 request_info.url = GURL("http://www.google.com"); | 553 request_info.url = GURL("http://www.google.com"); |
| 552 | 554 |
| 553 Initialize(request_info); | 555 Initialize(request_info); |
| 554 | 556 |
| 555 request_.reset( | 557 request_ = |
| 556 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 558 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 557 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 559 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 558 | 560 |
| 559 EXPECT_TRUE(job_controller_->main_job()); | 561 EXPECT_TRUE(job_controller_->main_job()); |
| 560 EXPECT_FALSE(job_controller_->alternative_job()); | 562 EXPECT_FALSE(job_controller_->alternative_job()); |
| 561 | 563 |
| 562 // There's no other alternative job. Thus when stream failed, it should | 564 // There's no other alternative job. Thus when stream failed, it should |
| 563 // notify Request of the stream failure. | 565 // notify Request of the stream failure. |
| 564 EXPECT_CALL(request_delegate_, OnStreamFailed(ERR_FAILED, _)).Times(1); | 566 EXPECT_CALL(request_delegate_, OnStreamFailed(ERR_FAILED, _)).Times(1); |
| 565 base::RunLoop().RunUntilIdle(); | 567 base::RunLoop().RunUntilIdle(); |
| 566 } | 568 } |
| 567 | 569 |
| 568 TEST_F(HttpStreamFactoryImplJobControllerTest, | 570 TEST_F(HttpStreamFactoryImplJobControllerTest, |
| 569 OnStreamReadyWithNoAlternativeJob) { | 571 OnStreamReadyWithNoAlternativeJob) { |
| 570 tcp_data_ = base::MakeUnique<SequencedSocketData>(nullptr, 0, nullptr, 0); | 572 tcp_data_ = base::MakeUnique<SequencedSocketData>(nullptr, 0, nullptr, 0); |
| 571 tcp_data_->set_connect_data(MockConnect(ASYNC, OK)); | 573 tcp_data_->set_connect_data(MockConnect(ASYNC, OK)); |
| 572 | 574 |
| 573 HttpRequestInfo request_info; | 575 HttpRequestInfo request_info; |
| 574 request_info.method = "GET"; | 576 request_info.method = "GET"; |
| 575 request_info.url = GURL("http://www.google.com"); | 577 request_info.url = GURL("http://www.google.com"); |
| 576 | 578 |
| 577 Initialize(request_info); | 579 Initialize(request_info); |
| 578 | 580 |
| 579 request_.reset( | 581 request_ = |
| 580 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 582 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 581 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 583 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 582 | 584 |
| 583 // There's no other alternative job. Thus when a stream is ready, it should | 585 // There's no other alternative job. Thus when a stream is ready, it should |
| 584 // notify Request. | 586 // notify Request. |
| 585 EXPECT_TRUE(job_controller_->main_job()); | 587 EXPECT_TRUE(job_controller_->main_job()); |
| 586 | 588 |
| 587 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) | 589 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) |
| 588 .WillOnce(Invoke(DeleteHttpStreamPointer)); | 590 .WillOnce(Invoke(DeleteHttpStreamPointer)); |
| 589 base::RunLoop().RunUntilIdle(); | 591 base::RunLoop().RunUntilIdle(); |
| 590 } | 592 } |
| 591 | 593 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 602 tcp_data_->set_connect_data(MockConnect(ASYNC, OK)); | 604 tcp_data_->set_connect_data(MockConnect(ASYNC, OK)); |
| 603 HttpRequestInfo request_info; | 605 HttpRequestInfo request_info; |
| 604 request_info.method = "GET"; | 606 request_info.method = "GET"; |
| 605 request_info.url = GURL("https://www.google.com"); | 607 request_info.url = GURL("https://www.google.com"); |
| 606 | 608 |
| 607 Initialize(request_info); | 609 Initialize(request_info); |
| 608 url::SchemeHostPort server(request_info.url); | 610 url::SchemeHostPort server(request_info.url); |
| 609 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 611 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 610 SetAlternativeService(request_info, alternative_service); | 612 SetAlternativeService(request_info, alternative_service); |
| 611 | 613 |
| 612 request_.reset( | 614 request_ = |
| 613 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 615 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 614 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 616 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 615 EXPECT_TRUE(job_controller_->main_job()); | 617 EXPECT_TRUE(job_controller_->main_job()); |
| 616 EXPECT_TRUE(job_controller_->alternative_job()); | 618 EXPECT_TRUE(job_controller_->alternative_job()); |
| 617 | 619 |
| 618 // Reset the Request will cancel all the Jobs since there's no Job determined | 620 // Reset the Request will cancel all the Jobs since there's no Job determined |
| 619 // to serve Request yet and JobController will notify the factory to delete | 621 // to serve Request yet and JobController will notify the factory to delete |
| 620 // itself upon completion. | 622 // itself upon completion. |
| 621 request_.reset(); | 623 request_.reset(); |
| 622 VerifyBrokenAlternateProtocolMapping(request_info, false); | 624 VerifyBrokenAlternateProtocolMapping(request_info, false); |
| 623 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); | 625 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); |
| 624 } | 626 } |
| 625 | 627 |
| 626 TEST_F(HttpStreamFactoryImplJobControllerTest, OnStreamFailedForBothJobs) { | 628 TEST_F(HttpStreamFactoryImplJobControllerTest, OnStreamFailedForBothJobs) { |
| 627 quic_data_ = base::MakeUnique<test::MockQuicData>(); | 629 quic_data_ = base::MakeUnique<test::MockQuicData>(); |
| 628 quic_data_->AddConnect(ASYNC, ERR_FAILED); | 630 quic_data_->AddConnect(ASYNC, ERR_FAILED); |
| 629 tcp_data_ = base::MakeUnique<SequencedSocketData>(nullptr, 0, nullptr, 0); | 631 tcp_data_ = base::MakeUnique<SequencedSocketData>(nullptr, 0, nullptr, 0); |
| 630 tcp_data_->set_connect_data(MockConnect(ASYNC, ERR_FAILED)); | 632 tcp_data_->set_connect_data(MockConnect(ASYNC, ERR_FAILED)); |
| 631 | 633 |
| 632 HttpRequestInfo request_info; | 634 HttpRequestInfo request_info; |
| 633 request_info.method = "GET"; | 635 request_info.method = "GET"; |
| 634 request_info.url = GURL("https://www.google.com"); | 636 request_info.url = GURL("https://www.google.com"); |
| 635 | 637 |
| 636 Initialize(request_info); | 638 Initialize(request_info); |
| 637 url::SchemeHostPort server(request_info.url); | 639 url::SchemeHostPort server(request_info.url); |
| 638 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 640 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 639 SetAlternativeService(request_info, alternative_service); | 641 SetAlternativeService(request_info, alternative_service); |
| 640 | 642 |
| 641 request_.reset( | 643 request_ = |
| 642 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 644 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 643 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 645 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 644 EXPECT_TRUE(job_controller_->main_job()); | 646 EXPECT_TRUE(job_controller_->main_job()); |
| 645 EXPECT_TRUE(job_controller_->alternative_job()); | 647 EXPECT_TRUE(job_controller_->alternative_job()); |
| 646 | 648 |
| 647 // The failure of second Job should be reported to Request as there's no more | 649 // The failure of second Job should be reported to Request as there's no more |
| 648 // pending Job to serve the Request. | 650 // pending Job to serve the Request. |
| 649 EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(1); | 651 EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(1); |
| 650 base::RunLoop().RunUntilIdle(); | 652 base::RunLoop().RunUntilIdle(); |
| 651 VerifyBrokenAlternateProtocolMapping(request_info, false); | 653 VerifyBrokenAlternateProtocolMapping(request_info, false); |
| 652 request_.reset(); | 654 request_.reset(); |
| 653 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); | 655 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 667 | 669 |
| 668 HttpRequestInfo request_info; | 670 HttpRequestInfo request_info; |
| 669 request_info.method = "GET"; | 671 request_info.method = "GET"; |
| 670 request_info.url = GURL("https://www.google.com"); | 672 request_info.url = GURL("https://www.google.com"); |
| 671 | 673 |
| 672 Initialize(request_info); | 674 Initialize(request_info); |
| 673 url::SchemeHostPort server(request_info.url); | 675 url::SchemeHostPort server(request_info.url); |
| 674 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 676 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 675 SetAlternativeService(request_info, alternative_service); | 677 SetAlternativeService(request_info, alternative_service); |
| 676 | 678 |
| 677 request_.reset( | 679 request_ = |
| 678 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 680 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 679 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 681 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 680 EXPECT_TRUE(job_controller_->main_job()); | 682 EXPECT_TRUE(job_controller_->main_job()); |
| 681 EXPECT_TRUE(job_controller_->alternative_job()); | 683 EXPECT_TRUE(job_controller_->alternative_job()); |
| 682 | 684 |
| 683 // Main job succeeds, starts serving Request and it should report status | 685 // Main job succeeds, starts serving Request and it should report status |
| 684 // to Request. The alternative job will mark the main job complete and gets | 686 // to Request. The alternative job will mark the main job complete and gets |
| 685 // orphaned. | 687 // orphaned. |
| 686 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) | 688 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) |
| 687 .WillOnce(Invoke(DeleteHttpStreamPointer)); | 689 .WillOnce(Invoke(DeleteHttpStreamPointer)); |
| 688 // JobController shouldn't report the status of second job as request | 690 // JobController shouldn't report the status of second job as request |
| 689 // is already successfully served. | 691 // is already successfully served. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 708 | 710 |
| 709 HttpRequestInfo request_info; | 711 HttpRequestInfo request_info; |
| 710 request_info.method = "GET"; | 712 request_info.method = "GET"; |
| 711 request_info.url = GURL("https://www.google.com"); | 713 request_info.url = GURL("https://www.google.com"); |
| 712 | 714 |
| 713 Initialize(request_info); | 715 Initialize(request_info); |
| 714 | 716 |
| 715 url::SchemeHostPort server(request_info.url); | 717 url::SchemeHostPort server(request_info.url); |
| 716 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 718 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 717 SetAlternativeService(request_info, alternative_service); | 719 SetAlternativeService(request_info, alternative_service); |
| 718 request_.reset( | 720 request_ = |
| 719 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 721 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 720 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 722 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 721 EXPECT_TRUE(job_controller_->main_job()); | 723 EXPECT_TRUE(job_controller_->main_job()); |
| 722 EXPECT_TRUE(job_controller_->alternative_job()); | 724 EXPECT_TRUE(job_controller_->alternative_job()); |
| 723 EXPECT_TRUE(JobControllerPeer::main_job_is_blocked(job_controller_)); | 725 EXPECT_TRUE(JobControllerPeer::main_job_is_blocked(job_controller_)); |
| 724 | 726 |
| 725 // |alternative_job| succeeds and should report status to |request_delegate_|. | 727 // |alternative_job| succeeds and should report status to |request_delegate_|. |
| 726 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) | 728 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) |
| 727 .WillOnce(Invoke(DeleteHttpStreamPointer)); | 729 .WillOnce(Invoke(DeleteHttpStreamPointer)); |
| 728 | 730 |
| 729 base::RunLoop().RunUntilIdle(); | 731 base::RunLoop().RunUntilIdle(); |
| 730 | 732 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 752 request_info.method = "GET"; | 754 request_info.method = "GET"; |
| 753 request_info.url = | 755 request_info.url = |
| 754 GURL(base::StringPrintf("https://%s:%u", origin_host, origin_port)); | 756 GURL(base::StringPrintf("https://%s:%u", origin_host, origin_port)); |
| 755 Initialize(request_info); | 757 Initialize(request_info); |
| 756 | 758 |
| 757 url::SchemeHostPort server(request_info.url); | 759 url::SchemeHostPort server(request_info.url); |
| 758 AlternativeService alternative_service(kProtoHTTP2, alternative_host, | 760 AlternativeService alternative_service(kProtoHTTP2, alternative_host, |
| 759 alternative_port); | 761 alternative_port); |
| 760 SetAlternativeService(request_info, alternative_service); | 762 SetAlternativeService(request_info, alternative_service); |
| 761 | 763 |
| 762 request_.reset( | 764 request_ = |
| 763 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 765 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 764 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 766 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 765 | 767 |
| 766 HostPortPair main_host_port_pair = | 768 HostPortPair main_host_port_pair = |
| 767 HttpStreamFactoryImplJobPeer::GetSpdySessionKey( | 769 HttpStreamFactoryImplJobPeer::GetSpdySessionKey( |
| 768 job_controller_->main_job()) | 770 job_controller_->main_job()) |
| 769 .host_port_pair(); | 771 .host_port_pair(); |
| 770 EXPECT_EQ(origin_host, main_host_port_pair.host()); | 772 EXPECT_EQ(origin_host, main_host_port_pair.host()); |
| 771 EXPECT_EQ(origin_port, main_host_port_pair.port()); | 773 EXPECT_EQ(origin_port, main_host_port_pair.port()); |
| 772 | 774 |
| 773 HostPortPair alternative_host_port_pair = | 775 HostPortPair alternative_host_port_pair = |
| 774 HttpStreamFactoryImplJobPeer::GetSpdySessionKey( | 776 HttpStreamFactoryImplJobPeer::GetSpdySessionKey( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 796 HttpRequestInfo request_info; | 798 HttpRequestInfo request_info; |
| 797 request_info.method = "GET"; | 799 request_info.method = "GET"; |
| 798 request_info.url = GURL("https://www.google.com"); | 800 request_info.url = GURL("https://www.google.com"); |
| 799 | 801 |
| 800 Initialize(request_info); | 802 Initialize(request_info); |
| 801 | 803 |
| 802 url::SchemeHostPort server(request_info.url); | 804 url::SchemeHostPort server(request_info.url); |
| 803 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 805 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 804 SetAlternativeService(request_info, alternative_service); | 806 SetAlternativeService(request_info, alternative_service); |
| 805 | 807 |
| 806 request_.reset( | 808 request_ = |
| 807 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 809 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 808 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 810 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 809 EXPECT_TRUE(job_controller_->main_job()); | 811 EXPECT_TRUE(job_controller_->main_job()); |
| 810 EXPECT_TRUE(job_controller_->alternative_job()); | 812 EXPECT_TRUE(job_controller_->alternative_job()); |
| 811 // main job should not be blocked because alt job returned ERR_IO_PENDING. | 813 // main job should not be blocked because alt job returned ERR_IO_PENDING. |
| 812 EXPECT_FALSE(JobControllerPeer::main_job_is_blocked(job_controller_)); | 814 EXPECT_FALSE(JobControllerPeer::main_job_is_blocked(job_controller_)); |
| 813 | 815 |
| 814 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) | 816 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) |
| 815 .WillOnce(Invoke(DeleteHttpStreamPointer)); | 817 .WillOnce(Invoke(DeleteHttpStreamPointer)); |
| 816 | 818 |
| 817 // Complete main job now. | 819 // Complete main job now. |
| 818 base::RunLoop().RunUntilIdle(); | 820 base::RunLoop().RunUntilIdle(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 | 854 |
| 853 Initialize(request_info); | 855 Initialize(request_info); |
| 854 | 856 |
| 855 url::SchemeHostPort server(request_info.url); | 857 url::SchemeHostPort server(request_info.url); |
| 856 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 858 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 857 SetAlternativeService(request_info, alternative_service); | 859 SetAlternativeService(request_info, alternative_service); |
| 858 | 860 |
| 859 // |main_job| fails but should not report status to Request. | 861 // |main_job| fails but should not report status to Request. |
| 860 EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(0); | 862 EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(0); |
| 861 | 863 |
| 862 request_.reset( | 864 request_ = |
| 863 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 865 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 864 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 866 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 865 EXPECT_TRUE(job_controller_->main_job()); | 867 EXPECT_TRUE(job_controller_->main_job()); |
| 866 EXPECT_TRUE(job_controller_->alternative_job()); | 868 EXPECT_TRUE(job_controller_->alternative_job()); |
| 867 | 869 |
| 868 base::RunLoop().RunUntilIdle(); | 870 base::RunLoop().RunUntilIdle(); |
| 869 | 871 |
| 870 // Make |alternative_job| succeed. | 872 // Make |alternative_job| succeed. |
| 871 HttpStream* http_stream = | 873 HttpStream* http_stream = |
| 872 new HttpBasicStream(base::MakeUnique<ClientSocketHandle>(), false, false); | 874 new HttpBasicStream(base::MakeUnique<ClientSocketHandle>(), false, false); |
| 873 | 875 |
| 874 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, http_stream)) | 876 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, http_stream)) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 897 HttpRequestInfo request_info; | 899 HttpRequestInfo request_info; |
| 898 request_info.method = "GET"; | 900 request_info.method = "GET"; |
| 899 request_info.url = GURL("https://www.google.com"); | 901 request_info.url = GURL("https://www.google.com"); |
| 900 | 902 |
| 901 Initialize(request_info); | 903 Initialize(request_info); |
| 902 | 904 |
| 903 url::SchemeHostPort server(request_info.url); | 905 url::SchemeHostPort server(request_info.url); |
| 904 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 906 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 905 SetAlternativeService(request_info, alternative_service); | 907 SetAlternativeService(request_info, alternative_service); |
| 906 | 908 |
| 907 request_.reset( | 909 request_ = |
| 908 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 910 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 909 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 911 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 910 EXPECT_TRUE(job_controller_->main_job()); | 912 EXPECT_TRUE(job_controller_->main_job()); |
| 911 EXPECT_TRUE(job_controller_->alternative_job()); | 913 EXPECT_TRUE(job_controller_->alternative_job()); |
| 912 | 914 |
| 913 // |alternative_job| fails but should not report status to Request. | 915 // |alternative_job| fails but should not report status to Request. |
| 914 EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(0); | 916 EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(0); |
| 915 // |main_job| succeeds and should report status to Request. | 917 // |main_job| succeeds and should report status to Request. |
| 916 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) | 918 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) |
| 917 .WillOnce(Invoke(DeleteHttpStreamPointer)); | 919 .WillOnce(Invoke(DeleteHttpStreamPointer)); |
| 918 | 920 |
| 919 base::RunLoop().RunUntilIdle(); | 921 base::RunLoop().RunUntilIdle(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 941 | 943 |
| 942 HttpRequestInfo request_info; | 944 HttpRequestInfo request_info; |
| 943 request_info.method = "GET"; | 945 request_info.method = "GET"; |
| 944 request_info.url = GURL("https://www.google.com"); | 946 request_info.url = GURL("https://www.google.com"); |
| 945 Initialize(request_info); | 947 Initialize(request_info); |
| 946 | 948 |
| 947 url::SchemeHostPort server(request_info.url); | 949 url::SchemeHostPort server(request_info.url); |
| 948 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 950 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 949 SetAlternativeService(request_info, alternative_service); | 951 SetAlternativeService(request_info, alternative_service); |
| 950 | 952 |
| 951 request_.reset( | 953 request_ = |
| 952 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 954 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 953 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 955 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 954 EXPECT_TRUE(job_controller_->main_job()); | 956 EXPECT_TRUE(job_controller_->main_job()); |
| 955 EXPECT_TRUE(job_controller_->alternative_job()); | 957 EXPECT_TRUE(job_controller_->alternative_job()); |
| 956 | 958 |
| 957 // |alternative_job| fails but should not report status to Request. | 959 // |alternative_job| fails but should not report status to Request. |
| 958 EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(0); | 960 EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(0); |
| 959 // |main_job| succeeds and should report status to Request. | 961 // |main_job| succeeds and should report status to Request. |
| 960 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) | 962 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) |
| 961 .WillOnce(Invoke(DeleteHttpStreamPointer)); | 963 .WillOnce(Invoke(DeleteHttpStreamPointer)); |
| 962 base::RunLoop().RunUntilIdle(); | 964 base::RunLoop().RunUntilIdle(); |
| 963 | 965 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 983 | 985 |
| 984 HttpRequestInfo request_info; | 986 HttpRequestInfo request_info; |
| 985 request_info.method = "GET"; | 987 request_info.method = "GET"; |
| 986 request_info.url = GURL("https://www.google.com"); | 988 request_info.url = GURL("https://www.google.com"); |
| 987 | 989 |
| 988 Initialize(request_info); | 990 Initialize(request_info); |
| 989 url::SchemeHostPort server(request_info.url); | 991 url::SchemeHostPort server(request_info.url); |
| 990 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 992 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 991 SetAlternativeService(request_info, alternative_service); | 993 SetAlternativeService(request_info, alternative_service); |
| 992 | 994 |
| 993 request_.reset( | 995 request_ = |
| 994 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 996 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 995 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 997 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 996 EXPECT_TRUE(job_controller_->main_job()); | 998 EXPECT_TRUE(job_controller_->main_job()); |
| 997 EXPECT_TRUE(job_controller_->alternative_job()); | 999 EXPECT_TRUE(job_controller_->alternative_job()); |
| 998 | 1000 |
| 999 // |main_job| fails but should not report status to Request. | 1001 // |main_job| fails but should not report status to Request. |
| 1000 // The alternative job will mark the main job complete. | 1002 // The alternative job will mark the main job complete. |
| 1001 EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(0); | 1003 EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(0); |
| 1002 | 1004 |
| 1003 base::RunLoop().RunUntilIdle(); | 1005 base::RunLoop().RunUntilIdle(); |
| 1004 | 1006 |
| 1005 // Controller should use alternative job to get load state. | 1007 // Controller should use alternative job to get load state. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1031 | 1033 |
| 1032 HttpRequestInfo request_info; | 1034 HttpRequestInfo request_info; |
| 1033 request_info.method = "GET"; | 1035 request_info.method = "GET"; |
| 1034 request_info.url = GURL("https://www.google.com"); | 1036 request_info.url = GURL("https://www.google.com"); |
| 1035 | 1037 |
| 1036 Initialize(request_info); | 1038 Initialize(request_info); |
| 1037 url::SchemeHostPort server(request_info.url); | 1039 url::SchemeHostPort server(request_info.url); |
| 1038 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 1040 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 1039 SetAlternativeService(request_info, alternative_service); | 1041 SetAlternativeService(request_info, alternative_service); |
| 1040 | 1042 |
| 1041 request_.reset( | 1043 request_ = |
| 1042 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 1044 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 1043 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 1045 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 1044 EXPECT_TRUE(job_controller_->main_job()); | 1046 EXPECT_TRUE(job_controller_->main_job()); |
| 1045 EXPECT_TRUE(job_controller_->alternative_job()); | 1047 EXPECT_TRUE(job_controller_->alternative_job()); |
| 1046 | 1048 |
| 1047 // Alt job is stalled and main job should complete successfully. | 1049 // Alt job is stalled and main job should complete successfully. |
| 1048 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) | 1050 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) |
| 1049 .WillOnce(Invoke(DeleteHttpStreamPointer)); | 1051 .WillOnce(Invoke(DeleteHttpStreamPointer)); |
| 1050 | 1052 |
| 1051 base::RunLoop().RunUntilIdle(); | 1053 base::RunLoop().RunUntilIdle(); |
| 1052 } | 1054 } |
| 1053 | 1055 |
| 1054 TEST_F(HttpStreamFactoryImplJobControllerTest, InvalidPortForQuic) { | 1056 TEST_F(HttpStreamFactoryImplJobControllerTest, InvalidPortForQuic) { |
| 1055 HttpRequestInfo request_info; | 1057 HttpRequestInfo request_info; |
| 1056 request_info.method = "GET"; | 1058 request_info.method = "GET"; |
| 1057 request_info.url = GURL("https://www.google.com"); | 1059 request_info.url = GURL("https://www.google.com"); |
| 1058 | 1060 |
| 1059 // Using a restricted port 101 for QUIC should fail and the alternative job | 1061 // Using a restricted port 101 for QUIC should fail and the alternative job |
| 1060 // should post OnStreamFailedCall on the controller to resume the main job. | 1062 // should post OnStreamFailedCall on the controller to resume the main job. |
| 1061 Initialize(request_info); | 1063 Initialize(request_info); |
| 1062 | 1064 |
| 1063 url::SchemeHostPort server(request_info.url); | 1065 url::SchemeHostPort server(request_info.url); |
| 1064 AlternativeService alternative_service(kProtoQUIC, server.host(), 101); | 1066 AlternativeService alternative_service(kProtoQUIC, server.host(), 101); |
| 1065 SetAlternativeService(request_info, alternative_service); | 1067 SetAlternativeService(request_info, alternative_service); |
| 1066 | 1068 |
| 1067 request_.reset( | 1069 request_ = |
| 1068 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 1070 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 1069 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 1071 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 1070 | 1072 |
| 1071 EXPECT_TRUE(job_factory_.main_job()->is_waiting()); | 1073 EXPECT_TRUE(job_factory_.main_job()->is_waiting()); |
| 1072 | 1074 |
| 1073 // Wait until OnStreamFailedCallback is executed on the alternative job. | 1075 // Wait until OnStreamFailedCallback is executed on the alternative job. |
| 1074 EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(1); | 1076 EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(1); |
| 1075 base::RunLoop().RunUntilIdle(); | 1077 base::RunLoop().RunUntilIdle(); |
| 1076 } | 1078 } |
| 1077 | 1079 |
| 1078 TEST_F(HttpStreamFactoryImplJobControllerTest, DelayedTCP) { | 1080 TEST_F(HttpStreamFactoryImplJobControllerTest, DelayedTCP) { |
| 1079 base::ScopedMockTimeMessageLoopTaskRunner test_task_runner; | 1081 base::ScopedMockTimeMessageLoopTaskRunner test_task_runner; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1093 quic_stream_factory->set_require_confirmation(false); | 1095 quic_stream_factory->set_require_confirmation(false); |
| 1094 ServerNetworkStats stats1; | 1096 ServerNetworkStats stats1; |
| 1095 stats1.srtt = base::TimeDelta::FromMicroseconds(10); | 1097 stats1.srtt = base::TimeDelta::FromMicroseconds(10); |
| 1096 session_->http_server_properties()->SetServerNetworkStats( | 1098 session_->http_server_properties()->SetServerNetworkStats( |
| 1097 url::SchemeHostPort(GURL("https://www.google.com")), stats1); | 1099 url::SchemeHostPort(GURL("https://www.google.com")), stats1); |
| 1098 | 1100 |
| 1099 url::SchemeHostPort server(request_info.url); | 1101 url::SchemeHostPort server(request_info.url); |
| 1100 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 1102 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 1101 SetAlternativeService(request_info, alternative_service); | 1103 SetAlternativeService(request_info, alternative_service); |
| 1102 | 1104 |
| 1103 request_.reset( | 1105 request_ = |
| 1104 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 1106 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 1105 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 1107 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 1106 EXPECT_TRUE(job_controller_->main_job()); | 1108 EXPECT_TRUE(job_controller_->main_job()); |
| 1107 EXPECT_TRUE(job_controller_->alternative_job()); | 1109 EXPECT_TRUE(job_controller_->alternative_job()); |
| 1108 EXPECT_TRUE(job_controller_->main_job()->is_waiting()); | 1110 EXPECT_TRUE(job_controller_->main_job()->is_waiting()); |
| 1109 | 1111 |
| 1110 // The alternative job stalls as host resolution hangs when creating the QUIC | 1112 // The alternative job stalls as host resolution hangs when creating the QUIC |
| 1111 // request and controller should resume the main job after delay. | 1113 // request and controller should resume the main job after delay. |
| 1112 EXPECT_TRUE(test_task_runner->HasPendingTask()); | 1114 EXPECT_TRUE(test_task_runner->HasPendingTask()); |
| 1113 EXPECT_EQ(1u, test_task_runner->GetPendingTaskCount()); | 1115 EXPECT_EQ(1u, test_task_runner->GetPendingTaskCount()); |
| 1114 EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(1); | 1116 EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(1); |
| 1115 test_task_runner->FastForwardBy(base::TimeDelta::FromMicroseconds(15)); | 1117 test_task_runner->FastForwardBy(base::TimeDelta::FromMicroseconds(15)); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 ServerNetworkStats stats1; | 1162 ServerNetworkStats stats1; |
| 1161 stats1.srtt = base::TimeDelta::FromSeconds(100); | 1163 stats1.srtt = base::TimeDelta::FromSeconds(100); |
| 1162 session_->http_server_properties()->SetServerNetworkStats( | 1164 session_->http_server_properties()->SetServerNetworkStats( |
| 1163 url::SchemeHostPort(GURL("https://www.google.com")), stats1); | 1165 url::SchemeHostPort(GURL("https://www.google.com")), stats1); |
| 1164 | 1166 |
| 1165 // Set a SPDY alternative service for the server. | 1167 // Set a SPDY alternative service for the server. |
| 1166 url::SchemeHostPort server(request_info.url); | 1168 url::SchemeHostPort server(request_info.url); |
| 1167 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 1169 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 1168 SetAlternativeService(request_info, alternative_service); | 1170 SetAlternativeService(request_info, alternative_service); |
| 1169 | 1171 |
| 1170 request_.reset( | 1172 request_ = |
| 1171 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 1173 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 1172 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 1174 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 1173 EXPECT_TRUE(job_controller_->main_job()); | 1175 EXPECT_TRUE(job_controller_->main_job()); |
| 1174 EXPECT_TRUE(job_controller_->alternative_job()); | 1176 EXPECT_TRUE(job_controller_->alternative_job()); |
| 1175 EXPECT_TRUE(job_controller_->main_job()->is_waiting()); | 1177 EXPECT_TRUE(job_controller_->main_job()->is_waiting()); |
| 1176 | 1178 |
| 1177 // The alternative job stalls as host resolution hangs when creating the QUIC | 1179 // The alternative job stalls as host resolution hangs when creating the QUIC |
| 1178 // request and controller should resume the main job after delay. | 1180 // request and controller should resume the main job after delay. |
| 1179 EXPECT_TRUE(test_task_runner->HasPendingTask()); | 1181 EXPECT_TRUE(test_task_runner->HasPendingTask()); |
| 1180 EXPECT_EQ(1u, test_task_runner->GetPendingTaskCount()); | 1182 EXPECT_EQ(1u, test_task_runner->GetPendingTaskCount()); |
| 1181 | 1183 |
| 1182 EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(1); | 1184 EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(1); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 url::SchemeHostPort(GURL("https://www.google.com")), stats1); | 1221 url::SchemeHostPort(GURL("https://www.google.com")), stats1); |
| 1220 | 1222 |
| 1221 // Set a SPDY alternative service for the server. | 1223 // Set a SPDY alternative service for the server. |
| 1222 url::SchemeHostPort server(request_info.url); | 1224 url::SchemeHostPort server(request_info.url); |
| 1223 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 1225 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 1224 SetAlternativeService(request_info, alternative_service); | 1226 SetAlternativeService(request_info, alternative_service); |
| 1225 | 1227 |
| 1226 // The alternative job stalls as host resolution hangs when creating the QUIC | 1228 // The alternative job stalls as host resolution hangs when creating the QUIC |
| 1227 // request and controller should resume the main job with delay. | 1229 // request and controller should resume the main job with delay. |
| 1228 // OnStreamFailed should resume the main job immediately. | 1230 // OnStreamFailed should resume the main job immediately. |
| 1229 request_.reset( | 1231 request_ = |
| 1230 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 1232 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 1231 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 1233 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 1232 EXPECT_TRUE(job_controller_->main_job()); | 1234 EXPECT_TRUE(job_controller_->main_job()); |
| 1233 EXPECT_TRUE(job_controller_->alternative_job()); | 1235 EXPECT_TRUE(job_controller_->alternative_job()); |
| 1234 EXPECT_TRUE(job_controller_->main_job()->is_waiting()); | 1236 EXPECT_TRUE(job_controller_->main_job()->is_waiting()); |
| 1235 | 1237 |
| 1236 EXPECT_TRUE(test_task_runner->HasPendingTask()); | 1238 EXPECT_TRUE(test_task_runner->HasPendingTask()); |
| 1237 EXPECT_EQ(1u, test_task_runner->GetPendingTaskCount()); | 1239 EXPECT_EQ(1u, test_task_runner->GetPendingTaskCount()); |
| 1238 | 1240 |
| 1239 // |alternative_job| fails but should not report status to Request. | 1241 // |alternative_job| fails but should not report status to Request. |
| 1240 EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(0); | 1242 EXPECT_CALL(request_delegate_, OnStreamFailed(_, _)).Times(0); |
| 1241 // Now unblock Resolver to fail the alternate job. | 1243 // Now unblock Resolver to fail the alternate job. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1264 // Using hanging resolver will cause the alternative job to hang indefinitely. | 1266 // Using hanging resolver will cause the alternative job to hang indefinitely. |
| 1265 HangingResolver* resolver = new HangingResolver(); | 1267 HangingResolver* resolver = new HangingResolver(); |
| 1266 session_deps_.host_resolver.reset(resolver); | 1268 session_deps_.host_resolver.reset(resolver); |
| 1267 | 1269 |
| 1268 HttpRequestInfo request_info; | 1270 HttpRequestInfo request_info; |
| 1269 request_info.method = "GET"; | 1271 request_info.method = "GET"; |
| 1270 request_info.url = GURL("https://mail.example.org/"); | 1272 request_info.url = GURL("https://mail.example.org/"); |
| 1271 Initialize(request_info); | 1273 Initialize(request_info); |
| 1272 EXPECT_TRUE(test_proxy_delegate()->alternative_proxy_server().is_quic()); | 1274 EXPECT_TRUE(test_proxy_delegate()->alternative_proxy_server().is_quic()); |
| 1273 | 1275 |
| 1274 request_.reset( | 1276 request_ = |
| 1275 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 1277 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 1276 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 1278 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 1277 EXPECT_TRUE(job_controller_->main_job()); | 1279 EXPECT_TRUE(job_controller_->main_job()); |
| 1278 EXPECT_FALSE(job_controller_->main_job()->is_waiting()); | 1280 EXPECT_FALSE(job_controller_->main_job()->is_waiting()); |
| 1279 EXPECT_FALSE(job_controller_->alternative_job()); | 1281 EXPECT_FALSE(job_controller_->alternative_job()); |
| 1280 | 1282 |
| 1281 EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(0); | 1283 EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(0); |
| 1282 base::RunLoop().RunUntilIdle(); | 1284 base::RunLoop().RunUntilIdle(); |
| 1283 EXPECT_EQ(0, test_proxy_delegate()->get_alternative_proxy_invocations()); | 1285 EXPECT_EQ(0, test_proxy_delegate()->get_alternative_proxy_invocations()); |
| 1284 } | 1286 } |
| 1285 | 1287 |
| 1286 // Verifies that the alternative proxy server job is not created if the main job | 1288 // Verifies that the alternative proxy server job is not created if the main job |
| 1287 // does not fetch the resource through a proxy. | 1289 // does not fetch the resource through a proxy. |
| 1288 TEST_F(HttpStreamFactoryImplJobControllerTest, HttpURLWithNoProxy) { | 1290 TEST_F(HttpStreamFactoryImplJobControllerTest, HttpURLWithNoProxy) { |
| 1289 // Using hanging resolver will cause the alternative job to hang indefinitely. | 1291 // Using hanging resolver will cause the alternative job to hang indefinitely. |
| 1290 HangingResolver* resolver = new HangingResolver(); | 1292 HangingResolver* resolver = new HangingResolver(); |
| 1291 session_deps_.host_resolver.reset(resolver); | 1293 session_deps_.host_resolver.reset(resolver); |
| 1292 | 1294 |
| 1293 HttpRequestInfo request_info; | 1295 HttpRequestInfo request_info; |
| 1294 request_info.method = "GET"; | 1296 request_info.method = "GET"; |
| 1295 request_info.url = GURL("http://mail.example.org/"); | 1297 request_info.url = GURL("http://mail.example.org/"); |
| 1296 | 1298 |
| 1297 Initialize(request_info); | 1299 Initialize(request_info); |
| 1298 EXPECT_TRUE(test_proxy_delegate()->alternative_proxy_server().is_quic()); | 1300 EXPECT_TRUE(test_proxy_delegate()->alternative_proxy_server().is_quic()); |
| 1299 | 1301 |
| 1300 request_.reset( | 1302 request_ = |
| 1301 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 1303 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 1302 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 1304 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 1303 EXPECT_TRUE(job_controller_->main_job()); | 1305 EXPECT_TRUE(job_controller_->main_job()); |
| 1304 EXPECT_FALSE(job_controller_->main_job()->is_waiting()); | 1306 EXPECT_FALSE(job_controller_->main_job()->is_waiting()); |
| 1305 EXPECT_FALSE(job_controller_->alternative_job()); | 1307 EXPECT_FALSE(job_controller_->alternative_job()); |
| 1306 | 1308 |
| 1307 EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(0); | 1309 EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(0); |
| 1308 base::RunLoop().RunUntilIdle(); | 1310 base::RunLoop().RunUntilIdle(); |
| 1309 | 1311 |
| 1310 EXPECT_EQ(0, test_proxy_delegate()->get_alternative_proxy_invocations()); | 1312 EXPECT_EQ(0, test_proxy_delegate()->get_alternative_proxy_invocations()); |
| 1311 } | 1313 } |
| 1312 | 1314 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1332 EXPECT_TRUE(test_proxy_delegate()->alternative_proxy_server().is_quic()); | 1334 EXPECT_TRUE(test_proxy_delegate()->alternative_proxy_server().is_quic()); |
| 1333 | 1335 |
| 1334 // Enable delayed TCP and set time delay for waiting job. | 1336 // Enable delayed TCP and set time delay for waiting job. |
| 1335 QuicStreamFactory* quic_stream_factory = session_->quic_stream_factory(); | 1337 QuicStreamFactory* quic_stream_factory = session_->quic_stream_factory(); |
| 1336 quic_stream_factory->set_require_confirmation(false); | 1338 quic_stream_factory->set_require_confirmation(false); |
| 1337 ServerNetworkStats stats1; | 1339 ServerNetworkStats stats1; |
| 1338 stats1.srtt = base::TimeDelta::FromMicroseconds(10); | 1340 stats1.srtt = base::TimeDelta::FromMicroseconds(10); |
| 1339 session_->http_server_properties()->SetServerNetworkStats( | 1341 session_->http_server_properties()->SetServerNetworkStats( |
| 1340 url::SchemeHostPort(GURL("https://myproxy.org")), stats1); | 1342 url::SchemeHostPort(GURL("https://myproxy.org")), stats1); |
| 1341 | 1343 |
| 1342 request_.reset( | 1344 request_ = |
| 1343 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 1345 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 1344 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 1346 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 1345 EXPECT_TRUE(job_controller_->main_job()); | 1347 EXPECT_TRUE(job_controller_->main_job()); |
| 1346 EXPECT_TRUE(job_controller_->main_job()->is_waiting()); | 1348 EXPECT_TRUE(job_controller_->main_job()->is_waiting()); |
| 1347 EXPECT_TRUE(job_controller_->alternative_job()); | 1349 EXPECT_TRUE(job_controller_->alternative_job()); |
| 1348 // The main job is unblocked but is resumed one message loop iteration later. | 1350 // The main job is unblocked but is resumed one message loop iteration later. |
| 1349 EXPECT_FALSE(JobControllerPeer::main_job_is_blocked(job_controller_)); | 1351 EXPECT_FALSE(JobControllerPeer::main_job_is_blocked(job_controller_)); |
| 1350 EXPECT_FALSE(JobControllerPeer::main_job_is_resumed(job_controller_)); | 1352 EXPECT_FALSE(JobControllerPeer::main_job_is_resumed(job_controller_)); |
| 1351 EXPECT_EQ(1u, test_task_runner->GetPendingTaskCount()); | 1353 EXPECT_EQ(1u, test_task_runner->GetPendingTaskCount()); |
| 1352 | 1354 |
| 1353 // Move forward the delay and verify the main job is resumed. | 1355 // Move forward the delay and verify the main job is resumed. |
| 1354 EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(1); | 1356 EXPECT_CALL(*job_factory_.main_job(), Resume()).Times(1); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 EXPECT_TRUE(test_proxy_delegate()->alternative_proxy_server().is_quic()); | 1390 EXPECT_TRUE(test_proxy_delegate()->alternative_proxy_server().is_quic()); |
| 1389 | 1391 |
| 1390 // Enable delayed TCP and set time delay for waiting job. | 1392 // Enable delayed TCP and set time delay for waiting job. |
| 1391 QuicStreamFactory* quic_stream_factory = session_->quic_stream_factory(); | 1393 QuicStreamFactory* quic_stream_factory = session_->quic_stream_factory(); |
| 1392 quic_stream_factory->set_require_confirmation(false); | 1394 quic_stream_factory->set_require_confirmation(false); |
| 1393 ServerNetworkStats stats1; | 1395 ServerNetworkStats stats1; |
| 1394 stats1.srtt = base::TimeDelta::FromMicroseconds(300 * 1000); | 1396 stats1.srtt = base::TimeDelta::FromMicroseconds(300 * 1000); |
| 1395 session_->http_server_properties()->SetServerNetworkStats( | 1397 session_->http_server_properties()->SetServerNetworkStats( |
| 1396 url::SchemeHostPort(GURL("https://myproxy.org")), stats1); | 1398 url::SchemeHostPort(GURL("https://myproxy.org")), stats1); |
| 1397 | 1399 |
| 1398 request_.reset( | 1400 request_ = |
| 1399 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 1401 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 1400 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 1402 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 1401 EXPECT_TRUE(job_controller_->main_job()); | 1403 EXPECT_TRUE(job_controller_->main_job()); |
| 1402 EXPECT_TRUE(job_controller_->alternative_job()); | 1404 EXPECT_TRUE(job_controller_->alternative_job()); |
| 1403 | 1405 |
| 1404 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) | 1406 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) |
| 1405 .WillOnce(Invoke(DeleteHttpStreamPointer)); | 1407 .WillOnce(Invoke(DeleteHttpStreamPointer)); |
| 1406 | 1408 |
| 1407 base::RunLoop().RunUntilIdle(); | 1409 base::RunLoop().RunUntilIdle(); |
| 1408 | 1410 |
| 1409 EXPECT_FALSE(job_controller_->alternative_job()); | 1411 EXPECT_FALSE(job_controller_->alternative_job()); |
| 1410 EXPECT_TRUE(job_controller_->main_job()); | 1412 EXPECT_TRUE(job_controller_->main_job()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1432 | 1434 |
| 1433 UseAlternativeProxy(); | 1435 UseAlternativeProxy(); |
| 1434 | 1436 |
| 1435 HttpRequestInfo request_info; | 1437 HttpRequestInfo request_info; |
| 1436 request_info.method = "GET"; | 1438 request_info.method = "GET"; |
| 1437 request_info.url = GURL("http://www.google.com"); | 1439 request_info.url = GURL("http://www.google.com"); |
| 1438 Initialize(request_info); | 1440 Initialize(request_info); |
| 1439 | 1441 |
| 1440 url::SchemeHostPort server(request_info.url); | 1442 url::SchemeHostPort server(request_info.url); |
| 1441 | 1443 |
| 1442 request_.reset( | 1444 request_ = |
| 1443 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 1445 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 1444 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 1446 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 1445 EXPECT_TRUE(job_controller_->main_job()); | 1447 EXPECT_TRUE(job_controller_->main_job()); |
| 1446 EXPECT_TRUE(job_controller_->alternative_job()); | 1448 EXPECT_TRUE(job_controller_->alternative_job()); |
| 1447 | 1449 |
| 1448 // Main job succeeds, starts serving Request and it should report status | 1450 // Main job succeeds, starts serving Request and it should report status |
| 1449 // to Request. The alternative job will mark the main job complete and gets | 1451 // to Request. The alternative job will mark the main job complete and gets |
| 1450 // orphaned. | 1452 // orphaned. |
| 1451 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) | 1453 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) |
| 1452 .WillOnce(Invoke(DeleteHttpStreamPointer)); | 1454 .WillOnce(Invoke(DeleteHttpStreamPointer)); |
| 1453 | 1455 |
| 1454 base::RunLoop().RunUntilIdle(); | 1456 base::RunLoop().RunUntilIdle(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 DisableIPBasedPooling(); | 1534 DisableIPBasedPooling(); |
| 1533 if (!enable_alternative_services) | 1535 if (!enable_alternative_services) |
| 1534 DisableAlternativeServices(); | 1536 DisableAlternativeServices(); |
| 1535 | 1537 |
| 1536 Initialize(request_info); | 1538 Initialize(request_info); |
| 1537 | 1539 |
| 1538 url::SchemeHostPort server(request_info.url); | 1540 url::SchemeHostPort server(request_info.url); |
| 1539 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); | 1541 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); |
| 1540 SetAlternativeService(request_info, alternative_service); | 1542 SetAlternativeService(request_info, alternative_service); |
| 1541 | 1543 |
| 1542 request_.reset( | 1544 request_ = |
| 1543 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), | 1545 job_controller_->Start(&request_delegate_, nullptr, NetLogWithSource(), |
| 1544 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY)); | 1546 HttpStreamRequest::HTTP_STREAM, DEFAULT_PRIORITY); |
| 1545 EXPECT_TRUE(job_controller_->main_job()); | 1547 EXPECT_TRUE(job_controller_->main_job()); |
| 1546 if (enable_alternative_services) { | 1548 if (enable_alternative_services) { |
| 1547 EXPECT_TRUE(job_controller_->alternative_job()); | 1549 EXPECT_TRUE(job_controller_->alternative_job()); |
| 1548 } else { | 1550 } else { |
| 1549 EXPECT_FALSE(job_controller_->alternative_job()); | 1551 EXPECT_FALSE(job_controller_->alternative_job()); |
| 1550 } | 1552 } |
| 1551 | 1553 |
| 1552 // |main_job| succeeds and should report status to Request. | 1554 // |main_job| succeeds and should report status to Request. |
| 1553 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) | 1555 EXPECT_CALL(request_delegate_, OnStreamReady(_, _, _)) |
| 1554 .WillOnce(Invoke(DeleteHttpStreamPointer)); | 1556 .WillOnce(Invoke(DeleteHttpStreamPointer)); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 Preconnect(kNumPreconects); | 1623 Preconnect(kNumPreconects); |
| 1622 // If experiment is enabled, only 1 stream is requested. | 1624 // If experiment is enabled, only 1 stream is requested. |
| 1623 EXPECT_EQ( | 1625 EXPECT_EQ( |
| 1624 (int)actual_num_connects, | 1626 (int)actual_num_connects, |
| 1625 HttpStreamFactoryImplJobPeer::GetNumStreams(job_controller_->main_job())); | 1627 HttpStreamFactoryImplJobPeer::GetNumStreams(job_controller_->main_job())); |
| 1626 base::RunLoop().RunUntilIdle(); | 1628 base::RunLoop().RunUntilIdle(); |
| 1627 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); | 1629 EXPECT_TRUE(HttpStreamFactoryImplPeer::IsJobControllerDeleted(factory_)); |
| 1628 } | 1630 } |
| 1629 | 1631 |
| 1630 } // namespace net | 1632 } // namespace net |
| OLD | NEW |