diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 21:42:25 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 21:42:25 +0000 |
commit | 550890ec7f1cf968abc4544b170e97a67f919902 (patch) | |
tree | 632dec32bed5266837a2668a9225d303303e3160 /webkit/appcache/appcache_group.h | |
parent | ed249ab7916d438b0bdb650a796aaf709f6ae1ae (diff) | |
download | chromium_src-550890ec7f1cf968abc4544b170e97a67f919902.zip chromium_src-550890ec7f1cf968abc4544b170e97a67f919902.tar.gz chromium_src-550890ec7f1cf968abc4544b170e97a67f919902.tar.bz2 |
MockAppCacheStorage implemention
This is a quick and easy 'mock' implementation of the storage interface
that doesn't put anything to disk.
We simply add an extra reference to objects when they're put in storage,
and remove the extra reference when they are removed from storage.
Responses are never really removed from the in-memory disk cache.
Delegate callbacks are made asyncly to appropiately mimic what will
happen with a real disk-backed storage impl that involves IO on a
background thread.
This is for use in unit tests and to initially bring up the appcache
related layout tests.
TEST=mock_appcache_storage_unittest.cc
BUG=none
Review URL: http://codereview.chromium.org/300043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_group.h')
-rw-r--r-- | webkit/appcache/appcache_group.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/webkit/appcache/appcache_group.h b/webkit/appcache/appcache_group.h index a5ff5fb..6f3c210 100644 --- a/webkit/appcache/appcache_group.h +++ b/webkit/appcache/appcache_group.h @@ -45,20 +45,18 @@ class AppCacheGroup : public base::RefCounted<AppCacheGroup> { void AddUpdateObserver(UpdateObserver* observer); void RemoveUpdateObserver(UpdateObserver* observer); - const GURL& manifest_url() { return manifest_url_; } + const GURL& manifest_url() const { return manifest_url_; } - bool is_obsolete() { return is_obsolete_; } + bool is_obsolete() const { return is_obsolete_; } void set_obsolete(bool value) { is_obsolete_ = value; } - AppCache* newest_complete_cache() { return newest_complete_cache_; } + AppCache* newest_complete_cache() const { return newest_complete_cache_; } void AddCache(AppCache* complete_cache); - void RemoveCache(AppCache* cache); + bool HasCache() const { return newest_complete_cache_ != NULL; } - bool HasCache() { return newest_complete_cache_ != NULL; } - - UpdateStatus update_status() { return update_status_; } + UpdateStatus update_status() const { return update_status_; } // Starts an update via update() javascript API. void StartUpdate() { @@ -79,13 +77,14 @@ class AppCacheGroup : public base::RefCounted<AppCacheGroup> { private: friend class AppCacheUpdateJob; friend class AppCacheUpdateJobTest; + friend class MockAppCacheStorage; // for old_caches() typedef std::vector<AppCache*> Caches; AppCacheUpdateJob* update_job() { return update_job_; } void SetUpdateStatus(UpdateStatus status); - const Caches& old_caches() { return old_caches_; } + const Caches& old_caches() const { return old_caches_; } GURL manifest_url_; UpdateStatus update_status_; |