diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-16 18:53:12 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-16 18:53:12 +0000 |
commit | 39eee12e58ed3ffe2986888acacaa7fcc746a53f (patch) | |
tree | 24bdf9b16fd33e11a614360f61013226e28b5d44 /net/disk_cache/disk_cache_perftest.cc | |
parent | 611cad45a3bc67189d273eaba0171b96f7bdbd97 (diff) | |
download | chromium_src-39eee12e58ed3ffe2986888acacaa7fcc746a53f.zip chromium_src-39eee12e58ed3ffe2986888acacaa7fcc746a53f.tar.gz chromium_src-39eee12e58ed3ffe2986888acacaa7fcc746a53f.tar.bz2 |
Make sure that net_perftest doesn't leave temporary files.
BUG=8580
Review URL: http://codereview.chromium.org/48003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11753 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/disk_cache_perftest.cc')
-rw-r--r-- | net/disk_cache/disk_cache_perftest.cc | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/net/disk_cache/disk_cache_perftest.cc b/net/disk_cache/disk_cache_perftest.cc index 785f93f..0abbc5b 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()); |