summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_framer_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/spdy/spdy_framer_test.cc')
-rw-r--r--net/spdy/spdy_framer_test.cc37
1 files changed, 36 insertions, 1 deletions
diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
index ceea1d3..7abdf97 100644
--- a/net/spdy/spdy_framer_test.cc
+++ b/net/spdy/spdy_framer_test.cc
@@ -2015,7 +2015,7 @@ TEST_P(SpdyFramerTest, CreateRstStream) {
0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x01,
};
- scoped_ptr<SpdyRstStreamControlFrame> frame(
+ scoped_ptr<SpdyFrame> frame(
framer.CreateRstStream(1, RST_STREAM_PROTOCOL_ERROR));
CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData));
}
@@ -3559,6 +3559,41 @@ TEST_P(SpdyFramerTest, SettingsFlagsAndId) {
EXPECT_EQ(kWireFormat, id_and_flags.GetWireFormat(spdy_version_));
}
+// Test handling of a RST_STREAM with out-of-bounds status codes.
+TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
+ DCHECK_GE(0xff, RST_STREAM_NUM_STATUS_CODES);
+
+ const unsigned char kRstStreamInvalid[] = {
+ 0x80, spdy_version_, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x08,
+ 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, RST_STREAM_INVALID
+ };
+
+ const unsigned char kRstStreamNumStatusCodes[] = {
+ 0x80, spdy_version_, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x08,
+ 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, RST_STREAM_NUM_STATUS_CODES
+ };
+
+ testing::StrictMock<net::test::MockVisitor> visitor;
+ SpdyFramer framer(spdy_version_);
+ framer.set_visitor(&visitor);
+
+ EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_INVALID));
+ framer.ProcessInput(reinterpret_cast<const char*>(kRstStreamInvalid),
+ arraysize(kRstStreamInvalid));
+ EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state());
+ EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code());
+
+ EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_INVALID));
+ framer.ProcessInput(reinterpret_cast<const char*>(kRstStreamNumStatusCodes),
+ arraysize(kRstStreamNumStatusCodes));
+ EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state());
+ EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code());
+}
+
// Tests handling of a GOAWAY frame with out-of-bounds stream ID.
TEST_P(SpdyFramerTest, GoAwayStreamIdBounds) {
const unsigned char kV2FrameData[] = {