| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 5 #ifndef WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ |
| 6 #define WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 6 #define WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // For use in unit tests. | 25 // For use in unit tests. |
| 26 // Note: This class is also being used to bootstrap our development efforts. | 26 // Note: This class is also being used to bootstrap our development efforts. |
| 27 // We can get layout tests up and running, and back fill with real storage | 27 // We can get layout tests up and running, and back fill with real storage |
| 28 // somewhat in parallel. | 28 // somewhat in parallel. |
| 29 class MockAppCacheStorage : public AppCacheStorage { | 29 class MockAppCacheStorage : public AppCacheStorage { |
| 30 public: | 30 public: |
| 31 explicit MockAppCacheStorage(AppCacheService* service); | 31 explicit MockAppCacheStorage(AppCacheService* service); |
| 32 virtual ~MockAppCacheStorage(); | 32 virtual ~MockAppCacheStorage(); |
| 33 | 33 |
| 34 virtual void GetAllInfo(Delegate* delegate); | 34 virtual void GetAllInfo(Delegate* delegate) OVERRIDE; |
| 35 virtual void LoadCache(int64 id, Delegate* delegate); | 35 virtual void LoadCache(int64 id, Delegate* delegate) OVERRIDE; |
| 36 virtual void LoadOrCreateGroup(const GURL& manifest_url, Delegate* delegate); | 36 virtual void LoadOrCreateGroup(const GURL& manifest_url, |
| 37 virtual void StoreGroupAndNewestCache( | 37 Delegate* delegate) OVERRIDE; |
| 38 AppCacheGroup* group, AppCache* newest_cache, Delegate* delegate); | 38 virtual void StoreGroupAndNewestCache(AppCacheGroup* group, |
| 39 virtual void FindResponseForMainRequest( | 39 AppCache* newest_cache, |
| 40 const GURL& url, const GURL& preferred_manifest_url, Delegate* delegate); | 40 Delegate* delegate) OVERRIDE; |
| 41 virtual void FindResponseForMainRequest(const GURL& url, |
| 42 const GURL& preferred_manifest_url, |
| 43 Delegate* delegate) OVERRIDE; |
| 41 virtual void FindResponseForSubRequest( | 44 virtual void FindResponseForSubRequest( |
| 42 AppCache* cache, const GURL& url, | 45 AppCache* cache, const GURL& url, |
| 43 AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry, | 46 AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry, |
| 44 bool * found_network_namespace); | 47 bool * found_network_namespace) OVERRIDE; |
| 45 virtual void MarkEntryAsForeign(const GURL& entry_url, int64 cache_id); | 48 virtual void MarkEntryAsForeign(const GURL& entry_url, |
| 46 virtual void MakeGroupObsolete(AppCacheGroup* group, Delegate* delegate); | 49 int64 cache_id) OVERRIDE; |
| 50 virtual void MakeGroupObsolete(AppCacheGroup* group, |
| 51 Delegate* delegate) OVERRIDE; |
| 47 virtual AppCacheResponseReader* CreateResponseReader( | 52 virtual AppCacheResponseReader* CreateResponseReader( |
| 48 const GURL& manifest_url, int64 group_id, int64 response_id); | 53 const GURL& manifest_url, int64 group_id, int64 response_id) OVERRIDE; |
| 49 virtual AppCacheResponseWriter* CreateResponseWriter( | 54 virtual AppCacheResponseWriter* CreateResponseWriter( |
| 50 const GURL& manifest_url, int64 group_id); | 55 const GURL& manifest_url, int64 group_id) OVERRIDE; |
| 51 virtual void DoomResponses( | 56 virtual void DoomResponses( |
| 52 const GURL& manifest_url, const std::vector<int64>& response_ids); | 57 const GURL& manifest_url, |
| 58 const std::vector<int64>& response_ids) OVERRIDE; |
| 53 virtual void DeleteResponses( | 59 virtual void DeleteResponses( |
| 54 const GURL& manifest_url, const std::vector<int64>& response_ids); | 60 const GURL& manifest_url, |
| 55 virtual void PurgeMemory() {} | 61 const std::vector<int64>& response_ids) OVERRIDE; |
| 62 virtual void PurgeMemory() OVERRIDE {} |
| 56 | 63 |
| 57 private: | 64 private: |
| 58 friend class AppCacheRequestHandlerTest; | 65 friend class AppCacheRequestHandlerTest; |
| 59 friend class AppCacheServiceTest; | 66 friend class AppCacheServiceTest; |
| 60 friend class AppCacheUpdateJobTest; | 67 friend class AppCacheUpdateJobTest; |
| 61 | 68 |
| 62 typedef base::hash_map<int64, scoped_refptr<AppCache> > StoredCacheMap; | 69 typedef base::hash_map<int64, scoped_refptr<AppCache> > StoredCacheMap; |
| 63 typedef std::map<GURL, scoped_refptr<AppCacheGroup> > StoredGroupMap; | 70 typedef std::map<GURL, scoped_refptr<AppCacheGroup> > StoredGroupMap; |
| 64 typedef std::set<int64> DoomedResponseIds; | 71 typedef std::set<int64> DoomedResponseIds; |
| 65 | 72 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, | 209 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, |
| 203 StoreExistingGroupExistingCache); | 210 StoreExistingGroupExistingCache); |
| 204 FRIEND_TEST_ALL_PREFIXES(AppCacheServiceTest, DeleteAppCachesForOrigin); | 211 FRIEND_TEST_ALL_PREFIXES(AppCacheServiceTest, DeleteAppCachesForOrigin); |
| 205 | 212 |
| 206 DISALLOW_COPY_AND_ASSIGN(MockAppCacheStorage); | 213 DISALLOW_COPY_AND_ASSIGN(MockAppCacheStorage); |
| 207 }; | 214 }; |
| 208 | 215 |
| 209 } // namespace appcache | 216 } // namespace appcache |
| 210 | 217 |
| 211 #endif // WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 218 #endif // WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ |
| OLD | NEW |