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

Unified Diff: net/disk_cache/disk_cache_perftest.cc

Issue 8463031: Disk cache: Simplyfy some of the test infrastructure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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/block_files_unittest.cc ('k') | net/disk_cache/disk_cache_test_base.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
===================================================================
--- net/disk_cache/disk_cache_perftest.cc (revision 109713)
+++ net/disk_cache/disk_cache_perftest.cc (working copy)
@@ -5,8 +5,6 @@
#include <string>
#include "base/basictypes.h"
-#include "base/file_path.h"
-#include "base/file_util.h"
#include "base/perftimer.h"
#include "base/string_util.h"
#include "base/threading/thread.h"
@@ -16,7 +14,9 @@
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/disk_cache/block_files.h"
+#include "net/disk_cache/backend_impl.h"
#include "net/disk_cache/disk_cache.h"
+#include "net/disk_cache/disk_cache_test_base.h"
#include "net/disk_cache/disk_cache_test_util.h"
#include "net/disk_cache/hash.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -24,8 +24,6 @@
using base::Time;
-typedef PlatformTest DiskCacheTest;
-
namespace {
struct TestEntry {
@@ -151,17 +149,15 @@
}
TEST_F(DiskCacheTest, CacheBackendPerformance) {
- MessageLoopForIO message_loop;
-
base::Thread cache_thread("CacheThread");
ASSERT_TRUE(cache_thread.StartWithOptions(
base::Thread::Options(MessageLoop::TYPE_IO, 0)));
- ScopedTestCache test_cache;
+ ASSERT_TRUE(CleanupCacheDir());
TestOldCompletionCallback cb;
disk_cache::Backend* cache;
int rv = disk_cache::CreateCacheBackend(
- net::DISK_CACHE, test_cache.path(), 0, false,
+ net::DISK_CACHE, cache_path_, 0, false,
cache_thread.message_loop_proxy(), NULL, &cache, &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
@@ -178,17 +174,17 @@
delete cache;
ASSERT_TRUE(file_util::EvictFileFromSystemCache(
- test_cache.path().AppendASCII("index")));
+ cache_path_.AppendASCII("index")));
ASSERT_TRUE(file_util::EvictFileFromSystemCache(
- test_cache.path().AppendASCII("data_0")));
+ cache_path_.AppendASCII("data_0")));
ASSERT_TRUE(file_util::EvictFileFromSystemCache(
- test_cache.path().AppendASCII("data_1")));
+ cache_path_.AppendASCII("data_1")));
ASSERT_TRUE(file_util::EvictFileFromSystemCache(
- test_cache.path().AppendASCII("data_2")));
+ cache_path_.AppendASCII("data_2")));
ASSERT_TRUE(file_util::EvictFileFromSystemCache(
- test_cache.path().AppendASCII("data_3")));
+ cache_path_.AppendASCII("data_3")));
- rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, test_cache.path(), 0,
+ rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, cache_path_, 0,
false, cache_thread.message_loop_proxy(),
NULL, &cache, &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
@@ -207,11 +203,9 @@
// fragmented, or if we have multiple files. This test measures that scenario,
// by using multiple, highly fragmented files.
TEST_F(DiskCacheTest, BlockFilesPerformance) {
- MessageLoopForIO message_loop;
+ ASSERT_TRUE(CleanupCacheDir());
- ScopedTestCache test_cache;
-
- disk_cache::BlockFiles files(test_cache.path());
+ disk_cache::BlockFiles files(cache_path_);
ASSERT_TRUE(files.Init(true));
int seed = static_cast<int>(Time::Now().ToInternalValue());
« no previous file with comments | « net/disk_cache/block_files_unittest.cc ('k') | net/disk_cache/disk_cache_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698