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

Unified Diff: net/spdy/spdy_framer_test.cc

Issue 12262004: Remove SpdyRstStreamControlFrame struct. Useful for SPDY 4 development. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/spdy/spdy_framer.cc ('k') | net/spdy/spdy_protocol.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_framer_test.cc
diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
index ceea1d389f5bd8bdbca8d523817c6a0fcd416ba7..7abdf97aaec28430352fbdc9001090b8593961ba 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[] = {
« no previous file with comments | « net/spdy/spdy_framer.cc ('k') | net/spdy/spdy_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698