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

Unified Diff: net/spdy/spdy_framer_test.cc

Issue 202033002: Update SPDY4 length field to exclude frame prefix length. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Related test update Created 6 years, 9 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_network_transaction_unittest.cc » ('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 739d8085f8cf8c0e600d2e11220d2847b5eb8d53..61ded3f43de16021c10157af6795b2230ec208dc 100644
--- a/net/spdy/spdy_framer_test.cc
+++ b/net/spdy/spdy_framer_test.cc
@@ -63,15 +63,9 @@ class SpdyFramerTestUtil {
char* buffer = visitor.ReleaseBuffer();
CHECK(buffer != NULL);
SpdyFrame* decompressed_frame = new SpdyFrame(buffer, visitor.size(), true);
- if (framer->protocol_version() == 4) {
- SetFrameLength(decompressed_frame,
- visitor.size(),
- framer->protocol_version());
- } else {
- SetFrameLength(decompressed_frame,
- visitor.size() - framer->GetControlFrameHeaderSize(),
- framer->protocol_version());
- }
+ SetFrameLength(decompressed_frame,
+ visitor.size() - framer->GetControlFrameHeaderSize(),
+ framer->protocol_version());
return decompressed_frame;
}
@@ -1053,43 +1047,43 @@ TEST_P(SpdyFramerTest, Basic) {
// SYN_STREAM doesn't exist in SPDY4, so instead we send
// HEADERS frames with PRIORITY and END_HEADERS set.
const unsigned char kV4Input[] = {
- 0x00, 0x0d, 0x08, 0x0c, // HEADERS: PRIORITY | END_HEADERS
+ 0x00, 0x05, 0x08, 0x0c, // HEADERS: PRIORITY | END_HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x00, 0x00, 0x00, 0x00, // Priority 0
0x82, // :method: GET
- 0x00, 0x09, 0x08, 0x04, // HEADERS: END_HEADERS
+ 0x00, 0x01, 0x08, 0x04, // HEADERS: END_HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x8c, // :status: 200
- 0x00, 0x14, 0x00, 0x00, // DATA on Stream #1
+ 0x00, 0x0c, 0x00, 0x00, // DATA on Stream #1
0x00, 0x00, 0x00, 0x01,
0xde, 0xad, 0xbe, 0xef,
0xde, 0xad, 0xbe, 0xef,
0xde, 0xad, 0xbe, 0xef,
- 0x00, 0x0d, 0x08, 0x0c, // HEADERS: PRIORITY | END_HEADERS
+ 0x00, 0x05, 0x08, 0x0c, // HEADERS: PRIORITY | END_HEADERS
0x00, 0x00, 0x00, 0x03, // Stream 3
0x00, 0x00, 0x00, 0x00, // Priority 0
0x82, // :method: GET
- 0x00, 0x10, 0x00, 0x00, // DATA on Stream #3
+ 0x00, 0x08, 0x00, 0x00, // DATA on Stream #3
0x00, 0x00, 0x00, 0x03,
0xde, 0xad, 0xbe, 0xef,
0xde, 0xad, 0xbe, 0xef,
- 0x00, 0x0c, 0x00, 0x00, // DATA on Stream #1
+ 0x00, 0x04, 0x00, 0x00, // DATA on Stream #1
0x00, 0x00, 0x00, 0x01,
0xde, 0xad, 0xbe, 0xef,
- 0x00, 0x0c, 0x03, 0x00, // RST_STREAM on Stream #1
+ 0x00, 0x04, 0x03, 0x00, // RST_STREAM on Stream #1
0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x00, 0x00, // DATA on Stream #3
+ 0x00, 0x00, 0x00, 0x00, // DATA on Stream #3
0x00, 0x00, 0x00, 0x03,
- 0x00, 0x17, 0x03, 0x00, // RST_STREAM on Stream #3
+ 0x00, 0x0f, 0x03, 0x00, // RST_STREAM on Stream #3
0x00, 0x00, 0x00, 0x03,
0x00, 0x00, 0x00, 0x00,
0x52, 0x45, 0x53, 0x45, // opaque data
@@ -1188,22 +1182,22 @@ TEST_P(SpdyFramerTest, FinOnDataFrame) {
// SYN_STREAM and SYN_REPLY don't exist in SPDY4, so instead we send
// HEADERS frames with PRIORITY(SYN_STREAM only) and END_HEADERS set.
const unsigned char kV4Input[] = {
- 0x00, 0x0d, 0x08, 0x0c, // HEADERS: PRIORITY | END_HEADERS
+ 0x00, 0x05, 0x08, 0x0c, // HEADERS: PRIORITY | END_HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x00, 0x00, 0x00, 0x00, // Priority 0
0x82, // :method: GET
- 0x00, 0x09, 0x08, 0x04, // HEADERS: END_HEADERS
+ 0x00, 0x01, 0x08, 0x04, // HEADERS: END_HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x8c, // :status: 200
- 0x00, 0x14, 0x00, 0x00, // DATA on Stream #1
+ 0x00, 0x0c, 0x00, 0x00, // DATA on Stream #1
0x00, 0x00, 0x00, 0x01,
0xde, 0xad, 0xbe, 0xef,
0xde, 0xad, 0xbe, 0xef,
0xde, 0xad, 0xbe, 0xef,
- 0x00, 0x0c, 0x00, 0x01, // DATA on Stream #1, with FIN
+ 0x00, 0x04, 0x00, 0x01, // DATA on Stream #1, with FIN
0x00, 0x00, 0x00, 0x01,
0xde, 0xad, 0xbe, 0xef,
};
@@ -1274,12 +1268,12 @@ TEST_P(SpdyFramerTest, FinOnSynReplyFrame) {
// SYN_STREAM and SYN_REPLY don't exist in SPDY4, so instead we send
// HEADERS frames with PRIORITY(SYN_STREAM only) and END_HEADERS set.
const unsigned char kV4Input[] = {
- 0x00, 0x0d, 0x08, 0x0c, // HEADERS: PRIORITY | END_HEADERS
+ 0x00, 0x05, 0x08, 0x0c, // HEADERS: PRIORITY | END_HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x00, 0x00, 0x00, 0x00, // Priority 0
0x82, // :method: GET
- 0x00, 0x09, 0x08, 0x05, // HEADERS: FIN | END_HEADERS
+ 0x00, 0x01, 0x08, 0x05, // HEADERS: FIN | END_HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x8c, // :status: 200
};
@@ -1482,15 +1476,15 @@ TEST_P(SpdyFramerTest, WindowUpdateFrame) {
0x12, 0x34, 0x56, 0x78
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0c, 0x09, 0x00,
+ 0x00, 0x04, 0x09, 0x00,
0x00, 0x00, 0x00, 0x01,
0x12, 0x34, 0x56, 0x78
};
if (IsSpdy4()) {
- CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
+ CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
} else {
- CompareFrame(kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
+ CompareFrame(kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
}
}
@@ -1506,7 +1500,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
'o'
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0d, 0x00, 0x00,
+ 0x00, 0x05, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
'h', 'e', 'l', 'l',
'o'
@@ -1544,7 +1538,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x15, 0x00, 0x10, // Length = 13. PAD_LOW set.
+ 0x00, 0x0d, 0x00, 0x10, // Length = 13. PAD_LOW set.
0x00, 0x00, 0x00, 0x01,
0x07, // Pad Low field.
'h', 'e', 'l', 'l', // Data
@@ -1575,7 +1569,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
0xff
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x09, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0xff
};
@@ -1599,7 +1593,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
'o'
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0d, 0x00, 0x01,
+ 0x00, 0x05, 0x00, 0x01,
0x00, 0x00, 0x00, 0x01,
'h', 'e', 'l', 'l',
'o'
@@ -1623,7 +1617,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
0x00, 0x00, 0x00, 0x00,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
};
net::SpdyDataIR data_ir(1, StringPiece());
@@ -1646,7 +1640,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
'o'
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0d, 0x00, 0x01,
+ 0x00, 0x05, 0x00, 0x01,
0x7f, 0xff, 0xff, 0xff,
'h', 'e', 'l', 'l',
'o'
@@ -1723,7 +1717,7 @@ TEST_P(SpdyFramerTest, CreateSynStreamUncompressed) {
'a', 'r'
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x1e, 0x08, 0x0c, // HEADERS: PRIORITY | END_HEADERS
+ 0x00, 0x16, 0x08, 0x0c, // HEADERS: PRIORITY | END_HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x00, 0x00, 0x00, 0x07, // Priority 7
0x40, 0x03, 0x62, 0x61, // @.ba
@@ -1778,7 +1772,7 @@ TEST_P(SpdyFramerTest, CreateSynStreamUncompressed) {
'b', 'a', 'r'
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x1b, 0x08, 0x0d, // HEADERS: PRIORITY | FIN | END_HEADERS
+ 0x00, 0x13, 0x08, 0x0d, // HEADERS: PRIORITY | FIN | END_HEADERS
0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
0x00, 0x00, 0x00, 0x00, // Priority 0
0x40, 0x00, 0x03, 0x66, // @..f
@@ -1835,7 +1829,7 @@ TEST_P(SpdyFramerTest, CreateSynStreamUncompressed) {
0x00, 0x00, 0x00
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x1b, 0x08, 0x0d, // HEADERS: PRIORITY | FIN | END_HEADERS
+ 0x00, 0x13, 0x08, 0x0d, // HEADERS: PRIORITY | FIN | END_HEADERS
0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
0x00, 0x00, 0x00, 0x01, // Priority 1
0x40, 0x03, 0x62, 0x61, // @.ba
@@ -1956,7 +1950,7 @@ TEST_P(SpdyFramerTest, CreateSynReplyUncompressed) {
0x03, 'b', 'a', 'r'
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x1a, 0x08, 0x04, // HEADER: END_HEADERS
+ 0x00, 0x12, 0x08, 0x04, // HEADER: END_HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x40, 0x03, 0x62, 0x61, // @.ba
0x72, 0x03, 0x66, 0x6f, // r.fo
@@ -2006,7 +2000,7 @@ TEST_P(SpdyFramerTest, CreateSynReplyUncompressed) {
'r'
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x17, 0x08, 0x05, // HEADER: FIN | END_HEADERS
+ 0x00, 0x0f, 0x08, 0x05, // HEADER: FIN | END_HEADERS
0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
0x40, 0x00, 0x03, 0x66, // @..f
0x6f, 0x6f, 0x40, 0x03, // oo@.
@@ -2056,7 +2050,7 @@ TEST_P(SpdyFramerTest, CreateSynReplyUncompressed) {
0x00
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x17, 0x08, 0x05, // HEADER: FIN | END_HEADERS
+ 0x00, 0x0f, 0x08, 0x05, // HEADER: FIN | END_HEADERS
0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
0x40, 0x03, 0x62, 0x61, // @.ba
0x72, 0x03, 0x66, 0x6f, // r.fo
@@ -2149,7 +2143,7 @@ TEST_P(SpdyFramerTest, CreateRstStream) {
0x00, 0x00, 0x00, 0x01,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0f, 0x03, 0x00,
+ 0x00, 0x07, 0x03, 0x00,
0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x01,
0x52, 0x53, 0x54
@@ -2172,7 +2166,7 @@ TEST_P(SpdyFramerTest, CreateRstStream) {
0x00, 0x00, 0x00, 0x01,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0c, 0x03, 0x00,
+ 0x00, 0x04, 0x03, 0x00,
0x7f, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x01,
};
@@ -2196,7 +2190,7 @@ TEST_P(SpdyFramerTest, CreateRstStream) {
0x00, 0x00, 0x00, 0x06,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0c, 0x03, 0x00,
+ 0x00, 0x04, 0x03, 0x00,
0x7f, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x06,
};
@@ -2233,7 +2227,7 @@ TEST_P(SpdyFramerTest, CreateSettings) {
0x0a, 0x0b, 0x0c, 0x0d,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0d, 0x04, 0x00,
+ 0x00, 0x05, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00,
0x01, 0x0a, 0x0b, 0x0c,
0x0d,
@@ -2293,7 +2287,7 @@ TEST_P(SpdyFramerTest, CreateSettings) {
0xff, 0x00, 0x00, 0x04,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x1c, 0x04, 0x00,
+ 0x00, 0x14, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00,
0x01, // 1st Setting
0x00, 0x00, 0x00, 0x01,
@@ -2341,7 +2335,7 @@ TEST_P(SpdyFramerTest, CreateSettings) {
0x00, 0x00, 0x00, 0x00,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x08, 0x04, 0x00,
+ 0x00, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00,
};
SpdySettingsIR settings_ir;
@@ -2365,13 +2359,13 @@ TEST_P(SpdyFramerTest, CreatePingFrame) {
0x12, 0x34, 0x56, 0x78,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x10, 0x06, 0x00,
+ 0x00, 0x08, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00,
0x12, 0x34, 0x56, 0x78,
0x9a, 0xbc, 0xde, 0xff,
};
const unsigned char kV4FrameDataWithAck[] = {
- 0x00, 0x10, 0x06, 0x01,
+ 0x00, 0x08, 0x06, 0x01,
0x00, 0x00, 0x00, 0x00,
0x12, 0x34, 0x56, 0x78,
0x9a, 0xbc, 0xde, 0xff,
@@ -2415,7 +2409,7 @@ TEST_P(SpdyFramerTest, CreateGoAway) {
0x00, 0x00, 0x00, 0x00, // Status
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x12, 0x07, 0x00,
+ 0x00, 0x0a, 0x07, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, // Stream id
0x00, 0x00, 0x00, 0x00, // Status
@@ -2446,7 +2440,7 @@ TEST_P(SpdyFramerTest, CreateGoAway) {
0x00, 0x00, 0x00, 0x02, // Status
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x12, 0x07, 0x00,
+ 0x00, 0x0a, 0x07, 0x00,
0x00, 0x00, 0x00, 0x00,
0x7f, 0xff, 0xff, 0xff, // Stream Id
0x00, 0x00, 0x00, 0x02, // Status
@@ -2496,7 +2490,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
0x03, 'b', 'a', 'r'
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x1a, 0x08, 0x04, // Headers: END_HEADERS
+ 0x00, 0x12, 0x08, 0x04, // Headers: END_HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x40, 0x03, 0x62, 0x61, // @.ba
0x72, 0x03, 0x66, 0x6f, // r.fo
@@ -2546,7 +2540,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
'r'
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x17, 0x08, 0x05, // HEADER: FIN | END_HEADERS
+ 0x00, 0x0f, 0x08, 0x05, // HEADER: FIN | END_HEADERS
0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
0x40, 0x00, 0x03, 0x66, // @..f
0x6f, 0x6f, 0x40, 0x03, // oo@.
@@ -2596,7 +2590,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
0x00
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x17, 0x08, 0x05, // HEADER: FIN | END_HEADERS
+ 0x00, 0x0f, 0x08, 0x05, // HEADER: FIN | END_HEADERS
0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
0x40, 0x03, 0x62, 0x61, // @.ba
0x72, 0x03, 0x66, 0x6f, // r.fo
@@ -2689,7 +2683,7 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
0x00, 0x00, 0x00, 0x01,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0c, 0x09, 0x00,
+ 0x00, 0x04, 0x09, 0x00,
0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x01,
};
@@ -2711,7 +2705,7 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
0x00, 0x00, 0x00, 0x01,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0c, 0x09, 0x00,
+ 0x00, 0x04, 0x09, 0x00,
0x7f, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x01,
};
@@ -2733,7 +2727,7 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
0x7f, 0xff, 0xff, 0xff,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0c, 0x09, 0x00,
+ 0x00, 0x04, 0x09, 0x00,
0x00, 0x00, 0x00, 0x01,
0x7f, 0xff, 0xff, 0xff,
};
@@ -2756,7 +2750,7 @@ TEST_P(SpdyFramerTest, SerializeBlocked) {
const char kDescription[] = "BLOCKED frame";
const unsigned char kFrameData[] = {
- 0x00, 0x08, 0x0b, 0x00,
+ 0x00, 0x00, 0x0b, 0x00,
0x00, 0x00, 0x00, 0x00,
};
SpdyBlockedIR blocked_ir(0);
@@ -2793,7 +2787,7 @@ TEST_P(SpdyFramerTest, CreatePushPromise) {
const char kDescription[] = "PUSH_PROMISE frame";
const unsigned char kFrameData[] = {
- 0x00, 0x1e, 0x0c, 0x04, // PUSH_PROMISE: END_HEADERS
+ 0x00, 0x16, 0x0c, 0x04, // PUSH_PROMISE: END_HEADERS
0x00, 0x00, 0x00, 0x2a, // Stream 42
0x00, 0x00, 0x00, 0x39, // Promised stream 57
0x40, 0x03, 0x62, 0x61, // @.ba
@@ -3060,7 +3054,8 @@ TEST_P(SpdyFramerTest, ControlFrameSizesAreValidated) {
// SPDY version 4 and up GOAWAY frames are only bound to a minimal length,
// since it may carry opaque data. Verify that minimal length is tested.
- const unsigned char less_than_min_length = framer.GetGoAwayMinimumSize() - 1;
+ const unsigned char less_than_min_length =
+ framer.GetGoAwayMinimumSize() - framer.GetControlFrameHeaderSize() - 1;
const unsigned char kV4FrameData[] = {
0x00, static_cast<uint8>(less_than_min_length), 0x07, 0x00,
0x00, 0x00, 0x00, 0x00,
@@ -3099,8 +3094,13 @@ TEST_P(SpdyFramerTest, ReadZeroLenSettingsFrame) {
visitor.SimulateInFramer(
reinterpret_cast<unsigned char*>(control_frame->data()),
framer.GetControlFrameHeaderSize());
- // Should generate an error, since zero-len settings frames are unsupported.
- EXPECT_EQ(1, visitor.error_count_);
+ if (spdy_version_ < 4) {
+ // Should generate an error, since zero-len settings frames are unsupported.
+ EXPECT_EQ(1, visitor.error_count_);
+ } else {
+ // Zero-len settings frames are permitted as of SPDY 4.
+ EXPECT_EQ(0, visitor.error_count_);
+ }
}
// Tests handling of SETTINGS frames with invalid length.
@@ -3213,7 +3213,7 @@ TEST_P(SpdyFramerTest, ReadDuplicateSettings) {
0x00, 0x00, 0x00, 0x03,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x17, 0x04, 0x00,
+ 0x00, 0x0f, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00,
0x01, // 1st Setting
0x00, 0x00, 0x00, 0x02,
@@ -3272,7 +3272,7 @@ TEST_P(SpdyFramerTest, ReadOutOfOrderSettings) {
0x00, 0x00, 0x00, 0x03,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x17, 0x04, 0x00,
+ 0x00, 0x0f, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00,
0x02, // 1st Setting
0x00, 0x00, 0x00, 0x02,
@@ -3310,7 +3310,7 @@ TEST_P(SpdyFramerTest, ProcessSettingsAckFrame) {
SpdyFramer framer(spdy_version_);
const unsigned char kFrameData[] = {
- 0x00, 0x08, 0x04, 0x01,
+ 0x00, 0x00, 0x04, 0x01,
0x00, 0x00, 0x00, 0x00,
};
@@ -3480,7 +3480,7 @@ TEST_P(SpdyFramerTest, CreateContinuation) {
const char kDescription[] = "CONTINUATION frame";
const unsigned char kFrameData[] = {
- 0x00, 0x1a, 0x0d, 0x00, // CONTINUATION
+ 0x00, 0x12, 0x0d, 0x00, // CONTINUATION
0x00, 0x00, 0x00, 0x2a, // Stream 42
0x40, 0x03, 0x62, 0x61, // @.ba
0x72, 0x03, 0x66, 0x6f, // r.fo
@@ -3526,14 +3526,14 @@ TEST_P(SpdyFramerTest, ReadHeadersWithContinuation) {
}
const unsigned char kInput[] = {
- 0x00, 0x18, 0x08, 0x00, // HEADERS
+ 0x00, 0x10, 0x08, 0x00, // HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x40, 0x06, 0x43, 0x6f,
0x6f, 0x6b, 0x69, 0x65,
0x07, 0x66, 0x6f, 0x6f,
0x3d, 0x62, 0x61, 0x72,
- 0x00, 0x1c, 0x0D, 0x00, // CONTINUATION
+ 0x00, 0x14, 0x0D, 0x00, // CONTINUATION
0x00, 0x00, 0x00, 0x01, // Stream 1
0x40, 0x06, 0x43, 0x6f,
0x6f, 0x6b, 0x69, 0x65,
@@ -3541,7 +3541,7 @@ TEST_P(SpdyFramerTest, ReadHeadersWithContinuation) {
0x3d, 0x62, 0x69, 0x6e,
0x67, 0x40, 0x06, 0x43,
- 0x00, 0x1a, 0x0D, 0x04, // CONTINUATION: END_HEADERS
+ 0x00, 0x12, 0x0D, 0x04, // CONTINUATION: END_HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x6f, 0x6f, 0x6b, 0x69,
0x65, 0x00, 0x40, 0x04,
@@ -3571,14 +3571,14 @@ TEST_P(SpdyFramerTest, ReadHeadersWithContinuationAndFin) {
}
const unsigned char kInput[] = {
- 0x00, 0x18, 0x08, 0x01, // HEADERS: FIN
+ 0x00, 0x10, 0x08, 0x01, // HEADERS: FIN
0x00, 0x00, 0x00, 0x01, // Stream 1
0x40, 0x06, 0x43, 0x6f,
0x6f, 0x6b, 0x69, 0x65,
0x07, 0x66, 0x6f, 0x6f,
0x3d, 0x62, 0x61, 0x72,
- 0x00, 0x1c, 0x0D, 0x00, // CONTINUATION
+ 0x00, 0x14, 0x0D, 0x00, // CONTINUATION
0x00, 0x00, 0x00, 0x01, // Stream 1
0x40, 0x06, 0x43, 0x6f,
0x6f, 0x6b, 0x69, 0x65,
@@ -3586,7 +3586,7 @@ TEST_P(SpdyFramerTest, ReadHeadersWithContinuationAndFin) {
0x3d, 0x62, 0x69, 0x6e,
0x67, 0x40, 0x06, 0x43,
- 0x00, 0x1a, 0x0D, 0x04, // CONTINUATION: END_HEADERS
+ 0x00, 0x12, 0x0D, 0x04, // CONTINUATION: END_HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x6f, 0x6f, 0x6b, 0x69,
0x65, 0x00, 0x40, 0x04,
@@ -3617,7 +3617,7 @@ TEST_P(SpdyFramerTest, ReadPushPromiseWithContinuation) {
}
const unsigned char kInput[] = {
- 0x00, 0x1c, 0x0C, 0x00, // PUSH_PROMISE
+ 0x00, 0x14, 0x0C, 0x00, // PUSH_PROMISE
0x00, 0x00, 0x00, 0x01, // Stream 1
0x00, 0x00, 0x00, 0x2A, // Promised stream 42
0x40, 0x06, 0x43, 0x6f,
@@ -3625,7 +3625,7 @@ TEST_P(SpdyFramerTest, ReadPushPromiseWithContinuation) {
0x07, 0x66, 0x6f, 0x6f,
0x3d, 0x62, 0x61, 0x72,
- 0x00, 0x1c, 0x0D, 0x00, // CONTINUATION
+ 0x00, 0x14, 0x0D, 0x00, // CONTINUATION
0x00, 0x00, 0x00, 0x01, // Stream 1
0x40, 0x06, 0x43, 0x6f,
0x6f, 0x6b, 0x69, 0x65,
@@ -3633,7 +3633,7 @@ TEST_P(SpdyFramerTest, ReadPushPromiseWithContinuation) {
0x3d, 0x62, 0x69, 0x6e,
0x67, 0x40, 0x06, 0x43,
- 0x00, 0x1a, 0x0D, 0x04, // CONTINUATION: END_HEADERS
+ 0x00, 0x12, 0x0D, 0x04, // CONTINUATION: END_HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x6f, 0x6f, 0x6b, 0x69,
0x65, 0x00, 0x40, 0x04,
@@ -3664,14 +3664,14 @@ TEST_P(SpdyFramerTest, ReadContinuationWithWrongStreamId) {
}
const unsigned char kInput[] = {
- 0x00, 0x18, 0x08, 0x00, // HEADERS
+ 0x00, 0x10, 0x08, 0x00, // HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x40, 0x06, 0x43, 0x6f,
0x6f, 0x6b, 0x69, 0x65,
0x07, 0x66, 0x6f, 0x6f,
0x3d, 0x62, 0x61, 0x72,
- 0x00, 0x1c, 0x0D, 0x00, // CONTINUATION
+ 0x00, 0x14, 0x0D, 0x00, // CONTINUATION
0x00, 0x00, 0x00, 0x02, // Stream 2
0x40, 0x06, 0x43, 0x6f,
0x6f, 0x6b, 0x69, 0x65,
@@ -3700,7 +3700,7 @@ TEST_P(SpdyFramerTest, ReadContinuationOutOfOrder) {
}
const unsigned char kInput[] = {
- 0x00, 0x18, 0x0D, 0x00, // CONTINUATION
+ 0x00, 0x10, 0x0D, 0x00, // CONTINUATION
0x00, 0x00, 0x00, 0x01, // Stream 1
0x40, 0x06, 0x43, 0x6f,
0x6f, 0x6b, 0x69, 0x65,
@@ -3727,7 +3727,7 @@ TEST_P(SpdyFramerTest, ExpectContinuationReceiveData) {
}
const unsigned char kInput[] = {
- 0x00, 0x18, 0x08, 0x00, // HEADERS
+ 0x00, 0x10, 0x08, 0x00, // HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x40, 0x06, 0x43, 0x6f,
0x6f, 0x6b, 0x69, 0x65,
@@ -3760,14 +3760,14 @@ TEST_P(SpdyFramerTest, ExpectContinuationReceiveControlFrame) {
}
const unsigned char kInput[] = {
- 0x00, 0x18, 0x08, 0x00, // HEADERS
+ 0x00, 0x10, 0x08, 0x00, // HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x40, 0x06, 0x43, 0x6f,
0x6f, 0x6b, 0x69, 0x65,
0x07, 0x66, 0x6f, 0x6f,
0x3d, 0x62, 0x61, 0x72,
- 0x00, 0x1c, 0x08, 0x00, // HEADERS
+ 0x00, 0x14, 0x08, 0x00, // HEADERS
0x00, 0x00, 0x00, 0x01, // Stream 1
0x40, 0x06, 0x43, 0x6f, // (Note this is a valid continued encoding).
0x6f, 0x6b, 0x69, 0x65,
@@ -3801,6 +3801,23 @@ TEST_P(SpdyFramerTest, ReadGarbage) {
EXPECT_EQ(1, visitor.error_count_);
}
+TEST_P(SpdyFramerTest, ReadGarbageWithValidLength) {
+ if (!IsSpdy4()) {
+ return;
+ }
+ SpdyFramer framer(spdy_version_);
+ const unsigned char kFrameData[] = {
+ 0x00, 0x10, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ };
+ TestSpdyVisitor visitor(spdy_version_);
+ visitor.use_compression_ = false;
+ visitor.SimulateInFramer(kFrameData, arraysize(kFrameData));
+ EXPECT_EQ(1, visitor.error_count_);
+}
+
TEST_P(SpdyFramerTest, ReadGarbageWithValidVersion) {
if (IsSpdy4()) {
// Not valid for SPDY 4 since there is no version field.
@@ -4592,17 +4609,10 @@ TEST_P(SpdyFramerTest, EmptySynStream) {
syn_stream.set_priority(1);
scoped_ptr<SpdyFrame> frame(framer.SerializeSynStream(syn_stream));
// Adjust size to remove the name/value block.
- if (IsSpdy4()) {
- SetFrameLength(
- frame.get(),
- framer.GetSynStreamMinimumSize(),
- spdy_version_);
- } else {
- SetFrameLength(
- frame.get(),
- framer.GetSynStreamMinimumSize() - framer.GetControlFrameHeaderSize(),
- spdy_version_);
- }
+ SetFrameLength(
+ frame.get(),
+ framer.GetSynStreamMinimumSize() - framer.GetControlFrameHeaderSize(),
+ spdy_version_);
EXPECT_CALL(debug_visitor, OnReceiveCompressedFrame(1, SYN_STREAM, _));
EXPECT_CALL(visitor, OnSynStream(1, 0, 1, false, false));
@@ -4637,7 +4647,7 @@ TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
0x00, 0x00, 0x00, RST_STREAM_INVALID
};
const unsigned char kV4RstStreamInvalid[] = {
- 0x00, 0x0c, 0x03, 0x00,
+ 0x00, 0x04, 0x03, 0x00,
0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, RST_STREAM_INVALID
};
@@ -4649,7 +4659,7 @@ TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
0x00, 0x00, 0x00, RST_STREAM_NUM_STATUS_CODES
};
const unsigned char kV4RstStreamNumStatusCodes[] = {
- 0x00, 0x0c, 0x03, 0x00,
+ 0x00, 0x04, 0x03, 0x00,
0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, RST_STREAM_NUM_STATUS_CODES
};
@@ -4699,7 +4709,7 @@ TEST_P(SpdyFramerTest, GoAwayStreamIdBounds) {
0x00, 0x00, 0x00, 0x00,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x10, 0x07, 0x00,
+ 0x00, 0x08, 0x07, 0x00,
0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00,
« no previous file with comments | « net/spdy/spdy_framer.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698