diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-09 00:09:21 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-09 00:09:21 +0000 |
commit | 3367fc1dd134eeaf9ab6e62397f05ad3964319fe (patch) | |
tree | 78fb4d7ac912bbaf47b64f0aaefef331906b5fca /webkit/appcache/mock_appcache_storage.h | |
parent | 9f9e1fcbbd52267fa657b3b0b80ece683ceb6dd6 (diff) | |
download | chromium_src-3367fc1dd134eeaf9ab6e62397f05ad3964319fe.zip chromium_src-3367fc1dd134eeaf9ab6e62397f05ad3964319fe.tar.gz chromium_src-3367fc1dd134eeaf9ab6e62397f05ad3964319fe.tar.bz2 |
AppCache changes to the networking model. Added new classes AppCacheRequestHandler and AppCacheURLRequestJob.
TEST=appcache_url_request_job_unittest.cc, appcache_request_handler_unittest.cc
BUG=none
Review URL: http://codereview.chromium.org/338034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31411 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/mock_appcache_storage.h')
-rw-r--r-- | webkit/appcache/mock_appcache_storage.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/webkit/appcache/mock_appcache_storage.h b/webkit/appcache/mock_appcache_storage.h index eaf742b..c29959a 100644 --- a/webkit/appcache/mock_appcache_storage.h +++ b/webkit/appcache/mock_appcache_storage.h @@ -32,6 +32,10 @@ class MockAppCacheStorage : public AppCacheStorage { virtual void StoreGroupAndNewestCache( AppCacheGroup* group, Delegate* delegate); virtual void FindResponseForMainRequest(const GURL& url, Delegate* delegate); + virtual void FindResponseForSubRequest( + AppCache* cache, const GURL& url, + AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry, + bool * found_network_namespace); virtual void MarkEntryAsForeign(const GURL& entry_url, int64 cache_id); virtual void MakeGroupObsolete(AppCacheGroup* group, Delegate* delegate); virtual AppCacheResponseReader* CreateResponseReader( @@ -41,6 +45,7 @@ class MockAppCacheStorage : public AppCacheStorage { const GURL& manifest_url, const std::vector<int64>& response_ids); private: + friend class AppCacheRequestHandlerTest; friend class AppCacheUpdateJobTest; typedef base::hash_map<int64, scoped_refptr<AppCache> > StoredCacheMap; @@ -100,6 +105,32 @@ class MockAppCacheStorage : public AppCacheStorage { simulate_store_group_and_newest_cache_failure_ = true; } + // Simulate FindResponseFor results for testing. + void SimulateFindMainResource( + const AppCacheEntry& entry, + const AppCacheEntry& fallback_entry, + int64 cache_id, const GURL& manifest_url) { + simulate_find_main_resource_ = true; + simulate_find_sub_resource_ = false; + simulated_found_entry_ = entry; + simulated_found_fallback_entry_ = fallback_entry; + simulated_found_cache_id_ = cache_id; + simulated_found_manifest_url_ = manifest_url, + simulated_found_network_namespace_ = false; // N/A to main resource loads + } + void SimulateFindSubResource( + const AppCacheEntry& entry, + const AppCacheEntry& fallback_entry, + bool network_namespace) { + simulate_find_main_resource_ = false; + simulate_find_sub_resource_ = true; + simulated_found_entry_ = entry; + simulated_found_fallback_entry_ = fallback_entry; + simulated_found_cache_id_ = kNoCacheId; // N/A to sub resource loads + simulated_found_manifest_url_ = GURL(); // N/A to sub resource loads + simulated_found_network_namespace_ = network_namespace; + } + StoredCacheMap stored_caches_; StoredGroupMap stored_groups_; DoomedResponseIds doomed_response_ids_; @@ -110,6 +141,14 @@ class MockAppCacheStorage : public AppCacheStorage { bool simulate_make_group_obsolete_failure_; bool simulate_store_group_and_newest_cache_failure_; + bool simulate_find_main_resource_; + bool simulate_find_sub_resource_; + AppCacheEntry simulated_found_entry_; + AppCacheEntry simulated_found_fallback_entry_; + int64 simulated_found_cache_id_; + GURL simulated_found_manifest_url_; + bool simulated_found_network_namespace_; + FRIEND_TEST(MockAppCacheStorageTest, CreateGroup); FRIEND_TEST(MockAppCacheStorageTest, LoadCache_FarHit); FRIEND_TEST(MockAppCacheStorageTest, LoadGroupAndCache_FarHit); |