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

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

Issue 1119803006: Revert of Add AllReadDataConsumed and AllWriteDataConsumed methods to SocketDataProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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_http_stream_test.cc ('k') | net/quic/quic_stream_factory_test.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 <vector> 5 #include <vector>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 // The HTTP transaction will complete. 790 // The HTTP transaction will complete.
791 DeterministicSocketData http_data2(http_reads, arraysize(http_reads), 791 DeterministicSocketData http_data2(http_reads, arraysize(http_reads),
792 http_writes, arraysize(http_writes)); 792 http_writes, arraysize(http_writes));
793 socket_factory.AddSocketDataProvider(&http_data2); 793 socket_factory.AddSocketDataProvider(&http_data2);
794 794
795 CreateSessionWithFactory(&socket_factory, true); 795 CreateSessionWithFactory(&socket_factory, true);
796 796
797 // Run the first request. 797 // Run the first request.
798 http_data.StopAfter(arraysize(http_reads) + arraysize(http_writes)); 798 http_data.StopAfter(arraysize(http_reads) + arraysize(http_writes));
799 SendRequestAndExpectHttpResponse("hello world"); 799 SendRequestAndExpectHttpResponse("hello world");
800 ASSERT_TRUE(http_data.AllReadDataConsumed()); 800 ASSERT_TRUE(http_data.at_read_eof());
801 ASSERT_TRUE(http_data.AllWriteDataConsumed()); 801 ASSERT_TRUE(http_data.at_write_eof());
802 802
803 // Now run the second request in which the QUIC socket hangs, 803 // Now run the second request in which the QUIC socket hangs,
804 // and verify the the transaction continues over HTTP. 804 // and verify the the transaction continues over HTTP.
805 http_data2.StopAfter(arraysize(http_reads) + arraysize(http_writes)); 805 http_data2.StopAfter(arraysize(http_reads) + arraysize(http_writes));
806 SendRequestAndExpectHttpResponse("hello world"); 806 SendRequestAndExpectHttpResponse("hello world");
807 807
808 ASSERT_TRUE(http_data2.AllReadDataConsumed()); 808 ASSERT_TRUE(http_data2.at_read_eof());
809 ASSERT_TRUE(http_data2.AllWriteDataConsumed()); 809 ASSERT_TRUE(http_data2.at_write_eof());
810 ASSERT_TRUE(!quic_data.AllReadDataConsumed()); 810 ASSERT_TRUE(!quic_data.at_read_eof());
811 ASSERT_TRUE(!quic_data.AllWriteDataConsumed()); 811 ASSERT_TRUE(!quic_data.at_write_eof());
812 } 812 }
813 813
814 TEST_P(QuicNetworkTransactionTest, ZeroRTTWithHttpRace) { 814 TEST_P(QuicNetworkTransactionTest, ZeroRTTWithHttpRace) {
815 MockQuicData mock_quic_data; 815 MockQuicData mock_quic_data;
816 mock_quic_data.AddWrite( 816 mock_quic_data.AddWrite(
817 ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true, 817 ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true,
818 GetRequestHeaders("GET", "http", "/"))); 818 GetRequestHeaders("GET", "http", "/")));
819 mock_quic_data.AddRead( 819 mock_quic_data.AddRead(
820 ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false, 820 ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false,
821 GetResponseHeaders("200 OK"))); 821 GetResponseHeaders("200 OK")));
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 socket_factory_.AddSocketDataProvider(&http_data); 1071 socket_factory_.AddSocketDataProvider(&http_data);
1072 1072
1073 CreateSessionWithNextProtos(); 1073 CreateSessionWithNextProtos();
1074 1074
1075 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); 1075 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT);
1076 1076
1077 SendRequestAndExpectHttpResponse("hello from http"); 1077 SendRequestAndExpectHttpResponse("hello from http");
1078 1078
1079 ExpectBrokenAlternateProtocolMapping(); 1079 ExpectBrokenAlternateProtocolMapping();
1080 1080
1081 EXPECT_TRUE(quic_data.AllReadDataConsumed()); 1081 EXPECT_TRUE(quic_data.at_read_eof());
1082 EXPECT_TRUE(quic_data.AllWriteDataConsumed()); 1082 EXPECT_TRUE(quic_data.at_write_eof());
1083 } 1083 }
1084 1084
1085 TEST_P(QuicNetworkTransactionTest, DISABLED_HangingZeroRttFallback) { 1085 TEST_P(QuicNetworkTransactionTest, DISABLED_HangingZeroRttFallback) {
1086 // Alternate-protocol job 1086 // Alternate-protocol job
1087 MockRead quic_reads[] = { 1087 MockRead quic_reads[] = {
1088 MockRead(ASYNC, ERR_IO_PENDING), 1088 MockRead(ASYNC, ERR_IO_PENDING),
1089 }; 1089 };
1090 StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads), 1090 StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads),
1091 nullptr, 0); 1091 nullptr, 0);
1092 socket_factory_.AddSocketDataProvider(&quic_data); 1092 socket_factory_.AddSocketDataProvider(&quic_data);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 nullptr, 1172 nullptr,
1173 net_log_.bound()); 1173 net_log_.bound());
1174 1174
1175 CreateSessionWithNextProtos(); 1175 CreateSessionWithNextProtos();
1176 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); 1176 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT);
1177 SendRequestAndExpectHttpResponse("hello world"); 1177 SendRequestAndExpectHttpResponse("hello world");
1178 } 1178 }
1179 1179
1180 } // namespace test 1180 } // namespace test
1181 } // namespace net 1181 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_http_stream_test.cc ('k') | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698