update_engine: More accurate and general method name
This is a small review that merely changes |UpdateAttempter|'s member
function |IsUpdateRunningOrScheduled()| to a more accurate name and
general name of |IsBusyOrUpdateScheduled()|.
BUG=none
TEST=FEATURES="test" emerge-$BOARD update_engine
Change-Id: I4dcce374c86f61e6cee9d060d915110765a70a79
diff --git a/update_attempter.cc b/update_attempter.cc
index b06807d..31d728b 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -153,7 +153,7 @@
}
bool UpdateAttempter::ScheduleUpdates() {
- if (IsUpdateRunningOrScheduled())
+ if (IsBusyOrUpdateScheduled())
return false;
chromeos_update_manager::UpdateManager* const update_manager =
@@ -1018,7 +1018,7 @@
// a bug that will most likely prevent further automatic update checks. It
// seems better to crash in such cases and restart the update_engine daemon
// into, hopefully, a known good state.
- CHECK(IsUpdateRunningOrScheduled());
+ CHECK(IsBusyOrUpdateScheduled());
}
void UpdateAttempter::UpdateLastCheckedTime() {
@@ -1686,7 +1686,7 @@
return true;
}
-bool UpdateAttempter::IsUpdateRunningOrScheduled() {
+bool UpdateAttempter::IsBusyOrUpdateScheduled() {
return ((status_ != UpdateStatus::IDLE &&
status_ != UpdateStatus::UPDATED_NEED_REBOOT) ||
waiting_for_scheduled_check_);
diff --git a/update_attempter.h b/update_attempter.h
index 3b580ad..880e975 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -407,8 +407,8 @@
// policy is available again.
void UpdateRollbackHappened();
- // Returns whether an update is currently running or scheduled.
- bool IsUpdateRunningOrScheduled();
+ // Returns if an update is: running, applied and needs reboot, or scheduled.
+ bool IsBusyOrUpdateScheduled();
void CalculateStagingParams(bool interactive);
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index b69527d..254579c 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -1710,10 +1710,10 @@
TEST_F(UpdateAttempterTest, UpdateIsNotRunningWhenUpdateAvailable) {
// Default construction for |waiting_for_scheduled_check_| is false.
- EXPECT_FALSE(attempter_.IsUpdateRunningOrScheduled());
+ EXPECT_FALSE(attempter_.IsBusyOrUpdateScheduled());
// Verify in-progress update with UPDATE_AVAILABLE is running
attempter_.status_ = UpdateStatus::UPDATE_AVAILABLE;
- EXPECT_TRUE(attempter_.IsUpdateRunningOrScheduled());
+ EXPECT_TRUE(attempter_.IsBusyOrUpdateScheduled());
}
TEST_F(UpdateAttempterTest, UpdateAttemptFlagsCachedAtUpdateStart) {