Move IsBootDeviceRemovable() to the HardwareInterface.
The UpdateCheckScheduler class had a IsBootDeviceRemovable method to
mock out the value during testing of that class. Instead, this patch
uses the HardwareInterface to mock out that value.
BUG=chromium:358269
TEST=Unittests updated.
Change-Id: Ib20f70fa0468aaa4bc8bb1b674084bd9a61e5085
Reviewed-on: https://chromium-review.googlesource.com/197598
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/update_check_scheduler_unittest.cc b/update_check_scheduler_unittest.cc
index 608b6a6..74daaf3 100644
--- a/update_check_scheduler_unittest.cc
+++ b/update_check_scheduler_unittest.cc
@@ -40,7 +40,6 @@
fake_system_state_(fake_system_state) {}
MOCK_METHOD2(GTimeoutAddSeconds, guint(guint seconds, GSourceFunc function));
- MOCK_METHOD0(IsBootDeviceRemovable, bool());
FakeSystemState* fake_system_state_;
};
@@ -164,17 +163,10 @@
g_main_loop_unref(loop_);
}
-TEST_F(UpdateCheckSchedulerTest, IsBootDeviceRemovableTest) {
- // Invokes the actual utils wrapper method rather than the subclass mock.
- EXPECT_FALSE(scheduler_.UpdateCheckScheduler::IsBootDeviceRemovable());
-}
-
TEST_F(UpdateCheckSchedulerTest, RunBootDeviceRemovableTest) {
scheduler_.enabled_ = true;
fake_system_state_.fake_hardware()->SetIsOfficialBuild(true);
- EXPECT_CALL(scheduler_, IsBootDeviceRemovable())
- .Times(1)
- .WillOnce(Return(true));
+ fake_system_state_.fake_hardware()->SetIsBootDeviceRemovable(true);
scheduler_.Run();
EXPECT_FALSE(scheduler_.enabled_);
EXPECT_EQ(NULL, attempter_.update_check_scheduler());
@@ -195,9 +187,7 @@
&interval_min,
&interval_max);
fake_system_state_.fake_hardware()->SetIsOfficialBuild(true);
- EXPECT_CALL(scheduler_, IsBootDeviceRemovable())
- .Times(1)
- .WillOnce(Return(false));
+ fake_system_state_.fake_hardware()->SetIsBootDeviceRemovable(false);
EXPECT_CALL(scheduler_,
GTimeoutAddSeconds(AllOf(Ge(interval_min), Le(interval_max)),
scheduler_.StaticCheck)).Times(1);