| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <sys/epoll.h> | 7 #include <sys/epoll.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 EXPECT_EQ(500u, client_->response_headers()->parsed_response_code()); | 476 EXPECT_EQ(500u, client_->response_headers()->parsed_response_code()); |
| 477 } | 477 } |
| 478 | 478 |
| 479 // TODO(rtenneti): DISABLED_LargePostNoPacketLoss seems to be flaky. | 479 // TODO(rtenneti): DISABLED_LargePostNoPacketLoss seems to be flaky. |
| 480 // http://crbug.com/297040. | 480 // http://crbug.com/297040. |
| 481 TEST_P(EndToEndTest, DISABLED_LargePostNoPacketLoss) { | 481 TEST_P(EndToEndTest, DISABLED_LargePostNoPacketLoss) { |
| 482 ASSERT_TRUE(Initialize()); | 482 ASSERT_TRUE(Initialize()); |
| 483 | 483 |
| 484 client_->client()->WaitForCryptoHandshakeConfirmed(); | 484 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 485 | 485 |
| 486 // 1 Mb body. | 486 // 1 MB body. |
| 487 string body; | 487 string body; |
| 488 GenerateBody(&body, 1024 * 1024); | 488 GenerateBody(&body, 1024 * 1024); |
| 489 | 489 |
| 490 HTTPMessage request(HttpConstants::HTTP_1_1, | 490 HTTPMessage request(HttpConstants::HTTP_1_1, |
| 491 HttpConstants::POST, "/foo"); | 491 HttpConstants::POST, "/foo"); |
| 492 request.AddBody(body, true); | 492 request.AddBody(body, true); |
| 493 | 493 |
| 494 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 494 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
| 495 VerifyCleanConnection(false); | 495 VerifyCleanConnection(false); |
| 496 } | 496 } |
| 497 | 497 |
| 498 TEST_P(EndToEndTest, LargePostNoPacketLoss1sRTT) { | 498 TEST_P(EndToEndTest, LargePostNoPacketLoss1sRTT) { |
| 499 ASSERT_TRUE(Initialize()); | 499 ASSERT_TRUE(Initialize()); |
| 500 SetPacketSendDelay(QuicTime::Delta::FromMilliseconds(1000)); | 500 SetPacketSendDelay(QuicTime::Delta::FromMilliseconds(1000)); |
| 501 | 501 |
| 502 client_->client()->WaitForCryptoHandshakeConfirmed(); | 502 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 503 | 503 |
| 504 // 1 Mb body. | 504 // 100 KB body. |
| 505 string body; | 505 string body; |
| 506 GenerateBody(&body, 100 * 1024); | 506 GenerateBody(&body, 100 * 1024); |
| 507 | 507 |
| 508 HTTPMessage request(HttpConstants::HTTP_1_1, | 508 HTTPMessage request(HttpConstants::HTTP_1_1, |
| 509 HttpConstants::POST, "/foo"); | 509 HttpConstants::POST, "/foo"); |
| 510 request.AddBody(body, true); | 510 request.AddBody(body, true); |
| 511 | 511 |
| 512 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 512 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
| 513 VerifyCleanConnection(false); | 513 VerifyCleanConnection(false); |
| 514 } | 514 } |
| 515 | 515 |
| 516 TEST_P(EndToEndTest, LargePostWithPacketLoss) { | 516 TEST_P(EndToEndTest, LargePostWithPacketLoss) { |
| 517 // Connect with lower fake packet loss than we'd like to test. Until | 517 // Connect with lower fake packet loss than we'd like to test. Until |
| 518 // b/10126687 is fixed, losing handshake packets is pretty brutal. | 518 // b/10126687 is fixed, losing handshake packets is pretty brutal. |
| 519 SetPacketLossPercentage(5); | 519 SetPacketLossPercentage(5); |
| 520 ASSERT_TRUE(Initialize()); | 520 ASSERT_TRUE(Initialize()); |
| 521 | 521 |
| 522 // Wait for the server SHLO before upping the packet loss. | 522 // Wait for the server SHLO before upping the packet loss. |
| 523 client_->client()->WaitForCryptoHandshakeConfirmed(); | 523 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 524 SetPacketLossPercentage(30); | 524 SetPacketLossPercentage(30); |
| 525 | 525 |
| 526 // 10 Kb body. | 526 // 10 KB body. |
| 527 string body; | 527 string body; |
| 528 GenerateBody(&body, 1024 * 10); | 528 GenerateBody(&body, 1024 * 10); |
| 529 | 529 |
| 530 HTTPMessage request(HttpConstants::HTTP_1_1, | 530 HTTPMessage request(HttpConstants::HTTP_1_1, |
| 531 HttpConstants::POST, "/foo"); | 531 HttpConstants::POST, "/foo"); |
| 532 request.AddBody(body, true); | 532 request.AddBody(body, true); |
| 533 | 533 |
| 534 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 534 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
| 535 } | |
| 536 | |
| 537 TEST_P(EndToEndTest, LargePostNoPacketLossWithDelayAndReordering) { | |
| 538 ASSERT_TRUE(Initialize()); | |
| 539 | |
| 540 client_->client()->WaitForCryptoHandshakeConfirmed(); | |
| 541 // Both of these must be called when the writer is not actively used. | |
| 542 SetPacketSendDelay(QuicTime::Delta::FromMilliseconds(2)); | |
| 543 SetReorderPercentage(30); | |
| 544 | |
| 545 // 1 Mb body. | |
| 546 string body; | |
| 547 GenerateBody(&body, 1024 * 1024); | |
| 548 | |
| 549 HTTPMessage request(HttpConstants::HTTP_1_1, | |
| 550 HttpConstants::POST, "/foo"); | |
| 551 request.AddBody(body, true); | |
| 552 | |
| 553 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | |
| 554 VerifyCleanConnection(true); | 535 VerifyCleanConnection(true); |
| 555 } | 536 } |
| 556 | 537 |
| 557 TEST_P(EndToEndTest, LargePostWithPacketLossAndBlockedSocket) { | 538 TEST_P(EndToEndTest, LargePostWithPacketLossAndBlockedSocket) { |
| 558 // Connect with lower fake packet loss than we'd like to test. Until | 539 // Connect with lower fake packet loss than we'd like to test. Until |
| 559 // b/10126687 is fixed, losing handshake packets is pretty brutal. | 540 // b/10126687 is fixed, losing handshake packets is pretty brutal. |
| 560 SetPacketLossPercentage(5); | 541 SetPacketLossPercentage(5); |
| 561 ASSERT_TRUE(Initialize()); | 542 ASSERT_TRUE(Initialize()); |
| 562 | 543 |
| 563 // Wait for the server SHLO before upping the packet loss. | 544 // Wait for the server SHLO before upping the packet loss. |
| 564 client_->client()->WaitForCryptoHandshakeConfirmed(); | 545 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 565 SetPacketLossPercentage(10); | 546 SetPacketLossPercentage(10); |
| 566 client_writer_->set_fake_blocked_socket_percentage(10); | 547 client_writer_->set_fake_blocked_socket_percentage(10); |
| 567 | 548 |
| 568 // 10 Kb body. | 549 // 10 KB body. |
| 569 string body; | 550 string body; |
| 570 GenerateBody(&body, 1024 * 10); | 551 GenerateBody(&body, 1024 * 10); |
| 571 | 552 |
| 572 HTTPMessage request(HttpConstants::HTTP_1_1, | 553 HTTPMessage request(HttpConstants::HTTP_1_1, |
| 573 HttpConstants::POST, "/foo"); | 554 HttpConstants::POST, "/foo"); |
| 555 request.AddBody(body, true); |
| 556 |
| 557 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
| 558 } |
| 559 |
| 560 TEST_P(EndToEndTest, LargePostNoPacketLossWithDelayAndReordering) { |
| 561 ASSERT_TRUE(Initialize()); |
| 562 |
| 563 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 564 // Both of these must be called when the writer is not actively used. |
| 565 SetPacketSendDelay(QuicTime::Delta::FromMilliseconds(2)); |
| 566 SetReorderPercentage(30); |
| 567 |
| 568 // 1 MB body. |
| 569 string body; |
| 570 GenerateBody(&body, 1024 * 1024); |
| 571 |
| 572 HTTPMessage request(HttpConstants::HTTP_1_1, |
| 573 HttpConstants::POST, "/foo"); |
| 574 request.AddBody(body, true); | 574 request.AddBody(body, true); |
| 575 | 575 |
| 576 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 576 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
| 577 } | 577 } |
| 578 | 578 |
| 579 // TODO(rtenneti): rch is investigating the root cause. Will enable after we | 579 // TODO(rtenneti): rch is investigating the root cause. Will enable after we |
| 580 // find the bug. | 580 // find the bug. |
| 581 TEST_P(EndToEndTest, DISABLED_LargePostZeroRTTFailure) { | 581 TEST_P(EndToEndTest, DISABLED_LargePostZeroRTTFailure) { |
| 582 // Have the server accept 0-RTT without waiting a startup period. | 582 // Have the server accept 0-RTT without waiting a startup period. |
| 583 strike_register_no_startup_period_ = true; | 583 strike_register_no_startup_period_ = true; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 | 655 |
| 656 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 656 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
| 657 VerifyCleanConnection(true); | 657 VerifyCleanConnection(true); |
| 658 } | 658 } |
| 659 | 659 |
| 660 // TODO(rtenneti): DISABLED_LargePostLargeBuffer seems to be flaky. | 660 // TODO(rtenneti): DISABLED_LargePostLargeBuffer seems to be flaky. |
| 661 // http://crbug.com/370087. | 661 // http://crbug.com/370087. |
| 662 TEST_P(EndToEndTest, DISABLED_LargePostLargeBuffer) { | 662 TEST_P(EndToEndTest, DISABLED_LargePostLargeBuffer) { |
| 663 ASSERT_TRUE(Initialize()); | 663 ASSERT_TRUE(Initialize()); |
| 664 SetPacketSendDelay(QuicTime::Delta::FromMicroseconds(1)); | 664 SetPacketSendDelay(QuicTime::Delta::FromMicroseconds(1)); |
| 665 // 1Mbit per second with a 128k buffer from server to client. Wireless | 665 // 256KB per second with a 128k buffer from server to client. Wireless |
| 666 // clients commonly have larger buffers, but our max CWND is 200. | 666 // clients commonly have larger buffers, but our max CWND is 200. |
| 667 server_writer_->set_max_bandwidth_and_buffer_size( | 667 server_writer_->set_max_bandwidth_and_buffer_size( |
| 668 QuicBandwidth::FromBytesPerSecond(256 * 1024), 128 * 1024); | 668 QuicBandwidth::FromBytesPerSecond(256 * 1024), 128 * 1024); |
| 669 | 669 |
| 670 client_->client()->WaitForCryptoHandshakeConfirmed(); | 670 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 671 | 671 |
| 672 // 1 Mb body. | 672 // 1 MB body. |
| 673 string body; | 673 string body; |
| 674 GenerateBody(&body, 1024 * 1024); | 674 GenerateBody(&body, 1024 * 1024); |
| 675 | 675 |
| 676 HTTPMessage request(HttpConstants::HTTP_1_1, | 676 HTTPMessage request(HttpConstants::HTTP_1_1, |
| 677 HttpConstants::POST, "/foo"); | 677 HttpConstants::POST, "/foo"); |
| 678 request.AddBody(body, true); | 678 request.AddBody(body, true); |
| 679 | 679 |
| 680 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 680 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
| 681 VerifyCleanConnection(false); | 681 VerifyCleanConnection(false); |
| 682 } | 682 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 EXPECT_EQ(FLAGS_enable_quic_pacing, | 785 EXPECT_EQ(FLAGS_enable_quic_pacing, |
| 786 client_sent_packet_manager.using_pacing()); | 786 client_sent_packet_manager.using_pacing()); |
| 787 | 787 |
| 788 EXPECT_EQ(100000u, | 788 EXPECT_EQ(100000u, |
| 789 client_sent_packet_manager.GetRttStats()->initial_rtt_us()); | 789 client_sent_packet_manager.GetRttStats()->initial_rtt_us()); |
| 790 EXPECT_EQ(1u, server_sent_packet_manager.GetRttStats()->initial_rtt_us()); | 790 EXPECT_EQ(1u, server_sent_packet_manager.GetRttStats()->initial_rtt_us()); |
| 791 | 791 |
| 792 // Now use the negotiated limits with packet loss. | 792 // Now use the negotiated limits with packet loss. |
| 793 SetPacketLossPercentage(30); | 793 SetPacketLossPercentage(30); |
| 794 | 794 |
| 795 // 10 Kb body. | 795 // 10 KB body. |
| 796 string body; | 796 string body; |
| 797 GenerateBody(&body, 1024 * 10); | 797 GenerateBody(&body, 1024 * 10); |
| 798 | 798 |
| 799 HTTPMessage request(HttpConstants::HTTP_1_1, | 799 HTTPMessage request(HttpConstants::HTTP_1_1, |
| 800 HttpConstants::POST, "/foo"); | 800 HttpConstants::POST, "/foo"); |
| 801 request.AddBody(body, true); | 801 request.AddBody(body, true); |
| 802 | 802 |
| 803 server_thread_->Resume(); | 803 server_thread_->Resume(); |
| 804 | 804 |
| 805 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 805 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 QuicSession* session = dispatcher->session_map().begin()->second; | 1059 QuicSession* session = dispatcher->session_map().begin()->second; |
| 1060 EXPECT_EQ(kClientIFCW, | 1060 EXPECT_EQ(kClientIFCW, |
| 1061 session->config()->ReceivedInitialFlowControlWindowBytes()); | 1061 session->config()->ReceivedInitialFlowControlWindowBytes()); |
| 1062 server_thread_->Resume(); | 1062 server_thread_->Resume(); |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 } // namespace | 1065 } // namespace |
| 1066 } // namespace test | 1066 } // namespace test |
| 1067 } // namespace tools | 1067 } // namespace tools |
| 1068 } // namespace net | 1068 } // namespace net |
| OLD | NEW |