diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-24 01:18:13 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-24 01:18:13 +0000 |
commit | 64144178c9070dd0e08abf0a70c5da87af0f1722 (patch) | |
tree | ab523e1e230670629abf8105a557e4f1d2da5599 /webkit/appcache | |
parent | 43c6dae7c9d9dc3cf639a4ada168d880b800e34b (diff) | |
download | chromium_src-64144178c9070dd0e08abf0a70c5da87af0f1722.zip chromium_src-64144178c9070dd0e08abf0a70c5da87af0f1722.tar.gz chromium_src-64144178c9070dd0e08abf0a70c5da87af0f1722.tar.bz2 |
A mind numbing change to add the notion of a persistent groupId, and to get rid of the notion of an entryId.
TEST=existing tests apply
BUG=none
Review URL: http://codereview.chromium.org/432012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32895 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r-- | webkit/appcache/appcache_group.cc | 6 | ||||
-rw-r--r-- | webkit/appcache/appcache_group.h | 7 | ||||
-rw-r--r-- | webkit/appcache/appcache_group_unittest.cc | 8 | ||||
-rw-r--r-- | webkit/appcache/appcache_host_unittest.cc | 6 | ||||
-rw-r--r-- | webkit/appcache/appcache_request_handler_unittest.cc | 3 | ||||
-rw-r--r-- | webkit/appcache/appcache_storage.cc | 3 | ||||
-rw-r--r-- | webkit/appcache/appcache_storage.h | 4 | ||||
-rw-r--r-- | webkit/appcache/appcache_storage_unittest.cc | 2 | ||||
-rw-r--r-- | webkit/appcache/appcache_unittest.cc | 2 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job_unittest.cc | 90 | ||||
-rw-r--r-- | webkit/appcache/mock_appcache_storage.cc | 3 | ||||
-rw-r--r-- | webkit/appcache/mock_appcache_storage_unittest.cc | 20 |
12 files changed, 93 insertions, 61 deletions
diff --git a/webkit/appcache/appcache_group.cc b/webkit/appcache/appcache_group.cc index 5107b12..49c8af3 100644 --- a/webkit/appcache/appcache_group.cc +++ b/webkit/appcache/appcache_group.cc @@ -16,8 +16,10 @@ namespace appcache { AppCacheGroup::AppCacheGroup(AppCacheService* service, - const GURL& manifest_url) - : manifest_url_(manifest_url), + const GURL& manifest_url, + int64 group_id) + : group_id_(group_id), + manifest_url_(manifest_url), update_status_(IDLE), is_obsolete_(false), newest_complete_cache_(NULL), diff --git a/webkit/appcache/appcache_group.h b/webkit/appcache/appcache_group.h index 166ec21..efe8049 100644 --- a/webkit/appcache/appcache_group.h +++ b/webkit/appcache/appcache_group.h @@ -37,13 +37,15 @@ class AppCacheGroup : public base::RefCounted<AppCacheGroup> { DOWNLOADING, }; - AppCacheGroup(AppCacheService* service, const GURL& manifest_url); + AppCacheGroup(AppCacheService* service, const GURL& manifest_url, + int64 group_id); // Adds/removes an update observer, the AppCacheGroup does not take // ownership of the observer. void AddUpdateObserver(UpdateObserver* observer); void RemoveUpdateObserver(UpdateObserver* observer); + const int64 group_id() const { return group_id_; } const GURL& manifest_url() const { return manifest_url_; } bool is_obsolete() const { return is_obsolete_; } @@ -88,7 +90,8 @@ class AppCacheGroup : public base::RefCounted<AppCacheGroup> { const Caches& old_caches() const { return old_caches_; } - GURL manifest_url_; + const int64 group_id_; + const GURL manifest_url_; UpdateStatus update_status_; bool is_obsolete_; diff --git a/webkit/appcache/appcache_group_unittest.cc b/webkit/appcache/appcache_group_unittest.cc index aca8552..81280e7 100644 --- a/webkit/appcache/appcache_group_unittest.cc +++ b/webkit/appcache/appcache_group_unittest.cc @@ -62,7 +62,7 @@ class AppCacheGroupTest : public testing::Test { TEST(AppCacheGroupTest, AddRemoveCache) { MockAppCacheService service; scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, GURL::EmptyGURL()); + new AppCacheGroup(&service, GURL::EmptyGURL(), 111); base::TimeTicks ticks = base::TimeTicks::Now(); @@ -131,7 +131,7 @@ TEST(AppCacheGroupTest, AddRemoveCache) { TEST(AppCacheGroupTest, CleanupUnusedGroup) { MockAppCacheService service; TestAppCacheFrontend frontend; - AppCacheGroup* group = new AppCacheGroup(&service, GURL::EmptyGURL()); + AppCacheGroup* group = new AppCacheGroup(&service, GURL::EmptyGURL(), 111); AppCacheHost host1(1, &frontend, &service); AppCacheHost host2(2, &frontend, &service); @@ -171,7 +171,7 @@ TEST(AppCacheGroupTest, CleanupUnusedGroup) { TEST(AppCacheGroupTest, StartUpdate) { MockAppCacheService service; scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, GURL("http://foo.com")); + new AppCacheGroup(&service, GURL("http://foo.com"), 111); // Set state to checking to prevent update job from executing fetches. group->update_status_ = AppCacheGroup::CHECKING; @@ -192,7 +192,7 @@ TEST(AppCacheGroupTest, StartUpdate) { TEST(AppCacheGroupTest, CancelUpdate) { MockAppCacheService service; scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, GURL("http://foo.com")); + new AppCacheGroup(&service, GURL("http://foo.com"), 111); // Set state to checking to prevent update job from executing fetches. group->update_status_ = AppCacheGroup::CHECKING; diff --git a/webkit/appcache/appcache_host_unittest.cc b/webkit/appcache/appcache_host_unittest.cc index b92443c..f726d9e 100644 --- a/webkit/appcache/appcache_host_unittest.cc +++ b/webkit/appcache/appcache_host_unittest.cc @@ -235,7 +235,8 @@ TEST_F(AppCacheHostTest, SetSwappableCache) { EXPECT_FALSE(host.swappable_cache_.get()); scoped_refptr<AppCacheGroup> group1 = - new AppCacheGroup(&service_, GURL::EmptyGURL()); + new AppCacheGroup(&service_, GURL::EmptyGURL(), + service_.storage()->NewGroupId()); host.SetSwappableCache(group1); EXPECT_FALSE(host.swappable_cache_.get()); @@ -261,7 +262,8 @@ TEST_F(AppCacheHostTest, SetSwappableCache) { EXPECT_EQ(cache2, host.swappable_cache_.get()); // updated to newest scoped_refptr<AppCacheGroup> group2 = - new AppCacheGroup(&service_, GURL("http://foo.com")); + new AppCacheGroup(&service_, GURL("http://foo.com"), + service_.storage()->NewGroupId()); AppCache* cache3 = new AppCache(&service_, 333); cache3->set_complete(true); group2->AddCache(cache3); diff --git a/webkit/appcache/appcache_request_handler_unittest.cc b/webkit/appcache/appcache_request_handler_unittest.cc index 6b31651..c42efbb 100644 --- a/webkit/appcache/appcache_request_handler_unittest.cc +++ b/webkit/appcache/appcache_request_handler_unittest.cc @@ -558,7 +558,8 @@ class AppCacheRequestHandlerTest : public testing::Test { mock_service_.get(), mock_storage()->NewCacheId()); cache->set_complete(true); AppCacheGroup* group = new AppCacheGroup( - mock_service_.get(), GURL("http://blah/manifest")); + mock_service_.get(), GURL("http://blah/manifest"), + mock_storage()->NewGroupId()); group->AddCache(cache); return cache; } diff --git a/webkit/appcache/appcache_storage.cc b/webkit/appcache/appcache_storage.cc index b1fc5c4..e0e2610 100644 --- a/webkit/appcache/appcache_storage.cc +++ b/webkit/appcache/appcache_storage.cc @@ -10,8 +10,7 @@ namespace appcache { AppCacheStorage::AppCacheStorage(AppCacheService* service) : last_cache_id_(kUnitializedId), last_group_id_(kUnitializedId), - last_entry_id_(kUnitializedId), last_response_id_(kUnitializedId), - service_(service) { + last_response_id_(kUnitializedId), service_(service) { } AppCacheStorage::~AppCacheStorage() { diff --git a/webkit/appcache/appcache_storage.h b/webkit/appcache/appcache_storage.h index 02b6884..7193ef3 100644 --- a/webkit/appcache/appcache_storage.h +++ b/webkit/appcache/appcache_storage.h @@ -151,9 +151,6 @@ class AppCacheStorage { int64 NewGroupId() { return ++last_group_id_; } - int64 NewEntryId() { - return ++last_entry_id_; - } // The working set of object instances currently in memory. AppCacheWorkingSet* working_set() { return &working_set_; } @@ -294,7 +291,6 @@ class AppCacheStorage { // The last storage id used for different object types. int64 last_cache_id_; int64 last_group_id_; - int64 last_entry_id_; int64 last_response_id_; AppCacheWorkingSet working_set_; diff --git a/webkit/appcache/appcache_storage_unittest.cc b/webkit/appcache/appcache_storage_unittest.cc index 506dc04..c9c44d8 100644 --- a/webkit/appcache/appcache_storage_unittest.cc +++ b/webkit/appcache/appcache_storage_unittest.cc @@ -38,7 +38,7 @@ TEST_F(AppCacheStorageTest, AddRemoveCache) { TEST_F(AppCacheStorageTest, AddRemoveGroup) { MockAppCacheService service; scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, GURL::EmptyGURL()); + new AppCacheGroup(&service, GURL::EmptyGURL(), 111); EXPECT_EQ(group.get(), service.storage()->working_set()->GetGroup(GURL::EmptyGURL())); diff --git a/webkit/appcache/appcache_unittest.cc b/webkit/appcache/appcache_unittest.cc index 5f95f9d..9f41cd0e7 100644 --- a/webkit/appcache/appcache_unittest.cc +++ b/webkit/appcache/appcache_unittest.cc @@ -19,7 +19,7 @@ TEST(AppCacheTest, CleanupUnusedCache) { scoped_refptr<AppCache> cache(new AppCache(&service, 111)); cache->set_complete(true); scoped_refptr<AppCacheGroup> group( - new AppCacheGroup(&service, GURL("http://blah/manifest"))); + new AppCacheGroup(&service, GURL("http://blah/manifest"), 111)); group->AddCache(cache); AppCacheHost host1(1, &frontend, &service); diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc index d7b695a..2f4d1b6 100644 --- a/webkit/appcache/appcache_update_job_unittest.cc +++ b/webkit/appcache/appcache_update_job_unittest.cc @@ -224,7 +224,8 @@ class AppCacheUpdateJobTest : public testing::Test, ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); MakeService(); - group_ = new AppCacheGroup(service_.get(), GURL("http://failme")); + group_ = new AppCacheGroup(service_.get(), GURL("http://failme"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -257,7 +258,8 @@ class AppCacheUpdateJobTest : public testing::Test, { MakeService(); - group_ = new AppCacheGroup(service_.get(), GURL("http://failme")); + group_ = new AppCacheGroup(service_.get(), GURL("http://failme"), + service_->storage()->NewGroupId()); // Give the group some existing caches. AppCache* cache1 = MakeCacheForGroup(1, 111); @@ -321,7 +323,8 @@ class AppCacheUpdateJobTest : public testing::Test, ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); MakeService(); - group_ = new AppCacheGroup(service_.get(), GURL("http://failme")); + group_ = new AppCacheGroup(service_.get(), GURL("http://failme"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -346,7 +349,8 @@ class AppCacheUpdateJobTest : public testing::Test, ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); MakeService(); - group_ = new AppCacheGroup(service_.get(), GURL("http://failme")); + group_ = new AppCacheGroup(service_.get(), GURL("http://failme"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -386,7 +390,8 @@ class AppCacheUpdateJobTest : public testing::Test, registered_factory_ = true; MakeService(); - group_ = new AppCacheGroup(service_.get(), GURL("http://testme")); + group_ = new AppCacheGroup(service_.get(), GURL("http://testme"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -410,7 +415,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("defaultresponse")); + service_.get(), http_server_->TestServerPage("defaultresponse"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -434,7 +440,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/nosuchfile")); + service_.get(), http_server_->TestServerPage("files/nosuchfile"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -469,7 +476,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/gone")); + service_.get(), http_server_->TestServerPage("files/gone"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -493,7 +501,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/notmodified")); + service_.get(), http_server_->TestServerPage("files/notmodified"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -517,7 +526,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/notmodified")); + service_.get(), http_server_->TestServerPage("files/notmodified"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -552,7 +562,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/manifest1")); + service_.get(), http_server_->TestServerPage("files/manifest1"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -616,7 +627,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/manifest1")); + service_.get(), http_server_->TestServerPage("files/manifest1"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -641,7 +653,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/manifest1")); + service_.get(), http_server_->TestServerPage("files/manifest1"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -695,7 +708,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup(service_.get(), - http_server_->TestServerPage("files/manifest-merged-types")); + http_server_->TestServerPage("files/manifest-merged-types"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -746,7 +760,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup(service_.get(), - http_server_->TestServerPage("files/manifest-with-404")); + http_server_->TestServerPage("files/manifest-with-404"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -770,7 +785,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup(service_.get(), - http_server_->TestServerPage("files/manifest-fb-404")); + http_server_->TestServerPage("files/manifest-fb-404"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -813,7 +829,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/manifest1")); + service_.get(), http_server_->TestServerPage("files/manifest1"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -884,7 +901,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/empty-manifest")); + service_.get(), http_server_->TestServerPage("files/empty-manifest"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -922,7 +940,8 @@ class AppCacheUpdateJobTest : public testing::Test, MakeService(); group_ = new AppCacheGroup(service_.get(), - http_server_->TestServerPage("files/empty-file-manifest")); + http_server_->TestServerPage("files/empty-file-manifest"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -959,7 +978,8 @@ class AppCacheUpdateJobTest : public testing::Test, registered_factory_ = true; MakeService(); - group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl); + group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl, + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -989,7 +1009,8 @@ class AppCacheUpdateJobTest : public testing::Test, registered_factory_ = true; MakeService(); - group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl); + group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl, + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -1020,7 +1041,8 @@ class AppCacheUpdateJobTest : public testing::Test, registered_factory_ = true; MakeService(); - group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl); + group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl, + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -1050,7 +1072,8 @@ class AppCacheUpdateJobTest : public testing::Test, registered_factory_ = true; MakeService(); - group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl); + group_ = new AppCacheGroup(service_.get(), RetryRequestTestJob::kRetryUrl, + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -1080,7 +1103,8 @@ class AppCacheUpdateJobTest : public testing::Test, registered_factory_ = true; MakeService(); - group_ = new AppCacheGroup(service_.get(), GURL("http://retryurl")); + group_ = new AppCacheGroup(service_.get(), GURL("http://retryurl"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -1108,7 +1132,8 @@ class AppCacheUpdateJobTest : public testing::Test, storage->SimulateStoreGroupAndNewestCacheFailure(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/manifest1")); + service_.get(), http_server_->TestServerPage("files/manifest1"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -1135,7 +1160,8 @@ class AppCacheUpdateJobTest : public testing::Test, storage->SimulateStoreGroupAndNewestCacheFailure(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/manifest1")); + service_.get(), http_server_->TestServerPage("files/manifest1"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -1179,7 +1205,8 @@ class AppCacheUpdateJobTest : public testing::Test, storage->SimulateMakeGroupObsoleteFailure(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/gone")); + service_.get(), http_server_->TestServerPage("files/gone"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -1207,7 +1234,8 @@ class AppCacheUpdateJobTest : public testing::Test, storage->SimulateMakeGroupObsoleteFailure(); group_ = new AppCacheGroup( - service_.get(), http_server_->TestServerPage("files/nosuchfile")); + service_.get(), http_server_->TestServerPage("files/nosuchfile"), + service_->storage()->NewGroupId()); AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; @@ -1565,7 +1593,8 @@ scoped_refptr<HTTPTestServer> AppCacheUpdateJobTest::http_server_; TEST_F(AppCacheUpdateJobTest, AlreadyChecking) { MockAppCacheService service; scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, GURL("http://manifesturl.com")); + new AppCacheGroup(&service, GURL("http://manifesturl.com"), + service.storage()->NewGroupId()); AppCacheUpdateJob update(&service, group); @@ -1592,7 +1621,8 @@ TEST_F(AppCacheUpdateJobTest, AlreadyChecking) { TEST_F(AppCacheUpdateJobTest, AlreadyDownloading) { MockAppCacheService service; scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, GURL("http://manifesturl.com")); + new AppCacheGroup(&service, GURL("http://manifesturl.com"), + service.storage()->NewGroupId()); AppCacheUpdateJob update(&service, group); diff --git a/webkit/appcache/mock_appcache_storage.cc b/webkit/appcache/mock_appcache_storage.cc index cf93338..214be249 100644 --- a/webkit/appcache/mock_appcache_storage.cc +++ b/webkit/appcache/mock_appcache_storage.cc @@ -35,7 +35,6 @@ MockAppCacheStorage::MockAppCacheStorage(AppCacheService* service) simulated_found_cache_id_(kNoCacheId), simulated_found_network_namespace_(false) { last_cache_id_ = 0; - last_entry_id_ = 0; last_group_id_ = 0; last_response_id_ = 0; } @@ -175,7 +174,7 @@ void MockAppCacheStorage::ProcessLoadOrCreateGroup( // Newly created groups are not put in the stored_groups collection // until StoreGroupAndNewestCache is called. if (!group) - group = new AppCacheGroup(service_, manifest_url); + group = new AppCacheGroup(service_, manifest_url, NewGroupId()); if (delegate_ref->delegate) delegate_ref->delegate->OnGroupLoaded(group, manifest_url); diff --git a/webkit/appcache/mock_appcache_storage_unittest.cc b/webkit/appcache/mock_appcache_storage_unittest.cc index 0a0bae5..28e1bc5 100644 --- a/webkit/appcache/mock_appcache_storage_unittest.cc +++ b/webkit/appcache/mock_appcache_storage_unittest.cc @@ -155,7 +155,7 @@ TEST_F(MockAppCacheStorageTest, LoadGroupAndCache_FarHit) { // appears to be "stored" and "not currently in use". GURL manifest_url("http://blah/"); scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, manifest_url); + new AppCacheGroup(&service, manifest_url, 111); int64 cache_id = storage->NewCacheId(); scoped_refptr<AppCache> cache = new AppCache(&service, cache_id); cache->set_complete(true); @@ -206,7 +206,7 @@ TEST_F(MockAppCacheStorageTest, StoreNewGroup) { // appears to be "unstored". GURL manifest_url("http://blah/"); scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, manifest_url); + new AppCacheGroup(&service, manifest_url, 111); int64 cache_id = storage->NewCacheId(); scoped_refptr<AppCache> cache = new AppCache(&service, cache_id); cache->set_complete(true); @@ -238,7 +238,7 @@ TEST_F(MockAppCacheStorageTest, StoreExistingGroup) { // that appear to be "stored", and a newest unstored complete cache. GURL manifest_url("http://blah/"); scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, manifest_url); + new AppCacheGroup(&service, manifest_url, 111); int64 old_cache_id = storage->NewCacheId(); scoped_refptr<AppCache> old_cache = new AppCache(&service, old_cache_id); old_cache->set_complete(true); @@ -281,7 +281,7 @@ TEST_F(MockAppCacheStorageTest, StoreExistingGroupExistingCache) { // appear to be "stored". GURL manifest_url("http://blah"); scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, manifest_url); + new AppCacheGroup(&service, manifest_url, 111); int64 cache_id = storage->NewCacheId(); scoped_refptr<AppCache> cache = new AppCache(&service, cache_id); cache->set_complete(true); @@ -323,7 +323,7 @@ TEST_F(MockAppCacheStorageTest, MakeGroupObsolete) { // appears to be "stored" and "currently in use". GURL manifest_url("http://blah/"); scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, manifest_url); + new AppCacheGroup(&service, manifest_url, 111); int64 cache_id = storage->NewCacheId(); scoped_refptr<AppCache> cache = new AppCache(&service, cache_id); cache->set_complete(true); @@ -416,7 +416,7 @@ TEST_F(MockAppCacheStorageTest, BasicFindMainResponse) { kEntryUrl, AppCacheEntry(AppCacheEntry::EXPLICIT, kResponseId)); cache->set_complete(true); scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, kManifestUrl); + new AppCacheGroup(&service, kManifestUrl, 111); group->AddCache(cache); storage->AddStoredGroup(group); storage->AddStoredCache(cache); @@ -467,7 +467,7 @@ TEST_F(MockAppCacheStorageTest, BasicFindMainFallbackResponse) { cache->set_complete(true); scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, kManifestUrl); + new AppCacheGroup(&service, kManifestUrl, 111); group->AddCache(cache); storage->AddStoredGroup(group); storage->AddStoredCache(cache); @@ -513,7 +513,7 @@ TEST_F(MockAppCacheStorageTest, FindMainResponseWithMultipleCandidates) { kEntryUrl, AppCacheEntry(AppCacheEntry::EXPLICIT, kResponseId1)); cache->set_complete(true); scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, kManifestUrl1); + new AppCacheGroup(&service, kManifestUrl1, 111); group->AddCache(cache); storage->AddStoredGroup(group); storage->AddStoredCache(cache); @@ -526,7 +526,7 @@ TEST_F(MockAppCacheStorageTest, FindMainResponseWithMultipleCandidates) { cache->AddEntry( kEntryUrl, AppCacheEntry(AppCacheEntry::EXPLICIT, kResponseId2)); cache->set_complete(true); - group = new AppCacheGroup(&service, kManifestUrl2); + group = new AppCacheGroup(&service, kManifestUrl2, 222); group->AddCache(cache); storage->AddStoredGroup(group); storage->AddStoredCache(cache); @@ -572,7 +572,7 @@ TEST_F(MockAppCacheStorageTest, FindMainResponseExclusions) { kResponseId)); cache->set_complete(true); scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, kManifestUrl); + new AppCacheGroup(&service, kManifestUrl, 111); group->AddCache(cache); storage->AddStoredGroup(group); storage->AddStoredCache(cache); |