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_unittest.cc b/update_check_scheduler_unittest.cc
index b3497c4..62eb876 100644
--- a/update_check_scheduler_unittest.cc
+++ b/update_check_scheduler_unittest.cc
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "update_engine/update_check_scheduler.h"
+
 #include <gtest/gtest.h>
 
 #include "update_engine/certificate_checker.h"
 #include "update_engine/certificate_checker_mock.h"
 #include "update_engine/mock_system_state.h"
 #include "update_engine/update_attempter_mock.h"
-#include "update_engine/update_check_scheduler.h"
 
 using base::Time;
-using std::string;
 using testing::_;
 using testing::AllOf;
 using testing::Assign;
@@ -28,7 +28,7 @@
   *interval_min = interval - fuzz / 2;
   *interval_max = interval + fuzz - fuzz / 2;
 }
-}  // namespace {}
+}  // namespace
 
 // Test a subclass rather than the main class directly so that we can mock out
 // GLib and utils in tests. There're explicit unit test for the wrapper methods.
@@ -41,7 +41,6 @@
 
   MOCK_METHOD2(GTimeoutAddSeconds, guint(guint seconds, GSourceFunc function));
   MOCK_METHOD0(IsBootDeviceRemovable, bool());
-  MOCK_METHOD0(IsOfficialBuild, bool());
 
   MockSystemState* mock_system_state_;
 };
@@ -170,14 +169,9 @@
   EXPECT_FALSE(scheduler_.UpdateCheckScheduler::IsBootDeviceRemovable());
 }
 
-TEST_F(UpdateCheckSchedulerTest, IsOfficialBuildTest) {
-  // Invokes the actual utils wrapper method rather than the subclass mock.
-  EXPECT_TRUE(scheduler_.UpdateCheckScheduler::IsOfficialBuild());
-}
-
 TEST_F(UpdateCheckSchedulerTest, RunBootDeviceRemovableTest) {
   scheduler_.enabled_ = true;
-  EXPECT_CALL(scheduler_, IsOfficialBuild()).Times(1).WillOnce(Return(true));
+  mock_system_state_.get_fake_hardware()->SetIsOfficialBuild(true);
   EXPECT_CALL(scheduler_, IsBootDeviceRemovable())
       .Times(1)
       .WillOnce(Return(true));
@@ -188,7 +182,7 @@
 
 TEST_F(UpdateCheckSchedulerTest, RunNonOfficialBuildTest) {
   scheduler_.enabled_ = true;
-  EXPECT_CALL(scheduler_, IsOfficialBuild()).Times(1).WillOnce(Return(false));
+  mock_system_state_.get_fake_hardware()->SetIsOfficialBuild(false);
   scheduler_.Run();
   EXPECT_FALSE(scheduler_.enabled_);
   EXPECT_EQ(NULL, attempter_.update_check_scheduler());
@@ -200,7 +194,7 @@
             UpdateCheckScheduler::kTimeoutRegularFuzz,
             &interval_min,
             &interval_max);
-  EXPECT_CALL(scheduler_, IsOfficialBuild()).Times(1).WillOnce(Return(true));
+  mock_system_state_.get_fake_hardware()->SetIsOfficialBuild(true);
   EXPECT_CALL(scheduler_, IsBootDeviceRemovable())
       .Times(1)
       .WillOnce(Return(false));