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

Unified Diff: net/disk_cache/disk_cache_test_util.h

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 | « net/disk_cache/disk_cache_perftest.cc ('k') | net/disk_cache/disk_cache_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/disk_cache_test_util.h
diff --git a/net/disk_cache/disk_cache_test_util.h b/net/disk_cache/disk_cache_test_util.h
index 4277d027b144d225a0b3560eb41508af530a3894..05dce990f7035bdb8a2eecee2c7eb34ba6fc343e 100644
--- a/net/disk_cache/disk_cache_test_util.h
+++ b/net/disk_cache/disk_cache_test_util.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/file_path.h"
#include "base/message_loop.h"
#include "base/task.h"
@@ -32,6 +33,22 @@ std::string GenerateKey(bool same_length);
// Returns true if the cache is not corrupt.
bool CheckCacheIntegrity(const std::wstring& path);
+// Helper class which ensures that the cache dir returned by GetCachePath exists
+// and is clear in ctor and that the directory gets deleted in dtor.
+class ScopedTestCache {
+ public:
+ ScopedTestCache();
+ ~ScopedTestCache();
+
+ FilePath path() const { return FilePath::FromWStringHack(path_); }
+ std::wstring path_wstring() const { return path_; }
+
+ private:
+ const std::wstring path_; // Path to the cache test folder.
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedTestCache);
+};
+
// -----------------------------------------------------------------------
// Simple callback to process IO completions from the cache.
« no previous file with comments | « net/disk_cache/disk_cache_perftest.cc ('k') | net/disk_cache/disk_cache_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698