summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/disk_cache_test_util.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-16 18:53:12 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-16 18:53:12 +0000
commit39eee12e58ed3ffe2986888acacaa7fcc746a53f (patch)
tree24bdf9b16fd33e11a614360f61013226e28b5d44 /net/disk_cache/disk_cache_test_util.cc
parent611cad45a3bc67189d273eaba0171b96f7bdbd97 (diff)
downloadchromium_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_test_util.cc')
-rw-r--r--net/disk_cache/disk_cache_test_util.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc
index 9a15209..555b2e5 100644
--- a/net/disk_cache/disk_cache_test_util.cc
+++ b/net/disk_cache/disk_cache_test_util.cc
@@ -4,6 +4,7 @@
#include "net/disk_cache/disk_cache_test_util.h"
+#include "base/logging.h"
#include "base/file_util.h"
#include "base/path_service.h"
#include "net/disk_cache/backend_impl.h"
@@ -77,6 +78,15 @@ bool CheckCacheIntegrity(const std::wstring& path) {
return cache->SelfCheck() >= 0;
}
+ScopedTestCache::ScopedTestCache() : path_(GetCachePath()) {
+ bool result = DeleteCache(path_.c_str());
+ DCHECK(result);
+}
+
+ScopedTestCache::~ScopedTestCache() {
+ file_util::Delete(path(), true);
+}
+
// -----------------------------------------------------------------------
int g_cache_tests_max_id = 0;