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

Unified Diff: net/disk_cache/disk_cache_perftest.cc

Issue 2739007: Disk cache: Update the disk cache tools and tests to use... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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.h ('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 49603)
+++ net/disk_cache/disk_cache_perftest.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,10 +9,12 @@
#include "base/file_util.h"
#include "base/perftimer.h"
#include "base/string_util.h"
+#include "base/thread.h"
#include "base/test/test_file_util.h"
#include "base/timer.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
+#include "net/base/test_completion_callback.h"
#include "net/disk_cache/block_files.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/disk_cache_test_util.h"
@@ -154,12 +156,19 @@
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;
- disk_cache::Backend* cache =
- disk_cache::CreateCacheBackend(test_cache.path(), false, 0,
- net::DISK_CACHE);
- ASSERT_TRUE(NULL != cache);
+ TestCompletionCallback cb;
+ disk_cache::Backend* cache;
+ int rv = disk_cache::CreateCacheBackend(
+ net::DISK_CACHE, test_cache.path(), 0, false,
+ cache_thread.message_loop_proxy(), &cache, &cb);
+ ASSERT_EQ(net::OK, cb.GetResult(rv));
+
int seed = static_cast<int>(Time::Now().ToInternalValue());
srand(seed);
@@ -183,9 +192,10 @@
ASSERT_TRUE(file_util::EvictFileFromSystemCache(
test_cache.path().AppendASCII("data_3")));
- cache = disk_cache::CreateCacheBackend(test_cache.path(), false, 0,
- net::DISK_CACHE);
- ASSERT_TRUE(NULL != cache);
+ rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, test_cache.path(), 0,
+ false, cache_thread.message_loop_proxy(),
+ &cache, &cb);
+ ASSERT_EQ(net::OK, cb.GetResult(rv));
ret = TimeRead(num_entries, cache, entries, true);
EXPECT_EQ(ret, g_cache_tests_received);
« no previous file with comments | « net/disk_cache/disk_cache.h ('k') | net/disk_cache/disk_cache_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698