summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/entry_unittest.cc
diff options
context:
space:
mode:
authortbreisacher@chromium.org <tbreisacher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-22 11:29:34 +0000
committertbreisacher@chromium.org <tbreisacher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-22 11:29:34 +0000
commitf27bbe00ec90a4be512033f500ec933508ea3532 (patch)
tree02fbe9e68db7c59afb918efc4601e6f0eb3d56b7 /net/disk_cache/entry_unittest.cc
parent61af999511b96b3a9adffdb657f312771e8658e3 (diff)
downloadchromium_src-f27bbe00ec90a4be512033f500ec933508ea3532.zip
chromium_src-f27bbe00ec90a4be512033f500ec933508ea3532.tar.gz
chromium_src-f27bbe00ec90a4be512033f500ec933508ea3532.tar.bz2
base::Bind: disk_cache_test_base.(cc|h)
BUG=NONE TEST=NONE TBR= rtenneti@chromium.org Review URL: http://codereview.chromium.org/9019036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115516 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/entry_unittest.cc')
-rw-r--r--net/disk_cache/entry_unittest.cc44
1 files changed, 9 insertions, 35 deletions
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc
index cf9e6cd..f81e9d4 100644
--- a/net/disk_cache/entry_unittest.cc
+++ b/net/disk_cache/entry_unittest.cc
@@ -53,27 +53,6 @@ class DiskCacheEntryTest : public DiskCacheTestWithCache {
void PartialSparseEntry();
};
-// Simple task to run part of a test from the cache thread.
-class SyncIOTask : public Task {
- public:
- SyncIOTask(DiskCacheEntryTest* test, disk_cache::Entry* entry)
- : test_(test), entry_(entry) {}
-
- protected:
- DiskCacheEntryTest* test_;
- disk_cache::Entry* entry_;
-};
-
-class InternalSyncIOTask : public SyncIOTask {
- public:
- InternalSyncIOTask(DiskCacheEntryTest* test, disk_cache::Entry* entry)
- : SyncIOTask(test, entry) {}
-
- virtual void Run() {
- test_->InternalSyncIOBackground(entry_);
- }
-};
-
// This part of the test runs on the background thread.
void DiskCacheEntryTest::InternalSyncIOBackground(disk_cache::Entry* entry) {
const int kSize1 = 10;
@@ -134,8 +113,11 @@ void DiskCacheEntryTest::InternalSyncIO() {
ASSERT_EQ(net::OK, CreateEntry("the first key", &entry));
ASSERT_TRUE(NULL != entry);
- // The bulk of the test runs from within the task, on the cache thread.
- RunTaskForTest(new InternalSyncIOTask(this, entry));
+ // The bulk of the test runs from within the callback, on the cache thread.
+ RunTaskForTest(base::Bind(&DiskCacheEntryTest::InternalSyncIOBackground,
+ base::Unretained(this),
+ entry));
+
entry->Doom();
entry->Close();
@@ -317,16 +299,6 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyInternalAsyncIO) {
InternalAsyncIO();
}
-class ExternalSyncIOTask : public SyncIOTask {
- public:
- ExternalSyncIOTask(DiskCacheEntryTest* test, disk_cache::Entry* entry)
- : SyncIOTask(test, entry) {}
-
- virtual void Run() {
- test_->ExternalSyncIOBackground(entry_);
- }
-};
-
// This part of the test runs on the background thread.
void DiskCacheEntryTest::ExternalSyncIOBackground(disk_cache::Entry* entry) {
const int kSize1 = 17000;
@@ -375,8 +347,10 @@ void DiskCacheEntryTest::ExternalSyncIO() {
disk_cache::Entry* entry;
ASSERT_EQ(net::OK, CreateEntry("the first key", &entry));
- // The bulk of the test runs from within the task, on the cache thread.
- RunTaskForTest(new ExternalSyncIOTask(this, entry));
+ // The bulk of the test runs from within the callback, on the cache thread.
+ RunTaskForTest(base::Bind(&DiskCacheEntryTest::ExternalSyncIOBackground,
+ base::Unretained(this),
+ entry));
entry->Doom();
entry->Close();