| Index: net/tools/quic/end_to_end_test.cc
|
| diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc
|
| index 58a482752837b87e1d9b6333e0177e7ca879b304..5cbf9e1bccf07f5def40263a93396b7e513bb7c9 100644
|
| --- a/net/tools/quic/end_to_end_test.cc
|
| +++ b/net/tools/quic/end_to_end_test.cc
|
| @@ -74,8 +74,7 @@ struct TestParams {
|
| : client_supported_versions(client_supported_versions),
|
| server_supported_versions(server_supported_versions),
|
| negotiated_version(negotiated_version),
|
| - use_pacing(use_pacing) {
|
| - }
|
| + use_pacing(use_pacing) {}
|
|
|
| friend ostream& operator<<(ostream& os, const TestParams& p) {
|
| os << "{ server_supported_versions: "
|
| @@ -132,6 +131,7 @@ class ServerDelegate : public PacketDroppingTestWriter::Delegate {
|
| : dispatcher_(dispatcher) {}
|
| virtual ~ServerDelegate() {}
|
| virtual void OnCanWrite() OVERRIDE { dispatcher_->OnCanWrite(); }
|
| +
|
| private:
|
| QuicDispatcher* dispatcher_;
|
| };
|
| @@ -144,6 +144,7 @@ class ClientDelegate : public PacketDroppingTestWriter::Delegate {
|
| EpollEvent event(EPOLLOUT, false);
|
| client_->OnEvent(client_->fd(), &event);
|
| }
|
| +
|
| private:
|
| QuicClient* client_;
|
| };
|
| @@ -178,10 +179,18 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
|
| 3 * kInitialFlowControlWindowForTest;
|
|
|
| QuicInMemoryCachePeer::ResetForTests();
|
| - AddToCache("GET", "https://www.google.com/foo",
|
| - "HTTP/1.1", "200", "OK", kFooResponseBody);
|
| - AddToCache("GET", "https://www.google.com/bar",
|
| - "HTTP/1.1", "200", "OK", kBarResponseBody);
|
| + AddToCache("GET",
|
| + "https://www.google.com/foo",
|
| + "HTTP/1.1",
|
| + "200",
|
| + "OK",
|
| + kFooResponseBody);
|
| + AddToCache("GET",
|
| + "https://www.google.com/bar",
|
| + "HTTP/1.1",
|
| + "200",
|
| + "OK",
|
| + kBarResponseBody);
|
| }
|
|
|
| virtual ~EndToEndTest() {
|
| @@ -191,13 +200,13 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
|
| }
|
|
|
| QuicTestClient* CreateQuicClient(QuicPacketWriterWrapper* writer) {
|
| - QuicTestClient* client = new QuicTestClient(
|
| - server_address_,
|
| - server_hostname_,
|
| - false, // not secure
|
| - client_config_,
|
| - client_supported_versions_,
|
| - client_initial_flow_control_receive_window_);
|
| + QuicTestClient* client =
|
| + new QuicTestClient(server_address_,
|
| + server_hostname_,
|
| + false, // not secure
|
| + client_config_,
|
| + client_supported_versions_,
|
| + client_initial_flow_control_receive_window_);
|
| client->UseWriter(writer);
|
| client->Connect();
|
| return client;
|
| @@ -236,9 +245,7 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
|
| server_writer_ = new PacketDroppingTestWriter();
|
| }
|
|
|
| - virtual void TearDown() OVERRIDE {
|
| - StopServer();
|
| - }
|
| + virtual void TearDown() OVERRIDE { StopServer(); }
|
|
|
| void StartServer() {
|
| server_thread_.reset(
|
| @@ -248,14 +255,13 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
|
| strike_register_no_startup_period_,
|
| server_initial_flow_control_receive_window_));
|
| server_thread_->Initialize();
|
| - server_address_ = IPEndPoint(server_address_.address(),
|
| - server_thread_->GetPort());
|
| + server_address_ =
|
| + IPEndPoint(server_address_.address(), server_thread_->GetPort());
|
| QuicDispatcher* dispatcher =
|
| QuicServerPeer::GetDispatcher(server_thread_->server());
|
| QuicDispatcherPeer::UseWriter(dispatcher, server_writer_);
|
| - server_writer_->Initialize(
|
| - QuicDispatcherPeer::GetHelper(dispatcher),
|
| - new ServerDelegate(dispatcher));
|
| + server_writer_->Initialize(QuicDispatcherPeer::GetHelper(dispatcher),
|
| + new ServerDelegate(dispatcher));
|
| server_thread_->Start();
|
| server_started_ = true;
|
| }
|
| @@ -376,8 +382,7 @@ TEST_P(EndToEndTest, DISABLED_SimpleRequestResponsev6) {
|
| TEST_P(EndToEndTest, SeparateFinPacket) {
|
| ASSERT_TRUE(Initialize());
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.set_has_complete_message(false);
|
|
|
| client_->SendMessage(request);
|
| @@ -410,8 +415,7 @@ TEST_P(EndToEndTest, MultipleClients) {
|
| ASSERT_TRUE(Initialize());
|
| scoped_ptr<QuicTestClient> client2(CreateQuicClient(NULL));
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddHeader("content-length", "3");
|
| request.set_has_complete_message(false);
|
|
|
| @@ -459,8 +463,7 @@ TEST_P(EndToEndTest, PostMissingBytes) {
|
| ASSERT_TRUE(Initialize());
|
|
|
| // Add a content length header with no body.
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddHeader("content-length", "3");
|
| request.set_skip_message_validation(true);
|
|
|
| @@ -482,8 +485,7 @@ TEST_P(EndToEndTest, DISABLED_LargePostNoPacketLoss) {
|
| string body;
|
| GenerateBody(&body, 1024 * 1024);
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddBody(body, true);
|
|
|
| EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
|
| @@ -500,8 +502,7 @@ TEST_P(EndToEndTest, LargePostNoPacketLoss1sRTT) {
|
| string body;
|
| GenerateBody(&body, 100 * 1024);
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddBody(body, true);
|
|
|
| EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
|
| @@ -522,8 +523,7 @@ TEST_P(EndToEndTest, LargePostWithPacketLoss) {
|
| string body;
|
| GenerateBody(&body, 1024 * 10);
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddBody(body, true);
|
|
|
| EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
|
| @@ -541,8 +541,7 @@ TEST_P(EndToEndTest, LargePostNoPacketLossWithDelayAndReordering) {
|
| string body;
|
| GenerateBody(&body, 1024 * 1024);
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddBody(body, true);
|
|
|
| EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
|
| @@ -564,8 +563,7 @@ TEST_P(EndToEndTest, LargePostWithPacketLossAndBlockedSocket) {
|
| string body;
|
| GenerateBody(&body, 1024 * 10);
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddBody(body, true);
|
|
|
| EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
|
| @@ -584,8 +582,7 @@ TEST_P(EndToEndTest, DISABLED_LargePostZeroRTTFailure) {
|
| string body;
|
| GenerateBody(&body, 20480);
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddBody(body, true);
|
|
|
| EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
|
| @@ -644,8 +641,7 @@ TEST_P(EndToEndTest, LargePostFEC) {
|
| string body;
|
| GenerateBody(&body, 10240);
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddBody(body, true);
|
|
|
| EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
|
| @@ -666,8 +662,7 @@ TEST_P(EndToEndTest, LargePostLargeBuffer) {
|
| string body;
|
| GenerateBody(&body, 1024 * 1024);
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddBody(body, true);
|
|
|
| EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
|
| @@ -681,8 +676,7 @@ TEST_P(EndToEndTest, InvalidStream) {
|
| string body;
|
| GenerateBody(&body, kMaxPacketSize);
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddBody(body, true);
|
| // Force the client to write with a stream ID belonging to a nonexistent
|
| // server-side stream.
|
| @@ -697,8 +691,7 @@ TEST_P(EndToEndTest, InvalidStream) {
|
| TEST_P(EndToEndTest, DISABLED_MultipleTermination) {
|
| ASSERT_TRUE(Initialize());
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddHeader("content-length", "3");
|
| request.set_has_complete_message(false);
|
|
|
| @@ -714,8 +707,8 @@ TEST_P(EndToEndTest, DISABLED_MultipleTermination) {
|
|
|
| // By default the stream protects itself from writes after terminte is set.
|
| // Override this to test the server handling buggy clients.
|
| - ReliableQuicStreamPeer::SetWriteSideClosed(
|
| - false, client_->GetOrCreateStream());
|
| + ReliableQuicStreamPeer::SetWriteSideClosed(false,
|
| + client_->GetOrCreateStream());
|
|
|
| EXPECT_DFATAL(client_->SendData("eep", true), "Fin already buffered");
|
| }
|
| @@ -789,8 +782,7 @@ TEST_P(EndToEndTest, DISABLED_LimitCongestionWindowAndRTT) {
|
| string body;
|
| GenerateBody(&body, 1024 * 10);
|
|
|
| - HTTPMessage request(HttpConstants::HTTP_1_1,
|
| - HttpConstants::POST, "/foo");
|
| + HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo");
|
| request.AddBody(body, true);
|
|
|
| server_thread_->Resume();
|
| @@ -801,8 +793,8 @@ TEST_P(EndToEndTest, DISABLED_LimitCongestionWindowAndRTT) {
|
| TEST_P(EndToEndTest, MaxInitialRTT) {
|
| // Client tries to suggest twice the server's max initial rtt and the server
|
| // uses the max.
|
| - client_config_.SetInitialRoundTripTimeUsToSend(
|
| - 2 * kMaxInitialRoundTripTimeUs);
|
| + client_config_.SetInitialRoundTripTimeUsToSend(2 *
|
| + kMaxInitialRoundTripTimeUs);
|
|
|
| ASSERT_TRUE(Initialize());
|
| client_->client()->WaitForCryptoHandshakeConfirmed();
|
| @@ -880,7 +872,8 @@ TEST_P(EndToEndTest, MaxStreamsUberTest) {
|
| GenerateBody(&large_body, 10240);
|
| int max_streams = 100;
|
|
|
| - AddToCache("GET", "/large_response", "HTTP/1.1", "200", "OK", large_body);;
|
| + AddToCache("GET", "/large_response", "HTTP/1.1", "200", "OK", large_body);
|
| + ;
|
|
|
| client_->client()->WaitForCryptoHandshakeConfirmed();
|
| SetPacketLossPercentage(10);
|
| @@ -931,19 +924,16 @@ class WrongAddressWriter : public QuicPacketWriterWrapper {
|
| self_address_ = IPEndPoint(ip, 0);
|
| }
|
|
|
| - virtual WriteResult WritePacket(
|
| - const char* buffer,
|
| - size_t buf_len,
|
| - const IPAddressNumber& real_self_address,
|
| - const IPEndPoint& peer_address) OVERRIDE {
|
| + virtual WriteResult WritePacket(const char* buffer,
|
| + size_t buf_len,
|
| + const IPAddressNumber& real_self_address,
|
| + const IPEndPoint& peer_address) OVERRIDE {
|
| // Use wrong address!
|
| return QuicPacketWriterWrapper::WritePacket(
|
| buffer, buf_len, self_address_.address(), peer_address);
|
| }
|
|
|
| - virtual bool IsWriteBlockedDataBuffered() const OVERRIDE {
|
| - return false;
|
| - }
|
| + virtual bool IsWriteBlockedDataBuffered() const OVERRIDE { return false; }
|
|
|
| IPEndPoint self_address_;
|
| };
|
| @@ -984,10 +974,11 @@ TEST_P(EndToEndTest, DifferentFlowControlWindows) {
|
| server_thread_->WaitForCryptoHandshakeConfirmed();
|
|
|
| // Client should have the right value for server's receive window.
|
| - EXPECT_EQ(kServerIFCW, client_->client()
|
| - ->session()
|
| - ->config()
|
| - ->ReceivedInitialFlowControlWindowBytes());
|
| + EXPECT_EQ(kServerIFCW,
|
| + client_->client()
|
| + ->session()
|
| + ->config()
|
| + ->ReceivedInitialFlowControlWindowBytes());
|
|
|
| // Server should have the right value for client's receive window.
|
| server_thread_->Pause();
|
|
|