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

Side by Side Diff: net/quic/quic_session_test.cc

Issue 664803003: Update from chromium a8e7c94b1b79a0948d05a1fcfff53391d22ce37a (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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/quic_reliable_client_stream.cc ('k') | net/quic/quic_stream_factory.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/quic_session.h" 5 #include "net/quic/quic_session.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); 722 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked());
723 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); 723 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
724 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); 724 EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
725 QuicHeadersStream* headers_stream = 725 QuicHeadersStream* headers_stream =
726 QuicSessionPeer::GetHeadersStream(&session_); 726 QuicSessionPeer::GetHeadersStream(&session_);
727 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); 727 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked());
728 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); 728 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
729 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); 729 EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
730 QuicStreamId stream_id = 5; 730 QuicStreamId stream_id = 5;
731 // Write until the header stream is flow control blocked. 731 // Write until the header stream is flow control blocked.
732 SpdyHeaderBlock headers;
732 while (!headers_stream->flow_controller()->IsBlocked() && stream_id < 2010) { 733 while (!headers_stream->flow_controller()->IsBlocked() && stream_id < 2010) {
733 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); 734 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
734 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); 735 EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
735 SpdyHeaderBlock headers;
736 headers["header"] = base::Uint64ToString(base::RandUint64()) + 736 headers["header"] = base::Uint64ToString(base::RandUint64()) +
737 base::Uint64ToString(base::RandUint64()) + 737 base::Uint64ToString(base::RandUint64()) +
738 base::Uint64ToString(base::RandUint64()); 738 base::Uint64ToString(base::RandUint64());
739 headers_stream->WriteHeaders(stream_id, headers, true, nullptr); 739 headers_stream->WriteHeaders(stream_id, headers, true, nullptr);
740 stream_id += 2; 740 stream_id += 2;
741 } 741 }
742 // Write one more to ensure that the headers stream has buffered data. The
743 // random headers may have exactly filled the flow control window.
744 headers_stream->WriteHeaders(stream_id, headers, true, nullptr);
745 EXPECT_TRUE(headers_stream->HasBufferedData());
746
742 EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked()); 747 EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked());
743 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); 748 EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked());
744 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); 749 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
745 EXPECT_TRUE(session_.IsStreamFlowControlBlocked()); 750 EXPECT_TRUE(session_.IsStreamFlowControlBlocked());
746 EXPECT_FALSE(session_.HasDataToWrite()); 751 EXPECT_FALSE(session_.HasDataToWrite());
747 // TODO(rtenneti): crbug.com/423586 headers_stream->HasBufferedData is flaky.
748 // EXPECT_TRUE(headers_stream->HasBufferedData());
749 752
750 // Now complete the crypto handshake, resulting in an increased flow control 753 // Now complete the crypto handshake, resulting in an increased flow control
751 // send window. 754 // send window.
752 CryptoHandshakeMessage msg; 755 CryptoHandshakeMessage msg;
753 session_.GetCryptoStream()->OnHandshakeMessage(msg); 756 session_.GetCryptoStream()->OnHandshakeMessage(msg);
754 757
755 // Stream is now unblocked and will no longer have buffered data. 758 // Stream is now unblocked and will no longer have buffered data.
756 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); 759 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked());
757 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); 760 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
758 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); 761 EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 } 1021 }
1019 1022
1020 // Called after any new data is received by the session, and triggers the call 1023 // Called after any new data is received by the session, and triggers the call
1021 // to close the connection. 1024 // to close the connection.
1022 session_.PostProcessAfterData(); 1025 session_.PostProcessAfterData();
1023 } 1026 }
1024 1027
1025 } // namespace 1028 } // namespace
1026 } // namespace test 1029 } // namespace test
1027 } // namespace net 1030 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_reliable_client_stream.cc ('k') | net/quic/quic_stream_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698