Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: net/tools/quic/end_to_end_test.cc

Issue 1976393002: Reduces flakiness of EndToEndTest.ConnectionMigrationClientPortChanged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@121638470
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <sys/epoll.h> 6 #include <sys/epoll.h>
7 7
8 #include <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 // Tests that the client's port can change during an established QUIC 1467 // Tests that the client's port can change during an established QUIC
1468 // connection, and that doing so does not result in the connection being 1468 // connection, and that doing so does not result in the connection being
1469 // closed by the server. 1469 // closed by the server.
1470 ASSERT_TRUE(Initialize()); 1470 ASSERT_TRUE(Initialize());
1471 1471
1472 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); 1472 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1473 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); 1473 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1474 1474
1475 // Store the client address which was used to send the first request. 1475 // Store the client address which was used to send the first request.
1476 IPEndPoint old_address = client_->client()->GetLatestClientAddress(); 1476 IPEndPoint old_address = client_->client()->GetLatestClientAddress();
1477 1477 int old_fd = client_->client()->GetLatestFD();
1478 // Stop listening and close the old FD.
1479 QuicClientPeer::CleanUpUDPSocket(client_->client(),
1480 client_->client()->GetLatestFD());
1481 1478
1482 // Create a new socket before closing the old one, which will result in a new 1479 // Create a new socket before closing the old one, which will result in a new
1483 // ephemeral port. 1480 // ephemeral port.
1484 QuicClientPeer::CreateUDPSocketAndBind(client_->client()); 1481 QuicClientPeer::CreateUDPSocketAndBind(client_->client());
1485 1482
1483 // Stop listening and close the old FD.
1484 QuicClientPeer::CleanUpUDPSocket(client_->client(), old_fd);
1485
1486 // The packet writer needs to be updated to use the new FD. 1486 // The packet writer needs to be updated to use the new FD.
1487 client_->client()->CreateQuicPacketWriter(); 1487 client_->client()->CreateQuicPacketWriter();
1488 1488
1489 // Change the internal state of the client and connection to use the new port, 1489 // Change the internal state of the client and connection to use the new port,
1490 // this is done because in a real NAT rebinding the client wouldn't see any 1490 // this is done because in a real NAT rebinding the client wouldn't see any
1491 // port change, and so expects no change to incoming port. 1491 // port change, and so expects no change to incoming port.
1492 // This is kind of ugly, but needed as we are simply swapping out the client 1492 // This is kind of ugly, but needed as we are simply swapping out the client
1493 // FD rather than any more complex NAT rebinding simulation. 1493 // FD rather than any more complex NAT rebinding simulation.
1494 int new_port = client_->client()->GetLatestClientAddress().port(); 1494 int new_port = client_->client()->GetLatestClientAddress().port();
1495 QuicClientPeer::SetClientPort(client_->client(), new_port); 1495 QuicClientPeer::SetClientPort(client_->client(), new_port);
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2687 client_->WaitForResponse(); 2687 client_->WaitForResponse();
2688 // TODO(fayang): Fix this test to work with stateless rejects. 2688 // TODO(fayang): Fix this test to work with stateless rejects.
2689 if (!BothSidesSupportStatelessRejects()) { 2689 if (!BothSidesSupportStatelessRejects()) {
2690 VerifyCleanConnection(false); 2690 VerifyCleanConnection(false);
2691 } 2691 }
2692 } 2692 }
2693 2693
2694 } // namespace 2694 } // namespace
2695 } // namespace test 2695 } // namespace test
2696 } // namespace net 2696 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698