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_attempter_unittest.cc b/update_attempter_unittest.cc
index 0eaedf5..e3dab7d 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -34,8 +34,8 @@
#include <policy/libpolicy.h>
#include <policy/mock_device_policy.h>
-#include "libcros/dbus-proxies.h"
-#include "libcros/dbus-proxy-mocks.h"
+#include "network_proxy/dbus-proxies.h"
+#include "network_proxy/dbus-proxy-mocks.h"
#include "update_engine/common/fake_clock.h"
#include "update_engine/common/fake_prefs.h"
#include "update_engine/common/mock_action.h"
@@ -56,8 +56,9 @@
using base::Time;
using base::TimeDelta;
-using org::chromium::LibCrosServiceInterfaceProxyMock;
-using org::chromium::UpdateEngineLibcrosProxyResolvedInterfaceProxyMock;
+using org::chromium::debugdProxyMock;
+using org::chromium::NetworkProxyServiceInterfaceProxyInterface;
+using org::chromium::NetworkProxyServiceInterfaceProxyMock;
using std::string;
using std::unique_ptr;
using testing::DoAll;
@@ -79,10 +80,12 @@
// methods.
class UpdateAttempterUnderTest : public UpdateAttempter {
public:
- UpdateAttempterUnderTest(SystemState* system_state,
- LibCrosProxy* libcros_proxy,
- org::chromium::debugdProxyInterface* debugd_proxy)
- : UpdateAttempter(system_state, nullptr, libcros_proxy, debugd_proxy) {}
+ UpdateAttempterUnderTest(
+ SystemState* system_state,
+ NetworkProxyServiceInterfaceProxyInterface* network_proxy_service_proxy,
+ org::chromium::debugdProxyInterface* debugd_proxy)
+ : UpdateAttempter(system_state, nullptr, network_proxy_service_proxy,
+ debugd_proxy) {}
// Wrap the update scheduling method, allowing us to opt out of scheduled
// updates for testing purposes.
@@ -111,13 +114,7 @@
class UpdateAttempterTest : public ::testing::Test {
protected:
UpdateAttempterTest()
- : service_interface_mock_(new LibCrosServiceInterfaceProxyMock()),
- ue_proxy_resolved_interface_mock_(
- new NiceMock<UpdateEngineLibcrosProxyResolvedInterfaceProxyMock>()),
- libcros_proxy_(
- brillo::make_unique_ptr(service_interface_mock_),
- brillo::make_unique_ptr(ue_proxy_resolved_interface_mock_)),
- certificate_checker_(fake_system_state_.mock_prefs(),
+ : certificate_checker_(fake_system_state_.mock_prefs(),
&openssl_wrapper_) {
// Override system state members.
fake_system_state_.set_connection_manager(&mock_connection_manager);
@@ -189,14 +186,11 @@
FakeSystemState fake_system_state_;
org::chromium::debugdProxyMock debugd_proxy_mock_;
- LibCrosServiceInterfaceProxyMock* service_interface_mock_;
- UpdateEngineLibcrosProxyResolvedInterfaceProxyMock*
- ue_proxy_resolved_interface_mock_;
- LibCrosProxy libcros_proxy_;
+ NetworkProxyServiceInterfaceProxyMock network_proxy_service_proxy_mock_;
OpenSSLWrapper openssl_wrapper_;
CertificateChecker certificate_checker_;
UpdateAttempterUnderTest attempter_{&fake_system_state_,
- &libcros_proxy_,
+ &network_proxy_service_proxy_mock_,
&debugd_proxy_mock_};
NiceMock<MockActionProcessor>* processor_;
@@ -256,7 +250,8 @@
EXPECT_TRUE(utils::GetBootId(&boot_id));
fake_prefs.SetString(kPrefsUpdateCompletedOnBootId, boot_id);
fake_system_state_.set_prefs(&fake_prefs);
- UpdateAttempterUnderTest attempter(&fake_system_state_, &libcros_proxy_,
+ UpdateAttempterUnderTest attempter(&fake_system_state_,
+ &network_proxy_service_proxy_mock_,
&debugd_proxy_mock_);
attempter.Init();
EXPECT_EQ(UpdateStatus::UPDATED_NEED_REBOOT, attempter.status());
@@ -926,7 +921,7 @@
TEST_F(UpdateAttempterTest, BootTimeInUpdateMarkerFile) {
UpdateAttempterUnderTest attempter{&fake_system_state_,
- &libcros_proxy_,
+ &network_proxy_service_proxy_mock_,
&debugd_proxy_mock_};
FakeClock fake_clock;
fake_clock.SetBootTime(Time::FromTimeT(42));