OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic_session.h" | 5 #include "net/quic/quic_session.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
10 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
11 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
13 #include "net/quic/crypto/crypto_protocol.h" | 14 #include "net/quic/crypto/crypto_protocol.h" |
14 #include "net/quic/quic_crypto_stream.h" | 15 #include "net/quic/quic_crypto_stream.h" |
15 #include "net/quic/quic_flags.h" | 16 #include "net/quic/quic_flags.h" |
16 #include "net/quic/quic_protocol.h" | 17 #include "net/quic/quic_protocol.h" |
17 #include "net/quic/quic_utils.h" | 18 #include "net/quic/quic_utils.h" |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 QuicStreamId stream_id = 5; | 809 QuicStreamId stream_id = 5; |
809 // Write until the header stream is flow control blocked. | 810 // Write until the header stream is flow control blocked. |
810 EXPECT_CALL(*connection_, SendBlocked(kHeadersStreamId)); | 811 EXPECT_CALL(*connection_, SendBlocked(kHeadersStreamId)); |
811 SpdyHeaderBlock headers; | 812 SpdyHeaderBlock headers; |
812 while (!headers_stream->flow_controller()->IsBlocked() && stream_id < 2000) { | 813 while (!headers_stream->flow_controller()->IsBlocked() && stream_id < 2000) { |
813 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); | 814 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); |
814 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); | 815 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); |
815 headers["header"] = base::Uint64ToString(base::RandUint64()) + | 816 headers["header"] = base::Uint64ToString(base::RandUint64()) + |
816 base::Uint64ToString(base::RandUint64()) + | 817 base::Uint64ToString(base::RandUint64()) + |
817 base::Uint64ToString(base::RandUint64()); | 818 base::Uint64ToString(base::RandUint64()); |
818 headers_stream->WriteHeaders(stream_id, headers, true, 0, nullptr); | 819 headers_stream->WriteHeaders(stream_id, headers.Clone(), true, 0, nullptr); |
819 stream_id += 2; | 820 stream_id += 2; |
820 } | 821 } |
821 // Write once more to ensure that the headers stream has buffered data. The | 822 // Write once more to ensure that the headers stream has buffered data. The |
822 // random headers may have exactly filled the flow control window. | 823 // random headers may have exactly filled the flow control window. |
823 headers_stream->WriteHeaders(stream_id, headers, true, 0, nullptr); | 824 headers_stream->WriteHeaders(stream_id, std::move(headers), true, 0, nullptr); |
824 EXPECT_TRUE(headers_stream->HasBufferedData()); | 825 EXPECT_TRUE(headers_stream->HasBufferedData()); |
825 | 826 |
826 EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked()); | 827 EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked()); |
827 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); | 828 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); |
828 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); | 829 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); |
829 EXPECT_TRUE(session_.IsStreamFlowControlBlocked()); | 830 EXPECT_TRUE(session_.IsStreamFlowControlBlocked()); |
830 EXPECT_FALSE(session_.HasDataToWrite()); | 831 EXPECT_FALSE(session_.HasDataToWrite()); |
831 | 832 |
832 // Now complete the crypto handshake, resulting in an increased flow control | 833 // Now complete the crypto handshake, resulting in an increased flow control |
833 // send window. | 834 // send window. |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 session_.OnConfigNegotiated(); | 1178 session_.OnConfigNegotiated(); |
1178 EXPECT_LT(session_.max_open_outgoing_streams(), | 1179 EXPECT_LT(session_.max_open_outgoing_streams(), |
1179 session_.max_open_incoming_streams()); | 1180 session_.max_open_incoming_streams()); |
1180 EXPECT_EQ(session_.max_open_outgoing_streams(), | 1181 EXPECT_EQ(session_.max_open_outgoing_streams(), |
1181 kDefaultMaxStreamsPerConnection); | 1182 kDefaultMaxStreamsPerConnection); |
1182 } | 1183 } |
1183 | 1184 |
1184 } // namespace | 1185 } // namespace |
1185 } // namespace test | 1186 } // namespace test |
1186 } // namespace net | 1187 } // namespace net |
OLD | NEW |