update_engine: Use org.chromium.NetworkProxyService.
Make update_engine call Chrome's new
org.chromium.NetworkProxyService D-Bus service to resolve
network proxies instead of using
org.chromium.LibCrosService. The new service supports
asynchronous replies instead of responding via D-Bus
signals.
BUG=chromium:446115,chromium:703217
TEST=unit tests pass; also added debug logging and verified
that chrome's proxy settings are used
Change-Id: Iebd268ea3e551c0760416d955828b9d7ebf851fb
Reviewed-on: https://chromium-review.googlesource.com/497491
Commit-Ready: Dan Erat <derat@chromium.org>
Tested-by: Dan Erat <derat@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
diff --git a/update_manager/real_system_provider.cc b/update_manager/real_system_provider.cc
index fde6bfa..395bf83 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>
+#include <libcros/dbus-proxies.h>
#include "update_engine/common/utils.h"
-#include "update_engine/libcros_proxy.h"
#include "update_engine/update_manager/generic_variables.h"
#include "update_engine/update_manager/variable.h"
@@ -124,9 +124,8 @@
string* required_platform_version) {
#if USE_LIBCROS
brillo::ErrorPtr error;
- if (!libcros_proxy_->service_interface_proxy()
- ->GetKioskAppRequiredPlatformVersion(required_platform_version,
- &error)) {
+ if (!libcros_proxy_->GetKioskAppRequiredPlatformVersion(
+ 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 083943b..a62e1ae 100644
--- a/update_manager/real_system_provider.h
+++ b/update_manager/real_system_provider.h
@@ -24,18 +24,21 @@
#include "update_engine/common/hardware_interface.h"
#include "update_engine/update_manager/system_provider.h"
-namespace chromeos_update_engine {
-class LibCrosProxy;
-}
+namespace org {
+namespace chromium {
+class LibCrosServiceInterfaceProxyInterface;
+} // namespace chromium
+} // namespace org
namespace chromeos_update_manager {
// SystemProvider concrete implementation.
class RealSystemProvider : public SystemProvider {
public:
- RealSystemProvider(chromeos_update_engine::HardwareInterface* hardware,
- chromeos_update_engine::BootControlInterface* boot_control,
- chromeos_update_engine::LibCrosProxy* libcros_proxy)
+ RealSystemProvider(
+ chromeos_update_engine::HardwareInterface* hardware,
+ chromeos_update_engine::BootControlInterface* boot_control,
+ org::chromium::LibCrosServiceInterfaceProxyInterface* libcros_proxy)
: hardware_(hardware),
boot_control_(boot_control),
libcros_proxy_(libcros_proxy) {}
@@ -75,7 +78,8 @@
chromeos_update_engine::HardwareInterface* const hardware_;
chromeos_update_engine::BootControlInterface* const boot_control_;
- chromeos_update_engine::LibCrosProxy* const libcros_proxy_ ALLOW_UNUSED_TYPE;
+ org::chromium::LibCrosServiceInterfaceProxyInterface* const libcros_proxy_
+ ALLOW_UNUSED_TYPE;
DISALLOW_COPY_AND_ASSIGN(RealSystemProvider);
};
diff --git a/update_manager/real_system_provider_unittest.cc b/update_manager/real_system_provider_unittest.cc
index bb42817..2a56f8b 100644
--- a/update_manager/real_system_provider_unittest.cc
+++ b/update_manager/real_system_provider_unittest.cc
@@ -22,11 +22,9 @@
#include <brillo/make_unique_ptr.h>
#include <gtest/gtest.h>
-#include "libcros/dbus-proxies.h"
#include "libcros/dbus-proxy-mocks.h"
#include "update_engine/common/fake_boot_control.h"
#include "update_engine/common/fake_hardware.h"
-#include "update_engine/libcros_proxy.h"
#include "update_engine/update_manager/umtest_utils.h"
using org::chromium::LibCrosServiceInterfaceProxyMock;
@@ -45,19 +43,14 @@
class UmRealSystemProviderTest : public ::testing::Test {
protected:
void SetUp() override {
- service_interface_mock_ = new LibCrosServiceInterfaceProxyMock();
- libcros_proxy_.reset(new chromeos_update_engine::LibCrosProxy(
- brillo::make_unique_ptr(service_interface_mock_),
- unique_ptr<
- org::chromium::
- UpdateEngineLibcrosProxyResolvedInterfaceProxyInterface>()));
- ON_CALL(*service_interface_mock_,
+ libcros_proxy_mock_.reset(new LibCrosServiceInterfaceProxyMock());
+ ON_CALL(*libcros_proxy_mock_,
GetKioskAppRequiredPlatformVersion(_, _, _))
.WillByDefault(
DoAll(SetArgPointee<0>(kRequiredPlatformVersion), Return(true)));
provider_.reset(new RealSystemProvider(&fake_hardware_, &fake_boot_control_,
- libcros_proxy_.get()));
+ libcros_proxy_mock_.get()));
EXPECT_TRUE(provider_->Init());
}
@@ -65,11 +58,7 @@
chromeos_update_engine::FakeBootControl fake_boot_control_;
unique_ptr<RealSystemProvider> provider_;
- // Local pointers to the mocks. The instances are owned by the
- // |libcros_proxy_|.
- LibCrosServiceInterfaceProxyMock* service_interface_mock_;
-
- unique_ptr<chromeos_update_engine::LibCrosProxy> libcros_proxy_;
+ std::unique_ptr<LibCrosServiceInterfaceProxyMock> libcros_proxy_mock_;
};
TEST_F(UmRealSystemProviderTest, InitTest) {
@@ -97,7 +86,7 @@
}
TEST_F(UmRealSystemProviderTest, KioskRequiredPlatformVersionFailure) {
- EXPECT_CALL(*service_interface_mock_,
+ EXPECT_CALL(*libcros_proxy_mock_,
GetKioskAppRequiredPlatformVersion(_, _, _))
.WillOnce(Return(false));
@@ -107,14 +96,14 @@
TEST_F(UmRealSystemProviderTest,
KioskRequiredPlatformVersionRecoveryFromFailure) {
- EXPECT_CALL(*service_interface_mock_,
+ EXPECT_CALL(*libcros_proxy_mock_,
GetKioskAppRequiredPlatformVersion(_, _, _))
.WillOnce(Return(false));
UmTestUtils::ExpectVariableNotSet(
provider_->var_kiosk_required_platform_version());
- testing::Mock::VerifyAndClearExpectations(service_interface_mock_);
+ testing::Mock::VerifyAndClearExpectations(libcros_proxy_mock_.get());
- EXPECT_CALL(*service_interface_mock_,
+ EXPECT_CALL(*libcros_proxy_mock_,
GetKioskAppRequiredPlatformVersion(_, _, _))
.WillOnce(
DoAll(SetArgPointee<0>(kRequiredPlatformVersion), Return(true)));
diff --git a/update_manager/state_factory.cc b/update_manager/state_factory.cc
index e01f769..1da3fb9 100644
--- a/update_manager/state_factory.cc
+++ b/update_manager/state_factory.cc
@@ -21,7 +21,6 @@
#include <base/logging.h>
#include "update_engine/common/clock_interface.h"
-#include "update_engine/libcros_proxy.h"
#include "update_engine/update_manager/real_config_provider.h"
#include "update_engine/update_manager/real_device_policy_provider.h"
#include "update_engine/update_manager/real_random_provider.h"
@@ -39,7 +38,7 @@
policy::PolicyProvider* policy_provider,
chromeos_update_engine::ShillProxy* shill_proxy,
org::chromium::SessionManagerInterfaceProxyInterface* session_manager_proxy,
- chromeos_update_engine::LibCrosProxy* libcros_proxy,
+ org::chromium::LibCrosServiceInterfaceProxyInterface* libcros_proxy,
chromeos_update_engine::SystemState* system_state) {
chromeos_update_engine::ClockInterface* const clock = system_state->clock();
unique_ptr<RealConfigProvider> config_provider(
diff --git a/update_manager/state_factory.h b/update_manager/state_factory.h
index 726deeb..c8db776 100644
--- a/update_manager/state_factory.h
+++ b/update_manager/state_factory.h
@@ -23,9 +23,11 @@
#include "update_engine/system_state.h"
#include "update_engine/update_manager/state.h"
-namespace chromeos_update_engine {
-class LibCrosProxy;
-}
+namespace org {
+namespace chromium {
+class LibCrosServiceInterfaceProxyInterface;
+} // namespace chromium
+} // namespace org
namespace chromeos_update_manager {
@@ -38,7 +40,7 @@
policy::PolicyProvider* policy_provider,
chromeos_update_engine::ShillProxy* shill_proxy,
org::chromium::SessionManagerInterfaceProxyInterface* session_manager_proxy,
- chromeos_update_engine::LibCrosProxy* libcros_proxy,
+ org::chromium::LibCrosServiceInterfaceProxyInterface* libcros_proxy,
chromeos_update_engine::SystemState* system_state);
} // namespace chromeos_update_manager