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

Side by Side Diff: content/browser/appcache/mock_appcache_storage.cc

Issue 344493002: Move all remaining appcache-related code to content namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 months 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 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 #include "content/browser/appcache/mock_appcache_storage.h" 5 #include "content/browser/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/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "webkit/browser/appcache/appcache.h" 12 #include "content/browser/appcache/appcache.h"
13 #include "webkit/browser/appcache/appcache_entry.h" 13 #include "content/browser/appcache/appcache_entry.h"
14 #include "webkit/browser/appcache/appcache_group.h" 14 #include "content/browser/appcache/appcache_group.h"
15 #include "webkit/browser/appcache/appcache_response.h" 15 #include "content/browser/appcache/appcache_response.h"
16 #include "webkit/browser/appcache/appcache_service_impl.h" 16 #include "content/browser/appcache/appcache_service_impl.h"
17 17
18 // This is a quick and easy 'mock' implementation of the storage interface 18 // This is a quick and easy 'mock' implementation of the storage interface
19 // that doesn't put anything to disk. 19 // that doesn't put anything to disk.
20 // 20 //
21 // We simply add an extra reference to objects when they're put in storage, 21 // We simply add an extra reference to objects when they're put in storage,
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 using appcache::AppCacheResponseWriter;
29 using appcache::AppCacheServiceImpl;
30 using appcache::APPCACHE_FALLBACK_NAMESPACE;
31 using appcache::APPCACHE_INTERCEPT_NAMESPACE;
32 using appcache::kAppCacheNoCacheId;
33 using appcache::AppCacheNamespaceType;
34
35 namespace content { 28 namespace content {
36 29
37 MockAppCacheStorage::MockAppCacheStorage(AppCacheServiceImpl* service) 30 MockAppCacheStorage::MockAppCacheStorage(AppCacheServiceImpl* service)
38 : AppCacheStorage(service), 31 : AppCacheStorage(service),
39 simulate_make_group_obsolete_failure_(false), 32 simulate_make_group_obsolete_failure_(false),
40 simulate_store_group_and_newest_cache_failure_(false), 33 simulate_store_group_and_newest_cache_failure_(false),
41 simulate_find_main_resource_(false), 34 simulate_find_main_resource_(false),
42 simulate_find_sub_resource_(false), 35 simulate_find_sub_resource_(false),
43 simulated_found_cache_id_(kAppCacheNoCacheId), 36 simulated_found_cache_id_(kAppCacheNoCacheId),
44 simulated_found_group_id_(0), 37 simulated_found_group_id_(0),
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) { 535 bool MockAppCacheStorage::ShouldCacheLoadAppearAsync(const AppCache* cache) {
543 if (!cache) 536 if (!cache)
544 return true; 537 return true;
545 538
546 // If the 'stored' ref is the only ref, real storage will have to load from 539 // If the 'stored' ref is the only ref, real storage will have to load from
547 // the database. 540 // the database.
548 return IsCacheStored(cache) && cache->HasOneRef(); 541 return IsCacheStored(cache) && cache->HasOneRef();
549 } 542 }
550 543
551 } // namespace content 544 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698