Move IsOfficialBuild() and IsNormalBootMode() into HardwareInterface.
This makes the implementation of the two methods part of the
HardwareInterface, so that unit tests won't end up with meaningless
(and unpredictable) calls to the real functions.
BUG=None
TEST=unit tests
Change-Id: Ia23932634124987c1d6ff0683acb15cf4819bc5e
Reviewed-on: https://chromium-review.googlesource.com/175024
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
diff --git a/fake_hardware.h b/fake_hardware.h
index 5428f28..4351e2c 100644
--- a/fake_hardware.h
+++ b/fake_hardware.h
@@ -14,12 +14,16 @@
public:
FakeHardware()
: boot_device_("/dev/sdz5"),
+ is_official_build_(true),
+ is_normal_boot_mode_(true),
hardware_class_("Fake HWID BLAH-1234"),
firmware_version_("Fake Firmware v1.0.1"),
ec_version_("Fake EC v1.0a") {}
// HardwareInterface methods.
virtual const std::string BootDevice() { return boot_device_; }
+ virtual bool IsOfficialBuild() { return is_official_build_; }
+ virtual bool IsNormalBootMode() { return is_normal_boot_mode_; }
virtual std::string GetHardwareClass() { return hardware_class_; }
virtual std::string GetFirmwareVersion() { return firmware_version_; }
virtual std::string GetECVersion() { return ec_version_; }
@@ -29,6 +33,14 @@
boot_device_ = boot_device;
}
+ void SetIsOfficialBuild(bool is_official_build) {
+ is_official_build_ = is_official_build;
+ }
+
+ void SetIsNormalBootMode(bool is_normal_boot_mode) {
+ is_normal_boot_mode_ = is_normal_boot_mode;
+ }
+
void SetHardwareClass(std::string hardware_class) {
hardware_class_ = hardware_class;
}
@@ -43,6 +55,8 @@
private:
std::string boot_device_;
+ bool is_official_build_;
+ bool is_normal_boot_mode_;
std::string hardware_class_;
std::string firmware_version_;
std::string ec_version_;