summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/disk_cache_test_util.h
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-18 23:46:58 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-18 23:46:58 +0000
commit84d4ceeee6546783aff920ba0625c0ce01f624ef (patch)
tree502d43daabfcabfc08a8b5b24cf302ddbe265cfa /net/disk_cache/disk_cache_test_util.h
parenta8c1a314d8277b7ce4f701ce73957146e61a215f (diff)
downloadchromium_src-84d4ceeee6546783aff920ba0625c0ce01f624ef.zip
chromium_src-84d4ceeee6546783aff920ba0625c0ce01f624ef.tar.gz
chromium_src-84d4ceeee6546783aff920ba0625c0ce01f624ef.tar.bz2
Disk cache: First pass to add support for sparse entries.
Adding Read/Write support. BUG=12258 TEST=unittests. original review: http://codereview.chromium.org/126179 Review URL: http://codereview.chromium.org/132031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18772 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/disk_cache_test_util.h')
-rw-r--r--net/disk_cache/disk_cache_test_util.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/net/disk_cache/disk_cache_test_util.h b/net/disk_cache/disk_cache_test_util.h
index 45abe5b..9e17512 100644
--- a/net/disk_cache/disk_cache_test_util.h
+++ b/net/disk_cache/disk_cache_test_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2009 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.
@@ -11,6 +11,7 @@
#include "base/message_loop.h"
#include "base/task.h"
#include "base/timer.h"
+#include "net/base/test_completion_callback.h"
// Re-creates a given test file inside the cache test folder.
bool CreateCacheTestFile(const wchar_t* name);
@@ -53,7 +54,8 @@ class ScopedTestCache {
// -----------------------------------------------------------------------
-// Simple callback to process IO completions from the cache.
+// Simple callback to process IO completions from the cache. It allows tests
+// with multiple simultaneous IO operations.
class CallbackTest : public CallbackRunner< Tuple1<int> > {
public:
explicit CallbackTest(bool reuse) : result_(-1), reuse_(reuse ? 0 : 1) {}
@@ -70,6 +72,24 @@ class CallbackTest : public CallbackRunner< Tuple1<int> > {
// -----------------------------------------------------------------------
+// Simple callback to process IO completions from the cache. This object is not
+// intended to be used when multiple IO operations are in-flight at the same
+// time.
+class SimpleCallbackTest : public TestCompletionCallback {
+ public:
+ SimpleCallbackTest() {}
+ ~SimpleCallbackTest() {}
+
+ // Returns the final result of the IO operation. If |result| is
+ // net::ERR_IO_PENDING, it waits for the callback be invoked.
+ int GetResult(int result);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SimpleCallbackTest);
+};
+
+// -----------------------------------------------------------------------
+
// Simple helper to deal with the message loop on a test.
class MessageLoopHelper {
public: