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

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

Issue 2115033002: Adds QUIC_VERSION_36 which adds support to force HOL blocking between streams for measurement purpo… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@126085461
Patch Set: typo Created 4 years, 5 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_protocol.cc ('k') | net/quic/quic_spdy_session.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 (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 #include <utility>
9 9
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 14 matching lines...) Expand all
25 #include "net/quic/test_tools/quic_spdy_session_peer.h" 25 #include "net/quic/test_tools/quic_spdy_session_peer.h"
26 #include "net/quic/test_tools/quic_spdy_stream_peer.h" 26 #include "net/quic/test_tools/quic_spdy_stream_peer.h"
27 #include "net/quic/test_tools/quic_test_utils.h" 27 #include "net/quic/test_tools/quic_test_utils.h"
28 #include "net/quic/test_tools/reliable_quic_stream_peer.h" 28 #include "net/quic/test_tools/reliable_quic_stream_peer.h"
29 #include "net/spdy/spdy_framer.h" 29 #include "net/spdy/spdy_framer.h"
30 #include "net/test/gtest_util.h" 30 #include "net/test/gtest_util.h"
31 #include "testing/gmock/include/gmock/gmock.h" 31 #include "testing/gmock/include/gmock/gmock.h"
32 #include "testing/gmock_mutant.h" 32 #include "testing/gmock_mutant.h"
33 #include "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
34 34
35 using net::SpdyHeaderBlock;
36 using net::SpdyPriority;
35 using std::set; 37 using std::set;
36 using std::string; 38 using std::string;
37 using std::vector; 39 using std::vector;
38 using testing::CreateFunctor; 40 using testing::CreateFunctor;
41 using testing::AtLeast;
39 using testing::InSequence; 42 using testing::InSequence;
40 using testing::Invoke; 43 using testing::Invoke;
41 using testing::Return; 44 using testing::Return;
42 using testing::StrictMock; 45 using testing::StrictMock;
43 using testing::_; 46 using testing::_;
44 47
45 namespace net { 48 namespace net {
46 namespace test { 49 namespace test {
47 namespace { 50 namespace {
48 51
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 // Ensure that Writev consumes all the data it is given (simulate no socket 717 // Ensure that Writev consumes all the data it is given (simulate no socket
715 // blocking). 718 // blocking).
716 session_.set_writev_consumes_all_data(true); 719 session_.set_writev_consumes_all_data(true);
717 720
718 // Create a stream, and send enough data to make it flow control blocked. 721 // Create a stream, and send enough data to make it flow control blocked.
719 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); 722 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority);
720 string body(kMinimumFlowControlSendWindow, '.'); 723 string body(kMinimumFlowControlSendWindow, '.');
721 EXPECT_FALSE(stream2->flow_controller()->IsBlocked()); 724 EXPECT_FALSE(stream2->flow_controller()->IsBlocked());
722 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked()); 725 EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
723 EXPECT_FALSE(session_.IsStreamFlowControlBlocked()); 726 EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
724 EXPECT_CALL(*connection_, SendBlocked(stream2->id())); 727 EXPECT_CALL(*connection_, SendBlocked(_)).Times(AtLeast(1));
725 EXPECT_CALL(*connection_, SendBlocked(0)); 728 EXPECT_CALL(*connection_, SendBlocked(0));
726 stream2->WriteOrBufferBody(body, false, nullptr); 729 stream2->WriteOrBufferBody(body, false, nullptr);
727 EXPECT_TRUE(stream2->flow_controller()->IsBlocked()); 730 EXPECT_TRUE(stream2->flow_controller()->IsBlocked());
728 EXPECT_TRUE(session_.IsConnectionFlowControlBlocked()); 731 EXPECT_TRUE(session_.IsConnectionFlowControlBlocked());
729 EXPECT_TRUE(session_.IsStreamFlowControlBlocked()); 732 EXPECT_TRUE(session_.IsStreamFlowControlBlocked());
730 733
731 // The handshake message will call OnCanWrite, so the stream can resume 734 // The handshake message will call OnCanWrite, so the stream can resume
732 // writing. 735 // writing.
733 EXPECT_CALL(*stream2, OnCanWrite()); 736 EXPECT_CALL(*stream2, OnCanWrite());
734 // Now complete the crypto handshake, resulting in an increased flow control 737 // Now complete the crypto handshake, resulting in an increased flow control
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 // The max number of open outgoing streams is less than that of incoming 1114 // The max number of open outgoing streams is less than that of incoming
1112 // streams, and it should be same as negotiated value. 1115 // streams, and it should be same as negotiated value.
1113 EXPECT_LT(session_.max_open_outgoing_streams(), 1116 EXPECT_LT(session_.max_open_outgoing_streams(),
1114 session_.max_open_incoming_streams()); 1117 session_.max_open_incoming_streams());
1115 EXPECT_EQ(session_.max_open_outgoing_streams(), 1118 EXPECT_EQ(session_.max_open_outgoing_streams(),
1116 kDefaultMaxStreamsPerConnection); 1119 kDefaultMaxStreamsPerConnection);
1117 EXPECT_GT(session_.max_open_incoming_streams(), 1120 EXPECT_GT(session_.max_open_incoming_streams(),
1118 kDefaultMaxStreamsPerConnection); 1121 kDefaultMaxStreamsPerConnection);
1119 } 1122 }
1120 1123
1124 TEST_P(QuicSessionTestServer, EnableFHOLThroughConfigOption) {
1125 QuicConfigPeer::SetReceivedForceHolBlocking(session_.config());
1126 session_.OnConfigNegotiated();
1127 if (version() <= QUIC_VERSION_35) {
1128 EXPECT_FALSE(session_.force_hol_blocking());
1129 } else {
1130 EXPECT_TRUE(session_.force_hol_blocking());
1131 }
1132 }
1133
1121 class QuicSessionTestClient : public QuicSessionTestBase { 1134 class QuicSessionTestClient : public QuicSessionTestBase {
1122 protected: 1135 protected:
1123 QuicSessionTestClient() : QuicSessionTestBase(Perspective::IS_CLIENT) {} 1136 QuicSessionTestClient() : QuicSessionTestBase(Perspective::IS_CLIENT) {}
1124 }; 1137 };
1125 1138
1126 INSTANTIATE_TEST_CASE_P(Tests, 1139 INSTANTIATE_TEST_CASE_P(Tests,
1127 QuicSessionTestClient, 1140 QuicSessionTestClient,
1128 ::testing::ValuesIn(QuicSupportedVersions())); 1141 ::testing::ValuesIn(QuicSupportedVersions()));
1129 1142
1130 TEST_P(QuicSessionTestClient, AvailableStreamsClient) { 1143 TEST_P(QuicSessionTestClient, AvailableStreamsClient) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 1201
1189 QuicTagVector copt; 1202 QuicTagVector copt;
1190 copt.push_back(kDHDT); 1203 copt.push_back(kDHDT);
1191 QuicConfigPeer::SetConnectionOptionsToSend(session_.config(), copt); 1204 QuicConfigPeer::SetConnectionOptionsToSend(session_.config(), copt);
1192 session_.OnConfigNegotiated(); 1205 session_.OnConfigNegotiated();
1193 EXPECT_EQ(QuicHeadersStreamPeer::GetSpdyFramer(session_.headers_stream()) 1206 EXPECT_EQ(QuicHeadersStreamPeer::GetSpdyFramer(session_.headers_stream())
1194 .header_encoder_table_size(), 1207 .header_encoder_table_size(),
1195 0UL); 1208 0UL);
1196 } 1209 }
1197 1210
1211 TEST_P(QuicSessionTestClient, EnableFHOLThroughConfigOption) {
1212 session_.config()->SetForceHolBlocking();
1213 session_.OnConfigNegotiated();
1214 if (version() <= QUIC_VERSION_35) {
1215 EXPECT_FALSE(session_.force_hol_blocking());
1216 } else {
1217 EXPECT_TRUE(session_.force_hol_blocking());
1218 }
1219 }
1220
1198 } // namespace 1221 } // namespace
1199 } // namespace test 1222 } // namespace test
1200 } // namespace net 1223 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.cc ('k') | net/quic/quic_spdy_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698