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

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

Issue 2591143003: Add QuicStrCat. (Closed)
Patch Set: sync Created 3 years, 12 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
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 <cstdint> 7 #include <cstdint>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 #include <tuple> 10 #include <tuple>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "net/quic/core/quic_bug_tracker.h" 14 #include "net/quic/core/quic_bug_tracker.h"
15 #include "net/quic/core/quic_flags.h" 15 #include "net/quic/core/quic_flags.h"
16 #include "net/quic/core/quic_utils.h" 16 #include "net/quic/core/quic_utils.h"
17 #include "net/quic/core/spdy_utils.h" 17 #include "net/quic/core/spdy_utils.h"
18 #include "net/quic/platform/api/quic_str_cat.h"
18 #include "net/quic/test_tools/quic_connection_peer.h" 19 #include "net/quic/test_tools/quic_connection_peer.h"
19 #include "net/quic/test_tools/quic_headers_stream_peer.h" 20 #include "net/quic/test_tools/quic_headers_stream_peer.h"
20 #include "net/quic/test_tools/quic_spdy_session_peer.h" 21 #include "net/quic/test_tools/quic_spdy_session_peer.h"
21 #include "net/quic/test_tools/quic_stream_peer.h" 22 #include "net/quic/test_tools/quic_stream_peer.h"
22 #include "net/quic/test_tools/quic_test_utils.h" 23 #include "net/quic/test_tools/quic_test_utils.h"
23 #include "net/spdy/spdy_alt_svc_wire_format.h" 24 #include "net/spdy/spdy_alt_svc_wire_format.h"
24 #include "net/spdy/spdy_flags.h" 25 #include "net/spdy/spdy_flags.h"
25 #include "net/spdy/spdy_protocol.h" 26 #include "net/spdy/spdy_protocol.h"
26 #include "net/spdy/spdy_test_utils.h" 27 #include "net/spdy/spdy_test_utils.h"
27 #include "net/test/gtest_util.h" 28 #include "net/test/gtest_util.h"
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 // SETTINGS_INITIAL_WINDOW_SIZE, SETTINGS_ENABLE_PUSH and 771 // SETTINGS_INITIAL_WINDOW_SIZE, SETTINGS_ENABLE_PUSH and
771 // SETTINGS_MAX_FRAME_SIZE. 772 // SETTINGS_MAX_FRAME_SIZE.
772 data.AddSetting(SETTINGS_MAX_CONCURRENT_STREAMS, 100); 773 data.AddSetting(SETTINGS_MAX_CONCURRENT_STREAMS, 100);
773 data.AddSetting(SETTINGS_INITIAL_WINDOW_SIZE, 100); 774 data.AddSetting(SETTINGS_INITIAL_WINDOW_SIZE, 100);
774 data.AddSetting(SETTINGS_ENABLE_PUSH, 1); 775 data.AddSetting(SETTINGS_ENABLE_PUSH, 1);
775 data.AddSetting(SETTINGS_MAX_FRAME_SIZE, 1250); 776 data.AddSetting(SETTINGS_MAX_FRAME_SIZE, 1250);
776 SpdySerializedFrame frame(framer_->SerializeFrame(data)); 777 SpdySerializedFrame frame(framer_->SerializeFrame(data));
777 EXPECT_CALL( 778 EXPECT_CALL(
778 *connection_, 779 *connection_,
779 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA, 780 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
780 "Unsupported field of HTTP/2 SETTINGS frame: " + 781 QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
781 base::IntToString(SETTINGS_MAX_CONCURRENT_STREAMS), 782 SETTINGS_MAX_CONCURRENT_STREAMS),
782 _)); 783 _));
783 EXPECT_CALL( 784 EXPECT_CALL(
784 *connection_, 785 *connection_,
785 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA, 786 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
786 "Unsupported field of HTTP/2 SETTINGS frame: " + 787 QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
787 base::IntToString(SETTINGS_INITIAL_WINDOW_SIZE), 788 SETTINGS_INITIAL_WINDOW_SIZE),
788 _)); 789 _));
789 if (!FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default || 790 if (!FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default ||
790 session_.perspective() == Perspective::IS_CLIENT) { 791 session_.perspective() == Perspective::IS_CLIENT) {
791 EXPECT_CALL(*connection_, 792 EXPECT_CALL(*connection_,
792 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA, 793 CloseConnection(
793 "Unsupported field of HTTP/2 SETTINGS frame: " + 794 QUIC_INVALID_HEADERS_STREAM_DATA,
794 base::IntToString(SETTINGS_ENABLE_PUSH), 795 QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
795 _)); 796 SETTINGS_ENABLE_PUSH),
797 _));
796 } 798 }
797 EXPECT_CALL(*connection_, 799 EXPECT_CALL(
798 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA, 800 *connection_,
799 "Unsupported field of HTTP/2 SETTINGS frame: " + 801 CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
800 base::IntToString(SETTINGS_MAX_FRAME_SIZE), 802 QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ",
801 _)); 803 SETTINGS_MAX_FRAME_SIZE),
804 _));
802 stream_frame_.data_buffer = frame.data(); 805 stream_frame_.data_buffer = frame.data();
803 stream_frame_.data_length = frame.size(); 806 stream_frame_.data_length = frame.size();
804 headers_stream_->OnStreamFrame(stream_frame_); 807 headers_stream_->OnStreamFrame(stream_frame_);
805 } 808 }
806 809
807 TEST_P(QuicHeadersStreamTest, ProcessSpdyPingFrame) { 810 TEST_P(QuicHeadersStreamTest, ProcessSpdyPingFrame) {
808 SpdyPingIR data(1); 811 SpdyPingIR data(1);
809 SpdySerializedFrame frame(framer_->SerializeFrame(data)); 812 SpdySerializedFrame frame(framer_->SerializeFrame(data));
810 EXPECT_CALL(*connection_, CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA, 813 EXPECT_CALL(*connection_, CloseConnection(QUIC_INVALID_HEADERS_STREAM_DATA,
811 "SPDY PING frame received.", _)) 814 "SPDY PING frame received.", _))
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 consumed_data = headers_stream_->WritevStreamData( 1048 consumed_data = headers_stream_->WritevStreamData(
1046 id, MakeIOVector(data, &iov), offset, fin, nullptr); 1049 id, MakeIOVector(data, &iov), offset, fin, nullptr);
1047 1050
1048 EXPECT_EQ(consumed_data.bytes_consumed, 0u); 1051 EXPECT_EQ(consumed_data.bytes_consumed, 0u);
1049 EXPECT_EQ(consumed_data.fin_consumed, false); 1052 EXPECT_EQ(consumed_data.fin_consumed, false);
1050 } 1053 }
1051 1054
1052 } // namespace 1055 } // namespace
1053 } // namespace test 1056 } // namespace test
1054 } // namespace net 1057 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_headers_stream.cc ('k') | net/quic/core/quic_multipath_sent_packet_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698