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

Unified Diff: net/quic/quic_headers_stream_test.cc

Issue 2104633002: Landing recent QUIC changes until 6/24/2016 14:00 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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_packet_creator.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 9cd9e77530f16b6f5c97ca3f642942ca56423b81..2d0b7d8b2f5290403dc834e917b02e2030b9ff42 100644
--- a/net/quic/quic_headers_stream_test.cc
+++ b/net/quic/quic_headers_stream_test.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "base/strings/string_number_conversions.h"
#include "net/quic/quic_utils.h"
#include "net/quic/spdy_utils.h"
#include "net/quic/test_tools/quic_connection_peer.h"
@@ -44,6 +45,13 @@ class MockHpackDebugVisitor : public QuicHeadersStream::HpackDebugVisitor {
DISALLOW_COPY_AND_ASSIGN(MockHpackDebugVisitor);
};
+class QuicHeadersStreamPeer {
+ public:
+ static const SpdyFramer& GetSpdyFramer(QuicHeadersStream* stream) {
+ return stream->spdy_framer_;
+ }
+};
+
namespace {
// TODO(ckrasic): this workaround is due to absence of std::initializer_list
@@ -570,6 +578,7 @@ TEST_P(QuicHeadersStreamTest, ProcessSpdyRstStreamFrame) {
}
TEST_P(QuicHeadersStreamTest, ProcessSpdySettingsFrame) {
+ FLAGS_quic_respect_http2_settings_frame = false;
SpdySettingsIR data;
data.AddSetting(SETTINGS_HEADER_TABLE_SIZE, true, true, 0);
SpdySerializedFrame frame(framer_->SerializeFrame(data));
@@ -582,6 +591,66 @@ TEST_P(QuicHeadersStreamTest, ProcessSpdySettingsFrame) {
headers_stream_->OnStreamFrame(stream_frame_);
}
+TEST_P(QuicHeadersStreamTest, RespectHttp2SettingsFrameSupportedFields) {
+ FLAGS_quic_respect_http2_settings_frame = true;
+ const uint32_t kTestHeaderTableSize = 1000;
+ SpdySettingsIR data;
+ // Respect supported settings frames SETTINGS_HEADER_TABLE_SIZE.
+ data.AddSetting(SETTINGS_HEADER_TABLE_SIZE, true, true, kTestHeaderTableSize);
+ SpdySerializedFrame frame(framer_->SerializeFrame(data));
+ stream_frame_.data_buffer = frame.data();
+ stream_frame_.data_length = frame.size();
+ headers_stream_->OnStreamFrame(stream_frame_);
+ EXPECT_EQ(kTestHeaderTableSize,
+ QuicHeadersStreamPeer::GetSpdyFramer(headers_stream_)
+ .header_encoder_table_size());
+}
+
+TEST_P(QuicHeadersStreamTest, RespectHttp2SettingsFrameUnsupportedFields) {
+ FLAGS_quic_respect_http2_settings_frame = true;
+ SpdySettingsIR data;
+ // Does not support SETTINGS_MAX_HEADER_LIST_SIZE,
+ // SETTINGS_MAX_CONCURRENT_STREAMS, SETTINGS_INITIAL_WINDOW_SIZE,
+ // SETTINGS_ENABLE_PUSH and SETTINGS_MAX_FRAME_SIZE.
+ data.AddSetting(SETTINGS_MAX_HEADER_LIST_SIZE, true, true, 2000);
+ data.AddSetting(SETTINGS_MAX_CONCURRENT_STREAMS, true, true, 100);
+ data.AddSetting(SETTINGS_INITIAL_WINDOW_SIZE, true, true, 100);
+ data.AddSetting(SETTINGS_ENABLE_PUSH, true, true, 1);
+ data.AddSetting(SETTINGS_MAX_FRAME_SIZE, true, true, 1250);
+ SpdySerializedFrame frame(framer_->SerializeFrame(data));
+ EXPECT_CALL(
+ *connection_,
+ CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
+ "Unsupported field of HTTP/2 SETTINGS frame: " +
+ base::IntToString(SETTINGS_MAX_HEADER_LIST_SIZE),
+ _));
+ EXPECT_CALL(
+ *connection_,
+ CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
+ "Unsupported field of HTTP/2 SETTINGS frame: " +
+ base::IntToString(SETTINGS_MAX_CONCURRENT_STREAMS),
+ _));
+ EXPECT_CALL(
+ *connection_,
+ CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
+ "Unsupported field of HTTP/2 SETTINGS frame: " +
+ base::IntToString(SETTINGS_INITIAL_WINDOW_SIZE),
+ _));
+ EXPECT_CALL(*connection_,
+ CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
+ "Unsupported field of HTTP/2 SETTINGS frame: " +
+ base::IntToString(SETTINGS_ENABLE_PUSH),
+ _));
+ EXPECT_CALL(*connection_,
+ CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
+ "Unsupported field of HTTP/2 SETTINGS frame: " +
+ base::IntToString(SETTINGS_MAX_FRAME_SIZE),
+ _));
+ stream_frame_.data_buffer = frame.data();
+ stream_frame_.data_length = frame.size();
+ headers_stream_->OnStreamFrame(stream_frame_);
+}
+
TEST_P(QuicHeadersStreamTest, ProcessSpdyPingFrame) {
SpdyPingIR data(1);
SpdySerializedFrame frame(framer_->SerializeFrame(data));
« no previous file with comments | « net/quic/quic_headers_stream.cc ('k') | net/quic/quic_packet_creator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698