update_engine: Change time restrictions to return kSucceeded
Change UpdateTimeRestrictionsPolicyImpl to return kSucceeded
in place of kAskMeAgainLater. Since the former is not an expected
return value.
Background:
Policies in UpdateCanBeApplied should return kSucceeded when
they want to force a decision, since UpdateCanBeApplied is
supposed to only contain sync policies. kAskMeAgainLater is
reserved for async policies.
BUG=chromium:852860
TEST=cros_workon_make update_engine --test and local tests
Change-Id: Ie81a3d09f98ad7aba3c36183873bc153a6b530cf
Reviewed-on: https://chromium-review.googlesource.com/1153624
Commit-Ready: Adolfo Higueros <adokar@google.com>
Tested-by: Adolfo Higueros <adokar@google.com>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: May Lippert <maybelle@chromium.org>
diff --git a/update_manager/chromeos_policy_unittest.cc b/update_manager/chromeos_policy_unittest.cc
index b5b1bd9..96f3d79 100644
--- a/update_manager/chromeos_policy_unittest.cc
+++ b/update_manager/chromeos_policy_unittest.cc
@@ -151,7 +151,7 @@
// Sets up a test with the given intervals and the current fake wallclock
// time.
void TestDisallowedTimeIntervals(const WeeklyTimeIntervalVector& intervals,
- const EvalStatus& expected_status,
+ const ErrorCode& expected_error_code,
bool kiosk) {
SetUpDefaultTimeProvider();
if (kiosk)
@@ -165,12 +165,11 @@
// Check that |expected_status| matches the value of UpdateCheckAllowed
ErrorCode result;
InstallPlan install_plan;
- ExpectPolicyStatus(
- expected_status, &Policy::UpdateCanBeApplied, &result, &install_plan);
- if (expected_status == EvalStatus::kAskMeAgainLater)
- EXPECT_EQ(result, ErrorCode::kOmahaUpdateDeferredPerPolicy);
- else
- EXPECT_EQ(result, ErrorCode::kSuccess);
+ ExpectPolicyStatus(EvalStatus::kSucceeded,
+ &Policy::UpdateCanBeApplied,
+ &result,
+ &install_plan);
+ EXPECT_EQ(result, expected_error_code);
}
};
@@ -1615,7 +1614,7 @@
{WeeklyTimeInterval(
WeeklyTime::FromTime(curr_time),
WeeklyTime::FromTime(curr_time + TimeDelta::FromMinutes(1)))},
- EvalStatus::kSucceeded,
+ ErrorCode::kSuccess,
/* kiosk = */ true);
}
@@ -1625,7 +1624,7 @@
{WeeklyTimeInterval(
WeeklyTime::FromTime(curr_time),
WeeklyTime::FromTime(curr_time + TimeDelta::FromMinutes(1)))},
- EvalStatus::kAskMeAgainLater,
+ ErrorCode::kOmahaUpdateDeferredPerPolicy,
/* kiosk = */ true);
}
@@ -1635,7 +1634,7 @@
{WeeklyTimeInterval(
WeeklyTime::FromTime(curr_time - TimeDelta::FromHours(3)),
WeeklyTime::FromTime(curr_time))},
- EvalStatus::kSucceeded,
+ ErrorCode::kSuccess,
/* kiosk = */ true);
}
@@ -1645,7 +1644,7 @@
{WeeklyTimeInterval(
WeeklyTime::FromTime(curr_time),
WeeklyTime::FromTime(curr_time + TimeDelta::FromMinutes(1)))},
- EvalStatus::kSucceeded,
+ ErrorCode::kSuccess,
/* kiosk = */ false);
}