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
(cherry picked from commit 941cf235c5e56eddc6e4f2de2f38bee032a4dead)
Cherry-pick updated to resolve conflicts with existing code in AOSP.
Change-Id: I8c0704482e9988fe9ed14d32797b3a5b8da3d46a
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 44d5566..9b968ca 100644
--- a/update_manager/real_system_provider.cc
+++ b/update_manager/real_system_provider.cc
@@ -20,11 +20,11 @@
#include <base/callback.h>
#include <base/logging.h>
#include <base/time/time.h>
+#if USE_LIBCROS
+#include <libcros/dbus-proxies.h>
+#endif
#include "update_engine/common/utils.h"
-#if USE_LIBCROS
-#include "update_engine/libcros_proxy.h"
-#endif
#include "update_engine/update_manager/generic_variables.h"
#include "update_engine/update_manager/variable.h"
@@ -126,9 +126,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 c997ad8..821a6cc 100644
--- a/update_manager/real_system_provider_unittest.cc
+++ b/update_manager/real_system_provider_unittest.cc
@@ -29,7 +29,6 @@
#if USE_LIBCROS
#include "libcros/dbus-proxies.h"
#include "libcros/dbus-proxy-mocks.h"
-#include "update_engine/libcros_proxy.h"
using org::chromium::LibCrosServiceInterfaceProxyMock;
#endif // USE_LIBCROS
@@ -51,19 +50,14 @@
protected:
void SetUp() override {
#if USE_LIBCROS
- 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()));
+ &fake_hardware_, &fake_boot_control_, libcros_proxy_mock_.get()));
#else
provider_.reset(
new RealSystemProvider(&fake_hardware_, &fake_boot_control_, nullptr));
@@ -76,11 +70,7 @@
unique_ptr<RealSystemProvider> provider_;
#if USE_LIBCROS
- // 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_;
+ unique_ptr<LibCrosServiceInterfaceProxyMock> libcros_proxy_mock_;
#endif // USE_LIBCROS
};
@@ -109,7 +99,7 @@
}
TEST_F(UmRealSystemProviderTest, KioskRequiredPlatformVersionFailure) {
- EXPECT_CALL(*service_interface_mock_,
+ EXPECT_CALL(*libcros_proxy_mock_,
GetKioskAppRequiredPlatformVersion(_, _, _))
.WillOnce(Return(false));
@@ -119,14 +109,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 2b3ce63..70fc80b 100644
--- a/update_manager/state_factory.cc
+++ b/update_manager/state_factory.cc
@@ -47,7 +47,7 @@
State* DefaultStateFactory(
policy::PolicyProvider* policy_provider,
- 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 f1b576c..689684a 100644
--- a/update_manager/state_factory.h
+++ b/update_manager/state_factory.h
@@ -20,9 +20,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 {
@@ -33,7 +35,7 @@
// to initialize.
State* DefaultStateFactory(
policy::PolicyProvider* policy_provider,
- chromeos_update_engine::LibCrosProxy* libcros_proxy,
+ org::chromium::LibCrosServiceInterfaceProxyInterface* libcros_proxy,
chromeos_update_engine::SystemState* system_state);
} // namespace chromeos_update_manager