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 #include "webkit/appcache/mock_appcache_storage.h" | 5 #include "webkit/appcache/mock_appcache_storage.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // and remove the extra reference when they are removed from storage. | 22 // and remove the extra reference when they are removed from storage. |
23 // Responses are never really removed from the in-memory disk cache. | 23 // Responses are never really removed from the in-memory disk cache. |
24 // Delegate callbacks are made asyncly to appropiately mimic what will | 24 // Delegate callbacks are made asyncly to appropiately mimic what will |
25 // happen with a real disk-backed storage impl that involves IO on a | 25 // happen with a real disk-backed storage impl that involves IO on a |
26 // background thread. | 26 // background thread. |
27 | 27 |
28 namespace appcache { | 28 namespace appcache { |
29 | 29 |
30 MockAppCacheStorage::MockAppCacheStorage(AppCacheService* service) | 30 MockAppCacheStorage::MockAppCacheStorage(AppCacheService* service) |
31 : AppCacheStorage(service), | 31 : AppCacheStorage(service), |
32 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 32 weak_factory_(this), |
33 simulate_make_group_obsolete_failure_(false), | 33 simulate_make_group_obsolete_failure_(false), |
34 simulate_store_group_and_newest_cache_failure_(false), | 34 simulate_store_group_and_newest_cache_failure_(false), |
35 simulate_find_main_resource_(false), | 35 simulate_find_main_resource_(false), |
36 simulate_find_sub_resource_(false), | 36 simulate_find_sub_resource_(false), |
37 simulated_found_cache_id_(kNoCacheId), | 37 simulated_found_cache_id_(kNoCacheId), |
38 simulated_found_group_id_(0), | 38 simulated_found_group_id_(0), |
39 simulated_found_network_namespace_(false) { | 39 simulated_found_network_namespace_(false) { |
40 last_cache_id_ = 0; | 40 last_cache_id_ = 0; |
41 last_group_id_ = 0; | 41 last_group_id_ = 0; |
42 last_response_id_ = 0; | 42 last_response_id_ = 0; |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { | 526 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { |
527 if (!cache) | 527 if (!cache) |
528 return true; | 528 return true; |
529 | 529 |
530 // If the 'stored' ref is the only ref, real storage will have to load from | 530 // If the 'stored' ref is the only ref, real storage will have to load from |
531 // the database. | 531 // the database. |
532 return IsCacheStored(cache) && cache->HasOneRef(); | 532 return IsCacheStored(cache) && cache->HasOneRef(); |
533 } | 533 } |
534 | 534 |
535 } // namespace appcache | 535 } // namespace appcache |
OLD | NEW |