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

Side by Side Diff: net/quic/core/quic_headers_stream_test.cc

Issue 2350173005: QUIC enable server push by default. Guarded by FLAGS_quic_enable_server_push_by_default. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_headers_stream.cc ('k') | net/quic/core/quic_server_session_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/core/quic_headers_stream.h" 5 #include "net/quic/core/quic_headers_stream.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "net/quic/core/quic_bug_tracker.h" 10 #include "net/quic/core/quic_bug_tracker.h"
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 stream_frame_.data_buffer = frame.data(); 523 stream_frame_.data_buffer = frame.data();
524 stream_frame_.data_length = frame.size(); 524 stream_frame_.data_length = frame.size();
525 headers_stream_->OnStreamFrame(stream_frame_); 525 headers_stream_->OnStreamFrame(stream_frame_);
526 if (perspective() == Perspective::IS_CLIENT) { 526 if (perspective() == Perspective::IS_CLIENT) {
527 stream_frame_.offset += frame.size(); 527 stream_frame_.offset += frame.size();
528 CheckHeaders(); 528 CheckHeaders();
529 } 529 }
530 } 530 }
531 } 531 }
532 532
533 TEST_P(QuicHeadersStreamTest, ProcessPushPromiseDisabledSetting) {
534 FLAGS_quic_respect_http2_settings_frame = true;
535 FLAGS_quic_enable_server_push_by_default = true;
536 session_.OnConfigNegotiated();
537 SpdySettingsIR data;
538 // Respect supported settings frames SETTINGS_ENABLE_PUSH.
539 data.AddSetting(SETTINGS_ENABLE_PUSH, true, true, 0);
540 SpdySerializedFrame frame(framer_->SerializeFrame(data));
541 stream_frame_.data_buffer = frame.data();
542 stream_frame_.data_length = frame.size();
543 if (perspective() == Perspective::IS_CLIENT) {
544 EXPECT_CALL(
545 *connection_,
546 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
547 "Unsupported field of HTTP/2 SETTINGS frame: 9", _));
548 }
549 headers_stream_->OnStreamFrame(stream_frame_);
550 EXPECT_EQ(
551 session_.server_push_enabled(),
552 (perspective() == Perspective::IS_CLIENT && version() > QUIC_VERSION_34));
553 }
554
533 TEST_P(QuicHeadersStreamTest, EmptyHeaderHOLBlockedTime) { 555 TEST_P(QuicHeadersStreamTest, EmptyHeaderHOLBlockedTime) {
534 EXPECT_CALL(session_, OnHeadersHeadOfLineBlocking(_)).Times(0); 556 EXPECT_CALL(session_, OnHeadersHeadOfLineBlocking(_)).Times(0);
535 testing::InSequence seq; 557 testing::InSequence seq;
536 bool fin = true; 558 bool fin = true;
537 for (int stream_num = 0; stream_num < 10; stream_num++) { 559 for (int stream_num = 0; stream_num < 10; stream_num++) {
538 QuicStreamId stream_id = QuicClientDataStreamId(stream_num); 560 QuicStreamId stream_id = QuicClientDataStreamId(stream_num);
539 // Replace with "WriteHeadersAndSaveData" 561 // Replace with "WriteHeadersAndSaveData"
540 SpdySerializedFrame frame; 562 SpdySerializedFrame frame;
541 if (perspective() == Perspective::IS_SERVER) { 563 if (perspective() == Perspective::IS_SERVER) {
542 SpdyHeadersIR headers_frame(stream_id, headers_.Clone()); 564 SpdyHeadersIR headers_frame(stream_id, headers_.Clone());
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA, 779 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
758 "Unsupported field of HTTP/2 SETTINGS frame: " + 780 "Unsupported field of HTTP/2 SETTINGS frame: " +
759 base::IntToString(SETTINGS_MAX_CONCURRENT_STREAMS), 781 base::IntToString(SETTINGS_MAX_CONCURRENT_STREAMS),
760 _)); 782 _));
761 EXPECT_CALL( 783 EXPECT_CALL(
762 *connection_, 784 *connection_,
763 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA, 785 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
764 "Unsupported field of HTTP/2 SETTINGS frame: " + 786 "Unsupported field of HTTP/2 SETTINGS frame: " +
765 base::IntToString(SETTINGS_INITIAL_WINDOW_SIZE), 787 base::IntToString(SETTINGS_INITIAL_WINDOW_SIZE),
766 _)); 788 _));
789 if (!FLAGS_quic_enable_server_push_by_default ||
790 session_.perspective() == Perspective::IS_CLIENT) {
791 EXPECT_CALL(*connection_,
792 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
793 "Unsupported field of HTTP/2 SETTINGS frame: " +
794 base::IntToString(SETTINGS_ENABLE_PUSH),
795 _));
796 }
767 EXPECT_CALL(*connection_, 797 EXPECT_CALL(*connection_,
768 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA, 798 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
769 "Unsupported field of HTTP/2 SETTINGS frame: " + 799 "Unsupported field of HTTP/2 SETTINGS frame: " +
770 base::IntToString(SETTINGS_ENABLE_PUSH),
771 _));
772 EXPECT_CALL(*connection_,
773 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
774 "Unsupported field of HTTP/2 SETTINGS frame: " +
775 base::IntToString(SETTINGS_MAX_FRAME_SIZE), 800 base::IntToString(SETTINGS_MAX_FRAME_SIZE),
776 _)); 801 _));
777 stream_frame_.data_buffer = frame.data(); 802 stream_frame_.data_buffer = frame.data();
778 stream_frame_.data_length = frame.size(); 803 stream_frame_.data_length = frame.size();
779 headers_stream_->OnStreamFrame(stream_frame_); 804 headers_stream_->OnStreamFrame(stream_frame_);
780 } 805 }
781 806
782 TEST_P(QuicHeadersStreamTest, ProcessSpdyPingFrame) { 807 TEST_P(QuicHeadersStreamTest, ProcessSpdyPingFrame) {
783 SpdyPingIR data(1); 808 SpdyPingIR data(1);
784 SpdySerializedFrame frame(framer_->SerializeFrame(data)); 809 SpdySerializedFrame frame(framer_->SerializeFrame(data));
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 } 988 }
964 saved_data_.clear(); 989 saved_data_.clear();
965 saved_payloads_.clear(); 990 saved_payloads_.clear();
966 } 991 }
967 } 992 }
968 } 993 }
969 994
970 } // namespace 995 } // namespace
971 } // namespace test 996 } // namespace test
972 } // namespace net 997 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_headers_stream.cc ('k') | net/quic/core/quic_server_session_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698