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

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

Issue 2077683002: Move the logic for delaying 0-RTT QUIC POST from the QuicStreamFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@QuicHttpStream
Patch Set: Rebase Created 4 years, 6 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_stream_factory.cc ('k') | no next file » | 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_stream_factory.h" 5 #include "net/quic/quic_stream_factory.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); 604 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0);
605 socket_factory_.AddSocketDataProvider(&socket_data); 605 socket_factory_.AddSocketDataProvider(&socket_data);
606 606
607 crypto_client_stream_factory_.set_handshake_mode( 607 crypto_client_stream_factory_.set_handshake_mode(
608 MockCryptoClientStream::ZERO_RTT); 608 MockCryptoClientStream::ZERO_RTT);
609 host_resolver_.set_synchronous_mode(true); 609 host_resolver_.set_synchronous_mode(true);
610 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), 610 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(),
611 "192.168.0.1", ""); 611 "192.168.0.1", "");
612 612
613 QuicStreamRequest request(factory_.get()); 613 QuicStreamRequest request(factory_.get());
614 // Posts require handshake confirmation, so this will return asynchronously. 614 // Posts require handshake confirmation, so this will return asynchronously.
xunjieli 2016/06/17 13:40:37 The comment is now outdated.
Ryan Hamilton 2016/06/17 17:37:22 Done.
615 EXPECT_EQ(ERR_IO_PENDING, 615 EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_,
616 request.Request(host_port_pair_, privacy_mode_, 616 /*cert_verify_flags=*/0, url_, "POST", net_log_,
617 /*cert_verify_flags=*/0, url_, "POST", net_log_, 617 callback_.callback()));
618 callback_.callback()));
619 618
620 // Confirm the handshake and verify that the stream is created.
621 crypto_client_stream_factory_.last_stream()->SendOnCryptoHandshakeEvent(
622 QuicSession::HANDSHAKE_CONFIRMED);
623
624 EXPECT_EQ(OK, callback_.WaitForResult());
625 std::unique_ptr<QuicHttpStream> stream = request.CreateStream(); 619 std::unique_ptr<QuicHttpStream> stream = request.CreateStream();
626 EXPECT_TRUE(stream.get()); 620 EXPECT_TRUE(stream.get());
627 EXPECT_TRUE(socket_data.AllReadDataConsumed()); 621 EXPECT_TRUE(socket_data.AllReadDataConsumed());
628 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); 622 EXPECT_TRUE(socket_data.AllWriteDataConsumed());
629 } 623 }
630 624
631 TEST_P(QuicStreamFactoryTest, GoAway) { 625 TEST_P(QuicStreamFactoryTest, GoAway) {
632 Initialize(); 626 Initialize();
633 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); 627 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails();
634 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); 628 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details);
(...skipping 3021 matching lines...) Expand 10 before | Expand all | Expand 10 after
3656 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); 3650 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0);
3657 socket_factory_.AddSocketDataProvider(&socket_data); 3651 socket_factory_.AddSocketDataProvider(&socket_data);
3658 3652
3659 ServerNetworkStats stats1; 3653 ServerNetworkStats stats1;
3660 stats1.srtt = base::TimeDelta::FromMicroseconds(10); 3654 stats1.srtt = base::TimeDelta::FromMicroseconds(10);
3661 url::SchemeHostPort server("https", kDefaultServerHostName, 3655 url::SchemeHostPort server("https", kDefaultServerHostName,
3662 kDefaultServerPort); 3656 kDefaultServerPort);
3663 http_server_properties_.SetServerNetworkStats(server, stats1); 3657 http_server_properties_.SetServerNetworkStats(server, stats1);
3664 3658
3665 crypto_client_stream_factory_.set_handshake_mode( 3659 crypto_client_stream_factory_.set_handshake_mode(
3666 MockCryptoClientStream::ZERO_RTT); 3660 MockCryptoClientStream::COLD_START);
3667 host_resolver_.set_synchronous_mode(true); 3661 host_resolver_.set_synchronous_mode(true);
3668 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), 3662 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(),
3669 "192.168.0.1", ""); 3663 "192.168.0.1", "");
3670 3664
3671 QuicStreamRequest request(factory_.get()); 3665 QuicStreamRequest request(factory_.get());
3672 EXPECT_EQ(ERR_IO_PENDING, 3666 EXPECT_EQ(ERR_IO_PENDING,
3673 request.Request(host_port_pair_, privacy_mode_, 3667 request.Request(host_port_pair_, privacy_mode_,
3674 /*cert_verify_flags=*/0, url_, "POST", net_log_, 3668 /*cert_verify_flags=*/0, url_, "POST", net_log_,
3675 callback_.callback())); 3669 callback_.callback()));
3676 3670
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
4336 EXPECT_NE(session1, session2); 4330 EXPECT_NE(session1, session2);
4337 4331
4338 EXPECT_EQ(QuicServerId(origin1_, privacy_mode_), session1->server_id()); 4332 EXPECT_EQ(QuicServerId(origin1_, privacy_mode_), session1->server_id());
4339 EXPECT_EQ(QuicServerId(origin2_, privacy_mode_), session2->server_id()); 4333 EXPECT_EQ(QuicServerId(origin2_, privacy_mode_), session2->server_id());
4340 4334
4341 EXPECT_TRUE(AllDataConsumed()); 4335 EXPECT_TRUE(AllDataConsumed());
4342 } 4336 }
4343 4337
4344 } // namespace test 4338 } // namespace test
4345 } // namespace net 4339 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_stream_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698