diff options
author | vsevik@chromium.org <vsevik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-08 17:36:37 +0000 |
---|---|---|
committer | vsevik@chromium.org <vsevik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-08 17:36:37 +0000 |
commit | 7731bf2f4de4eb5a02b5dc95ac3edcea6e5b4abf (patch) | |
tree | f81e8c1a7c705565746dc18bfb9ef0e3d80dd38c /webkit/appcache | |
parent | 8fff20b5a494b253e3aa316e552b39aa31e179ae (diff) | |
download | chromium_src-7731bf2f4de4eb5a02b5dc95ac3edcea6e5b4abf.zip chromium_src-7731bf2f4de4eb5a02b5dc95ac3edcea6e5b4abf.tar.gz chromium_src-7731bf2f4de4eb5a02b5dc95ac3edcea6e5b4abf.tar.bz2 |
Made application cache manifest URL always available for DevTools.
BUG=102680
TEST=None
Review URL: http://codereview.chromium.org/8438043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109043 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r-- | webkit/appcache/appcache.h | 2 | ||||
-rw-r--r-- | webkit/appcache/appcache_group_unittest.cc | 8 | ||||
-rw-r--r-- | webkit/appcache/appcache_host.cc | 72 | ||||
-rw-r--r-- | webkit/appcache/appcache_host.h | 27 | ||||
-rw-r--r-- | webkit/appcache/appcache_host_unittest.cc | 6 | ||||
-rw-r--r-- | webkit/appcache/appcache_request_handler_unittest.cc | 12 | ||||
-rw-r--r-- | webkit/appcache/appcache_unittest.cc | 8 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job.cc | 21 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job_unittest.cc | 72 | ||||
-rw-r--r-- | webkit/appcache/web_application_cache_host_impl.cc | 2 |
10 files changed, 138 insertions, 92 deletions
diff --git a/webkit/appcache/appcache.h b/webkit/appcache/appcache.h index 2fbb9cd..b273f97 100644 --- a/webkit/appcache/appcache.h +++ b/webkit/appcache/appcache.h @@ -130,7 +130,7 @@ class APPCACHE_EXPORT AppCache : public base::RefCounted<AppCache> { // FindResponseForRequest helpers FallbackNamespace* FindFallbackNamespace(const GURL& url); - // Use AppCacheHost::AssociateCache() to manipulate host association. + // Use AppCacheHost::Associate*Cache() to manipulate host association. void AssociateHost(AppCacheHost* host) { associated_hosts_.insert(host); } diff --git a/webkit/appcache/appcache_group_unittest.cc b/webkit/appcache/appcache_group_unittest.cc index c42722c..26eb5ca 100644 --- a/webkit/appcache/appcache_group_unittest.cc +++ b/webkit/appcache/appcache_group_unittest.cc @@ -183,12 +183,12 @@ TEST(AppCacheGroupTest, CleanupUnusedGroup) { group->AddCache(cache1); EXPECT_EQ(cache1, group->newest_complete_cache()); - host1.AssociateCache(cache1); + host1.AssociateCompleteCache(cache1); EXPECT_EQ(frontend.last_host_id_, host1.host_id()); EXPECT_EQ(frontend.last_cache_id_, cache1->cache_id()); EXPECT_EQ(frontend.last_status_, appcache::IDLE); - host2.AssociateCache(cache1); + host2.AssociateCompleteCache(cache1); EXPECT_EQ(frontend.last_host_id_, host2.host_id()); EXPECT_EQ(frontend.last_cache_id_, cache1->cache_id()); EXPECT_EQ(frontend.last_status_, appcache::IDLE); @@ -200,8 +200,8 @@ TEST(AppCacheGroupTest, CleanupUnusedGroup) { EXPECT_EQ(cache2, group->newest_complete_cache()); // Unassociate all hosts from older cache. - host1.AssociateCache(NULL); - host2.AssociateCache(NULL); + host1.AssociateNoCache(GURL()); + host2.AssociateNoCache(GURL()); EXPECT_EQ(frontend.last_host_id_, host2.host_id()); EXPECT_EQ(frontend.last_cache_id_, appcache::kNoCacheId); EXPECT_EQ(frontend.last_status_, appcache::UNCACHED); diff --git a/webkit/appcache/appcache_host.cc b/webkit/appcache/appcache_host.cc index d2cc50f..b9cae76 100644 --- a/webkit/appcache/appcache_host.cc +++ b/webkit/appcache/appcache_host.cc @@ -17,20 +17,26 @@ namespace appcache { namespace { -void FillCacheInfo( - const AppCache* cache, Status status, AppCacheInfo* info) { - DCHECK(cache); - info->cache_id = cache->cache_id(); +void FillCacheInfo(const AppCache* cache, + const GURL& manifest_url, + Status status, AppCacheInfo* info) { + info->manifest_url = manifest_url; info->status = status; - info->is_complete = cache->is_complete(); - if (info->is_complete) { - DCHECK(cache->owning_group()); - info->manifest_url = cache->owning_group()->manifest_url(); - info->group_id = cache->owning_group()->group_id(); - info->last_update_time = cache->update_time(); - info->creation_time = cache->owning_group()->creation_time(); - info->size = cache->cache_size(); - } + + if (!cache) + return; + + info->cache_id = cache->cache_id(); + + if (!cache->is_complete()) + return; + + DCHECK(cache->owning_group()); + info->is_complete = true; + info->group_id = cache->owning_group()->group_id(); + info->last_update_time = cache->update_time(); + info->creation_time = cache->owning_group()->creation_time(); + info->size = cache->cache_size(); } } // Anonymous namespace @@ -235,12 +241,12 @@ void AppCacheHost::DoPendingSwapCache() { if (associated_cache_ && associated_cache_->owning_group()) { if (associated_cache_->owning_group()->is_obsolete()) { success = true; - AssociateCache(NULL); + AssociateNoCache(GURL()); } else if (swappable_cache_) { DCHECK(swappable_cache_.get() == swappable_cache_->owning_group()->newest_complete_cache()); success = true; - AssociateCache(swappable_cache_); + AssociateCompleteCache(swappable_cache_); } } @@ -367,7 +373,7 @@ void AppCacheHost::FinishCacheSelection( host_id_, LOG_INFO, base::StringPrintf( kFormatString, owing_group->manifest_url().spec().c_str())); - AssociateCache(cache); + AssociateCompleteCache(cache); if (!owing_group->is_obsolete() && !owing_group->is_being_deleted()) { owing_group->StartUpdateWithHost(this); ObserveGroupBeingUpdated(owing_group); @@ -388,13 +394,14 @@ void AppCacheHost::FinishCacheSelection( host_id_, LOG_INFO, base::StringPrintf(kFormatString, group->manifest_url().spec().c_str())); - AssociateCache(NULL); // The UpdateJob may produce one for us later. + // The UpdateJob may produce one for us later. + AssociateNoCache(preferred_manifest_url_); group->StartUpdateWithNewMasterEntry(this, new_master_entry_url_); ObserveGroupBeingUpdated(group); } else { // Otherwise, the Document is not associated with any application cache. new_master_entry_url_ = GURL(); - AssociateCache(NULL); + AssociateNoCache(GURL()); } // Respond to pending callbacks now that we have a selection. @@ -428,7 +435,8 @@ void AppCacheHost::OnUpdateComplete(AppCacheGroup* group) { if (associated_cache_info_pending_ && associated_cache_.get() && associated_cache_->is_complete()) { AppCacheInfo info; - FillCacheInfo(associated_cache_.get(), GetStatus(), &info); + FillCacheInfo( + associated_cache_.get(), preferred_manifest_url_, GetStatus(), &info); associated_cache_info_pending_ = false; frontend_->OnCacheSelected(host_id_, info); } @@ -466,7 +474,25 @@ void AppCacheHost::NotifyMainResourceBlocked(const GURL& manifest_url) { blocked_manifest_url_ = manifest_url; } -void AppCacheHost::AssociateCache(AppCache* cache) { +void AppCacheHost::AssociateNoCache(const GURL& manifest_url) { + // manifest url can be empty. + AssociateCacheHelper(NULL, manifest_url); +} + +void AppCacheHost::AssociateIncompleteCache(AppCache* cache, + const GURL& manifest_url) { + DCHECK(cache && !cache->is_complete()); + DCHECK(!manifest_url.is_empty()); + AssociateCacheHelper(cache, manifest_url); +} + +void AppCacheHost::AssociateCompleteCache(AppCache* cache) { + DCHECK(cache && cache->is_complete()); + AssociateCacheHelper(cache, cache->owning_group()->manifest_url()); +} + +void AppCacheHost::AssociateCacheHelper(AppCache* cache, + const GURL& manifest_url) { if (associated_cache_.get()) { associated_cache_->UnassociateHost(this); } @@ -475,10 +501,10 @@ void AppCacheHost::AssociateCache(AppCache* cache) { SetSwappableCache(cache ? cache->owning_group() : NULL); associated_cache_info_pending_ = cache && !cache->is_complete(); AppCacheInfo info; - if (cache) { + if (cache) cache->AssociateHost(this); - FillCacheInfo(cache, GetStatus(), &info); - } + + FillCacheInfo(cache, manifest_url, GetStatus(), &info); frontend_->OnCacheSelected(host_id_, info); } diff --git a/webkit/appcache/appcache_host.h b/webkit/appcache/appcache_host.h index c94a1b3..25d46f5 100644 --- a/webkit/appcache/appcache_host.h +++ b/webkit/appcache/appcache_host.h @@ -96,11 +96,25 @@ class APPCACHE_EXPORT AppCacheHost : public AppCacheStorage::Delegate, // Support for devtools inspecting appcache resources. void GetResourceList(std::vector<AppCacheResourceInfo>* resource_infos); - // Establishes an association between this host and a cache. 'cache' may be - // NULL to break any existing association. Associations are established - // either thru the cache selection algorithm implemented (in this class), - // or by the update algorithm (see AppCacheUpdateJob). - void AssociateCache(AppCache* cache); + // Breaks any existing association between this host and a cache. + // 'manifest_url' is sent to DevTools as the manifest url that could have + // been associated before or could be associated later with this host. + // Associations are broken either thru the cache selection algorithm + // implemented in this class, or by the update algorithm (see + // AppCacheUpdateJob). + void AssociateNoCache(const GURL& manifest_url); + + // Establishes an association between this host and an incomplete cache. + // 'manifest_url' is manifest url of the cache group being updated. + // Associations with incomplete caches are established by the update algorithm + // (see AppCacheUpdateJob). + void AssociateIncompleteCache(AppCache* cache, const GURL& manifest_url); + + // Establishes an association between this host and a complete cache. + // Associations with complete caches are established either thru the cache + // selection algorithm implemented (in this class), or by the update algorithm + // (see AppCacheUpdateJob). + void AssociateCompleteCache(AppCache* cache); // Adds a reference to the newest complete cache in a group, unless it's the // same as the cache that is currently associated with the host. @@ -140,6 +154,9 @@ class APPCACHE_EXPORT AppCacheHost : public AppCacheStorage::Delegate, void LoadSelectedCache(int64 cache_id); void LoadOrCreateGroup(const GURL& manifest_url); + // See public Associate*Host() methods above. + void AssociateCacheHelper(AppCache* cache, const GURL& manifest_url); + // AppCacheStorage::Delegate impl virtual void OnCacheLoaded(AppCache* cache, int64 cache_id); virtual void OnGroupLoaded(AppCacheGroup* group, diff --git a/webkit/appcache/appcache_host_unittest.cc b/webkit/appcache/appcache_host_unittest.cc index f439059..1b89d06 100644 --- a/webkit/appcache/appcache_host_unittest.cc +++ b/webkit/appcache/appcache_host_unittest.cc @@ -352,7 +352,7 @@ TEST_F(AppCacheHostTest, SetSwappableCache) { mock_frontend_.last_host_id_ = -222; // to verify we received OnCacheSelected - host.AssociateCache(cache1); + host.AssociateCompleteCache(cache1); EXPECT_FALSE(host.swappable_cache_.get()); // was same as associated cache EXPECT_EQ(appcache::IDLE, host.GetStatus()); // verify OnCacheSelected was called @@ -377,11 +377,11 @@ TEST_F(AppCacheHostTest, SetSwappableCache) { group2->AddCache(cache4); EXPECT_EQ(cache2, host.swappable_cache_.get()); // unchanged - host.AssociateCache(cache3); + host.AssociateCompleteCache(cache3); EXPECT_EQ(cache4, host.swappable_cache_.get()); // newest cache in group2 EXPECT_FALSE(group1->HasCache()); // both caches in group1 have refcount 0 - host.AssociateCache(NULL); + host.AssociateNoCache(GURL()); EXPECT_FALSE(host.swappable_cache_.get()); EXPECT_FALSE(group2->HasCache()); // both caches in group2 have refcount 0 diff --git a/webkit/appcache/appcache_request_handler_unittest.cc b/webkit/appcache/appcache_request_handler_unittest.cc index 0d706d2..a1dfa49 100644 --- a/webkit/appcache/appcache_request_handler_unittest.cc +++ b/webkit/appcache/appcache_request_handler_unittest.cc @@ -442,7 +442,7 @@ class AppCacheRequestHandlerTest : public testing::Test { void SubResource_Miss_WithCacheSelected() { // A sub-resource load where the resource is not in an appcache, or // in a network or fallback namespace, should result in a failed request. - host_->AssociateCache(MakeNewCache()); + host_->AssociateCompleteCache(MakeNewCache()); request_.reset(new MockURLRequest(GURL("http://blah/"))); handler_.reset(host_->CreateRequestHandler(request_.get(), @@ -496,7 +496,7 @@ class AppCacheRequestHandlerTest : public testing::Test { // SubResource_Hit ----------------------------- void SubResource_Hit() { - host_->AssociateCache(MakeNewCache()); + host_->AssociateCompleteCache(MakeNewCache()); mock_storage()->SimulateFindSubResource( AppCacheEntry(AppCacheEntry::EXPLICIT, 1), AppCacheEntry(), false); @@ -524,7 +524,7 @@ class AppCacheRequestHandlerTest : public testing::Test { void SubResource_RedirectFallback() { // Redirects to resources in the a different origin are subject to // fallback namespaces. - host_->AssociateCache(MakeNewCache()); + host_->AssociateCompleteCache(MakeNewCache()); mock_storage()->SimulateFindSubResource( AppCacheEntry(), AppCacheEntry(AppCacheEntry::EXPLICIT, 1), false); @@ -553,7 +553,7 @@ class AppCacheRequestHandlerTest : public testing::Test { void SubResource_NoRedirectFallback() { // Redirects to resources in the same-origin are not subject to // fallback namespaces. - host_->AssociateCache(MakeNewCache()); + host_->AssociateCompleteCache(MakeNewCache()); mock_storage()->SimulateFindSubResource( AppCacheEntry(), AppCacheEntry(AppCacheEntry::EXPLICIT, 1), false); @@ -583,7 +583,7 @@ class AppCacheRequestHandlerTest : public testing::Test { // A sub-resource load where the resource is in a network namespace, // should result in the system using a 'real' job to do the network // retrieval. - host_->AssociateCache(MakeNewCache()); + host_->AssociateCompleteCache(MakeNewCache()); mock_storage()->SimulateFindSubResource( AppCacheEntry(), AppCacheEntry(), true); @@ -608,7 +608,7 @@ class AppCacheRequestHandlerTest : public testing::Test { // DestroyedHost ----------------------------- void DestroyedHost() { - host_->AssociateCache(MakeNewCache()); + host_->AssociateCompleteCache(MakeNewCache()); mock_storage()->SimulateFindSubResource( AppCacheEntry(AppCacheEntry::EXPLICIT, 1), AppCacheEntry(), false); diff --git a/webkit/appcache/appcache_unittest.cc b/webkit/appcache/appcache_unittest.cc index 5e1de6b..ecb29fe 100644 --- a/webkit/appcache/appcache_unittest.cc +++ b/webkit/appcache/appcache_unittest.cc @@ -25,11 +25,11 @@ TEST(AppCacheTest, CleanupUnusedCache) { AppCacheHost host1(1, &frontend, &service); AppCacheHost host2(2, &frontend, &service); - host1.AssociateCache(cache.get()); - host2.AssociateCache(cache.get()); + host1.AssociateCompleteCache(cache.get()); + host2.AssociateCompleteCache(cache.get()); - host1.AssociateCache(NULL); - host2.AssociateCache(NULL); + host1.AssociateNoCache(GURL()); + host2.AssociateNoCache(GURL()); } TEST(AppCacheTest, AddModifyRemoveEntry) { diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc index dd77329..b0c5966 100644 --- a/webkit/appcache/appcache_update_job.cc +++ b/webkit/appcache/appcache_update_job.cc @@ -530,7 +530,7 @@ void AppCacheUpdateJob::ContinueHandleManifestFetchCompleted(bool changed) { PendingHosts& hosts = it->second; for (PendingHosts::iterator host_it = hosts.begin(); host_it != hosts.end(); ++host_it) { - (*host_it)->AssociateCache(inprogress_cache_); + (*host_it)->AssociateIncompleteCache(inprogress_cache_, manifest_url_); } } @@ -650,7 +650,7 @@ void AppCacheUpdateJob::HandleMasterEntryFetchCompleted( DCHECK(cache == group_->newest_complete_cache()); for (PendingHosts::iterator host_it = hosts.begin(); host_it != hosts.end(); ++host_it) { - (*host_it)->AssociateCache(cache); + (*host_it)->AssociateCompleteCache(cache); } } } else { @@ -662,7 +662,7 @@ void AppCacheUpdateJob::HandleMasterEntryFetchCompleted( // In downloading case, disassociate host from inprogress cache. if (inprogress_cache_) - host->AssociateCache(NULL); + host->AssociateNoCache(GURL()); host->RemoveObserver(this); } @@ -1002,7 +1002,8 @@ void AppCacheUpdateJob::AddMasterEntryToFetchList(AppCacheHost* host, if (internal_state_ == DOWNLOADING || internal_state_ == NO_UPDATE) { AppCache* cache; if (inprogress_cache_) { - host->AssociateCache(inprogress_cache_); // always associate + // always associate + host->AssociateIncompleteCache(inprogress_cache_, manifest_url_); cache = inprogress_cache_.get(); } else { cache = group_->newest_complete_cache(); @@ -1012,8 +1013,10 @@ void AppCacheUpdateJob::AddMasterEntryToFetchList(AppCacheHost* host, AppCacheEntry* entry = cache->GetEntry(url); if (entry) { entry->add_types(AppCacheEntry::MASTER); - if (internal_state_ == NO_UPDATE) - host->AssociateCache(cache); // only associate if have entry + if (internal_state_ == NO_UPDATE && !inprogress_cache_) { + // only associate if have entry + host->AssociateCompleteCache(cache); + } if (is_new) ++master_entries_completed_; // pretend fetching completed return; @@ -1051,7 +1054,7 @@ void AppCacheUpdateJob::FetchMasterEntries() { PendingHosts& hosts = found->second; for (PendingHosts::iterator host_it = hosts.begin(); host_it != hosts.end(); ++host_it) { - (*host_it)->AssociateCache(cache); + (*host_it)->AssociateCompleteCache(cache); } } } else { @@ -1094,7 +1097,7 @@ void AppCacheUpdateJob::CancelAllMasterEntryFetches( for (PendingHosts::iterator host_it = hosts.begin(); host_it != hosts.end(); ++host_it) { AppCacheHost* host = *host_it; - host->AssociateCache(NULL); + host->AssociateNoCache(GURL()); host_notifier.AddHost(host); host->RemoveObserver(this); } @@ -1306,7 +1309,7 @@ void AppCacheUpdateJob::DiscardInprogressCache() { AppCache::AppCacheHosts& hosts = inprogress_cache_->associated_hosts(); while (!hosts.empty()) - (*hosts.begin())->AssociateCache(NULL); + (*hosts.begin())->AssociateNoCache(GURL()); inprogress_cache_ = NULL; } diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc index 0739cda..2f87651f 100644 --- a/webkit/appcache/appcache_update_job_unittest.cc +++ b/webkit/appcache/appcache_update_job_unittest.cc @@ -625,13 +625,13 @@ class AppCacheUpdateJobTest : public testing::Test, MockFrontend mock_frontend3; AppCacheHost host1(1, &mock_frontend1, service_.get()); - host1.AssociateCache(cache1); + host1.AssociateCompleteCache(cache1); AppCacheHost host2(2, &mock_frontend2, service_.get()); - host2.AssociateCache(cache2); + host2.AssociateCompleteCache(cache2); AppCacheHost host3(3, &mock_frontend1, service_.get()); - host3.AssociateCache(cache1); + host3.AssociateCompleteCache(cache1); AppCacheHost host4(4, &mock_frontend3, service_.get()); @@ -713,8 +713,8 @@ class AppCacheUpdateJobTest : public testing::Test, MockFrontend* frontend2 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); AppCacheHost* host2 = MakeHost(2, frontend2); - host1->AssociateCache(cache); - host2->AssociateCache(cache); + host1->AssociateCompleteCache(cache); + host2->AssociateCompleteCache(cache); update->StartUpdate(NULL, GURL()); EXPECT_TRUE(update->manifest_fetcher_ != NULL); @@ -804,8 +804,8 @@ class AppCacheUpdateJobTest : public testing::Test, MockFrontend* frontend2 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); AppCacheHost* host2 = MakeHost(2, frontend2); - host1->AssociateCache(cache); - host2->AssociateCache(cache); + host1->AssociateCompleteCache(cache); + host2->AssociateCompleteCache(cache); update->StartUpdate(NULL, GURL()); EXPECT_TRUE(update->manifest_fetcher_ != NULL); @@ -890,8 +890,8 @@ class AppCacheUpdateJobTest : public testing::Test, MockFrontend* frontend2 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); AppCacheHost* host2 = MakeHost(2, frontend2); - host1->AssociateCache(cache); - host2->AssociateCache(cache); + host1->AssociateCompleteCache(cache); + host2->AssociateCompleteCache(cache); update->StartUpdate(NULL, GURL()); EXPECT_TRUE(update->manifest_fetcher_ != NULL); @@ -931,8 +931,8 @@ class AppCacheUpdateJobTest : public testing::Test, MockFrontend* frontend2 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); AppCacheHost* host2 = MakeHost(2, frontend2); - host1->AssociateCache(cache); - host2->AssociateCache(cache); + host1->AssociateCompleteCache(cache); + host2->AssociateCompleteCache(cache); // Set up checks for when update job finishes. do_checks_after_update_finished_ = true; @@ -1019,8 +1019,8 @@ class AppCacheUpdateJobTest : public testing::Test, MockFrontend* frontend2 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); AppCacheHost* host2 = MakeHost(2, frontend2); - host1->AssociateCache(cache); - host2->AssociateCache(cache); + host1->AssociateCompleteCache(cache); + host2->AssociateCompleteCache(cache); frontend1->SetVerifyProgressEvents(true); frontend2->SetVerifyProgressEvents(true); @@ -1071,7 +1071,7 @@ class AppCacheUpdateJobTest : public testing::Test, AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 42); MockFrontend* frontend = MakeMockFrontend(); AppCacheHost* host = MakeHost(1, frontend); - host->AssociateCache(cache); + host->AssociateCompleteCache(cache); // Give the newest cache an entry that is in storage. response_writer_.reset( @@ -1133,7 +1133,7 @@ class AppCacheUpdateJobTest : public testing::Test, AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 42); MockFrontend* frontend = MakeMockFrontend(); AppCacheHost* host = MakeHost(1, frontend); - host->AssociateCache(cache); + host->AssociateCompleteCache(cache); // Give the newest cache an entry that is in storage. response_writer_.reset( @@ -1192,7 +1192,7 @@ class AppCacheUpdateJobTest : public testing::Test, AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 42); MockFrontend* frontend = MakeMockFrontend(); AppCacheHost* host = MakeHost(1, frontend); - host->AssociateCache(cache); + host->AssociateCompleteCache(cache); // Give the newest cache an entry that is in storage. response_writer_.reset( @@ -1253,8 +1253,8 @@ class AppCacheUpdateJobTest : public testing::Test, MockFrontend* frontend2 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); AppCacheHost* host2 = MakeHost(2, frontend2); - host1->AssociateCache(cache); - host2->AssociateCache(cache); + host1->AssociateCompleteCache(cache); + host2->AssociateCompleteCache(cache); // Give the newest cache a master entry that is also one of the explicit // entries in the manifest. @@ -1330,8 +1330,8 @@ class AppCacheUpdateJobTest : public testing::Test, frontend2->SetIgnoreProgressEvents(true); AppCacheHost* host1 = MakeHost(1, frontend1); AppCacheHost* host2 = MakeHost(2, frontend2); - host1->AssociateCache(cache); - host2->AssociateCache(cache); + host1->AssociateCompleteCache(cache); + host2->AssociateCompleteCache(cache); update->StartUpdate(NULL, GURL()); EXPECT_TRUE(update->manifest_fetcher_ != NULL); @@ -1372,8 +1372,8 @@ class AppCacheUpdateJobTest : public testing::Test, MockFrontend* frontend2 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); AppCacheHost* host2 = MakeHost(2, frontend2); - host1->AssociateCache(cache); - host2->AssociateCache(cache); + host1->AssociateCompleteCache(cache); + host2->AssociateCompleteCache(cache); // Give the newest cache some existing entries; one will fail with a 404. cache->AddEntry( @@ -1463,8 +1463,8 @@ class AppCacheUpdateJobTest : public testing::Test, MockFrontend* frontend2 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); AppCacheHost* host2 = MakeHost(2, frontend2); - host1->AssociateCache(cache); - host2->AssociateCache(cache); + host1->AssociateCompleteCache(cache); + host2->AssociateCompleteCache(cache); frontend1->SetVerifyProgressEvents(true); @@ -1504,7 +1504,7 @@ class AppCacheUpdateJobTest : public testing::Test, AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 22); MockFrontend* frontend = MakeMockFrontend(); AppCacheHost* host = MakeHost(1, frontend); - host->AssociateCache(cache); + host->AssociateCompleteCache(cache); frontend->SetVerifyProgressEvents(true); update->StartUpdate(host, GURL()); @@ -1728,8 +1728,8 @@ class AppCacheUpdateJobTest : public testing::Test, MockFrontend* frontend2 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); AppCacheHost* host2 = MakeHost(2, frontend2); - host1->AssociateCache(cache); - host2->AssociateCache(cache); + host1->AssociateCompleteCache(cache); + host2->AssociateCompleteCache(cache); update->StartUpdate(NULL, GURL()); @@ -1823,8 +1823,8 @@ class AppCacheUpdateJobTest : public testing::Test, MockFrontend* frontend2 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); AppCacheHost* host2 = MakeHost(2, frontend2); - host1->AssociateCache(cache); - host2->AssociateCache(cache); + host1->AssociateCompleteCache(cache); + host2->AssociateCompleteCache(cache); update->StartUpdate(NULL, GURL()); EXPECT_TRUE(update->manifest_fetcher_ != NULL); @@ -2005,7 +2005,7 @@ class AppCacheUpdateJobTest : public testing::Test, AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 42); MockFrontend* frontend1 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); - host1->AssociateCache(cache); + host1->AssociateCompleteCache(cache); MockFrontend* frontend2 = MakeMockFrontend(); frontend2->SetIgnoreProgressEvents(true); @@ -2102,7 +2102,7 @@ class AppCacheUpdateJobTest : public testing::Test, AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 42); MockFrontend* frontend1 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); - host1->AssociateCache(cache); + host1->AssociateCompleteCache(cache); MockFrontend* frontend2 = MakeMockFrontend(); frontend2->SetIgnoreProgressEvents(true); @@ -2159,7 +2159,7 @@ class AppCacheUpdateJobTest : public testing::Test, AppCache* cache = MakeCacheForGroup(1, 111); MockFrontend* frontend1 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); - host1->AssociateCache(cache); + host1->AssociateCompleteCache(cache); // Give cache an existing entry that can also be fetched. cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit2"), @@ -2299,7 +2299,7 @@ class AppCacheUpdateJobTest : public testing::Test, AppCache* cache = MakeCacheForGroup(1, 111); MockFrontend* frontend1 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); - host1->AssociateCache(cache); + host1->AssociateCompleteCache(cache); // Give cache an existing entry. cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit2"), @@ -2378,7 +2378,7 @@ class AppCacheUpdateJobTest : public testing::Test, AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 42); MockFrontend* frontend1 = MakeMockFrontend(); AppCacheHost* host1 = MakeHost(1, frontend1); - host1->AssociateCache(cache); + host1->AssociateCompleteCache(cache); update->StartUpdate(NULL, GURL()); @@ -2583,7 +2583,7 @@ class AppCacheUpdateJobTest : public testing::Test, response_writer_->response_id()); MockFrontend* frontend = MakeMockFrontend(); AppCacheHost* host = MakeHost(1, frontend); - host->AssociateCache(cache); + host->AssociateCompleteCache(cache); // Set up checks for when update job finishes. do_checks_after_update_finished_ = true; @@ -2642,7 +2642,7 @@ class AppCacheUpdateJobTest : public testing::Test, response_writer_->response_id()); MockFrontend* frontend = MakeMockFrontend(); AppCacheHost* host = MakeHost(1, frontend); - host->AssociateCache(cache); + host->AssociateCompleteCache(cache); // Set up checks for when update job finishes. do_checks_after_update_finished_ = true; diff --git a/webkit/appcache/web_application_cache_host_impl.cc b/webkit/appcache/web_application_cache_host_impl.cc index 044b4ca..287ce78 100644 --- a/webkit/appcache/web_application_cache_host_impl.cc +++ b/webkit/appcache/web_application_cache_host_impl.cc @@ -297,9 +297,9 @@ bool WebApplicationCacheHostImpl::swapCache() { void WebApplicationCacheHostImpl::getAssociatedCacheInfo( WebApplicationCacheHost::CacheInfo* info) { + info->manifestURL = cache_info_.manifest_url; if (!cache_info_.is_complete) return; - info->manifestURL = cache_info_.manifest_url; info->creationTime = cache_info_.creation_time.ToDoubleT(); info->updateTime = cache_info_.last_update_time.ToDoubleT(); info->totalSize = cache_info_.size; |