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

Unified Diff: net/http/http_cache_unittest.cc

Issue 232003002: Ignore disk cache for concurrent byte range requests to a single resource, to prevent stalling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments on test Created 6 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 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 c87fa1b7eecba7e2f12fef38c342b24e87325947..9de88ae91326daebb3ea3b76a94883bd5c0da7a5 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -4421,6 +4421,38 @@ TEST(HttpCache, RangeGET_Cancel3) {
RemoveMockTransaction(&kRangeGET_TransactionOK);
}
+// 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);
+}
+
// Tests that an invalid range response results in no cached entry.
TEST(HttpCache, RangeGET_InvalidResponse1) {
MockHttpCache cache;
« 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