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

Side by Side 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 unified diff | 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 »
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 <memory> 5 #include <memory>
6 #include <ostream> 6 #include <ostream>
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 QuicPacketNumber packet_number, 410 QuicPacketNumber packet_number,
411 QuicStreamId stream_id, 411 QuicStreamId stream_id,
412 bool should_include_version, 412 bool should_include_version,
413 bool fin, 413 bool fin,
414 QuicStreamOffset offset, 414 QuicStreamOffset offset,
415 base::StringPiece data) { 415 base::StringPiece data) {
416 return server_maker_.MakeDataPacket( 416 return server_maker_.MakeDataPacket(
417 packet_number, stream_id, should_include_version, fin, offset, data); 417 packet_number, stream_id, should_include_version, fin, offset, data);
418 } 418 }
419 419
420 std::unique_ptr<QuicEncryptedPacket> ConstructClientDataPacket(
421 QuicPacketNumber packet_number,
422 QuicStreamId stream_id,
423 bool should_include_version,
424 bool fin,
425 QuicStreamOffset offset,
426 base::StringPiece data) {
427 return client_maker_.MakeDataPacket(
428 packet_number, stream_id, should_include_version, fin, offset, data);
429 }
430
431 std::unique_ptr<QuicEncryptedPacket> ConstructClientForceHolDataPacket(
432 QuicPacketNumber packet_number,
433 QuicStreamId stream_id,
434 bool should_include_version,
435 bool fin,
436 QuicStreamOffset* offset,
437 base::StringPiece data) {
438 return client_maker_.MakeForceHolDataPacket(
439 packet_number, stream_id, should_include_version, fin, offset, data);
440 }
441
420 std::unique_ptr<QuicEncryptedPacket> ConstructClientRequestHeadersPacket( 442 std::unique_ptr<QuicEncryptedPacket> ConstructClientRequestHeadersPacket(
421 QuicPacketNumber packet_number, 443 QuicPacketNumber packet_number,
422 QuicStreamId stream_id, 444 QuicStreamId stream_id,
423 bool should_include_version, 445 bool should_include_version,
424 bool fin, 446 bool fin,
425 SpdyHeaderBlock headers, 447 SpdyHeaderBlock headers,
426 QuicStreamOffset* offset) { 448 QuicStreamOffset* offset) {
427 SpdyPriority priority = 449 SpdyPriority priority =
428 ConvertRequestPriorityToQuicPriority(DEFAULT_PRIORITY); 450 ConvertRequestPriorityToQuicPriority(DEFAULT_PRIORITY);
429 return client_maker_.MakeRequestHeadersPacketWithOffsetTracking( 451 return client_maker_.MakeRequestHeadersPacketWithOffsetTracking(
(...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 net_log_.GetEntries(&entries); 2368 net_log_.GetEntries(&entries);
2347 EXPECT_LT(0u, entries.size()); 2369 EXPECT_LT(0u, entries.size());
2348 2370
2349 // Check that we logged a QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM 2371 // Check that we logged a QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM
2350 int pos = ExpectLogContainsSomewhere( 2372 int pos = ExpectLogContainsSomewhere(
2351 entries, 0, NetLog::TYPE_QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM, 2373 entries, 0, NetLog::TYPE_QUIC_HTTP_STREAM_ADOPTED_PUSH_STREAM,
2352 NetLog::PHASE_NONE); 2374 NetLog::PHASE_NONE);
2353 EXPECT_LT(0, pos); 2375 EXPECT_LT(0, pos);
2354 } 2376 }
2355 2377
2378 TEST_P(QuicNetworkTransactionTest, QuicForceHolBlocking) {
2379 FLAGS_quic_enable_version_35 = true;
2380 FLAGS_quic_enable_version_36 = true;
2381 params_.quic_force_hol_blocking = true;
2382 params_.origins_to_force_quic_on.insert(
2383 HostPortPair::FromString("mail.example.org:443"));
2384
2385 MockQuicData mock_quic_data;
2386
2387 QuicStreamOffset offset = 0;
2388 mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket(
2389 1, kClientDataStreamId1, true, false,
2390 GetRequestHeaders("POST", "https", "/"), &offset));
2391
2392 std::unique_ptr<QuicEncryptedPacket> packet;
2393 if (GetParam() > QUIC_VERSION_35) {
2394 packet = ConstructClientForceHolDataPacket(2, kClientDataStreamId1, true,
2395 true, &offset, "1");
2396 } else {
2397 packet =
2398 ConstructClientDataPacket(2, kClientDataStreamId1, true, true, 0, "1");
2399 }
2400 mock_quic_data.AddWrite(std::move(packet));
2401
2402 mock_quic_data.AddRead(ConstructServerResponseHeadersPacket(
2403 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK")));
2404
2405 mock_quic_data.AddRead(ConstructServerDataPacket(2, kClientDataStreamId1,
2406 false, true, 0, "hello!"));
2407
2408 mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1));
2409
2410 mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read
2411 mock_quic_data.AddRead(ASYNC, 0); // EOF
2412 mock_quic_data.AddSocketDataToFactory(&socket_factory_);
2413
2414 // The non-alternate protocol job needs to hang in order to guarantee that
2415 // the alternate-protocol job will "win".
2416 AddHangingNonAlternateProtocolSocketData();
2417
2418 CreateSession();
2419 request_.method = "POST";
2420 ChunkedUploadDataStream upload_data(0);
2421 upload_data.AppendData("1", 1, true);
2422
2423 request_.upload_data_stream = &upload_data;
2424
2425 SendRequestAndExpectQuicResponse("hello!");
2426 }
2427
2356 class QuicNetworkTransactionWithDestinationTest 2428 class QuicNetworkTransactionWithDestinationTest
2357 : public PlatformTest, 2429 : public PlatformTest,
2358 public ::testing::WithParamInterface<PoolingTestParams> { 2430 public ::testing::WithParamInterface<PoolingTestParams> {
2359 protected: 2431 protected:
2360 QuicNetworkTransactionWithDestinationTest() 2432 QuicNetworkTransactionWithDestinationTest()
2361 : clock_(new MockClock), 2433 : clock_(new MockClock),
2362 version_(GetParam().version), 2434 version_(GetParam().version),
2363 destination_type_(GetParam().destination_type), 2435 destination_type_(GetParam().destination_type),
2364 cert_transparency_verifier_(new MultiLogCTVerifier()), 2436 cert_transparency_verifier_(new MultiLogCTVerifier()),
2365 ssl_config_service_(new SSLConfigServiceDefaults), 2437 ssl_config_service_(new SSLConfigServiceDefaults),
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
2768 AddHangingSocketData(); 2840 AddHangingSocketData();
2769 2841
2770 SendRequestAndExpectQuicResponse(origin1_); 2842 SendRequestAndExpectQuicResponse(origin1_);
2771 SendRequestAndExpectQuicResponse(origin2_); 2843 SendRequestAndExpectQuicResponse(origin2_);
2772 2844
2773 EXPECT_TRUE(AllDataConsumed()); 2845 EXPECT_TRUE(AllDataConsumed());
2774 } 2846 }
2775 2847
2776 } // namespace test 2848 } // namespace test
2777 } // namespace net 2849 } // namespace net
OLDNEW
« 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