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

Unified Diff: net/quic/chromium/quic_network_transaction_unittest.cc

Issue 2948143002: Add an async method to QuicChromiumClientSession::Handle for (Closed)
Patch Set: cleanup Created 3 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 side-by-side diff with in-line comments
Download patch
Index: net/quic/chromium/quic_network_transaction_unittest.cc
diff --git a/net/quic/chromium/quic_network_transaction_unittest.cc b/net/quic/chromium/quic_network_transaction_unittest.cc
index 334ae5c7ceaaef58bdab279c5af82c256ee7c8d2..f17afbc285b8fd8b49b855394ca364a73274d6d7 100644
--- a/net/quic/chromium/quic_network_transaction_unittest.cc
+++ b/net/quic/chromium/quic_network_transaction_unittest.cc
@@ -4300,6 +4300,64 @@ TEST_P(QuicNetworkTransactionTest, QuicServerPush) {
EXPECT_LT(0, pos);
}
+// Regression test for http://crbug.com/719461 in which a promised stream
+// is closed before the pushed header arrive, but after the connection
xunjieli 2017/06/21 20:55:28 nit: s/arrive/arrives
Ryan Hamilton 2017/06/21 22:24:51 Done. (Well, s/header/headers/)
+// is closed and before the callbacks are executed.
+TEST_P(QuicNetworkTransactionTest, CancelServerPushAfterConnectionClose) {
+ session_params_.origins_to_force_quic_on.insert(
+ HostPortPair::FromString("mail.example.org:443"));
+
+ MockQuicData mock_quic_data;
+ QuicStreamOffset header_stream_offset = 0;
+ mock_quic_data.AddWrite(
+ ConstructInitialSettingsPacket(1, &header_stream_offset));
+ mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket(
+ 2, GetNthClientInitiatedStreamId(0), true, true,
+ GetRequestHeaders("GET", "https", "/"), &header_stream_offset));
+ QuicStreamOffset server_header_offset = 0;
+ mock_quic_data.AddRead(ConstructServerPushPromisePacket(
+ 1, GetNthClientInitiatedStreamId(0), GetNthServerInitiatedStreamId(0),
+ false, GetRequestHeaders("GET", "https", "/pushed.jpg"),
+ &server_header_offset, &server_maker_));
+ mock_quic_data.AddRead(ConstructServerResponseHeadersPacket(
+ 2, GetNthClientInitiatedStreamId(0), false, false,
+ GetResponseHeaders("200 OK"), &server_header_offset));
xunjieli 2017/06/21 20:55:28 Sorry I am not familiar with how push promise work
Ryan Hamilton 2017/06/21 22:24:51 It's the response headers for the first request ("
+ mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1));
+ mock_quic_data.AddRead(ConstructServerDataPacket(
+ 3, GetNthClientInitiatedStreamId(0), false, true, 0, "hello!"));
xunjieli 2017/06/21 20:55:28 Could you annotate these data packets? Is this th
Ryan Hamilton 2017/06/21 22:24:51 Done.
+ mock_quic_data.AddWrite(SYNCHRONOUS, ERR_FAILED);
+ 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_);
+
+ CreateSession();
+
+ // Send a request which triggers a push promise from the server.
+ SendRequestAndExpectQuicResponse("hello!");
+
+ {
+ // Start a push transaction that will be cancelled after the conneciton
xunjieli 2017/06/21 20:55:28 nit: typo in connection.
Ryan Hamilton 2017/06/21 22:24:51 Done.
+ // is closed, but before the callback is executed.
+ request_.url = GURL("https://mail.example.org/pushed.jpg");
+ HttpNetworkTransaction trans(DEFAULT_PRIORITY, session_.get());
+ TestCompletionCallback callback;
xunjieli 2017/06/21 20:55:28 |callback| should still be notified, right? Can we
Ryan Hamilton 2017/06/21 22:24:51 No, it will not be notified because the transactio
xunjieli 2017/06/22 14:43:30 Acknowledged.
+ int rv = trans.Start(&request_, callback.callback(), net_log_.bound());
+ EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
+ base::RunLoop().RunUntilIdle();
+
+ // Cause the connection to close on a write error.
+ HttpNetworkTransaction trans2(DEFAULT_PRIORITY, session_.get());
+ TestCompletionCallback callback2;
+ request_.url = GURL("https://mail.example.org/");
xunjieli 2017/06/21 20:55:28 nit: do not reuse |request_| for |trans2|. The Tra
Ryan Hamilton 2017/06/21 22:24:51 Done.
+ EXPECT_THAT(trans2.Start(&request_, callback2.callback(), net_log_.bound()),
+ IsError(ERR_IO_PENDING));
+
+ base::RunLoop().RunUntilIdle();
+
+ // When |trans| goes out of scope, the underlying stream will be closed
+ }
xunjieli 2017/06/21 20:55:28 why do we need this extra scope {}?
Ryan Hamilton 2017/06/21 22:24:51 Ah. We need this so that |trans| will be closed. T
xunjieli 2017/06/22 14:43:30 |trans| is going out of scope anyway, right? This
Ryan Hamilton 2017/06/22 20:40:38 Hahahhahahahahaha! Yes, you're obviously right, of
+}
+
TEST_P(QuicNetworkTransactionTest, QuicForceHolBlocking) {
session_params_.quic_force_hol_blocking = true;
session_params_.origins_to_force_quic_on.insert(
« net/quic/chromium/quic_http_stream.cc ('K') | « net/quic/chromium/quic_http_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698