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

Unified Diff: net/http/http_pipelined_network_transaction_unittest.cc

Issue 9567025: Ensure pipelined requests are sent in the same order they're queued. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Clean up unit test Created 8 years, 10 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
« no previous file with comments | « chrome/browser/net/http_pipelining_compatibility_client.cc ('k') | net/http/http_stream_factory_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_pipelined_network_transaction_unittest.cc
diff --git a/net/http/http_pipelined_network_transaction_unittest.cc b/net/http/http_pipelined_network_transaction_unittest.cc
index 65794daa31bc8679c2cb5f4f8d550cf9a1ae1e9f..4949e225a0cc8c4cc6a584c82c2f116914678939 100644
--- a/net/http/http_pipelined_network_transaction_unittest.cc
+++ b/net/http/http_pipelined_network_transaction_unittest.cc
@@ -860,6 +860,70 @@ TEST_F(HttpPipelinedNetworkTransactionTest, ForcedPipelineEvictionIsFatal) {
EXPECT_EQ(ERR_PIPELINE_EVICTION, two_callback.WaitForResult());
}
+TEST_F(HttpPipelinedNetworkTransactionTest, ForcedPipelineOrder) {
+ Initialize(true);
+
+ MockWrite writes[] = {
+ MockWrite(ASYNC, 0,
+ "GET /one.html HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Connection: keep-alive\r\n\r\n"
+ "GET /two.html HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Connection: keep-alive\r\n\r\n"
+ "GET /three.html HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Connection: keep-alive\r\n\r\n"
+ "GET /four.html HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Connection: keep-alive\r\n\r\n"
+ ),
+ };
+ MockRead reads[] = {
+ MockRead(ASYNC, ERR_FAILED, 1),
+ };
+ scoped_refptr<DeterministicSocketData> data(new DeterministicSocketData(
+ reads, arraysize(reads), writes, arraysize(writes)));
+ data->set_connect_data(MockConnect(ASYNC, OK));
+ factory_.AddSocketDataProvider(data);
+
+ scoped_ptr<HttpNetworkTransaction> one_transaction(
+ new HttpNetworkTransaction(session_.get()));
+ TestCompletionCallback one_callback;
+ EXPECT_EQ(ERR_IO_PENDING,
+ one_transaction->Start(GetRequestInfo("one.html"),
+ one_callback.callback(), BoundNetLog()));
+
+ scoped_ptr<HttpNetworkTransaction> two_transaction(
+ new HttpNetworkTransaction(session_.get()));
+ TestCompletionCallback two_callback;
+ EXPECT_EQ(ERR_IO_PENDING,
+ two_transaction->Start(GetRequestInfo("two.html"),
+ two_callback.callback(), BoundNetLog()));
+
+ scoped_ptr<HttpNetworkTransaction> three_transaction(
+ new HttpNetworkTransaction(session_.get()));
+ TestCompletionCallback three_callback;
+ EXPECT_EQ(ERR_IO_PENDING,
+ three_transaction->Start(GetRequestInfo("three.html"),
+ three_callback.callback(), BoundNetLog()));
+
+ scoped_ptr<HttpNetworkTransaction> four_transaction(
+ new HttpNetworkTransaction(session_.get()));
+ TestCompletionCallback four_callback;
+ EXPECT_EQ(ERR_IO_PENDING,
+ four_transaction->Start(GetRequestInfo("four.html"),
+ four_callback.callback(), BoundNetLog()));
+
+ data->RunFor(3);
+ EXPECT_EQ(ERR_FAILED, one_callback.WaitForResult());
+ one_transaction.reset();
+ EXPECT_EQ(ERR_PIPELINE_EVICTION, two_callback.WaitForResult());
+ two_transaction.reset();
+ EXPECT_EQ(ERR_PIPELINE_EVICTION, three_callback.WaitForResult());
+ three_transaction.reset();
+ EXPECT_EQ(ERR_PIPELINE_EVICTION, four_callback.WaitForResult());
+}
} // anonymous namespace
} // namespace net
« no previous file with comments | « chrome/browser/net/http_pipelining_compatibility_client.cc ('k') | net/http/http_stream_factory_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698