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

Unified Diff: net/disk_cache/disk_cache_perftest.cc

Issue 48003: Make sure that net_perftest doesn't leave temporary files. (Closed)
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') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/disk_cache_perftest.cc
diff --git a/net/disk_cache/disk_cache_perftest.cc b/net/disk_cache/disk_cache_perftest.cc
index 785f93f7532026cc8ec5b3a39daca75c9f78bffd..0abbc5b64e57b9c20dd282ad08b2dc330eaed0de 100644
--- a/net/disk_cache/disk_cache_perftest.cc
+++ b/net/disk_cache/disk_cache_perftest.cc
@@ -157,10 +157,9 @@ TEST_F(DiskCacheTest, Hash) {
TEST_F(DiskCacheTest, CacheBackendPerformance) {
MessageLoopForIO message_loop;
- std::wstring path_wstring = GetCachePath();
- ASSERT_TRUE(DeleteCache(path_wstring.c_str()));
- disk_cache::Backend* cache = disk_cache::CreateCacheBackend(path_wstring,
- false, 0);
+ ScopedTestCache test_cache;
+ disk_cache::Backend* cache =
+ disk_cache::CreateCacheBackend(test_cache.path_wstring(), false, 0);
ASSERT_TRUE(NULL != cache);
int seed = static_cast<int>(Time::Now().ToInternalValue());
@@ -175,20 +174,18 @@ TEST_F(DiskCacheTest, CacheBackendPerformance) {
MessageLoop::current()->RunAllPending();
delete cache;
- FilePath path = FilePath::FromWStringHack(path_wstring);
-
ASSERT_TRUE(file_util::EvictFileFromSystemCache(
- path.AppendASCII("index")));
+ test_cache.path().AppendASCII("index")));
ASSERT_TRUE(file_util::EvictFileFromSystemCache(
- path.AppendASCII("data_0")));
+ test_cache.path().AppendASCII("data_0")));
ASSERT_TRUE(file_util::EvictFileFromSystemCache(
- path.AppendASCII("data_1")));
+ test_cache.path().AppendASCII("data_1")));
ASSERT_TRUE(file_util::EvictFileFromSystemCache(
- path.AppendASCII("data_2")));
+ test_cache.path().AppendASCII("data_2")));
ASSERT_TRUE(file_util::EvictFileFromSystemCache(
- path.AppendASCII("data_3")));
+ test_cache.path().AppendASCII("data_3")));
- cache = disk_cache::CreateCacheBackend(path_wstring, false, 0);
+ cache = disk_cache::CreateCacheBackend(test_cache.path_wstring(), false, 0);
ASSERT_TRUE(NULL != cache);
ret = TimeRead(num_entries, cache, entries, true);
@@ -208,10 +205,10 @@ TEST_F(DiskCacheTest, CacheBackendPerformance) {
// by using multiple, highly fragmented files.
TEST_F(DiskCacheTest, BlockFilesPerformance) {
MessageLoopForIO message_loop;
- std::wstring path = GetCachePath();
- ASSERT_TRUE(DeleteCache(path.c_str()));
- disk_cache::BlockFiles files(path);
+ ScopedTestCache test_cache;
+
+ disk_cache::BlockFiles files(test_cache.path_wstring());
ASSERT_TRUE(files.Init(true));
int seed = static_cast<int>(Time::Now().ToInternalValue());
« no previous file with comments | « no previous file | net/disk_cache/disk_cache_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698