update_engine: Breaks the use of libcros into two dbus proxies.
This CL breaks USE_LIBCROS into two defines:
USE_CHROME_NETWORK_PROXY
USE_CHROME_KIOSK_APP
and changes all related build artifacts for both chrome and android.
Breaks USE_libcros into USE_chrome_network_proxy and USE_chrome_kiosk_app.
Removes BRILL_USE_LIBCROS.
Replaces __BRILLO__ with USE_OMAHA.
BUG=chromium:717306
TEST=Ran test 'cros_workon_make --board=amd64-generic --test update_engine'
for all four conditions of the newly introduced two flags.
Change-Id: I9ca5b35c22a17c45a861db6a434239096a896127
Reviewed-on: https://chromium-review.googlesource.com/596802
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Tested-by: Sen Jiang <senj@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
diff --git a/update_manager/real_system_provider.cc b/update_manager/real_system_provider.cc
index 9b968ca..fdf7e86 100644
--- a/update_manager/real_system_provider.cc
+++ b/update_manager/real_system_provider.cc
@@ -20,9 +20,9 @@
#include <base/callback.h>
#include <base/logging.h>
#include <base/time/time.h>
-#if USE_LIBCROS
+#if USE_CHROME_KIOSK_APP
#include <libcros/dbus-proxies.h>
-#endif
+#endif // USE_CHROME_KIOSK_APP
#include "update_engine/common/utils.h"
#include "update_engine/update_manager/generic_variables.h"
@@ -124,7 +124,7 @@
bool RealSystemProvider::GetKioskAppRequiredPlatformVersion(
string* required_platform_version) {
-#if USE_LIBCROS
+#if USE_CHROME_KIOSK_APP
brillo::ErrorPtr error;
if (!libcros_proxy_->GetKioskAppRequiredPlatformVersion(
required_platform_version, &error)) {
@@ -132,7 +132,7 @@
required_platform_version->clear();
return false;
}
-#endif
+#endif // USE_CHROME_KIOSK_APP
return true;
}
diff --git a/update_manager/real_system_provider.h b/update_manager/real_system_provider.h
index a62e1ae..80a8615 100644
--- a/update_manager/real_system_provider.h
+++ b/update_manager/real_system_provider.h
@@ -40,8 +40,12 @@
chromeos_update_engine::BootControlInterface* boot_control,
org::chromium::LibCrosServiceInterfaceProxyInterface* libcros_proxy)
: hardware_(hardware),
+#if USE_CHROME_KIOSK_APP
boot_control_(boot_control),
libcros_proxy_(libcros_proxy) {}
+#else
+ boot_control_(boot_control) {}
+#endif // USE_CHROME_KIOSK_APP
// Initializes the provider and returns whether it succeeded.
bool Init();
@@ -78,8 +82,9 @@
chromeos_update_engine::HardwareInterface* const hardware_;
chromeos_update_engine::BootControlInterface* const boot_control_;
- org::chromium::LibCrosServiceInterfaceProxyInterface* const libcros_proxy_
- ALLOW_UNUSED_TYPE;
+#if USE_CHROME_KIOSK_APP
+ org::chromium::LibCrosServiceInterfaceProxyInterface* const libcros_proxy_;
+#endif // USE_CHROME_KIOSK_APP
DISALLOW_COPY_AND_ASSIGN(RealSystemProvider);
};
diff --git a/update_manager/real_system_provider_unittest.cc b/update_manager/real_system_provider_unittest.cc
index 821a6cc..33838e5 100644
--- a/update_manager/real_system_provider_unittest.cc
+++ b/update_manager/real_system_provider_unittest.cc
@@ -26,30 +26,30 @@
#include "update_engine/common/fake_boot_control.h"
#include "update_engine/common/fake_hardware.h"
#include "update_engine/update_manager/umtest_utils.h"
-#if USE_LIBCROS
+#if USE_CHROME_KIOSK_APP
#include "libcros/dbus-proxies.h"
#include "libcros/dbus-proxy-mocks.h"
using org::chromium::LibCrosServiceInterfaceProxyMock;
-#endif // USE_LIBCROS
+#endif // USE_CHROME_KIOSK_APP
using std::unique_ptr;
using testing::_;
using testing::DoAll;
using testing::Return;
using testing::SetArgPointee;
-#if USE_LIBCROS
+#if USE_CHROME_KIOSK_APP
namespace {
const char kRequiredPlatformVersion[] ="1234.0.0";
} // namespace
-#endif // USE_LIBCROS
+#endif // USE_CHROME_KIOSK_APP
namespace chromeos_update_manager {
class UmRealSystemProviderTest : public ::testing::Test {
protected:
void SetUp() override {
-#if USE_LIBCROS
+#if USE_CHROME_KIOSK_APP
libcros_proxy_mock_.reset(new LibCrosServiceInterfaceProxyMock());
ON_CALL(*libcros_proxy_mock_,
GetKioskAppRequiredPlatformVersion(_, _, _))
@@ -61,7 +61,7 @@
#else
provider_.reset(
new RealSystemProvider(&fake_hardware_, &fake_boot_control_, nullptr));
-#endif // USE_LIBCROS
+#endif // USE_CHROME_KIOSK_APP
EXPECT_TRUE(provider_->Init());
}
@@ -69,9 +69,9 @@
chromeos_update_engine::FakeBootControl fake_boot_control_;
unique_ptr<RealSystemProvider> provider_;
-#if USE_LIBCROS
+#if USE_CHROME_KIOSK_APP
unique_ptr<LibCrosServiceInterfaceProxyMock> libcros_proxy_mock_;
-#endif // USE_LIBCROS
+#endif // USE_CHROME_KIOSK_APP
};
TEST_F(UmRealSystemProviderTest, InitTest) {
@@ -91,7 +91,7 @@
UmTestUtils::ExpectVariableHasValue(false, provider_->var_is_oobe_complete());
}
-#if USE_LIBCROS
+#if USE_CHROME_KIOSK_APP
TEST_F(UmRealSystemProviderTest, KioskRequiredPlatformVersion) {
UmTestUtils::ExpectVariableHasValue(
std::string(kRequiredPlatformVersion),
@@ -129,6 +129,6 @@
UmTestUtils::ExpectVariableHasValue(
std::string(), provider_->var_kiosk_required_platform_version());
}
-#endif
+#endif // USE_CHROME_KIOSK_APP
} // namespace chromeos_update_manager
diff --git a/update_manager/state_factory.cc b/update_manager/state_factory.cc
index 70fc80b..a79b676 100644
--- a/update_manager/state_factory.cc
+++ b/update_manager/state_factory.cc
@@ -73,6 +73,7 @@
unique_ptr<RealRandomProvider> random_provider(new RealRandomProvider());
unique_ptr<RealSystemProvider> system_provider(new RealSystemProvider(
system_state->hardware(), system_state->boot_control(), libcros_proxy));
+
unique_ptr<RealTimeProvider> time_provider(new RealTimeProvider(clock));
unique_ptr<RealUpdaterProvider> updater_provider(
new RealUpdaterProvider(system_state));