update_engine: Use org.chromium.KioskAppService service.
Make update_engine use the org.chromium.KioskAppService
D-Bus service exported by Chrome rather than the old methods
under org.chromium.LibCrosService.
BUG=chromium:703229
TEST=unit tests pass; also hacked up RealSystemProvider to
call its GetKioskAppRequiredPlatformVersion and
manually verified that the D-Bus call succeeds
Change-Id: I02d503da1e1aec2319c75e2237c87bfcdcd1f7e5
Reviewed-on: https://chromium-review.googlesource.com/987325
Commit-Ready: Dan Erat <derat@chromium.org>
Tested-by: Dan Erat <derat@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/dbus_bindings/org.chromium.KioskAppService.dbus-xml b/dbus_bindings/org.chromium.KioskAppService.dbus-xml
new file mode 100644
index 0000000..11b888b
--- /dev/null
+++ b/dbus_bindings/org.chromium.KioskAppService.dbus-xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<node name="/org/chromium/KioskAppService"
+ xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
+ <interface name="org.chromium.KioskAppServiceInterface">
+ <method name="GetRequiredPlatformVersion">
+ <arg name="required_platform_version" type="s" direction="out" />
+ </method>
+ </interface>
+</node>
diff --git a/dbus_bindings/org.chromium.LibCrosService.dbus-xml b/dbus_bindings/org.chromium.LibCrosService.dbus-xml
deleted file mode 100644
index 3111c63..0000000
--- a/dbus_bindings/org.chromium.LibCrosService.dbus-xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<node name="/org/chromium/LibCrosService"
- xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
- <interface name="org.chromium.LibCrosServiceInterface">
- <method name="GetKioskAppRequiredPlatformVersion">
- <arg name="required_platform_version" type="s" direction="out" />
- </method>
- </interface>
-</node>
diff --git a/real_system_state.cc b/real_system_state.cc
index 8e7ad51..b39b7b3 100644
--- a/real_system_state.cc
+++ b/real_system_state.cc
@@ -67,8 +67,8 @@
}
#if USE_CHROME_KIOSK_APP
- libcros_proxy_.reset(new org::chromium::LibCrosServiceInterfaceProxy(
- DBusConnection::Get()->GetDBus(), chromeos::kLibCrosServiceName));
+ kiosk_app_proxy_.reset(new org::chromium::KioskAppServiceInterfaceProxy(
+ DBusConnection::Get()->GetDBus(), chromeos::kKioskAppServiceName));
#endif // USE_CHROME_KIOSK_APP
LOG_IF(INFO, !hardware_->IsNormalBootMode()) << "Booted in dev mode.";
@@ -150,7 +150,7 @@
chromeos_update_manager::State* um_state =
chromeos_update_manager::DefaultStateFactory(&policy_provider_,
#if USE_CHROME_KIOSK_APP
- libcros_proxy_.get(),
+ kiosk_app_proxy_.get(),
#else
nullptr,
#endif // USE_CHROME_KIOSK_APP
diff --git a/real_system_state.h b/real_system_state.h
index 49f7c31..f1cd38f 100644
--- a/real_system_state.h
+++ b/real_system_state.h
@@ -25,7 +25,7 @@
#include <policy/device_policy.h>
#if USE_CHROME_KIOSK_APP
-#include <libcros/dbus-proxies.h>
+#include <kiosk-app/dbus-proxies.h>
#endif // USE_CHROME_KIOSK_APP
#include "update_engine/certificate_checker.h"
@@ -129,7 +129,8 @@
private:
// Real DBus proxies using the DBus connection.
#if USE_CHROME_KIOSK_APP
- std::unique_ptr<org::chromium::LibCrosServiceInterfaceProxy> libcros_proxy_;
+ std::unique_ptr<org::chromium::KioskAppServiceInterfaceProxy>
+ kiosk_app_proxy_;
#endif // USE_CHROME_KIOSK_APP
// Interface for the power manager.
diff --git a/update_engine.gyp b/update_engine.gyp
index dc47da4..6da3a28 100644
--- a/update_engine.gyp
+++ b/update_engine.gyp
@@ -103,16 +103,16 @@
'includes': ['../../../platform2/common-mk/generate-dbus-adaptors.gypi'],
},
{
- 'target_name': 'update_engine-dbus-libcros-client',
+ 'target_name': 'update_engine-dbus-kiosk-app-client',
'type': 'none',
'actions': [{
- 'action_name': 'update_engine-dbus-libcros-client-action',
+ 'action_name': 'update_engine-dbus-kiosk-app-client-action',
'variables': {
- 'mock_output_file': 'include/libcros/dbus-proxy-mocks.h',
- 'proxy_output_file': 'include/libcros/dbus-proxies.h',
+ 'mock_output_file': 'include/kiosk-app/dbus-proxy-mocks.h',
+ 'proxy_output_file': 'include/kiosk-app/dbus-proxies.h',
},
'sources': [
- 'dbus_bindings/org.chromium.LibCrosService.dbus-xml',
+ 'dbus_bindings/org.chromium.KioskAppService.dbus-xml',
],
'includes': ['../../../platform2/common-mk/generate-dbus-proxies.gypi'],
}],
@@ -302,7 +302,7 @@
}],
['USE_chrome_kiosk_app == 1', {
'dependencies': [
- 'update_engine-dbus-libcros-client',
+ 'update_engine-dbus-kiosk-app-client',
],
}],
],
diff --git a/update_manager/real_system_provider.cc b/update_manager/real_system_provider.cc
index fdf7e86..53e9ab3 100644
--- a/update_manager/real_system_provider.cc
+++ b/update_manager/real_system_provider.cc
@@ -21,7 +21,7 @@
#include <base/logging.h>
#include <base/time/time.h>
#if USE_CHROME_KIOSK_APP
-#include <libcros/dbus-proxies.h>
+#include <kiosk-app/dbus-proxies.h>
#endif // USE_CHROME_KIOSK_APP
#include "update_engine/common/utils.h"
@@ -126,8 +126,8 @@
string* required_platform_version) {
#if USE_CHROME_KIOSK_APP
brillo::ErrorPtr error;
- if (!libcros_proxy_->GetKioskAppRequiredPlatformVersion(
- required_platform_version, &error)) {
+ if (!kiosk_app_proxy_->GetRequiredPlatformVersion(required_platform_version,
+ &error)) {
LOG(WARNING) << "Failed to get kiosk required platform version";
required_platform_version->clear();
return false;
diff --git a/update_manager/real_system_provider.h b/update_manager/real_system_provider.h
index 80a8615..9d71d0d 100644
--- a/update_manager/real_system_provider.h
+++ b/update_manager/real_system_provider.h
@@ -26,7 +26,7 @@
namespace org {
namespace chromium {
-class LibCrosServiceInterfaceProxyInterface;
+class KioskAppServiceInterfaceProxyInterface;
} // namespace chromium
} // namespace org
@@ -38,11 +38,12 @@
RealSystemProvider(
chromeos_update_engine::HardwareInterface* hardware,
chromeos_update_engine::BootControlInterface* boot_control,
- org::chromium::LibCrosServiceInterfaceProxyInterface* libcros_proxy)
+ org::chromium::KioskAppServiceInterfaceProxyInterface* kiosk_app_proxy)
: hardware_(hardware),
#if USE_CHROME_KIOSK_APP
boot_control_(boot_control),
- libcros_proxy_(libcros_proxy) {}
+ kiosk_app_proxy_(kiosk_app_proxy) {
+ }
#else
boot_control_(boot_control) {}
#endif // USE_CHROME_KIOSK_APP
@@ -83,7 +84,7 @@
chromeos_update_engine::HardwareInterface* const hardware_;
chromeos_update_engine::BootControlInterface* const boot_control_;
#if USE_CHROME_KIOSK_APP
- org::chromium::LibCrosServiceInterfaceProxyInterface* const libcros_proxy_;
+ org::chromium::KioskAppServiceInterfaceProxyInterface* const kiosk_app_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 103a35f..4e4da67 100644
--- a/update_manager/real_system_provider_unittest.cc
+++ b/update_manager/real_system_provider_unittest.cc
@@ -26,10 +26,10 @@
#include "update_engine/common/fake_hardware.h"
#include "update_engine/update_manager/umtest_utils.h"
#if USE_CHROME_KIOSK_APP
-#include "libcros/dbus-proxies.h"
-#include "libcros/dbus-proxy-mocks.h"
+#include "kiosk-app/dbus-proxies.h"
+#include "kiosk-app/dbus-proxy-mocks.h"
-using org::chromium::LibCrosServiceInterfaceProxyMock;
+using org::chromium::KioskAppServiceInterfaceProxyMock;
#endif // USE_CHROME_KIOSK_APP
using std::unique_ptr;
using testing::_;
@@ -49,14 +49,13 @@
protected:
void SetUp() override {
#if USE_CHROME_KIOSK_APP
- libcros_proxy_mock_.reset(new LibCrosServiceInterfaceProxyMock());
- ON_CALL(*libcros_proxy_mock_,
- GetKioskAppRequiredPlatformVersion(_, _, _))
+ kiosk_app_proxy_mock_.reset(new KioskAppServiceInterfaceProxyMock());
+ ON_CALL(*kiosk_app_proxy_mock_, GetRequiredPlatformVersion(_, _, _))
.WillByDefault(
DoAll(SetArgPointee<0>(kRequiredPlatformVersion), Return(true)));
provider_.reset(new RealSystemProvider(
- &fake_hardware_, &fake_boot_control_, libcros_proxy_mock_.get()));
+ &fake_hardware_, &fake_boot_control_, kiosk_app_proxy_mock_.get()));
#else
provider_.reset(
new RealSystemProvider(&fake_hardware_, &fake_boot_control_, nullptr));
@@ -69,7 +68,7 @@
unique_ptr<RealSystemProvider> provider_;
#if USE_CHROME_KIOSK_APP
- unique_ptr<LibCrosServiceInterfaceProxyMock> libcros_proxy_mock_;
+ unique_ptr<KioskAppServiceInterfaceProxyMock> kiosk_app_proxy_mock_;
#endif // USE_CHROME_KIOSK_APP
};
@@ -98,8 +97,7 @@
}
TEST_F(UmRealSystemProviderTest, KioskRequiredPlatformVersionFailure) {
- EXPECT_CALL(*libcros_proxy_mock_,
- GetKioskAppRequiredPlatformVersion(_, _, _))
+ EXPECT_CALL(*kiosk_app_proxy_mock_, GetRequiredPlatformVersion(_, _, _))
.WillOnce(Return(false));
UmTestUtils::ExpectVariableNotSet(
@@ -108,15 +106,13 @@
TEST_F(UmRealSystemProviderTest,
KioskRequiredPlatformVersionRecoveryFromFailure) {
- EXPECT_CALL(*libcros_proxy_mock_,
- GetKioskAppRequiredPlatformVersion(_, _, _))
+ EXPECT_CALL(*kiosk_app_proxy_mock_, GetRequiredPlatformVersion(_, _, _))
.WillOnce(Return(false));
UmTestUtils::ExpectVariableNotSet(
provider_->var_kiosk_required_platform_version());
- testing::Mock::VerifyAndClearExpectations(libcros_proxy_mock_.get());
+ testing::Mock::VerifyAndClearExpectations(kiosk_app_proxy_mock_.get());
- EXPECT_CALL(*libcros_proxy_mock_,
- GetKioskAppRequiredPlatformVersion(_, _, _))
+ EXPECT_CALL(*kiosk_app_proxy_mock_, GetRequiredPlatformVersion(_, _, _))
.WillOnce(
DoAll(SetArgPointee<0>(kRequiredPlatformVersion), Return(true)));
UmTestUtils::ExpectVariableHasValue(
diff --git a/update_manager/state_factory.cc b/update_manager/state_factory.cc
index 208ed51..7293692 100644
--- a/update_manager/state_factory.cc
+++ b/update_manager/state_factory.cc
@@ -46,7 +46,7 @@
State* DefaultStateFactory(
policy::PolicyProvider* policy_provider,
- org::chromium::LibCrosServiceInterfaceProxyInterface* libcros_proxy,
+ org::chromium::KioskAppServiceInterfaceProxyInterface* kiosk_app_proxy,
chromeos_update_engine::SystemState* system_state) {
chromeos_update_engine::ClockInterface* const clock = system_state->clock();
unique_ptr<RealConfigProvider> config_provider(
@@ -70,7 +70,7 @@
#endif // USE_SHILL
unique_ptr<RealRandomProvider> random_provider(new RealRandomProvider());
unique_ptr<RealSystemProvider> system_provider(new RealSystemProvider(
- system_state->hardware(), system_state->boot_control(), libcros_proxy));
+ system_state->hardware(), system_state->boot_control(), kiosk_app_proxy));
unique_ptr<RealTimeProvider> time_provider(new RealTimeProvider(clock));
unique_ptr<RealUpdaterProvider> updater_provider(
diff --git a/update_manager/state_factory.h b/update_manager/state_factory.h
index 689684a..1c1c1d9 100644
--- a/update_manager/state_factory.h
+++ b/update_manager/state_factory.h
@@ -22,7 +22,7 @@
namespace org {
namespace chromium {
-class LibCrosServiceInterfaceProxyInterface;
+class KioskAppServiceInterfaceProxyInterface;
} // namespace chromium
} // namespace org
@@ -35,7 +35,7 @@
// to initialize.
State* DefaultStateFactory(
policy::PolicyProvider* policy_provider,
- org::chromium::LibCrosServiceInterfaceProxyInterface* libcros_proxy,
+ org::chromium::KioskAppServiceInterfaceProxyInterface* kiosk_app_proxy,
chromeos_update_engine::SystemState* system_state);
} // namespace chromeos_update_manager