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.cc | |
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.cc')
-rw-r--r-- | webkit/appcache/mock_appcache_storage.cc | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/webkit/appcache/mock_appcache_storage.cc b/webkit/appcache/mock_appcache_storage.cc index 34bfbb7..d9c63b0 100644 --- a/webkit/appcache/mock_appcache_storage.cc +++ b/webkit/appcache/mock_appcache_storage.cc @@ -29,7 +29,11 @@ MockAppCacheStorage::MockAppCacheStorage(AppCacheService* service) : AppCacheStorage(service), ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), simulate_make_group_obsolete_failure_(false), - simulate_store_group_and_newest_cache_failure_(false) { + simulate_store_group_and_newest_cache_failure_(false), + simulate_find_main_resource_(false), + simulate_find_sub_resource_(false), + simulated_found_cache_id_(kNoCacheId), + simulated_found_network_namespace_(false) { last_cache_id_ = 0; last_entry_id_ = 0; last_group_id_ = 0; @@ -88,6 +92,25 @@ void MockAppCacheStorage::FindResponseForMainRequest( url, GetOrCreateDelegateReference(delegate))); } +void MockAppCacheStorage::FindResponseForSubRequest( + AppCache* cache, const GURL& url, + AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry, + bool* found_network_namespace) { + DCHECK(cache && cache->is_complete()); + + // This layer of indirection is here to facilitate testing. + if (simulate_find_sub_resource_) { + *found_entry = simulated_found_entry_; + *found_fallback_entry = simulated_found_fallback_entry_; + *found_network_namespace = simulated_found_network_namespace_; + simulate_find_sub_resource_ = false; + return; + } + + cache->FindResponseForRequest(url, found_entry, found_fallback_entry, + found_network_namespace); +} + void MockAppCacheStorage::MarkEntryAsForeign( const GURL& entry_url, int64 cache_id) { AppCache* cache = working_set_.GetCache(cache_id); @@ -194,9 +217,21 @@ void MockAppCacheStorage::ProcessFindResponseForMainRequest( // look for a fallback namespace // look for a online namespace // } + AppCacheEntry found_entry; + AppCacheEntry found_fallback_entry; + int64 found_cache_id = kNoCacheId; + GURL found_manifest_url = GURL(); + if (simulate_find_main_resource_) { + found_entry = simulated_found_entry_; + found_fallback_entry = simulated_found_fallback_entry_; + found_cache_id = simulated_found_cache_id_; + found_manifest_url = simulated_found_manifest_url_; + simulate_find_main_resource_ = false; + } if (delegate_ref->delegate) { delegate_ref->delegate->OnMainResponseFound( - url, AppCacheEntry(), kNoCacheId, GURL()); + url, found_entry, found_fallback_entry, + found_cache_id, found_manifest_url); } } |