Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(875)

Unified Diff: webkit/appcache/mock_appcache_storage.h

Issue 326002: Add storage code to appcache update process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/appcache/mock_appcache_storage.h
===================================================================
--- webkit/appcache/mock_appcache_storage.h (revision 30060)
+++ webkit/appcache/mock_appcache_storage.h (working copy)
@@ -41,6 +41,8 @@
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 @@
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 @@
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 @@
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);

Powered by Google App Engine
This is Rietveld 408576698