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

Unified Diff: net/spdy/spdy_framer_test.cc

Issue 286313002: Accept and ignore PRIORITY frames in SPDY4+. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 6ed219d0b2b081ed0911f939b489a9970fc4fe87..744f9e2ee6be918ccd58f99f50bbc1ca4306ea18 100644
--- a/net/spdy/spdy_framer_test.cc
+++ b/net/spdy/spdy_framer_test.cc
@@ -2905,7 +2905,7 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
}
TEST_P(SpdyFramerTest, SerializeBlocked) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
@@ -2924,7 +2924,7 @@ TEST_P(SpdyFramerTest, SerializeBlocked) {
}
TEST_P(SpdyFramerTest, CreateBlocked) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
@@ -2943,7 +2943,7 @@ TEST_P(SpdyFramerTest, CreateBlocked) {
}
TEST_P(SpdyFramerTest, CreatePushPromiseUncompressed) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
@@ -2971,7 +2971,7 @@ TEST_P(SpdyFramerTest, CreatePushPromiseUncompressed) {
}
TEST_P(SpdyFramerTest, CreateAltSvc) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
@@ -3167,7 +3167,7 @@ TEST_P(SpdyFramerTest, ControlFrameTooLarge) {
}
TEST_P(SpdyFramerTest, TooLargeHeadersFrameUsesContinuation) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
SpdyFramer framer(spdy_version_);
@@ -3195,7 +3195,7 @@ TEST_P(SpdyFramerTest, TooLargeHeadersFrameUsesContinuation) {
}
TEST_P(SpdyFramerTest, TooLargePushPromiseFrameUsesContinuation) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
SpdyFramer framer(spdy_version_);
@@ -3716,7 +3716,7 @@ TEST_P(SpdyFramerTest, ReadCredentialFrameFollowedByAnotherFrame) {
}
TEST_P(SpdyFramerTest, CreateContinuationUncompressed) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
@@ -4743,7 +4743,7 @@ TEST_P(SpdyFramerTest, WindowUpdateFrameFlags) {
}
TEST_P(SpdyFramerTest, PushPromiseFrameFlags) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
@@ -4789,7 +4789,7 @@ TEST_P(SpdyFramerTest, PushPromiseFrameFlags) {
}
TEST_P(SpdyFramerTest, ContinuationFrameFlags) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
@@ -4845,6 +4845,10 @@ TEST_P(SpdyFramerTest, ContinuationFrameFlags) {
}
}
+// TODO(mlavan): Add TEST_P(SpdyFramerTest, AltSvcFrameFlags)
+
+// TODO(hkhalil): Add TEST_P(SpdyFramerTest, BlockedFrameFlags)
+
TEST_P(SpdyFramerTest, EmptySynStream) {
testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
testing::StrictMock<test::MockDebugVisitor> debug_visitor;
@@ -4996,7 +5000,7 @@ TEST_P(SpdyFramerTest, GoAwayStreamIdBounds) {
}
TEST_P(SpdyFramerTest, OnBlocked) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
@@ -5018,7 +5022,7 @@ TEST_P(SpdyFramerTest, OnBlocked) {
}
TEST_P(SpdyFramerTest, OnAltSvc) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
@@ -5053,7 +5057,7 @@ TEST_P(SpdyFramerTest, OnAltSvc) {
}
TEST_P(SpdyFramerTest, OnAltSvcNoOrigin) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
@@ -5086,7 +5090,7 @@ TEST_P(SpdyFramerTest, OnAltSvcNoOrigin) {
}
TEST_P(SpdyFramerTest, OnAltSvcBadLengths) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
@@ -5185,7 +5189,7 @@ TEST_P(SpdyFramerTest, OnAltSvcBadLengths) {
// Tests handling of ALTSVC frames delivered in small chunks.
TEST_P(SpdyFramerTest, ReadChunkedAltSvcFrame) {
- if (spdy_version_ < SPDY4) {
+ if (spdy_version_ <= SPDY3) {
return;
}
SpdyFramer framer(spdy_version_);
@@ -5219,4 +5223,47 @@ TEST_P(SpdyFramerTest, ReadChunkedAltSvcFrame) {
EXPECT_EQ("hostname", visitor.test_altsvc_ir_.host());
}
+// Tests handling of PRIORITY frames.
+TEST_P(SpdyFramerTest, ReadPriority) {
+ if (spdy_version_ <= SPDY3) {
+ return;
+ }
+
+ const unsigned char kFrameData[] = {
+ 0x00, 0x05, 0x02, 0x00, // PRIORITY frame
+ 0x00, 0x00, 0x00, 0x03, // stream ID 3
+ 0x00, 0x00, 0x00, 0x01, // dependent on stream id 1
+ 0x00 // weight 0
+ };
+
+ TestSpdyVisitor visitor(spdy_version_);
+ visitor.SimulateInFramer(kFrameData, sizeof(kFrameData));
+
+ EXPECT_EQ(SpdyFramer::SPDY_RESET, visitor.framer_.state());
+ EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, visitor.framer_.error_code())
+ << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code());
+}
+
+// Tests handling of PRIORITY frame with incorrect size.
+TEST_P(SpdyFramerTest, ReadIncorrectlySizedPriority) {
+ if (spdy_version_ <= SPDY3) {
+ return;
+ }
+
+ // PRIORITY frame of size 4, which isn't correct.
+ const unsigned char kFrameData[] = {
+ 0x00, 0x04, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x01,
+ };
+
+ TestSpdyVisitor visitor(spdy_version_);
+ visitor.SimulateInFramer(kFrameData, sizeof(kFrameData));
+
+ EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state());
+ EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME,
+ visitor.framer_.error_code())
+ << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code());
+}
+
} // namespace net
« 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