diff options
author | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-19 03:11:49 +0000 |
---|---|---|
committer | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-19 03:11:49 +0000 |
commit | c112093004963fb24639127d4a7ce3b2fdfda508 (patch) | |
tree | 57a362cf6f46a33db974a0cb7c1eabbf0e93709c /webkit/appcache | |
parent | e7b1dd8b09de8a10e7f41ae687a731a56e243eea (diff) | |
download | chromium_src-c112093004963fb24639127d4a7ce3b2fdfda508.zip chromium_src-c112093004963fb24639127d4a7ce3b2fdfda508.tar.gz chromium_src-c112093004963fb24639127d4a7ce3b2fdfda508.tar.bz2 |
Make the error message more clear in the appcache console logging when an initial cache attempt fails due to a missing manifest file.
BUG=none
TEST=manual
Review URL: http://codereview.chromium.org/5178003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66729 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r-- | webkit/appcache/appcache_update_job.cc | 8 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job_unittest.cc | 37 |
2 files changed, 7 insertions, 38 deletions
diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc index 94d8a05..d34017a 100644 --- a/webkit/appcache/appcache_update_job.cc +++ b/webkit/appcache/appcache_update_job.cc @@ -538,7 +538,8 @@ void AppCacheUpdateJob::HandleManifestFetchCompleted(URLRequest* request) { ContinueHandleManifestFetchCompleted(true); } else if (response_code == 304 && update_type_ == UPGRADE_ATTEMPT) { ContinueHandleManifestFetchCompleted(false); - } else if (response_code == 404 || response_code == 410) { + } else if ((response_code == 404 || response_code == 410) && + update_type_ == UPGRADE_ATTEMPT) { service_->storage()->MakeGroupObsolete(group_, this); // async } else { std::string message; @@ -559,7 +560,8 @@ void AppCacheUpdateJob::HandleManifestFetchCompleted(URLRequest* request) { void AppCacheUpdateJob::OnGroupMadeObsolete(AppCacheGroup* group, bool success) { DCHECK(master_entry_fetches_.empty()); - CancelAllMasterEntryFetches("The group has been made obsolete"); + CancelAllMasterEntryFetches("The cache has been made obsolete, " + "the manifest file returned 404 or 410"); if (success) { DCHECK(group->is_obsolete()); NotifyAllAssociatedHosts(OBSOLETE_EVENT); @@ -567,7 +569,7 @@ void AppCacheUpdateJob::OnGroupMadeObsolete(AppCacheGroup* group, MaybeCompleteUpdate(); } else { // Treat failure to mark group obsolete as a cache failure. - HandleCacheFailure("Failed to make the group as obsolete"); + HandleCacheFailure("Failed to mark the cache as obsolete"); } } diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc index eddb8e4..defe9f7 100644 --- a/webkit/appcache/appcache_update_job_unittest.cc +++ b/webkit/appcache/appcache_update_job_unittest.cc @@ -892,7 +892,7 @@ class AppCacheUpdateJobTest : public testing::Test, // Set up checks for when update job finishes. do_checks_after_update_finished_ = true; - expect_group_obsolete_ = true; + expect_group_obsolete_ = false; expect_group_has_cache_ = false; frontend->AddExpectedEvent(MockFrontend::HostIds(1, host->host_id()), CHECKING_EVENT); @@ -1853,35 +1853,6 @@ class AppCacheUpdateJobTest : public testing::Test, WaitForUpdateToFinish(); } - void FailMakeGroupObsoleteTest() { - ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); - - MakeService(); - MockAppCacheStorage* storage = - reinterpret_cast<MockAppCacheStorage*>(service_->storage()); - storage->SimulateMakeGroupObsoleteFailure(); - - group_ = new AppCacheGroup( - service_.get(), MockHttpServer::GetMockUrl("files/gone"), - service_->storage()->NewGroupId()); - AppCacheUpdateJob* update = new AppCacheUpdateJob(service_.get(), group_); - group_->update_job_ = update; - - MockFrontend* frontend = MakeMockFrontend(); - AppCacheHost* host = MakeHost(1, frontend); - update->StartUpdate(host, GURL()); - EXPECT_TRUE(update->manifest_url_request_ != NULL); - - // Set up checks for when update job finishes. - do_checks_after_update_finished_ = true; - expect_group_obsolete_ = false; - expect_group_has_cache_ = false; - frontend->AddExpectedEvent(MockFrontend::HostIds(1, host->host_id()), - CHECKING_EVENT); - - WaitForUpdateToFinish(); - } - void UpgradeFailMakeGroupObsoleteTest() { ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); @@ -1993,7 +1964,7 @@ class AppCacheUpdateJobTest : public testing::Test, // Set up checks for when update job finishes. do_checks_after_update_finished_ = true; - expect_group_obsolete_ = true; + expect_group_obsolete_ = false; expect_group_has_cache_ = false; MockFrontend::HostIds ids1(1, host->host_id()); frontend->AddExpectedEvent(ids1, CHECKING_EVENT); @@ -3409,10 +3380,6 @@ TEST_F(AppCacheUpdateJobTest, UpgradeFailStoreNewestCache) { RunTestOnIOThread(&AppCacheUpdateJobTest::UpgradeFailStoreNewestCacheTest); } -TEST_F(AppCacheUpdateJobTest, FailMakeGroupObsolete) { - RunTestOnIOThread(&AppCacheUpdateJobTest::FailMakeGroupObsoleteTest); -} - TEST_F(AppCacheUpdateJobTest, UpgradeFailMakeGroupObsolete) { RunTestOnIOThread(&AppCacheUpdateJobTest::UpgradeFailMakeGroupObsoleteTest); } |