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

Side by Side Diff: net/quic/core/quic_session_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
« no previous file with comments | « net/quic/core/quic_session.cc ('k') | net/quic/core/quic_stream_sequencer.cc » ('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 (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/core/quic_session.h" 5 #include "net/quic/core/quic_session.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/rand_util.h" 11 #include "base/rand_util.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "net/quic/core/crypto/crypto_protocol.h" 15 #include "net/quic/core/crypto/crypto_protocol.h"
16 #include "net/quic/core/crypto/null_encrypter.h" 16 #include "net/quic/core/crypto/null_encrypter.h"
17 #include "net/quic/core/quic_crypto_stream.h" 17 #include "net/quic/core/quic_crypto_stream.h"
18 #include "net/quic/core/quic_flags.h" 18 #include "net/quic/core/quic_flags.h"
19 #include "net/quic/core/quic_packets.h" 19 #include "net/quic/core/quic_packets.h"
20 #include "net/quic/core/quic_stream.h" 20 #include "net/quic/core/quic_stream.h"
21 #include "net/quic/core/quic_utils.h" 21 #include "net/quic/core/quic_utils.h"
22 #include "net/quic/platform/api/quic_str_cat.h"
22 #include "net/quic/test_tools/quic_config_peer.h" 23 #include "net/quic/test_tools/quic_config_peer.h"
23 #include "net/quic/test_tools/quic_connection_peer.h" 24 #include "net/quic/test_tools/quic_connection_peer.h"
24 #include "net/quic/test_tools/quic_flow_controller_peer.h" 25 #include "net/quic/test_tools/quic_flow_controller_peer.h"
25 #include "net/quic/test_tools/quic_headers_stream_peer.h" 26 #include "net/quic/test_tools/quic_headers_stream_peer.h"
26 #include "net/quic/test_tools/quic_session_peer.h" 27 #include "net/quic/test_tools/quic_session_peer.h"
27 #include "net/quic/test_tools/quic_spdy_session_peer.h" 28 #include "net/quic/test_tools/quic_spdy_session_peer.h"
28 #include "net/quic/test_tools/quic_spdy_stream_peer.h" 29 #include "net/quic/test_tools/quic_spdy_stream_peer.h"
29 #include "net/quic/test_tools/quic_stream_peer.h" 30 #include "net/quic/test_tools/quic_stream_peer.h"
30 #include "net/quic/test_tools/quic_test_utils.h" 31 #include "net/quic/test_tools/quic_test_utils.h"
31 #include "net/spdy/spdy_framer.h" 32 #include "net/spdy/spdy_framer.h"
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); 915 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked());
915 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); 916 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
916 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); 917 EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
917 QuicStreamId stream_id = 5; 918 QuicStreamId stream_id = 5;
918 // Write until the header stream is flow control blocked. 919 // Write until the header stream is flow control blocked.
919 EXPECT_CALL(*connection_, SendBlocked(kHeadersStreamId)); 920 EXPECT_CALL(*connection_, SendBlocked(kHeadersStreamId));
920 SpdyHeaderBlock headers; 921 SpdyHeaderBlock headers;
921 while (!headers_stream->flow_controller()->IsBlocked() && stream_id < 2000) { 922 while (!headers_stream->flow_controller()->IsBlocked() && stream_id < 2000) {
922 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); 923 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
923 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); 924 EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
924 headers["header"] = base::Uint64ToString(base::RandUint64()) + 925 headers["header"] = QuicStrCat("", base::RandUint64(), base::RandUint64(),
925 base::Uint64ToString(base::RandUint64()) + 926 base::RandUint64());
926 base::Uint64ToString(base::RandUint64());
927 headers_stream->WriteHeaders(stream_id, headers.Clone(), true, 0, nullptr); 927 headers_stream->WriteHeaders(stream_id, headers.Clone(), true, 0, nullptr);
928 stream_id += 2; 928 stream_id += 2;
929 } 929 }
930 // Write once more to ensure that the headers stream has buffered data. The 930 // Write once more to ensure that the headers stream has buffered data. The
931 // random headers may have exactly filled the flow control window. 931 // random headers may have exactly filled the flow control window.
932 headers_stream->WriteHeaders(stream_id, std::move(headers), true, 0, nullptr); 932 headers_stream->WriteHeaders(stream_id, std::move(headers), true, 0, nullptr);
933 EXPECT_TRUE(headers_stream->HasBufferedData()); 933 EXPECT_TRUE(headers_stream->HasBufferedData());
934 934
935 EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked()); 935 EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked());
936 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); 936 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked());
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 if (version() <= QUIC_VERSION_35) { 1315 if (version() <= QUIC_VERSION_35) {
1316 EXPECT_FALSE(session_.force_hol_blocking()); 1316 EXPECT_FALSE(session_.force_hol_blocking());
1317 } else { 1317 } else {
1318 EXPECT_TRUE(session_.force_hol_blocking()); 1318 EXPECT_TRUE(session_.force_hol_blocking());
1319 } 1319 }
1320 } 1320 }
1321 1321
1322 } // namespace 1322 } // namespace
1323 } // namespace test 1323 } // namespace test
1324 } // namespace net 1324 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_session.cc ('k') | net/quic/core/quic_stream_sequencer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698