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/libcurl_http_fetcher.h b/libcurl_http_fetcher.h
index ff0275a..cc8b7a6 100644
--- a/libcurl_http_fetcher.h
+++ b/libcurl_http_fetcher.h
@@ -15,6 +15,7 @@
#include "update_engine/certificate_checker.h"
#include "update_engine/connection_manager.h"
+#include "update_engine/hardware_interface.h"
#include "update_engine/http_fetcher.h"
#include "update_engine/system_state.h"
@@ -45,8 +46,6 @@
no_network_retry_count_(0),
no_network_max_retries_(0),
idle_seconds_(1),
- force_build_type_(false),
- forced_official_build_(false),
in_write_callback_(false),
sent_byte_(false),
terminate_requested_(false),
@@ -57,7 +56,7 @@
connect_timeout_seconds_(kDownloadConnectTimeoutSeconds) {
// Dev users want a longer timeout (180 seconds) because they may
// be waiting on the dev server to build an image.
- if (!IsOfficialBuild())
+ if (!system_state->hardware()->IsOfficialBuild())
low_speed_time_seconds_ = kDownloadDevModeLowSpeedTimeSeconds;
base::Time time_oobe_complete;
if (!system_state_->IsOOBEComplete(&time_oobe_complete))
@@ -103,11 +102,6 @@
no_network_max_retries_ = retries;
}
- void SetBuildType(bool is_official) {
- force_build_type_ = true;
- forced_official_build_ = is_official;
- }
-
void set_check_certificate(
CertificateChecker::ServerToCheck check_certificate) {
check_certificate_ = check_certificate;
@@ -208,9 +202,6 @@
// False otherwise.
bool IsUpdateAllowedOverCurrentConnection() const;
- // Returns whether or not the current build is official.
- bool IsOfficialBuild() const;
-
// Sets the curl options for HTTP URL.
void SetCurlOptionsForHttp();
@@ -270,11 +261,6 @@
// Seconds to wait before asking libcurl to "perform".
int idle_seconds_;
- // If true, assume the build is official or not, according to
- // forced_official_build_. Useful for testing.
- bool force_build_type_;
- bool forced_official_build_;
-
// If true, we are currently performing a write callback on the delegate.
bool in_write_callback_;