summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/mock_appcache_storage.h
diff options
context:
space:
mode:
authorjennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 18:52:21 +0000
committerjennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 18:52:21 +0000
commit9fb8cf6994d2c87644f5819b360bfa4d4a5af820 (patch)
tree03aa196ce0f5217a5c2a569cd013c9c44087ca93 /webkit/appcache/mock_appcache_storage.h
parent5d4cd6254ffb1a1f6720803adb8ef611d89df2c3 (diff)
downloadchromium_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.h')
-rw-r--r--webkit/appcache/mock_appcache_storage.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/webkit/appcache/mock_appcache_storage.h b/webkit/appcache/mock_appcache_storage.h
index ca6bd70..eaf742b 100644
--- a/webkit/appcache/mock_appcache_storage.h
+++ b/webkit/appcache/mock_appcache_storage.h
@@ -41,6 +41,8 @@ class MockAppCacheStorage : public AppCacheStorage {
const GURL& manifest_url, const std::vector<int64>& response_ids);
private:
+ friend class AppCacheUpdateJobTest;
+
typedef base::hash_map<int64, scoped_refptr<AppCache> > StoredCacheMap;
typedef std::map<GURL, scoped_refptr<AppCacheGroup> > StoredGroupMap;
typedef std::set<int64> DoomedResponseIds;
@@ -70,6 +72,9 @@ class MockAppCacheStorage : public AppCacheStorage {
void AddStoredGroup(AppCacheGroup* group);
void RemoveStoredGroup(AppCacheGroup* group);
+ bool IsGroupStored(const AppCacheGroup* group) {
+ return stored_groups_.find(group->manifest_url()) != stored_groups_.end();
+ }
// These helpers determine when certain operations should complete
// asynchronously vs synchronously to faithfully mimic, or mock,
@@ -87,6 +92,14 @@ class MockAppCacheStorage : public AppCacheStorage {
return disk_cache_.get();
}
+ // Simulate failures for testing.
+ void SimulateMakeGroupObsoleteFailure() {
+ simulate_make_group_obsolete_failure_ = true;
+ }
+ void SimulateStoreGroupAndNewestCacheFailure() {
+ simulate_store_group_and_newest_cache_failure_ = true;
+ }
+
StoredCacheMap stored_caches_;
StoredGroupMap stored_groups_;
DoomedResponseIds doomed_response_ids_;
@@ -94,6 +107,9 @@ class MockAppCacheStorage : public AppCacheStorage {
std::deque<Task*> pending_tasks_;
ScopedRunnableMethodFactory<MockAppCacheStorage> method_factory_;
+ bool simulate_make_group_obsolete_failure_;
+ bool simulate_store_group_and_newest_cache_failure_;
+
FRIEND_TEST(MockAppCacheStorageTest, CreateGroup);
FRIEND_TEST(MockAppCacheStorageTest, LoadCache_FarHit);
FRIEND_TEST(MockAppCacheStorageTest, LoadGroupAndCache_FarHit);