Update to use libbrillo Chrome proxy resolver

This uses the new proxy resolution code in libbrillo for doing proxy
resolution rather than making the D-Bus calls directly through the
generated bindings. The unittest for this class was removed since the
main function of it was removed. It now is essentially just a wrapper
around the call into libbrillo along with some minimal code for
allowing cancelling of callbacks.

BUG=chromium:771386
TEST=Unit tests pass

Change-Id: Ib0d4e413482f4bdfe0e9689f68118efbec94ec9d
Reviewed-on: https://chromium-review.googlesource.com/698964
Commit-Ready: Jeffrey Kardatzke <jkardatzke@google.com>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Sen Jiang <senj@chromium.org>
diff --git a/Android.mk b/Android.mk
index dad0ed7..67563a9 100644
--- a/Android.mk
+++ b/Android.mk
@@ -999,10 +999,6 @@
 LOCAL_SHARED_LIBRARIES += \
     $(ue_libupdate_engine_android_exported_shared_libraries:-host=)
 endif  # local_use_omaha == 1
-ifeq ($(local_use_chrome_network_proxy),1)
-LOCAL_SRC_FILES += \
-    chrome_browser_proxy_resolver_unittest.cc
-endif  # local_use_chrome_network_proxy == 1
 include $(BUILD_NATIVE_TEST)
 
 # Update payload signing public key.
diff --git a/chrome_browser_proxy_resolver.cc b/chrome_browser_proxy_resolver.cc
index 12a8328..5beecc1 100644
--- a/chrome_browser_proxy_resolver.cc
+++ b/chrome_browser_proxy_resolver.cc
@@ -20,85 +20,26 @@
 
 #include <base/bind.h>
 #include <base/memory/ptr_util.h>
-#include <base/strings/string_tokenizer.h>
 #include <base/strings/string_util.h>
+#include <brillo/http/http_proxy.h>
 
-#include "network_proxy/dbus-proxies.h"
+#include "update_engine/dbus_connection.h"
 
 namespace chromeos_update_engine {
 
-using base::StringTokenizer;
-using std::deque;
-using std::string;
-
-namespace {
-
-// Timeout for D-Bus calls in milliseconds.
-constexpr int kTimeoutMs = 5000;
-
-}  // namespace
-
-ChromeBrowserProxyResolver::ChromeBrowserProxyResolver(
-    org::chromium::NetworkProxyServiceInterfaceProxyInterface* dbus_proxy)
-    : dbus_proxy_(dbus_proxy),
-      next_request_id_(kProxyRequestIdNull + 1),
+ChromeBrowserProxyResolver::ChromeBrowserProxyResolver()
+    : next_request_id_(kProxyRequestIdNull + 1),
       weak_ptr_factory_(this) {}
 
 ChromeBrowserProxyResolver::~ChromeBrowserProxyResolver() = default;
 
-// static
-deque<string> ChromeBrowserProxyResolver::ParseProxyString(
-    const string& input) {
-  deque<string> ret;
-  // Some of this code taken from
-  // http://src.chromium.org/svn/trunk/src/net/proxy/proxy_server.cc and
-  // http://src.chromium.org/svn/trunk/src/net/proxy/proxy_list.cc
-  StringTokenizer entry_tok(input, ";");
-  while (entry_tok.GetNext()) {
-    string token = entry_tok.token();
-    base::TrimWhitespaceASCII(token, base::TRIM_ALL, &token);
-
-    // Start by finding the first space (if any).
-    string::iterator space;
-    for (space = token.begin(); space != token.end(); ++space) {
-      if (base::IsAsciiWhitespace(*space)) {
-        break;
-      }
-    }
-
-    string scheme = base::ToLowerASCII(string(token.begin(), space));
-    // Chrome uses "socks" to mean socks4 and "proxy" to mean http.
-    if (scheme == "socks")
-      scheme += "4";
-    else if (scheme == "proxy")
-      scheme = "http";
-    else if (scheme != "https" &&
-             scheme != "socks4" &&
-             scheme != "socks5" &&
-             scheme != "direct")
-      continue;  // Invalid proxy scheme
-
-    string host_and_port = string(space, token.end());
-    base::TrimWhitespaceASCII(host_and_port, base::TRIM_ALL, &host_and_port);
-    if (scheme != "direct" && host_and_port.empty())
-      continue;  // Must supply host/port when non-direct proxy used.
-    ret.push_back(scheme + "://" + host_and_port);
-  }
-  if (ret.empty() || *ret.rbegin() != kNoProxy)
-    ret.push_back(kNoProxy);
-  return ret;
-}
-
 ProxyRequestId ChromeBrowserProxyResolver::GetProxiesForUrl(
-    const string& url, const ProxiesResolvedFn& callback) {
+    const std::string& url, const ProxiesResolvedFn& callback) {
   const ProxyRequestId id = next_request_id_++;
-  dbus_proxy_->ResolveProxyAsync(
-      url,
-      base::Bind(&ChromeBrowserProxyResolver::OnResolveProxyResponse,
-                 weak_ptr_factory_.GetWeakPtr(), id),
-      base::Bind(&ChromeBrowserProxyResolver::OnResolveProxyError,
-                 weak_ptr_factory_.GetWeakPtr(), id),
-      kTimeoutMs);
+  brillo::http::GetChromeProxyServersAsync(
+      DBusConnection::Get()->GetDBus(), url,
+      base::Bind(&ChromeBrowserProxyResolver::OnGetChromeProxyServers,
+                 weak_ptr_factory_.GetWeakPtr(), id));
   pending_callbacks_[id] = callback;
   return id;
 }
@@ -107,32 +48,18 @@
   return pending_callbacks_.erase(request) != 0;
 }
 
-void ChromeBrowserProxyResolver::OnResolveProxyResponse(
-    ProxyRequestId request_id,
-    const std::string& proxy_info,
-    const std::string& error_message) {
-  if (!error_message.empty())
-    LOG(WARNING) << "Got error resolving proxy: " << error_message;
-  RunCallback(request_id, ParseProxyString(proxy_info));
-}
-
-void ChromeBrowserProxyResolver::OnResolveProxyError(ProxyRequestId request_id,
-                                                     brillo::Error* error) {
-  LOG(WARNING) << "Failed to resolve proxy: "
-               << (error ? error->GetMessage() : "[null]");
-  RunCallback(request_id, deque<string>{kNoProxy});
-}
-
-void ChromeBrowserProxyResolver::RunCallback(
-    ProxyRequestId request_id,
-    const std::deque<std::string>& proxies) {
+void ChromeBrowserProxyResolver::OnGetChromeProxyServers(
+    ProxyRequestId request_id, bool success,
+    const std::vector<std::string>& proxies) {
+  // If |success| is false, |proxies| will still hold the direct proxy option
+  // which is what we do in our error case.
   auto it = pending_callbacks_.find(request_id);
   if (it == pending_callbacks_.end())
     return;
 
   ProxiesResolvedFn callback = it->second;
   pending_callbacks_.erase(it);
-  callback.Run(proxies);
+  callback.Run(std::deque<std::string>(proxies.begin(), proxies.end()));
 }
 
-} // namespace chromeos_update_engine
+}  // namespace chromeos_update_engine
diff --git a/chrome_browser_proxy_resolver.h b/chrome_browser_proxy_resolver.h
index 03dbdad..fcf85b6 100644
--- a/chrome_browser_proxy_resolver.h
+++ b/chrome_browser_proxy_resolver.h
@@ -20,46 +20,29 @@
 #include <deque>
 #include <map>
 #include <string>
+#include <vector>
 
 #include <base/memory/weak_ptr.h>
 
 #include "update_engine/proxy_resolver.h"
 
-namespace brillo {
-class Error;
-}  // namespace brillo
-
-namespace org {
-namespace chromium {
-class NetworkProxyServiceInterfaceProxyInterface;
-}  // namespace chromium
-}  // namespace org
-
 namespace chromeos_update_engine {
 
 class ChromeBrowserProxyResolver : public ProxyResolver {
  public:
-  explicit ChromeBrowserProxyResolver(
-      org::chromium::NetworkProxyServiceInterfaceProxyInterface* dbus_proxy);
+  ChromeBrowserProxyResolver();
   ~ChromeBrowserProxyResolver() override;
 
-  // Parses a string-encoded list of proxies and returns a deque
-  // of individual proxies. The last one will always be kNoProxy.
-  static std::deque<std::string> ParseProxyString(const std::string& input);
-
   // ProxyResolver:
   ProxyRequestId GetProxiesForUrl(const std::string& url,
                                   const ProxiesResolvedFn& callback) override;
   bool CancelProxyRequest(ProxyRequestId request) override;
 
-private:
-  // Callback for successful D-Bus calls made by GetProxiesForUrl().
-  void OnResolveProxyResponse(ProxyRequestId request_id,
-                              const std::string& proxy_info,
-                              const std::string& error_message);
-
-  // Callback for failed D-Bus calls made by GetProxiesForUrl().
-  void OnResolveProxyError(ProxyRequestId request_id, brillo::Error* error);
+ private:
+  // Callback for calls made by GetProxiesForUrl().
+  void OnGetChromeProxyServers(ProxyRequestId request_id,
+                               bool success,
+                               const std::vector<std::string>& proxies);
 
   // Finds the callback identified by |request_id| in |pending_callbacks_|,
   // passes |proxies| to it, and deletes it. Does nothing if the request has
@@ -67,9 +50,6 @@
   void RunCallback(ProxyRequestId request_id,
                    const std::deque<std::string>& proxies);
 
-  // D-Bus proxy for resolving network proxies.
-  org::chromium::NetworkProxyServiceInterfaceProxyInterface* dbus_proxy_;
-
   // Next ID to return from GetProxiesForUrl().
   ProxyRequestId next_request_id_;
 
diff --git a/chrome_browser_proxy_resolver_unittest.cc b/chrome_browser_proxy_resolver_unittest.cc
deleted file mode 100644
index dc71d2b..0000000
--- a/chrome_browser_proxy_resolver_unittest.cc
+++ /dev/null
@@ -1,180 +0,0 @@
-//
-// Copyright (C) 2011 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include "update_engine/chrome_browser_proxy_resolver.h"
-
-#include <deque>
-#include <string>
-#include <vector>
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#include <base/macros.h>
-#include <brillo/errors/error.h>
-
-#include "network_proxy/dbus-proxies.h"
-#include "network_proxy/dbus-proxy-mocks.h"
-#include "update_engine/dbus_test_utils.h"
-
-using ::testing::DoAll;
-using ::testing::SaveArg;
-using ::testing::StrEq;
-using ::testing::_;
-using org::chromium::NetworkProxyServiceInterfaceProxyMock;
-using std::deque;
-using std::string;
-using std::vector;
-
-namespace chromeos_update_engine {
-
-namespace {
-
-// Callback for ProxyResolver::GetProxiesForUrl() that copies |src| to |dest|.
-void CopyProxies(deque<string>* dest, const deque<string>& src) {
-  *dest = src;
-}
-
-}  // namespace
-
-class ChromeBrowserProxyResolverTest : public ::testing::Test {
- public:
-  ChromeBrowserProxyResolverTest() = default;
-  ~ChromeBrowserProxyResolverTest() override = default;
-
- protected:
-  // Adds a GoogleMock expectation for a call to |dbus_proxy_|'s
-  // ResolveProxyAsync method to resolve |url|.
-  void AddResolveProxyExpectation(const std::string& url) {
-    EXPECT_CALL(dbus_proxy_, ResolveProxyAsync(StrEq(url), _, _, _))
-        .WillOnce(DoAll(SaveArg<1>(&success_callback_),
-                        SaveArg<2>(&error_callback_)));
-  }
-
-  NetworkProxyServiceInterfaceProxyMock dbus_proxy_;
-  ChromeBrowserProxyResolver resolver_{&dbus_proxy_};
-
-  // Callbacks that were passed to |dbus_proxy_|'s ResolveProxyAsync method.
-  base::Callback<void(const std::string&, const std::string&)>
-      success_callback_;
-  base::Callback<void(brillo::Error*)> error_callback_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProxyResolverTest);
-};
-
-TEST_F(ChromeBrowserProxyResolverTest, Parse) {
-  // Test ideas from
-  // http://src.chromium.org/svn/trunk/src/net/proxy/proxy_list_unittest.cc
-  vector<string> inputs = {
-      "PROXY foopy:10",
-      " DIRECT", // leading space.
-      "PROXY foopy1 ; proxy foopy2;\t DIRECT",
-      "proxy foopy1 ; SOCKS foopy2",
-      "DIRECT ; proxy foopy1 ; DIRECT ; SOCKS5 foopy2;DIRECT ",
-      "DIRECT ; proxy foopy1:80; DIRECT ; DIRECT",
-      "PROXY-foopy:10",
-      "PROXY",
-      "PROXY foopy1 ; JUNK ; JUNK ; SOCKS5 foopy2 ; ;",
-      "HTTP foopy1; SOCKS5 foopy2",
-  };
-  vector<deque<string>> outputs = {
-      {"http://foopy:10", kNoProxy},
-      {kNoProxy},
-      {"http://foopy1", "http://foopy2", kNoProxy},
-      {"http://foopy1", "socks4://foopy2", kNoProxy},
-      {kNoProxy, "http://foopy1", kNoProxy, "socks5://foopy2", kNoProxy},
-      {kNoProxy, "http://foopy1:80", kNoProxy, kNoProxy},
-      {kNoProxy},
-      {kNoProxy},
-      {"http://foopy1", "socks5://foopy2", kNoProxy},
-      {"socks5://foopy2", kNoProxy},
-  };
-  ASSERT_EQ(inputs.size(), outputs.size());
-
-  for (size_t i = 0; i < inputs.size(); i++) {
-    deque<string> results =
-        ChromeBrowserProxyResolver::ParseProxyString(inputs[i]);
-    deque<string>& expected = outputs[i];
-    EXPECT_EQ(results.size(), expected.size()) << "i = " << i;
-    if (expected.size() != results.size())
-      continue;
-    for (size_t j = 0; j < expected.size(); j++) {
-      EXPECT_EQ(expected[j], results[j]) << "i = " << i;
-    }
-  }
-}
-
-TEST_F(ChromeBrowserProxyResolverTest, Success) {
-  const char kUrl[] = "http://example.com/blah";
-  const char kProxyConfig[] = "SOCKS5 192.168.52.83:5555;DIRECT";
-  AddResolveProxyExpectation(kUrl);
-  deque<string> proxies;
-  resolver_.GetProxiesForUrl(kUrl, base::Bind(&CopyProxies, &proxies));
-
-  // Run the D-Bus success callback and verify that the proxies are passed to
-  // the supplied function.
-  ASSERT_FALSE(success_callback_.is_null());
-  success_callback_.Run(kProxyConfig, string());
-  ASSERT_EQ(2u, proxies.size());
-  EXPECT_EQ("socks5://192.168.52.83:5555", proxies[0]);
-  EXPECT_EQ(kNoProxy, proxies[1]);
-}
-
-TEST_F(ChromeBrowserProxyResolverTest, Failure) {
-  const char kUrl[] = "http://example.com/blah";
-  AddResolveProxyExpectation(kUrl);
-  deque<string> proxies;
-  resolver_.GetProxiesForUrl(kUrl, base::Bind(&CopyProxies, &proxies));
-
-  // Run the D-Bus error callback and verify that the supplied function is
-  // instructed to use a direct connection.
-  ASSERT_FALSE(error_callback_.is_null());
-  brillo::ErrorPtr error = brillo::Error::Create(FROM_HERE, "", "", "");
-  error_callback_.Run(error.get());
-  ASSERT_EQ(1u, proxies.size());
-  EXPECT_EQ(kNoProxy, proxies[0]);
-}
-
-TEST_F(ChromeBrowserProxyResolverTest, CancelCallback) {
-  const char kUrl[] = "http://example.com/blah";
-  AddResolveProxyExpectation(kUrl);
-  int called = 0;
-  auto callback = base::Bind(
-      [](int* called, const deque<string>& proxies) { (*called)++; }, &called);
-  ProxyRequestId request = resolver_.GetProxiesForUrl(kUrl, callback);
-
-  // Cancel the request and then run the D-Bus success callback. The original
-  // callback shouldn't be run.
-  EXPECT_TRUE(resolver_.CancelProxyRequest(request));
-  ASSERT_FALSE(success_callback_.is_null());
-  success_callback_.Run("DIRECT", string());
-  EXPECT_EQ(0, called);
-}
-
-TEST_F(ChromeBrowserProxyResolverTest, CancelCallbackTwice) {
-  const char kUrl[] = "http://example.com/blah";
-  AddResolveProxyExpectation(kUrl);
-  deque<string> proxies;
-  ProxyRequestId request =
-      resolver_.GetProxiesForUrl(kUrl, base::Bind(&CopyProxies, &proxies));
-
-  // Cancel the same request twice. The second call should fail.
-  EXPECT_TRUE(resolver_.CancelProxyRequest(request));
-  EXPECT_FALSE(resolver_.CancelProxyRequest(request));
-}
-
-}  // namespace chromeos_update_engine
diff --git a/dbus_bindings/org.chromium.NetworkProxyService.dbus-xml b/dbus_bindings/org.chromium.NetworkProxyService.dbus-xml
deleted file mode 100644
index 90686ca..0000000
--- a/dbus_bindings/org.chromium.NetworkProxyService.dbus-xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<node name="/org/chromium/NetworkProxyService"
-      xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
-  <interface name="org.chromium.NetworkProxyServiceInterface">
-    <method name="ResolveProxy">
-      <arg name="source_url" type="s" direction="in" />
-      <arg name="proxy_info" type="s" direction="out" />
-      <arg name="error_message" type="s" direction="out" />
-      <annotation name="org.chromium.DBus.Method.Kind" value="async" />
-    </method>
-  </interface>
-</node>
diff --git a/fake_system_state.cc b/fake_system_state.cc
index d51f775..9403f8b 100644
--- a/fake_system_state.cc
+++ b/fake_system_state.cc
@@ -21,7 +21,7 @@
 // Mock the SystemStateInterface so that we could lie that
 // OOBE is completed even when there's no such marker file, etc.
 FakeSystemState::FakeSystemState()
-    : mock_update_attempter_(this, nullptr, nullptr),
+    : mock_update_attempter_(this, nullptr),
       mock_request_params_(this),
       fake_update_manager_(&fake_clock_),
       clock_(&fake_clock_),
diff --git a/real_system_state.cc b/real_system_state.cc
index b6e59cd..d1af41f 100644
--- a/real_system_state.cc
+++ b/real_system_state.cc
@@ -24,9 +24,9 @@
 #include <base/memory/ptr_util.h>
 #include <base/time/time.h>
 #include <brillo/message_loops/message_loop.h>
-#if USE_CHROME_KIOSK_APP || USE_CHROME_NETWORK_PROXY
+#if USE_CHROME_KIOSK_APP
 #include <chromeos/dbus/service_constants.h>
-#endif  // USE_CHROME_KIOSK_APP || USE_CHROME_NETWORK_PROXY
+#endif  // USE_CHROME_KIOSK_APP
 
 #include "update_engine/common/boot_control.h"
 #include "update_engine/common/boot_control_stub.h"
@@ -69,12 +69,6 @@
   libcros_proxy_.reset(new org::chromium::LibCrosServiceInterfaceProxy(
       DBusConnection::Get()->GetDBus(), chromeos::kLibCrosServiceName));
 #endif  // USE_CHROME_KIOSK_APP
-#if USE_CHROME_NETWORK_PROXY
-  network_proxy_service_proxy_.reset(
-      new org::chromium::NetworkProxyServiceInterfaceProxy(
-          DBusConnection::Get()->GetDBus(),
-          chromeos::kNetworkProxyServiceName));
-#endif  // USE_CHROME_NETWORK_PROXY
 
   LOG_IF(INFO, !hardware_->IsNormalBootMode()) << "Booted in dev mode.";
   LOG_IF(INFO, !hardware_->IsOfficialBuild()) << "Booted non-official build.";
@@ -145,14 +139,8 @@
       new CertificateChecker(prefs_.get(), &openssl_wrapper_));
   certificate_checker_->Init();
 
-  update_attempter_.reset(
-      new UpdateAttempter(this,
-                          certificate_checker_.get(),
-#if USE_CHROME_NETWORK_PROXY
-                          network_proxy_service_proxy_.get()));
-#else
-                          nullptr));
-#endif  // USE_CHROME_NETWORK_PROXY
+  update_attempter_.reset(new UpdateAttempter(this,
+                                              certificate_checker_.get()));
 
   // Initialize the UpdateAttempter before the UpdateManager.
   update_attempter_->Init();
diff --git a/real_system_state.h b/real_system_state.h
index 6aee0af..e25b34e 100644
--- a/real_system_state.h
+++ b/real_system_state.h
@@ -28,9 +28,6 @@
 #if USE_CHROME_KIOSK_APP
 #include <libcros/dbus-proxies.h>
 #endif  // USE_CHROME_KIOSK_APP
-#if USE_CHROME_NETWORK_PROXY
-#include <network_proxy/dbus-proxies.h>
-#endif  // USE_CHROME_NETWORK_PROXY
 
 #include "update_engine/certificate_checker.h"
 #include "update_engine/common/boot_control_interface.h"
@@ -133,10 +130,6 @@
 #if USE_CHROME_KIOSK_APP
   std::unique_ptr<org::chromium::LibCrosServiceInterfaceProxy> libcros_proxy_;
 #endif  // USE_CHROME_KIOSK_APP
-#if USE_CHROME_NETWORK_PROXY
-  std::unique_ptr<org::chromium::NetworkProxyServiceInterfaceProxy>
-      network_proxy_service_proxy_;
-#endif  // USE_CHROME_NETWORK_PROXY
 
   // Interface for the power manager.
   std::unique_ptr<PowerManagerInterface> power_manager_;
diff --git a/update_attempter.cc b/update_attempter.cc
index 136413d..9b34365 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -122,17 +122,10 @@
 
 UpdateAttempter::UpdateAttempter(
     SystemState* system_state,
-    CertificateChecker* cert_checker,
-    org::chromium::NetworkProxyServiceInterfaceProxyInterface*
-        network_proxy_service_proxy)
+    CertificateChecker* cert_checker)
     : processor_(new ActionProcessor()),
       system_state_(system_state),
-#if USE_CHROME_NETWORK_PROXY
-      cert_checker_(cert_checker),
-      chrome_proxy_resolver_(network_proxy_service_proxy) {
-#else
       cert_checker_(cert_checker) {
-#endif  // USE_CHROME_NETWORK_PROXY
 }
 
 UpdateAttempter::~UpdateAttempter() {
diff --git a/update_attempter.h b/update_attempter.h
index 082ebfe..f0747e2 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -48,12 +48,6 @@
 
 class MetricsLibraryInterface;
 
-namespace org {
-namespace chromium {
-class NetworkProxyServiceInterfaceProxyInterface;
-}  // namespace chromium
-}  // namespace org
-
 namespace policy {
 class PolicyProvider;
 }
@@ -70,10 +64,7 @@
   using UpdateStatus = update_engine::UpdateStatus;
   static const int kMaxDeltaUpdateFailures;
 
-  UpdateAttempter(SystemState* system_state,
-                  CertificateChecker* cert_checker,
-                  org::chromium::NetworkProxyServiceInterfaceProxyInterface*
-                      network_proxy_service_proxy);
+  UpdateAttempter(SystemState* system_state, CertificateChecker* cert_checker);
   ~UpdateAttempter() override;
 
   // Further initialization to be done post construction.
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index 6a08139..fed21ca 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -30,10 +30,6 @@
 #include <policy/libpolicy.h>
 #include <policy/mock_device_policy.h>
 
-#if USE_CHROME_NETWORK_PROXY
-#include "network_proxy/dbus-proxies.h"
-#include "network_proxy/dbus-proxy-mocks.h"
-#endif  // USE_CHROME_NETWORK_PROXY
 #include "update_engine/common/fake_clock.h"
 #include "update_engine/common/fake_prefs.h"
 #include "update_engine/common/mock_action.h"
@@ -52,16 +48,8 @@
 #include "update_engine/payload_consumer/payload_constants.h"
 #include "update_engine/payload_consumer/postinstall_runner_action.h"
 
-namespace org {
-namespace chromium {
-class NetworkProxyServiceInterfaceProxyMock;
-}  // namespace chromium
-}  // namespace org
-
 using base::Time;
 using base::TimeDelta;
-using org::chromium::NetworkProxyServiceInterfaceProxyInterface;
-using org::chromium::NetworkProxyServiceInterfaceProxyMock;
 using std::string;
 using std::unique_ptr;
 using testing::DoAll;
@@ -83,10 +71,8 @@
 // methods.
 class UpdateAttempterUnderTest : public UpdateAttempter {
  public:
-  UpdateAttempterUnderTest(
-      SystemState* system_state,
-      NetworkProxyServiceInterfaceProxyInterface* network_proxy_service_proxy)
-      : UpdateAttempter(system_state, nullptr, network_proxy_service_proxy) {}
+  explicit UpdateAttempterUnderTest(SystemState* system_state)
+      : UpdateAttempter(system_state, nullptr) {}
 
   // Wrap the update scheduling method, allowing us to opt out of scheduled
   // updates for testing purposes.
@@ -186,13 +172,7 @@
   brillo::BaseMessageLoop loop_{&base_loop_};
 
   FakeSystemState fake_system_state_;
-#if USE_CHROME_NETWORK_PROXY
-  NetworkProxyServiceInterfaceProxyMock network_proxy_service_proxy_mock_;
-  UpdateAttempterUnderTest attempter_{&fake_system_state_,
-                                      &network_proxy_service_proxy_mock_};
-#else
-  UpdateAttempterUnderTest attempter_{&fake_system_state_, nullptr};
-#endif  // USE_CHROME_NETWORK_PROXY
+  UpdateAttempterUnderTest attempter_{&fake_system_state_};
   OpenSSLWrapper openssl_wrapper_;
   CertificateChecker certificate_checker_;
 
diff --git a/update_engine.gyp b/update_engine.gyp
index e8e1fe9..6877ac8 100644
--- a/update_engine.gyp
+++ b/update_engine.gyp
@@ -117,21 +117,6 @@
         'includes': ['../../../platform2/common-mk/generate-dbus-proxies.gypi'],
       }],
     },
-    {
-      'target_name': 'update_engine-dbus-chrome_network_proxy-client',
-      'type': 'none',
-      'actions': [{
-        'action_name': 'update_engine-dbus-chrome_network_proxy-client-action',
-        'variables': {
-          'mock_output_file': 'include/network_proxy/dbus-proxy-mocks.h',
-          'proxy_output_file': 'include/network_proxy/dbus-proxies.h',
-        },
-        'sources': [
-          'dbus_bindings/org.chromium.NetworkProxyService.dbus-xml',
-        ],
-        'includes': ['../../../platform2/common-mk/generate-dbus-proxies.gypi'],
-      }],
-    },
     # The payload application component and common dependencies.
     {
       'target_name': 'libpayload_consumer',
@@ -235,6 +220,7 @@
           'libshill-client',
           'libssl',
           'libupdate_engine-client',
+          'vboot_host',
         ],
         'deps': ['<@(exported_deps)'],
       },
@@ -256,7 +242,6 @@
           '-lpolicy-<(libbase_ver)',
           '-lrootdev',
           '-lrt',
-          '-lvboot_host',
         ],
       },
       'sources': [
@@ -302,9 +287,6 @@
       ],
       'conditions': [
         ['USE_chrome_network_proxy == 1', {
-          'dependencies': [
-            'update_engine-dbus-chrome_network_proxy-client',
-          ],
           'sources': [
             'chrome_browser_proxy_resolver.cc',
           ],
@@ -583,13 +565,6 @@
             'update_manager/update_manager_unittest.cc',
             'update_manager/variable_unittest.cc',
           ],
-          'conditions': [
-            ['USE_chrome_network_proxy == 1', {
-              'sources': [
-                'chrome_browser_proxy_resolver_unittest.cc',
-              ],
-            }],
-          ],
         },
       ],
     }],