In update_client, emit different events in the noupdate and update error cases.
Bug: 804472
Change-Id: I0425bcea8cd82386dbcd0fe63fa696e60a468af2
Reviewed-on: https://chromium-review.googlesource.com/879165
Reviewed-by: Bernhard Bauer <[email protected]>
Reviewed-by: Joshua Pawlicki <[email protected]>
Commit-Queue: Sorin Jianu <[email protected]>
Cr-Commit-Position: refs/heads/master@{#531276}
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 3314b60..3880cd2 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -4631,8 +4631,8 @@
<message name="IDS_COMPONENTS_SVC_STATUS_UPTODATE" desc="Service Status">
Up-to-date
</message>
- <message name="IDS_COMPONENTS_SVC_STATUS_NOUPDATE" desc="Service Status">
- No update
+ <message name="IDS_COMPONENTS_SVC_STATUS_UPDATE_ERROR" desc="Service Status">
+ Update error
</message>
<message name="IDS_COMPONENTS_UNKNOWN" desc="Service Status">
Unknown
@@ -4655,6 +4655,9 @@
<message name="IDS_COMPONENTS_EVT_STATUS_NOTUPDATED" desc="Service Status">
Component not updated
</message>
+ <message name="IDS_COMPONENTS_EVT_STATUS_UPDATE_ERROR" desc="Service Status">
+ Update error
+ </message>
<message name="IDS_COMPONENTS_EVT_STATUS_DOWNLOADING" desc="Service Status">
Component downloading
</message>
diff --git a/chrome/browser/component_updater/sw_reporter_installer_win.cc b/chrome/browser/component_updater/sw_reporter_installer_win.cc
index 1e3b8ecf..900a761 100644
--- a/chrome/browser/component_updater/sw_reporter_installer_win.cc
+++ b/chrome/browser/component_updater/sw_reporter_installer_win.cc
@@ -449,7 +449,8 @@
if (id != kSwReporterComponentId)
return;
- if (event == Events::COMPONENT_NOT_UPDATED) {
+ if (event == Events::COMPONENT_NOT_UPDATED ||
+ event == Events::COMPONENT_UPDATE_ERROR) {
ReportOnDemandUpdateSucceededHistogram(false);
std::move(on_error_callback_).Run();
cus_->RemoveObserver(this);
diff --git a/chrome/browser/component_updater/sw_reporter_installer_win_unittest.cc b/chrome/browser/component_updater/sw_reporter_installer_win_unittest.cc
index 7ca7172c..403d269e 100644
--- a/chrome/browser/component_updater/sw_reporter_installer_win_unittest.cc
+++ b/chrome/browser/component_updater/sw_reporter_installer_win_unittest.cc
@@ -687,7 +687,7 @@
EXPECT_CALL(mock_cus_, RemoveObserver(_)).Times(AtLeast(1));
}
- void CreateOnDemandFetcherAndVerifyExpecations(bool can_be_updated) {
+ void CreateOnDemandFetcherAndVerifyExpectations(bool can_be_updated) {
component_can_be_updated_ = can_be_updated;
fetcher_ = base::MakeUnique<SwReporterOnDemandFetcher>(
@@ -735,7 +735,7 @@
void FireComponentNotUpdatedEvents() {
fetcher_->OnEvent(Events::COMPONENT_CHECKING_FOR_UPDATES,
kSwReporterComponentId);
- fetcher_->OnEvent(Events::COMPONENT_NOT_UPDATED, kSwReporterComponentId);
+ fetcher_->OnEvent(Events::COMPONENT_UPDATE_ERROR, kSwReporterComponentId);
EXPECT_TRUE(error_callback_called_);
}
@@ -750,13 +750,13 @@
};
TEST_F(SwReporterOnDemandFetcherTest, TestUpdateSuccess) {
- CreateOnDemandFetcherAndVerifyExpecations(true);
+ CreateOnDemandFetcherAndVerifyExpectations(true);
EXPECT_TRUE(on_demand_update_called_);
}
TEST_F(SwReporterOnDemandFetcherTest, TestUpdateFailure) {
- CreateOnDemandFetcherAndVerifyExpecations(false);
+ CreateOnDemandFetcherAndVerifyExpectations(false);
EXPECT_TRUE(on_demand_update_called_);
}
diff --git a/chrome/browser/plugins/plugin_observer.cc b/chrome/browser/plugins/plugin_observer.cc
index 528d987..24f40fc 100644
--- a/chrome/browser/plugins/plugin_observer.cc
+++ b/chrome/browser/plugins/plugin_observer.cc
@@ -109,6 +109,7 @@
plugin_renderer_interface_->UpdateDownloading();
break;
case Events::COMPONENT_NOT_UPDATED:
+ case Events::COMPONENT_UPDATE_ERROR:
plugin_renderer_interface_->UpdateFailure();
observer_->RemoveComponentObserver(this);
break;
diff --git a/chrome/browser/ui/webui/components_ui.cc b/chrome/browser/ui/webui/components_ui.cc
index 1d24e81..f58e250 100644
--- a/chrome/browser/ui/webui/components_ui.cc
+++ b/chrome/browser/ui/webui/components_ui.cc
@@ -214,6 +214,8 @@
return l10n_util::GetStringUTF16(IDS_COMPONENTS_EVT_STATUS_UPDATED);
case Events::COMPONENT_NOT_UPDATED:
return l10n_util::GetStringUTF16(IDS_COMPONENTS_EVT_STATUS_NOTUPDATED);
+ case Events::COMPONENT_UPDATE_ERROR:
+ return l10n_util::GetStringUTF16(IDS_COMPONENTS_EVT_STATUS_UPDATE_ERROR);
case Events::COMPONENT_UPDATE_DOWNLOADING:
return l10n_util::GetStringUTF16(IDS_COMPONENTS_EVT_STATUS_DOWNLOADING);
}
@@ -245,7 +247,7 @@
case update_client::ComponentState::kUpToDate:
return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPTODATE);
case update_client::ComponentState::kUpdateError:
- return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_NOUPDATE);
+ return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDATE_ERROR);
case update_client::ComponentState::kUninstalled: // Fall through.
case update_client::ComponentState::kRun:
case update_client::ComponentState::kLastStatus:
diff --git a/components/component_updater/component_updater_service.cc b/components/component_updater/component_updater_service.cc
index 54d0161..b1304c5d 100644
--- a/components/component_updater/component_updater_service.cc
+++ b/components/component_updater/component_updater_service.cc
@@ -400,7 +400,8 @@
// Unblock all throttles for the component.
if (event == Observer::Events::COMPONENT_UPDATED ||
- event == Observer::Events::COMPONENT_NOT_UPDATED) {
+ event == Observer::Events::COMPONENT_NOT_UPDATED ||
+ event == Observer::Events::COMPONENT_UPDATE_ERROR) {
auto callbacks = ready_callbacks_.equal_range(id);
for (auto it = callbacks.first; it != callbacks.second; ++it) {
std::move(it->second).Run();
diff --git a/components/update_client/component.cc b/components/update_client/component.cc
index e6fb571..daf40fe 100644
--- a/components/update_client/component.cc
+++ b/components/update_client/component.cc
@@ -393,7 +393,7 @@
component.AppendEvent(BuildUpdateCompleteEventElement(component));
TransitionState(nullptr);
- component.NotifyObservers(Events::COMPONENT_NOT_UPDATED);
+ component.NotifyObservers(Events::COMPONENT_UPDATE_ERROR);
}
Component::StateCanUpdate::StateCanUpdate(Component* component)
diff --git a/components/update_client/update_client.h b/components/update_client/update_client.h
index a806057..f0796503 100644
--- a/components/update_client/update_client.h
+++ b/components/update_client/update_client.h
@@ -299,10 +299,15 @@
// Sent when a CRX has been successfully updated.
COMPONENT_UPDATED,
- // Sent when a CRX has not been updated following an update check:
- // either there was no update available, or the update failed.
+ // Sent when a CRX has not been updated because there was no update
+ // available for this component.
COMPONENT_NOT_UPDATED,
+ // Sent when an error ocurred during an update for any reason, including
+ // the update check itself failed, or the download of the update payload
+ // failed, or applying the update failed.
+ COMPONENT_UPDATE_ERROR,
+
// Sent when CRX bytes are being downloaded.
COMPONENT_UPDATE_DOWNLOADING,
};
diff --git a/components/update_client/update_client_unittest.cc b/components/update_client/update_client_unittest.cc
index e3e8846..57fefe0 100644
--- a/components/update_client/update_client_unittest.cc
+++ b/components/update_client/update_client_unittest.cc
@@ -1014,8 +1014,9 @@
EXPECT_CALL(observer, OnEvent(Events::COMPONENT_UPDATE_DOWNLOADING,
"jebgalgnebhfojomionfpkfelancnnkf"))
.Times(AtLeast(1));
- EXPECT_CALL(observer, OnEvent(Events::COMPONENT_NOT_UPDATED,
- "jebgalgnebhfojomionfpkfelancnnkf")).Times(1);
+ EXPECT_CALL(observer, OnEvent(Events::COMPONENT_UPDATE_ERROR,
+ "jebgalgnebhfojomionfpkfelancnnkf"))
+ .Times(1);
}
{
InSequence seq;
@@ -1544,8 +1545,9 @@
.Times(AtLeast(1));
EXPECT_CALL(observer, OnEvent(Events::COMPONENT_UPDATE_READY,
"jebgalgnebhfojomionfpkfelancnnkf")).Times(1);
- EXPECT_CALL(observer, OnEvent(Events::COMPONENT_NOT_UPDATED,
- "jebgalgnebhfojomionfpkfelancnnkf")).Times(1);
+ EXPECT_CALL(observer, OnEvent(Events::COMPONENT_UPDATE_ERROR,
+ "jebgalgnebhfojomionfpkfelancnnkf"))
+ .Times(1);
}
update_client->AddObserver(&observer);
@@ -2812,7 +2814,7 @@
EXPECT_CALL(observer, OnEvent(Events::COMPONENT_UPDATE_FOUND,
"jebgalgnebhfojomionfpkfelancnnkf"))
.Times(1);
- EXPECT_CALL(observer, OnEvent(Events::COMPONENT_NOT_UPDATED,
+ EXPECT_CALL(observer, OnEvent(Events::COMPONENT_UPDATE_ERROR,
"jebgalgnebhfojomionfpkfelancnnkf"))
.Times(1);
}
@@ -2926,7 +2928,7 @@
EXPECT_CALL(observer, OnEvent(Events::COMPONENT_CHECKING_FOR_UPDATES,
"jebgalgnebhfojomionfpkfelancnnkf"))
.Times(1);
- EXPECT_CALL(observer, OnEvent(Events::COMPONENT_NOT_UPDATED,
+ EXPECT_CALL(observer, OnEvent(Events::COMPONENT_UPDATE_ERROR,
"jebgalgnebhfojomionfpkfelancnnkf"))
.Times(1)
.WillOnce(Invoke([&update_client](Events event, const std::string& id) {