| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 void SimulateStoreGroupAndNewestCacheFailure() { | 112 void SimulateStoreGroupAndNewestCacheFailure() { |
| 113 simulate_store_group_and_newest_cache_failure_ = true; | 113 simulate_store_group_and_newest_cache_failure_ = true; |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Simulate FindResponseFor results for testing. These | 116 // Simulate FindResponseFor results for testing. These |
| 117 // provided values will be return on the next call to | 117 // provided values will be return on the next call to |
| 118 // the corresponding Find method, subsequent calls are | 118 // the corresponding Find method, subsequent calls are |
| 119 // unaffected. | 119 // unaffected. |
| 120 void SimulateFindMainResource( | 120 void SimulateFindMainResource( |
| 121 const AppCacheEntry& entry, | 121 const AppCacheEntry& entry, |
| 122 const GURL& fallback_url, |
| 122 const AppCacheEntry& fallback_entry, | 123 const AppCacheEntry& fallback_entry, |
| 123 int64 cache_id, const GURL& manifest_url) { | 124 int64 cache_id, const GURL& manifest_url) { |
| 124 simulate_find_main_resource_ = true; | 125 simulate_find_main_resource_ = true; |
| 125 simulate_find_sub_resource_ = false; | 126 simulate_find_sub_resource_ = false; |
| 126 simulated_found_entry_ = entry; | 127 simulated_found_entry_ = entry; |
| 128 simulated_found_fallback_url_ = fallback_url; |
| 127 simulated_found_fallback_entry_ = fallback_entry; | 129 simulated_found_fallback_entry_ = fallback_entry; |
| 128 simulated_found_cache_id_ = cache_id; | 130 simulated_found_cache_id_ = cache_id; |
| 129 simulated_found_manifest_url_ = manifest_url, | 131 simulated_found_manifest_url_ = manifest_url, |
| 130 simulated_found_network_namespace_ = false; // N/A to main resource loads | 132 simulated_found_network_namespace_ = false; // N/A to main resource loads |
| 131 } | 133 } |
| 132 void SimulateFindSubResource( | 134 void SimulateFindSubResource( |
| 133 const AppCacheEntry& entry, | 135 const AppCacheEntry& entry, |
| 134 const AppCacheEntry& fallback_entry, | 136 const AppCacheEntry& fallback_entry, |
| 135 bool network_namespace) { | 137 bool network_namespace) { |
| 136 simulate_find_main_resource_ = false; | 138 simulate_find_main_resource_ = false; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 150 ScopedRunnableMethodFactory<MockAppCacheStorage> method_factory_; | 152 ScopedRunnableMethodFactory<MockAppCacheStorage> method_factory_; |
| 151 | 153 |
| 152 bool simulate_make_group_obsolete_failure_; | 154 bool simulate_make_group_obsolete_failure_; |
| 153 bool simulate_store_group_and_newest_cache_failure_; | 155 bool simulate_store_group_and_newest_cache_failure_; |
| 154 | 156 |
| 155 bool simulate_find_main_resource_; | 157 bool simulate_find_main_resource_; |
| 156 bool simulate_find_sub_resource_; | 158 bool simulate_find_sub_resource_; |
| 157 AppCacheEntry simulated_found_entry_; | 159 AppCacheEntry simulated_found_entry_; |
| 158 AppCacheEntry simulated_found_fallback_entry_; | 160 AppCacheEntry simulated_found_fallback_entry_; |
| 159 int64 simulated_found_cache_id_; | 161 int64 simulated_found_cache_id_; |
| 162 GURL simulated_found_fallback_url_; |
| 160 GURL simulated_found_manifest_url_; | 163 GURL simulated_found_manifest_url_; |
| 161 bool simulated_found_network_namespace_; | 164 bool simulated_found_network_namespace_; |
| 162 | 165 |
| 163 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, BasicFindMainResponse); | 166 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, BasicFindMainResponse); |
| 164 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, | 167 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, |
| 165 BasicFindMainFallbackResponse); | 168 BasicFindMainFallbackResponse); |
| 166 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, CreateGroup); | 169 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, CreateGroup); |
| 167 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, FindMainResponseExclusions); | 170 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, FindMainResponseExclusions); |
| 168 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, | 171 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, |
| 169 FindMainResponseWithMultipleCandidates); | 172 FindMainResponseWithMultipleCandidates); |
| 170 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, LoadCache_FarHit); | 173 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, LoadCache_FarHit); |
| 171 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, LoadGroupAndCache_FarHit); | 174 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, LoadGroupAndCache_FarHit); |
| 172 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, MakeGroupObsolete); | 175 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, MakeGroupObsolete); |
| 173 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, StoreNewGroup); | 176 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, StoreNewGroup); |
| 174 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, StoreExistingGroup); | 177 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, StoreExistingGroup); |
| 175 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, | 178 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, |
| 176 StoreExistingGroupExistingCache); | 179 StoreExistingGroupExistingCache); |
| 177 | 180 |
| 178 DISALLOW_COPY_AND_ASSIGN(MockAppCacheStorage); | 181 DISALLOW_COPY_AND_ASSIGN(MockAppCacheStorage); |
| 179 }; | 182 }; |
| 180 | 183 |
| 181 } // namespace appcache | 184 } // namespace appcache |
| 182 | 185 |
| 183 #endif // WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 186 #endif // WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ |
| OLD | NEW |