Remove IsOfficialBuild() from other singleton interfaces.
IsOfficialBuild() is replicated on other singleton interfaces as a
shortcut for accessing the new HardwareInterface. These shortcuts
were used for testing when it wasn't possible to fake out this value
in a more standard way.
This patch removes the IsOfficialBuild() method from all the
singleton interfaces and uses HardwareInterface directly, which
can be faked via the default FakeHardware on MockSystemState.
This helps reduce the actual dependencies on the
UpdateCheckScheduler before migrate it to the PolicyManager.
Some minor linter issues are also solved on this patch.
BUG=chromium:358269
TEST=Unittests still pass.
Change-Id: I19d5add04b8cdc679e918cbc7fe27f688e8da64e
Reviewed-on: https://chromium-review.googlesource.com/192974
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/update_check_scheduler.cc b/update_check_scheduler.cc
index 682bae7..096387b 100644
--- a/update_check_scheduler.cc
+++ b/update_check_scheduler.cc
@@ -5,9 +5,9 @@
#include "update_engine/update_check_scheduler.h"
#include "update_engine/certificate_checker.h"
+#include "update_engine/gpio_handler.h"
#include "update_engine/hardware_interface.h"
#include "update_engine/http_common.h"
-#include "update_engine/gpio_handler.h"
#include "update_engine/system_state.h"
#include "update_engine/utils.h"
@@ -37,7 +37,7 @@
enabled_ = false;
update_attempter_->set_update_check_scheduler(NULL);
- if (!IsOfficialBuild()) {
+ if (!system_state_->hardware()->IsOfficialBuild()) {
LOG(WARNING) << "Non-official build: periodic update checks disabled.";
return;
}
@@ -63,10 +63,6 @@
system_state_->hardware()->BootDevice()));
}
-bool UpdateCheckScheduler::IsOfficialBuild() {
- return system_state_->hardware()->IsOfficialBuild();
-}
-
guint UpdateCheckScheduler::GTimeoutAddSeconds(guint interval,
GSourceFunc function) {
return g_timeout_add_seconds(interval, function, this);