diff options
author | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 18:52:21 +0000 |
---|---|---|
committer | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 18:52:21 +0000 |
commit | 9fb8cf6994d2c87644f5819b360bfa4d4a5af820 (patch) | |
tree | 03aa196ce0f5217a5c2a569cd013c9c44087ca93 /webkit/appcache/mock_appcache_storage.cc | |
parent | 5d4cd6254ffb1a1f6720803adb8ef611d89df2c3 (diff) | |
download | chromium_src-9fb8cf6994d2c87644f5819b360bfa4d4a5af820.zip chromium_src-9fb8cf6994d2c87644f5819b360bfa4d4a5af820.tar.gz chromium_src-9fb8cf6994d2c87644f5819b360bfa4d4a5af820.tar.bz2 |
Add storage code to appcache update process.
Add storage API for simulating storage errors.
TEST=verify appcache update wrote to storage correctly
BUG=none
Review URL: http://codereview.chromium.org/326002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30612 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/mock_appcache_storage.cc')
-rw-r--r-- | webkit/appcache/mock_appcache_storage.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/webkit/appcache/mock_appcache_storage.cc b/webkit/appcache/mock_appcache_storage.cc index 3c626ec..34bfbb7 100644 --- a/webkit/appcache/mock_appcache_storage.cc +++ b/webkit/appcache/mock_appcache_storage.cc @@ -27,7 +27,9 @@ namespace appcache { MockAppCacheStorage::MockAppCacheStorage(AppCacheService* service) : AppCacheStorage(service), - ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { + ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), + simulate_make_group_obsolete_failure_(false), + simulate_store_group_and_newest_cache_failure_(false) { last_cache_id_ = 0; last_entry_id_ = 0; last_group_id_ = 0; @@ -156,6 +158,12 @@ void MockAppCacheStorage::ProcessStoreGroupAndNewestCache( scoped_refptr<DelegateReference> delegate_ref) { DCHECK(group->newest_complete_cache() == newest_cache.get()); + if (simulate_store_group_and_newest_cache_failure_) { + if (delegate_ref->delegate) + delegate_ref->delegate->OnGroupAndNewestCacheStored(group, false); + return; + } + AddStoredGroup(group); AddStoredCache(group->newest_complete_cache()); @@ -195,6 +203,12 @@ void MockAppCacheStorage::ProcessFindResponseForMainRequest( void MockAppCacheStorage::ProcessMakeGroupObsolete( scoped_refptr<AppCacheGroup> group, scoped_refptr<DelegateReference> delegate_ref) { + if (simulate_make_group_obsolete_failure_) { + if (delegate_ref->delegate) + delegate_ref->delegate->OnGroupMadeObsolete(group, false); + return; + } + RemoveStoredGroup(group); if (group->newest_complete_cache()) RemoveStoredCache(group->newest_complete_cache()); |