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

Unified Diff: net/quic/quic_session_test.cc

Issue 1548783002: Adding details to most quic connection close calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@110540464
Patch Set: Created 5 years 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_session.cc ('k') | net/quic/quic_spdy_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_session_test.cc
diff --git a/net/quic/quic_session_test.cc b/net/quic/quic_session_test.cc
index 9e4eea2871f0a986f2c4f75ad61960bd0ebac308..b7f55e0a5753ab91df926333b8328383fb46cf74 100644
--- a/net/quic/quic_session_test.cc
+++ b/net/quic/quic_session_test.cc
@@ -141,7 +141,8 @@ class TestSession : public QuicSpdySession {
TestStream* CreateIncomingDynamicStream(QuicStreamId id) override {
// Enforce the limit on the number of open streams.
if (GetNumOpenIncomingStreams() + 1 > get_max_open_streams()) {
- connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS);
+ connection()->SendConnectionCloseWithDetails(QUIC_TOO_MANY_OPEN_STREAMS,
+ "Too many streams!");
return nullptr;
} else {
return new TestStream(id, this);
@@ -341,7 +342,7 @@ TEST_P(QuicSessionTestServer, IsClosedStreamPeerCreated) {
TEST_P(QuicSessionTestServer, MaximumAvailableOpenedStreams) {
QuicStreamId stream_id = kClientDataStreamId1;
session_.GetOrCreateDynamicStream(stream_id);
- EXPECT_CALL(*connection_, SendConnectionClose(_)).Times(0);
+ EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(_, _)).Times(0);
EXPECT_NE(nullptr,
session_.GetOrCreateDynamicStream(
stream_id + 2 * (session_.get_max_open_streams() - 1)));
@@ -353,8 +354,8 @@ TEST_P(QuicSessionTestServer, TooManyAvailableStreams) {
EXPECT_NE(nullptr, session_.GetOrCreateDynamicStream(stream_id1));
// A stream ID which is too large to create.
stream_id2 = stream_id1 + 2 * session_.get_max_available_streams() + 4;
- EXPECT_CALL(*connection_,
- SendConnectionClose(QUIC_TOO_MANY_AVAILABLE_STREAMS));
+ EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(
+ QUIC_TOO_MANY_AVAILABLE_STREAMS, _));
EXPECT_EQ(nullptr, session_.GetOrCreateDynamicStream(stream_id2));
}
@@ -365,7 +366,7 @@ TEST_P(QuicSessionTestServer, ManyAvailableStreams) {
QuicStreamId stream_id = kClientDataStreamId1;
// Create one stream.
session_.GetOrCreateDynamicStream(stream_id);
- EXPECT_CALL(*connection_, SendConnectionClose(_)).Times(0);
+ EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(_, _)).Times(0);
// Create the largest stream ID of a threatened total of 200 streams.
session_.GetOrCreateDynamicStream(stream_id + 2 * (200 - 1));
}
@@ -737,8 +738,8 @@ TEST_P(QuicSessionTestServer, MultipleRstStreamsCauseSingleConnectionClose) {
// Process first invalid stream reset, resulting in the connection being
// closed.
- EXPECT_CALL(*connection_,
- SendConnectionClose(QUIC_TOO_MANY_AVAILABLE_STREAMS));
+ EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(
+ QUIC_TOO_MANY_AVAILABLE_STREAMS, _));
const QuicStreamId kLargeInvalidStreamId = 99999999;
QuicRstStreamFrame rst1(kLargeInvalidStreamId, QUIC_STREAM_NO_ERROR, 0);
@@ -1017,8 +1018,8 @@ TEST_P(QuicSessionTestServer, InvalidStreamFlowControlWindowInHandshake) {
QuicConfigPeer::SetReceivedInitialStreamFlowControlWindow(session_.config(),
kInvalidWindow);
- EXPECT_CALL(*connection_,
- SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW));
+ EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(
+ QUIC_FLOW_CONTROL_INVALID_WINDOW, _));
session_.OnConfigNegotiated();
}
@@ -1029,8 +1030,8 @@ TEST_P(QuicSessionTestServer, InvalidSessionFlowControlWindowInHandshake) {
QuicConfigPeer::SetReceivedInitialSessionFlowControlWindow(session_.config(),
kInvalidWindow);
- EXPECT_CALL(*connection_,
- SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW));
+ EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(
+ QUIC_FLOW_CONTROL_INVALID_WINDOW, _));
session_.OnConfigNegotiated();
}
@@ -1038,8 +1039,8 @@ TEST_P(QuicSessionTestServer, FlowControlWithInvalidFinalOffset) {
// Test that if we receive a stream RST with a highest byte offset that
// violates flow control, that we close the connection.
const uint64 kLargeOffset = kInitialSessionFlowControlWindowForTest + 1;
- EXPECT_CALL(*connection_,
- SendConnectionClose(QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA))
+ EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(
+ QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA, _))
.Times(2);
// Check that stream frame + FIN results in connection close.
@@ -1097,7 +1098,8 @@ TEST_P(QuicSessionTestServer, TooManyUnfinishedStreamsCauseServerRejectStream) {
}
if (GetParam() <= QUIC_VERSION_27) {
- EXPECT_CALL(*connection_, SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS));
+ EXPECT_CALL(*connection_,
+ SendConnectionCloseWithDetails(QUIC_TOO_MANY_OPEN_STREAMS, _));
EXPECT_CALL(*connection_, SendRstStream(kFinalStreamId, _, _)).Times(0);
} else {
EXPECT_CALL(*connection_,
@@ -1118,7 +1120,8 @@ TEST_P(QuicSessionTestServer, DrainingStreamsDoNotCountAsOpened) {
// it) does not count against the open quota (because it is closed from the
// protocol point of view).
if (GetParam() <= QUIC_VERSION_27) {
- EXPECT_CALL(*connection_, SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS))
+ EXPECT_CALL(*connection_,
+ SendConnectionCloseWithDetails(QUIC_TOO_MANY_OPEN_STREAMS, _))
.Times(0);
} else {
EXPECT_CALL(*connection_, SendRstStream(_, QUIC_REFUSED_STREAM, _))
« no previous file with comments | « net/quic/quic_session.cc ('k') | net/quic/quic_spdy_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698