PolicyManager: UpdateCheckAllowed policy initial implementation.
This patch implements the UpdateCheckAllowed policy for ChromeOS
using the same logic we had on update_check_scheduler.cc. It checks
for updates onces every 45 minutes and does an exponential backoff
up to 4 hours when the update check fails. Some other parts of the
policy are not implemented, such as retry an update check with a
short delay on certain failures.
BUG=chromium:358269
TEST=Unittests added to the policy.
Change-Id: Ief8deff47fd6490bd70a22ba20abed05fcc37ab4
Reviewed-on: https://chromium-review.googlesource.com/197595
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/policy_manager/pmtest_utils.h b/policy_manager/pmtest_utils.h
index d9f98ce..79a7733 100644
--- a/policy_manager/pmtest_utils.h
+++ b/policy_manager/pmtest_utils.h
@@ -5,10 +5,13 @@
#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_PMTEST_UTILS_H_
#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_PMTEST_UTILS_H_
+#include <iostream>
+
#include <base/memory/scoped_ptr.h>
#include <base/time/time.h>
#include <gtest/gtest.h>
+#include "update_engine/policy_manager/policy.h"
#include "update_engine/policy_manager/variable.h"
// Convenience macros for checking null-ness of pointers.
@@ -58,6 +61,10 @@
static const unsigned kDefaultTimeoutInSeconds;
};
+// PrintTo() functions are used by gtest to print these values. They need to be
+// defined on the same namespace where the type was defined.
+void PrintTo(const EvalStatus& status, ::std::ostream* os);
+
} // namespace chromeos_policy_manager
#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_PMTEST_UTILS_H_