summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_update_job_unittest.cc
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-25 21:15:31 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-25 21:15:31 +0000
commit697af4a94a9351f6994d9207356930f373cf3a6e (patch)
tree501a3d73683bf94694da5a540c5b6b88501ba961 /webkit/appcache/appcache_update_job_unittest.cc
parent2a8132263c53c361e4a7618af889492407dbb8e2 (diff)
downloadchromium_src-697af4a94a9351f6994d9207356930f373cf3a6e.zip
chromium_src-697af4a94a9351f6994d9207356930f373cf3a6e.tar.gz
chromium_src-697af4a94a9351f6994d9207356930f373cf3a6e.tar.bz2
Provide more info to the renderer process in appcache progress events.
BUG=39370 TEST= yes, updated unittests Review URL: http://codereview.chromium.org/2166006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48197 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_update_job_unittest.cc')
-rw-r--r--webkit/appcache/appcache_update_job_unittest.cc155
1 files changed, 107 insertions, 48 deletions
diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc
index df63042..5b42fe4 100644
--- a/webkit/appcache/appcache_update_job_unittest.cc
+++ b/webkit/appcache/appcache_update_job_unittest.cc
@@ -24,7 +24,11 @@ const wchar_t kDocRoot[] = L"webkit/appcache/data/appcache_unittest";
class MockFrontend : public AppCacheFrontend {
public:
- MockFrontend() : start_update_trigger_(CHECKING_EVENT), update_(NULL) { }
+ MockFrontend()
+ : ignore_progress_events_(false), verify_progress_events_(false),
+ last_progress_total_(-1), last_progress_complete_(-1),
+ start_update_trigger_(CHECKING_EVENT), update_(NULL) {
+ }
virtual void OnCacheSelected(int host_id, int64 cache_id,
Status status) {
@@ -50,13 +54,58 @@ class MockFrontend : public AppCacheFrontend {
}
}
+ virtual void OnProgressEventRaised(const std::vector<int>& host_ids,
+ const GURL& url,
+ int num_total, int num_complete) {
+ if (!ignore_progress_events_)
+ OnEventRaised(host_ids, PROGRESS_EVENT);
+
+ if (verify_progress_events_) {
+ EXPECT_GE(num_total, num_complete);
+ EXPECT_GE(num_complete, 0);
+
+ if (last_progress_total_ == -1) {
+ // Should start at zero.
+ EXPECT_EQ(0, num_complete);
+ } else {
+ // Total should be stable and complete should bump up by one at a time.
+ EXPECT_EQ(last_progress_total_, num_total);
+ EXPECT_EQ(last_progress_complete_ + 1, num_complete);
+ }
+
+ // Url should be valid for all except the 'final' event.
+ if (num_total == num_complete)
+ EXPECT_TRUE(url.is_empty());
+ else
+ EXPECT_TRUE(url.is_valid());
+
+ last_progress_total_ = num_total;
+ last_progress_complete_ = num_complete;
+ }
+ }
+
virtual void OnContentBlocked(int host_id) {
}
void AddExpectedEvent(const std::vector<int>& host_ids, EventID event_id) {
+ DCHECK(!ignore_progress_events_ || event_id != PROGRESS_EVENT);
expected_events_.push_back(RaisedEvent(host_ids, event_id));
}
+ void SetIgnoreProgressEvents(bool ignore) {
+ // Some tests involve joining new hosts to an already running update job
+ // or intentionally failing. The timing and sequencing of the progress
+ // events generated by an update job are dependent on the behavior of
+ // an external HTTP server. For jobs that do not run fully till completion,
+ // due to either joining late or early exit, we skip monitoring the
+ // progress events to avoid flakiness.
+ ignore_progress_events_ = ignore;
+ }
+
+ void SetVerifyProgressEvents(bool verify) {
+ verify_progress_events_ = verify;
+ }
+
void TriggerAdditionalUpdates(EventID trigger_event,
AppCacheUpdateJob* update) {
start_update_trigger_ = trigger_event;
@@ -75,6 +124,12 @@ class MockFrontend : public AppCacheFrontend {
// Set the expected events if verification needs to happen asynchronously.
RaisedEvents expected_events_;
+ bool ignore_progress_events_;
+
+ bool verify_progress_events_;
+ int last_progress_total_;
+ int last_progress_complete_;
+
// Add ability for frontend to add master entries to an inprogress update.
EventID start_update_trigger_;
AppCacheUpdateJob* update_;
@@ -849,6 +904,8 @@ class AppCacheUpdateJobTest : public testing::Test,
AppCacheHost* host2 = MakeHost(2, frontend2);
host1->AssociateCache(cache);
host2->AssociateCache(cache);
+ frontend1->SetVerifyProgressEvents(true);
+ frontend2->SetVerifyProgressEvents(true);
// Set up checks for when update job finishes.
do_checks_after_update_finished_ = true;
@@ -861,12 +918,14 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
frontend1->AddExpectedEvent(ids1, UPDATE_READY_EVENT);
MockFrontend::HostIds ids2(1, host2->host_id());
frontend2->AddExpectedEvent(ids2, CHECKING_EVENT);
frontend2->AddExpectedEvent(ids2, DOWNLOADING_EVENT);
frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
+ frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT); // final
frontend2->AddExpectedEvent(ids2, UPDATE_READY_EVENT);
// Seed storage with expected manifest data different from manifest1.
@@ -919,6 +978,7 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend->AddExpectedEvent(ids, DOWNLOADING_EVENT);
frontend->AddExpectedEvent(ids, PROGRESS_EVENT);
frontend->AddExpectedEvent(ids, PROGRESS_EVENT);
+ frontend->AddExpectedEvent(ids, PROGRESS_EVENT); // final
frontend->AddExpectedEvent(ids, UPDATE_READY_EVENT);
// Seed storage with expected http response info for entry. Allow reuse.
@@ -975,8 +1035,7 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend->AddExpectedEvent(ids, DOWNLOADING_EVENT);
frontend->AddExpectedEvent(ids, PROGRESS_EVENT);
frontend->AddExpectedEvent(ids, PROGRESS_EVENT);
- // Extra progress event for re-attempt to fetch explicit1 from network.
- frontend->AddExpectedEvent(ids, PROGRESS_EVENT);
+ frontend->AddExpectedEvent(ids, PROGRESS_EVENT); // final
frontend->AddExpectedEvent(ids, UPDATE_READY_EVENT);
// Seed storage with expected http response info for entry. Do NOT
@@ -1034,8 +1093,7 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend->AddExpectedEvent(ids, DOWNLOADING_EVENT);
frontend->AddExpectedEvent(ids, PROGRESS_EVENT);
frontend->AddExpectedEvent(ids, PROGRESS_EVENT);
- // Extra progress event for re-attempt to fetch explicit1 from network.
- frontend->AddExpectedEvent(ids, PROGRESS_EVENT);
+ frontend->AddExpectedEvent(ids, PROGRESS_EVENT); // final
frontend->AddExpectedEvent(ids, UPDATE_READY_EVENT);
// Seed storage with expected http response info for entry: a vary header.
@@ -1095,18 +1153,16 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // explicit1 (load)
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // manifest (load)
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // explicit1 (fetch)
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // manifest (fetch)
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // explicit1
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // manifest
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
frontend1->AddExpectedEvent(ids1, UPDATE_READY_EVENT);
MockFrontend::HostIds ids2(1, host2->host_id());
frontend2->AddExpectedEvent(ids2, CHECKING_EVENT);
frontend2->AddExpectedEvent(ids2, DOWNLOADING_EVENT);
frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
+ frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT); // final
frontend2->AddExpectedEvent(ids2, UPDATE_READY_EVENT);
WaitForUpdateToFinish();
@@ -1150,6 +1206,8 @@ class AppCacheUpdateJobTest : public testing::Test,
AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 99);
MockFrontend* frontend1 = MakeMockFrontend();
MockFrontend* frontend2 = MakeMockFrontend();
+ frontend1->SetIgnoreProgressEvents(true);
+ frontend2->SetIgnoreProgressEvents(true);
AppCacheHost* host1 = MakeHost(1, frontend1);
AppCacheHost* host2 = MakeHost(2, frontend2);
host1->AssociateCache(cache);
@@ -1166,16 +1224,10 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
frontend1->AddExpectedEvent(ids1, ERROR_EVENT);
MockFrontend::HostIds ids2(1, host2->host_id());
frontend2->AddExpectedEvent(ids2, CHECKING_EVENT);
frontend2->AddExpectedEvent(ids2, DOWNLOADING_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
frontend2->AddExpectedEvent(ids2, ERROR_EVENT);
WaitForUpdateToFinish();
@@ -1232,24 +1284,20 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // explicit1
frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // fallback1a
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // notfound (load)
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // notfound (fetch)
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // explicit2 (load)
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // explicit2 (fetch)
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // servererror (load)
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // servererror (fetch)
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // notfound
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // explicit2
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // servererror
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
frontend1->AddExpectedEvent(ids1, UPDATE_READY_EVENT);
MockFrontend::HostIds ids2(1, host2->host_id());
frontend2->AddExpectedEvent(ids2, CHECKING_EVENT);
frontend2->AddExpectedEvent(ids2, DOWNLOADING_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
+ frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT); // explicit1
+ frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT); // fallback1a
+ frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT); // notfound
+ frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT); // explicit2
+ frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT); // servererror
+ frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT); // final
frontend2->AddExpectedEvent(ids2, UPDATE_READY_EVENT);
WaitForUpdateToFinish();
@@ -1273,6 +1321,8 @@ class AppCacheUpdateJobTest : public testing::Test,
host1->AssociateCache(cache);
host2->AssociateCache(cache);
+ frontend1->SetVerifyProgressEvents(true);
+
update->StartUpdate(NULL, GURL());
EXPECT_TRUE(update->manifest_url_request_ != NULL);
@@ -1285,10 +1335,12 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
frontend1->AddExpectedEvent(ids1, UPDATE_READY_EVENT);
MockFrontend::HostIds ids2(1, host2->host_id());
frontend2->AddExpectedEvent(ids2, CHECKING_EVENT);
frontend2->AddExpectedEvent(ids2, DOWNLOADING_EVENT);
+ frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT); // final
frontend2->AddExpectedEvent(ids2, UPDATE_READY_EVENT);
WaitForUpdateToFinish();
@@ -1308,6 +1360,7 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend* frontend = MakeMockFrontend();
AppCacheHost* host = MakeHost(1, frontend);
host->AssociateCache(cache);
+ frontend->SetVerifyProgressEvents(true);
update->StartUpdate(host, GURL());
EXPECT_TRUE(update->manifest_url_request_ != NULL);
@@ -1321,6 +1374,7 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend->AddExpectedEvent(ids1, CHECKING_EVENT);
frontend->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
frontend->AddExpectedEvent(ids1, PROGRESS_EVENT);
+ frontend->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
frontend->AddExpectedEvent(ids1, UPDATE_READY_EVENT);
WaitForUpdateToFinish();
@@ -1714,6 +1768,7 @@ class AppCacheUpdateJobTest : public testing::Test,
group_->update_job_ = update;
MockFrontend* frontend = MakeMockFrontend();
+ frontend->SetIgnoreProgressEvents(true);
AppCacheHost* host = MakeHost(1, frontend);
host->new_master_entry_url_ =
http_server_->TestServerPage("files/explicit1");
@@ -1728,9 +1783,6 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend::HostIds ids1(1, host->host_id());
frontend->AddExpectedEvent(ids1, CHECKING_EVENT);
frontend->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
- frontend->AddExpectedEvent(ids1, PROGRESS_EVENT);
- frontend->AddExpectedEvent(ids1, PROGRESS_EVENT);
- frontend->AddExpectedEvent(ids1, PROGRESS_EVENT);
frontend->AddExpectedEvent(ids1, ERROR_EVENT);
WaitForUpdateToFinish();
@@ -1746,12 +1798,14 @@ class AppCacheUpdateJobTest : public testing::Test,
group_->update_job_ = update;
MockFrontend* frontend1 = MakeMockFrontend();
+ frontend1->SetIgnoreProgressEvents(true);
AppCacheHost* host1 = MakeHost(1, frontend1);
host1->new_master_entry_url_ =
http_server_->TestServerPage("files/nosuchfile");
update->StartUpdate(host1, host1->new_master_entry_url_);
MockFrontend* frontend2 = MakeMockFrontend();
+ frontend2->SetIgnoreProgressEvents(true);
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
http_server_->TestServerPage("files/servererror");
@@ -1764,14 +1818,10 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
frontend1->AddExpectedEvent(ids1, ERROR_EVENT);
MockFrontend::HostIds ids2(1, host2->host_id());
frontend2->AddExpectedEvent(ids2, CHECKING_EVENT);
frontend2->AddExpectedEvent(ids2, DOWNLOADING_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
frontend2->AddExpectedEvent(ids2, ERROR_EVENT);
WaitForUpdateToFinish();
@@ -1792,12 +1842,14 @@ class AppCacheUpdateJobTest : public testing::Test,
host1->AssociateCache(cache);
MockFrontend* frontend2 = MakeMockFrontend();
+ frontend2->SetIgnoreProgressEvents(true);
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
http_server_->TestServerPage("files/nosuchfile");
update->StartUpdate(host2, host2->new_master_entry_url_);
MockFrontend* frontend3 = MakeMockFrontend();
+ frontend3->SetIgnoreProgressEvents(true);
AppCacheHost* host3 = MakeHost(3, frontend3);
host3->new_master_entry_url_ =
http_server_->TestServerPage("files/servererror");
@@ -1814,17 +1866,14 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
frontend1->AddExpectedEvent(ids1, UPDATE_READY_EVENT);
MockFrontend::HostIds ids2(1, host2->host_id());
frontend2->AddExpectedEvent(ids2, DOWNLOADING_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
frontend2->AddExpectedEvent(ids2, ERROR_EVENT);
MockFrontend::HostIds ids3(1, host3->host_id());
frontend3->AddExpectedEvent(ids3, CHECKING_EVENT);
frontend3->AddExpectedEvent(ids3, DOWNLOADING_EVENT);
- frontend3->AddExpectedEvent(ids3, PROGRESS_EVENT);
- frontend3->AddExpectedEvent(ids3, PROGRESS_EVENT);
frontend3->AddExpectedEvent(ids3, ERROR_EVENT);
WaitForUpdateToFinish();
@@ -1840,6 +1889,7 @@ class AppCacheUpdateJobTest : public testing::Test,
group_->update_job_ = update;
MockFrontend* frontend1 = MakeMockFrontend();
+ frontend1->SetIgnoreProgressEvents(true);
AppCacheHost* host1 = MakeHost(1, frontend1);
host1->new_master_entry_url_ =
http_server_->TestServerPage("files/nosuchfile");
@@ -1862,14 +1912,13 @@ class AppCacheUpdateJobTest : public testing::Test,
MockFrontend::HostIds ids1(1, host1->host_id());
frontend1->AddExpectedEvent(ids1, CHECKING_EVENT);
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
- frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
frontend1->AddExpectedEvent(ids1, ERROR_EVENT);
MockFrontend::HostIds ids2(1, host2->host_id());
frontend2->AddExpectedEvent(ids2, CHECKING_EVENT);
frontend2->AddExpectedEvent(ids2, DOWNLOADING_EVENT);
frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
+ frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT); // final
frontend2->AddExpectedEvent(ids2, CACHED_EVENT);
WaitForUpdateToFinish();
@@ -1890,6 +1939,7 @@ class AppCacheUpdateJobTest : public testing::Test,
host1->AssociateCache(cache);
MockFrontend* frontend2 = MakeMockFrontend();
+ frontend2->SetIgnoreProgressEvents(true);
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
http_server_->TestServerPage("files/nosuchfile");
@@ -1915,17 +1965,17 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
frontend1->AddExpectedEvent(ids1, UPDATE_READY_EVENT);
MockFrontend::HostIds ids2(1, host2->host_id());
frontend2->AddExpectedEvent(ids2, DOWNLOADING_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
frontend2->AddExpectedEvent(ids2, ERROR_EVENT);
MockFrontend::HostIds ids3(1, host3->host_id());
frontend3->AddExpectedEvent(ids3, CHECKING_EVENT);
frontend3->AddExpectedEvent(ids3, DOWNLOADING_EVENT);
frontend3->AddExpectedEvent(ids3, PROGRESS_EVENT);
frontend3->AddExpectedEvent(ids3, PROGRESS_EVENT);
+ frontend3->AddExpectedEvent(ids3, PROGRESS_EVENT); // final
frontend3->AddExpectedEvent(ids3, UPDATE_READY_EVENT);
WaitForUpdateToFinish();
@@ -2003,6 +2053,7 @@ class AppCacheUpdateJobTest : public testing::Test,
// Set up additional updates to be started while update is in progress.
MockFrontend* frontend2 = MakeMockFrontend();
+ frontend2->SetIgnoreProgressEvents(true);
AppCacheHost* host2 = MakeHost(2, frontend2);
host2->new_master_entry_url_ =
http_server_->TestServerPage("files/nosuchfile");
@@ -2040,24 +2091,25 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
frontend1->AddExpectedEvent(ids1, CACHED_EVENT);
MockFrontend::HostIds ids2(1, host2->host_id());
frontend2->AddExpectedEvent(ids2, CHECKING_EVENT);
frontend2->AddExpectedEvent(ids2, DOWNLOADING_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
- frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
frontend2->AddExpectedEvent(ids2, ERROR_EVENT);
MockFrontend::HostIds ids3(1, host3->host_id());
frontend3->AddExpectedEvent(ids3, CHECKING_EVENT);
frontend3->AddExpectedEvent(ids3, DOWNLOADING_EVENT);
frontend3->AddExpectedEvent(ids3, PROGRESS_EVENT);
frontend3->AddExpectedEvent(ids3, PROGRESS_EVENT);
+ frontend3->AddExpectedEvent(ids3, PROGRESS_EVENT); // final
frontend3->AddExpectedEvent(ids3, CACHED_EVENT);
MockFrontend::HostIds ids4(1, host4->host_id());
frontend4->AddExpectedEvent(ids4, CHECKING_EVENT);
frontend4->AddExpectedEvent(ids4, DOWNLOADING_EVENT);
frontend4->AddExpectedEvent(ids4, PROGRESS_EVENT);
frontend4->AddExpectedEvent(ids4, PROGRESS_EVENT);
+ frontend4->AddExpectedEvent(ids4, PROGRESS_EVENT); // final
frontend4->AddExpectedEvent(ids4, CACHED_EVENT);
// Host 5 is not associated with cache so no progress/cached events.
@@ -2203,16 +2255,19 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend1->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT);
+ frontend1->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
frontend1->AddExpectedEvent(ids1, UPDATE_READY_EVENT);
MockFrontend::HostIds ids2(1, host2->host_id());
frontend2->AddExpectedEvent(ids2, CHECKING_EVENT);
frontend2->AddExpectedEvent(ids2, DOWNLOADING_EVENT);
frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT);
+ frontend2->AddExpectedEvent(ids2, PROGRESS_EVENT); // final
frontend2->AddExpectedEvent(ids2, UPDATE_READY_EVENT);
MockFrontend::HostIds ids3(1, host3->host_id());
frontend3->AddExpectedEvent(ids3, CHECKING_EVENT);
frontend3->AddExpectedEvent(ids3, DOWNLOADING_EVENT);
frontend3->AddExpectedEvent(ids3, PROGRESS_EVENT);
+ frontend3->AddExpectedEvent(ids3, PROGRESS_EVENT); // final
frontend3->AddExpectedEvent(ids3, UPDATE_READY_EVENT);
MockFrontend::HostIds ids4(1, host4->host_id()); // unassociated w/cache
frontend4->AddExpectedEvent(ids4, CHECKING_EVENT);
@@ -2221,6 +2276,7 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend5->AddExpectedEvent(ids5, CHECKING_EVENT);
frontend5->AddExpectedEvent(ids5, DOWNLOADING_EVENT);
frontend5->AddExpectedEvent(ids5, PROGRESS_EVENT);
+ frontend5->AddExpectedEvent(ids5, PROGRESS_EVENT); // final
frontend5->AddExpectedEvent(ids5, UPDATE_READY_EVENT);
WaitForUpdateToFinish();
@@ -2266,6 +2322,7 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
frontend->AddExpectedEvent(ids1, PROGRESS_EVENT);
frontend->AddExpectedEvent(ids1, PROGRESS_EVENT);
+ frontend->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
frontend->AddExpectedEvent(ids1, CACHED_EVENT);
// Group status will be IDLE so cannot call WaitForUpdateToFinish.
@@ -2372,6 +2429,7 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
frontend->AddExpectedEvent(ids1, PROGRESS_EVENT);
frontend->AddExpectedEvent(ids1, PROGRESS_EVENT);
+ frontend->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
frontend->AddExpectedEvent(ids1, UPDATE_READY_EVENT);
// Seed storage with expected manifest response info that will cause
@@ -2429,6 +2487,7 @@ class AppCacheUpdateJobTest : public testing::Test,
frontend->AddExpectedEvent(ids1, DOWNLOADING_EVENT);
frontend->AddExpectedEvent(ids1, PROGRESS_EVENT);
frontend->AddExpectedEvent(ids1, PROGRESS_EVENT);
+ frontend->AddExpectedEvent(ids1, PROGRESS_EVENT); // final
frontend->AddExpectedEvent(ids1, UPDATE_READY_EVENT);
// Seed storage with expected manifest response info that will cause