update_engine: Don't require reboot after install.
We don't require a reboot after installing a DLC. Instead just set
Update Engine's status to idle.
Resubmitting now that crbug.com/905704 is fixed.
BUG=chromium:907205,chromium:907632
TEST=Attempt a DLC install, UE no longer prompts for a reboot.
(cherry picked from commit d772aaebdbd0c53d3e46e21df5783d437809108a)
Change-Id: I061ee8d6268a922ae21f310211acea5b645a3ebb
Reviewed-on: https://chromium-review.googlesource.com/1362572
Commit-Ready: Colin Howes <chowes@google.com>
Tested-by: Colin Howes <chowes@google.com>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index 50c72f0..179b455 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -1051,6 +1051,13 @@
system_state_->payload_state()->SetStagingWaitPeriod(TimeDelta());
prefs_->Delete(kPrefsUpdateFirstSeenAt);
+ if (is_install_) {
+ LOG(INFO) << "DLC successfully installed, no reboot needed.";
+ SetStatusAndNotify(UpdateStatus::IDLE);
+ ScheduleUpdates();
+ return;
+ }
+
SetStatusAndNotify(UpdateStatus::UPDATED_NEED_REBOOT);
ScheduleUpdates();
LOG(INFO) << "Update successfully applied, waiting to reboot.";
diff --git a/update_attempter.h b/update_attempter.h
index 7371507..9e1f2ac 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -271,6 +271,7 @@
FRIEND_TEST(UpdateAttempterTest, CreatePendingErrorEventResumedTest);
FRIEND_TEST(UpdateAttempterTest, DisableDeltaUpdateIfNeededTest);
FRIEND_TEST(UpdateAttempterTest, DownloadProgressAccumulationTest);
+ FRIEND_TEST(UpdateAttempterTest, InstallSetsStatusIdle);
FRIEND_TEST(UpdateAttempterTest, MarkDeltaUpdateFailureTest);
FRIEND_TEST(UpdateAttempterTest, PingOmahaTest);
FRIEND_TEST(UpdateAttempterTest, ReportDailyMetrics);
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index f2905bc..3209f15 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -1216,6 +1216,17 @@
EXPECT_EQ("", attempter_.forced_omaha_url());
}
+TEST_F(UpdateAttempterTest, InstallSetsStatusIdle) {
+ attempter_.CheckForInstall({}, "http://foo.bar");
+ attempter_.status_ = UpdateStatus::DOWNLOADING;
+ EXPECT_TRUE(attempter_.is_install_);
+ attempter_.ProcessingDone(nullptr, ErrorCode::kSuccess);
+ UpdateEngineStatus status;
+ attempter_.GetStatus(&status);
+ // Should set status to idle after an install operation.
+ EXPECT_EQ(UpdateStatus::IDLE, status.status);
+}
+
TEST_F(UpdateAttempterTest, RollbackAfterInstall) {
attempter_.is_install_ = true;
attempter_.Rollback(false);