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

Unified Diff: net/quic/quic_network_transaction_unittest.cc

Issue 2113343002: QUIC - added force_hol_blocking field trial param to enable forced HOL blocking. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@126418608
Patch Set: review feedback round #1 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/quic/quic_stream_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_network_transaction_unittest.cc
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc
index c6a1ced51193316523f610acf868102df74e244f..01c5d88f714555e8a0fcb5f263efbd3a5769f946 100644
--- a/net/quic/quic_network_transaction_unittest.cc
+++ b/net/quic/quic_network_transaction_unittest.cc
@@ -417,6 +417,28 @@ class QuicNetworkTransactionTest
packet_number, stream_id, should_include_version, fin, offset, data);
}
+ std::unique_ptr<QuicEncryptedPacket> ConstructClientDataPacket(
+ QuicPacketNumber packet_number,
+ QuicStreamId stream_id,
+ bool should_include_version,
+ bool fin,
+ QuicStreamOffset offset,
+ base::StringPiece data) {
+ return client_maker_.MakeDataPacket(
+ packet_number, stream_id, should_include_version, fin, offset, data);
+ }
+
+ std::unique_ptr<QuicEncryptedPacket> ConstructClientForceHolDataPacket(
+ QuicPacketNumber packet_number,
+ QuicStreamId stream_id,
+ bool should_include_version,
+ bool fin,
+ QuicStreamOffset* offset,
+ base::StringPiece data) {
+ return client_maker_.MakeForceHolDataPacket(
+ packet_number, stream_id, should_include_version, fin, offset, data);
+ }
+
std::unique_ptr<QuicEncryptedPacket> ConstructClientRequestHeadersPacket(
QuicPacketNumber packet_number,
QuicStreamId stream_id,
@@ -2353,6 +2375,56 @@ TEST_P(QuicNetworkTransactionTest, QuicServerPush) {
EXPECT_LT(0, pos);
}
+TEST_P(QuicNetworkTransactionTest, QuicForceHolBlocking) {
+ FLAGS_quic_enable_version_35 = true;
+ FLAGS_quic_enable_version_36 = true;
+ params_.quic_force_hol_blocking = true;
+ params_.origins_to_force_quic_on.insert(
+ HostPortPair::FromString("mail.example.org:443"));
+
+ MockQuicData mock_quic_data;
+
+ QuicStreamOffset offset = 0;
+ mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket(
+ 1, kClientDataStreamId1, true, false,
+ GetRequestHeaders("POST", "https", "/"), &offset));
+
+ std::unique_ptr<QuicEncryptedPacket> packet;
+ if (GetParam() > QUIC_VERSION_35) {
+ packet = ConstructClientForceHolDataPacket(2, kClientDataStreamId1, true,
+ true, &offset, "1");
+ } else {
+ packet =
+ ConstructClientDataPacket(2, kClientDataStreamId1, true, true, 0, "1");
+ }
+ mock_quic_data.AddWrite(std::move(packet));
+
+ mock_quic_data.AddRead(ConstructServerResponseHeadersPacket(
+ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK")));
+
+ mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1,
+ false, true, 0, "hello!"));
+
+ mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1));
+
+ mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read
+ mock_quic_data.AddRead(ASYNC, 0); // EOF
+ mock_quic_data.AddSocketDataToFactory(&socket_factory_);
+
+ // The non-alternate protocol job needs to hang in order to guarantee that
+ // the alternate-protocol job will "win".
+ AddHangingNonAlternateProtocolSocketData();
+
+ CreateSession();
+ request_.method = "POST";
+ ChunkedUploadDataStream upload_data(0);
+ upload_data.AppendData("1", 1, true);
+
+ request_.upload_data_stream = &upload_data;
+
+ SendRequestAndExpectQuicResponse("hello!");
+}
+
class QuicNetworkTransactionWithDestinationTest
: public PlatformTest,
public ::testing::WithParamInterface<PoolingTestParams> {
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/quic/quic_stream_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698