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

Side by Side Diff: webkit/appcache/mock_appcache_storage.h

Issue 8515019: base::Bind: Convert most of webkit/appcache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused include. Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
11 11
12 #include "base/callback.h"
12 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
13 #include "base/hash_tables.h" 14 #include "base/hash_tables.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/task.h" 16 #include "base/memory/weak_ptr.h"
16 #include "webkit/appcache/appcache.h" 17 #include "webkit/appcache/appcache.h"
17 #include "webkit/appcache/appcache_disk_cache.h" 18 #include "webkit/appcache/appcache_disk_cache.h"
18 #include "webkit/appcache/appcache_group.h" 19 #include "webkit/appcache/appcache_group.h"
19 #include "webkit/appcache/appcache_response.h" 20 #include "webkit/appcache/appcache_response.h"
20 #include "webkit/appcache/appcache_storage.h" 21 #include "webkit/appcache/appcache_storage.h"
21 22
22 namespace appcache { 23 namespace appcache {
23 24
24 // For use in unit tests. 25 // For use in unit tests.
25 // 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.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const GURL& manifest_url, scoped_refptr<DelegateReference> delegate_ref); 70 const GURL& manifest_url, scoped_refptr<DelegateReference> delegate_ref);
70 void ProcessStoreGroupAndNewestCache( 71 void ProcessStoreGroupAndNewestCache(
71 scoped_refptr<AppCacheGroup> group, scoped_refptr<AppCache> newest_cache, 72 scoped_refptr<AppCacheGroup> group, scoped_refptr<AppCache> newest_cache,
72 scoped_refptr<DelegateReference> delegate_ref); 73 scoped_refptr<DelegateReference> delegate_ref);
73 void ProcessMakeGroupObsolete( 74 void ProcessMakeGroupObsolete(
74 scoped_refptr<AppCacheGroup> group, 75 scoped_refptr<AppCacheGroup> group,
75 scoped_refptr<DelegateReference> delegate_ref); 76 scoped_refptr<DelegateReference> delegate_ref);
76 void ProcessFindResponseForMainRequest( 77 void ProcessFindResponseForMainRequest(
77 const GURL& url, scoped_refptr<DelegateReference> delegate_ref); 78 const GURL& url, scoped_refptr<DelegateReference> delegate_ref);
78 79
79 void ScheduleTask(Task* task); 80 void ScheduleTask(const base::Closure& task);
80 void RunOnePendingTask(); 81 void RunOnePendingTask();
81 82
82 void AddStoredCache(AppCache* cache); 83 void AddStoredCache(AppCache* cache);
83 void RemoveStoredCache(AppCache* cache); 84 void RemoveStoredCache(AppCache* cache);
84 void RemoveStoredCaches(const AppCacheGroup::Caches& caches); 85 void RemoveStoredCaches(const AppCacheGroup::Caches& caches);
85 bool IsCacheStored(const AppCache* cache) { 86 bool IsCacheStored(const AppCache* cache) {
86 return stored_caches_.find(cache->cache_id()) != stored_caches_.end(); 87 return stored_caches_.find(cache->cache_id()) != stored_caches_.end();
87 } 88 }
88 89
89 void AddStoredGroup(AppCacheGroup* group); 90 void AddStoredGroup(AppCacheGroup* group);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 162 }
162 163
163 void SimulateResponseReader(AppCacheResponseReader* reader) { 164 void SimulateResponseReader(AppCacheResponseReader* reader) {
164 simulated_reader_.reset(reader); 165 simulated_reader_.reset(reader);
165 } 166 }
166 167
167 StoredCacheMap stored_caches_; 168 StoredCacheMap stored_caches_;
168 StoredGroupMap stored_groups_; 169 StoredGroupMap stored_groups_;
169 DoomedResponseIds doomed_response_ids_; 170 DoomedResponseIds doomed_response_ids_;
170 scoped_ptr<AppCacheDiskCache> disk_cache_; 171 scoped_ptr<AppCacheDiskCache> disk_cache_;
171 std::deque<Task*> pending_tasks_; 172 std::deque<base::Closure> pending_tasks_;
172 ScopedRunnableMethodFactory<MockAppCacheStorage> method_factory_; 173 base::WeakPtrFactory<MockAppCacheStorage> weak_factory_;
173 174
174 bool simulate_make_group_obsolete_failure_; 175 bool simulate_make_group_obsolete_failure_;
175 bool simulate_store_group_and_newest_cache_failure_; 176 bool simulate_store_group_and_newest_cache_failure_;
176 177
177 bool simulate_find_main_resource_; 178 bool simulate_find_main_resource_;
178 bool simulate_find_sub_resource_; 179 bool simulate_find_sub_resource_;
179 AppCacheEntry simulated_found_entry_; 180 AppCacheEntry simulated_found_entry_;
180 AppCacheEntry simulated_found_fallback_entry_; 181 AppCacheEntry simulated_found_fallback_entry_;
181 int64 simulated_found_cache_id_; 182 int64 simulated_found_cache_id_;
182 int64 simulated_found_group_id_; 183 int64 simulated_found_group_id_;
(...skipping 18 matching lines...) Expand all
201 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, 202 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest,
202 StoreExistingGroupExistingCache); 203 StoreExistingGroupExistingCache);
203 FRIEND_TEST_ALL_PREFIXES(AppCacheServiceTest, DeleteAppCachesForOrigin); 204 FRIEND_TEST_ALL_PREFIXES(AppCacheServiceTest, DeleteAppCachesForOrigin);
204 205
205 DISALLOW_COPY_AND_ASSIGN(MockAppCacheStorage); 206 DISALLOW_COPY_AND_ASSIGN(MockAppCacheStorage);
206 }; 207 };
207 208
208 } // namespace appcache 209 } // namespace appcache
209 210
210 #endif // WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ 211 #endif // WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_url_request_job_unittest.cc ('k') | webkit/appcache/mock_appcache_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698