| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_STORAGE_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 6 #define CONTENT_BROWSER_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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // For use in unit tests. | 43 // For use in unit tests. |
| 44 // Note: This class is also being used to bootstrap our development efforts. | 44 // Note: This class is also being used to bootstrap our development efforts. |
| 45 // We can get layout tests up and running, and back fill with real storage | 45 // We can get layout tests up and running, and back fill with real storage |
| 46 // somewhat in parallel. | 46 // somewhat in parallel. |
| 47 class MockAppCacheStorage : public AppCacheStorage { | 47 class MockAppCacheStorage : public AppCacheStorage { |
| 48 public: | 48 public: |
| 49 explicit MockAppCacheStorage(AppCacheServiceImpl* service); | 49 explicit MockAppCacheStorage(AppCacheServiceImpl* service); |
| 50 virtual ~MockAppCacheStorage(); | 50 virtual ~MockAppCacheStorage(); |
| 51 | 51 |
| 52 virtual void GetAllInfo(Delegate* delegate) OVERRIDE; | 52 virtual void GetAllInfo(Delegate* delegate) override; |
| 53 virtual void LoadCache(int64 id, Delegate* delegate) OVERRIDE; | 53 virtual void LoadCache(int64 id, Delegate* delegate) override; |
| 54 virtual void LoadOrCreateGroup(const GURL& manifest_url, | 54 virtual void LoadOrCreateGroup(const GURL& manifest_url, |
| 55 Delegate* delegate) OVERRIDE; | 55 Delegate* delegate) override; |
| 56 virtual void StoreGroupAndNewestCache(AppCacheGroup* group, | 56 virtual void StoreGroupAndNewestCache(AppCacheGroup* group, |
| 57 AppCache* newest_cache, | 57 AppCache* newest_cache, |
| 58 Delegate* delegate) OVERRIDE; | 58 Delegate* delegate) override; |
| 59 virtual void FindResponseForMainRequest(const GURL& url, | 59 virtual void FindResponseForMainRequest(const GURL& url, |
| 60 const GURL& preferred_manifest_url, | 60 const GURL& preferred_manifest_url, |
| 61 Delegate* delegate) OVERRIDE; | 61 Delegate* delegate) override; |
| 62 virtual void FindResponseForSubRequest( | 62 virtual void FindResponseForSubRequest( |
| 63 AppCache* cache, const GURL& url, | 63 AppCache* cache, const GURL& url, |
| 64 AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry, | 64 AppCacheEntry* found_entry, AppCacheEntry* found_fallback_entry, |
| 65 bool * found_network_namespace) OVERRIDE; | 65 bool * found_network_namespace) override; |
| 66 virtual void MarkEntryAsForeign(const GURL& entry_url, | 66 virtual void MarkEntryAsForeign(const GURL& entry_url, |
| 67 int64 cache_id) OVERRIDE; | 67 int64 cache_id) override; |
| 68 virtual void MakeGroupObsolete(AppCacheGroup* group, | 68 virtual void MakeGroupObsolete(AppCacheGroup* group, |
| 69 Delegate* delegate, | 69 Delegate* delegate, |
| 70 int response_code) OVERRIDE; | 70 int response_code) override; |
| 71 virtual AppCacheResponseReader* CreateResponseReader( | 71 virtual AppCacheResponseReader* CreateResponseReader( |
| 72 const GURL& manifest_url, int64 group_id, int64 response_id) OVERRIDE; | 72 const GURL& manifest_url, int64 group_id, int64 response_id) override; |
| 73 virtual AppCacheResponseWriter* CreateResponseWriter( | 73 virtual AppCacheResponseWriter* CreateResponseWriter( |
| 74 const GURL& manifest_url, int64 group_id) OVERRIDE; | 74 const GURL& manifest_url, int64 group_id) override; |
| 75 virtual void DoomResponses( | 75 virtual void DoomResponses( |
| 76 const GURL& manifest_url, | 76 const GURL& manifest_url, |
| 77 const std::vector<int64>& response_ids) OVERRIDE; | 77 const std::vector<int64>& response_ids) override; |
| 78 virtual void DeleteResponses( | 78 virtual void DeleteResponses( |
| 79 const GURL& manifest_url, | 79 const GURL& manifest_url, |
| 80 const std::vector<int64>& response_ids) OVERRIDE; | 80 const std::vector<int64>& response_ids) override; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 friend class AppCacheRequestHandlerTest; | 83 friend class AppCacheRequestHandlerTest; |
| 84 friend class AppCacheServiceImplTest; | 84 friend class AppCacheServiceImplTest; |
| 85 friend class AppCacheUpdateJobTest; | 85 friend class AppCacheUpdateJobTest; |
| 86 friend class MockAppCacheStorageTest; | 86 friend class MockAppCacheStorageTest; |
| 87 | 87 |
| 88 typedef base::hash_map<int64, scoped_refptr<AppCache> > StoredCacheMap; | 88 typedef base::hash_map<int64, scoped_refptr<AppCache> > StoredCacheMap; |
| 89 typedef std::map<GURL, scoped_refptr<AppCacheGroup> > StoredGroupMap; | 89 typedef std::map<GURL, scoped_refptr<AppCacheGroup> > StoredGroupMap; |
| 90 typedef std::set<int64> DoomedResponseIds; | 90 typedef std::set<int64> DoomedResponseIds; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 StoreExistingGroupExistingCache); | 234 StoreExistingGroupExistingCache); |
| 235 FRIEND_TEST_ALL_PREFIXES(AppCacheServiceImplTest, | 235 FRIEND_TEST_ALL_PREFIXES(AppCacheServiceImplTest, |
| 236 DeleteAppCachesForOrigin); | 236 DeleteAppCachesForOrigin); |
| 237 | 237 |
| 238 DISALLOW_COPY_AND_ASSIGN(MockAppCacheStorage); | 238 DISALLOW_COPY_AND_ASSIGN(MockAppCacheStorage); |
| 239 }; | 239 }; |
| 240 | 240 |
| 241 } // namespace content | 241 } // namespace content |
| 242 | 242 |
| 243 #endif // CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 243 #endif // CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_STORAGE_H_ |
| OLD | NEW |