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

Unified Diff: net/quic/quic_headers_stream_test.cc

Issue 1572013002: relnote: QUIC header streams support to receive PUSH_PROMISE. Protected by --quic_supports_push_pr… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@14_CL_111507546
Patch Set: Created 4 years, 11 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/quic/quic_headers_stream.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_headers_stream_test.cc
diff --git a/net/quic/quic_headers_stream_test.cc b/net/quic/quic_headers_stream_test.cc
index 24066535349d4b8755742c03c162f1b6ebdc76c7..1f4d586b4050650ef60187aa7f4e394cf4a0286a 100644
--- a/net/quic/quic_headers_stream_test.cc
+++ b/net/quic/quic_headers_stream_test.cc
@@ -225,7 +225,7 @@ class QuicHeadersStreamTest : public ::testing::TestWithParam<TestParams> {
void CloseConnection() { QuicConnectionPeer::CloseConnection(connection_); }
- QuicStreamId NextPromisedStreamId() { return next_promised_stream_id_++; }
+ QuicStreamId NextPromisedStreamId() { return next_promised_stream_id_ += 2; }
static const bool kFrameComplete = true;
static const bool kHasPriority = true;
@@ -338,6 +338,83 @@ TEST_P(QuicHeadersStreamTest, ProcessRawData) {
}
}
+TEST_P(QuicHeadersStreamTest, ProcessPushPromise) {
+ FLAGS_quic_supports_push_promise = true;
+ for (QuicStreamId stream_id = kClientDataStreamId1;
+ stream_id < kClientDataStreamId3; stream_id += 2) {
+ QuicStreamId promised_stream_id = NextPromisedStreamId();
+ scoped_ptr<SpdySerializedFrame> frame;
+ SpdyPushPromiseIR push_promise(stream_id, promised_stream_id);
+ push_promise.set_header_block(headers_);
+ frame.reset(framer_.SerializeFrame(push_promise));
+ if (perspective() == Perspective::IS_SERVER) {
+ EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(
+ QUIC_INVALID_HEADERS_STREAM_DATA,
+ "PUSH_PROMISE not supported."))
+ .WillRepeatedly(
+ InvokeWithoutArgs(this, &QuicHeadersStreamTest::CloseConnection));
+ } else {
+ EXPECT_CALL(session_, OnPromiseHeaders(stream_id, _))
+ .WillRepeatedly(WithArgs<1>(
+ Invoke(this, &QuicHeadersStreamTest::SaveHeaderDataStringPiece)));
+ EXPECT_CALL(session_, OnPromiseHeadersComplete(
+ stream_id, promised_stream_id, frame->size()));
+ }
+ stream_frame_.frame_buffer = frame->data();
+ stream_frame_.frame_length = frame->size();
+ headers_stream_->OnStreamFrame(stream_frame_);
+ if (perspective() == Perspective::IS_CLIENT) {
+ stream_frame_.offset += frame->size();
+ CheckHeaders();
+ }
+ }
+}
+
+TEST_P(QuicHeadersStreamTest, PushPromiseOutOfOrder) {
+ FLAGS_quic_supports_push_promise = true;
+ if (perspective() == Perspective::IS_SERVER) {
+ return;
+ }
+
+ QuicStreamId promised_stream_id = NextPromisedStreamId();
+ QuicStreamId stream_id = kClientDataStreamId1;
+
+ scoped_ptr<SpdySerializedFrame> frame;
+ SpdyPushPromiseIR push_promise(stream_id, promised_stream_id);
+ push_promise.set_header_block(headers_);
+ frame.reset(framer_.SerializeFrame(push_promise));
+ EXPECT_CALL(session_, OnPromiseHeaders(stream_id, _))
+ .WillRepeatedly(WithArgs<1>(
+ Invoke(this, &QuicHeadersStreamTest::SaveHeaderDataStringPiece)));
+ EXPECT_CALL(session_, OnPromiseHeadersComplete(stream_id, promised_stream_id,
+ frame->size()));
+ stream_frame_.frame_buffer = frame->data();
+ stream_frame_.frame_length = frame->size();
+ headers_stream_->OnStreamFrame(stream_frame_);
+ if (perspective() == Perspective::IS_CLIENT) {
+ stream_frame_.offset += frame->size();
+ CheckHeaders();
+ }
+
+ stream_id += 2;
+ push_promise.set_stream_id(stream_id);
+ frame.reset(framer_.SerializeFrame(push_promise));
+ EXPECT_CALL(session_, OnPromiseHeaders(stream_id, _))
+ .WillRepeatedly(WithArgs<1>(
+ Invoke(this, &QuicHeadersStreamTest::SaveHeaderDataStringPiece)));
+ EXPECT_CALL(session_, OnPromiseHeadersComplete(stream_id, promised_stream_id,
+ frame->size()));
+ EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(
+ QUIC_INVALID_STREAM_ID,
+ "Received push stream id lesser or equal to the"
+ " last accepted before"))
+ .WillRepeatedly(
+ InvokeWithoutArgs(this, &QuicHeadersStreamTest::CloseConnection));
+ stream_frame_.frame_buffer = frame->data();
+ stream_frame_.frame_length = frame->size();
+ headers_stream_->OnStreamFrame(stream_frame_);
+}
+
TEST_P(QuicHeadersStreamTest, EmptyHeaderHOLBlockedTime) {
EXPECT_CALL(session_, OnHeadersHeadOfLineBlocking(_)).Times(0);
testing::InSequence seq;
« no previous file with comments | « net/quic/quic_headers_stream.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698