Make UpdateAttempter own debugd_proxy.

It's the only class using this proxy.

Test: mma
Bug: 28800946

Change-Id: I1a98b417f213db5d47de451390367ca4975db4b0
diff --git a/update_attempter.cc b/update_attempter.cc
index 57a9074..11c736e 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -50,7 +50,7 @@
 #include "update_engine/common/prefs_interface.h"
 #include "update_engine/common/subprocess.h"
 #include "update_engine/common/utils.h"
-#include "update_engine/dbus_service.h"
+#include "update_engine/dbus_connection.h"
 #include "update_engine/metrics.h"
 #include "update_engine/omaha_request_action.h"
 #include "update_engine/omaha_request_params.h"
@@ -120,18 +120,17 @@
   return code;
 }
 
-UpdateAttempter::UpdateAttempter(
-    SystemState* system_state,
-    CertificateChecker* cert_checker,
-    LibCrosProxy* libcros_proxy,
-    org::chromium::debugdProxyInterface* debugd_proxy)
+UpdateAttempter::UpdateAttempter(SystemState* system_state,
+                                 CertificateChecker* cert_checker,
+                                 LibCrosProxy* libcros_proxy)
     : processor_(new ActionProcessor()),
       system_state_(system_state),
-      cert_checker_(cert_checker),
 #if USE_LIBCROS
-      chrome_proxy_resolver_(libcros_proxy),
+      cert_checker_(cert_checker),
+      chrome_proxy_resolver_(libcros_proxy) {
+#else
+      cert_checker_(cert_checker) {
 #endif  // USE_LIBCROS
-      debugd_proxy_(debugd_proxy) {
 }
 
 UpdateAttempter::~UpdateAttempter() {
@@ -163,6 +162,11 @@
 #if USE_LIBCROS
   chrome_proxy_resolver_.Init();
 #endif  // USE_LIBCROS
+
+  // unittest can set this to a mock before calling Init().
+  if (!debugd_proxy_)
+    debugd_proxy_.reset(
+        new org::chromium::debugdProxy(DBusConnection::Get()->GetDBus()));
 }
 
 void UpdateAttempter::ScheduleUpdates() {