diff options
author | Miriam Polzer <mpolzer@google.com> | 2020-04-29 17:39:51 +0200 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-05-20 12:42:08 +0000 |
commit | 0cf1acbbdc2d8b75704f5799713f81b33ff00e3c (patch) | |
tree | e17e3cff23570a5541477363dc2ca612fb669307 /update_attempter_unittest.cc | |
parent | e6b888c9c3c5be497b3bb57946f73daba8a21eea (diff) |
update_engine: Add powerwash flag to update status
Add a powerwash flag to the update status which is set to true if and
only if a powerwash takes place. This will ensure that the user is
informed of a pending powerwash exactly when it is going to happen.
BUG=chromium:1070563
TEST=FEATURES=test emerge-amd64-generic update_engine
channel change and update on test device
Cq-Depend: chromium:2187671
Change-Id: I58314ecc7c9c2e64c906ef5b31cb780948196296
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2187672
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Tested-by: Miriam Polzer <mpolzer@google.com>
Commit-Queue: Miriam Polzer <mpolzer@google.com>
Diffstat (limited to 'update_attempter_unittest.cc')
-rw-r--r-- | update_attempter_unittest.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc index 5a6a23e9..3a1646fd 100644 --- a/update_attempter_unittest.cc +++ b/update_attempter_unittest.cc @@ -2317,6 +2317,30 @@ TEST_F(UpdateAttempterTest, IsEnterpriseRollbackInGetStatusTrue) { EXPECT_TRUE(status.is_enterprise_rollback); } +TEST_F(UpdateAttempterTest, PowerwashInGetStatusDefault) { + UpdateEngineStatus status; + attempter_.GetStatus(&status); + EXPECT_FALSE(status.will_powerwash_after_reboot); +} + +TEST_F(UpdateAttempterTest, PowerwashInGetStatusTrueBecausePowerwashRequired) { + attempter_.install_plan_.reset(new InstallPlan); + attempter_.install_plan_->powerwash_required = true; + + UpdateEngineStatus status; + attempter_.GetStatus(&status); + EXPECT_TRUE(status.will_powerwash_after_reboot); +} + +TEST_F(UpdateAttempterTest, PowerwashInGetStatusTrueBecauseRollback) { + attempter_.install_plan_.reset(new InstallPlan); + attempter_.install_plan_->is_rollback = true; + + UpdateEngineStatus status; + attempter_.GetStatus(&status); + EXPECT_TRUE(status.will_powerwash_after_reboot); +} + TEST_F(UpdateAttempterTest, FutureEolTest) { EolDate eol_date = std::numeric_limits<int64_t>::max(); EXPECT_CALL(*prefs_, GetString(kPrefsOmahaEolDate, _)) |