diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 21:42:25 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 21:42:25 +0000 |
commit | 550890ec7f1cf968abc4544b170e97a67f919902 (patch) | |
tree | 632dec32bed5266837a2668a9225d303303e3160 /webkit/appcache/appcache_response_unittest.cc | |
parent | ed249ab7916d438b0bdb650a796aaf709f6ae1ae (diff) | |
download | chromium_src-550890ec7f1cf968abc4544b170e97a67f919902.zip chromium_src-550890ec7f1cf968abc4544b170e97a67f919902.tar.gz chromium_src-550890ec7f1cf968abc4544b170e97a67f919902.tar.bz2 |
MockAppCacheStorage implemention
This is a quick and easy 'mock' implementation of the storage interface
that doesn't put anything to disk.
We simply add an extra reference to objects when they're put in storage,
and remove the extra reference when they are removed from storage.
Responses are never really removed from the in-memory disk cache.
Delegate callbacks are made asyncly to appropiately mimic what will
happen with a real disk-backed storage impl that involves IO on a
background thread.
This is for use in unit tests and to initially bring up the appcache
related layout tests.
TEST=mock_appcache_storage_unittest.cc
BUG=none
Review URL: http://codereview.chromium.org/300043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_response_unittest.cc')
-rw-r--r-- | webkit/appcache/appcache_response_unittest.cc | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/webkit/appcache/appcache_response_unittest.cc b/webkit/appcache/appcache_response_unittest.cc index 854ac01..939086e 100644 --- a/webkit/appcache/appcache_response_unittest.cc +++ b/webkit/appcache/appcache_response_unittest.cc @@ -287,46 +287,6 @@ class AppCacheResponseTest : public testing::Test { // Most of the individual tests involve multiple async steps. Each test // is delineated with a section header. - // DelegateReferences ------------------------------------------------------- - // TODO(michaeln): maybe this one belongs in appcache_storage_unittest.cc - void DelegateReferences() { - typedef scoped_refptr<AppCacheStorage::DelegateReference> - ScopedDelegateReference; - MockStorageDelegate delegate(this); - ScopedDelegateReference delegate_reference1; - ScopedDelegateReference delegate_reference2; - - EXPECT_FALSE(service_->storage()->GetDelegateReference(&delegate)); - - delegate_reference1 = - service_->storage()->GetOrCreateDelegateReference(&delegate); - EXPECT_TRUE(delegate_reference1.get()); - EXPECT_TRUE(delegate_reference1->HasOneRef()); - EXPECT_TRUE(service_->storage()->GetDelegateReference(&delegate)); - EXPECT_EQ(&delegate, - service_->storage()->GetDelegateReference(&delegate)->delegate); - EXPECT_EQ(service_->storage()->GetDelegateReference(&delegate), - service_->storage()->GetOrCreateDelegateReference(&delegate)); - delegate_reference1 = NULL; - EXPECT_FALSE(service_->storage()->GetDelegateReference(&delegate)); - - delegate_reference1 = - service_->storage()->GetOrCreateDelegateReference(&delegate); - service_->storage()->CancelDelegateCallbacks(&delegate); - EXPECT_TRUE(delegate_reference1.get()); - EXPECT_TRUE(delegate_reference1->HasOneRef()); - EXPECT_FALSE(delegate_reference1->delegate); - EXPECT_FALSE(service_->storage()->GetDelegateReference(&delegate)); - - delegate_reference2 = - service_->storage()->GetOrCreateDelegateReference(&delegate); - EXPECT_TRUE(delegate_reference2.get()); - EXPECT_TRUE(delegate_reference2->HasOneRef()); - EXPECT_EQ(&delegate, delegate_reference2->delegate); - EXPECT_NE(delegate_reference1.get(), delegate_reference2.get()); - - TestFinished(); - } // ReadNonExistentResponse ------------------------------------------- void ReadNonExistentResponse() { @@ -680,10 +640,6 @@ class AppCacheResponseTest : public testing::Test { // static scoped_ptr<base::Thread> AppCacheResponseTest::io_thread_; -TEST_F(AppCacheResponseTest, DelegateReferences) { - RunTestOnIOThread(&AppCacheResponseTest::DelegateReferences); -} - TEST_F(AppCacheResponseTest, ReadNonExistentResponse) { RunTestOnIOThread(&AppCacheResponseTest::ReadNonExistentResponse); } |