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

Unified Diff: net/http/http_cache_unittest.cc

Issue 478763004: Bypass http cache for concurrent range requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits. Created 6 years, 4 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 | « net/http/http_cache_transaction.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache_unittest.cc
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 4987c37b025a6aa89f8279586e4b811ba6ad9c30..8473f5c00ffaee1d64ff13de6f30009ca36fad8c 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -6790,3 +6790,35 @@ TEST(HttpCache, ResourceFreshnessHeaderNotSent) {
EXPECT_EQ(2, cache.network_layer()->transaction_count());
}
+
+// Tests that we allow multiple simultaneous, non-overlapping transactions to
+// take place on a sparse entry.
+TEST(HttpCache, RangeGET_MultipleRequests) {
+ MockHttpCache cache;
+
+ // Create a transaction for bytes 0-9.
+ MockHttpRequest request(kRangeGET_TransactionOK);
+ MockTransaction transaction(kRangeGET_TransactionOK);
+ transaction.request_headers = "Range: bytes = 0-9\r\n" EXTRA_HEADER;
+ transaction.data = "rg: 00-09 ";
+ AddMockTransaction(&transaction);
+
+ net::TestCompletionCallback callback;
+ scoped_ptr<net::HttpTransaction> trans;
+ int rv = cache.http_cache()->CreateTransaction(net::DEFAULT_PRIORITY, &trans);
+ EXPECT_EQ(net::OK, rv);
+ ASSERT_TRUE(trans.get());
+
+ // Start our transaction.
+ trans->Start(&request, callback.callback(), net::BoundNetLog());
+
+ // A second transaction on a different part of the file (the default
+ // kRangeGET_TransactionOK requests 40-49) should not be blocked by
+ // the already pending transaction.
+ RunTransactionTest(cache.http_cache(), kRangeGET_TransactionOK);
+
+ // Let the first transaction complete.
+ callback.WaitForResult();
+
+ RemoveMockTransaction(&transaction);
+}
« no previous file with comments | « net/http/http_cache_transaction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698