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.cc b/libcurl_http_fetcher.cc
index 57f0595..886a446 100644
--- a/libcurl_http_fetcher.cc
+++ b/libcurl_http_fetcher.cc
@@ -56,11 +56,6 @@
return is_allowed;
}
-bool LibcurlHttpFetcher::IsOfficialBuild() const {
- return force_build_type_ ? forced_official_build_
- : system_state_->hardware()->IsOfficialBuild();
-}
-
bool LibcurlHttpFetcher::GetProxyType(const std::string& proxy,
curl_proxytype* out_type) {
if (utils::StringHasPrefix(proxy, "socks5://") ||
@@ -199,7 +194,7 @@
// If we are running in test mode or using a dev/test build, then lock down
// the appropriate curl options for HTTP or HTTPS depending on the url.
- if (!is_test_mode_ && IsOfficialBuild()) {
+ if (!is_test_mode_ && GetSystemState()->hardware()->IsOfficialBuild()) {
if (StartsWithASCII(url_to_use, "http://", false))
SetCurlOptionsForHttp();
else