| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic/quic_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "net/base/test_data_directory.h" | 10 #include "net/base/test_data_directory.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 size_t socket_count = socket_factory_.udp_client_socket_ports().size(); | 291 size_t socket_count = socket_factory_.udp_client_socket_ports().size(); |
| 292 | 292 |
| 293 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 293 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 294 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); | 294 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); |
| 295 socket_factory_.AddSocketDataProvider(&socket_data); | 295 socket_factory_.AddSocketDataProvider(&socket_data); |
| 296 | 296 |
| 297 QuicStreamRequest request(factory_.get()); | 297 QuicStreamRequest request(factory_.get()); |
| 298 EXPECT_EQ(ERR_IO_PENDING, | 298 EXPECT_EQ(ERR_IO_PENDING, |
| 299 request.Request(destination, privacy_mode_, | 299 request.Request(destination, privacy_mode_, |
| 300 /*cert_verify_flags=*/0, destination.host(), | 300 /*cert_verify_flags=*/0, destination.host(), |
| 301 "GET", net_log_, callback_.callback())); | 301 "GET", net_log_, callback_.callback(), |
| 302 /*for_bidirectional=*/false)); |
| 302 | 303 |
| 303 EXPECT_EQ(OK, callback_.WaitForResult()); | 304 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 304 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 305 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 305 EXPECT_TRUE(stream.get()); | 306 EXPECT_TRUE(stream.get()); |
| 306 stream.reset(); | 307 stream.reset(); |
| 307 | 308 |
| 308 QuicChromiumClientSession* session = | 309 QuicChromiumClientSession* session = |
| 309 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), destination); | 310 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), destination); |
| 310 | 311 |
| 311 if (socket_count + 1 != socket_factory_.udp_client_socket_ports().size()) { | 312 if (socket_count + 1 != socket_factory_.udp_client_socket_ports().size()) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 435 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 435 | 436 |
| 436 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 437 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 437 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); | 438 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); |
| 438 socket_factory_.AddSocketDataProvider(&socket_data); | 439 socket_factory_.AddSocketDataProvider(&socket_data); |
| 439 | 440 |
| 440 QuicStreamRequest request(factory_.get()); | 441 QuicStreamRequest request(factory_.get()); |
| 441 EXPECT_EQ(ERR_IO_PENDING, | 442 EXPECT_EQ(ERR_IO_PENDING, |
| 442 request.Request(host_port_pair_, privacy_mode_, | 443 request.Request(host_port_pair_, privacy_mode_, |
| 443 /*cert_verify_flags=*/0, host_port_pair_.host(), | 444 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 444 "GET", net_log_, callback_.callback())); | 445 "GET", net_log_, callback_.callback(), |
| 446 /*for_bidirectional=*/false)); |
| 445 | 447 |
| 446 EXPECT_EQ(OK, callback_.WaitForResult()); | 448 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 447 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 449 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 448 EXPECT_TRUE(stream.get()); | 450 EXPECT_TRUE(stream.get()); |
| 449 | 451 |
| 450 // Will reset stream 3. | 452 // Will reset stream 3. |
| 451 stream = CreateFromSession(host_port_pair_); | 453 stream = CreateFromSession(host_port_pair_); |
| 452 EXPECT_TRUE(stream.get()); | 454 EXPECT_TRUE(stream.get()); |
| 453 | 455 |
| 454 // TODO(rtenneti): We should probably have a tests that HTTP and HTTPS result | 456 // TODO(rtenneti): We should probably have a tests that HTTP and HTTPS result |
| 455 // in streams on different sessions. | 457 // in streams on different sessions. |
| 456 QuicStreamRequest request2(factory_.get()); | 458 QuicStreamRequest request2(factory_.get()); |
| 457 EXPECT_EQ(OK, | 459 EXPECT_EQ(OK, |
| 458 request2.Request(host_port_pair_, privacy_mode_, | 460 request2.Request(host_port_pair_, privacy_mode_, |
| 459 /*cert_verify_flags=*/0, host_port_pair_.host(), | 461 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 460 "GET", net_log_, callback_.callback())); | 462 "GET", net_log_, callback_.callback(), |
| 463 /*for_bidirectional=*/false)); |
| 461 stream = request2.ReleaseStream(); // Will reset stream 5. | 464 stream = request2.ReleaseStream(); // Will reset stream 5. |
| 462 stream.reset(); // Will reset stream 7. | 465 stream.reset(); // Will reset stream 7. |
| 463 | 466 |
| 464 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 467 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 465 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 468 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 466 } | 469 } |
| 467 | 470 |
| 468 TEST_P(QuicStreamFactoryTest, CreateZeroRtt) { | 471 TEST_P(QuicStreamFactoryTest, CreateZeroRtt) { |
| 469 Initialize(); | 472 Initialize(); |
| 470 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); | 473 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); |
| 471 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 474 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 472 | 475 |
| 473 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 476 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 474 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); | 477 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); |
| 475 socket_factory_.AddSocketDataProvider(&socket_data); | 478 socket_factory_.AddSocketDataProvider(&socket_data); |
| 476 | 479 |
| 477 crypto_client_stream_factory_.set_handshake_mode( | 480 crypto_client_stream_factory_.set_handshake_mode( |
| 478 MockCryptoClientStream::ZERO_RTT); | 481 MockCryptoClientStream::ZERO_RTT); |
| 479 host_resolver_.set_synchronous_mode(true); | 482 host_resolver_.set_synchronous_mode(true); |
| 480 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 483 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 481 "192.168.0.1", ""); | 484 "192.168.0.1", ""); |
| 482 | 485 |
| 483 QuicStreamRequest request(factory_.get()); | 486 QuicStreamRequest request(factory_.get()); |
| 484 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 487 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 485 /*cert_verify_flags=*/0, host_port_pair_.host(), | 488 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 486 "GET", net_log_, callback_.callback())); | 489 "GET", net_log_, callback_.callback(), |
| 490 /*for_bidirectional=*/false)); |
| 487 | 491 |
| 488 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 492 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 489 EXPECT_TRUE(stream.get()); | 493 EXPECT_TRUE(stream.get()); |
| 490 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 494 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 491 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 495 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 492 } | 496 } |
| 493 | 497 |
| 494 TEST_P(QuicStreamFactoryTest, CreateZeroRttPost) { | 498 TEST_P(QuicStreamFactoryTest, CreateZeroRttPost) { |
| 495 Initialize(); | 499 Initialize(); |
| 496 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); | 500 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); |
| 497 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 501 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 498 | 502 |
| 499 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 503 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 500 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); | 504 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); |
| 501 socket_factory_.AddSocketDataProvider(&socket_data); | 505 socket_factory_.AddSocketDataProvider(&socket_data); |
| 502 | 506 |
| 503 crypto_client_stream_factory_.set_handshake_mode( | 507 crypto_client_stream_factory_.set_handshake_mode( |
| 504 MockCryptoClientStream::ZERO_RTT); | 508 MockCryptoClientStream::ZERO_RTT); |
| 505 host_resolver_.set_synchronous_mode(true); | 509 host_resolver_.set_synchronous_mode(true); |
| 506 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 510 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 507 "192.168.0.1", ""); | 511 "192.168.0.1", ""); |
| 508 | 512 |
| 509 QuicStreamRequest request(factory_.get()); | 513 QuicStreamRequest request(factory_.get()); |
| 510 // Posts require handshake confirmation, so this will return asynchronously. | 514 // Posts require handshake confirmation, so this will return asynchronously. |
| 511 EXPECT_EQ(ERR_IO_PENDING, | 515 EXPECT_EQ(ERR_IO_PENDING, |
| 512 request.Request(host_port_pair_, privacy_mode_, | 516 request.Request(host_port_pair_, privacy_mode_, |
| 513 /*cert_verify_flags=*/0, host_port_pair_.host(), | 517 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 514 "POST", net_log_, callback_.callback())); | 518 "POST", net_log_, callback_.callback(), |
| 519 /*for_bidirectional=*/false)); |
| 515 | 520 |
| 516 // Confirm the handshake and verify that the stream is created. | 521 // Confirm the handshake and verify that the stream is created. |
| 517 crypto_client_stream_factory_.last_stream()->SendOnCryptoHandshakeEvent( | 522 crypto_client_stream_factory_.last_stream()->SendOnCryptoHandshakeEvent( |
| 518 QuicSession::HANDSHAKE_CONFIRMED); | 523 QuicSession::HANDSHAKE_CONFIRMED); |
| 519 | 524 |
| 520 EXPECT_EQ(OK, callback_.WaitForResult()); | 525 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 521 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 526 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 522 EXPECT_TRUE(stream.get()); | 527 EXPECT_TRUE(stream.get()); |
| 523 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 528 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 524 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 529 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 525 } | 530 } |
| 526 | 531 |
| 527 TEST_P(QuicStreamFactoryTest, NoZeroRttForDifferentHost) { | 532 TEST_P(QuicStreamFactoryTest, NoZeroRttForDifferentHost) { |
| 528 Initialize(); | 533 Initialize(); |
| 529 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); | 534 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); |
| 530 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 535 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 531 | 536 |
| 532 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 537 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 533 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); | 538 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); |
| 534 socket_factory_.AddSocketDataProvider(&socket_data); | 539 socket_factory_.AddSocketDataProvider(&socket_data); |
| 535 | 540 |
| 536 crypto_client_stream_factory_.set_handshake_mode( | 541 crypto_client_stream_factory_.set_handshake_mode( |
| 537 MockCryptoClientStream::ZERO_RTT); | 542 MockCryptoClientStream::ZERO_RTT); |
| 538 host_resolver_.set_synchronous_mode(true); | 543 host_resolver_.set_synchronous_mode(true); |
| 539 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 544 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 540 "192.168.0.1", ""); | 545 "192.168.0.1", ""); |
| 541 | 546 |
| 542 QuicStreamRequest request(factory_.get()); | 547 QuicStreamRequest request(factory_.get()); |
| 543 int rv = | 548 int rv = request.Request( |
| 544 request.Request(host_port_pair_, privacy_mode_, /*cert_verify_flags=*/0, | 549 host_port_pair_, privacy_mode_, /*cert_verify_flags=*/0, kServer2HostName, |
| 545 kServer2HostName, "GET", net_log_, callback_.callback()); | 550 "GET", net_log_, callback_.callback(), /*for_bidirectional=*/false); |
| 546 // If server and origin have different hostnames, then handshake confirmation | 551 // If server and origin have different hostnames, then handshake confirmation |
| 547 // should be required, so Request will return asynchronously. | 552 // should be required, so Request will return asynchronously. |
| 548 EXPECT_EQ(ERR_IO_PENDING, rv); | 553 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 549 // Confirm handshake. | 554 // Confirm handshake. |
| 550 crypto_client_stream_factory_.last_stream()->SendOnCryptoHandshakeEvent( | 555 crypto_client_stream_factory_.last_stream()->SendOnCryptoHandshakeEvent( |
| 551 QuicSession::HANDSHAKE_CONFIRMED); | 556 QuicSession::HANDSHAKE_CONFIRMED); |
| 552 EXPECT_EQ(OK, callback_.WaitForResult()); | 557 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 553 | 558 |
| 554 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 559 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 555 EXPECT_TRUE(stream.get()); | 560 EXPECT_TRUE(stream.get()); |
| 556 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 561 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 557 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 562 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 558 } | 563 } |
| 559 | 564 |
| 560 TEST_P(QuicStreamFactoryTest, GoAway) { | 565 TEST_P(QuicStreamFactoryTest, GoAway) { |
| 561 Initialize(); | 566 Initialize(); |
| 562 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); | 567 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); |
| 563 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 568 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 564 | 569 |
| 565 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 570 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 566 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); | 571 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); |
| 567 socket_factory_.AddSocketDataProvider(&socket_data); | 572 socket_factory_.AddSocketDataProvider(&socket_data); |
| 568 | 573 |
| 569 QuicStreamRequest request(factory_.get()); | 574 QuicStreamRequest request(factory_.get()); |
| 570 EXPECT_EQ(ERR_IO_PENDING, | 575 EXPECT_EQ(ERR_IO_PENDING, |
| 571 request.Request(host_port_pair_, privacy_mode_, | 576 request.Request(host_port_pair_, privacy_mode_, |
| 572 /*cert_verify_flags=*/0, host_port_pair_.host(), | 577 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 573 "GET", net_log_, callback_.callback())); | 578 "GET", net_log_, callback_.callback(), |
| 579 /*for_bidirectional=*/false)); |
| 574 | 580 |
| 575 EXPECT_EQ(OK, callback_.WaitForResult()); | 581 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 576 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 582 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 577 EXPECT_TRUE(stream.get()); | 583 EXPECT_TRUE(stream.get()); |
| 578 | 584 |
| 579 QuicChromiumClientSession* session = | 585 QuicChromiumClientSession* session = |
| 580 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 586 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 581 | 587 |
| 582 session->OnGoAway(QuicGoAwayFrame()); | 588 session->OnGoAway(QuicGoAwayFrame()); |
| 583 | 589 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 599 | 605 |
| 600 HostPortPair server2(kServer2HostName, kDefaultServerPort); | 606 HostPortPair server2(kServer2HostName, kDefaultServerPort); |
| 601 host_resolver_.set_synchronous_mode(true); | 607 host_resolver_.set_synchronous_mode(true); |
| 602 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 608 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 603 "192.168.0.1", ""); | 609 "192.168.0.1", ""); |
| 604 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 610 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 605 | 611 |
| 606 QuicStreamRequest request(factory_.get()); | 612 QuicStreamRequest request(factory_.get()); |
| 607 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 613 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 608 /*cert_verify_flags=*/0, host_port_pair_.host(), | 614 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 609 "GET", net_log_, callback_.callback())); | 615 "GET", net_log_, callback_.callback(), |
| 616 /*for_bidirectional=*/false)); |
| 610 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 617 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 611 EXPECT_TRUE(stream.get()); | 618 EXPECT_TRUE(stream.get()); |
| 612 | 619 |
| 613 TestCompletionCallback callback; | 620 TestCompletionCallback callback; |
| 614 QuicStreamRequest request2(factory_.get()); | 621 QuicStreamRequest request2(factory_.get()); |
| 615 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 622 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 616 /*cert_verify_flags=*/0, server2.host(), "GET", | 623 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 617 net_log_, callback.callback())); | 624 net_log_, callback.callback(), |
| 625 /*for_bidirectional=*/false)); |
| 618 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 626 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 619 EXPECT_TRUE(stream2.get()); | 627 EXPECT_TRUE(stream2.get()); |
| 620 | 628 |
| 621 EXPECT_EQ( | 629 EXPECT_EQ( |
| 622 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_), | 630 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_), |
| 623 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); | 631 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); |
| 624 | 632 |
| 625 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 633 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 626 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 634 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 627 } | 635 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 641 | 649 |
| 642 HostPortPair server2(kServer2HostName, kDefaultServerPort); | 650 HostPortPair server2(kServer2HostName, kDefaultServerPort); |
| 643 host_resolver_.set_synchronous_mode(true); | 651 host_resolver_.set_synchronous_mode(true); |
| 644 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 652 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 645 "192.168.0.1", ""); | 653 "192.168.0.1", ""); |
| 646 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 654 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 647 | 655 |
| 648 QuicStreamRequest request(factory_.get()); | 656 QuicStreamRequest request(factory_.get()); |
| 649 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 657 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 650 /*cert_verify_flags=*/0, host_port_pair_.host(), | 658 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 651 "GET", net_log_, callback_.callback())); | 659 "GET", net_log_, callback_.callback(), |
| 660 /*for_bidirectional=*/false)); |
| 652 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 661 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 653 EXPECT_TRUE(stream.get()); | 662 EXPECT_TRUE(stream.get()); |
| 654 | 663 |
| 655 TestCompletionCallback callback; | 664 TestCompletionCallback callback; |
| 656 QuicStreamRequest request2(factory_.get()); | 665 QuicStreamRequest request2(factory_.get()); |
| 657 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 666 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 658 /*cert_verify_flags=*/0, server2.host(), "GET", | 667 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 659 net_log_, callback.callback())); | 668 net_log_, callback.callback(), |
| 669 /*for_bidirectional=*/false)); |
| 660 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 670 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 661 EXPECT_TRUE(stream2.get()); | 671 EXPECT_TRUE(stream2.get()); |
| 662 | 672 |
| 663 EXPECT_NE( | 673 EXPECT_NE( |
| 664 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_), | 674 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_), |
| 665 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); | 675 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); |
| 666 | 676 |
| 667 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); | 677 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); |
| 668 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); | 678 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); |
| 669 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 679 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 684 | 694 |
| 685 HostPortPair server2(kServer2HostName, kDefaultServerPort); | 695 HostPortPair server2(kServer2HostName, kDefaultServerPort); |
| 686 host_resolver_.set_synchronous_mode(true); | 696 host_resolver_.set_synchronous_mode(true); |
| 687 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 697 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 688 "192.168.0.1", ""); | 698 "192.168.0.1", ""); |
| 689 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 699 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 690 | 700 |
| 691 QuicStreamRequest request(factory_.get()); | 701 QuicStreamRequest request(factory_.get()); |
| 692 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 702 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 693 /*cert_verify_flags=*/0, host_port_pair_.host(), | 703 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 694 "GET", net_log_, callback_.callback())); | 704 "GET", net_log_, callback_.callback(), |
| 705 /*for_bidirectional=*/false)); |
| 695 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 706 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 696 EXPECT_TRUE(stream.get()); | 707 EXPECT_TRUE(stream.get()); |
| 697 | 708 |
| 698 TestCompletionCallback callback; | 709 TestCompletionCallback callback; |
| 699 QuicStreamRequest request2(factory_.get()); | 710 QuicStreamRequest request2(factory_.get()); |
| 700 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 711 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 701 /*cert_verify_flags=*/0, server2.host(), "GET", | 712 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 702 net_log_, callback.callback())); | 713 net_log_, callback.callback(), |
| 714 /*for_bidirectional=*/false)); |
| 703 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 715 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 704 EXPECT_TRUE(stream2.get()); | 716 EXPECT_TRUE(stream2.get()); |
| 705 | 717 |
| 706 factory_->OnSessionGoingAway( | 718 factory_->OnSessionGoingAway( |
| 707 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_)); | 719 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_)); |
| 708 EXPECT_FALSE( | 720 EXPECT_FALSE( |
| 709 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); | 721 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); |
| 710 EXPECT_FALSE( | 722 EXPECT_FALSE( |
| 711 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), server2)); | 723 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), server2)); |
| 712 | 724 |
| 713 TestCompletionCallback callback3; | 725 TestCompletionCallback callback3; |
| 714 QuicStreamRequest request3(factory_.get()); | 726 QuicStreamRequest request3(factory_.get()); |
| 715 EXPECT_EQ(OK, request3.Request(server2, privacy_mode_, | 727 EXPECT_EQ(OK, request3.Request(server2, privacy_mode_, |
| 716 /*cert_verify_flags=*/0, server2.host(), "GET", | 728 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 717 net_log_, callback3.callback())); | 729 net_log_, callback3.callback(), |
| 730 /*for_bidirectional=*/false)); |
| 718 scoped_ptr<QuicHttpStream> stream3 = request3.ReleaseStream(); | 731 scoped_ptr<QuicHttpStream> stream3 = request3.ReleaseStream(); |
| 719 EXPECT_TRUE(stream3.get()); | 732 EXPECT_TRUE(stream3.get()); |
| 720 | 733 |
| 721 EXPECT_TRUE(QuicStreamFactoryPeer::HasActiveSession(factory_.get(), server2)); | 734 EXPECT_TRUE(QuicStreamFactoryPeer::HasActiveSession(factory_.get(), server2)); |
| 722 | 735 |
| 723 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); | 736 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); |
| 724 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); | 737 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); |
| 725 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 738 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
| 726 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); | 739 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); |
| 727 } | 740 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 739 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); | 752 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); |
| 740 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 753 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 741 | 754 |
| 742 host_resolver_.set_synchronous_mode(true); | 755 host_resolver_.set_synchronous_mode(true); |
| 743 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); | 756 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); |
| 744 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 757 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 745 | 758 |
| 746 QuicStreamRequest request(factory_.get()); | 759 QuicStreamRequest request(factory_.get()); |
| 747 EXPECT_EQ(OK, request.Request(server1, privacy_mode_, | 760 EXPECT_EQ(OK, request.Request(server1, privacy_mode_, |
| 748 /*cert_verify_flags=*/0, server1.host(), "GET", | 761 /*cert_verify_flags=*/0, server1.host(), "GET", |
| 749 net_log_, callback_.callback())); | 762 net_log_, callback_.callback(), |
| 763 /*for_bidirectional=*/false)); |
| 750 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 764 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 751 EXPECT_TRUE(stream.get()); | 765 EXPECT_TRUE(stream.get()); |
| 752 | 766 |
| 753 TestCompletionCallback callback; | 767 TestCompletionCallback callback; |
| 754 QuicStreamRequest request2(factory_.get()); | 768 QuicStreamRequest request2(factory_.get()); |
| 755 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 769 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 756 /*cert_verify_flags=*/0, server2.host(), "GET", | 770 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 757 net_log_, callback_.callback())); | 771 net_log_, callback_.callback(), |
| 772 /*for_bidirectional=*/false)); |
| 758 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 773 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 759 EXPECT_TRUE(stream2.get()); | 774 EXPECT_TRUE(stream2.get()); |
| 760 | 775 |
| 761 EXPECT_EQ(QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server1), | 776 EXPECT_EQ(QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server1), |
| 762 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); | 777 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); |
| 763 | 778 |
| 764 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 779 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 765 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 780 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 766 } | 781 } |
| 767 | 782 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 782 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 797 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 783 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 798 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 784 | 799 |
| 785 host_resolver_.set_synchronous_mode(true); | 800 host_resolver_.set_synchronous_mode(true); |
| 786 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); | 801 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); |
| 787 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 802 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 788 | 803 |
| 789 QuicStreamRequest request(factory_.get()); | 804 QuicStreamRequest request(factory_.get()); |
| 790 EXPECT_EQ(OK, request.Request(server1, privacy_mode_, | 805 EXPECT_EQ(OK, request.Request(server1, privacy_mode_, |
| 791 /*cert_verify_flags=*/0, server1.host(), "GET", | 806 /*cert_verify_flags=*/0, server1.host(), "GET", |
| 792 net_log_, callback_.callback())); | 807 net_log_, callback_.callback(), |
| 808 /*for_bidirectional=*/false)); |
| 793 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 809 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 794 EXPECT_TRUE(stream.get()); | 810 EXPECT_TRUE(stream.get()); |
| 795 | 811 |
| 796 TestCompletionCallback callback; | 812 TestCompletionCallback callback; |
| 797 QuicStreamRequest request2(factory_.get()); | 813 QuicStreamRequest request2(factory_.get()); |
| 798 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 814 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 799 /*cert_verify_flags=*/0, server2.host(), "GET", | 815 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 800 net_log_, callback_.callback())); | 816 net_log_, callback_.callback(), |
| 817 /*for_bidirectional=*/false)); |
| 801 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 818 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 802 EXPECT_TRUE(stream2.get()); | 819 EXPECT_TRUE(stream2.get()); |
| 803 | 820 |
| 804 EXPECT_NE(QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server1), | 821 EXPECT_NE(QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server1), |
| 805 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); | 822 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); |
| 806 | 823 |
| 807 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); | 824 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); |
| 808 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); | 825 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); |
| 809 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 826 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
| 810 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); | 827 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 835 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 852 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 836 | 853 |
| 837 host_resolver_.set_synchronous_mode(true); | 854 host_resolver_.set_synchronous_mode(true); |
| 838 host_resolver_.rules()->AddIPLiteralRule(alternative.host(), "192.168.0.1", | 855 host_resolver_.rules()->AddIPLiteralRule(alternative.host(), "192.168.0.1", |
| 839 ""); | 856 ""); |
| 840 | 857 |
| 841 // Open first stream to alternative. | 858 // Open first stream to alternative. |
| 842 QuicStreamRequest request1(factory_.get()); | 859 QuicStreamRequest request1(factory_.get()); |
| 843 EXPECT_EQ(OK, request1.Request(alternative, privacy_mode_, | 860 EXPECT_EQ(OK, request1.Request(alternative, privacy_mode_, |
| 844 /*cert_verify_flags=*/0, alternative.host(), | 861 /*cert_verify_flags=*/0, alternative.host(), |
| 845 "GET", net_log_, callback_.callback())); | 862 "GET", net_log_, callback_.callback(), |
| 863 /*for_bidirectional=*/false)); |
| 846 scoped_ptr<QuicHttpStream> stream1 = request1.ReleaseStream(); | 864 scoped_ptr<QuicHttpStream> stream1 = request1.ReleaseStream(); |
| 847 EXPECT_TRUE(stream1.get()); | 865 EXPECT_TRUE(stream1.get()); |
| 848 | 866 |
| 849 QuicStreamRequest request2(factory_.get()); | 867 QuicStreamRequest request2(factory_.get()); |
| 850 int rv = request2.Request(alternative, privacy_mode_, | 868 int rv = |
| 851 /*cert_verify_flags=*/0, origin_host, "GET", | 869 request2.Request(alternative, privacy_mode_, |
| 852 net_log_, callback_.callback()); | 870 /*cert_verify_flags=*/0, origin_host, "GET", net_log_, |
| 871 callback_.callback(), /*for_bidirectional=*/false); |
| 853 if (valid) { | 872 if (valid) { |
| 854 // Alternative service of origin to |alternative| should pool to session | 873 // Alternative service of origin to |alternative| should pool to session |
| 855 // of |stream1| even if origin is different. Since only one | 874 // of |stream1| even if origin is different. Since only one |
| 856 // SocketDataProvider is set up, the second request succeeding means that | 875 // SocketDataProvider is set up, the second request succeeding means that |
| 857 // it pooled to the session opened by the first one. | 876 // it pooled to the session opened by the first one. |
| 858 EXPECT_EQ(OK, rv); | 877 EXPECT_EQ(OK, rv); |
| 859 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 878 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 860 EXPECT_TRUE(stream2.get()); | 879 EXPECT_TRUE(stream2.get()); |
| 861 } else { | 880 } else { |
| 862 EXPECT_EQ(ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN, rv); | 881 EXPECT_EQ(ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN, rv); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 test::GetTestHashValue(primary_pin)); | 918 test::GetTestHashValue(primary_pin)); |
| 900 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 919 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 901 | 920 |
| 902 host_resolver_.set_synchronous_mode(true); | 921 host_resolver_.set_synchronous_mode(true); |
| 903 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); | 922 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); |
| 904 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 923 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 905 | 924 |
| 906 QuicStreamRequest request(factory_.get()); | 925 QuicStreamRequest request(factory_.get()); |
| 907 EXPECT_EQ(OK, request.Request(server1, privacy_mode_, | 926 EXPECT_EQ(OK, request.Request(server1, privacy_mode_, |
| 908 /*cert_verify_flags=*/0, server1.host(), "GET", | 927 /*cert_verify_flags=*/0, server1.host(), "GET", |
| 909 net_log_, callback_.callback())); | 928 net_log_, callback_.callback(), |
| 929 /*for_bidirectional=*/false)); |
| 910 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 930 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 911 EXPECT_TRUE(stream.get()); | 931 EXPECT_TRUE(stream.get()); |
| 912 | 932 |
| 913 TestCompletionCallback callback; | 933 TestCompletionCallback callback; |
| 914 QuicStreamRequest request2(factory_.get()); | 934 QuicStreamRequest request2(factory_.get()); |
| 915 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 935 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 916 /*cert_verify_flags=*/0, server2.host(), "GET", | 936 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 917 net_log_, callback_.callback())); | 937 net_log_, callback_.callback(), |
| 938 /*for_bidirectional=*/false)); |
| 918 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 939 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 919 EXPECT_TRUE(stream2.get()); | 940 EXPECT_TRUE(stream2.get()); |
| 920 | 941 |
| 921 EXPECT_EQ(QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server1), | 942 EXPECT_EQ(QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server1), |
| 922 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); | 943 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); |
| 923 | 944 |
| 924 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 945 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 925 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 946 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 926 } | 947 } |
| 927 | 948 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 948 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 969 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 949 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 970 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 950 | 971 |
| 951 host_resolver_.set_synchronous_mode(true); | 972 host_resolver_.set_synchronous_mode(true); |
| 952 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); | 973 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); |
| 953 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 974 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 954 | 975 |
| 955 QuicStreamRequest request(factory_.get()); | 976 QuicStreamRequest request(factory_.get()); |
| 956 EXPECT_EQ(OK, request.Request(server1, privacy_mode_, | 977 EXPECT_EQ(OK, request.Request(server1, privacy_mode_, |
| 957 /*cert_verify_flags=*/0, server1.host(), "GET", | 978 /*cert_verify_flags=*/0, server1.host(), "GET", |
| 958 net_log_, callback_.callback())); | 979 net_log_, callback_.callback(), |
| 980 /*for_bidirectional=*/false)); |
| 959 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 981 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 960 EXPECT_TRUE(stream.get()); | 982 EXPECT_TRUE(stream.get()); |
| 961 | 983 |
| 962 TestCompletionCallback callback; | 984 TestCompletionCallback callback; |
| 963 QuicStreamRequest request2(factory_.get()); | 985 QuicStreamRequest request2(factory_.get()); |
| 964 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 986 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 965 /*cert_verify_flags=*/0, server2.host(), "GET", | 987 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 966 net_log_, callback_.callback())); | 988 net_log_, callback_.callback(), |
| 989 /*for_bidirectional=*/false)); |
| 967 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 990 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 968 EXPECT_TRUE(stream2.get()); | 991 EXPECT_TRUE(stream2.get()); |
| 969 | 992 |
| 970 EXPECT_NE(QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server1), | 993 EXPECT_NE(QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server1), |
| 971 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); | 994 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); |
| 972 | 995 |
| 973 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); | 996 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); |
| 974 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); | 997 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); |
| 975 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 998 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
| 976 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); | 999 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1002 test::GetTestHashValue(primary_pin)); | 1025 test::GetTestHashValue(primary_pin)); |
| 1003 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details2); | 1026 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details2); |
| 1004 | 1027 |
| 1005 host_resolver_.set_synchronous_mode(true); | 1028 host_resolver_.set_synchronous_mode(true); |
| 1006 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); | 1029 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); |
| 1007 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 1030 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 1008 | 1031 |
| 1009 QuicStreamRequest request(factory_.get()); | 1032 QuicStreamRequest request(factory_.get()); |
| 1010 EXPECT_EQ(OK, request.Request(server1, privacy_mode_, | 1033 EXPECT_EQ(OK, request.Request(server1, privacy_mode_, |
| 1011 /*cert_verify_flags=*/0, server1.host(), "GET", | 1034 /*cert_verify_flags=*/0, server1.host(), "GET", |
| 1012 net_log_, callback_.callback())); | 1035 net_log_, callback_.callback(), |
| 1036 /*for_bidirectional=*/false)); |
| 1013 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1037 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1014 EXPECT_TRUE(stream.get()); | 1038 EXPECT_TRUE(stream.get()); |
| 1015 | 1039 |
| 1016 TestCompletionCallback callback; | 1040 TestCompletionCallback callback; |
| 1017 QuicStreamRequest request2(factory_.get()); | 1041 QuicStreamRequest request2(factory_.get()); |
| 1018 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 1042 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 1019 /*cert_verify_flags=*/0, server2.host(), "GET", | 1043 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 1020 net_log_, callback_.callback())); | 1044 net_log_, callback_.callback(), |
| 1045 /*for_bidirectional=*/false)); |
| 1021 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 1046 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 1022 EXPECT_TRUE(stream2.get()); | 1047 EXPECT_TRUE(stream2.get()); |
| 1023 | 1048 |
| 1024 EXPECT_NE(QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server1), | 1049 EXPECT_NE(QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server1), |
| 1025 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); | 1050 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2)); |
| 1026 | 1051 |
| 1027 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); | 1052 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); |
| 1028 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); | 1053 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); |
| 1029 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 1054 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
| 1030 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); | 1055 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); |
| 1031 } | 1056 } |
| 1032 | 1057 |
| 1033 TEST_P(QuicStreamFactoryTest, Goaway) { | 1058 TEST_P(QuicStreamFactoryTest, Goaway) { |
| 1034 Initialize(); | 1059 Initialize(); |
| 1035 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); | 1060 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); |
| 1036 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 1061 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 1037 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 1062 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
| 1038 | 1063 |
| 1039 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 1064 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 1040 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); | 1065 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); |
| 1041 socket_factory_.AddSocketDataProvider(&socket_data); | 1066 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1042 SequencedSocketData socket_data2(reads, arraysize(reads), nullptr, 0); | 1067 SequencedSocketData socket_data2(reads, arraysize(reads), nullptr, 0); |
| 1043 socket_factory_.AddSocketDataProvider(&socket_data2); | 1068 socket_factory_.AddSocketDataProvider(&socket_data2); |
| 1044 | 1069 |
| 1045 QuicStreamRequest request(factory_.get()); | 1070 QuicStreamRequest request(factory_.get()); |
| 1046 EXPECT_EQ(ERR_IO_PENDING, | 1071 EXPECT_EQ(ERR_IO_PENDING, |
| 1047 request.Request(host_port_pair_, privacy_mode_, | 1072 request.Request(host_port_pair_, privacy_mode_, |
| 1048 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1073 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1049 "GET", net_log_, callback_.callback())); | 1074 "GET", net_log_, callback_.callback(), |
| 1075 /*for_bidirectional=*/false)); |
| 1050 | 1076 |
| 1051 EXPECT_EQ(OK, callback_.WaitForResult()); | 1077 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1052 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1078 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1053 EXPECT_TRUE(stream.get()); | 1079 EXPECT_TRUE(stream.get()); |
| 1054 | 1080 |
| 1055 // Mark the session as going away. Ensure that while it is still alive | 1081 // Mark the session as going away. Ensure that while it is still alive |
| 1056 // that it is no longer active. | 1082 // that it is no longer active. |
| 1057 QuicChromiumClientSession* session = | 1083 QuicChromiumClientSession* session = |
| 1058 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 1084 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 1059 factory_->OnSessionGoingAway(session); | 1085 factory_->OnSessionGoingAway(session); |
| 1060 EXPECT_EQ(true, | 1086 EXPECT_EQ(true, |
| 1061 QuicStreamFactoryPeer::IsLiveSession(factory_.get(), session)); | 1087 QuicStreamFactoryPeer::IsLiveSession(factory_.get(), session)); |
| 1062 EXPECT_FALSE( | 1088 EXPECT_FALSE( |
| 1063 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); | 1089 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); |
| 1064 EXPECT_FALSE(HasActiveSession(host_port_pair_)); | 1090 EXPECT_FALSE(HasActiveSession(host_port_pair_)); |
| 1065 | 1091 |
| 1066 // Create a new request for the same destination and verify that a | 1092 // Create a new request for the same destination and verify that a |
| 1067 // new session is created. | 1093 // new session is created. |
| 1068 QuicStreamRequest request2(factory_.get()); | 1094 QuicStreamRequest request2(factory_.get()); |
| 1069 EXPECT_EQ(ERR_IO_PENDING, | 1095 EXPECT_EQ(ERR_IO_PENDING, |
| 1070 request2.Request(host_port_pair_, privacy_mode_, | 1096 request2.Request(host_port_pair_, privacy_mode_, |
| 1071 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1097 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1072 "GET", net_log_, callback_.callback())); | 1098 "GET", net_log_, callback_.callback(), |
| 1099 /*for_bidirectional=*/false)); |
| 1073 EXPECT_EQ(OK, callback_.WaitForResult()); | 1100 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1074 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 1101 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 1075 EXPECT_TRUE(stream2.get()); | 1102 EXPECT_TRUE(stream2.get()); |
| 1076 | 1103 |
| 1077 EXPECT_TRUE( | 1104 EXPECT_TRUE( |
| 1078 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); | 1105 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); |
| 1079 EXPECT_NE(session, QuicStreamFactoryPeer::GetActiveSession(factory_.get(), | 1106 EXPECT_NE(session, QuicStreamFactoryPeer::GetActiveSession(factory_.get(), |
| 1080 host_port_pair_)); | 1107 host_port_pair_)); |
| 1081 EXPECT_EQ(true, | 1108 EXPECT_EQ(true, |
| 1082 QuicStreamFactoryPeer::IsLiveSession(factory_.get(), session)); | 1109 QuicStreamFactoryPeer::IsLiveSession(factory_.get(), session)); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1111 socket_factory_.AddSocketDataProvider(&socket_data); | 1138 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1112 | 1139 |
| 1113 HttpRequestInfo request_info; | 1140 HttpRequestInfo request_info; |
| 1114 std::vector<QuicHttpStream*> streams; | 1141 std::vector<QuicHttpStream*> streams; |
| 1115 // The MockCryptoClientStream sets max_open_streams to be | 1142 // The MockCryptoClientStream sets max_open_streams to be |
| 1116 // kDefaultMaxStreamsPerConnection / 2. | 1143 // kDefaultMaxStreamsPerConnection / 2. |
| 1117 for (size_t i = 0; i < kDefaultMaxStreamsPerConnection / 2; i++) { | 1144 for (size_t i = 0; i < kDefaultMaxStreamsPerConnection / 2; i++) { |
| 1118 QuicStreamRequest request(factory_.get()); | 1145 QuicStreamRequest request(factory_.get()); |
| 1119 int rv = request.Request(host_port_pair_, privacy_mode_, | 1146 int rv = request.Request(host_port_pair_, privacy_mode_, |
| 1120 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1147 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1121 "GET", net_log_, callback_.callback()); | 1148 "GET", net_log_, callback_.callback(), |
| 1149 /*for_bidirectional=*/false); |
| 1122 if (i == 0) { | 1150 if (i == 0) { |
| 1123 EXPECT_EQ(ERR_IO_PENDING, rv); | 1151 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1124 EXPECT_EQ(OK, callback_.WaitForResult()); | 1152 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1125 } else { | 1153 } else { |
| 1126 EXPECT_EQ(OK, rv); | 1154 EXPECT_EQ(OK, rv); |
| 1127 } | 1155 } |
| 1128 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1156 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1129 EXPECT_TRUE(stream); | 1157 EXPECT_TRUE(stream); |
| 1130 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 1158 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 1131 net_log_, CompletionCallback())); | 1159 net_log_, CompletionCallback())); |
| 1132 streams.push_back(stream.release()); | 1160 streams.push_back(stream.release()); |
| 1133 } | 1161 } |
| 1134 | 1162 |
| 1135 QuicStreamRequest request(factory_.get()); | 1163 QuicStreamRequest request(factory_.get()); |
| 1136 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 1164 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 1137 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1165 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1138 "GET", net_log_, CompletionCallback())); | 1166 "GET", net_log_, CompletionCallback(), |
| 1167 /*for_bidirectional=*/false)); |
| 1139 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1168 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1140 EXPECT_TRUE(stream); | 1169 EXPECT_TRUE(stream); |
| 1141 EXPECT_EQ(ERR_IO_PENDING, | 1170 EXPECT_EQ(ERR_IO_PENDING, |
| 1142 stream->InitializeStream(&request_info, DEFAULT_PRIORITY, net_log_, | 1171 stream->InitializeStream(&request_info, DEFAULT_PRIORITY, net_log_, |
| 1143 callback_.callback())); | 1172 callback_.callback())); |
| 1144 | 1173 |
| 1145 // Close the first stream. | 1174 // Close the first stream. |
| 1146 streams.front()->Close(false); | 1175 streams.front()->Close(false); |
| 1147 // Trigger exchange of RSTs that in turn allow progress for the last | 1176 // Trigger exchange of RSTs that in turn allow progress for the last |
| 1148 // stream. | 1177 // stream. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1166 Initialize(); | 1195 Initialize(); |
| 1167 SequencedSocketData socket_data(nullptr, 0, nullptr, 0); | 1196 SequencedSocketData socket_data(nullptr, 0, nullptr, 0); |
| 1168 socket_factory_.AddSocketDataProvider(&socket_data); | 1197 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1169 | 1198 |
| 1170 host_resolver_.rules()->AddSimulatedFailure(kDefaultServerHostName); | 1199 host_resolver_.rules()->AddSimulatedFailure(kDefaultServerHostName); |
| 1171 | 1200 |
| 1172 QuicStreamRequest request(factory_.get()); | 1201 QuicStreamRequest request(factory_.get()); |
| 1173 EXPECT_EQ(ERR_IO_PENDING, | 1202 EXPECT_EQ(ERR_IO_PENDING, |
| 1174 request.Request(host_port_pair_, privacy_mode_, | 1203 request.Request(host_port_pair_, privacy_mode_, |
| 1175 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1204 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1176 "GET", net_log_, callback_.callback())); | 1205 "GET", net_log_, callback_.callback(), |
| 1206 /*for_bidirectional=*/false)); |
| 1177 | 1207 |
| 1178 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, callback_.WaitForResult()); | 1208 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, callback_.WaitForResult()); |
| 1179 | 1209 |
| 1180 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 1210 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 1181 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 1211 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 1182 } | 1212 } |
| 1183 | 1213 |
| 1184 TEST_P(QuicStreamFactoryTest, ConnectErrorInCreate) { | 1214 TEST_P(QuicStreamFactoryTest, ConnectErrorInCreate) { |
| 1185 Initialize(); | 1215 Initialize(); |
| 1186 MockConnect connect(SYNCHRONOUS, ERR_ADDRESS_IN_USE); | 1216 MockConnect connect(SYNCHRONOUS, ERR_ADDRESS_IN_USE); |
| 1187 SequencedSocketData socket_data(nullptr, 0, nullptr, 0); | 1217 SequencedSocketData socket_data(nullptr, 0, nullptr, 0); |
| 1188 socket_data.set_connect_data(connect); | 1218 socket_data.set_connect_data(connect); |
| 1189 socket_factory_.AddSocketDataProvider(&socket_data); | 1219 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1190 | 1220 |
| 1191 QuicStreamRequest request(factory_.get()); | 1221 QuicStreamRequest request(factory_.get()); |
| 1192 EXPECT_EQ(ERR_IO_PENDING, | 1222 EXPECT_EQ(ERR_IO_PENDING, |
| 1193 request.Request(host_port_pair_, privacy_mode_, | 1223 request.Request(host_port_pair_, privacy_mode_, |
| 1194 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1224 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1195 "GET", net_log_, callback_.callback())); | 1225 "GET", net_log_, callback_.callback(), |
| 1226 /*for_bidirectional=*/false)); |
| 1196 | 1227 |
| 1197 EXPECT_EQ(ERR_ADDRESS_IN_USE, callback_.WaitForResult()); | 1228 EXPECT_EQ(ERR_ADDRESS_IN_USE, callback_.WaitForResult()); |
| 1198 | 1229 |
| 1199 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 1230 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 1200 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 1231 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 1201 } | 1232 } |
| 1202 | 1233 |
| 1203 TEST_P(QuicStreamFactoryTest, CancelCreate) { | 1234 TEST_P(QuicStreamFactoryTest, CancelCreate) { |
| 1204 Initialize(); | 1235 Initialize(); |
| 1205 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 1236 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 1206 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); | 1237 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); |
| 1207 socket_factory_.AddSocketDataProvider(&socket_data); | 1238 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1208 { | 1239 { |
| 1209 QuicStreamRequest request(factory_.get()); | 1240 QuicStreamRequest request(factory_.get()); |
| 1210 EXPECT_EQ(ERR_IO_PENDING, | 1241 EXPECT_EQ(ERR_IO_PENDING, |
| 1211 request.Request(host_port_pair_, privacy_mode_, | 1242 request.Request(host_port_pair_, privacy_mode_, |
| 1212 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1243 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1213 "GET", net_log_, callback_.callback())); | 1244 "GET", net_log_, callback_.callback(), |
| 1245 /*for_bidirectional=*/false)); |
| 1214 } | 1246 } |
| 1215 | 1247 |
| 1216 base::RunLoop().RunUntilIdle(); | 1248 base::RunLoop().RunUntilIdle(); |
| 1217 | 1249 |
| 1218 scoped_ptr<QuicHttpStream> stream(CreateFromSession(host_port_pair_)); | 1250 scoped_ptr<QuicHttpStream> stream(CreateFromSession(host_port_pair_)); |
| 1219 EXPECT_TRUE(stream.get()); | 1251 EXPECT_TRUE(stream.get()); |
| 1220 stream.reset(); | 1252 stream.reset(); |
| 1221 | 1253 |
| 1222 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 1254 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 1223 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 1255 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 socket_factory_.AddSocketDataProvider(&socket_data); | 1306 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1275 | 1307 |
| 1276 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 1308 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 1277 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); | 1309 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); |
| 1278 socket_factory_.AddSocketDataProvider(&socket_data2); | 1310 socket_factory_.AddSocketDataProvider(&socket_data2); |
| 1279 | 1311 |
| 1280 QuicStreamRequest request(factory_.get()); | 1312 QuicStreamRequest request(factory_.get()); |
| 1281 EXPECT_EQ(ERR_IO_PENDING, | 1313 EXPECT_EQ(ERR_IO_PENDING, |
| 1282 request.Request(host_port_pair_, privacy_mode_, | 1314 request.Request(host_port_pair_, privacy_mode_, |
| 1283 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1315 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1284 "GET", net_log_, callback_.callback())); | 1316 "GET", net_log_, callback_.callback(), |
| 1317 /*for_bidirectional=*/false)); |
| 1285 | 1318 |
| 1286 EXPECT_EQ(OK, callback_.WaitForResult()); | 1319 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1287 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1320 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1288 HttpRequestInfo request_info; | 1321 HttpRequestInfo request_info; |
| 1289 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 1322 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 1290 net_log_, CompletionCallback())); | 1323 net_log_, CompletionCallback())); |
| 1291 | 1324 |
| 1292 // Close the session and verify that stream saw the error. | 1325 // Close the session and verify that stream saw the error. |
| 1293 factory_->CloseAllSessions(ERR_INTERNET_DISCONNECTED, QUIC_INTERNAL_ERROR); | 1326 factory_->CloseAllSessions(ERR_INTERNET_DISCONNECTED, QUIC_INTERNAL_ERROR); |
| 1294 EXPECT_EQ(ERR_INTERNET_DISCONNECTED, | 1327 EXPECT_EQ(ERR_INTERNET_DISCONNECTED, |
| 1295 stream->ReadResponseHeaders(callback_.callback())); | 1328 stream->ReadResponseHeaders(callback_.callback())); |
| 1296 | 1329 |
| 1297 // Now attempting to request a stream to the same origin should create | 1330 // Now attempting to request a stream to the same origin should create |
| 1298 // a new session. | 1331 // a new session. |
| 1299 | 1332 |
| 1300 QuicStreamRequest request2(factory_.get()); | 1333 QuicStreamRequest request2(factory_.get()); |
| 1301 EXPECT_EQ(ERR_IO_PENDING, | 1334 EXPECT_EQ(ERR_IO_PENDING, |
| 1302 request2.Request(host_port_pair_, privacy_mode_, | 1335 request2.Request(host_port_pair_, privacy_mode_, |
| 1303 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1336 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1304 "GET", net_log_, callback_.callback())); | 1337 "GET", net_log_, callback_.callback(), |
| 1338 /*for_bidirectional=*/false)); |
| 1305 | 1339 |
| 1306 EXPECT_EQ(OK, callback_.WaitForResult()); | 1340 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1307 stream = request2.ReleaseStream(); | 1341 stream = request2.ReleaseStream(); |
| 1308 stream.reset(); // Will reset stream 3. | 1342 stream.reset(); // Will reset stream 3. |
| 1309 | 1343 |
| 1310 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 1344 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 1311 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 1345 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 1312 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 1346 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
| 1313 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); | 1347 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); |
| 1314 } | 1348 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1330 socket_factory_.AddSocketDataProvider(&socket_data); | 1364 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1331 | 1365 |
| 1332 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 1366 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 1333 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); | 1367 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); |
| 1334 socket_factory_.AddSocketDataProvider(&socket_data2); | 1368 socket_factory_.AddSocketDataProvider(&socket_data2); |
| 1335 | 1369 |
| 1336 QuicStreamRequest request(factory_.get()); | 1370 QuicStreamRequest request(factory_.get()); |
| 1337 EXPECT_EQ(ERR_IO_PENDING, | 1371 EXPECT_EQ(ERR_IO_PENDING, |
| 1338 request.Request(host_port_pair_, privacy_mode_, | 1372 request.Request(host_port_pair_, privacy_mode_, |
| 1339 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1373 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1340 "GET", net_log_, callback_.callback())); | 1374 "GET", net_log_, callback_.callback(), |
| 1375 /*for_bidirectional=*/false)); |
| 1341 | 1376 |
| 1342 EXPECT_EQ(OK, callback_.WaitForResult()); | 1377 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1343 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1378 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1344 HttpRequestInfo request_info; | 1379 HttpRequestInfo request_info; |
| 1345 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 1380 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 1346 net_log_, CompletionCallback())); | 1381 net_log_, CompletionCallback())); |
| 1347 | 1382 |
| 1348 // Change the IP address and verify that stream saw the error. | 1383 // Change the IP address and verify that stream saw the error. |
| 1349 NotifyIPAddressChanged(); | 1384 NotifyIPAddressChanged(); |
| 1350 EXPECT_EQ(ERR_NETWORK_CHANGED, | 1385 EXPECT_EQ(ERR_NETWORK_CHANGED, |
| 1351 stream->ReadResponseHeaders(callback_.callback())); | 1386 stream->ReadResponseHeaders(callback_.callback())); |
| 1352 EXPECT_TRUE(factory_->require_confirmation()); | 1387 EXPECT_TRUE(factory_->require_confirmation()); |
| 1353 | 1388 |
| 1354 // Now attempting to request a stream to the same origin should create | 1389 // Now attempting to request a stream to the same origin should create |
| 1355 // a new session. | 1390 // a new session. |
| 1356 | 1391 |
| 1357 QuicStreamRequest request2(factory_.get()); | 1392 QuicStreamRequest request2(factory_.get()); |
| 1358 EXPECT_EQ(ERR_IO_PENDING, | 1393 EXPECT_EQ(ERR_IO_PENDING, |
| 1359 request2.Request(host_port_pair_, privacy_mode_, | 1394 request2.Request(host_port_pair_, privacy_mode_, |
| 1360 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1395 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1361 "GET", net_log_, callback_.callback())); | 1396 "GET", net_log_, callback_.callback(), |
| 1397 /*for_bidirectional=*/false)); |
| 1362 | 1398 |
| 1363 EXPECT_EQ(OK, callback_.WaitForResult()); | 1399 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1364 stream = request2.ReleaseStream(); | 1400 stream = request2.ReleaseStream(); |
| 1365 stream.reset(); // Will reset stream 3. | 1401 stream.reset(); // Will reset stream 3. |
| 1366 | 1402 |
| 1367 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 1403 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 1368 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 1404 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 1369 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 1405 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
| 1370 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); | 1406 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); |
| 1371 } | 1407 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1384 request_packet->length(), 1)}; | 1420 request_packet->length(), 1)}; |
| 1385 SequencedSocketData socket_data(reads, arraysize(reads), writes, | 1421 SequencedSocketData socket_data(reads, arraysize(reads), writes, |
| 1386 arraysize(writes)); | 1422 arraysize(writes)); |
| 1387 socket_factory_.AddSocketDataProvider(&socket_data); | 1423 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1388 | 1424 |
| 1389 // Create request and QuicHttpStream. | 1425 // Create request and QuicHttpStream. |
| 1390 QuicStreamRequest request(factory_.get()); | 1426 QuicStreamRequest request(factory_.get()); |
| 1391 EXPECT_EQ(ERR_IO_PENDING, | 1427 EXPECT_EQ(ERR_IO_PENDING, |
| 1392 request.Request(host_port_pair_, privacy_mode_, | 1428 request.Request(host_port_pair_, privacy_mode_, |
| 1393 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1429 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1394 "GET", net_log_, callback_.callback())); | 1430 "GET", net_log_, callback_.callback(), |
| 1431 /*for_bidirectional=*/false)); |
| 1395 EXPECT_EQ(OK, callback_.WaitForResult()); | 1432 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1396 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1433 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1397 EXPECT_TRUE(stream.get()); | 1434 EXPECT_TRUE(stream.get()); |
| 1398 | 1435 |
| 1399 // Cause QUIC stream to be created. | 1436 // Cause QUIC stream to be created. |
| 1400 HttpRequestInfo request_info; | 1437 HttpRequestInfo request_info; |
| 1401 request_info.method = "GET"; | 1438 request_info.method = "GET"; |
| 1402 request_info.url = GURL("https://www.example.org/"); | 1439 request_info.url = GURL("https://www.example.org/"); |
| 1403 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 1440 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 1404 net_log_, CompletionCallback())); | 1441 net_log_, CompletionCallback())); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1449 // Create a new request for the same destination and verify that a | 1486 // Create a new request for the same destination and verify that a |
| 1450 // new session is created. | 1487 // new session is created. |
| 1451 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 1488 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 1452 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); | 1489 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); |
| 1453 socket_factory_.AddSocketDataProvider(&socket_data2); | 1490 socket_factory_.AddSocketDataProvider(&socket_data2); |
| 1454 | 1491 |
| 1455 QuicStreamRequest request2(factory_.get()); | 1492 QuicStreamRequest request2(factory_.get()); |
| 1456 EXPECT_EQ(ERR_IO_PENDING, | 1493 EXPECT_EQ(ERR_IO_PENDING, |
| 1457 request2.Request(host_port_pair_, privacy_mode_, | 1494 request2.Request(host_port_pair_, privacy_mode_, |
| 1458 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1495 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1459 "GET", net_log_, callback_.callback())); | 1496 "GET", net_log_, callback_.callback(), |
| 1497 /*for_bidirectional=*/false)); |
| 1460 EXPECT_EQ(OK, callback_.WaitForResult()); | 1498 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1461 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 1499 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 1462 EXPECT_TRUE(stream2.get()); | 1500 EXPECT_TRUE(stream2.get()); |
| 1463 | 1501 |
| 1464 EXPECT_TRUE( | 1502 EXPECT_TRUE( |
| 1465 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); | 1503 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); |
| 1466 QuicChromiumClientSession* new_session = | 1504 QuicChromiumClientSession* new_session = |
| 1467 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 1505 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 1468 EXPECT_NE(session, new_session); | 1506 EXPECT_NE(session, new_session); |
| 1469 | 1507 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1499 request_packet->length(), 1)}; | 1537 request_packet->length(), 1)}; |
| 1500 SequencedSocketData socket_data(reads, arraysize(reads), writes, | 1538 SequencedSocketData socket_data(reads, arraysize(reads), writes, |
| 1501 arraysize(writes)); | 1539 arraysize(writes)); |
| 1502 socket_factory_.AddSocketDataProvider(&socket_data); | 1540 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1503 | 1541 |
| 1504 // Create request and QuicHttpStream. | 1542 // Create request and QuicHttpStream. |
| 1505 QuicStreamRequest request(factory_.get()); | 1543 QuicStreamRequest request(factory_.get()); |
| 1506 EXPECT_EQ(ERR_IO_PENDING, | 1544 EXPECT_EQ(ERR_IO_PENDING, |
| 1507 request.Request(host_port_pair_, privacy_mode_, | 1545 request.Request(host_port_pair_, privacy_mode_, |
| 1508 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1546 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1509 "GET", net_log_, callback_.callback())); | 1547 "GET", net_log_, callback_.callback(), |
| 1548 /*for_bidirectional=*/false)); |
| 1510 EXPECT_EQ(OK, callback_.WaitForResult()); | 1549 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1511 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1550 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1512 EXPECT_TRUE(stream.get()); | 1551 EXPECT_TRUE(stream.get()); |
| 1513 | 1552 |
| 1514 // Cause QUIC stream to be created. | 1553 // Cause QUIC stream to be created. |
| 1515 HttpRequestInfo request_info; | 1554 HttpRequestInfo request_info; |
| 1516 request_info.method = "GET"; | 1555 request_info.method = "GET"; |
| 1517 request_info.url = GURL("https://www.example.org/"); | 1556 request_info.url = GURL("https://www.example.org/"); |
| 1518 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 1557 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 1519 net_log_, CompletionCallback())); | 1558 net_log_, CompletionCallback())); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 // Create a new request for the same destination and verify that a | 1599 // Create a new request for the same destination and verify that a |
| 1561 // new session is created. | 1600 // new session is created. |
| 1562 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 1601 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 1563 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); | 1602 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); |
| 1564 socket_factory_.AddSocketDataProvider(&socket_data2); | 1603 socket_factory_.AddSocketDataProvider(&socket_data2); |
| 1565 | 1604 |
| 1566 QuicStreamRequest request2(factory_.get()); | 1605 QuicStreamRequest request2(factory_.get()); |
| 1567 EXPECT_EQ(ERR_IO_PENDING, | 1606 EXPECT_EQ(ERR_IO_PENDING, |
| 1568 request2.Request(host_port_pair_, privacy_mode_, | 1607 request2.Request(host_port_pair_, privacy_mode_, |
| 1569 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1608 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1570 "GET", net_log_, callback_.callback())); | 1609 "GET", net_log_, callback_.callback(), |
| 1610 /*for_bidirectional=*/false)); |
| 1571 EXPECT_EQ(OK, callback_.WaitForResult()); | 1611 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1572 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 1612 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 1573 EXPECT_TRUE(stream2.get()); | 1613 EXPECT_TRUE(stream2.get()); |
| 1574 | 1614 |
| 1575 EXPECT_TRUE( | 1615 EXPECT_TRUE( |
| 1576 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); | 1616 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); |
| 1577 EXPECT_NE(session, QuicStreamFactoryPeer::GetActiveSession(factory_.get(), | 1617 EXPECT_NE(session, QuicStreamFactoryPeer::GetActiveSession(factory_.get(), |
| 1578 host_port_pair_)); | 1618 host_port_pair_)); |
| 1579 EXPECT_EQ(true, | 1619 EXPECT_EQ(true, |
| 1580 QuicStreamFactoryPeer::IsLiveSession(factory_.get(), session)); | 1620 QuicStreamFactoryPeer::IsLiveSession(factory_.get(), session)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1601 }; | 1641 }; |
| 1602 SequencedSocketData socket_data(reads, arraysize(reads), writes, | 1642 SequencedSocketData socket_data(reads, arraysize(reads), writes, |
| 1603 arraysize(writes)); | 1643 arraysize(writes)); |
| 1604 socket_factory_.AddSocketDataProvider(&socket_data); | 1644 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1605 | 1645 |
| 1606 // Create request and QuicHttpStream. | 1646 // Create request and QuicHttpStream. |
| 1607 QuicStreamRequest request(factory_.get()); | 1647 QuicStreamRequest request(factory_.get()); |
| 1608 EXPECT_EQ(ERR_IO_PENDING, | 1648 EXPECT_EQ(ERR_IO_PENDING, |
| 1609 request.Request(host_port_pair_, privacy_mode_, | 1649 request.Request(host_port_pair_, privacy_mode_, |
| 1610 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1650 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1611 "GET", net_log_, callback_.callback())); | 1651 "GET", net_log_, callback_.callback(), |
| 1652 /*for_bidirectional=*/false)); |
| 1612 EXPECT_EQ(OK, callback_.WaitForResult()); | 1653 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1613 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1654 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1614 EXPECT_TRUE(stream.get()); | 1655 EXPECT_TRUE(stream.get()); |
| 1615 | 1656 |
| 1616 // Cause QUIC stream to be created. | 1657 // Cause QUIC stream to be created. |
| 1617 HttpRequestInfo request_info; | 1658 HttpRequestInfo request_info; |
| 1618 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 1659 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 1619 net_log_, CompletionCallback())); | 1660 net_log_, CompletionCallback())); |
| 1620 | 1661 |
| 1621 // Ensure that session is alive and active. | 1662 // Ensure that session is alive and active. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 }; | 1696 }; |
| 1656 SequencedSocketData socket_data(reads, arraysize(reads), writes, | 1697 SequencedSocketData socket_data(reads, arraysize(reads), writes, |
| 1657 arraysize(writes)); | 1698 arraysize(writes)); |
| 1658 socket_factory_.AddSocketDataProvider(&socket_data); | 1699 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1659 | 1700 |
| 1660 // Create request and QuicHttpStream. | 1701 // Create request and QuicHttpStream. |
| 1661 QuicStreamRequest request(factory_.get()); | 1702 QuicStreamRequest request(factory_.get()); |
| 1662 EXPECT_EQ(ERR_IO_PENDING, | 1703 EXPECT_EQ(ERR_IO_PENDING, |
| 1663 request.Request(host_port_pair_, privacy_mode_, | 1704 request.Request(host_port_pair_, privacy_mode_, |
| 1664 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1705 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1665 "GET", net_log_, callback_.callback())); | 1706 "GET", net_log_, callback_.callback(), |
| 1707 /*for_bidirectional=*/false)); |
| 1666 EXPECT_EQ(OK, callback_.WaitForResult()); | 1708 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1667 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1709 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1668 EXPECT_TRUE(stream.get()); | 1710 EXPECT_TRUE(stream.get()); |
| 1669 | 1711 |
| 1670 // Cause QUIC stream to be created. | 1712 // Cause QUIC stream to be created. |
| 1671 HttpRequestInfo request_info; | 1713 HttpRequestInfo request_info; |
| 1672 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 1714 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 1673 net_log_, CompletionCallback())); | 1715 net_log_, CompletionCallback())); |
| 1674 | 1716 |
| 1675 // Ensure that session is alive and active. | 1717 // Ensure that session is alive and active. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1704 }; | 1746 }; |
| 1705 SequencedSocketData socket_data(reads, arraysize(reads), writes, | 1747 SequencedSocketData socket_data(reads, arraysize(reads), writes, |
| 1706 arraysize(writes)); | 1748 arraysize(writes)); |
| 1707 socket_factory_.AddSocketDataProvider(&socket_data); | 1749 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1708 | 1750 |
| 1709 // Create request and QuicHttpStream. | 1751 // Create request and QuicHttpStream. |
| 1710 QuicStreamRequest request(factory_.get()); | 1752 QuicStreamRequest request(factory_.get()); |
| 1711 EXPECT_EQ(ERR_IO_PENDING, | 1753 EXPECT_EQ(ERR_IO_PENDING, |
| 1712 request.Request(host_port_pair_, privacy_mode_, | 1754 request.Request(host_port_pair_, privacy_mode_, |
| 1713 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1755 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1714 "GET", net_log_, callback_.callback())); | 1756 "GET", net_log_, callback_.callback(), |
| 1757 /*for_bidirectional=*/false)); |
| 1715 EXPECT_EQ(OK, callback_.WaitForResult()); | 1758 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1716 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1759 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1717 EXPECT_TRUE(stream.get()); | 1760 EXPECT_TRUE(stream.get()); |
| 1718 | 1761 |
| 1719 // Cause QUIC stream to be created. | 1762 // Cause QUIC stream to be created. |
| 1720 HttpRequestInfo request_info; | 1763 HttpRequestInfo request_info; |
| 1721 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 1764 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 1722 net_log_, CompletionCallback())); | 1765 net_log_, CompletionCallback())); |
| 1723 | 1766 |
| 1724 // Ensure that session is alive and active. | 1767 // Ensure that session is alive and active. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 }; | 1799 }; |
| 1757 SequencedSocketData socket_data(reads, arraysize(reads), writes, | 1800 SequencedSocketData socket_data(reads, arraysize(reads), writes, |
| 1758 arraysize(writes)); | 1801 arraysize(writes)); |
| 1759 socket_factory_.AddSocketDataProvider(&socket_data); | 1802 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1760 | 1803 |
| 1761 // Create request and QuicHttpStream. | 1804 // Create request and QuicHttpStream. |
| 1762 QuicStreamRequest request(factory_.get()); | 1805 QuicStreamRequest request(factory_.get()); |
| 1763 EXPECT_EQ(ERR_IO_PENDING, | 1806 EXPECT_EQ(ERR_IO_PENDING, |
| 1764 request.Request(host_port_pair_, privacy_mode_, | 1807 request.Request(host_port_pair_, privacy_mode_, |
| 1765 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1808 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1766 "GET", net_log_, callback_.callback())); | 1809 "GET", net_log_, callback_.callback(), |
| 1810 /*for_bidirectional=*/false)); |
| 1767 EXPECT_EQ(OK, callback_.WaitForResult()); | 1811 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1768 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1812 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1769 EXPECT_TRUE(stream.get()); | 1813 EXPECT_TRUE(stream.get()); |
| 1770 | 1814 |
| 1771 // Cause QUIC stream to be created. | 1815 // Cause QUIC stream to be created. |
| 1772 HttpRequestInfo request_info; | 1816 HttpRequestInfo request_info; |
| 1773 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 1817 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 1774 net_log_, CompletionCallback())); | 1818 net_log_, CompletionCallback())); |
| 1775 | 1819 |
| 1776 // Ensure that session is alive and active. | 1820 // Ensure that session is alive and active. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1800 | 1844 |
| 1801 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 1845 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 1802 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0u); | 1846 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0u); |
| 1803 socket_factory_.AddSocketDataProvider(&socket_data); | 1847 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1804 | 1848 |
| 1805 // Create request and QuicHttpStream. | 1849 // Create request and QuicHttpStream. |
| 1806 QuicStreamRequest request(factory_.get()); | 1850 QuicStreamRequest request(factory_.get()); |
| 1807 EXPECT_EQ(ERR_IO_PENDING, | 1851 EXPECT_EQ(ERR_IO_PENDING, |
| 1808 request.Request(host_port_pair_, privacy_mode_, | 1852 request.Request(host_port_pair_, privacy_mode_, |
| 1809 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1853 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1810 "GET", net_log_, callback_.callback())); | 1854 "GET", net_log_, callback_.callback(), |
| 1855 /*for_bidirectional=*/false)); |
| 1811 EXPECT_EQ(OK, callback_.WaitForResult()); | 1856 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1812 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1857 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1813 EXPECT_TRUE(stream.get()); | 1858 EXPECT_TRUE(stream.get()); |
| 1814 | 1859 |
| 1815 // Ensure that session is alive and active. | 1860 // Ensure that session is alive and active. |
| 1816 QuicChromiumClientSession* session = | 1861 QuicChromiumClientSession* session = |
| 1817 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 1862 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 1818 EXPECT_TRUE(QuicStreamFactoryPeer::IsLiveSession(factory_.get(), session)); | 1863 EXPECT_TRUE(QuicStreamFactoryPeer::IsLiveSession(factory_.get(), session)); |
| 1819 EXPECT_TRUE(HasActiveSession(host_port_pair_)); | 1864 EXPECT_TRUE(HasActiveSession(host_port_pair_)); |
| 1820 | 1865 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1838 | 1883 |
| 1839 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 1884 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 1840 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0u); | 1885 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0u); |
| 1841 socket_factory_.AddSocketDataProvider(&socket_data); | 1886 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1842 | 1887 |
| 1843 // Create request and QuicHttpStream. | 1888 // Create request and QuicHttpStream. |
| 1844 QuicStreamRequest request(factory_.get()); | 1889 QuicStreamRequest request(factory_.get()); |
| 1845 EXPECT_EQ(ERR_IO_PENDING, | 1890 EXPECT_EQ(ERR_IO_PENDING, |
| 1846 request.Request(host_port_pair_, privacy_mode_, | 1891 request.Request(host_port_pair_, privacy_mode_, |
| 1847 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1892 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1848 "GET", net_log_, callback_.callback())); | 1893 "GET", net_log_, callback_.callback(), |
| 1894 /*for_bidirectional=*/false)); |
| 1849 EXPECT_EQ(OK, callback_.WaitForResult()); | 1895 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1850 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1896 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1851 EXPECT_TRUE(stream.get()); | 1897 EXPECT_TRUE(stream.get()); |
| 1852 | 1898 |
| 1853 // Ensure that session is alive and active. | 1899 // Ensure that session is alive and active. |
| 1854 QuicChromiumClientSession* session = | 1900 QuicChromiumClientSession* session = |
| 1855 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 1901 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 1856 EXPECT_TRUE(QuicStreamFactoryPeer::IsLiveSession(factory_.get(), session)); | 1902 EXPECT_TRUE(QuicStreamFactoryPeer::IsLiveSession(factory_.get(), session)); |
| 1857 EXPECT_TRUE(HasActiveSession(host_port_pair_)); | 1903 EXPECT_TRUE(HasActiveSession(host_port_pair_)); |
| 1858 | 1904 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1882 request_packet->length(), 1)}; | 1928 request_packet->length(), 1)}; |
| 1883 SequencedSocketData socket_data(reads, arraysize(reads), writes, | 1929 SequencedSocketData socket_data(reads, arraysize(reads), writes, |
| 1884 arraysize(writes)); | 1930 arraysize(writes)); |
| 1885 socket_factory_.AddSocketDataProvider(&socket_data); | 1931 socket_factory_.AddSocketDataProvider(&socket_data); |
| 1886 | 1932 |
| 1887 // Create request and QuicHttpStream. | 1933 // Create request and QuicHttpStream. |
| 1888 QuicStreamRequest request(factory_.get()); | 1934 QuicStreamRequest request(factory_.get()); |
| 1889 EXPECT_EQ(ERR_IO_PENDING, | 1935 EXPECT_EQ(ERR_IO_PENDING, |
| 1890 request.Request(host_port_pair_, privacy_mode_, | 1936 request.Request(host_port_pair_, privacy_mode_, |
| 1891 /*cert_verify_flags=*/0, host_port_pair_.host(), | 1937 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1892 "GET", net_log_, callback_.callback())); | 1938 "GET", net_log_, callback_.callback(), |
| 1939 /*for_bidirectional=*/false)); |
| 1893 EXPECT_EQ(OK, callback_.WaitForResult()); | 1940 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1894 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 1941 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 1895 EXPECT_TRUE(stream.get()); | 1942 EXPECT_TRUE(stream.get()); |
| 1896 | 1943 |
| 1897 // Cause QUIC stream to be created. | 1944 // Cause QUIC stream to be created. |
| 1898 HttpRequestInfo request_info; | 1945 HttpRequestInfo request_info; |
| 1899 request_info.method = "GET"; | 1946 request_info.method = "GET"; |
| 1900 request_info.url = GURL("https://www.example.org/"); | 1947 request_info.url = GURL("https://www.example.org/"); |
| 1901 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 1948 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 1902 net_log_, CompletionCallback())); | 1949 net_log_, CompletionCallback())); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 // Create a new request for the same destination and verify that a | 1997 // Create a new request for the same destination and verify that a |
| 1951 // new session is created. | 1998 // new session is created. |
| 1952 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 1999 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 1953 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); | 2000 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); |
| 1954 socket_factory_.AddSocketDataProvider(&socket_data2); | 2001 socket_factory_.AddSocketDataProvider(&socket_data2); |
| 1955 | 2002 |
| 1956 QuicStreamRequest request2(factory_.get()); | 2003 QuicStreamRequest request2(factory_.get()); |
| 1957 EXPECT_EQ(ERR_IO_PENDING, | 2004 EXPECT_EQ(ERR_IO_PENDING, |
| 1958 request2.Request(host_port_pair_, privacy_mode_, | 2005 request2.Request(host_port_pair_, privacy_mode_, |
| 1959 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2006 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 1960 "GET", net_log_, callback_.callback())); | 2007 "GET", net_log_, callback_.callback(), |
| 2008 /*for_bidirectional=*/false)); |
| 1961 EXPECT_EQ(OK, callback_.WaitForResult()); | 2009 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 1962 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 2010 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 1963 EXPECT_TRUE(stream2.get()); | 2011 EXPECT_TRUE(stream2.get()); |
| 1964 | 2012 |
| 1965 EXPECT_TRUE( | 2013 EXPECT_TRUE( |
| 1966 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); | 2014 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); |
| 1967 QuicChromiumClientSession* new_session = | 2015 QuicChromiumClientSession* new_session = |
| 1968 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 2016 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 1969 EXPECT_NE(session, new_session); | 2017 EXPECT_NE(session, new_session); |
| 1970 | 2018 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2005 }; | 2053 }; |
| 2006 SequencedSocketData socket_data(reads, arraysize(reads), writes, | 2054 SequencedSocketData socket_data(reads, arraysize(reads), writes, |
| 2007 arraysize(writes)); | 2055 arraysize(writes)); |
| 2008 socket_factory_.AddSocketDataProvider(&socket_data); | 2056 socket_factory_.AddSocketDataProvider(&socket_data); |
| 2009 | 2057 |
| 2010 // Create request and QuicHttpStream. | 2058 // Create request and QuicHttpStream. |
| 2011 QuicStreamRequest request(factory_.get()); | 2059 QuicStreamRequest request(factory_.get()); |
| 2012 EXPECT_EQ(ERR_IO_PENDING, | 2060 EXPECT_EQ(ERR_IO_PENDING, |
| 2013 request.Request(host_port_pair_, privacy_mode_, | 2061 request.Request(host_port_pair_, privacy_mode_, |
| 2014 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2062 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2015 "GET", net_log_, callback_.callback())); | 2063 "GET", net_log_, callback_.callback(), |
| 2064 /*for_bidirectional=*/false)); |
| 2016 EXPECT_EQ(OK, callback_.WaitForResult()); | 2065 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 2017 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 2066 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 2018 EXPECT_TRUE(stream.get()); | 2067 EXPECT_TRUE(stream.get()); |
| 2019 | 2068 |
| 2020 // Cause QUIC stream to be created. | 2069 // Cause QUIC stream to be created. |
| 2021 HttpRequestInfo request_info; | 2070 HttpRequestInfo request_info; |
| 2022 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 2071 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 2023 net_log_, CompletionCallback())); | 2072 net_log_, CompletionCallback())); |
| 2024 | 2073 |
| 2025 // Ensure that session is alive and active. | 2074 // Ensure that session is alive and active. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2063 socket_factory_.AddSocketDataProvider(&socket_data); | 2112 socket_factory_.AddSocketDataProvider(&socket_data); |
| 2064 | 2113 |
| 2065 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 2114 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 2066 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); | 2115 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); |
| 2067 socket_factory_.AddSocketDataProvider(&socket_data2); | 2116 socket_factory_.AddSocketDataProvider(&socket_data2); |
| 2068 | 2117 |
| 2069 QuicStreamRequest request(factory_.get()); | 2118 QuicStreamRequest request(factory_.get()); |
| 2070 EXPECT_EQ(ERR_IO_PENDING, | 2119 EXPECT_EQ(ERR_IO_PENDING, |
| 2071 request.Request(host_port_pair_, privacy_mode_, | 2120 request.Request(host_port_pair_, privacy_mode_, |
| 2072 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2121 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2073 "GET", net_log_, callback_.callback())); | 2122 "GET", net_log_, callback_.callback(), |
| 2123 /*for_bidirectional=*/false)); |
| 2074 | 2124 |
| 2075 EXPECT_EQ(OK, callback_.WaitForResult()); | 2125 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 2076 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 2126 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 2077 HttpRequestInfo request_info; | 2127 HttpRequestInfo request_info; |
| 2078 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 2128 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 2079 net_log_, CompletionCallback())); | 2129 net_log_, CompletionCallback())); |
| 2080 | 2130 |
| 2081 factory_->OnSSLConfigChanged(); | 2131 factory_->OnSSLConfigChanged(); |
| 2082 EXPECT_EQ(ERR_CERT_DATABASE_CHANGED, | 2132 EXPECT_EQ(ERR_CERT_DATABASE_CHANGED, |
| 2083 stream->ReadResponseHeaders(callback_.callback())); | 2133 stream->ReadResponseHeaders(callback_.callback())); |
| 2084 EXPECT_FALSE(factory_->require_confirmation()); | 2134 EXPECT_FALSE(factory_->require_confirmation()); |
| 2085 | 2135 |
| 2086 // Now attempting to request a stream to the same origin should create | 2136 // Now attempting to request a stream to the same origin should create |
| 2087 // a new session. | 2137 // a new session. |
| 2088 | 2138 |
| 2089 QuicStreamRequest request2(factory_.get()); | 2139 QuicStreamRequest request2(factory_.get()); |
| 2090 EXPECT_EQ(ERR_IO_PENDING, | 2140 EXPECT_EQ(ERR_IO_PENDING, |
| 2091 request2.Request(host_port_pair_, privacy_mode_, | 2141 request2.Request(host_port_pair_, privacy_mode_, |
| 2092 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2142 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2093 "GET", net_log_, callback_.callback())); | 2143 "GET", net_log_, callback_.callback(), |
| 2144 /*for_bidirectional=*/false)); |
| 2094 | 2145 |
| 2095 EXPECT_EQ(OK, callback_.WaitForResult()); | 2146 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 2096 stream = request2.ReleaseStream(); | 2147 stream = request2.ReleaseStream(); |
| 2097 stream.reset(); // Will reset stream 3. | 2148 stream.reset(); // Will reset stream 3. |
| 2098 | 2149 |
| 2099 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 2150 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 2100 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 2151 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 2101 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 2152 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
| 2102 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); | 2153 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); |
| 2103 } | 2154 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2118 socket_factory_.AddSocketDataProvider(&socket_data); | 2169 socket_factory_.AddSocketDataProvider(&socket_data); |
| 2119 | 2170 |
| 2120 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 2171 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 2121 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); | 2172 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); |
| 2122 socket_factory_.AddSocketDataProvider(&socket_data2); | 2173 socket_factory_.AddSocketDataProvider(&socket_data2); |
| 2123 | 2174 |
| 2124 QuicStreamRequest request(factory_.get()); | 2175 QuicStreamRequest request(factory_.get()); |
| 2125 EXPECT_EQ(ERR_IO_PENDING, | 2176 EXPECT_EQ(ERR_IO_PENDING, |
| 2126 request.Request(host_port_pair_, privacy_mode_, | 2177 request.Request(host_port_pair_, privacy_mode_, |
| 2127 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2178 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2128 "GET", net_log_, callback_.callback())); | 2179 "GET", net_log_, callback_.callback(), |
| 2180 /*for_bidirectional=*/false)); |
| 2129 | 2181 |
| 2130 EXPECT_EQ(OK, callback_.WaitForResult()); | 2182 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 2131 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 2183 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 2132 HttpRequestInfo request_info; | 2184 HttpRequestInfo request_info; |
| 2133 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 2185 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 2134 net_log_, CompletionCallback())); | 2186 net_log_, CompletionCallback())); |
| 2135 | 2187 |
| 2136 // Add a cert and verify that stream saw the event. | 2188 // Add a cert and verify that stream saw the event. |
| 2137 factory_->OnCertAdded(nullptr); | 2189 factory_->OnCertAdded(nullptr); |
| 2138 EXPECT_EQ(ERR_CERT_DATABASE_CHANGED, | 2190 EXPECT_EQ(ERR_CERT_DATABASE_CHANGED, |
| 2139 stream->ReadResponseHeaders(callback_.callback())); | 2191 stream->ReadResponseHeaders(callback_.callback())); |
| 2140 EXPECT_FALSE(factory_->require_confirmation()); | 2192 EXPECT_FALSE(factory_->require_confirmation()); |
| 2141 | 2193 |
| 2142 // Now attempting to request a stream to the same origin should create | 2194 // Now attempting to request a stream to the same origin should create |
| 2143 // a new session. | 2195 // a new session. |
| 2144 | 2196 |
| 2145 QuicStreamRequest request2(factory_.get()); | 2197 QuicStreamRequest request2(factory_.get()); |
| 2146 EXPECT_EQ(ERR_IO_PENDING, | 2198 EXPECT_EQ(ERR_IO_PENDING, |
| 2147 request2.Request(host_port_pair_, privacy_mode_, | 2199 request2.Request(host_port_pair_, privacy_mode_, |
| 2148 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2200 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2149 "GET", net_log_, callback_.callback())); | 2201 "GET", net_log_, callback_.callback(), |
| 2202 /*for_bidirectional=*/false)); |
| 2150 | 2203 |
| 2151 EXPECT_EQ(OK, callback_.WaitForResult()); | 2204 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 2152 stream = request2.ReleaseStream(); | 2205 stream = request2.ReleaseStream(); |
| 2153 stream.reset(); // Will reset stream 3. | 2206 stream.reset(); // Will reset stream 3. |
| 2154 | 2207 |
| 2155 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 2208 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 2156 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 2209 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 2157 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 2210 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
| 2158 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); | 2211 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); |
| 2159 } | 2212 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2174 socket_factory_.AddSocketDataProvider(&socket_data); | 2227 socket_factory_.AddSocketDataProvider(&socket_data); |
| 2175 | 2228 |
| 2176 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 2229 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
| 2177 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); | 2230 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); |
| 2178 socket_factory_.AddSocketDataProvider(&socket_data2); | 2231 socket_factory_.AddSocketDataProvider(&socket_data2); |
| 2179 | 2232 |
| 2180 QuicStreamRequest request(factory_.get()); | 2233 QuicStreamRequest request(factory_.get()); |
| 2181 EXPECT_EQ(ERR_IO_PENDING, | 2234 EXPECT_EQ(ERR_IO_PENDING, |
| 2182 request.Request(host_port_pair_, privacy_mode_, | 2235 request.Request(host_port_pair_, privacy_mode_, |
| 2183 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2236 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2184 "GET", net_log_, callback_.callback())); | 2237 "GET", net_log_, callback_.callback(), |
| 2238 /*for_bidirectional=*/false)); |
| 2185 | 2239 |
| 2186 EXPECT_EQ(OK, callback_.WaitForResult()); | 2240 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 2187 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 2241 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 2188 HttpRequestInfo request_info; | 2242 HttpRequestInfo request_info; |
| 2189 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 2243 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 2190 net_log_, CompletionCallback())); | 2244 net_log_, CompletionCallback())); |
| 2191 | 2245 |
| 2192 // Change the CA cert and verify that stream saw the event. | 2246 // Change the CA cert and verify that stream saw the event. |
| 2193 factory_->OnCACertChanged(nullptr); | 2247 factory_->OnCACertChanged(nullptr); |
| 2194 EXPECT_EQ(ERR_CERT_DATABASE_CHANGED, | 2248 EXPECT_EQ(ERR_CERT_DATABASE_CHANGED, |
| 2195 stream->ReadResponseHeaders(callback_.callback())); | 2249 stream->ReadResponseHeaders(callback_.callback())); |
| 2196 EXPECT_FALSE(factory_->require_confirmation()); | 2250 EXPECT_FALSE(factory_->require_confirmation()); |
| 2197 | 2251 |
| 2198 // Now attempting to request a stream to the same origin should create | 2252 // Now attempting to request a stream to the same origin should create |
| 2199 // a new session. | 2253 // a new session. |
| 2200 | 2254 |
| 2201 QuicStreamRequest request2(factory_.get()); | 2255 QuicStreamRequest request2(factory_.get()); |
| 2202 EXPECT_EQ(ERR_IO_PENDING, | 2256 EXPECT_EQ(ERR_IO_PENDING, |
| 2203 request2.Request(host_port_pair_, privacy_mode_, | 2257 request2.Request(host_port_pair_, privacy_mode_, |
| 2204 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2258 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2205 "GET", net_log_, callback_.callback())); | 2259 "GET", net_log_, callback_.callback(), |
| 2260 /*for_bidirectional=*/false)); |
| 2206 | 2261 |
| 2207 EXPECT_EQ(OK, callback_.WaitForResult()); | 2262 EXPECT_EQ(OK, callback_.WaitForResult()); |
| 2208 stream = request2.ReleaseStream(); | 2263 stream = request2.ReleaseStream(); |
| 2209 stream.reset(); // Will reset stream 3. | 2264 stream.reset(); // Will reset stream 3. |
| 2210 | 2265 |
| 2211 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 2266 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 2212 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 2267 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 2213 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 2268 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
| 2214 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); | 2269 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); |
| 2215 } | 2270 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2319 MockCryptoClientStream::ZERO_RTT); | 2374 MockCryptoClientStream::ZERO_RTT); |
| 2320 host_resolver_.set_synchronous_mode(true); | 2375 host_resolver_.set_synchronous_mode(true); |
| 2321 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 2376 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 2322 "192.168.0.1", ""); | 2377 "192.168.0.1", ""); |
| 2323 | 2378 |
| 2324 QuicStreamRequest request(factory_.get()); | 2379 QuicStreamRequest request(factory_.get()); |
| 2325 QuicServerId server_id(host_port_pair_, privacy_mode_); | 2380 QuicServerId server_id(host_port_pair_, privacy_mode_); |
| 2326 EXPECT_EQ(ERR_IO_PENDING, | 2381 EXPECT_EQ(ERR_IO_PENDING, |
| 2327 request.Request(host_port_pair_, privacy_mode_, | 2382 request.Request(host_port_pair_, privacy_mode_, |
| 2328 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2383 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2329 "GET", net_log_, callback_.callback())); | 2384 "GET", net_log_, callback_.callback(), |
| 2385 /*for_bidirectional=*/false)); |
| 2330 EXPECT_EQ(2u, QuicStreamFactoryPeer::GetNumberOfActiveJobs(factory_.get(), | 2386 EXPECT_EQ(2u, QuicStreamFactoryPeer::GetNumberOfActiveJobs(factory_.get(), |
| 2331 server_id)); | 2387 server_id)); |
| 2332 | 2388 |
| 2333 runner_->RunNextTask(); | 2389 runner_->RunNextTask(); |
| 2334 | 2390 |
| 2335 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 2391 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 2336 EXPECT_TRUE(stream.get()); | 2392 EXPECT_TRUE(stream.get()); |
| 2337 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 2393 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 2338 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 2394 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 2339 EXPECT_EQ(0u, QuicStreamFactoryPeer::GetNumberOfActiveJobs(factory_.get(), | 2395 EXPECT_EQ(0u, QuicStreamFactoryPeer::GetNumberOfActiveJobs(factory_.get(), |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2354 | 2410 |
| 2355 crypto_client_stream_factory_.set_handshake_mode( | 2411 crypto_client_stream_factory_.set_handshake_mode( |
| 2356 MockCryptoClientStream::ZERO_RTT); | 2412 MockCryptoClientStream::ZERO_RTT); |
| 2357 host_resolver_.set_synchronous_mode(true); | 2413 host_resolver_.set_synchronous_mode(true); |
| 2358 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 2414 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 2359 "192.168.0.1", ""); | 2415 "192.168.0.1", ""); |
| 2360 | 2416 |
| 2361 QuicStreamRequest request(factory_.get()); | 2417 QuicStreamRequest request(factory_.get()); |
| 2362 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 2418 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 2363 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2419 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2364 "GET", net_log_, callback_.callback())); | 2420 "GET", net_log_, callback_.callback(), |
| 2421 /*for_bidirectional=*/false)); |
| 2365 | 2422 |
| 2366 // If we are waiting for disk cache, we would have posted a task. Verify that | 2423 // If we are waiting for disk cache, we would have posted a task. Verify that |
| 2367 // the CancelWaitForDataReady task hasn't been posted. | 2424 // the CancelWaitForDataReady task hasn't been posted. |
| 2368 ASSERT_EQ(0u, runner_->GetPostedTasks().size()); | 2425 ASSERT_EQ(0u, runner_->GetPostedTasks().size()); |
| 2369 | 2426 |
| 2370 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 2427 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 2371 EXPECT_TRUE(stream.get()); | 2428 EXPECT_TRUE(stream.get()); |
| 2372 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 2429 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 2373 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 2430 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 2374 } | 2431 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2412 host_resolver_.set_synchronous_mode(true); | 2469 host_resolver_.set_synchronous_mode(true); |
| 2413 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 2470 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 2414 "192.168.0.1", ""); | 2471 "192.168.0.1", ""); |
| 2415 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 2472 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 2416 host_resolver_.rules()->AddIPLiteralRule(server3.host(), "192.168.0.1", ""); | 2473 host_resolver_.rules()->AddIPLiteralRule(server3.host(), "192.168.0.1", ""); |
| 2417 host_resolver_.rules()->AddIPLiteralRule(server4.host(), "192.168.0.1", ""); | 2474 host_resolver_.rules()->AddIPLiteralRule(server4.host(), "192.168.0.1", ""); |
| 2418 | 2475 |
| 2419 QuicStreamRequest request(factory_.get()); | 2476 QuicStreamRequest request(factory_.get()); |
| 2420 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 2477 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 2421 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2478 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2422 "GET", net_log_, callback_.callback())); | 2479 "GET", net_log_, callback_.callback(), |
| 2480 /*for_bidirectional=*/false)); |
| 2423 | 2481 |
| 2424 QuicChromiumClientSession* session = | 2482 QuicChromiumClientSession* session = |
| 2425 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 2483 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 2426 | 2484 |
| 2427 DVLOG(1) << "Create 1st session and test packet loss"; | 2485 DVLOG(1) << "Create 1st session and test packet loss"; |
| 2428 | 2486 |
| 2429 // Set packet_loss_rate to a lower value than packet_loss_threshold. | 2487 // Set packet_loss_rate to a lower value than packet_loss_threshold. |
| 2430 EXPECT_FALSE( | 2488 EXPECT_FALSE( |
| 2431 factory_->OnHandshakeConfirmed(session, /*packet_loss_rate=*/0.9f)); | 2489 factory_->OnHandshakeConfirmed(session, /*packet_loss_rate=*/0.9f)); |
| 2432 EXPECT_TRUE(session->connection()->connected()); | 2490 EXPECT_TRUE(session->connection()->connected()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2450 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); | 2508 QuicStreamFactoryPeer::HasActiveSession(factory_.get(), host_port_pair_)); |
| 2451 | 2509 |
| 2452 // Test N-in-a-row high packet loss connections. | 2510 // Test N-in-a-row high packet loss connections. |
| 2453 | 2511 |
| 2454 DVLOG(1) << "Create 2nd session and test packet loss"; | 2512 DVLOG(1) << "Create 2nd session and test packet loss"; |
| 2455 | 2513 |
| 2456 TestCompletionCallback callback2; | 2514 TestCompletionCallback callback2; |
| 2457 QuicStreamRequest request2(factory_.get()); | 2515 QuicStreamRequest request2(factory_.get()); |
| 2458 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 2516 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 2459 /*cert_verify_flags=*/0, server2.host(), "GET", | 2517 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 2460 net_log_, callback2.callback())); | 2518 net_log_, callback2.callback(), |
| 2519 /*for_bidirectional=*/false)); |
| 2461 QuicChromiumClientSession* session2 = | 2520 QuicChromiumClientSession* session2 = |
| 2462 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); | 2521 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); |
| 2463 | 2522 |
| 2464 // If there is no packet loss during handshake confirmation, number of lossy | 2523 // If there is no packet loss during handshake confirmation, number of lossy |
| 2465 // connections for the port should be 0. | 2524 // connections for the port should be 0. |
| 2466 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumberOfLossyConnections( | 2525 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumberOfLossyConnections( |
| 2467 factory_.get(), server2.port())); | 2526 factory_.get(), server2.port())); |
| 2468 EXPECT_FALSE( | 2527 EXPECT_FALSE( |
| 2469 factory_->OnHandshakeConfirmed(session2, /*packet_loss_rate=*/0.9f)); | 2528 factory_->OnHandshakeConfirmed(session2, /*packet_loss_rate=*/0.9f)); |
| 2470 EXPECT_EQ(0, QuicStreamFactoryPeer::GetNumberOfLossyConnections( | 2529 EXPECT_EQ(0, QuicStreamFactoryPeer::GetNumberOfLossyConnections( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2482 EXPECT_FALSE( | 2541 EXPECT_FALSE( |
| 2483 QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), server2.port())); | 2542 QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), server2.port())); |
| 2484 EXPECT_TRUE(QuicStreamFactoryPeer::HasActiveSession(factory_.get(), server2)); | 2543 EXPECT_TRUE(QuicStreamFactoryPeer::HasActiveSession(factory_.get(), server2)); |
| 2485 | 2544 |
| 2486 DVLOG(1) << "Create 3rd session which also has packet loss"; | 2545 DVLOG(1) << "Create 3rd session which also has packet loss"; |
| 2487 | 2546 |
| 2488 TestCompletionCallback callback3; | 2547 TestCompletionCallback callback3; |
| 2489 QuicStreamRequest request3(factory_.get()); | 2548 QuicStreamRequest request3(factory_.get()); |
| 2490 EXPECT_EQ(OK, request3.Request(server3, privacy_mode_, | 2549 EXPECT_EQ(OK, request3.Request(server3, privacy_mode_, |
| 2491 /*cert_verify_flags=*/0, server3.host(), "GET", | 2550 /*cert_verify_flags=*/0, server3.host(), "GET", |
| 2492 net_log_, callback3.callback())); | 2551 net_log_, callback3.callback(), |
| 2552 /*for_bidirectional=*/false)); |
| 2493 QuicChromiumClientSession* session3 = | 2553 QuicChromiumClientSession* session3 = |
| 2494 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server3); | 2554 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server3); |
| 2495 | 2555 |
| 2496 DVLOG(1) << "Create 4th session with packet loss and test IsQuicDisabled()"; | 2556 DVLOG(1) << "Create 4th session with packet loss and test IsQuicDisabled()"; |
| 2497 TestCompletionCallback callback4; | 2557 TestCompletionCallback callback4; |
| 2498 QuicStreamRequest request4(factory_.get()); | 2558 QuicStreamRequest request4(factory_.get()); |
| 2499 EXPECT_EQ(OK, request4.Request(server4, privacy_mode_, | 2559 EXPECT_EQ(OK, request4.Request(server4, privacy_mode_, |
| 2500 /*cert_verify_flags=*/0, server4.host(), "GET", | 2560 /*cert_verify_flags=*/0, server4.host(), "GET", |
| 2501 net_log_, callback4.callback())); | 2561 net_log_, callback4.callback(), |
| 2562 /*for_bidirectional=*/false)); |
| 2502 QuicChromiumClientSession* session4 = | 2563 QuicChromiumClientSession* session4 = |
| 2503 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server4); | 2564 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server4); |
| 2504 | 2565 |
| 2505 // Set packet_loss_rate to higher value than packet_loss_threshold 2nd time in | 2566 // Set packet_loss_rate to higher value than packet_loss_threshold 2nd time in |
| 2506 // a row and that should close the session and disable QUIC. | 2567 // a row and that should close the session and disable QUIC. |
| 2507 EXPECT_TRUE( | 2568 EXPECT_TRUE( |
| 2508 factory_->OnHandshakeConfirmed(session3, /*packet_loss_rate=*/1.0f)); | 2569 factory_->OnHandshakeConfirmed(session3, /*packet_loss_rate=*/1.0f)); |
| 2509 EXPECT_EQ(2, QuicStreamFactoryPeer::GetNumberOfLossyConnections( | 2570 EXPECT_EQ(2, QuicStreamFactoryPeer::GetNumberOfLossyConnections( |
| 2510 factory_.get(), server3.port())); | 2571 factory_.get(), server3.port())); |
| 2511 EXPECT_FALSE(session3->connection()->connected()); | 2572 EXPECT_FALSE(session3->connection()->connected()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2572 crypto_client_stream_factory_.set_handshake_mode( | 2633 crypto_client_stream_factory_.set_handshake_mode( |
| 2573 MockCryptoClientStream::CONFIRM_HANDSHAKE); | 2634 MockCryptoClientStream::CONFIRM_HANDSHAKE); |
| 2574 host_resolver_.set_synchronous_mode(true); | 2635 host_resolver_.set_synchronous_mode(true); |
| 2575 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 2636 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 2576 "192.168.0.1", ""); | 2637 "192.168.0.1", ""); |
| 2577 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 2638 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 2578 | 2639 |
| 2579 QuicStreamRequest request(factory_.get()); | 2640 QuicStreamRequest request(factory_.get()); |
| 2580 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 2641 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 2581 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2642 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2582 "GET", net_log_, callback_.callback())); | 2643 "GET", net_log_, callback_.callback(), |
| 2644 /*for_bidirectional=*/false)); |
| 2583 | 2645 |
| 2584 QuicChromiumClientSession* session = | 2646 QuicChromiumClientSession* session = |
| 2585 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 2647 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 2586 | 2648 |
| 2587 DVLOG(1) << "Created 1st session. Now trigger public reset post handshake"; | 2649 DVLOG(1) << "Created 1st session. Now trigger public reset post handshake"; |
| 2588 session->connection()->CloseConnection(QUIC_PUBLIC_RESET, | 2650 session->connection()->CloseConnection(QUIC_PUBLIC_RESET, |
| 2589 ConnectionCloseSource::FROM_PEER); | 2651 ConnectionCloseSource::FROM_PEER); |
| 2590 // Need to spin the loop now to ensure that | 2652 // Need to spin the loop now to ensure that |
| 2591 // QuicStreamFactory::OnSessionClosed() runs. | 2653 // QuicStreamFactory::OnSessionClosed() runs. |
| 2592 base::RunLoop run_loop; | 2654 base::RunLoop run_loop; |
| 2593 run_loop.RunUntilIdle(); | 2655 run_loop.RunUntilIdle(); |
| 2594 | 2656 |
| 2595 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( | 2657 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( |
| 2596 factory_.get())); | 2658 factory_.get())); |
| 2597 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), | 2659 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), |
| 2598 host_port_pair_.port())); | 2660 host_port_pair_.port())); |
| 2599 | 2661 |
| 2600 // Test two-in-a-row public reset post handshakes.. | 2662 // Test two-in-a-row public reset post handshakes.. |
| 2601 DVLOG(1) << "Create 2nd session and trigger public reset post handshake"; | 2663 DVLOG(1) << "Create 2nd session and trigger public reset post handshake"; |
| 2602 TestCompletionCallback callback2; | 2664 TestCompletionCallback callback2; |
| 2603 QuicStreamRequest request2(factory_.get()); | 2665 QuicStreamRequest request2(factory_.get()); |
| 2604 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 2666 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 2605 /*cert_verify_flags=*/0, server2.host(), "GET", | 2667 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 2606 net_log_, callback2.callback())); | 2668 net_log_, callback2.callback(), |
| 2669 /*for_bidirectional=*/false)); |
| 2607 QuicChromiumClientSession* session2 = | 2670 QuicChromiumClientSession* session2 = |
| 2608 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); | 2671 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); |
| 2609 | 2672 |
| 2610 session2->connection()->CloseConnection(QUIC_PUBLIC_RESET, | 2673 session2->connection()->CloseConnection(QUIC_PUBLIC_RESET, |
| 2611 ConnectionCloseSource::FROM_PEER); | 2674 ConnectionCloseSource::FROM_PEER); |
| 2612 // Need to spin the loop now to ensure that | 2675 // Need to spin the loop now to ensure that |
| 2613 // QuicStreamFactory::OnSessionClosed() runs. | 2676 // QuicStreamFactory::OnSessionClosed() runs. |
| 2614 base::RunLoop run_loop2; | 2677 base::RunLoop run_loop2; |
| 2615 run_loop2.RunUntilIdle(); | 2678 run_loop2.RunUntilIdle(); |
| 2616 EXPECT_EQ(2, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( | 2679 EXPECT_EQ(2, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2657 crypto_client_stream_factory_.set_handshake_mode( | 2720 crypto_client_stream_factory_.set_handshake_mode( |
| 2658 MockCryptoClientStream::CONFIRM_HANDSHAKE); | 2721 MockCryptoClientStream::CONFIRM_HANDSHAKE); |
| 2659 host_resolver_.set_synchronous_mode(true); | 2722 host_resolver_.set_synchronous_mode(true); |
| 2660 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 2723 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 2661 "192.168.0.1", ""); | 2724 "192.168.0.1", ""); |
| 2662 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 2725 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 2663 | 2726 |
| 2664 QuicStreamRequest request(factory_.get()); | 2727 QuicStreamRequest request(factory_.get()); |
| 2665 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 2728 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 2666 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2729 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2667 "GET", net_log_, callback_.callback())); | 2730 "GET", net_log_, callback_.callback(), |
| 2731 /*for_bidirectional=*/false)); |
| 2668 | 2732 |
| 2669 QuicChromiumClientSession* session = | 2733 QuicChromiumClientSession* session = |
| 2670 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 2734 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 2671 | 2735 |
| 2672 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 2736 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 2673 EXPECT_TRUE(stream.get()); | 2737 EXPECT_TRUE(stream.get()); |
| 2674 HttpRequestInfo request_info; | 2738 HttpRequestInfo request_info; |
| 2675 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 2739 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 2676 net_log_, CompletionCallback())); | 2740 net_log_, CompletionCallback())); |
| 2677 | 2741 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2688 1, QuicStreamFactoryPeer::GetNumTimeoutsWithOpenStreams(factory_.get())); | 2752 1, QuicStreamFactoryPeer::GetNumTimeoutsWithOpenStreams(factory_.get())); |
| 2689 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), | 2753 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), |
| 2690 host_port_pair_.port())); | 2754 host_port_pair_.port())); |
| 2691 | 2755 |
| 2692 // Test two-in-a-row timeouts with open streams. | 2756 // Test two-in-a-row timeouts with open streams. |
| 2693 DVLOG(1) << "Create 2nd session and timeout with open stream"; | 2757 DVLOG(1) << "Create 2nd session and timeout with open stream"; |
| 2694 TestCompletionCallback callback2; | 2758 TestCompletionCallback callback2; |
| 2695 QuicStreamRequest request2(factory_.get()); | 2759 QuicStreamRequest request2(factory_.get()); |
| 2696 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 2760 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 2697 /*cert_verify_flags=*/0, server2.host(), "GET", | 2761 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 2698 net_log_, callback2.callback())); | 2762 net_log_, callback2.callback(), |
| 2763 /*for_bidirectional=*/false)); |
| 2699 QuicChromiumClientSession* session2 = | 2764 QuicChromiumClientSession* session2 = |
| 2700 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); | 2765 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); |
| 2701 | 2766 |
| 2702 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); | 2767 scoped_ptr<QuicHttpStream> stream2 = request2.ReleaseStream(); |
| 2703 EXPECT_TRUE(stream2.get()); | 2768 EXPECT_TRUE(stream2.get()); |
| 2704 EXPECT_EQ(OK, stream2->InitializeStream(&request_info, DEFAULT_PRIORITY, | 2769 EXPECT_EQ(OK, stream2->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 2705 net_log_, CompletionCallback())); | 2770 net_log_, CompletionCallback())); |
| 2706 | 2771 |
| 2707 session2->connection()->CloseConnection(QUIC_NETWORK_IDLE_TIMEOUT, | 2772 session2->connection()->CloseConnection(QUIC_NETWORK_IDLE_TIMEOUT, |
| 2708 ConnectionCloseSource::FROM_SELF); | 2773 ConnectionCloseSource::FROM_SELF); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2755 host_resolver_.set_synchronous_mode(true); | 2820 host_resolver_.set_synchronous_mode(true); |
| 2756 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 2821 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 2757 "192.168.0.1", ""); | 2822 "192.168.0.1", ""); |
| 2758 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 2823 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 2759 host_resolver_.rules()->AddIPLiteralRule(server3.host(), "192.168.0.1", ""); | 2824 host_resolver_.rules()->AddIPLiteralRule(server3.host(), "192.168.0.1", ""); |
| 2760 | 2825 |
| 2761 // Test first and third out of three public reset post handshakes. | 2826 // Test first and third out of three public reset post handshakes. |
| 2762 QuicStreamRequest request(factory_.get()); | 2827 QuicStreamRequest request(factory_.get()); |
| 2763 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 2828 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 2764 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2829 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2765 "GET", net_log_, callback_.callback())); | 2830 "GET", net_log_, callback_.callback(), |
| 2831 /*for_bidirectional=*/false)); |
| 2766 | 2832 |
| 2767 QuicChromiumClientSession* session = | 2833 QuicChromiumClientSession* session = |
| 2768 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 2834 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 2769 | 2835 |
| 2770 DVLOG(1) << "Created 1st session. Now trigger public reset post handshake"; | 2836 DVLOG(1) << "Created 1st session. Now trigger public reset post handshake"; |
| 2771 session->connection()->CloseConnection(QUIC_PUBLIC_RESET, | 2837 session->connection()->CloseConnection(QUIC_PUBLIC_RESET, |
| 2772 ConnectionCloseSource::FROM_PEER); | 2838 ConnectionCloseSource::FROM_PEER); |
| 2773 // Need to spin the loop now to ensure that | 2839 // Need to spin the loop now to ensure that |
| 2774 // QuicStreamFactory::OnSessionClosed() runs. | 2840 // QuicStreamFactory::OnSessionClosed() runs. |
| 2775 base::RunLoop run_loop; | 2841 base::RunLoop run_loop; |
| 2776 run_loop.RunUntilIdle(); | 2842 run_loop.RunUntilIdle(); |
| 2777 | 2843 |
| 2778 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( | 2844 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( |
| 2779 factory_.get())); | 2845 factory_.get())); |
| 2780 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), | 2846 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), |
| 2781 host_port_pair_.port())); | 2847 host_port_pair_.port())); |
| 2782 | 2848 |
| 2783 DVLOG(1) << "Create 2nd session without disable trigger"; | 2849 DVLOG(1) << "Create 2nd session without disable trigger"; |
| 2784 TestCompletionCallback callback2; | 2850 TestCompletionCallback callback2; |
| 2785 QuicStreamRequest request2(factory_.get()); | 2851 QuicStreamRequest request2(factory_.get()); |
| 2786 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 2852 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 2787 /*cert_verify_flags=*/0, server2.host(), "GET", | 2853 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 2788 net_log_, callback2.callback())); | 2854 net_log_, callback2.callback(), |
| 2855 /*for_bidirectional=*/false)); |
| 2789 QuicChromiumClientSession* session2 = | 2856 QuicChromiumClientSession* session2 = |
| 2790 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); | 2857 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); |
| 2791 | 2858 |
| 2792 session2->connection()->CloseConnection(QUIC_NO_ERROR, | 2859 session2->connection()->CloseConnection(QUIC_NO_ERROR, |
| 2793 ConnectionCloseSource::FROM_SELF); | 2860 ConnectionCloseSource::FROM_SELF); |
| 2794 // Need to spin the loop now to ensure that | 2861 // Need to spin the loop now to ensure that |
| 2795 // QuicStreamFactory::OnSessionClosed() runs. | 2862 // QuicStreamFactory::OnSessionClosed() runs. |
| 2796 base::RunLoop run_loop2; | 2863 base::RunLoop run_loop2; |
| 2797 run_loop2.RunUntilIdle(); | 2864 run_loop2.RunUntilIdle(); |
| 2798 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( | 2865 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( |
| 2799 factory_.get())); | 2866 factory_.get())); |
| 2800 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), | 2867 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), |
| 2801 host_port_pair_.port())); | 2868 host_port_pair_.port())); |
| 2802 | 2869 |
| 2803 DVLOG(1) << "Create 3rd session with public reset post handshake," | 2870 DVLOG(1) << "Create 3rd session with public reset post handshake," |
| 2804 << " will disable QUIC"; | 2871 << " will disable QUIC"; |
| 2805 TestCompletionCallback callback3; | 2872 TestCompletionCallback callback3; |
| 2806 QuicStreamRequest request3(factory_.get()); | 2873 QuicStreamRequest request3(factory_.get()); |
| 2807 EXPECT_EQ(OK, request3.Request(server3, privacy_mode_, | 2874 EXPECT_EQ(OK, request3.Request(server3, privacy_mode_, |
| 2808 /*cert_verify_flags=*/0, server3.host(), "GET", | 2875 /*cert_verify_flags=*/0, server3.host(), "GET", |
| 2809 net_log_, callback3.callback())); | 2876 net_log_, callback3.callback(), |
| 2877 /*for_bidirectional=*/false)); |
| 2810 QuicChromiumClientSession* session3 = | 2878 QuicChromiumClientSession* session3 = |
| 2811 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server3); | 2879 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server3); |
| 2812 | 2880 |
| 2813 session3->connection()->CloseConnection(QUIC_PUBLIC_RESET, | 2881 session3->connection()->CloseConnection(QUIC_PUBLIC_RESET, |
| 2814 ConnectionCloseSource::FROM_PEER); | 2882 ConnectionCloseSource::FROM_PEER); |
| 2815 // Need to spin the loop now to ensure that | 2883 // Need to spin the loop now to ensure that |
| 2816 // QuicStreamFactory::OnSessionClosed() runs. | 2884 // QuicStreamFactory::OnSessionClosed() runs. |
| 2817 base::RunLoop run_loop3; | 2885 base::RunLoop run_loop3; |
| 2818 run_loop3.RunUntilIdle(); | 2886 run_loop3.RunUntilIdle(); |
| 2819 EXPECT_EQ(2, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( | 2887 EXPECT_EQ(2, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2873 host_resolver_.set_synchronous_mode(true); | 2941 host_resolver_.set_synchronous_mode(true); |
| 2874 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 2942 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 2875 "192.168.0.1", ""); | 2943 "192.168.0.1", ""); |
| 2876 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 2944 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 2877 host_resolver_.rules()->AddIPLiteralRule(server3.host(), "192.168.0.1", ""); | 2945 host_resolver_.rules()->AddIPLiteralRule(server3.host(), "192.168.0.1", ""); |
| 2878 | 2946 |
| 2879 // Test first and third out of three timeouts with open streams. | 2947 // Test first and third out of three timeouts with open streams. |
| 2880 QuicStreamRequest request(factory_.get()); | 2948 QuicStreamRequest request(factory_.get()); |
| 2881 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 2949 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 2882 /*cert_verify_flags=*/0, host_port_pair_.host(), | 2950 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2883 "GET", net_log_, callback_.callback())); | 2951 "GET", net_log_, callback_.callback(), |
| 2952 /*for_bidirectional=*/false)); |
| 2884 | 2953 |
| 2885 QuicChromiumClientSession* session = | 2954 QuicChromiumClientSession* session = |
| 2886 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 2955 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 2887 | 2956 |
| 2888 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 2957 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 2889 EXPECT_TRUE(stream.get()); | 2958 EXPECT_TRUE(stream.get()); |
| 2890 HttpRequestInfo request_info; | 2959 HttpRequestInfo request_info; |
| 2891 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 2960 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 2892 net_log_, CompletionCallback())); | 2961 net_log_, CompletionCallback())); |
| 2893 | 2962 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2904 1, QuicStreamFactoryPeer::GetNumTimeoutsWithOpenStreams(factory_.get())); | 2973 1, QuicStreamFactoryPeer::GetNumTimeoutsWithOpenStreams(factory_.get())); |
| 2905 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), | 2974 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), |
| 2906 host_port_pair_.port())); | 2975 host_port_pair_.port())); |
| 2907 | 2976 |
| 2908 // Test two-in-a-row timeouts with open streams. | 2977 // Test two-in-a-row timeouts with open streams. |
| 2909 DVLOG(1) << "Create 2nd session without timeout"; | 2978 DVLOG(1) << "Create 2nd session without timeout"; |
| 2910 TestCompletionCallback callback2; | 2979 TestCompletionCallback callback2; |
| 2911 QuicStreamRequest request2(factory_.get()); | 2980 QuicStreamRequest request2(factory_.get()); |
| 2912 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 2981 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 2913 /*cert_verify_flags=*/0, server2.host(), "GET", | 2982 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 2914 net_log_, callback2.callback())); | 2983 net_log_, callback2.callback(), |
| 2984 /*for_bidirectional=*/false)); |
| 2915 QuicChromiumClientSession* session2 = | 2985 QuicChromiumClientSession* session2 = |
| 2916 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); | 2986 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); |
| 2917 | 2987 |
| 2918 session2->connection()->CloseConnection(QUIC_NO_ERROR, | 2988 session2->connection()->CloseConnection(QUIC_NO_ERROR, |
| 2919 ConnectionCloseSource::FROM_PEER); | 2989 ConnectionCloseSource::FROM_PEER); |
| 2920 // Need to spin the loop now to ensure that | 2990 // Need to spin the loop now to ensure that |
| 2921 // QuicStreamFactory::OnSessionClosed() runs. | 2991 // QuicStreamFactory::OnSessionClosed() runs. |
| 2922 base::RunLoop run_loop2; | 2992 base::RunLoop run_loop2; |
| 2923 run_loop2.RunUntilIdle(); | 2993 run_loop2.RunUntilIdle(); |
| 2924 EXPECT_EQ( | 2994 EXPECT_EQ( |
| 2925 1, QuicStreamFactoryPeer::GetNumTimeoutsWithOpenStreams(factory_.get())); | 2995 1, QuicStreamFactoryPeer::GetNumTimeoutsWithOpenStreams(factory_.get())); |
| 2926 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), | 2996 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), |
| 2927 host_port_pair_.port())); | 2997 host_port_pair_.port())); |
| 2928 | 2998 |
| 2929 DVLOG(1) << "Create 3rd session with timeout with open streams," | 2999 DVLOG(1) << "Create 3rd session with timeout with open streams," |
| 2930 << " will disable QUIC"; | 3000 << " will disable QUIC"; |
| 2931 | 3001 |
| 2932 TestCompletionCallback callback3; | 3002 TestCompletionCallback callback3; |
| 2933 QuicStreamRequest request3(factory_.get()); | 3003 QuicStreamRequest request3(factory_.get()); |
| 2934 EXPECT_EQ(OK, request3.Request(server3, privacy_mode_, | 3004 EXPECT_EQ(OK, request3.Request(server3, privacy_mode_, |
| 2935 /*cert_verify_flags=*/0, server3.host(), "GET", | 3005 /*cert_verify_flags=*/0, server3.host(), "GET", |
| 2936 net_log_, callback3.callback())); | 3006 net_log_, callback3.callback(), |
| 3007 /*for_bidirectional=*/false)); |
| 2937 QuicChromiumClientSession* session3 = | 3008 QuicChromiumClientSession* session3 = |
| 2938 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server3); | 3009 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server3); |
| 2939 | 3010 |
| 2940 scoped_ptr<QuicHttpStream> stream3 = request3.ReleaseStream(); | 3011 scoped_ptr<QuicHttpStream> stream3 = request3.ReleaseStream(); |
| 2941 EXPECT_TRUE(stream3.get()); | 3012 EXPECT_TRUE(stream3.get()); |
| 2942 EXPECT_EQ(OK, stream3->InitializeStream(&request_info, DEFAULT_PRIORITY, | 3013 EXPECT_EQ(OK, stream3->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 2943 net_log_, CompletionCallback())); | 3014 net_log_, CompletionCallback())); |
| 2944 session3->connection()->CloseConnection(QUIC_NETWORK_IDLE_TIMEOUT, | 3015 session3->connection()->CloseConnection(QUIC_NETWORK_IDLE_TIMEOUT, |
| 2945 ConnectionCloseSource::FROM_SELF); | 3016 ConnectionCloseSource::FROM_SELF); |
| 2946 // Need to spin the loop now to ensure that | 3017 // Need to spin the loop now to ensure that |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2984 crypto_client_stream_factory_.set_handshake_mode( | 3055 crypto_client_stream_factory_.set_handshake_mode( |
| 2985 MockCryptoClientStream::CONFIRM_HANDSHAKE); | 3056 MockCryptoClientStream::CONFIRM_HANDSHAKE); |
| 2986 host_resolver_.set_synchronous_mode(true); | 3057 host_resolver_.set_synchronous_mode(true); |
| 2987 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 3058 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 2988 "192.168.0.1", ""); | 3059 "192.168.0.1", ""); |
| 2989 | 3060 |
| 2990 // Test first timeouts with open streams will disable QUIC. | 3061 // Test first timeouts with open streams will disable QUIC. |
| 2991 QuicStreamRequest request(factory_.get()); | 3062 QuicStreamRequest request(factory_.get()); |
| 2992 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 3063 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 2993 /*cert_verify_flags=*/0, host_port_pair_.host(), | 3064 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 2994 "GET", net_log_, callback_.callback())); | 3065 "GET", net_log_, callback_.callback(), |
| 3066 /*for_bidirectional=*/false)); |
| 2995 | 3067 |
| 2996 QuicChromiumClientSession* session = | 3068 QuicChromiumClientSession* session = |
| 2997 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 3069 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 2998 | 3070 |
| 2999 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 3071 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 3000 EXPECT_TRUE(stream.get()); | 3072 EXPECT_TRUE(stream.get()); |
| 3001 HttpRequestInfo request_info; | 3073 HttpRequestInfo request_info; |
| 3002 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 3074 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 3003 net_log_, CompletionCallback())); | 3075 net_log_, CompletionCallback())); |
| 3004 | 3076 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3063 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 3135 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 3064 "192.168.0.1", ""); | 3136 "192.168.0.1", ""); |
| 3065 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 3137 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 3066 host_resolver_.rules()->AddIPLiteralRule(server3.host(), "192.168.0.1", ""); | 3138 host_resolver_.rules()->AddIPLiteralRule(server3.host(), "192.168.0.1", ""); |
| 3067 host_resolver_.rules()->AddIPLiteralRule(server4.host(), "192.168.0.1", ""); | 3139 host_resolver_.rules()->AddIPLiteralRule(server4.host(), "192.168.0.1", ""); |
| 3068 | 3140 |
| 3069 // Test first and fourth out of four public reset post handshakes. | 3141 // Test first and fourth out of four public reset post handshakes. |
| 3070 QuicStreamRequest request(factory_.get()); | 3142 QuicStreamRequest request(factory_.get()); |
| 3071 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 3143 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 3072 /*cert_verify_flags=*/0, host_port_pair_.host(), | 3144 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 3073 "GET", net_log_, callback_.callback())); | 3145 "GET", net_log_, callback_.callback(), |
| 3146 /*for_bidirectional=*/false)); |
| 3074 | 3147 |
| 3075 QuicChromiumClientSession* session = | 3148 QuicChromiumClientSession* session = |
| 3076 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 3149 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 3077 | 3150 |
| 3078 DVLOG(1) << "Created 1st session. Now trigger public reset post handshake"; | 3151 DVLOG(1) << "Created 1st session. Now trigger public reset post handshake"; |
| 3079 session->connection()->CloseConnection(QUIC_PUBLIC_RESET, | 3152 session->connection()->CloseConnection(QUIC_PUBLIC_RESET, |
| 3080 ConnectionCloseSource::FROM_PEER); | 3153 ConnectionCloseSource::FROM_PEER); |
| 3081 // Need to spin the loop now to ensure that | 3154 // Need to spin the loop now to ensure that |
| 3082 // QuicStreamFactory::OnSessionClosed() runs. | 3155 // QuicStreamFactory::OnSessionClosed() runs. |
| 3083 base::RunLoop run_loop; | 3156 base::RunLoop run_loop; |
| 3084 run_loop.RunUntilIdle(); | 3157 run_loop.RunUntilIdle(); |
| 3085 | 3158 |
| 3086 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( | 3159 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( |
| 3087 factory_.get())); | 3160 factory_.get())); |
| 3088 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), | 3161 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), |
| 3089 host_port_pair_.port())); | 3162 host_port_pair_.port())); |
| 3090 | 3163 |
| 3091 DVLOG(1) << "Create 2nd and 3rd sessions without disable trigger"; | 3164 DVLOG(1) << "Create 2nd and 3rd sessions without disable trigger"; |
| 3092 TestCompletionCallback callback2; | 3165 TestCompletionCallback callback2; |
| 3093 QuicStreamRequest request2(factory_.get()); | 3166 QuicStreamRequest request2(factory_.get()); |
| 3094 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 3167 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 3095 /*cert_verify_flags=*/0, server2.host(), "GET", | 3168 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 3096 net_log_, callback2.callback())); | 3169 net_log_, callback2.callback(), |
| 3170 /*for_bidirectional=*/false)); |
| 3097 QuicChromiumClientSession* session2 = | 3171 QuicChromiumClientSession* session2 = |
| 3098 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); | 3172 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); |
| 3099 | 3173 |
| 3100 session2->connection()->CloseConnection(QUIC_NO_ERROR, | 3174 session2->connection()->CloseConnection(QUIC_NO_ERROR, |
| 3101 ConnectionCloseSource::FROM_SELF); | 3175 ConnectionCloseSource::FROM_SELF); |
| 3102 // Need to spin the loop now to ensure that | 3176 // Need to spin the loop now to ensure that |
| 3103 // QuicStreamFactory::OnSessionClosed() runs. | 3177 // QuicStreamFactory::OnSessionClosed() runs. |
| 3104 base::RunLoop run_loop2; | 3178 base::RunLoop run_loop2; |
| 3105 run_loop2.RunUntilIdle(); | 3179 run_loop2.RunUntilIdle(); |
| 3106 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( | 3180 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( |
| 3107 factory_.get())); | 3181 factory_.get())); |
| 3108 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), | 3182 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), |
| 3109 host_port_pair_.port())); | 3183 host_port_pair_.port())); |
| 3110 | 3184 |
| 3111 TestCompletionCallback callback3; | 3185 TestCompletionCallback callback3; |
| 3112 QuicStreamRequest request3(factory_.get()); | 3186 QuicStreamRequest request3(factory_.get()); |
| 3113 EXPECT_EQ(OK, request3.Request(server3, privacy_mode_, | 3187 EXPECT_EQ(OK, request3.Request(server3, privacy_mode_, |
| 3114 /*cert_verify_flags=*/0, server3.host(), "GET", | 3188 /*cert_verify_flags=*/0, server3.host(), "GET", |
| 3115 net_log_, callback3.callback())); | 3189 net_log_, callback3.callback(), |
| 3190 /*for_bidirectional=*/false)); |
| 3116 QuicChromiumClientSession* session3 = | 3191 QuicChromiumClientSession* session3 = |
| 3117 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server3); | 3192 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server3); |
| 3118 | 3193 |
| 3119 session3->connection()->CloseConnection(QUIC_NO_ERROR, | 3194 session3->connection()->CloseConnection(QUIC_NO_ERROR, |
| 3120 ConnectionCloseSource::FROM_SELF); | 3195 ConnectionCloseSource::FROM_SELF); |
| 3121 // Need to spin the loop now to ensure that | 3196 // Need to spin the loop now to ensure that |
| 3122 // QuicStreamFactory::OnSessionClosed() runs. | 3197 // QuicStreamFactory::OnSessionClosed() runs. |
| 3123 base::RunLoop run_loop3; | 3198 base::RunLoop run_loop3; |
| 3124 run_loop3.RunUntilIdle(); | 3199 run_loop3.RunUntilIdle(); |
| 3125 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( | 3200 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( |
| 3126 factory_.get())); | 3201 factory_.get())); |
| 3127 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), | 3202 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), |
| 3128 host_port_pair_.port())); | 3203 host_port_pair_.port())); |
| 3129 | 3204 |
| 3130 DVLOG(1) << "Create 4rd session with public reset post handshake," | 3205 DVLOG(1) << "Create 4rd session with public reset post handshake," |
| 3131 << " will not disable QUIC"; | 3206 << " will not disable QUIC"; |
| 3132 TestCompletionCallback callback4; | 3207 TestCompletionCallback callback4; |
| 3133 QuicStreamRequest request4(factory_.get()); | 3208 QuicStreamRequest request4(factory_.get()); |
| 3134 EXPECT_EQ(OK, request4.Request(server4, privacy_mode_, | 3209 EXPECT_EQ(OK, request4.Request(server4, privacy_mode_, |
| 3135 /*cert_verify_flags=*/0, server4.host(), "GET", | 3210 /*cert_verify_flags=*/0, server4.host(), "GET", |
| 3136 net_log_, callback4.callback())); | 3211 net_log_, callback4.callback(), |
| 3212 /*for_bidirectional=*/false)); |
| 3137 QuicChromiumClientSession* session4 = | 3213 QuicChromiumClientSession* session4 = |
| 3138 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server4); | 3214 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server4); |
| 3139 | 3215 |
| 3140 session4->connection()->CloseConnection(QUIC_PUBLIC_RESET, | 3216 session4->connection()->CloseConnection(QUIC_PUBLIC_RESET, |
| 3141 ConnectionCloseSource::FROM_PEER); | 3217 ConnectionCloseSource::FROM_PEER); |
| 3142 // Need to spin the loop now to ensure that | 3218 // Need to spin the loop now to ensure that |
| 3143 // QuicStreamFactory::OnSessionClosed() runs. | 3219 // QuicStreamFactory::OnSessionClosed() runs. |
| 3144 base::RunLoop run_loop4; | 3220 base::RunLoop run_loop4; |
| 3145 run_loop4.RunUntilIdle(); | 3221 run_loop4.RunUntilIdle(); |
| 3146 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( | 3222 EXPECT_EQ(1, QuicStreamFactoryPeer::GetNumPublicResetsPostHandshake( |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3207 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 3283 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 3208 "192.168.0.1", ""); | 3284 "192.168.0.1", ""); |
| 3209 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); | 3285 host_resolver_.rules()->AddIPLiteralRule(server2.host(), "192.168.0.1", ""); |
| 3210 host_resolver_.rules()->AddIPLiteralRule(server3.host(), "192.168.0.1", ""); | 3286 host_resolver_.rules()->AddIPLiteralRule(server3.host(), "192.168.0.1", ""); |
| 3211 host_resolver_.rules()->AddIPLiteralRule(server4.host(), "192.168.0.1", ""); | 3287 host_resolver_.rules()->AddIPLiteralRule(server4.host(), "192.168.0.1", ""); |
| 3212 | 3288 |
| 3213 // Test first and fourth out of three timeouts with open streams. | 3289 // Test first and fourth out of three timeouts with open streams. |
| 3214 QuicStreamRequest request(factory_.get()); | 3290 QuicStreamRequest request(factory_.get()); |
| 3215 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 3291 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 3216 /*cert_verify_flags=*/0, host_port_pair_.host(), | 3292 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 3217 "GET", net_log_, callback_.callback())); | 3293 "GET", net_log_, callback_.callback(), |
| 3294 /*for_bidirectional=*/false)); |
| 3218 | 3295 |
| 3219 QuicChromiumClientSession* session = | 3296 QuicChromiumClientSession* session = |
| 3220 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); | 3297 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), host_port_pair_); |
| 3221 | 3298 |
| 3222 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 3299 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 3223 EXPECT_TRUE(stream.get()); | 3300 EXPECT_TRUE(stream.get()); |
| 3224 HttpRequestInfo request_info; | 3301 HttpRequestInfo request_info; |
| 3225 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, | 3302 EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 3226 net_log_, CompletionCallback())); | 3303 net_log_, CompletionCallback())); |
| 3227 | 3304 |
| 3228 DVLOG(1) | 3305 DVLOG(1) |
| 3229 << "Created 1st session and initialized a stream. Now trigger timeout"; | 3306 << "Created 1st session and initialized a stream. Now trigger timeout"; |
| 3230 session->connection()->CloseConnection(QUIC_NETWORK_IDLE_TIMEOUT, | 3307 session->connection()->CloseConnection(QUIC_NETWORK_IDLE_TIMEOUT, |
| 3231 ConnectionCloseSource::FROM_SELF); | 3308 ConnectionCloseSource::FROM_SELF); |
| 3232 // Need to spin the loop now to ensure that | 3309 // Need to spin the loop now to ensure that |
| 3233 // QuicStreamFactory::OnSessionClosed() runs. | 3310 // QuicStreamFactory::OnSessionClosed() runs. |
| 3234 base::RunLoop run_loop; | 3311 base::RunLoop run_loop; |
| 3235 run_loop.RunUntilIdle(); | 3312 run_loop.RunUntilIdle(); |
| 3236 | 3313 |
| 3237 EXPECT_EQ( | 3314 EXPECT_EQ( |
| 3238 1, QuicStreamFactoryPeer::GetNumTimeoutsWithOpenStreams(factory_.get())); | 3315 1, QuicStreamFactoryPeer::GetNumTimeoutsWithOpenStreams(factory_.get())); |
| 3239 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), | 3316 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), |
| 3240 host_port_pair_.port())); | 3317 host_port_pair_.port())); |
| 3241 | 3318 |
| 3242 DVLOG(1) << "Create 2nd and 3rd sessions without timeout"; | 3319 DVLOG(1) << "Create 2nd and 3rd sessions without timeout"; |
| 3243 TestCompletionCallback callback2; | 3320 TestCompletionCallback callback2; |
| 3244 QuicStreamRequest request2(factory_.get()); | 3321 QuicStreamRequest request2(factory_.get()); |
| 3245 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, | 3322 EXPECT_EQ(OK, request2.Request(server2, privacy_mode_, |
| 3246 /*cert_verify_flags=*/0, server2.host(), "GET", | 3323 /*cert_verify_flags=*/0, server2.host(), "GET", |
| 3247 net_log_, callback2.callback())); | 3324 net_log_, callback2.callback(), |
| 3325 /*for_bidirectional=*/false)); |
| 3248 QuicChromiumClientSession* session2 = | 3326 QuicChromiumClientSession* session2 = |
| 3249 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); | 3327 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server2); |
| 3250 | 3328 |
| 3251 session2->connection()->CloseConnection(QUIC_NO_ERROR, | 3329 session2->connection()->CloseConnection(QUIC_NO_ERROR, |
| 3252 ConnectionCloseSource::FROM_PEER); | 3330 ConnectionCloseSource::FROM_PEER); |
| 3253 // Need to spin the loop now to ensure that | 3331 // Need to spin the loop now to ensure that |
| 3254 // QuicStreamFactory::OnSessionClosed() runs. | 3332 // QuicStreamFactory::OnSessionClosed() runs. |
| 3255 base::RunLoop run_loop2; | 3333 base::RunLoop run_loop2; |
| 3256 run_loop2.RunUntilIdle(); | 3334 run_loop2.RunUntilIdle(); |
| 3257 EXPECT_EQ( | 3335 EXPECT_EQ( |
| 3258 1, QuicStreamFactoryPeer::GetNumTimeoutsWithOpenStreams(factory_.get())); | 3336 1, QuicStreamFactoryPeer::GetNumTimeoutsWithOpenStreams(factory_.get())); |
| 3259 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), | 3337 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), |
| 3260 host_port_pair_.port())); | 3338 host_port_pair_.port())); |
| 3261 | 3339 |
| 3262 TestCompletionCallback callback3; | 3340 TestCompletionCallback callback3; |
| 3263 QuicStreamRequest request3(factory_.get()); | 3341 QuicStreamRequest request3(factory_.get()); |
| 3264 EXPECT_EQ(OK, request3.Request(server3, privacy_mode_, | 3342 EXPECT_EQ(OK, request3.Request(server3, privacy_mode_, |
| 3265 /*cert_verify_flags=*/0, server3.host(), "GET", | 3343 /*cert_verify_flags=*/0, server3.host(), "GET", |
| 3266 net_log_, callback3.callback())); | 3344 net_log_, callback3.callback(), |
| 3345 /*for_bidirectional=*/false)); |
| 3267 QuicChromiumClientSession* session3 = | 3346 QuicChromiumClientSession* session3 = |
| 3268 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server3); | 3347 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server3); |
| 3269 | 3348 |
| 3270 session3->connection()->CloseConnection(QUIC_NO_ERROR, | 3349 session3->connection()->CloseConnection(QUIC_NO_ERROR, |
| 3271 ConnectionCloseSource::FROM_PEER); | 3350 ConnectionCloseSource::FROM_PEER); |
| 3272 // Need to spin the loop now to ensure that | 3351 // Need to spin the loop now to ensure that |
| 3273 // QuicStreamFactory::OnSessionClosed() runs. | 3352 // QuicStreamFactory::OnSessionClosed() runs. |
| 3274 base::RunLoop run_loop3; | 3353 base::RunLoop run_loop3; |
| 3275 run_loop3.RunUntilIdle(); | 3354 run_loop3.RunUntilIdle(); |
| 3276 EXPECT_EQ( | 3355 EXPECT_EQ( |
| 3277 1, QuicStreamFactoryPeer::GetNumTimeoutsWithOpenStreams(factory_.get())); | 3356 1, QuicStreamFactoryPeer::GetNumTimeoutsWithOpenStreams(factory_.get())); |
| 3278 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), | 3357 EXPECT_FALSE(QuicStreamFactoryPeer::IsQuicDisabled(factory_.get(), |
| 3279 host_port_pair_.port())); | 3358 host_port_pair_.port())); |
| 3280 | 3359 |
| 3281 DVLOG(1) << "Create 4th session with timeout with open streams," | 3360 DVLOG(1) << "Create 4th session with timeout with open streams," |
| 3282 << " will not disable QUIC"; | 3361 << " will not disable QUIC"; |
| 3283 | 3362 |
| 3284 TestCompletionCallback callback4; | 3363 TestCompletionCallback callback4; |
| 3285 QuicStreamRequest request4(factory_.get()); | 3364 QuicStreamRequest request4(factory_.get()); |
| 3286 EXPECT_EQ(OK, request4.Request(server4, privacy_mode_, | 3365 EXPECT_EQ(OK, request4.Request(server4, privacy_mode_, |
| 3287 /*cert_verify_flags=*/0, server4.host(), "GET", | 3366 /*cert_verify_flags=*/0, server4.host(), "GET", |
| 3288 net_log_, callback4.callback())); | 3367 net_log_, callback4.callback(), |
| 3368 /*for_bidirectional=*/false)); |
| 3289 QuicChromiumClientSession* session4 = | 3369 QuicChromiumClientSession* session4 = |
| 3290 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server4); | 3370 QuicStreamFactoryPeer::GetActiveSession(factory_.get(), server4); |
| 3291 | 3371 |
| 3292 scoped_ptr<QuicHttpStream> stream4 = request4.ReleaseStream(); | 3372 scoped_ptr<QuicHttpStream> stream4 = request4.ReleaseStream(); |
| 3293 EXPECT_TRUE(stream4.get()); | 3373 EXPECT_TRUE(stream4.get()); |
| 3294 EXPECT_EQ(OK, stream4->InitializeStream(&request_info, DEFAULT_PRIORITY, | 3374 EXPECT_EQ(OK, stream4->InitializeStream(&request_info, DEFAULT_PRIORITY, |
| 3295 net_log_, CompletionCallback())); | 3375 net_log_, CompletionCallback())); |
| 3296 session4->connection()->CloseConnection(QUIC_NETWORK_IDLE_TIMEOUT, | 3376 session4->connection()->CloseConnection(QUIC_NETWORK_IDLE_TIMEOUT, |
| 3297 ConnectionCloseSource::FROM_SELF); | 3377 ConnectionCloseSource::FROM_SELF); |
| 3298 // Need to spin the loop now to ensure that | 3378 // Need to spin the loop now to ensure that |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3335 crypto_client_stream_factory_.set_handshake_mode( | 3415 crypto_client_stream_factory_.set_handshake_mode( |
| 3336 MockCryptoClientStream::ZERO_RTT); | 3416 MockCryptoClientStream::ZERO_RTT); |
| 3337 host_resolver_.set_synchronous_mode(true); | 3417 host_resolver_.set_synchronous_mode(true); |
| 3338 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 3418 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
| 3339 "192.168.0.1", ""); | 3419 "192.168.0.1", ""); |
| 3340 | 3420 |
| 3341 QuicStreamRequest request(factory_.get()); | 3421 QuicStreamRequest request(factory_.get()); |
| 3342 EXPECT_EQ(ERR_IO_PENDING, | 3422 EXPECT_EQ(ERR_IO_PENDING, |
| 3343 request.Request(host_port_pair_, privacy_mode_, | 3423 request.Request(host_port_pair_, privacy_mode_, |
| 3344 /*cert_verify_flags=*/0, host_port_pair_.host(), | 3424 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 3345 "POST", net_log_, callback_.callback())); | 3425 "POST", net_log_, callback_.callback(), |
| 3426 /*for_bidirectional=*/false)); |
| 3346 | 3427 |
| 3347 // If we don't delay TCP connection, then time delay should be 0. | 3428 // If we don't delay TCP connection, then time delay should be 0. |
| 3348 EXPECT_FALSE(factory_->delay_tcp_race()); | 3429 EXPECT_FALSE(factory_->delay_tcp_race()); |
| 3349 EXPECT_EQ(base::TimeDelta(), request.GetTimeDelayForWaitingJob()); | 3430 EXPECT_EQ(base::TimeDelta(), request.GetTimeDelayForWaitingJob()); |
| 3350 | 3431 |
| 3351 // Enable |delay_tcp_race_| param and verify delay is one RTT and that | 3432 // Enable |delay_tcp_race_| param and verify delay is one RTT and that |
| 3352 // server supports QUIC. | 3433 // server supports QUIC. |
| 3353 QuicStreamFactoryPeer::SetDelayTcpRace(factory_.get(), true); | 3434 QuicStreamFactoryPeer::SetDelayTcpRace(factory_.get(), true); |
| 3354 EXPECT_TRUE(factory_->delay_tcp_race()); | 3435 EXPECT_TRUE(factory_->delay_tcp_race()); |
| 3355 EXPECT_EQ(base::TimeDelta::FromMicroseconds(15), | 3436 EXPECT_EQ(base::TimeDelta::FromMicroseconds(15), |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3487 | 3568 |
| 3488 // Set up the TaskObserver to verify QuicChromiumPacketReader::StartReading | 3569 // Set up the TaskObserver to verify QuicChromiumPacketReader::StartReading |
| 3489 // posts a task. | 3570 // posts a task. |
| 3490 // TODO(rtenneti): Change SpdySessionTestTaskObserver to NetTestTaskObserver?? | 3571 // TODO(rtenneti): Change SpdySessionTestTaskObserver to NetTestTaskObserver?? |
| 3491 SpdySessionTestTaskObserver observer("quic_chromium_packet_reader.cc", | 3572 SpdySessionTestTaskObserver observer("quic_chromium_packet_reader.cc", |
| 3492 "StartReading"); | 3573 "StartReading"); |
| 3493 | 3574 |
| 3494 QuicStreamRequest request(factory_.get()); | 3575 QuicStreamRequest request(factory_.get()); |
| 3495 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 3576 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 3496 /*cert_verify_flags=*/0, host_port_pair_.host(), | 3577 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 3497 "GET", net_log_, callback_.callback())); | 3578 "GET", net_log_, callback_.callback(), |
| 3579 /*for_bidirectional=*/false)); |
| 3498 | 3580 |
| 3499 // Call run_loop so that QuicChromiumPacketReader::OnReadComplete() gets | 3581 // Call run_loop so that QuicChromiumPacketReader::OnReadComplete() gets |
| 3500 // called. | 3582 // called. |
| 3501 base::RunLoop run_loop; | 3583 base::RunLoop run_loop; |
| 3502 run_loop.RunUntilIdle(); | 3584 run_loop.RunUntilIdle(); |
| 3503 | 3585 |
| 3504 // Verify task that the observer's executed_count is 1, which indicates | 3586 // Verify task that the observer's executed_count is 1, which indicates |
| 3505 // QuicChromiumPacketReader::StartReading() has posted only one task and | 3587 // QuicChromiumPacketReader::StartReading() has posted only one task and |
| 3506 // yielded the read. | 3588 // yielded the read. |
| 3507 EXPECT_EQ(1u, observer.executed_count()); | 3589 EXPECT_EQ(1u, observer.executed_count()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3536 | 3618 |
| 3537 // Set up the TaskObserver to verify QuicChromiumPacketReader::StartReading | 3619 // Set up the TaskObserver to verify QuicChromiumPacketReader::StartReading |
| 3538 // posts a task. | 3620 // posts a task. |
| 3539 // TODO(rtenneti): Change SpdySessionTestTaskObserver to NetTestTaskObserver?? | 3621 // TODO(rtenneti): Change SpdySessionTestTaskObserver to NetTestTaskObserver?? |
| 3540 SpdySessionTestTaskObserver observer("quic_chromium_packet_reader.cc", | 3622 SpdySessionTestTaskObserver observer("quic_chromium_packet_reader.cc", |
| 3541 "StartReading"); | 3623 "StartReading"); |
| 3542 | 3624 |
| 3543 QuicStreamRequest request(factory_.get()); | 3625 QuicStreamRequest request(factory_.get()); |
| 3544 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, | 3626 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_, |
| 3545 /*cert_verify_flags=*/0, host_port_pair_.host(), | 3627 /*cert_verify_flags=*/0, host_port_pair_.host(), |
| 3546 "GET", net_log_, callback_.callback())); | 3628 "GET", net_log_, callback_.callback(), |
| 3629 /*for_bidirectional=*/false)); |
| 3547 | 3630 |
| 3548 // Call run_loop so that QuicChromiumPacketReader::OnReadComplete() gets | 3631 // Call run_loop so that QuicChromiumPacketReader::OnReadComplete() gets |
| 3549 // called. | 3632 // called. |
| 3550 base::RunLoop run_loop; | 3633 base::RunLoop run_loop; |
| 3551 run_loop.RunUntilIdle(); | 3634 run_loop.RunUntilIdle(); |
| 3552 | 3635 |
| 3553 // Verify task that the observer's executed_count is 1, which indicates | 3636 // Verify task that the observer's executed_count is 1, which indicates |
| 3554 // QuicChromiumPacketReader::StartReading() has posted only one task and | 3637 // QuicChromiumPacketReader::StartReading() has posted only one task and |
| 3555 // yielded the read. | 3638 // yielded the read. |
| 3556 EXPECT_EQ(1u, observer.executed_count()); | 3639 EXPECT_EQ(1u, observer.executed_count()); |
| 3557 | 3640 |
| 3558 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 3641 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
| 3559 EXPECT_TRUE(stream.get()); | 3642 EXPECT_TRUE(stream.get()); |
| 3560 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 3643 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
| 3561 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 3644 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
| 3562 } | 3645 } |
| 3563 | 3646 |
| 3564 } // namespace test | 3647 } // namespace test |
| 3565 } // namespace net | 3648 } // namespace net |
| OLD | NEW |