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

Unified Diff: net/disk_cache/backend_unittest.cc

Issue 45061: Disk cache: Add a unit test that instantiates three caches... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 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 | « no previous file | net/disk_cache/disk_cache_test_util.h » ('j') | net/disk_cache/disk_cache_test_util.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/backend_unittest.cc
===================================================================
--- net/disk_cache/backend_unittest.cc (revision 12520)
+++ net/disk_cache/backend_unittest.cc (working copy)
@@ -995,3 +995,31 @@
InitCache();
BackendDoomAll();
}
+
+// We should be able to create the same entry on multiple simultaneous instances
+// of the cache.
+TEST_F(DiskCacheTest, MultipleInstances) {
+ ScopedTestCache store1;
+ ScopedTestCache store2(L"cache_test2");
+ ScopedTestCache store3(L"cache_test3");
+
+ const int kNumberOfCaches = 3;
+ scoped_ptr<disk_cache::Backend> cache[kNumberOfCaches];
+
+ cache[0].reset(disk_cache::CreateCacheBackend(store1.path_wstring(), false, 0,
+ net::DISK_CACHE));
+ cache[1].reset(disk_cache::CreateCacheBackend(store2.path_wstring(), false, 0,
+ net::MEDIA_CACHE));
+ cache[2].reset(disk_cache::CreateCacheBackend(store3.path_wstring(), false, 0,
+ net::TEMP_MEDIA_CACHE));
+
+ ASSERT_TRUE(cache[0].get() != NULL && cache[1].get() != NULL &&
+ cache[2].get() != NULL);
+
+ std::string key("the first key");
+ disk_cache::Entry* entry;
+ for (int i = 0; i < kNumberOfCaches; i++) {
+ ASSERT_TRUE(cache[i]->CreateEntry(key, &entry));
+ entry->Close();
+ }
+}
« no previous file with comments | « no previous file | net/disk_cache/disk_cache_test_util.h » ('j') | net/disk_cache/disk_cache_test_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698