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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/platform_thread.h" 8 #include "base/platform_thread.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 TEST_F(DiskCacheBackendTest, DoomAll) { 988 TEST_F(DiskCacheBackendTest, DoomAll) {
989 InitCache(); 989 InitCache();
990 BackendDoomAll(); 990 BackendDoomAll();
991 } 991 }
992 992
993 TEST_F(DiskCacheBackendTest, MemoryOnlyDoomAll) { 993 TEST_F(DiskCacheBackendTest, MemoryOnlyDoomAll) {
994 SetMemoryOnlyMode(); 994 SetMemoryOnlyMode();
995 InitCache(); 995 InitCache();
996 BackendDoomAll(); 996 BackendDoomAll();
997 } 997 }
998
999 // We should be able to create the same entry on multiple simultaneous instances
1000 // of the cache.
1001 TEST_F(DiskCacheTest, MultipleInstances) {
1002 ScopedTestCache store1;
1003 ScopedTestCache store2(L"cache_test2");
1004 ScopedTestCache store3(L"cache_test3");
1005
1006 const int kNumberOfCaches = 3;
1007 scoped_ptr<disk_cache::Backend> cache[kNumberOfCaches];
1008
1009 cache[0].reset(disk_cache::CreateCacheBackend(store1.path_wstring(), false, 0,
1010 net::DISK_CACHE));
1011 cache[1].reset(disk_cache::CreateCacheBackend(store2.path_wstring(), false, 0,
1012 net::MEDIA_CACHE));
1013 cache[2].reset(disk_cache::CreateCacheBackend(store3.path_wstring(), false, 0,
1014 net::TEMP_MEDIA_CACHE));
1015
1016 ASSERT_TRUE(cache[0].get() != NULL && cache[1].get() != NULL &&
1017 cache[2].get() != NULL);
1018
1019 std::string key("the first key");
1020 disk_cache::Entry* entry;
1021 for (int i = 0; i < kNumberOfCaches; i++) {
1022 ASSERT_TRUE(cache[i]->CreateEntry(key, &entry));
1023 entry->Close();
1024 }
1025 }
OLDNEW
« 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