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 e4ccdc71331261647a033c3a506ac0a71dcfd38a..d6f5c3c2c462462ddd31826e7520579e2ef13b48 100644 |
--- a/net/quic/quic_network_transaction_unittest.cc |
+++ b/net/quic/quic_network_transaction_unittest.cc |
@@ -10,6 +10,7 @@ |
#include "base/run_loop.h" |
#include "base/stl_util.h" |
#include "base/strings/stringprintf.h" |
+#include "net/base/chunked_upload_data_stream.h" |
#include "net/base/network_quality_estimator.h" |
#include "net/base/socket_performance_watcher.h" |
#include "net/base/test_completion_callback.h" |
@@ -2259,5 +2260,34 @@ TEST_P(QuicNetworkTransactionTest, SecureResourceOverSecureQuic) { |
EXPECT_TRUE(rtt_observer_.rtt_notification_received()); |
} |
+TEST_P(QuicNetworkTransactionTest, QuicUpload) { |
+ params_.origin_to_force_quic_on = |
+ HostPortPair::FromString("mail.example.com:443"); |
+ |
+ MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
+ MockWrite writes[] = {MockWrite(SYNCHRONOUS, ERR_FAILED, 1)}; |
+ SequencedSocketData socket_data(reads, arraysize(reads), writes, |
+ arraysize(writes)); |
+ socket_factory_.AddSocketDataProvider(&socket_data); |
+ |
+ // 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; |
+ |
+ scoped_ptr<HttpNetworkTransaction> trans( |
+ new HttpNetworkTransaction(DEFAULT_PRIORITY, session_.get())); |
+ TestCompletionCallback callback; |
+ int rv = trans->Start(&request_, callback.callback(), net_log_.bound()); |
+ EXPECT_EQ(ERR_IO_PENDING, rv); |
+ EXPECT_NE(OK, callback.WaitForResult()); |
+} |
+ |
} // namespace test |
} // namespace net |