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

Unified Diff: content/browser/cache_storage/cache_storage_manager_unittest.cc

Issue 2179353003: [CacheStorage] Check doomed caches first when dropping cache handles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the test to work around a different bug Created 4 years, 5 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 | « content/browser/cache_storage/cache_storage.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/cache_storage/cache_storage_manager_unittest.cc
diff --git a/content/browser/cache_storage/cache_storage_manager_unittest.cc b/content/browser/cache_storage/cache_storage_manager_unittest.cc
index 3de06912099609fb830e84b088dc0efa540b38eb..1cb0439ccff6d6bc63ea8beb5fd271a20f5a3b52 100644
--- a/content/browser/cache_storage/cache_storage_manager_unittest.cc
+++ b/content/browser/cache_storage/cache_storage_manager_unittest.cc
@@ -548,6 +548,31 @@ TEST_F(CacheStorageManagerTest, StorageReuseCacheName) {
EXPECT_TRUE(CachePut(callback_cache_handle_->value(), kTestURL));
}
+TEST_P(CacheStorageManagerTestP, DropRefAfterNewCacheWithSameNameCreated) {
+ // Make sure that dropping the final cache handle to a doomed cache doesn't
+ // affect newer caches with the same name. (see crbug.com/631467)
+
+ // 1. Create cache A and hang onto the handle
+ const GURL kTestURL = GURL("http://example.com/foo");
+ EXPECT_TRUE(Open(origin1_, "foo"));
+ EXPECT_FALSE(CacheMatch(callback_cache_handle_->value(), kTestURL));
+ std::unique_ptr<CacheStorageCacheHandle> cache_handle =
+ std::move(callback_cache_handle_);
+
+ // 2. Doom the cache
+ EXPECT_TRUE(Delete(origin1_, "foo"));
+
+ // 3. Create cache B (with the same name)
+ EXPECT_TRUE(Open(origin1_, "foo"));
+ EXPECT_FALSE(CacheMatch(callback_cache_handle_->value(), kTestURL));
+
+ // 4. Drop handle to A
+ cache_handle.reset();
+
+ // 5. Verify that B still works
+ EXPECT_FALSE(CacheMatch(callback_cache_handle_->value(), kTestURL));
+}
+
TEST_P(CacheStorageManagerTestP, StorageMatchAllEntryExistsTwice) {
EXPECT_TRUE(Open(origin1_, "foo"));
EXPECT_TRUE(CachePutWithStatusCode(callback_cache_handle_->value(),
« no previous file with comments | « content/browser/cache_storage/cache_storage.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698