diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-26 17:00:31 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-26 17:00:31 +0000 |
commit | 5897ea34708d4454d1492576a5983f189f0dcd2f (patch) | |
tree | 5110c082872ebb70f7e6167a9111d79aa46b9e41 /net/disk_cache/backend_unittest.cc | |
parent | 6cf0f62073918db69c7973bcbf083dd6200ba90b (diff) | |
download | chromium_src-5897ea34708d4454d1492576a5983f189f0dcd2f.zip chromium_src-5897ea34708d4454d1492576a5983f189f0dcd2f.tar.gz chromium_src-5897ea34708d4454d1492576a5983f189f0dcd2f.tar.bz2 |
Disk cache: Add a unit test that instantiates three caches
at the same time (for media files).
Review URL: http://codereview.chromium.org/45061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/backend_unittest.cc')
-rw-r--r-- | net/disk_cache/backend_unittest.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index 1562621..9851203 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -995,3 +995,31 @@ TEST_F(DiskCacheBackendTest, MemoryOnlyDoomAll) { 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(); + } +} |