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

Unified Diff: net/quic/quic_stream_factory_test.cc

Issue 186293002: Disable QUIC port selection when the server is going away. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_stream_factory.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_stream_factory_test.cc
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc
index c2ba455fff2aa6309ed9a36343c5ac73c25b3460..b6de4179df17d10ac1bd8ac2d163e5348525ed75 100644
--- a/net/quic/quic_stream_factory_test.cc
+++ b/net/quic/quic_stream_factory_test.cc
@@ -91,6 +91,16 @@ class QuicStreamFactoryTest : public ::testing::TestWithParam<QuicVersion> {
int GetSourcePortForNewSession(const HostPortProxyPair& destination) {
+ return GetSourcePortForNewSessionInner(destination, false);
+ }
+
+ int GetSourcePortForNewSessionAndGoAway(
+ const HostPortProxyPair& destination) {
+ return GetSourcePortForNewSessionInner(destination, true);
+ }
+
+ int GetSourcePortForNewSessionInner(const HostPortProxyPair& destination,
+ bool goaway_received) {
// Should only be called if there is no active session for this destination.
EXPECT_EQ(NULL, factory_.CreateIfSessionExists(destination,
net_log_).get());
@@ -129,6 +139,10 @@ class QuicStreamFactoryTest : public ::testing::TestWithParam<QuicVersion> {
socket_factory_.
udp_client_sockets()[socket_count]->GetLocalAddress(&endpoint);
int port = endpoint.port();
+ if (goaway_received) {
+ QuicGoAwayFrame goaway(QUIC_NO_ERROR, 1, "");
+ session->OnGoAway(goaway);
+ }
factory_.OnSessionClosed(session);
EXPECT_EQ(NULL, factory_.CreateIfSessionExists(destination,
@@ -676,6 +690,16 @@ TEST_P(QuicStreamFactoryTest, CreateConsistentEphemeralPort) {
EXPECT_EQ(original_port, GetSourcePortForNewSession(host_port_proxy_pair_));
}
+TEST_P(QuicStreamFactoryTest, GoAwayDisablesConsistentEphemeralPort) {
+ // Get a session to the host using the port suggester.
+ int original_port =
+ GetSourcePortForNewSessionAndGoAway(host_port_proxy_pair_);
+ // Verify that the port is different after the goaway.
+ EXPECT_NE(original_port, GetSourcePortForNewSession(host_port_proxy_pair_));
+ // Since the previous session did not goaway we should see the original port.
+ EXPECT_EQ(original_port, GetSourcePortForNewSession(host_port_proxy_pair_));
+}
+
TEST_P(QuicStreamFactoryTest, CloseAllSessions) {
MockRead reads[] = {
MockRead(ASYNC, 0, 0) // EOF
« no previous file with comments | « net/quic/quic_stream_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698