update_engine: Run clang-format on ./ (root directory)

BUG=none
TEST=unittest

Change-Id: Ibd075dc7ea9a18e798f612e35725f1c83c112809
Reviewed-on: https://chromium-review.googlesource.com/1409708
Commit-Ready: Amin Hassani <[email protected]>
Tested-by: Amin Hassani <[email protected]>
Reviewed-by: Sen Jiang <[email protected]>
diff --git a/binder_service_android.cc b/binder_service_android.cc
index 1702ead..137694a 100644
--- a/binder_service_android.cc
+++ b/binder_service_android.cc
@@ -37,8 +37,7 @@
 
 BinderUpdateEngineAndroidService::BinderUpdateEngineAndroidService(
     ServiceDelegateAndroidInterface* service_delegate)
-    : service_delegate_(service_delegate) {
-}
+    : service_delegate_(service_delegate) {}
 
 void BinderUpdateEngineAndroidService::SendStatusUpdate(
     const UpdateEngineStatus& update_engine_status) {
diff --git a/binder_service_android.h b/binder_service_android.h
index 694b80a..d8c4e9c 100644
--- a/binder_service_android.h
+++ b/binder_service_android.h
@@ -40,9 +40,7 @@
       ServiceDelegateAndroidInterface* service_delegate);
   ~BinderUpdateEngineAndroidService() override = default;
 
-  const char* ServiceName() const {
-    return "android.os.UpdateEngineService";
-  }
+  const char* ServiceName() const { return "android.os.UpdateEngineService"; }
 
   // ServiceObserverInterface overrides.
   void SendStatusUpdate(
diff --git a/binder_service_brillo.cc b/binder_service_brillo.cc
index d082add..cc74763 100644
--- a/binder_service_brillo.cc
+++ b/binder_service_brillo.cc
@@ -25,12 +25,12 @@
 
 #include "update_engine/update_status_utils.h"
 
+using android::sp;
 using android::String16;
 using android::String8;
 using android::binder::Status;
 using android::brillo::IUpdateEngineStatusCallback;
 using android::brillo::ParcelableUpdateEngineStatus;
-using android::sp;
 using brillo::ErrorPtr;
 using std::string;
 using update_engine::UpdateEngineStatus;
diff --git a/boot_control_android.cc b/boot_control_android.cc
index 421c091..8909cd9 100644
--- a/boot_control_android.cc
+++ b/boot_control_android.cc
@@ -232,8 +232,7 @@
   Return<BoolResult> ret = module_->isSlotBootable(slot);
   if (!ret.isOk()) {
     LOG(ERROR) << "Unable to determine if slot " << SlotName(slot)
-               << " is bootable: "
-               << ret.description();
+               << " is bootable: " << ret.description();
     return false;
   }
   if (ret == BoolResult::INVALID_SLOT) {
@@ -248,8 +247,7 @@
   auto ret = module_->setSlotAsUnbootable(slot, StoreResultCallback(&result));
   if (!ret.isOk()) {
     LOG(ERROR) << "Unable to call MarkSlotUnbootable for slot "
-               << SlotName(slot) << ": "
-               << ret.description();
+               << SlotName(slot) << ": " << ret.description();
     return false;
   }
   if (!result.success) {
@@ -279,8 +277,7 @@
   CommandResult result;
   auto ret = module_->markBootSuccessful(StoreResultCallback(&result));
   if (!ret.isOk()) {
-    LOG(ERROR) << "Unable to call MarkBootSuccessful: "
-               << ret.description();
+    LOG(ERROR) << "Unable to call MarkBootSuccessful: " << ret.description();
     return false;
   }
   if (!result.success) {
diff --git a/boot_control_chromeos.cc b/boot_control_chromeos.cc
index 3dee660..ccba316 100644
--- a/boot_control_chromeos.cc
+++ b/boot_control_chromeos.cc
@@ -124,9 +124,8 @@
   }
   if (current_slot_ >= num_slots_) {
     LOG(ERROR) << "Couldn't find the slot number corresponding to the "
-                  "partition " << boot_device
-               << ", number of slots: " << num_slots_
-               << ". This device is not updateable.";
+               << "partition " << boot_device << ", number of slots: "
+               << num_slots_ << ". This device is not updateable.";
     num_slots_ = 1;
     current_slot_ = BootControlInterface::kInvalidSlot;
     return false;
@@ -303,8 +302,7 @@
 }
 
 int BootControlChromeOS::GetPartitionNumber(
-    const string partition_name,
-    BootControlInterface::Slot slot) const {
+    const string partition_name, BootControlInterface::Slot slot) const {
   if (slot >= num_slots_) {
     LOG(ERROR) << "Invalid slot number: " << slot << ", we only have "
                << num_slots_ << " slot(s)";
diff --git a/certificate_checker.cc b/certificate_checker.cc
index 6e886e7..938c66f 100644
--- a/certificate_checker.cc
+++ b/certificate_checker.cc
@@ -59,8 +59,7 @@
 
 CertificateChecker::CertificateChecker(PrefsInterface* prefs,
                                        OpenSSLWrapper* openssl_wrapper)
-    : prefs_(prefs), openssl_wrapper_(openssl_wrapper) {
-}
+    : prefs_(prefs), openssl_wrapper_(openssl_wrapper) {}
 
 CertificateChecker::~CertificateChecker() {
   if (cert_checker_singleton_ == this)
@@ -128,7 +127,9 @@
                                           ServerToCheck server_to_check) {
   CHECK(cert_checker_singleton_ != nullptr);
   return cert_checker_singleton_->CheckCertificateChange(
-      preverify_ok, x509_ctx, server_to_check) ? 1 : 0;
+             preverify_ok, x509_ctx, server_to_check)
+             ? 1
+             : 0;
 }
 
 bool CertificateChecker::CheckCertificateChange(int preverify_ok,
@@ -147,10 +148,8 @@
   unsigned int digest_length;
   uint8_t digest[EVP_MAX_MD_SIZE];
 
-  if (!openssl_wrapper_->GetCertificateDigest(x509_ctx,
-                                              &depth,
-                                              &digest_length,
-                                              digest)) {
+  if (!openssl_wrapper_->GetCertificateDigest(
+          x509_ctx, &depth, &digest_length, digest)) {
     LOG(WARNING) << "Failed to generate digest of X509 certificate "
                  << "from update server.";
     NotifyCertificateChecked(server_to_check, CertificateCheckResult::kValid);
@@ -161,9 +160,10 @@
   // prefs.
   string digest_string = base::HexEncode(digest, digest_length);
 
-  string storage_key =
-      base::StringPrintf("%s-%d-%d", kPrefsUpdateServerCertificate,
-                         static_cast<int>(server_to_check), depth);
+  string storage_key = base::StringPrintf("%s-%d-%d",
+                                          kPrefsUpdateServerCertificate,
+                                          static_cast<int>(server_to_check),
+                                          depth);
   string stored_digest;
   // If there's no stored certificate, we just store the current one and return.
   if (!prefs_->GetString(storage_key, &stored_digest)) {
@@ -195,8 +195,7 @@
 }
 
 void CertificateChecker::NotifyCertificateChecked(
-    ServerToCheck server_to_check,
-    CertificateCheckResult result) {
+    ServerToCheck server_to_check, CertificateCheckResult result) {
   if (observer_)
     observer_->CertificateChecked(server_to_check, result);
 }
diff --git a/certificate_checker_unittest.cc b/certificate_checker_unittest.cc
index 66b92d6..15d6555 100644
--- a/certificate_checker_unittest.cc
+++ b/certificate_checker_unittest.cc
@@ -27,12 +27,12 @@
 #include "update_engine/common/mock_prefs.h"
 #include "update_engine/mock_certificate_checker.h"
 
+using std::string;
+using ::testing::_;
 using ::testing::DoAll;
 using ::testing::Return;
 using ::testing::SetArgPointee;
 using ::testing::SetArrayArgument;
-using ::testing::_;
-using std::string;
 
 namespace chromeos_update_engine {
 
@@ -54,9 +54,7 @@
     cert_checker.SetObserver(&observer_);
   }
 
-  void TearDown() override {
-    cert_checker.SetObserver(nullptr);
-  }
+  void TearDown() override { cert_checker.SetObserver(nullptr); }
 
   MockPrefs prefs_;
   MockOpenSSLWrapper openssl_wrapper_;
@@ -77,16 +75,15 @@
 // check certificate change, new
 TEST_F(CertificateCheckerTest, NewCertificate) {
   EXPECT_CALL(openssl_wrapper_, GetCertificateDigest(nullptr, _, _, _))
-      .WillOnce(DoAll(
-          SetArgPointee<1>(depth_),
-          SetArgPointee<2>(length_),
-          SetArrayArgument<3>(digest_, digest_ + 4),
-          Return(true)));
+      .WillOnce(DoAll(SetArgPointee<1>(depth_),
+                      SetArgPointee<2>(length_),
+                      SetArrayArgument<3>(digest_, digest_ + 4),
+                      Return(true)));
   EXPECT_CALL(prefs_, GetString(cert_key_, _)).WillOnce(Return(false));
   EXPECT_CALL(prefs_, SetString(cert_key_, digest_hex_)).WillOnce(Return(true));
-  EXPECT_CALL(observer_,
-              CertificateChecked(server_to_check_,
-                                 CertificateCheckResult::kValid));
+  EXPECT_CALL(
+      observer_,
+      CertificateChecked(server_to_check_, CertificateCheckResult::kValid));
   ASSERT_TRUE(
       cert_checker.CheckCertificateChange(1, nullptr, server_to_check_));
 }
@@ -94,17 +91,16 @@
 // check certificate change, unchanged
 TEST_F(CertificateCheckerTest, SameCertificate) {
   EXPECT_CALL(openssl_wrapper_, GetCertificateDigest(nullptr, _, _, _))
-      .WillOnce(DoAll(
-          SetArgPointee<1>(depth_),
-          SetArgPointee<2>(length_),
-          SetArrayArgument<3>(digest_, digest_ + 4),
-          Return(true)));
+      .WillOnce(DoAll(SetArgPointee<1>(depth_),
+                      SetArgPointee<2>(length_),
+                      SetArrayArgument<3>(digest_, digest_ + 4),
+                      Return(true)));
   EXPECT_CALL(prefs_, GetString(cert_key_, _))
       .WillOnce(DoAll(SetArgPointee<1>(digest_hex_), Return(true)));
   EXPECT_CALL(prefs_, SetString(_, _)).Times(0);
-  EXPECT_CALL(observer_,
-              CertificateChecked(server_to_check_,
-                                 CertificateCheckResult::kValid));
+  EXPECT_CALL(
+      observer_,
+      CertificateChecked(server_to_check_, CertificateCheckResult::kValid));
   ASSERT_TRUE(
       cert_checker.CheckCertificateChange(1, nullptr, server_to_check_));
 }
@@ -112,11 +108,10 @@
 // check certificate change, changed
 TEST_F(CertificateCheckerTest, ChangedCertificate) {
   EXPECT_CALL(openssl_wrapper_, GetCertificateDigest(nullptr, _, _, _))
-      .WillOnce(DoAll(
-          SetArgPointee<1>(depth_),
-          SetArgPointee<2>(length_),
-          SetArrayArgument<3>(digest_, digest_ + 4),
-          Return(true)));
+      .WillOnce(DoAll(SetArgPointee<1>(depth_),
+                      SetArgPointee<2>(length_),
+                      SetArrayArgument<3>(digest_, digest_ + 4),
+                      Return(true)));
   EXPECT_CALL(prefs_, GetString(cert_key_, _))
       .WillOnce(DoAll(SetArgPointee<1>(diff_digest_hex_), Return(true)));
   EXPECT_CALL(observer_,
@@ -129,8 +124,9 @@
 
 // check certificate change, failed
 TEST_F(CertificateCheckerTest, FailedCertificate) {
-  EXPECT_CALL(observer_, CertificateChecked(server_to_check_,
-                                            CertificateCheckResult::kFailed));
+  EXPECT_CALL(
+      observer_,
+      CertificateChecked(server_to_check_, CertificateCheckResult::kFailed));
   EXPECT_CALL(prefs_, GetString(_, _)).Times(0);
   EXPECT_CALL(openssl_wrapper_, GetCertificateDigest(_, _, _, _)).Times(0);
   ASSERT_FALSE(
diff --git a/chrome_browser_proxy_resolver.cc b/chrome_browser_proxy_resolver.cc
index 5beecc1..bfb58f7 100644
--- a/chrome_browser_proxy_resolver.cc
+++ b/chrome_browser_proxy_resolver.cc
@@ -28,8 +28,7 @@
 namespace chromeos_update_engine {
 
 ChromeBrowserProxyResolver::ChromeBrowserProxyResolver()
-    : next_request_id_(kProxyRequestIdNull + 1),
-      weak_ptr_factory_(this) {}
+    : next_request_id_(kProxyRequestIdNull + 1), weak_ptr_factory_(this) {}
 
 ChromeBrowserProxyResolver::~ChromeBrowserProxyResolver() = default;
 
@@ -37,9 +36,11 @@
     const std::string& url, const ProxiesResolvedFn& callback) {
   const ProxyRequestId id = next_request_id_++;
   brillo::http::GetChromeProxyServersAsync(
-      DBusConnection::Get()->GetDBus(), url,
+      DBusConnection::Get()->GetDBus(),
+      url,
       base::Bind(&ChromeBrowserProxyResolver::OnGetChromeProxyServers,
-                 weak_ptr_factory_.GetWeakPtr(), id));
+                 weak_ptr_factory_.GetWeakPtr(),
+                 id));
   pending_callbacks_[id] = callback;
   return id;
 }
@@ -49,7 +50,8 @@
 }
 
 void ChromeBrowserProxyResolver::OnGetChromeProxyServers(
-    ProxyRequestId request_id, bool success,
+    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.
diff --git a/common_service.cc b/common_service.cc
index 88ead28..0d5ee6d 100644
--- a/common_service.cc
+++ b/common_service.cc
@@ -71,8 +71,7 @@
     "org.chromium.UpdateEngine.Error.Failed";
 
 UpdateEngineService::UpdateEngineService(SystemState* system_state)
-    : system_state_(system_state) {
-}
+    : system_state_(system_state) {}
 
 // org::chromium::UpdateEngineInterfaceInterface methods implementation.
 
diff --git a/common_service_unittest.cc b/common_service_unittest.cc
index edf90b0..65202a0 100644
--- a/common_service_unittest.cc
+++ b/common_service_unittest.cc
@@ -43,9 +43,7 @@
       : mock_update_attempter_(fake_system_state_.mock_update_attempter()),
         common_service_(&fake_system_state_) {}
 
-  void SetUp() override {
-    fake_system_state_.set_device_policy(nullptr);
-  }
+  void SetUp() override { fake_system_state_.set_device_policy(nullptr); }
 
   // Fake/mock infrastructure.
   FakeSystemState fake_system_state_;
@@ -133,7 +131,8 @@
 TEST_F(UpdateEngineServiceTest, SetChannelWithInvalidChannel) {
   EXPECT_CALL(*mock_update_attempter_, RefreshDevicePolicy());
   EXPECT_CALL(*fake_system_state_.mock_request_params(),
-              SetTargetChannel("foo-channel", true, _)).WillOnce(Return(false));
+              SetTargetChannel("foo-channel", true, _))
+      .WillOnce(Return(false));
 
   EXPECT_FALSE(common_service_.SetChannel(&error_, "foo-channel", true));
   ASSERT_NE(nullptr, error_);
diff --git a/connection_manager.cc b/connection_manager.cc
index a048f5f..7263a74 100644
--- a/connection_manager.cc
+++ b/connection_manager.cc
@@ -46,7 +46,7 @@
   return std::unique_ptr<ConnectionManagerInterface>(
       new ConnectionManager(new ShillProxy(), system_state));
 }
-}
+}  // namespace connection_manager
 
 ConnectionManager::ConnectionManager(ShillProxyInterface* shill_proxy,
                                      SystemState* system_state)
diff --git a/connection_manager_android.cc b/connection_manager_android.cc
index 6da4cee..9d0c57b 100644
--- a/connection_manager_android.cc
+++ b/connection_manager_android.cc
@@ -26,7 +26,7 @@
   return std::unique_ptr<ConnectionManagerInterface>(
       new ConnectionManagerAndroid());
 }
-}
+}  // namespace connection_manager
 
 bool ConnectionManagerAndroid::GetConnectionProperties(
     ConnectionType* out_type, ConnectionTethering* out_tethering) {
diff --git a/connection_manager_interface.h b/connection_manager_interface.h
index 2faeb80..9f77989 100644
--- a/connection_manager_interface.h
+++ b/connection_manager_interface.h
@@ -61,7 +61,7 @@
 // Factory function which creates a ConnectionManager.
 std::unique_ptr<ConnectionManagerInterface> CreateConnectionManager(
     SystemState* system_state);
-}
+}  // namespace connection_manager
 
 }  // namespace chromeos_update_engine
 
diff --git a/connection_manager_unittest.cc b/connection_manager_unittest.cc
index 7cd858d..3cdaf4c 100644
--- a/connection_manager_unittest.cc
+++ b/connection_manager_unittest.cc
@@ -40,9 +40,9 @@
 using org::chromium::flimflam::ServiceProxyMock;
 using std::set;
 using std::string;
+using testing::_;
 using testing::Return;
 using testing::SetArgPointee;
-using testing::_;
 
 namespace chromeos_update_engine {
 
@@ -71,16 +71,14 @@
                        const char* physical_technology,
                        const char* service_tethering);
 
-  void TestWithServiceType(
-      const char* service_type,
-      const char* physical_technology,
-      ConnectionType expected_type);
+  void TestWithServiceType(const char* service_type,
+                           const char* physical_technology,
+                           ConnectionType expected_type);
 
   void TestWithServiceDisconnected(ConnectionType expected_type);
 
-  void TestWithServiceTethering(
-      const char* service_tethering,
-      ConnectionTethering expected_tethering);
+  void TestWithServiceTethering(const char* service_tethering,
+                                ConnectionTethering expected_tethering);
 
   brillo::FakeMessageLoop loop_{nullptr};
   FakeSystemState fake_system_state_;
@@ -140,10 +138,9 @@
                                        std::move(service_proxy_mock));
 }
 
-void ConnectionManagerTest::TestWithServiceType(
-    const char* service_type,
-    const char* physical_technology,
-    ConnectionType expected_type) {
+void ConnectionManagerTest::TestWithServiceType(const char* service_type,
+                                                const char* physical_technology,
+                                                ConnectionType expected_type) {
   SetManagerReply("/service/guest/network", true);
   SetServiceReply("/service/guest/network",
                   service_type,
@@ -159,8 +156,7 @@
 }
 
 void ConnectionManagerTest::TestWithServiceTethering(
-    const char* service_tethering,
-    ConnectionTethering expected_tethering) {
+    const char* service_tethering, ConnectionTethering expected_tethering) {
   SetManagerReply("/service/guest/network", true);
   SetServiceReply(
       "/service/guest/network", shill::kTypeWifi, nullptr, service_tethering);
diff --git a/daemon.cc b/daemon.cc
index f016fec..d42344a 100644
--- a/daemon.cc
+++ b/daemon.cc
@@ -66,7 +66,7 @@
   // Create the Binder Service.
 #if USE_OMAHA
   binder_service_ = new BinderUpdateEngineBrilloService{real_system_state};
-#else  // !USE_OMAHA
+#else   // !USE_OMAHA
   binder_service_ = new BinderUpdateEngineAndroidService{
       daemon_state_android->service_delegate()};
 #endif  // USE_OMAHA
@@ -87,7 +87,7 @@
   dbus_adaptor_->RegisterAsync(base::Bind(&UpdateEngineDaemon::OnDBusRegistered,
                                           base::Unretained(this)));
   LOG(INFO) << "Waiting for DBus object to be registered.";
-#else  // !USE_DBUS
+#else   // !USE_DBUS
   daemon_state_->StartUpdater();
 #endif  // USE_DBUS
   return EX_OK;
diff --git a/dbus_service.cc b/dbus_service.cc
index 03425b6..7296053 100644
--- a/dbus_service.cc
+++ b/dbus_service.cc
@@ -34,8 +34,7 @@
 using update_engine::UpdateEngineStatus;
 
 DBusUpdateEngineService::DBusUpdateEngineService(SystemState* system_state)
-    : common_(new UpdateEngineService{system_state}) {
-}
+    : common_(new UpdateEngineService{system_state}) {}
 
 // org::chromium::UpdateEngineInterfaceInterface methods implementation.
 
diff --git a/fake_file_writer.h b/fake_file_writer.h
index 43b71c7..75507ea 100644
--- a/fake_file_writer.h
+++ b/fake_file_writer.h
@@ -56,9 +56,7 @@
     return 0;
   }
 
-  const brillo::Blob& bytes() {
-    return bytes_;
-  }
+  const brillo::Blob& bytes() { return bytes_; }
 
  private:
   // The internal store of all bytes that have been written
diff --git a/fake_p2p_manager.h b/fake_p2p_manager.h
index a8cf4ea..1f8ae95 100644
--- a/fake_p2p_manager.h
+++ b/fake_p2p_manager.h
@@ -26,31 +26,23 @@
 // A fake implementation of P2PManager.
 class FakeP2PManager : public P2PManager {
  public:
-  FakeP2PManager() :
-    is_p2p_enabled_(false),
-    ensure_p2p_running_result_(false),
-    ensure_p2p_not_running_result_(false),
-    perform_housekeeping_result_(false),
-    count_shared_files_result_(0) {}
+  FakeP2PManager()
+      : is_p2p_enabled_(false),
+        ensure_p2p_running_result_(false),
+        ensure_p2p_not_running_result_(false),
+        perform_housekeeping_result_(false),
+        count_shared_files_result_(0) {}
 
   // P2PManager overrides.
   void SetDevicePolicy(const policy::DevicePolicy* device_policy) override {}
 
-  bool IsP2PEnabled() override {
-    return is_p2p_enabled_;
-  }
+  bool IsP2PEnabled() override { return is_p2p_enabled_; }
 
-  bool EnsureP2PRunning() override {
-    return ensure_p2p_running_result_;
-  }
+  bool EnsureP2PRunning() override { return ensure_p2p_running_result_; }
 
-  bool EnsureP2PNotRunning() override {
-    return ensure_p2p_not_running_result_;
-  }
+  bool EnsureP2PNotRunning() override { return ensure_p2p_not_running_result_; }
 
-  bool PerformHousekeeping() override {
-    return perform_housekeeping_result_;
-  }
+  bool PerformHousekeeping() override { return perform_housekeeping_result_; }
 
   void LookupUrlForFile(const std::string& file_id,
                         size_t minimum_size,
@@ -59,8 +51,7 @@
     callback.Run(lookup_url_for_file_result_);
   }
 
-  bool FileShare(const std::string& file_id,
-                 size_t expected_size) override {
+  bool FileShare(const std::string& file_id, size_t expected_size) override {
     return false;
   }
 
@@ -68,31 +59,22 @@
     return base::FilePath();
   }
 
-  ssize_t FileGetSize(const std::string& file_id) override {
-    return -1;
-  }
+  ssize_t FileGetSize(const std::string& file_id) override { return -1; }
 
   ssize_t FileGetExpectedSize(const std::string& file_id) override {
     return -1;
   }
 
-  bool FileGetVisible(const std::string& file_id,
-                      bool *out_result) override {
+  bool FileGetVisible(const std::string& file_id, bool* out_result) override {
     return false;
   }
 
-  bool FileMakeVisible(const std::string& file_id) override {
-    return false;
-  }
+  bool FileMakeVisible(const std::string& file_id) override { return false; }
 
-  int CountSharedFiles() override {
-    return count_shared_files_result_;
-  }
+  int CountSharedFiles() override { return count_shared_files_result_; }
 
   // Methods for controlling what the fake returns and how it acts.
-  void SetP2PEnabled(bool is_p2p_enabled) {
-    is_p2p_enabled_ = is_p2p_enabled;
-  }
+  void SetP2PEnabled(bool is_p2p_enabled) { is_p2p_enabled_ = is_p2p_enabled; }
 
   void SetEnsureP2PRunningResult(bool ensure_p2p_running_result) {
     ensure_p2p_running_result_ = ensure_p2p_running_result;
diff --git a/fake_p2p_manager_configuration.h b/fake_p2p_manager_configuration.h
index c1cf4f2..f5b0e80 100644
--- a/fake_p2p_manager_configuration.h
+++ b/fake_p2p_manager_configuration.h
@@ -32,9 +32,7 @@
 // /var/cache/p2p, a temporary directory is used.
 class FakeP2PManagerConfiguration : public P2PManager::Configuration {
  public:
-  FakeP2PManagerConfiguration() {
-    EXPECT_TRUE(p2p_dir_.CreateUniqueTempDir());
-  }
+  FakeP2PManagerConfiguration() { EXPECT_TRUE(p2p_dir_.CreateUniqueTempDir()); }
 
   // P2PManager::Configuration override
   base::FilePath GetP2PDir() override { return p2p_dir_.GetPath(); }
@@ -45,15 +43,15 @@
   }
 
   // P2PManager::Configuration override
-  std::vector<std::string> GetP2PClientArgs(const std::string &file_id,
+  std::vector<std::string> GetP2PClientArgs(const std::string& file_id,
                                             size_t minimum_size) override {
     std::vector<std::string> formatted_command = p2p_client_cmd_format_;
     // Replace {variable} on the passed string.
     std::string str_minimum_size = std::to_string(minimum_size);
     for (std::string& arg : formatted_command) {
       base::ReplaceSubstringsAfterOffset(&arg, 0, "{file_id}", file_id);
-      base::ReplaceSubstringsAfterOffset(&arg, 0, "{minsize}",
-                                         str_minimum_size);
+      base::ReplaceSubstringsAfterOffset(
+          &arg, 0, "{minsize}", str_minimum_size);
     }
     return formatted_command;
   }
diff --git a/fake_shill_proxy.cc b/fake_shill_proxy.cc
index 17698cd..de96511 100644
--- a/fake_shill_proxy.cc
+++ b/fake_shill_proxy.cc
@@ -16,6 +16,8 @@
 
 #include "update_engine/fake_shill_proxy.h"
 
+#include <utility>
+
 using org::chromium::flimflam::ManagerProxyMock;
 using org::chromium::flimflam::ServiceProxyInterface;
 
@@ -31,8 +33,8 @@
 std::unique_ptr<ServiceProxyInterface> FakeShillProxy::GetServiceForPath(
     const dbus::ObjectPath& path) {
   auto it = service_proxy_mocks_.find(path.value());
-  CHECK(it != service_proxy_mocks_.end()) << "No ServiceProxyMock set for "
-                                          << path.value();
+  CHECK(it != service_proxy_mocks_.end())
+      << "No ServiceProxyMock set for " << path.value();
   std::unique_ptr<ServiceProxyInterface> result = std::move(it->second);
   service_proxy_mocks_.erase(it);
   return result;
diff --git a/fake_system_state.h b/fake_system_state.h
index 627bd5c..24b1eec 100644
--- a/fake_system_state.h
+++ b/fake_system_state.h
@@ -118,8 +118,8 @@
 
   inline void set_connection_manager(
       ConnectionManagerInterface* connection_manager) {
-    connection_manager_ = (connection_manager ? connection_manager :
-                           &mock_connection_manager_);
+    connection_manager_ =
+        (connection_manager ? connection_manager : &mock_connection_manager_);
   }
 
   inline void set_hardware(HardwareInterface* hardware) {
@@ -136,30 +136,30 @@
   }
 
   inline void set_powerwash_safe_prefs(PrefsInterface* powerwash_safe_prefs) {
-    powerwash_safe_prefs_ = (powerwash_safe_prefs ? powerwash_safe_prefs :
-                             &mock_powerwash_safe_prefs_);
+    powerwash_safe_prefs_ =
+        (powerwash_safe_prefs ? powerwash_safe_prefs
+                              : &mock_powerwash_safe_prefs_);
   }
 
-  inline void set_payload_state(PayloadStateInterface *payload_state) {
+  inline void set_payload_state(PayloadStateInterface* payload_state) {
     payload_state_ = payload_state ? payload_state : &mock_payload_state_;
   }
 
   inline void set_update_attempter(UpdateAttempter* update_attempter) {
-    update_attempter_ = (update_attempter ? update_attempter :
-                         &mock_update_attempter_);
+    update_attempter_ =
+        (update_attempter ? update_attempter : &mock_update_attempter_);
   }
 
   inline void set_request_params(OmahaRequestParams* request_params) {
-    request_params_ = (request_params ? request_params :
-                       &mock_request_params_);
+    request_params_ = (request_params ? request_params : &mock_request_params_);
   }
 
-  inline void set_p2p_manager(P2PManager *p2p_manager) {
+  inline void set_p2p_manager(P2PManager* p2p_manager) {
     p2p_manager_ = p2p_manager ? p2p_manager : &mock_p2p_manager_;
   }
 
   inline void set_update_manager(
-      chromeos_update_manager::UpdateManager *update_manager) {
+      chromeos_update_manager::UpdateManager* update_manager) {
     update_manager_ = update_manager ? update_manager : &fake_update_manager_;
   }
 
@@ -201,12 +201,12 @@
     return &mock_metrics_reporter_;
   }
 
-  inline testing::NiceMock<MockPrefs> *mock_prefs() {
+  inline testing::NiceMock<MockPrefs>* mock_prefs() {
     CHECK(prefs_ == &mock_prefs_);
     return &mock_prefs_;
   }
 
-  inline testing::NiceMock<MockPrefs> *mock_powerwash_safe_prefs() {
+  inline testing::NiceMock<MockPrefs>* mock_powerwash_safe_prefs() {
     CHECK(powerwash_safe_prefs_ == &mock_powerwash_safe_prefs_);
     return &mock_powerwash_safe_prefs_;
   }
diff --git a/hardware_chromeos.cc b/hardware_chromeos.cc
index 3949328..c5933b5 100644
--- a/hardware_chromeos.cc
+++ b/hardware_chromeos.cc
@@ -131,8 +131,7 @@
   struct stat statbuf;
   if (stat(kOOBECompletedMarker, &statbuf) != 0) {
     if (errno != ENOENT) {
-      PLOG(ERROR) << "Error getting information about "
-                  << kOOBECompletedMarker;
+      PLOG(ERROR) << "Error getting information about " << kOOBECompletedMarker;
     }
     return false;
   }
@@ -145,8 +144,8 @@
 static string ReadValueFromCrosSystem(const string& key) {
   char value_buffer[VB_MAX_STRING_PROPERTY];
 
-  const char* rv = VbGetSystemPropertyString(key.c_str(), value_buffer,
-                                             sizeof(value_buffer));
+  const char* rv = VbGetSystemPropertyString(
+      key.c_str(), value_buffer, sizeof(value_buffer));
   if (rv != nullptr) {
     string return_value(value_buffer);
     base::TrimWhitespaceASCII(return_value, base::TRIM_ALL, &return_value);
@@ -212,8 +211,8 @@
 
 int HardwareChromeOS::GetPowerwashCount() const {
   int powerwash_count;
-  base::FilePath marker_path = base::FilePath(kPowerwashSafeDirectory).Append(
-      kPowerwashCountMarker);
+  base::FilePath marker_path =
+      base::FilePath(kPowerwashSafeDirectory).Append(kPowerwashCountMarker);
   string contents;
   if (!utils::ReadFile(marker_path.value(), &contents))
     return -1;
@@ -287,7 +286,7 @@
 bool HardwareChromeOS::GetFirstActiveOmahaPingSent() const {
   int exit_code = 0;
   string active_ping_str;
-  vector<string> cmd = { "vpd_get_value", kActivePingKey };
+  vector<string> cmd = {"vpd_get_value", kActivePingKey};
   if (!Subprocess::SynchronousExec(cmd, &exit_code, &active_ping_str) ||
       exit_code) {
     LOG(ERROR) << "Failed to get vpd key for " << kActivePingKey
@@ -295,9 +294,7 @@
     return false;
   }
 
-  base::TrimWhitespaceASCII(active_ping_str,
-                            base::TRIM_ALL,
-                            &active_ping_str);
+  base::TrimWhitespaceASCII(active_ping_str, base::TRIM_ALL, &active_ping_str);
   int active_ping;
   if (active_ping_str.empty() ||
       !base::StringToInt(active_ping_str, &active_ping)) {
@@ -311,21 +308,19 @@
   int exit_code = 0;
   string output;
   vector<string> vpd_set_cmd = {
-    "vpd", "-i", "RW_VPD", "-s", string(kActivePingKey) + "=1" };
+      "vpd", "-i", "RW_VPD", "-s", string(kActivePingKey) + "=1"};
   if (!Subprocess::SynchronousExec(vpd_set_cmd, &exit_code, &output) ||
       exit_code) {
     LOG(ERROR) << "Failed to set vpd key for " << kActivePingKey
-               << " with exit code: " << exit_code
-               << " with error: " << output;
+               << " with exit code: " << exit_code << " with error: " << output;
     return false;
   }
 
-  vector<string> vpd_dump_cmd = { "dump_vpd_log", "--force" };
+  vector<string> vpd_dump_cmd = {"dump_vpd_log", "--force"};
   if (!Subprocess::SynchronousExec(vpd_dump_cmd, &exit_code, &output) ||
       exit_code) {
-    LOG(ERROR) << "Failed to cache " << kActivePingKey<< " using dump_vpd_log"
-               << " with exit code: " << exit_code
-               << " with error: " << output;
+    LOG(ERROR) << "Failed to cache " << kActivePingKey << " using dump_vpd_log"
+               << " with exit code: " << exit_code << " with error: " << output;
     return false;
   }
   return true;
diff --git a/image_properties_chromeos.cc b/image_properties_chromeos.cc
index 87c32f0..5ab8f05 100644
--- a/image_properties_chromeos.cc
+++ b/image_properties_chromeos.cc
@@ -114,7 +114,8 @@
   result.board = GetStringWithDefault(lsb_release, kLsbReleaseBoardKey, "");
   result.version = GetStringWithDefault(lsb_release, kLsbReleaseVersionKey, "");
   result.omaha_url =
-      GetStringWithDefault(lsb_release, kLsbReleaseAutoUpdateServerKey,
+      GetStringWithDefault(lsb_release,
+                           kLsbReleaseAutoUpdateServerKey,
                            constants::kOmahaDefaultProductionURL);
   // Build fingerprint not used in Chrome OS.
   result.build_fingerprint = "";
diff --git a/libcurl_http_fetcher.cc b/libcurl_http_fetcher.cc
index 7cf3341..ce3475d 100644
--- a/libcurl_http_fetcher.cc
+++ b/libcurl_http_fetcher.cc
@@ -164,29 +164,26 @@
   bool is_direct = (GetCurrentProxy() == kNoProxy);
   LOG(INFO) << "Using proxy: " << (is_direct ? "no" : "yes");
   if (is_direct) {
-    CHECK_EQ(curl_easy_setopt(curl_handle_,
-                              CURLOPT_PROXY,
-                              ""), CURLE_OK);
+    CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_PROXY, ""), CURLE_OK);
   } else {
-    CHECK_EQ(curl_easy_setopt(curl_handle_,
-                              CURLOPT_PROXY,
-                              GetCurrentProxy().c_str()), CURLE_OK);
+    CHECK_EQ(curl_easy_setopt(
+                 curl_handle_, CURLOPT_PROXY, GetCurrentProxy().c_str()),
+             CURLE_OK);
     // Curl seems to require us to set the protocol
     curl_proxytype type;
     if (GetProxyType(GetCurrentProxy(), &type)) {
-      CHECK_EQ(curl_easy_setopt(curl_handle_,
-                                CURLOPT_PROXYTYPE,
-                                type), CURLE_OK);
+      CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_PROXYTYPE, type),
+               CURLE_OK);
     }
   }
 
   if (post_data_set_) {
     CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_POST, 1), CURLE_OK);
-    CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_POSTFIELDS,
-                              post_data_.data()),
-             CURLE_OK);
-    CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_POSTFIELDSIZE,
-                              post_data_.size()),
+    CHECK_EQ(
+        curl_easy_setopt(curl_handle_, CURLOPT_POSTFIELDS, post_data_.data()),
+        CURLE_OK);
+    CHECK_EQ(curl_easy_setopt(
+                 curl_handle_, CURLOPT_POSTFIELDSIZE, post_data_.size()),
              CURLE_OK);
   }
 
@@ -225,7 +222,7 @@
     size_t end_offset = 0;
     if (download_length_) {
       end_offset = static_cast<size_t>(resume_offset_) + download_length_ - 1;
-      CHECK_LE((size_t) resume_offset_, end_offset);
+      CHECK_LE((size_t)resume_offset_, end_offset);
     }
 
     // Create a string representation of the desired range.
@@ -238,30 +235,30 @@
   }
 
   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_WRITEDATA, this), CURLE_OK);
-  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_WRITEFUNCTION,
-                            StaticLibcurlWrite), CURLE_OK);
-  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_URL, url_.c_str()),
-           CURLE_OK);
+  CHECK_EQ(
+      curl_easy_setopt(curl_handle_, CURLOPT_WRITEFUNCTION, StaticLibcurlWrite),
+      CURLE_OK);
+  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_URL, url_.c_str()), CURLE_OK);
 
   // If the connection drops under |low_speed_limit_bps_| (10
   // bytes/sec by default) for |low_speed_time_seconds_| (90 seconds,
   // 180 on non-official builds), reconnect.
-  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_LOW_SPEED_LIMIT,
-                            low_speed_limit_bps_),
+  CHECK_EQ(curl_easy_setopt(
+               curl_handle_, CURLOPT_LOW_SPEED_LIMIT, low_speed_limit_bps_),
            CURLE_OK);
-  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_LOW_SPEED_TIME,
-                            low_speed_time_seconds_),
+  CHECK_EQ(curl_easy_setopt(
+               curl_handle_, CURLOPT_LOW_SPEED_TIME, low_speed_time_seconds_),
            CURLE_OK);
-  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_CONNECTTIMEOUT,
-                            connect_timeout_seconds_),
+  CHECK_EQ(curl_easy_setopt(
+               curl_handle_, CURLOPT_CONNECTTIMEOUT, connect_timeout_seconds_),
            CURLE_OK);
 
   // By default, libcurl doesn't follow redirections. Allow up to
   // |kDownloadMaxRedirects| redirections.
   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_FOLLOWLOCATION, 1), CURLE_OK);
-  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_MAXREDIRS,
-                            kDownloadMaxRedirects),
-           CURLE_OK);
+  CHECK_EQ(
+      curl_easy_setopt(curl_handle_, CURLOPT_MAXREDIRS, kDownloadMaxRedirects),
+      CURLE_OK);
 
   // Lock down the appropriate curl options for HTTP or HTTPS depending on
   // the url.
@@ -296,9 +293,9 @@
   LOG(INFO) << "Setting up curl options for HTTP";
   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_PROTOCOLS, CURLPROTO_HTTP),
            CURLE_OK);
-  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_REDIR_PROTOCOLS,
-                            CURLPROTO_HTTP),
-           CURLE_OK);
+  CHECK_EQ(
+      curl_easy_setopt(curl_handle_, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP),
+      CURLE_OK);
 }
 
 // Security lock-down in official builds: makes sure that peer certificate
@@ -306,25 +303,24 @@
 // restricts protocols to HTTPS, restricts ciphers to HIGH.
 void LibcurlHttpFetcher::SetCurlOptionsForHttps() {
   LOG(INFO) << "Setting up curl options for HTTPS";
-  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_SSL_VERIFYPEER, 1),
-           CURLE_OK);
-  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_SSL_VERIFYHOST, 2),
-           CURLE_OK);
-  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_CAPATH,
-                            constants::kCACertificatesPath),
+  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_SSL_VERIFYPEER, 1), CURLE_OK);
+  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_SSL_VERIFYHOST, 2), CURLE_OK);
+  CHECK_EQ(curl_easy_setopt(
+               curl_handle_, CURLOPT_CAPATH, constants::kCACertificatesPath),
            CURLE_OK);
   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS),
            CURLE_OK);
-  CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_REDIR_PROTOCOLS,
-                            CURLPROTO_HTTPS),
-           CURLE_OK);
+  CHECK_EQ(
+      curl_easy_setopt(curl_handle_, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS),
+      CURLE_OK);
   CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_SSL_CIPHER_LIST, "HIGH:!ADH"),
            CURLE_OK);
   if (server_to_check_ != ServerToCheck::kNone) {
     CHECK_EQ(
         curl_easy_setopt(curl_handle_, CURLOPT_SSL_CTX_DATA, &server_to_check_),
         CURLE_OK);
-    CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_SSL_CTX_FUNCTION,
+    CHECK_EQ(curl_easy_setopt(curl_handle_,
+                              CURLOPT_SSL_CTX_FUNCTION,
                               CertificateChecker::ProcessSSLContext),
              CURLE_OK);
   }
@@ -344,8 +340,8 @@
 void LibcurlHttpFetcher::BeginTransfer(const string& url) {
   CHECK(!transfer_in_progress_);
   url_ = url;
-  auto closure = base::Bind(&LibcurlHttpFetcher::ProxiesResolved,
-                            base::Unretained(this));
+  auto closure =
+      base::Bind(&LibcurlHttpFetcher::ProxiesResolved, base::Unretained(this));
   ResolveProxiesForUrl(url_, closure);
 }
 
@@ -443,8 +439,7 @@
   // update engine performs an update check while the network is not ready
   // (e.g., right after resume). Longer term, we should check if the network
   // is online/offline and return an appropriate error code.
-  if (!sent_byte_ &&
-      http_response_code_ == 0 &&
+  if (!sent_byte_ && http_response_code_ == 0 &&
       no_network_retry_count_ < no_network_max_retries_) {
     no_network_retry_count_++;
     retry_task_id_ = MessageLoop::current()->PostDelayedTask(
@@ -487,8 +482,8 @@
   } else if ((transfer_size_ >= 0) && (bytes_downloaded_ < transfer_size_)) {
     if (!ignore_failure_)
       retry_count_++;
-    LOG(INFO) << "Transfer interrupted after downloading "
-              << bytes_downloaded_ << " of " << transfer_size_ << " bytes. "
+    LOG(INFO) << "Transfer interrupted after downloading " << bytes_downloaded_
+              << " of " << transfer_size_ << " bytes. "
               << transfer_size_ - bytes_downloaded_ << " bytes remaining "
               << "after " << retry_count_ << " attempt(s)";
 
@@ -506,8 +501,8 @@
                    base::Unretained(this)),
         TimeDelta::FromSeconds(retry_seconds_));
   } else {
-    LOG(INFO) << "Transfer completed (" << http_response_code_
-              << "), " << bytes_downloaded_ << " bytes downloaded";
+    LOG(INFO) << "Transfer completed (" << http_response_code_ << "), "
+              << bytes_downloaded_ << " bytes downloaded";
     if (delegate_) {
       bool success = IsHttpResponseSuccess();
       delegate_->TransferComplete(this, success);
@@ -520,7 +515,7 @@
   ignore_failure_ = false;
 }
 
-size_t LibcurlHttpFetcher::LibcurlWrite(void *ptr, size_t size, size_t nmemb) {
+size_t LibcurlHttpFetcher::LibcurlWrite(void* ptr, size_t size, size_t nmemb) {
   // Update HTTP response first.
   GetHttpResponseCode();
   const size_t payload_size = size * nmemb;
@@ -537,7 +532,8 @@
     double transfer_size_double;
     CHECK_EQ(curl_easy_getinfo(curl_handle_,
                                CURLINFO_CONTENT_LENGTH_DOWNLOAD,
-                               &transfer_size_double), CURLE_OK);
+                               &transfer_size_double),
+             CURLE_OK);
     off_t new_transfer_size = static_cast<off_t>(transfer_size_double);
     if (new_transfer_size > 0) {
       transfer_size_ = resume_offset_ + new_transfer_size;
@@ -613,8 +609,9 @@
 
   // Ask libcurl for the set of file descriptors we should track on its
   // behalf.
-  CHECK_EQ(curl_multi_fdset(curl_multi_handle_, &fd_read, &fd_write,
-                            &fd_exc, &fd_max), CURLM_OK);
+  CHECK_EQ(curl_multi_fdset(
+               curl_multi_handle_, &fd_read, &fd_write, &fd_exc, &fd_max),
+           CURLM_OK);
 
   // We should iterate through all file descriptors up to libcurl's fd_max or
   // the highest one we're tracking, whichever is larger.
@@ -632,12 +629,12 @@
     // should always be false.
     bool is_exc = FD_ISSET(fd, &fd_exc) != 0;
     bool must_track[2] = {
-      is_exc || (FD_ISSET(fd, &fd_read) != 0),  // track 0 -- read
-      is_exc || (FD_ISSET(fd, &fd_write) != 0)  // track 1 -- write
+        is_exc || (FD_ISSET(fd, &fd_read) != 0),  // track 0 -- read
+        is_exc || (FD_ISSET(fd, &fd_write) != 0)  // track 1 -- write
     };
     MessageLoop::WatchMode watch_modes[2] = {
-      MessageLoop::WatchMode::kWatchRead,
-      MessageLoop::WatchMode::kWatchWrite,
+        MessageLoop::WatchMode::kWatchRead,
+        MessageLoop::WatchMode::kWatchWrite,
     };
 
     for (size_t t = 0; t < arraysize(fd_task_maps_); ++t) {
@@ -720,9 +717,8 @@
   for (size_t t = 0; t < arraysize(fd_task_maps_); ++t) {
     for (const auto& fd_taks_pair : fd_task_maps_[t]) {
       if (!MessageLoop::current()->CancelTask(fd_taks_pair.second)) {
-        LOG(WARNING) << "Error canceling the watch task "
-                     << fd_taks_pair.second << " for "
-                     << (t ? "writing" : "reading") << " the fd "
+        LOG(WARNING) << "Error canceling the watch task " << fd_taks_pair.second
+                     << " for " << (t ? "writing" : "reading") << " the fd "
                      << fd_taks_pair.first;
       }
     }
diff --git a/libcurl_http_fetcher.h b/libcurl_http_fetcher.h
index 61871c9..25a2df3 100644
--- a/libcurl_http_fetcher.h
+++ b/libcurl_http_fetcher.h
@@ -151,11 +151,13 @@
   void SetupMessageLoopSources();
 
   // Callback called by libcurl when new data has arrived on the transfer
-  size_t LibcurlWrite(void *ptr, size_t size, size_t nmemb);
-  static size_t StaticLibcurlWrite(void *ptr, size_t size,
-                                   size_t nmemb, void *stream) {
-    return reinterpret_cast<LibcurlHttpFetcher*>(stream)->
-        LibcurlWrite(ptr, size, nmemb);
+  size_t LibcurlWrite(void* ptr, size_t size, size_t nmemb);
+  static size_t StaticLibcurlWrite(void* ptr,
+                                   size_t size,
+                                   size_t nmemb,
+                                   void* stream) {
+    return reinterpret_cast<LibcurlHttpFetcher*>(stream)->LibcurlWrite(
+        ptr, size, nmemb);
   }
 
   // Cleans up the following if they are non-null:
diff --git a/main.cc b/main.cc
index 67a150e..26f9efb 100644
--- a/main.cc
+++ b/main.cc
@@ -108,9 +108,8 @@
   // we stop caring about the old-style logs.
   if (utils::FileExists(symlink_path.c_str()) &&
       !utils::IsSymlink(symlink_path.c_str())) {
-    base::ReplaceFile(base::FilePath(symlink_path),
-                      base::FilePath(log_path),
-                      nullptr);
+    base::ReplaceFile(
+        base::FilePath(symlink_path), base::FilePath(log_path), nullptr);
   }
   base::DeleteFile(base::FilePath(symlink_path), true);
   if (symlink(log_path.c_str(), symlink_path.c_str()) == -1) {
@@ -160,10 +159,10 @@
 
 int main(int argc, char** argv) {
   DEFINE_bool(logtofile, false, "Write logs to a file in log_dir.");
-  DEFINE_bool(logtostderr, false,
+  DEFINE_bool(logtostderr,
+              false,
               "Write logs to stderr instead of to a file in log_dir.");
-  DEFINE_bool(foreground, false,
-              "Don't daemon()ize; run in foreground.");
+  DEFINE_bool(foreground, false, "Don't daemon()ize; run in foreground.");
 
   chromeos_update_engine::Terminator::Init();
   brillo::FlagHelper::Init(argc, argv, "A/B Update Engine");
diff --git a/metrics_reporter_omaha.cc b/metrics_reporter_omaha.cc
index 3ae4f4b..14819d8 100644
--- a/metrics_reporter_omaha.cc
+++ b/metrics_reporter_omaha.cc
@@ -300,8 +300,6 @@
                           1024,  // max: 1024 MiB = 1 GiB
                           50);   // num_buckets
 
-
-
   metric = metrics::kMetricAttemptResult;
   LOG(INFO) << "Uploading " << static_cast<int>(attempt_result)
             << " for metric " << metric;
diff --git a/metrics_reporter_omaha_unittest.cc b/metrics_reporter_omaha_unittest.cc
index a479028..545d02f 100644
--- a/metrics_reporter_omaha_unittest.cc
+++ b/metrics_reporter_omaha_unittest.cc
@@ -226,7 +226,6 @@
                         _))
       .Times(2);
 
-
   // Check the report of attempt result.
   EXPECT_CALL(
       *mock_metrics_lib_,
diff --git a/metrics_utils_unittest.cc b/metrics_utils_unittest.cc
index 417a72b..e7c4c26 100644
--- a/metrics_utils_unittest.cc
+++ b/metrics_utils_unittest.cc
@@ -38,12 +38,12 @@
   EXPECT_EQ(metrics::ConnectionType::kEthernet,
             GetConnectionType(ConnectionType::kEthernet,
                               ConnectionTethering::kUnknown));
-  EXPECT_EQ(metrics::ConnectionType::kWifi,
-            GetConnectionType(ConnectionType::kWifi,
-                              ConnectionTethering::kUnknown));
-  EXPECT_EQ(metrics::ConnectionType::kWimax,
-            GetConnectionType(ConnectionType::kWimax,
-                              ConnectionTethering::kUnknown));
+  EXPECT_EQ(
+      metrics::ConnectionType::kWifi,
+      GetConnectionType(ConnectionType::kWifi, ConnectionTethering::kUnknown));
+  EXPECT_EQ(
+      metrics::ConnectionType::kWimax,
+      GetConnectionType(ConnectionType::kWimax, ConnectionTethering::kUnknown));
   EXPECT_EQ(metrics::ConnectionType::kBluetooth,
             GetConnectionType(ConnectionType::kBluetooth,
                               ConnectionTethering::kUnknown));
@@ -75,9 +75,9 @@
   EXPECT_EQ(metrics::ConnectionType::kWifi,
             GetConnectionType(ConnectionType::kWifi,
                               ConnectionTethering::kSuspected));
-  EXPECT_EQ(metrics::ConnectionType::kWifi,
-            GetConnectionType(ConnectionType::kWifi,
-                              ConnectionTethering::kUnknown));
+  EXPECT_EQ(
+      metrics::ConnectionType::kWifi,
+      GetConnectionType(ConnectionType::kWifi, ConnectionTethering::kUnknown));
 }
 
 TEST(MetricsUtilsTest, WallclockDurationHelper) {
@@ -94,61 +94,51 @@
   fake_clock.SetWallclockTime(base::Time::FromInternalValue(1000000));
 
   // First time called so no previous measurement available.
-  EXPECT_FALSE(metrics_utils::WallclockDurationHelper(&fake_system_state,
-                                                      state_variable_key,
-                                                      &duration));
+  EXPECT_FALSE(metrics_utils::WallclockDurationHelper(
+      &fake_system_state, state_variable_key, &duration));
 
   // Next time, we should get zero since the clock didn't advance.
-  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(&fake_system_state,
-                                                     state_variable_key,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
+      &fake_system_state, state_variable_key, &duration));
   EXPECT_EQ(duration.InSeconds(), 0);
 
   // We can also call it as many times as we want with it being
   // considered a failure.
-  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(&fake_system_state,
-                                                     state_variable_key,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
+      &fake_system_state, state_variable_key, &duration));
   EXPECT_EQ(duration.InSeconds(), 0);
-  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(&fake_system_state,
-                                                     state_variable_key,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
+      &fake_system_state, state_variable_key, &duration));
   EXPECT_EQ(duration.InSeconds(), 0);
 
   // Advance the clock one second, then we should get 1 sec on the
   // next call and 0 sec on the subsequent call.
   fake_clock.SetWallclockTime(base::Time::FromInternalValue(2000000));
-  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(&fake_system_state,
-                                                     state_variable_key,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
+      &fake_system_state, state_variable_key, &duration));
   EXPECT_EQ(duration.InSeconds(), 1);
-  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(&fake_system_state,
-                                                     state_variable_key,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
+      &fake_system_state, state_variable_key, &duration));
   EXPECT_EQ(duration.InSeconds(), 0);
 
   // Advance clock two seconds and we should get 2 sec and then 0 sec.
   fake_clock.SetWallclockTime(base::Time::FromInternalValue(4000000));
-  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(&fake_system_state,
-                                                     state_variable_key,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
+      &fake_system_state, state_variable_key, &duration));
   EXPECT_EQ(duration.InSeconds(), 2);
-  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(&fake_system_state,
-                                                     state_variable_key,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
+      &fake_system_state, state_variable_key, &duration));
   EXPECT_EQ(duration.InSeconds(), 0);
 
   // There's a possibility that the wallclock can go backwards (NTP
   // adjustments, for example) so check that we properly handle this
   // case.
   fake_clock.SetWallclockTime(base::Time::FromInternalValue(3000000));
-  EXPECT_FALSE(metrics_utils::WallclockDurationHelper(&fake_system_state,
-                                                      state_variable_key,
-                                                      &duration));
+  EXPECT_FALSE(metrics_utils::WallclockDurationHelper(
+      &fake_system_state, state_variable_key, &duration));
   fake_clock.SetWallclockTime(base::Time::FromInternalValue(4000000));
-  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(&fake_system_state,
-                                                     state_variable_key,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
+      &fake_system_state, state_variable_key, &duration));
   EXPECT_EQ(duration.InSeconds(), 1);
 }
 
@@ -164,48 +154,40 @@
   fake_clock.SetMonotonicTime(base::Time::FromInternalValue(1000000));
 
   // First time called so no previous measurement available.
-  EXPECT_FALSE(metrics_utils::MonotonicDurationHelper(&fake_system_state,
-                                                      &storage,
-                                                      &duration));
+  EXPECT_FALSE(metrics_utils::MonotonicDurationHelper(
+      &fake_system_state, &storage, &duration));
 
   // Next time, we should get zero since the clock didn't advance.
-  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(&fake_system_state,
-                                                     &storage,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
+      &fake_system_state, &storage, &duration));
   EXPECT_EQ(duration.InSeconds(), 0);
 
   // We can also call it as many times as we want with it being
   // considered a failure.
-  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(&fake_system_state,
-                                                     &storage,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
+      &fake_system_state, &storage, &duration));
   EXPECT_EQ(duration.InSeconds(), 0);
-  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(&fake_system_state,
-                                                     &storage,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
+      &fake_system_state, &storage, &duration));
   EXPECT_EQ(duration.InSeconds(), 0);
 
   // Advance the clock one second, then we should get 1 sec on the
   // next call and 0 sec on the subsequent call.
   fake_clock.SetMonotonicTime(base::Time::FromInternalValue(2000000));
-  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(&fake_system_state,
-                                                     &storage,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
+      &fake_system_state, &storage, &duration));
   EXPECT_EQ(duration.InSeconds(), 1);
-  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(&fake_system_state,
-                                                     &storage,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
+      &fake_system_state, &storage, &duration));
   EXPECT_EQ(duration.InSeconds(), 0);
 
   // Advance clock two seconds and we should get 2 sec and then 0 sec.
   fake_clock.SetMonotonicTime(base::Time::FromInternalValue(4000000));
-  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(&fake_system_state,
-                                                     &storage,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
+      &fake_system_state, &storage, &duration));
   EXPECT_EQ(duration.InSeconds(), 2);
-  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(&fake_system_state,
-                                                     &storage,
-                                                     &duration));
+  EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
+      &fake_system_state, &storage, &duration));
   EXPECT_EQ(duration.InSeconds(), 0);
 }
 
diff --git a/mock_omaha_request_params.h b/mock_omaha_request_params.h
index 2fe5e01..41bdc19 100644
--- a/mock_omaha_request_params.h
+++ b/mock_omaha_request_params.h
@@ -33,8 +33,8 @@
     // migration from tests using the real RequestParams when they should have
     // use a fake or mock.
     ON_CALL(*this, GetAppId())
-        .WillByDefault(testing::Invoke(
-            this, &MockOmahaRequestParams::FakeGetAppId));
+        .WillByDefault(
+            testing::Invoke(this, &MockOmahaRequestParams::FakeGetAppId));
     ON_CALL(*this, SetTargetChannel(testing::_, testing::_, testing::_))
         .WillByDefault(testing::Invoke(
             this, &MockOmahaRequestParams::FakeSetTargetChannel));
@@ -47,9 +47,10 @@
   }
 
   MOCK_CONST_METHOD0(GetAppId, std::string(void));
-  MOCK_METHOD3(SetTargetChannel, bool(const std::string& channel,
-                                      bool is_powerwash_allowed,
-                                      std::string* error));
+  MOCK_METHOD3(SetTargetChannel,
+               bool(const std::string& channel,
+                    bool is_powerwash_allowed,
+                    std::string* error));
   MOCK_CONST_METHOD0(target_version_prefix, std::string(void));
   MOCK_METHOD0(UpdateDownloadChannel, void(void));
   MOCK_CONST_METHOD0(IsUpdateUrlOfficial, bool(void));
@@ -58,16 +59,13 @@
  private:
   // Wrappers to call the parent class and behave like the real object by
   // default. See "Delegating Calls to a Parent Class" in gmock's documentation.
-  std::string FakeGetAppId() const {
-    return OmahaRequestParams::GetAppId();
-  }
+  std::string FakeGetAppId() const { return OmahaRequestParams::GetAppId(); }
 
   bool FakeSetTargetChannel(const std::string& channel,
                             bool is_powerwash_allowed,
                             std::string* error) {
-    return OmahaRequestParams::SetTargetChannel(channel,
-                                                is_powerwash_allowed,
-                                                error);
+    return OmahaRequestParams::SetTargetChannel(
+        channel, is_powerwash_allowed, error);
   }
 
   void FakeUpdateDownloadChannel() {
diff --git a/mock_p2p_manager.h b/mock_p2p_manager.h
index 5f4418e..fd67034 100644
--- a/mock_p2p_manager.h
+++ b/mock_p2p_manager.h
@@ -31,45 +31,41 @@
   MockP2PManager() {
     // Delegate all calls to the fake instance
     ON_CALL(*this, SetDevicePolicy(testing::_))
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::SetDevicePolicy));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeP2PManager::SetDevicePolicy));
     ON_CALL(*this, IsP2PEnabled())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::IsP2PEnabled));
+        .WillByDefault(testing::Invoke(&fake_, &FakeP2PManager::IsP2PEnabled));
     ON_CALL(*this, EnsureP2PRunning())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::EnsureP2PRunning));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeP2PManager::EnsureP2PRunning));
     ON_CALL(*this, EnsureP2PNotRunning())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::EnsureP2PNotRunning));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeP2PManager::EnsureP2PNotRunning));
     ON_CALL(*this, PerformHousekeeping())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::PerformHousekeeping));
-    ON_CALL(*this, LookupUrlForFile(testing::_, testing::_, testing::_,
-                                    testing::_))
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::LookupUrlForFile));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeP2PManager::PerformHousekeeping));
+    ON_CALL(*this,
+            LookupUrlForFile(testing::_, testing::_, testing::_, testing::_))
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeP2PManager::LookupUrlForFile));
     ON_CALL(*this, FileShare(testing::_, testing::_))
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::FileShare));
+        .WillByDefault(testing::Invoke(&fake_, &FakeP2PManager::FileShare));
     ON_CALL(*this, FileGetPath(testing::_))
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::FileGetPath));
+        .WillByDefault(testing::Invoke(&fake_, &FakeP2PManager::FileGetPath));
     ON_CALL(*this, FileGetSize(testing::_))
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::FileGetSize));
+        .WillByDefault(testing::Invoke(&fake_, &FakeP2PManager::FileGetSize));
     ON_CALL(*this, FileGetExpectedSize(testing::_))
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::FileGetExpectedSize));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeP2PManager::FileGetExpectedSize));
     ON_CALL(*this, FileGetVisible(testing::_, testing::_))
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::FileGetVisible));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeP2PManager::FileGetVisible));
     ON_CALL(*this, FileMakeVisible(testing::_))
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::FileMakeVisible));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeP2PManager::FileMakeVisible));
     ON_CALL(*this, CountSharedFiles())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeP2PManager::CountSharedFiles));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeP2PManager::CountSharedFiles));
   }
 
   ~MockP2PManager() override {}
@@ -80,10 +76,9 @@
   MOCK_METHOD0(EnsureP2PRunning, bool());
   MOCK_METHOD0(EnsureP2PNotRunning, bool());
   MOCK_METHOD0(PerformHousekeeping, bool());
-  MOCK_METHOD4(LookupUrlForFile, void(const std::string&,
-                                      size_t,
-                                      base::TimeDelta,
-                                      LookupCallback));
+  MOCK_METHOD4(
+      LookupUrlForFile,
+      void(const std::string&, size_t, base::TimeDelta, LookupCallback));
   MOCK_METHOD2(FileShare, bool(const std::string&, size_t));
   MOCK_METHOD1(FileGetPath, base::FilePath(const std::string&));
   MOCK_METHOD1(FileGetSize, ssize_t(const std::string&));
@@ -93,9 +88,7 @@
   MOCK_METHOD0(CountSharedFiles, int());
 
   // Returns a reference to the underlying FakeP2PManager.
-  FakeP2PManager& fake() {
-    return fake_;
-  }
+  FakeP2PManager& fake() { return fake_; }
 
  private:
   // The underlying FakeP2PManager.
diff --git a/mock_payload_state.h b/mock_payload_state.h
index 4ac3ccf..ad22de5 100644
--- a/mock_payload_state.h
+++ b/mock_payload_state.h
@@ -26,11 +26,9 @@
 
 namespace chromeos_update_engine {
 
-class MockPayloadState: public PayloadStateInterface {
+class MockPayloadState : public PayloadStateInterface {
  public:
-  bool Initialize(SystemState* system_state) {
-    return true;
-  }
+  bool Initialize(SystemState* system_state) { return true; }
 
   // Significant methods.
   MOCK_METHOD1(SetResponse, void(const OmahaResponse& response));
diff --git a/network_selector_interface.h b/network_selector_interface.h
index 6c17b2c..bd0948f 100644
--- a/network_selector_interface.h
+++ b/network_selector_interface.h
@@ -32,7 +32,6 @@
 
 class NetworkSelectorInterface {
  public:
-
   virtual ~NetworkSelectorInterface() = default;
 
   // Set the current process network. All sockets created in the future will be
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index 9cb9b49..fae9471 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -156,7 +156,7 @@
   string app_body;
   if (event == nullptr) {
     if (include_ping)
-        app_body = GetPingXml(ping_active_days, ping_roll_call_days);
+      app_body = GetPingXml(ping_active_days, ping_roll_call_days);
     if (!ping_only) {
       if (!skip_updatecheck) {
         app_body += "        <updatecheck";
@@ -209,7 +209,9 @@
     }
     app_body = base::StringPrintf(
         "        <event eventtype=\"%d\" eventresult=\"%d\"%s></event>\n",
-        event->type, event->result, error_code.c_str());
+        event->type,
+        event->result,
+        error_code.c_str());
   }
 
   return app_body;
@@ -245,8 +247,8 @@
     return "";
   }
 
-  return base::StringPrintf("%s=\"%s\" ",
-                            arg_name.c_str(), escaped_xml_value.c_str());
+  return base::StringPrintf(
+      "%s=\"%s\" ", arg_name.c_str(), escaped_xml_value.c_str());
 }
 
 struct OmahaAppData {
@@ -302,8 +304,8 @@
   string app_channels =
       "track=\"" + XmlEncodeWithDefault(download_channel, "") + "\" ";
   if (params->current_channel() != download_channel) {
-    app_channels += "from_track=\"" + XmlEncodeWithDefault(
-        params->current_channel(), "") + "\" ";
+    app_channels += "from_track=\"" +
+                    XmlEncodeWithDefault(params->current_channel(), "") + "\" ";
   }
 
   string delta_okay_str = params->delta_okay() ? "true" : "false";
@@ -312,17 +314,17 @@
   // include the attribute.
   string install_date_in_days_str = "";
   if (install_date_in_days >= 0) {
-    install_date_in_days_str = base::StringPrintf("installdate=\"%d\" ",
-                                                  install_date_in_days);
+    install_date_in_days_str =
+        base::StringPrintf("installdate=\"%d\" ", install_date_in_days);
   }
 
   string app_cohort_args;
-  app_cohort_args += GetCohortArgXml(system_state->prefs(),
-                                     "cohort", kPrefsOmahaCohort);
-  app_cohort_args += GetCohortArgXml(system_state->prefs(),
-                                     "cohorthint", kPrefsOmahaCohortHint);
-  app_cohort_args += GetCohortArgXml(system_state->prefs(),
-                                     "cohortname", kPrefsOmahaCohortName);
+  app_cohort_args +=
+      GetCohortArgXml(system_state->prefs(), "cohort", kPrefsOmahaCohort);
+  app_cohort_args += GetCohortArgXml(
+      system_state->prefs(), "cohorthint", kPrefsOmahaCohortHint);
+  app_cohort_args += GetCohortArgXml(
+      system_state->prefs(), "cohortname", kPrefsOmahaCohortName);
 
   string fingerprint_arg;
   if (!params->os_build_fingerprint().empty()) {
@@ -389,10 +391,13 @@
 // Returns an XML that corresponds to the entire <os> node of the Omaha
 // request based on the given parameters.
 string GetOsXml(OmahaRequestParams* params) {
-  string os_xml ="    <os "
-      "version=\"" + XmlEncodeWithDefault(params->os_version(), "") + "\" " +
-      "platform=\"" + XmlEncodeWithDefault(params->os_platform(), "") + "\" " +
-      "sp=\"" + XmlEncodeWithDefault(params->os_sp(), "") + "\">"
+  string os_xml =
+      "    <os "
+      "version=\"" +
+      XmlEncodeWithDefault(params->os_version(), "") + "\" " + "platform=\"" +
+      XmlEncodeWithDefault(params->os_platform(), "") + "\" " + "sp=\"" +
+      XmlEncodeWithDefault(params->os_sp(), "") +
+      "\">"
       "</os>\n";
   return os_xml;
 }
@@ -455,23 +460,22 @@
                          system_state);
   }
 
-  string install_source = base::StringPrintf("installsource=\"%s\" ",
+  string install_source = base::StringPrintf(
+      "installsource=\"%s\" ",
       (params->interactive() ? "ondemandupdate" : "scheduler"));
 
   string updater_version = XmlEncodeWithDefault(
-      base::StringPrintf("%s-%s",
-                         constants::kOmahaUpdaterID,
-                         kOmahaUpdaterVersion), "");
+      base::StringPrintf(
+          "%s-%s", constants::kOmahaUpdaterID, kOmahaUpdaterVersion),
+      "");
   string request_xml =
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
-      "<request protocol=\"3.0\" " + (
-          "version=\"" + updater_version + "\" "
-          "updaterversion=\"" + updater_version + "\" " +
-          install_source +
-          "ismachine=\"1\">\n") +
-      os_xml +
-      app_xml +
-      "</request>\n";
+      "<request protocol=\"3.0\" " +
+      ("version=\"" + updater_version +
+       "\" "
+       "updaterversion=\"" +
+       updater_version + "\" " + install_source + "ismachine=\"1\">\n") +
+      os_xml + app_xml + "</request>\n";
 
   return request_xml;
 }
@@ -522,7 +526,8 @@
 namespace {
 
 // Callback function invoked by expat.
-void ParserHandlerStart(void* user_data, const XML_Char* element,
+void ParserHandlerStart(void* user_data,
+                        const XML_Char* element,
                         const XML_Char** attr) {
   OmahaParserData* data = reinterpret_cast<OmahaParserData*>(user_data);
 
@@ -533,7 +538,7 @@
 
   map<string, string> attrs;
   if (attr != nullptr) {
-    for (int n = 0; attr[n] != nullptr && attr[n+1] != nullptr; n += 2) {
+    for (int n = 0; attr[n] != nullptr && attr[n + 1] != nullptr; n += 2) {
       string key = attr[n];
       string value = attr[n + 1];
       attrs[key] = value;
@@ -605,8 +610,8 @@
 
   const string path_suffix = string("/") + element;
 
-  if (!base::EndsWith(data->current_path, path_suffix,
-                      base::CompareCase::SENSITIVE)) {
+  if (!base::EndsWith(
+          data->current_path, path_suffix, base::CompareCase::SENSITIVE)) {
     LOG(ERROR) << "Unexpected end element '" << element
                << "' with current_path='" << data->current_path << "'";
     data->failed = true;
@@ -621,15 +626,15 @@
 // to never return any XML with entities our course of action is to
 // just stop parsing. This avoids potential resource exhaustion
 // problems AKA the "billion laughs". CVE-2013-0340.
-void ParserHandlerEntityDecl(void *user_data,
-                             const XML_Char *entity_name,
+void ParserHandlerEntityDecl(void* user_data,
+                             const XML_Char* entity_name,
                              int is_parameter_entity,
-                             const XML_Char *value,
+                             const XML_Char* value,
                              int value_length,
-                             const XML_Char *base,
-                             const XML_Char *system_id,
-                             const XML_Char *public_id,
-                             const XML_Char *notation_name) {
+                             const XML_Char* base,
+                             const XML_Char* system_id,
+                             const XML_Char* public_id,
+                             const XML_Char* notation_name) {
   OmahaParserData* data = reinterpret_cast<OmahaParserData*>(user_data);
 
   LOG(ERROR) << "XML entities are not supported. Aborting parsing.";
@@ -641,8 +646,9 @@
 }  // namespace
 
 bool XmlEncode(const string& input, string* output) {
-  if (std::find_if(input.begin(), input.end(),
-                   [](const char c){return c & 0x80;}) != input.end()) {
+  if (std::find_if(input.begin(), input.end(), [](const char c) {
+        return c & 0x80;
+      }) != input.end()) {
     LOG(WARNING) << "Invalid ASCII-7 string passed to the XML encoder:";
     utils::HexDumpString(input);
     return false;
@@ -713,8 +719,8 @@
       // last ping daystart preference. This way the next ping time
       // will be correct, hopefully.
       days = kPingTimeJump;
-      LOG(WARNING) <<
-          "System clock jumped back in time. Resetting ping daystarts.";
+      LOG(WARNING)
+          << "System clock jumped back in time. Resetting ping daystarts.";
     }
   }
   return days;
@@ -805,13 +811,12 @@
   }
 
   // Persist this to disk, for future use.
-  if (!OmahaRequestAction::PersistInstallDate(system_state,
-                                              num_days,
-                                              kProvisionedFromOOBEMarker))
+  if (!OmahaRequestAction::PersistInstallDate(
+          system_state, num_days, kProvisionedFromOOBEMarker))
     return -1;
 
-  LOG(INFO) << "Set the Omaha InstallDate from OOBE time-stamp to "
-            << num_days << " days";
+  LOG(INFO) << "Set the Omaha InstallDate from OOBE time-stamp to " << num_days
+            << " days";
 
   return num_days;
 }
@@ -842,8 +847,8 @@
       base::StringPrintf(
           "%s-%s", constants::kOmahaUpdaterID, kOmahaUpdaterVersion));
 
-  http_fetcher_->SetPostData(request_post.data(), request_post.size(),
-                             kHttpContentTypeTextXml);
+  http_fetcher_->SetPostData(
+      request_post.data(), request_post.size(), kHttpContentTypeTextXml);
   LOG(INFO) << "Posting an Omaha request to " << params_->update_url();
   LOG(INFO) << "Request: " << request_post;
   http_fetcher_->BeginTransfer(params_->update_url());
@@ -885,11 +890,10 @@
 
 // Update the last ping day preferences based on the server daystart
 // response. Returns true on success, false otherwise.
-bool UpdateLastPingDays(OmahaParserData *parser_data, PrefsInterface* prefs) {
+bool UpdateLastPingDays(OmahaParserData* parser_data, PrefsInterface* prefs) {
   int64_t elapsed_seconds = 0;
-  TEST_AND_RETURN_FALSE(
-      base::StringToInt64(parser_data->daystart_elapsed_seconds,
-                          &elapsed_seconds));
+  TEST_AND_RETURN_FALSE(base::StringToInt64(
+      parser_data->daystart_elapsed_seconds, &elapsed_seconds));
   TEST_AND_RETURN_FALSE(elapsed_seconds >= 0);
 
   // Remember the local time that matches the server's last midnight
@@ -1204,7 +1208,7 @@
 // If the transfer was successful, this uses expat to parse the response
 // and fill in the appropriate fields of the output object. Also, notifies
 // the processor that we're done.
-void OmahaRequestAction::TransferComplete(HttpFetcher *fetcher,
+void OmahaRequestAction::TransferComplete(HttpFetcher* fetcher,
                                           bool successful) {
   ScopedActionCompleter completer(processor_, this);
   string current_response(response_buffer_.begin(), response_buffer_.end());
@@ -1239,17 +1243,17 @@
   XML_SetUserData(parser, &parser_data);
   XML_SetElementHandler(parser, ParserHandlerStart, ParserHandlerEnd);
   XML_SetEntityDeclHandler(parser, ParserHandlerEntityDecl);
-  XML_Status res = XML_Parse(
-      parser,
-      reinterpret_cast<const char*>(response_buffer_.data()),
-      response_buffer_.size(),
-      XML_TRUE);
+  XML_Status res =
+      XML_Parse(parser,
+                reinterpret_cast<const char*>(response_buffer_.data()),
+                response_buffer_.size(),
+                XML_TRUE);
 
   if (res != XML_STATUS_OK || parser_data.failed) {
     LOG(ERROR) << "Omaha response not valid XML: "
-               << XML_ErrorString(XML_GetErrorCode(parser))
-               << " at line " << XML_GetCurrentLineNumber(parser)
-               << " col " << XML_GetCurrentColumnNumber(parser);
+               << XML_ErrorString(XML_GetErrorCode(parser)) << " at line "
+               << XML_GetCurrentLineNumber(parser) << " col "
+               << XML_GetCurrentColumnNumber(parser);
     XML_ParserFree(parser);
     ErrorCode error_code = ErrorCode::kOmahaRequestXMLParseError;
     if (response_buffer_.empty()) {
@@ -1304,7 +1308,6 @@
     return;
   }
 
-
   // If Omaha says to disable p2p, respect that
   if (output_object.disable_p2p_for_downloading) {
     LOG(INFO) << "Forcibly disabling use of p2p for downloading as "
@@ -1555,9 +1558,9 @@
 
     // But we can't download until the update-check-count-based wait is also
     // satisfied, so mark it as required now if update checks are enabled.
-    return params_->update_check_count_wait_enabled() ?
-              kWallClockWaitDoneButUpdateCheckWaitRequired :
-              kWallClockWaitDoneAndUpdateCheckWaitNotRequired;
+    return params_->update_check_count_wait_enabled()
+               ? kWallClockWaitDoneButUpdateCheckWaitRequired
+               : kWallClockWaitDoneAndUpdateCheckWaitNotRequired;
   }
 
   // Not our turn yet, so we have to wait until our turn to
@@ -1583,9 +1586,9 @@
   } else {
     // This file does not exist. This means we haven't started our update
     // check count down yet, so this is the right time to start the count down.
-    update_check_count_value = base::RandInt(
-      params_->min_update_checks_needed(),
-      params_->max_update_checks_allowed());
+    update_check_count_value =
+        base::RandInt(params_->min_update_checks_needed(),
+                      params_->max_update_checks_allowed());
 
     LOG(INFO) << "Randomly picked update check count value = "
               << update_check_count_value;
@@ -1618,8 +1621,7 @@
   // Legal value, we need to wait for more update checks to happen
   // until this becomes 0.
   LOG(INFO) << "Deferring Omaha updates for another "
-            << update_check_count_value
-            << " update checks per policy";
+            << update_check_count_value << " update checks per policy";
   return false;
 }
 
@@ -1627,8 +1629,7 @@
 bool OmahaRequestAction::ParseInstallDate(OmahaParserData* parser_data,
                                           OmahaResponse* output_object) {
   int64_t elapsed_days = 0;
-  if (!base::StringToInt64(parser_data->daystart_elapsed_days,
-                           &elapsed_days))
+  if (!base::StringToInt64(parser_data->daystart_elapsed_days, &elapsed_days))
     return false;
 
   if (elapsed_days < 0)
@@ -1639,7 +1640,7 @@
 }
 
 // static
-bool OmahaRequestAction::HasInstallDate(SystemState *system_state) {
+bool OmahaRequestAction::HasInstallDate(SystemState* system_state) {
   PrefsInterface* prefs = system_state->prefs();
   if (prefs == nullptr)
     return false;
@@ -1649,7 +1650,7 @@
 
 // static
 bool OmahaRequestAction::PersistInstallDate(
-    SystemState *system_state,
+    SystemState* system_state,
     int install_date_days,
     InstallDateProvisioningSource source) {
   TEST_AND_RETURN_FALSE(install_date_days >= 0);
@@ -1667,9 +1668,8 @@
   return true;
 }
 
-bool OmahaRequestAction::PersistCohortData(
-    const string& prefs_key,
-    const string& new_value) {
+bool OmahaRequestAction::PersistCohortData(const string& prefs_key,
+                                           const string& new_value) {
   if (new_value.empty() && system_state_->prefs()->Exists(prefs_key)) {
     LOG(INFO) << "Removing stored " << prefs_key << " value.";
     return system_state_->prefs()->Delete(prefs_key);
@@ -1703,51 +1703,51 @@
 
   // Regular update attempt.
   switch (code) {
-  case ErrorCode::kSuccess:
-    // OK, we parsed the response successfully but that does
-    // necessarily mean that an update is available.
-    if (HasOutputPipe()) {
-      const OmahaResponse& response = GetOutputObject();
-      if (response.update_exists) {
-        result = metrics::CheckResult::kUpdateAvailable;
-        reaction = metrics::CheckReaction::kUpdating;
+    case ErrorCode::kSuccess:
+      // OK, we parsed the response successfully but that does
+      // necessarily mean that an update is available.
+      if (HasOutputPipe()) {
+        const OmahaResponse& response = GetOutputObject();
+        if (response.update_exists) {
+          result = metrics::CheckResult::kUpdateAvailable;
+          reaction = metrics::CheckReaction::kUpdating;
+        } else {
+          result = metrics::CheckResult::kNoUpdateAvailable;
+        }
       } else {
         result = metrics::CheckResult::kNoUpdateAvailable;
       }
-    } else {
-      result = metrics::CheckResult::kNoUpdateAvailable;
-    }
-    break;
+      break;
 
-  case ErrorCode::kOmahaUpdateIgnoredPerPolicy:
-  case ErrorCode::kOmahaUpdateIgnoredOverCellular:
-    result = metrics::CheckResult::kUpdateAvailable;
-    reaction = metrics::CheckReaction::kIgnored;
-    break;
+    case ErrorCode::kOmahaUpdateIgnoredPerPolicy:
+    case ErrorCode::kOmahaUpdateIgnoredOverCellular:
+      result = metrics::CheckResult::kUpdateAvailable;
+      reaction = metrics::CheckReaction::kIgnored;
+      break;
 
-  case ErrorCode::kOmahaUpdateDeferredPerPolicy:
-    result = metrics::CheckResult::kUpdateAvailable;
-    reaction = metrics::CheckReaction::kDeferring;
-    break;
+    case ErrorCode::kOmahaUpdateDeferredPerPolicy:
+      result = metrics::CheckResult::kUpdateAvailable;
+      reaction = metrics::CheckReaction::kDeferring;
+      break;
 
-  case ErrorCode::kOmahaUpdateDeferredForBackoff:
-    result = metrics::CheckResult::kUpdateAvailable;
-    reaction = metrics::CheckReaction::kBackingOff;
-    break;
+    case ErrorCode::kOmahaUpdateDeferredForBackoff:
+      result = metrics::CheckResult::kUpdateAvailable;
+      reaction = metrics::CheckReaction::kBackingOff;
+      break;
 
-  default:
-    // We report two flavors of errors, "Download errors" and "Parsing
-    // error". Try to convert to the former and if that doesn't work
-    // we know it's the latter.
-    metrics::DownloadErrorCode tmp_error =
-        metrics_utils::GetDownloadErrorCode(code);
-    if (tmp_error != metrics::DownloadErrorCode::kInputMalformed) {
-      result = metrics::CheckResult::kDownloadError;
-      download_error_code = tmp_error;
-    } else {
-      result = metrics::CheckResult::kParsingError;
-    }
-    break;
+    default:
+      // We report two flavors of errors, "Download errors" and "Parsing
+      // error". Try to convert to the former and if that doesn't work
+      // we know it's the latter.
+      metrics::DownloadErrorCode tmp_error =
+          metrics_utils::GetDownloadErrorCode(code);
+      if (tmp_error != metrics::DownloadErrorCode::kInputMalformed) {
+        result = metrics::CheckResult::kDownloadError;
+        download_error_code = tmp_error;
+      } else {
+        result = metrics::CheckResult::kParsingError;
+      }
+      break;
   }
 
   system_state_->metrics_reporter()->ReportUpdateCheckMetrics(
diff --git a/omaha_request_action.h b/omaha_request_action.h
index c083abe..8db5fb9 100644
--- a/omaha_request_action.h
+++ b/omaha_request_action.h
@@ -88,9 +88,7 @@
         result(kResultSuccess),
         error_code(ErrorCode::kSuccess) {}
   OmahaEvent(Type in_type, Result in_result, ErrorCode in_error_code)
-      : type(in_type),
-        result(in_result),
-        error_code(in_error_code) {}
+      : type(in_type), result(in_result), error_code(in_error_code) {}
 
   Type type;
   Result result;
@@ -105,7 +103,7 @@
 // This struct is declared in the .cc file.
 struct OmahaParserData;
 
-template<>
+template <>
 class ActionTraits<OmahaRequestAction> {
  public:
   // Takes parameters on the input pipe.
@@ -175,7 +173,7 @@
                      const void* bytes,
                      size_t length) override;
 
-  void TransferComplete(HttpFetcher *fetcher, bool successful) override;
+  void TransferComplete(HttpFetcher* fetcher, bool successful) override;
 
   // Returns true if this is an Event request, false if it's an UpdateCheck.
   bool IsEvent() const { return event_.get() != nullptr; }
@@ -215,12 +213,12 @@
 
   // Returns True if the kPrefsInstallDateDays state variable is set,
   // False otherwise.
-  static bool HasInstallDate(SystemState *system_state);
+  static bool HasInstallDate(SystemState* system_state);
 
   // Writes |install_date_days| into the kPrefsInstallDateDays state
   // variable and emits an UMA stat for the |source| used. Returns
   // True if the value was written, False if an error occurred.
-  static bool PersistInstallDate(SystemState *system_state,
+  static bool PersistInstallDate(SystemState* system_state,
                                  int install_date_days,
                                  InstallDateProvisioningSource source);
 
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index 9a5cd10..1786bcc 100644
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -58,6 +58,7 @@
 using chromeos_update_manager::kRollforwardInfinity;
 using std::string;
 using std::vector;
+using testing::_;
 using testing::AllOf;
 using testing::AnyNumber;
 using testing::DoAll;
@@ -65,11 +66,10 @@
 using testing::Le;
 using testing::NiceMock;
 using testing::Return;
-using testing::ReturnRef;
 using testing::ReturnPointee;
+using testing::ReturnRef;
 using testing::SaveArg;
 using testing::SetArgPointee;
-using testing::_;
 
 namespace {
 
@@ -188,9 +188,7 @@
   }
 
   // Return the payload URL, which is split in two fields in the XML response.
-  string GetPayloadUrl() {
-    return codebase + filename;
-  }
+  string GetPayloadUrl() { return codebase + filename; }
 
   string app_id = kTestAppId;
   string app_id2 = kTestAppId2;
@@ -376,21 +374,20 @@
   void PingTest(bool ping_only);
 
   // InstallDate test helper function.
-  bool InstallDateParseHelper(const string &elapsed_days,
-                              OmahaResponse *response);
+  bool InstallDateParseHelper(const string& elapsed_days,
+                              OmahaResponse* response);
 
   // P2P test helper function.
-  void P2PTest(
-      bool initial_allow_p2p_for_downloading,
-      bool initial_allow_p2p_for_sharing,
-      bool omaha_disable_p2p_for_downloading,
-      bool omaha_disable_p2p_for_sharing,
-      bool payload_state_allow_p2p_attempt,
-      bool expect_p2p_client_lookup,
-      const string& p2p_client_result_url,
-      bool expected_allow_p2p_for_downloading,
-      bool expected_allow_p2p_for_sharing,
-      const string& expected_p2p_url);
+  void P2PTest(bool initial_allow_p2p_for_downloading,
+               bool initial_allow_p2p_for_sharing,
+               bool omaha_disable_p2p_for_downloading,
+               bool omaha_disable_p2p_for_sharing,
+               bool payload_state_allow_p2p_attempt,
+               bool expect_p2p_client_lookup,
+               const string& p2p_client_result_url,
+               bool expected_allow_p2p_for_downloading,
+               bool expected_allow_p2p_for_sharing,
+               const string& expected_p2p_url);
 
   FakeSystemState fake_system_state_;
   FakeUpdateResponse fake_update_response_;
@@ -878,10 +875,9 @@
   fake_system_state_.set_connection_manager(&mock_cm);
 
   EXPECT_CALL(mock_cm, GetConnectionProperties(_, _))
-      .WillRepeatedly(
-          DoAll(SetArgPointee<0>(ConnectionType::kEthernet),
-                SetArgPointee<1>(ConnectionTethering::kUnknown),
-                Return(true)));
+      .WillRepeatedly(DoAll(SetArgPointee<0>(ConnectionType::kEthernet),
+                            SetArgPointee<1>(ConnectionTethering::kUnknown),
+                            Return(true)));
   EXPECT_CALL(mock_cm, IsUpdateAllowedOver(ConnectionType::kEthernet, _))
       .WillRepeatedly(Return(false));
 
@@ -1069,7 +1065,7 @@
   fake_system_state_.set_payload_state(&mock_payload_state);
 
   EXPECT_CALL(mock_payload_state, GetRollbackVersion())
-    .WillRepeatedly(Return(rollback_version));
+      .WillRepeatedly(Return(rollback_version));
 
   fake_update_response_.version = rollback_version;
   ASSERT_FALSE(TestUpdateCheck(fake_update_response_.GetUpdateResponse(),
@@ -1269,7 +1265,6 @@
   EXPECT_TRUE(response.update_exists);
 }
 
-
 TEST_F(OmahaRequestActionTest, ZeroUpdateCheckCountCausesNoScattering) {
   OmahaResponse response;
   request_params_.set_wall_clock_based_wait_enabled(true);
@@ -1280,16 +1275,15 @@
 
   fake_system_state_.fake_clock()->SetWallclockTime(Time::Now());
 
-  ASSERT_TRUE(TestUpdateCheck(
-                      fake_update_response_.GetUpdateResponse(),
-                      -1,
-                      false,  // ping_only
-                      ErrorCode::kSuccess,
-                      metrics::CheckResult::kUpdateAvailable,
-                      metrics::CheckReaction::kUpdating,
-                      metrics::DownloadErrorCode::kUnset,
-                      &response,
-                      nullptr));
+  ASSERT_TRUE(TestUpdateCheck(fake_update_response_.GetUpdateResponse(),
+                              -1,
+                              false,  // ping_only
+                              ErrorCode::kSuccess,
+                              metrics::CheckResult::kUpdateAvailable,
+                              metrics::CheckReaction::kUpdating,
+                              metrics::DownloadErrorCode::kUnset,
+                              &response,
+                              nullptr));
 
   int64_t count;
   ASSERT_TRUE(fake_prefs_.GetInt64(kPrefsUpdateCheckCount, &count));
@@ -1307,16 +1301,15 @@
 
   fake_system_state_.fake_clock()->SetWallclockTime(Time::Now());
 
-  ASSERT_FALSE(TestUpdateCheck(
-                      fake_update_response_.GetUpdateResponse(),
-                      -1,
-                      false,  // ping_only
-                      ErrorCode::kOmahaUpdateDeferredPerPolicy,
-                      metrics::CheckResult::kUpdateAvailable,
-                      metrics::CheckReaction::kDeferring,
-                      metrics::DownloadErrorCode::kUnset,
-                      &response,
-                      nullptr));
+  ASSERT_FALSE(TestUpdateCheck(fake_update_response_.GetUpdateResponse(),
+                               -1,
+                               false,  // ping_only
+                               ErrorCode::kOmahaUpdateDeferredPerPolicy,
+                               metrics::CheckResult::kUpdateAvailable,
+                               metrics::CheckReaction::kDeferring,
+                               metrics::DownloadErrorCode::kUnset,
+                               &response,
+                               nullptr));
 
   int64_t count;
   ASSERT_TRUE(fake_prefs_.GetInt64(kPrefsUpdateCheckCount, &count));
@@ -1349,16 +1342,15 @@
 
   ASSERT_TRUE(fake_prefs_.SetInt64(kPrefsUpdateCheckCount, 5));
 
-  ASSERT_FALSE(TestUpdateCheck(
-                      fake_update_response_.GetUpdateResponse(),
-                      -1,
-                      false,  // ping_only
-                      ErrorCode::kOmahaUpdateDeferredPerPolicy,
-                      metrics::CheckResult::kUpdateAvailable,
-                      metrics::CheckReaction::kDeferring,
-                      metrics::DownloadErrorCode::kUnset,
-                      &response,
-                      nullptr));
+  ASSERT_FALSE(TestUpdateCheck(fake_update_response_.GetUpdateResponse(),
+                               -1,
+                               false,  // ping_only
+                               ErrorCode::kOmahaUpdateDeferredPerPolicy,
+                               metrics::CheckResult::kUpdateAvailable,
+                               metrics::CheckReaction::kDeferring,
+                               metrics::DownloadErrorCode::kUnset,
+                               &response,
+                               nullptr));
 
   int64_t count;
   ASSERT_TRUE(fake_prefs_.GetInt64(kPrefsUpdateCheckCount, &count));
@@ -1774,9 +1766,9 @@
   request_params_.set_hwid("<OEM MODEL>");
   fake_prefs_.SetString(kPrefsOmahaCohort, "evil\nstring");
   fake_prefs_.SetString(kPrefsOmahaCohortHint, "evil&string\\");
-  fake_prefs_.SetString(kPrefsOmahaCohortName,
-                        base::JoinString(
-                            vector<string>(100, "My spoon is too big."), " "));
+  fake_prefs_.SetString(
+      kPrefsOmahaCohortName,
+      base::JoinString(vector<string>(100, "My spoon is too big."), " "));
   OmahaResponse response;
   ASSERT_FALSE(TestUpdateCheck("invalid xml>",
                                -1,
@@ -1870,15 +1862,12 @@
       string::npos);
   EXPECT_NE(post_str.find("hardware_class=\"OEM MODEL 09235 7471\""),
             string::npos);
-  EXPECT_NE(post_str.find("fw_version=\"ChromeOSFirmware.1.0\""),
-            string::npos);
-  EXPECT_NE(post_str.find("ec_version=\"0X0A1\""),
-            string::npos);
+  EXPECT_NE(post_str.find("fw_version=\"ChromeOSFirmware.1.0\""), string::npos);
+  EXPECT_NE(post_str.find("ec_version=\"0X0A1\""), string::npos);
   // No <event> tag should be sent if we didn't reboot to an update.
   EXPECT_EQ(post_str.find("<event"), string::npos);
 }
 
-
 TEST_F(OmahaRequestActionTest, FormatSuccessEventOutputTest) {
   brillo::Blob post_data;
   TestEvent(new OmahaEvent(OmahaEvent::kTypeUpdateDownloadStarted),
@@ -1919,18 +1908,16 @@
   OmahaRequestAction update_check_action(
       &fake_system_state_,
       nullptr,
-      std::make_unique<MockHttpFetcher>(http_response.data(),
-                                        http_response.size(),
-                                        nullptr),
+      std::make_unique<MockHttpFetcher>(
+          http_response.data(), http_response.size(), nullptr),
       false);
   EXPECT_FALSE(update_check_action.IsEvent());
 
   OmahaRequestAction event_action(
       &fake_system_state_,
       new OmahaEvent(OmahaEvent::kTypeUpdateComplete),
-      std::make_unique<MockHttpFetcher>(http_response.data(),
-                                        http_response.size(),
-                                        nullptr),
+      std::make_unique<MockHttpFetcher>(
+          http_response.data(), http_response.size(), nullptr),
       false);
   EXPECT_TRUE(event_action.IsEvent());
 }
@@ -1954,9 +1941,9 @@
                                  &post_data));
     // convert post_data to string
     string post_str(post_data.begin(), post_data.end());
-    EXPECT_NE(post_str.find(base::StringPrintf(" delta_okay=\"%s\"",
-                                               delta_okay_str)),
-              string::npos)
+    EXPECT_NE(
+        post_str.find(base::StringPrintf(" delta_okay=\"%s\"", delta_okay_str)),
+        string::npos)
         << "i = " << i;
   }
 }
@@ -2073,7 +2060,7 @@
   NiceMock<MockPrefs> prefs;
   fake_system_state_.set_prefs(&prefs);
   EXPECT_CALL(prefs, GetInt64(kPrefsMetricsCheckLastReportingTime, _))
-    .Times(AnyNumber());
+      .Times(AnyNumber());
   EXPECT_CALL(prefs, SetInt64(_, _)).Times(AnyNumber());
   // Add a few hours to the day difference to test no rounding, etc.
   int64_t five_days_ago =
@@ -2109,18 +2096,18 @@
 }
 
 TEST_F(OmahaRequestActionTest, PingTestSendOnlyAPing) {
-  PingTest(true  /* ping_only */);
+  PingTest(true /* ping_only */);
 }
 
 TEST_F(OmahaRequestActionTest, PingTestSendAlsoAnUpdateCheck) {
-  PingTest(false  /* ping_only */);
+  PingTest(false /* ping_only */);
 }
 
 TEST_F(OmahaRequestActionTest, ActivePingTest) {
   NiceMock<MockPrefs> prefs;
   fake_system_state_.set_prefs(&prefs);
   EXPECT_CALL(prefs, GetInt64(kPrefsMetricsCheckLastReportingTime, _))
-    .Times(AnyNumber());
+      .Times(AnyNumber());
   EXPECT_CALL(prefs, SetInt64(_, _)).Times(AnyNumber());
   int64_t three_days_ago =
       (Time::Now() - TimeDelta::FromHours(3 * 24 + 12)).ToInternalValue();
@@ -2142,15 +2129,14 @@
                               nullptr,
                               &post_data));
   string post_str(post_data.begin(), post_data.end());
-  EXPECT_NE(post_str.find("<ping active=\"1\" a=\"3\"></ping>"),
-            string::npos);
+  EXPECT_NE(post_str.find("<ping active=\"1\" a=\"3\"></ping>"), string::npos);
 }
 
 TEST_F(OmahaRequestActionTest, RollCallPingTest) {
   NiceMock<MockPrefs> prefs;
   fake_system_state_.set_prefs(&prefs);
   EXPECT_CALL(prefs, GetInt64(kPrefsMetricsCheckLastReportingTime, _))
-    .Times(AnyNumber());
+      .Times(AnyNumber());
   EXPECT_CALL(prefs, SetInt64(_, _)).Times(AnyNumber());
   int64_t four_days_ago =
       (Time::Now() - TimeDelta::FromHours(4 * 24)).ToInternalValue();
@@ -2180,7 +2166,7 @@
   NiceMock<MockPrefs> prefs;
   fake_system_state_.set_prefs(&prefs);
   EXPECT_CALL(prefs, GetInt64(kPrefsMetricsCheckLastReportingTime, _))
-    .Times(AnyNumber());
+      .Times(AnyNumber());
   EXPECT_CALL(prefs, SetInt64(_, _)).Times(AnyNumber());
   int64_t one_hour_ago =
       (Time::Now() - TimeDelta::FromHours(1)).ToInternalValue();
@@ -2238,7 +2224,7 @@
   NiceMock<MockPrefs> prefs;
   fake_system_state_.set_prefs(&prefs);
   EXPECT_CALL(prefs, GetInt64(kPrefsMetricsCheckLastReportingTime, _))
-    .Times(AnyNumber());
+      .Times(AnyNumber());
   EXPECT_CALL(prefs, SetInt64(_, _)).Times(AnyNumber());
   int64_t future =
       (Time::Now() + TimeDelta::FromHours(3 * 24 + 4)).ToInternalValue();
@@ -2283,11 +2269,13 @@
   fake_system_state_.set_prefs(&prefs);
   EXPECT_CALL(prefs, GetInt64(_, _)).Times(AnyNumber());
   EXPECT_CALL(prefs, SetInt64(_, _)).Times(AnyNumber());
-  EXPECT_CALL(prefs, SetInt64(kPrefsLastActivePingDay,
-                              AllOf(Ge(midnight), Le(midnight_slack))))
+  EXPECT_CALL(prefs,
+              SetInt64(kPrefsLastActivePingDay,
+                       AllOf(Ge(midnight), Le(midnight_slack))))
       .WillOnce(Return(true));
-  EXPECT_CALL(prefs, SetInt64(kPrefsLastRollCallPingDay,
-                              AllOf(Ge(midnight), Le(midnight_slack))))
+  EXPECT_CALL(prefs,
+              SetInt64(kPrefsLastRollCallPingDay,
+                       AllOf(Ge(midnight), Le(midnight_slack))))
       .WillOnce(Return(true));
   ASSERT_TRUE(
       TestUpdateCheck("<?xml version=\"1.0\" encoding=\"UTF-8\"?><response "
@@ -2516,10 +2504,11 @@
                                &post_data));
   // convert post_data to string
   string post_str(post_data.begin(), post_data.end());
-  EXPECT_NE(string::npos, post_str.find(
-      "appid=\"{22222222-2222-2222-2222-222222222222}\" "
-      "version=\"0.0.0.0\" from_version=\"1.2.3.4\" "
-      "track=\"stable-channel\" from_track=\"canary-channel\" "));
+  EXPECT_NE(
+      string::npos,
+      post_str.find("appid=\"{22222222-2222-2222-2222-222222222222}\" "
+                    "version=\"0.0.0.0\" from_version=\"1.2.3.4\" "
+                    "track=\"stable-channel\" from_track=\"canary-channel\" "));
   EXPECT_EQ(string::npos, post_str.find("o.bundle"));
 }
 
@@ -2549,10 +2538,11 @@
                                &post_data));
   // Convert post_data to string.
   string post_str(post_data.begin(), post_data.end());
-  EXPECT_NE(string::npos, post_str.find(
-      "appid=\"{11111111-1111-1111-1111-111111111111}\" "
-      "version=\"5.6.7.8\" "
-      "track=\"canary-channel\" from_track=\"stable-channel\""));
+  EXPECT_NE(
+      string::npos,
+      post_str.find("appid=\"{11111111-1111-1111-1111-111111111111}\" "
+                    "version=\"5.6.7.8\" "
+                    "track=\"canary-channel\" from_track=\"stable-channel\""));
   EXPECT_EQ(string::npos, post_str.find("from_version"));
   EXPECT_NE(string::npos, post_str.find("o.bundle.version=\"1\""));
 }
@@ -2625,10 +2615,10 @@
   string post_str(post_data.begin(), post_data.end());
 
   // An event 54 is included and has the right version.
-  EXPECT_NE(string::npos,
-            post_str.find(base::StringPrintf(
-                              "<event eventtype=\"%d\"",
-                              OmahaEvent::kTypeRebootedAfterUpdate)));
+  EXPECT_NE(
+      string::npos,
+      post_str.find(base::StringPrintf("<event eventtype=\"%d\"",
+                                       OmahaEvent::kTypeRebootedAfterUpdate)));
   EXPECT_NE(string::npos,
             post_str.find("previousversion=\"1.2.3.4\"></event>"));
 
@@ -2639,17 +2629,16 @@
   EXPECT_TRUE(prev_version.empty());
 }
 
-void OmahaRequestActionTest::P2PTest(
-    bool initial_allow_p2p_for_downloading,
-    bool initial_allow_p2p_for_sharing,
-    bool omaha_disable_p2p_for_downloading,
-    bool omaha_disable_p2p_for_sharing,
-    bool payload_state_allow_p2p_attempt,
-    bool expect_p2p_client_lookup,
-    const string& p2p_client_result_url,
-    bool expected_allow_p2p_for_downloading,
-    bool expected_allow_p2p_for_sharing,
-    const string& expected_p2p_url) {
+void OmahaRequestActionTest::P2PTest(bool initial_allow_p2p_for_downloading,
+                                     bool initial_allow_p2p_for_sharing,
+                                     bool omaha_disable_p2p_for_downloading,
+                                     bool omaha_disable_p2p_for_sharing,
+                                     bool payload_state_allow_p2p_attempt,
+                                     bool expect_p2p_client_lookup,
+                                     const string& p2p_client_result_url,
+                                     bool expected_allow_p2p_for_downloading,
+                                     bool expected_allow_p2p_for_sharing,
+                                     const string& expected_p2p_url) {
   OmahaResponse response;
   bool actual_allow_p2p_for_downloading = initial_allow_p2p_for_downloading;
   bool actual_allow_p2p_for_sharing = initial_allow_p2p_for_sharing;
@@ -2694,8 +2683,7 @@
 
   EXPECT_EQ(omaha_disable_p2p_for_downloading,
             response.disable_p2p_for_downloading);
-  EXPECT_EQ(omaha_disable_p2p_for_sharing,
-            response.disable_p2p_for_sharing);
+  EXPECT_EQ(omaha_disable_p2p_for_sharing, response.disable_p2p_for_sharing);
 
   EXPECT_EQ(expected_allow_p2p_for_downloading,
             actual_allow_p2p_for_downloading);
@@ -2717,42 +2705,42 @@
 }
 
 TEST_F(OmahaRequestActionTest, P2PWithoutPeer) {
-  P2PTest(true,                   // initial_allow_p2p_for_downloading
-          true,                   // initial_allow_p2p_for_sharing
-          false,                  // omaha_disable_p2p_for_downloading
-          false,                  // omaha_disable_p2p_for_sharing
-          true,                   // payload_state_allow_p2p_attempt
-          true,                   // expect_p2p_client_lookup
-          "",                     // p2p_client_result_url
-          false,                  // expected_allow_p2p_for_downloading
-          true,                   // expected_allow_p2p_for_sharing
-          "");                    // expected_p2p_url
+  P2PTest(true,   // initial_allow_p2p_for_downloading
+          true,   // initial_allow_p2p_for_sharing
+          false,  // omaha_disable_p2p_for_downloading
+          false,  // omaha_disable_p2p_for_sharing
+          true,   // payload_state_allow_p2p_attempt
+          true,   // expect_p2p_client_lookup
+          "",     // p2p_client_result_url
+          false,  // expected_allow_p2p_for_downloading
+          true,   // expected_allow_p2p_for_sharing
+          "");    // expected_p2p_url
 }
 
 TEST_F(OmahaRequestActionTest, P2PDownloadNotAllowed) {
-  P2PTest(false,                  // initial_allow_p2p_for_downloading
-          true,                   // initial_allow_p2p_for_sharing
-          false,                  // omaha_disable_p2p_for_downloading
-          false,                  // omaha_disable_p2p_for_sharing
-          true,                   // payload_state_allow_p2p_attempt
-          false,                  // expect_p2p_client_lookup
-          "unset",                // p2p_client_result_url
-          false,                  // expected_allow_p2p_for_downloading
-          true,                   // expected_allow_p2p_for_sharing
-          "");                    // expected_p2p_url
+  P2PTest(false,    // initial_allow_p2p_for_downloading
+          true,     // initial_allow_p2p_for_sharing
+          false,    // omaha_disable_p2p_for_downloading
+          false,    // omaha_disable_p2p_for_sharing
+          true,     // payload_state_allow_p2p_attempt
+          false,    // expect_p2p_client_lookup
+          "unset",  // p2p_client_result_url
+          false,    // expected_allow_p2p_for_downloading
+          true,     // expected_allow_p2p_for_sharing
+          "");      // expected_p2p_url
 }
 
 TEST_F(OmahaRequestActionTest, P2PWithPeerDownloadDisabledByOmaha) {
-  P2PTest(true,                   // initial_allow_p2p_for_downloading
-          true,                   // initial_allow_p2p_for_sharing
-          true,                   // omaha_disable_p2p_for_downloading
-          false,                  // omaha_disable_p2p_for_sharing
-          true,                   // payload_state_allow_p2p_attempt
-          false,                  // expect_p2p_client_lookup
-          "unset",                // p2p_client_result_url
-          false,                  // expected_allow_p2p_for_downloading
-          true,                   // expected_allow_p2p_for_sharing
-          "");                    // expected_p2p_url
+  P2PTest(true,     // initial_allow_p2p_for_downloading
+          true,     // initial_allow_p2p_for_sharing
+          true,     // omaha_disable_p2p_for_downloading
+          false,    // omaha_disable_p2p_for_sharing
+          true,     // payload_state_allow_p2p_attempt
+          false,    // expect_p2p_client_lookup
+          "unset",  // p2p_client_result_url
+          false,    // expected_allow_p2p_for_downloading
+          true,     // expected_allow_p2p_for_sharing
+          "");      // expected_p2p_url
 }
 
 TEST_F(OmahaRequestActionTest, P2PWithPeerSharingDisabledByOmaha) {
@@ -2769,20 +2757,20 @@
 }
 
 TEST_F(OmahaRequestActionTest, P2PWithPeerBothDisabledByOmaha) {
-  P2PTest(true,                   // initial_allow_p2p_for_downloading
-          true,                   // initial_allow_p2p_for_sharing
-          true,                   // omaha_disable_p2p_for_downloading
-          true,                   // omaha_disable_p2p_for_sharing
-          true,                   // payload_state_allow_p2p_attempt
-          false,                  // expect_p2p_client_lookup
-          "unset",                // p2p_client_result_url
-          false,                  // expected_allow_p2p_for_downloading
-          false,                  // expected_allow_p2p_for_sharing
-          "");                    // expected_p2p_url
+  P2PTest(true,     // initial_allow_p2p_for_downloading
+          true,     // initial_allow_p2p_for_sharing
+          true,     // omaha_disable_p2p_for_downloading
+          true,     // omaha_disable_p2p_for_sharing
+          true,     // payload_state_allow_p2p_attempt
+          false,    // expect_p2p_client_lookup
+          "unset",  // p2p_client_result_url
+          false,    // expected_allow_p2p_for_downloading
+          false,    // expected_allow_p2p_for_sharing
+          "");      // expected_p2p_url
 }
 
-bool OmahaRequestActionTest::InstallDateParseHelper(const string &elapsed_days,
-                                                    OmahaResponse *response) {
+bool OmahaRequestActionTest::InstallDateParseHelper(const string& elapsed_days,
+                                                    OmahaResponse* response) {
   fake_update_response_.elapsed_days = elapsed_days;
   return TestUpdateCheck(fake_update_response_.GetUpdateResponse(),
                          -1,
diff --git a/omaha_request_params.cc b/omaha_request_params.cc
index c458424..8c410f1 100644
--- a/omaha_request_params.cc
+++ b/omaha_request_params.cc
@@ -101,8 +101,8 @@
     // know (i.e. stat() returns some unexpected error), then err on the side of
     // caution and say deltas are not okay.
     struct stat stbuf;
-    delta_okay_ = (stat((root_ + "/.nodelta").c_str(), &stbuf) < 0) &&
-                  (errno == ENOENT);
+    delta_okay_ =
+        (stat((root_ + "/.nodelta").c_str(), &stbuf) < 0) && (errno == ENOENT);
   } else {
     LOG(INFO) << "Disabling deltas as a channel change to "
               << mutable_image_props_.target_channel
diff --git a/omaha_request_params.h b/omaha_request_params.h
index 1bfa471..18235c0 100644
--- a/omaha_request_params.h
+++ b/omaha_request_params.h
@@ -306,11 +306,11 @@
   //   changed and cancel the current download attempt.
   std::string download_channel_;
 
-  std::string hwid_;  // Hardware Qualification ID of the client
+  std::string hwid_;        // Hardware Qualification ID of the client
   std::string fw_version_;  // Chrome OS Firmware Version.
   std::string ec_version_;  // Chrome OS EC Version.
-  bool delta_okay_;  // If this client can accept a delta
-  bool interactive_;   // Whether this is a user-initiated update check
+  bool delta_okay_;         // If this client can accept a delta
+  bool interactive_;        // Whether this is a user-initiated update check
 
   // The URL to send the Omaha request to.
   std::string update_url_;
diff --git a/omaha_response_handler_action.h b/omaha_response_handler_action.h
index 344fc1d..d2e6db8 100644
--- a/omaha_response_handler_action.h
+++ b/omaha_response_handler_action.h
@@ -33,7 +33,7 @@
 
 class OmahaResponseHandlerAction;
 
-template<>
+template <>
 class ActionTraits<OmahaResponseHandlerAction> {
  public:
   typedef OmahaResponse InputObjectType;
diff --git a/omaha_response_handler_action_unittest.cc b/omaha_response_handler_action_unittest.cc
index b128b27..b47040b 100644
--- a/omaha_response_handler_action_unittest.cc
+++ b/omaha_response_handler_action_unittest.cc
@@ -80,14 +80,10 @@
  protected:
   void SetUp() override {
     FakeBootControl* fake_boot_control = fake_system_state_.fake_boot_control();
-    fake_boot_control->SetPartitionDevice(
-        kPartitionNameKernel, 0, "/dev/sdz2");
-    fake_boot_control->SetPartitionDevice(
-        kPartitionNameRoot, 0, "/dev/sdz3");
-    fake_boot_control->SetPartitionDevice(
-        kPartitionNameKernel, 1, "/dev/sdz4");
-    fake_boot_control->SetPartitionDevice(
-        kPartitionNameRoot, 1, "/dev/sdz5");
+    fake_boot_control->SetPartitionDevice(kPartitionNameKernel, 0, "/dev/sdz2");
+    fake_boot_control->SetPartitionDevice(kPartitionNameRoot, 0, "/dev/sdz3");
+    fake_boot_control->SetPartitionDevice(kPartitionNameKernel, 1, "/dev/sdz4");
+    fake_boot_control->SetPartitionDevice(kPartitionNameRoot, 1, "/dev/sdz5");
   }
 
   // Return true iff the OmahaResponseHandlerAction succeeded.
diff --git a/p2p_manager.cc b/p2p_manager.cc
index 1ee124d..6720908 100644
--- a/p2p_manager.cc
+++ b/p2p_manager.cc
@@ -89,9 +89,7 @@
  public:
   ConfigurationImpl() {}
 
-  FilePath GetP2PDir() override {
-    return FilePath(kDefaultP2PDir);
-  }
+  FilePath GetP2PDir() override { return FilePath(kDefaultP2PDir); }
 
   vector<string> GetInitctlArgs(bool is_start) override {
     vector<string> args;
@@ -101,7 +99,7 @@
     return args;
   }
 
-  vector<string> GetP2PClientArgs(const string &file_id,
+  vector<string> GetP2PClientArgs(const string& file_id,
                                   size_t minimum_size) override {
     vector<string> args;
     args.push_back("p2p-client");
@@ -117,8 +115,8 @@
 // The default P2PManager implementation.
 class P2PManagerImpl : public P2PManager {
  public:
-  P2PManagerImpl(Configuration *configuration,
-                 ClockInterface *clock,
+  P2PManagerImpl(Configuration* configuration,
+                 ClockInterface* clock,
                  UpdateManager* update_manager,
                  const string& file_extension,
                  const int num_files_to_keep,
@@ -134,22 +132,17 @@
                         size_t minimum_size,
                         TimeDelta max_time_to_wait,
                         LookupCallback callback) override;
-  bool FileShare(const string& file_id,
-                 size_t expected_size) override;
+  bool FileShare(const string& file_id, size_t expected_size) override;
   FilePath FileGetPath(const string& file_id) override;
   ssize_t FileGetSize(const string& file_id) override;
   ssize_t FileGetExpectedSize(const string& file_id) override;
-  bool FileGetVisible(const string& file_id,
-                      bool *out_result) override;
+  bool FileGetVisible(const string& file_id, bool* out_result) override;
   bool FileMakeVisible(const string& file_id) override;
   int CountSharedFiles() override;
 
  private:
   // Enumeration for specifying visibility.
-  enum Visibility {
-    kVisible,
-    kNonVisible
-  };
+  enum Visibility { kVisible, kNonVisible };
 
   // Returns "." + |file_extension_| + ".p2p" if |visibility| is
   // |kVisible|. Returns the same concatenated with ".tmp" otherwise.
@@ -218,19 +211,19 @@
 
 const char P2PManagerImpl::kTmpExtension[] = ".tmp";
 
-P2PManagerImpl::P2PManagerImpl(Configuration *configuration,
-                               ClockInterface *clock,
+P2PManagerImpl::P2PManagerImpl(Configuration* configuration,
+                               ClockInterface* clock,
                                UpdateManager* update_manager,
                                const string& file_extension,
                                const int num_files_to_keep,
                                const TimeDelta& max_file_age)
-  : clock_(clock),
-    update_manager_(update_manager),
-    file_extension_(file_extension),
-    num_files_to_keep_(num_files_to_keep),
-    max_file_age_(max_file_age) {
-  configuration_.reset(configuration != nullptr ? configuration :
-                       new ConfigurationImpl());
+    : clock_(clock),
+      update_manager_(update_manager),
+      file_extension_(file_extension),
+      num_files_to_keep_(num_files_to_keep),
+      max_file_age_(max_file_age) {
+  configuration_.reset(configuration != nullptr ? configuration
+                                                : new ConfigurationImpl());
 }
 
 void P2PManagerImpl::SetDevicePolicy(
@@ -272,9 +265,9 @@
   // running" or "stop if running".
   // TODO(zeuthen,chromium:277051): Avoid doing this.
   if (return_code != 0) {
-    const char *expected_error_message = should_be_running ?
-      "initctl: Job is already running: p2p\n" :
-      "initctl: Unknown instance \n";
+    const char* expected_error_message =
+        should_be_running ? "initctl: Job is already running: p2p\n"
+                          : "initctl: Unknown instance \n";
     if (output != expected_error_message)
       return false;
   }
@@ -303,13 +296,13 @@
 string P2PManagerImpl::GetExt(Visibility visibility) {
   string ext = string(".") + file_extension_ + kP2PExtension;
   switch (visibility) {
-  case kVisible:
-    break;
-  case kNonVisible:
-    ext += kTmpExtension;
-    break;
-  // Don't add a default case to let the compiler warn about newly
-  // added enum values.
+    case kVisible:
+      break;
+    case kNonVisible:
+      ext += kTmpExtension;
+      break;
+      // Don't add a default case to let the compiler warn about newly
+      // added enum values.
   }
   return ext;
 }
@@ -318,10 +311,9 @@
   return configuration_->GetP2PDir().Append(file_id + GetExt(visibility));
 }
 
-bool P2PManagerImpl::DeleteP2PFile(const FilePath& path,
-                                   const string& reason) {
-  LOG(INFO) << "Deleting p2p file " << path.value()
-            << " (reason: " << reason << ")";
+bool P2PManagerImpl::DeleteP2PFile(const FilePath& path, const string& reason) {
+  LOG(INFO) << "Deleting p2p file " << path.value() << " (reason: " << reason
+            << ")";
   if (unlink(path.value().c_str()) != 0) {
     PLOG(ERROR) << "Error deleting p2p file " << path.value();
     return false;
@@ -329,7 +321,6 @@
   return true;
 }
 
-
 bool P2PManagerImpl::PerformHousekeeping() {
   // Open p2p dir.
   FilePath p2p_dir = configuration_->GetP2PDir();
@@ -342,10 +333,10 @@
   base::FileEnumerator dir(p2p_dir, false, base::FileEnumerator::FILES);
   // Go through all files and collect their mtime.
   for (FilePath name = dir.Next(); !name.empty(); name = dir.Next()) {
-    if (!(base::EndsWith(name.value(), ext_visible,
-                         base::CompareCase::SENSITIVE) ||
-          base::EndsWith(name.value(), ext_non_visible,
-                         base::CompareCase::SENSITIVE))) {
+    if (!(base::EndsWith(
+              name.value(), ext_visible, base::CompareCase::SENSITIVE) ||
+          base::EndsWith(
+              name.value(), ext_non_visible, base::CompareCase::SENSITIVE))) {
       continue;
     }
 
@@ -382,7 +373,7 @@
 class LookupData {
  public:
   explicit LookupData(P2PManager::LookupCallback callback)
-    : callback_(callback) {}
+      : callback_(callback) {}
 
   ~LookupData() {
     if (timeout_task_ != MessageLoop::kTaskIdNull)
@@ -399,7 +390,9 @@
 
     // We expect to run just "p2p-client" and find it in the path.
     child_pid_ = Subprocess::Get().ExecFlags(
-        cmd, Subprocess::kSearchPath, {},
+        cmd,
+        Subprocess::kSearchPath,
+        {},
         Bind(&LookupData::OnLookupDone, base::Unretained(this)));
 
     if (!child_pid_) {
@@ -418,9 +411,10 @@
 
  private:
   void ReportErrorAndDeleteInIdle() {
-    MessageLoop::current()->PostTask(FROM_HERE, Bind(
-        &LookupData::OnIdleForReportErrorAndDelete,
-        base::Unretained(this)));
+    MessageLoop::current()->PostTask(
+        FROM_HERE,
+        Bind(&LookupData::OnIdleForReportErrorAndDelete,
+             base::Unretained(this)));
   }
 
   void OnIdleForReportErrorAndDelete() {
@@ -463,8 +457,7 @@
   void OnLookupDone(int return_code, const string& output) {
     child_pid_ = 0;
     if (return_code != 0) {
-      LOG(INFO) << "Child exited with non-zero exit code "
-                << return_code;
+      LOG(INFO) << "Child exited with non-zero exit code " << return_code;
       ReportError();
     } else {
       ReportSuccess(output);
@@ -494,15 +487,14 @@
                                       size_t minimum_size,
                                       TimeDelta max_time_to_wait,
                                       LookupCallback callback) {
-  LookupData *lookup_data = new LookupData(callback);
+  LookupData* lookup_data = new LookupData(callback);
   string file_id_with_ext = file_id + "." + file_extension_;
-  vector<string> args = configuration_->GetP2PClientArgs(file_id_with_ext,
-                                                         minimum_size);
+  vector<string> args =
+      configuration_->GetP2PClientArgs(file_id_with_ext, minimum_size);
   lookup_data->InitiateLookup(args, max_time_to_wait);
 }
 
-bool P2PManagerImpl::FileShare(const string& file_id,
-                               size_t expected_size) {
+bool P2PManagerImpl::FileShare(const string& file_id, size_t expected_size) {
   // Check if file already exist.
   FilePath path = FileGetPath(file_id);
   if (!path.empty()) {
@@ -563,8 +555,8 @@
       } else {
         // ENOSPC can happen (funky race though, cf. the statvfs() check
         // above), handle it gracefully, e.g. use logging level INFO.
-        PLOG(INFO) << "Error allocating " << expected_size
-                   << " bytes for file " << path.value();
+        PLOG(INFO) << "Error allocating " << expected_size << " bytes for file "
+                   << path.value();
         if (unlink(path.value().c_str()) != 0) {
           PLOG(ERROR) << "Error deleting file with path " << path.value();
         }
@@ -573,8 +565,11 @@
     }
 
     string decimal_size = std::to_string(expected_size);
-    if (fsetxattr(fd, kCrosP2PFileSizeXAttrName,
-                  decimal_size.c_str(), decimal_size.size(), 0) != 0) {
+    if (fsetxattr(fd,
+                  kCrosP2PFileSizeXAttrName,
+                  decimal_size.c_str(),
+                  decimal_size.size(),
+                  0) != 0) {
       PLOG(ERROR) << "Error setting xattr " << path.value();
       return false;
     }
@@ -601,8 +596,7 @@
   return path;
 }
 
-bool P2PManagerImpl::FileGetVisible(const string& file_id,
-                                    bool *out_result) {
+bool P2PManagerImpl::FileGetVisible(const string& file_id, bool* out_result) {
   FilePath path = FileGetPath(file_id);
   if (path.empty()) {
     LOG(ERROR) << "No file for id " << file_id;
@@ -628,8 +622,8 @@
   FilePath new_path = path.RemoveExtension();
   LOG_ASSERT(new_path.MatchesExtension(kP2PExtension));
   if (rename(path.value().c_str(), new_path.value().c_str()) != 0) {
-    PLOG(ERROR) << "Error renaming " << path.value()
-                << " to " << new_path.value();
+    PLOG(ERROR) << "Error renaming " << path.value() << " to "
+                << new_path.value();
     return false;
   }
 
@@ -649,10 +643,12 @@
   if (path.empty())
     return -1;
 
-  char ea_value[64] = { 0 };
+  char ea_value[64] = {0};
   ssize_t ea_size;
-  ea_size = getxattr(path.value().c_str(), kCrosP2PFileSizeXAttrName,
-                     &ea_value, sizeof(ea_value) - 1);
+  ea_size = getxattr(path.value().c_str(),
+                     kCrosP2PFileSizeXAttrName,
+                     &ea_value,
+                     sizeof(ea_value) - 1);
   if (ea_size == -1) {
     PLOG(ERROR) << "Error calling getxattr() on file " << path.value();
     return -1;
@@ -661,9 +657,8 @@
   char* endp = nullptr;
   long long int val = strtoll(ea_value, &endp, 0);  // NOLINT(runtime/int)
   if (*endp != '\0') {
-    LOG(ERROR) << "Error parsing the value '" << ea_value
-               << "' of the xattr " << kCrosP2PFileSizeXAttrName
-               << " as an integer";
+    LOG(ERROR) << "Error parsing the value '" << ea_value << "' of the xattr "
+               << kCrosP2PFileSizeXAttrName << " as an integer";
     return -1;
   }
 
@@ -679,10 +674,10 @@
 
   base::FileEnumerator dir(p2p_dir, false, base::FileEnumerator::FILES);
   for (FilePath name = dir.Next(); !name.empty(); name = dir.Next()) {
-    if (base::EndsWith(name.value(), ext_visible,
-                       base::CompareCase::SENSITIVE) ||
-        base::EndsWith(name.value(), ext_non_visible,
-                       base::CompareCase::SENSITIVE)) {
+    if (base::EndsWith(
+            name.value(), ext_visible, base::CompareCase::SENSITIVE) ||
+        base::EndsWith(
+            name.value(), ext_non_visible, base::CompareCase::SENSITIVE)) {
       num_files += 1;
     }
   }
@@ -694,10 +689,10 @@
   if (waiting_for_enabled_status_change_)
     return;
 
-  Callback<void(EvalStatus, const bool&)> callback = Bind(
-      &P2PManagerImpl::OnEnabledStatusChange, base::Unretained(this));
-  update_manager_->AsyncPolicyRequest(callback, &Policy::P2PEnabledChanged,
-                                      is_enabled_);
+  Callback<void(EvalStatus, const bool&)> callback =
+      Bind(&P2PManagerImpl::OnEnabledStatusChange, base::Unretained(this));
+  update_manager_->AsyncPolicyRequest(
+      callback, &Policy::P2PEnabledChanged, is_enabled_);
   waiting_for_enabled_status_change_ = true;
 }
 
@@ -727,13 +722,12 @@
   ScheduleEnabledStatusChange();
 }
 
-P2PManager* P2PManager::Construct(
-    Configuration *configuration,
-    ClockInterface *clock,
-    UpdateManager* update_manager,
-    const string& file_extension,
-    const int num_files_to_keep,
-    const TimeDelta& max_file_age) {
+P2PManager* P2PManager::Construct(Configuration* configuration,
+                                  ClockInterface* clock,
+                                  UpdateManager* update_manager,
+                                  const string& file_extension,
+                                  const int num_files_to_keep,
+                                  const TimeDelta& max_file_age) {
   return new P2PManagerImpl(configuration,
                             clock,
                             update_manager,
diff --git a/p2p_manager.h b/p2p_manager.h
index 4ffab9a..ef62f0d 100644
--- a/p2p_manager.h
+++ b/p2p_manager.h
@@ -119,8 +119,7 @@
   //
   // If the file already exists, true is returned. Any on-disk xattr
   // is not updated.
-  virtual bool FileShare(const std::string& file_id,
-                         size_t expected_size) = 0;
+  virtual bool FileShare(const std::string& file_id, size_t expected_size) = 0;
 
   // Gets a fully qualified path for the file identified by |file_id|.
   // If the file has not been shared already using the FileShare()
@@ -148,8 +147,7 @@
   // Gets whether the file identified by |file_id| is publicly
   // visible. If |out_result| is not null, the result is returned
   // there. Returns false if an error occurs.
-  virtual bool FileGetVisible(const std::string& file_id,
-                              bool *out_result) = 0;
+  virtual bool FileGetVisible(const std::string& file_id, bool* out_result) = 0;
 
   // Makes the file identified by |file_id| publicly visible
   // (e.g. removes the .tmp extension). If the file is already
@@ -175,8 +173,8 @@
   // |max_file_age| parameter specifies the maximum file age after
   // performing housekeeping (pass zero to allow files of any age).
   static P2PManager* Construct(
-      Configuration *configuration,
-      ClockInterface *clock,
+      Configuration* configuration,
+      ClockInterface* clock,
       chromeos_update_manager::UpdateManager* update_manager,
       const std::string& file_extension,
       const int num_files_to_keep,
diff --git a/p2p_manager_unittest.cc b/p2p_manager_unittest.cc
index 736a87a..5771ec1 100644
--- a/p2p_manager_unittest.cc
+++ b/p2p_manager_unittest.cc
@@ -55,10 +55,10 @@
 using std::string;
 using std::unique_ptr;
 using std::vector;
+using testing::_;
 using testing::DoAll;
 using testing::Return;
 using testing::SetArgPointee;
-using testing::_;
 
 namespace chromeos_update_engine {
 
@@ -84,8 +84,11 @@
     fake_um_.set_policy(mock_policy_);
 
     // Construct the P2P manager under test.
-    manager_.reset(P2PManager::Construct(test_conf_, &fake_clock_, &fake_um_,
-                                         "cros_au", 3,
+    manager_.reset(P2PManager::Construct(test_conf_,
+                                         &fake_clock_,
+                                         &fake_um_,
+                                         "cros_au",
+                                         3,
                                          TimeDelta::FromDays(5)));
   }
 
@@ -95,16 +98,15 @@
   Subprocess subprocess_;
 
   // The P2PManager::Configuration instance used for testing.
-  FakeP2PManagerConfiguration *test_conf_;
+  FakeP2PManagerConfiguration* test_conf_;
 
   FakeClock fake_clock_;
-  chromeos_update_manager::MockPolicy *mock_policy_ = nullptr;
+  chromeos_update_manager::MockPolicy* mock_policy_ = nullptr;
   chromeos_update_manager::FakeUpdateManager fake_um_;
 
   unique_ptr<P2PManager> manager_;
 };
 
-
 // Check that IsP2PEnabled() polls the policy correctly, with the value not
 // changing between calls.
 TEST_F(P2PManagerTest, P2PEnabledInitAndNotChanged) {
@@ -120,9 +122,8 @@
 // between calls.
 TEST_F(P2PManagerTest, P2PEnabledInitAndChanged) {
   EXPECT_CALL(*mock_policy_, P2PEnabled(_, _, _, _))
-      .WillOnce(DoAll(
-              SetArgPointee<3>(true),
-              Return(chromeos_update_manager::EvalStatus::kSucceeded)));
+      .WillOnce(DoAll(SetArgPointee<3>(true),
+                      Return(chromeos_update_manager::EvalStatus::kSucceeded)));
   EXPECT_CALL(*mock_policy_, P2PEnabledChanged(_, _, _, _, true));
   EXPECT_CALL(*mock_policy_, P2PEnabledChanged(_, _, _, _, false));
 
@@ -137,23 +138,26 @@
   // we need to reallocate the test_conf_ member, whose currently aliased object
   // will be freed.
   test_conf_ = new FakeP2PManagerConfiguration();
-  manager_.reset(P2PManager::Construct(
-      test_conf_, &fake_clock_, &fake_um_, "cros_au", 3,
-      TimeDelta() /* max_file_age */));
+  manager_.reset(P2PManager::Construct(test_conf_,
+                                       &fake_clock_,
+                                       &fake_um_,
+                                       "cros_au",
+                                       3,
+                                       TimeDelta() /* max_file_age */));
   EXPECT_EQ(manager_->CountSharedFiles(), 0);
 
   base::Time start_time = base::Time::FromDoubleT(1246996800.);
   // Generate files with different timestamps matching our pattern and generate
   // other files not matching the pattern.
   for (int n = 0; n < 5; n++) {
-    base::FilePath path = test_conf_->GetP2PDir().Append(base::StringPrintf(
-        "file_%d.cros_au.p2p", n));
+    base::FilePath path = test_conf_->GetP2PDir().Append(
+        base::StringPrintf("file_%d.cros_au.p2p", n));
     base::Time file_time = start_time + TimeDelta::FromMinutes(n);
     EXPECT_EQ(0, base::WriteFile(path, nullptr, 0));
     EXPECT_TRUE(base::TouchFile(path, file_time, file_time));
 
-    path = test_conf_->GetP2PDir().Append(base::StringPrintf(
-        "file_%d.OTHER.p2p", n));
+    path = test_conf_->GetP2PDir().Append(
+        base::StringPrintf("file_%d.OTHER.p2p", n));
     EXPECT_EQ(0, base::WriteFile(path, nullptr, 0));
     EXPECT_TRUE(base::TouchFile(path, file_time, file_time));
   }
@@ -170,13 +174,11 @@
 
     expect = (n >= 2);
     file_name = base::StringPrintf(
-        "%s/file_%d.cros_au.p2p",
-         test_conf_->GetP2PDir().value().c_str(), n);
+        "%s/file_%d.cros_au.p2p", test_conf_->GetP2PDir().value().c_str(), n);
     EXPECT_EQ(expect, utils::FileExists(file_name.c_str()));
 
     file_name = base::StringPrintf(
-        "%s/file_%d.OTHER.p2p",
-        test_conf_->GetP2PDir().value().c_str(), n);
+        "%s/file_%d.OTHER.p2p", test_conf_->GetP2PDir().value().c_str(), n);
     EXPECT_TRUE(utils::FileExists(file_name.c_str()));
   }
   // CountSharedFiles() only counts 'cros_au' files.
@@ -201,16 +203,19 @@
   // Note that we need to reallocate the test_conf_ member, whose currently
   // aliased object will be freed.
   test_conf_ = new FakeP2PManagerConfiguration();
-  manager_.reset(P2PManager::Construct(
-      test_conf_, &fake_clock_, &fake_um_, "cros_au",
-      0 /* num_files_to_keep */, age_limit));
+  manager_.reset(P2PManager::Construct(test_conf_,
+                                       &fake_clock_,
+                                       &fake_um_,
+                                       "cros_au",
+                                       0 /* num_files_to_keep */,
+                                       age_limit));
   EXPECT_EQ(manager_->CountSharedFiles(), 0);
 
   // Generate files with different timestamps matching our pattern and generate
   // other files not matching the pattern.
   for (int n = 0; n < 5; n++) {
-    base::FilePath path = test_conf_->GetP2PDir().Append(base::StringPrintf(
-        "file_%d.cros_au.p2p", n));
+    base::FilePath path = test_conf_->GetP2PDir().Append(
+        base::StringPrintf("file_%d.cros_au.p2p", n));
 
     // With five files and aiming for two of them to be before
     // |cutoff_time|, we distribute it like this:
@@ -219,14 +224,14 @@
     //                            |
     //                       cutoff_time
     //
-    base::Time file_date = cutoff_time + (n - 2) * TimeDelta::FromDays(1)
-        + TimeDelta::FromHours(12);
+    base::Time file_date = cutoff_time + (n - 2) * TimeDelta::FromDays(1) +
+                           TimeDelta::FromHours(12);
 
     EXPECT_EQ(0, base::WriteFile(path, nullptr, 0));
     EXPECT_TRUE(base::TouchFile(path, file_date, file_date));
 
-    path = test_conf_->GetP2PDir().Append(base::StringPrintf(
-        "file_%d.OTHER.p2p", n));
+    path = test_conf_->GetP2PDir().Append(
+        base::StringPrintf("file_%d.OTHER.p2p", n));
     EXPECT_EQ(0, base::WriteFile(path, nullptr, 0));
     EXPECT_TRUE(base::TouchFile(path, file_date, file_date));
   }
@@ -243,23 +248,23 @@
 
     expect = (n >= 2);
     file_name = base::StringPrintf(
-        "%s/file_%d.cros_au.p2p",
-         test_conf_->GetP2PDir().value().c_str(), n);
+        "%s/file_%d.cros_au.p2p", test_conf_->GetP2PDir().value().c_str(), n);
     EXPECT_EQ(expect, utils::FileExists(file_name.c_str()));
 
     file_name = base::StringPrintf(
-        "%s/file_%d.OTHER.p2p",
-        test_conf_->GetP2PDir().value().c_str(), n);
+        "%s/file_%d.OTHER.p2p", test_conf_->GetP2PDir().value().c_str(), n);
     EXPECT_TRUE(utils::FileExists(file_name.c_str()));
   }
   // CountSharedFiles() only counts 'cros_au' files.
   EXPECT_EQ(manager_->CountSharedFiles(), 3);
 }
 
-static bool CheckP2PFile(const string& p2p_dir, const string& file_name,
-                         ssize_t expected_size, ssize_t expected_size_xattr) {
+static bool CheckP2PFile(const string& p2p_dir,
+                         const string& file_name,
+                         ssize_t expected_size,
+                         ssize_t expected_size_xattr) {
   string path = p2p_dir + "/" + file_name;
-  char ea_value[64] = { 0 };
+  char ea_value[64] = {0};
   ssize_t ea_size;
 
   off_t p2p_size = utils::FileSize(path);
@@ -270,15 +275,15 @@
 
   if (expected_size != 0) {
     if (p2p_size != expected_size) {
-      LOG(ERROR) << "Expected size " << expected_size
-                 << " but size was " << p2p_size;
+      LOG(ERROR) << "Expected size " << expected_size << " but size was "
+                 << p2p_size;
       return false;
     }
   }
 
   if (expected_size_xattr == 0) {
-    ea_size = getxattr(path.c_str(), "user.cros-p2p-filesize",
-                       &ea_value, sizeof ea_value - 1);
+    ea_size = getxattr(
+        path.c_str(), "user.cros-p2p-filesize", &ea_value, sizeof ea_value - 1);
     if (ea_size == -1 && errno == ENODATA) {
       // This is valid behavior as we support files without the xattr set.
     } else {
@@ -287,8 +292,8 @@
       return false;
     }
   } else {
-    ea_size = getxattr(path.c_str(), "user.cros-p2p-filesize",
-                       &ea_value, sizeof ea_value - 1);
+    ea_size = getxattr(
+        path.c_str(), "user.cros-p2p-filesize", &ea_value, sizeof ea_value - 1);
     if (ea_size < 0) {
       LOG(ERROR) << "Error getting xattr attribute";
       return false;
@@ -296,8 +301,7 @@
     char* endp = nullptr;
     long long int val = strtoll(ea_value, &endp, 0);  // NOLINT(runtime/int)
     if (endp == nullptr || *endp != '\0') {
-      LOG(ERROR) << "Error parsing xattr '" << ea_value
-                 << "' as an integer";
+      LOG(ERROR) << "Error parsing xattr '" << ea_value << "' as an integer";
       return false;
     }
     if (val != expected_size_xattr) {
@@ -310,11 +314,13 @@
   return true;
 }
 
-static bool CreateP2PFile(string p2p_dir, string file_name,
-                          size_t size, size_t size_xattr) {
+static bool CreateP2PFile(string p2p_dir,
+                          string file_name,
+                          size_t size,
+                          size_t size_xattr) {
   string path = p2p_dir + "/" + file_name;
 
-  int fd = open(path.c_str(), O_CREAT|O_RDWR, 0644);
+  int fd = open(path.c_str(), O_CREAT | O_RDWR, 0644);
   if (fd == -1) {
     PLOG(ERROR) << "Error creating file with path " << path;
     return false;
@@ -327,8 +333,11 @@
 
   if (size_xattr != 0) {
     string decimal_size = std::to_string(size_xattr);
-    if (fsetxattr(fd, "user.cros-p2p-filesize",
-                  decimal_size.c_str(), decimal_size.size(), 0) != 0) {
+    if (fsetxattr(fd,
+                  "user.cros-p2p-filesize",
+                  decimal_size.c_str(),
+                  decimal_size.size(),
+                  0) != 0) {
       PLOG(ERROR) << "Error setting xattr on " << path;
       close(fd);
       return false;
@@ -347,7 +356,9 @@
   EXPECT_EQ(manager_->FileGetPath("foo"),
             test_conf_->GetP2PDir().Append("foo.cros_au.p2p.tmp"));
   EXPECT_TRUE(CheckP2PFile(test_conf_->GetP2PDir().value(),
-                           "foo.cros_au.p2p.tmp", 0, kP2PTestFileSize));
+                           "foo.cros_au.p2p.tmp",
+                           0,
+                           kP2PTestFileSize));
 
   // Sharing it again - with the same expected size - should return true
   EXPECT_TRUE(manager_->FileShare("foo", kP2PTestFileSize));
@@ -365,7 +376,9 @@
   EXPECT_EQ(manager_->FileGetPath("foo"),
             test_conf_->GetP2PDir().Append("foo.cros_au.p2p.tmp"));
   EXPECT_TRUE(CheckP2PFile(test_conf_->GetP2PDir().value(),
-                           "foo.cros_au.p2p.tmp", 0, kP2PTestFileSize));
+                           "foo.cros_au.p2p.tmp",
+                           0,
+                           kP2PTestFileSize));
   // Make the file visible and check that it changed its name. Do it
   // twice to check that FileMakeVisible() is idempotent.
   for (int n = 0; n < 2; n++) {
@@ -373,7 +386,9 @@
     EXPECT_EQ(manager_->FileGetPath("foo"),
               test_conf_->GetP2PDir().Append("foo.cros_au.p2p"));
     EXPECT_TRUE(CheckP2PFile(test_conf_->GetP2PDir().value(),
-                             "foo.cros_au.p2p", 0, kP2PTestFileSize));
+                             "foo.cros_au.p2p",
+                             0,
+                             kP2PTestFileSize));
   }
 }
 
@@ -387,8 +402,8 @@
   EXPECT_EQ(manager_->FileGetExpectedSize("foo"), -1);
   EXPECT_FALSE(manager_->FileGetVisible("foo", nullptr));
   // ... then create the file ...
-  EXPECT_TRUE(CreateP2PFile(test_conf_->GetP2PDir().value(),
-                            "foo.cros_au.p2p", 42, 43));
+  EXPECT_TRUE(CreateP2PFile(
+      test_conf_->GetP2PDir().value(), "foo.cros_au.p2p", 42, 43));
   // ... and then check that the expected values are returned
   EXPECT_EQ(manager_->FileGetPath("foo"),
             test_conf_->GetP2PDir().Append("foo.cros_au.p2p"));
@@ -403,8 +418,8 @@
   EXPECT_EQ(manager_->FileGetExpectedSize("bar"), -1);
   EXPECT_FALSE(manager_->FileGetVisible("bar", nullptr));
   // ... then create the file ...
-  EXPECT_TRUE(CreateP2PFile(test_conf_->GetP2PDir().value(),
-                            "bar.cros_au.p2p.tmp", 44, 45));
+  EXPECT_TRUE(CreateP2PFile(
+      test_conf_->GetP2PDir().value(), "bar.cros_au.p2p.tmp", 44, 45));
   // ... and then check that the expected values are returned
   EXPECT_EQ(manager_->FileGetPath("bar"),
             test_conf_->GetP2PDir().Append("bar.cros_au.p2p.tmp"));
@@ -423,11 +438,11 @@
   EXPECT_TRUE(manager_->EnsureP2PRunning());
   test_conf_->SetInitctlStartCommand({"false"});
   EXPECT_FALSE(manager_->EnsureP2PRunning());
-  test_conf_->SetInitctlStartCommand({
-      "sh", "-c", "echo \"initctl: Job is already running: p2p\" >&2; false"});
+  test_conf_->SetInitctlStartCommand(
+      {"sh", "-c", "echo \"initctl: Job is already running: p2p\" >&2; false"});
   EXPECT_TRUE(manager_->EnsureP2PRunning());
-  test_conf_->SetInitctlStartCommand({
-      "sh", "-c", "echo something else >&2; false"});
+  test_conf_->SetInitctlStartCommand(
+      {"sh", "-c", "echo something else >&2; false"});
   EXPECT_FALSE(manager_->EnsureP2PRunning());
 }
 
@@ -438,16 +453,15 @@
   EXPECT_TRUE(manager_->EnsureP2PNotRunning());
   test_conf_->SetInitctlStopCommand({"false"});
   EXPECT_FALSE(manager_->EnsureP2PNotRunning());
-  test_conf_->SetInitctlStopCommand({
-      "sh", "-c", "echo \"initctl: Unknown instance \" >&2; false"});
+  test_conf_->SetInitctlStopCommand(
+      {"sh", "-c", "echo \"initctl: Unknown instance \" >&2; false"});
   EXPECT_TRUE(manager_->EnsureP2PNotRunning());
-  test_conf_->SetInitctlStopCommand({
-      "sh", "-c", "echo something else >&2; false"});
+  test_conf_->SetInitctlStopCommand(
+      {"sh", "-c", "echo something else >&2; false"});
   EXPECT_FALSE(manager_->EnsureP2PNotRunning());
 }
 
-static void ExpectUrl(const string& expected_url,
-                      const string& url) {
+static void ExpectUrl(const string& expected_url, const string& url) {
   EXPECT_EQ(url, expected_url);
   MessageLoop::current()->BreakLoop();
 }
@@ -457,53 +471,56 @@
 TEST_F(P2PManagerTest, LookupURL) {
   // Emulate p2p-client returning valid URL with "fooX", 42 and "cros_au"
   // being propagated in the right places.
-  test_conf_->SetP2PClientCommand({
-      "echo", "http://1.2.3.4/{file_id}_{minsize}"});
-  manager_->LookupUrlForFile("fooX", 42, TimeDelta(),
-                             base::Bind(ExpectUrl,
-                                        "http://1.2.3.4/fooX.cros_au_42"));
+  test_conf_->SetP2PClientCommand(
+      {"echo", "http://1.2.3.4/{file_id}_{minsize}"});
+  manager_->LookupUrlForFile(
+      "fooX",
+      42,
+      TimeDelta(),
+      base::Bind(ExpectUrl, "http://1.2.3.4/fooX.cros_au_42"));
   loop_.Run();
 
   // Emulate p2p-client returning invalid URL.
   test_conf_->SetP2PClientCommand({"echo", "not_a_valid_url"});
-  manager_->LookupUrlForFile("foobar", 42, TimeDelta(),
-                             base::Bind(ExpectUrl, ""));
+  manager_->LookupUrlForFile(
+      "foobar", 42, TimeDelta(), base::Bind(ExpectUrl, ""));
   loop_.Run();
 
   // Emulate p2p-client conveying failure.
   test_conf_->SetP2PClientCommand({"false"});
-  manager_->LookupUrlForFile("foobar", 42, TimeDelta(),
-                             base::Bind(ExpectUrl, ""));
+  manager_->LookupUrlForFile(
+      "foobar", 42, TimeDelta(), base::Bind(ExpectUrl, ""));
   loop_.Run();
 
   // Emulate p2p-client not existing.
   test_conf_->SetP2PClientCommand({"/path/to/non/existent/helper/program"});
-  manager_->LookupUrlForFile("foobar", 42,
-                             TimeDelta(),
-                             base::Bind(ExpectUrl, ""));
+  manager_->LookupUrlForFile(
+      "foobar", 42, TimeDelta(), base::Bind(ExpectUrl, ""));
   loop_.Run();
 
   // Emulate p2p-client crashing.
   test_conf_->SetP2PClientCommand({"sh", "-c", "kill -SEGV $$"});
-  manager_->LookupUrlForFile("foobar", 42, TimeDelta(),
-                             base::Bind(ExpectUrl, ""));
+  manager_->LookupUrlForFile(
+      "foobar", 42, TimeDelta(), base::Bind(ExpectUrl, ""));
   loop_.Run();
 
   // Emulate p2p-client exceeding its timeout.
-  test_conf_->SetP2PClientCommand({
-      "sh", "-c",
-      // The 'sleep' launched below could be left behind as an orphaned
-      // process when the 'sh' process is terminated by SIGTERM. As a
-      // remedy, trap SIGTERM and kill the 'sleep' process, which requires
-      // launching 'sleep' in background and then waiting for it.
-      "cleanup() { kill \"${sleep_pid}\"; exit 0; }; "
-      "trap cleanup TERM; "
-      "sleep 5 & "
-      "sleep_pid=$!; "
-      "echo http://1.2.3.4/; "
-      "wait"
-  });
-  manager_->LookupUrlForFile("foobar", 42, TimeDelta::FromMilliseconds(500),
+  test_conf_->SetP2PClientCommand(
+      {"sh",
+       "-c",
+       // The 'sleep' launched below could be left behind as an orphaned
+       // process when the 'sh' process is terminated by SIGTERM. As a
+       // remedy, trap SIGTERM and kill the 'sleep' process, which requires
+       // launching 'sleep' in background and then waiting for it.
+       "cleanup() { kill \"${sleep_pid}\"; exit 0; }; "
+       "trap cleanup TERM; "
+       "sleep 5 & "
+       "sleep_pid=$!; "
+       "echo http://1.2.3.4/; "
+       "wait"});
+  manager_->LookupUrlForFile("foobar",
+                             42,
+                             TimeDelta::FromMilliseconds(500),
                              base::Bind(ExpectUrl, ""));
   loop_.Run();
 }
diff --git a/parcelable_update_engine_status_unittest.cc b/parcelable_update_engine_status_unittest.cc
index f4bd518..20decb6 100644
--- a/parcelable_update_engine_status_unittest.cc
+++ b/parcelable_update_engine_status_unittest.cc
@@ -21,9 +21,9 @@
 #include <gtest/gtest.h>
 
 using android::Parcel;
+using android::status_t;
 using android::String16;
 using android::brillo::ParcelableUpdateEngineStatus;
-using android::status_t;
 using update_engine::UpdateEngineStatus;
 using update_engine::UpdateStatus;
 
diff --git a/payload_state.cc b/payload_state.cc
index ab7912e..a6c3620 100644
--- a/payload_state.cc
+++ b/payload_state.cc
@@ -193,7 +193,7 @@
 
   attempt_type_ = attempt_type;
 
-  ClockInterface *clock = system_state_->clock();
+  ClockInterface* clock = system_state_->clock();
   attempt_start_time_boot_ = clock->GetBootTime();
   attempt_start_time_monotonic_ = clock->GetMonotonicTime();
   attempt_num_bytes_downloaded_ = 0;
@@ -257,8 +257,8 @@
 
 void PayloadState::UpdateFailed(ErrorCode error) {
   ErrorCode base_error = utils::GetBaseErrorCode(error);
-  LOG(INFO) << "Updating payload state for error code: " << base_error
-            << " (" << utils::ErrorCodeToString(base_error) << ")";
+  LOG(INFO) << "Updating payload state for error code: " << base_error << " ("
+            << utils::ErrorCodeToString(base_error) << ")";
 
   if (candidate_urls_.size() == 0) {
     // This means we got this error even before we got a valid Omaha response
@@ -280,7 +280,6 @@
       break;
   }
 
-
   switch (base_error) {
     // Errors which are good indicators of a problem with a particular URL or
     // the protocol used in the URL or entities in the communication channel
@@ -312,14 +311,14 @@
       IncrementUrlIndex();
       break;
 
-    // Errors which seem to be just transient network/communication related
-    // failures and do not indicate any inherent problem with the URL itself.
-    // So, we should keep the current URL but just increment the
-    // failure count to give it more chances. This way, while we maximize our
-    // chances of downloading from the URLs that appear earlier in the response
-    // (because download from a local server URL that appears earlier in a
-    // response is preferable than downloading from the next URL which could be
-    // a internet URL and thus could be more expensive).
+      // Errors which seem to be just transient network/communication related
+      // failures and do not indicate any inherent problem with the URL itself.
+      // So, we should keep the current URL but just increment the
+      // failure count to give it more chances. This way, while we maximize our
+      // chances of downloading from the URLs that appear earlier in the
+      // response (because download from a local server URL that appears earlier
+      // in a response is preferable than downloading from the next URL which
+      // could be a internet URL and thus could be more expensive).
 
     case ErrorCode::kError:
     case ErrorCode::kDownloadTransferError:
@@ -369,22 +368,22 @@
       LOG(INFO) << "Not incrementing URL index or failure count for this error";
       break;
 
-    case ErrorCode::kSuccess:                            // success code
-    case ErrorCode::kUmaReportedMax:                     // not an error code
-    case ErrorCode::kOmahaRequestHTTPResponseBase:       // aggregated already
-    case ErrorCode::kDevModeFlag:                       // not an error code
-    case ErrorCode::kResumedFlag:                        // not an error code
-    case ErrorCode::kTestImageFlag:                      // not an error code
-    case ErrorCode::kTestOmahaUrlFlag:                   // not an error code
-    case ErrorCode::kSpecialFlags:                       // not an error code
+    case ErrorCode::kSuccess:                       // success code
+    case ErrorCode::kUmaReportedMax:                // not an error code
+    case ErrorCode::kOmahaRequestHTTPResponseBase:  // aggregated already
+    case ErrorCode::kDevModeFlag:                   // not an error code
+    case ErrorCode::kResumedFlag:                   // not an error code
+    case ErrorCode::kTestImageFlag:                 // not an error code
+    case ErrorCode::kTestOmahaUrlFlag:              // not an error code
+    case ErrorCode::kSpecialFlags:                  // not an error code
       // These shouldn't happen. Enumerating these  explicitly here so that we
       // can let the compiler warn about new error codes that are added to
       // action_processor.h but not added here.
       LOG(WARNING) << "Unexpected error code for UpdateFailed";
       break;
 
-    // Note: Not adding a default here so as to let the compiler warn us of
-    // any new enums that were added in the .h but not listed in this switch.
+      // Note: Not adding a default here so as to let the compiler warn us of
+      // any new enums that were added in the .h but not listed in this switch.
   }
 }
 
@@ -531,8 +530,8 @@
   // We don't want all retries to happen exactly at the same time when
   // retrying after backoff. So add some random minutes to fuzz.
   int fuzz_minutes = utils::FuzzInt(0, kMaxBackoffFuzzMinutes);
-  TimeDelta next_backoff_interval = TimeDelta::FromDays(num_days) +
-                                    TimeDelta::FromMinutes(fuzz_minutes);
+  TimeDelta next_backoff_interval =
+      TimeDelta::FromDays(num_days) + TimeDelta::FromMinutes(fuzz_minutes);
   LOG(INFO) << "Incrementing the backoff expiry time by "
             << utils::FormatTimeDelta(next_backoff_interval);
   SetBackoffExpiryTime(Time::Now() + next_backoff_interval);
@@ -600,10 +599,10 @@
 
   int64_t payload_bytes_downloaded = attempt_num_bytes_downloaded_;
 
-  ClockInterface *clock = system_state_->clock();
+  ClockInterface* clock = system_state_->clock();
   TimeDelta duration = clock->GetBootTime() - attempt_start_time_boot_;
-  TimeDelta duration_uptime = clock->GetMonotonicTime() -
-      attempt_start_time_monotonic_;
+  TimeDelta duration_uptime =
+      clock->GetMonotonicTime() - attempt_start_time_monotonic_;
 
   int64_t payload_download_speed_bps = 0;
   int64_t usec = duration_uptime.InMicroseconds();
@@ -616,7 +615,7 @@
   DownloadSource download_source = current_download_source_;
 
   metrics::DownloadErrorCode payload_download_error_code =
-    metrics::DownloadErrorCode::kUnset;
+      metrics::DownloadErrorCode::kUnset;
   ErrorCode internal_error_code = ErrorCode::kSuccess;
   metrics::AttemptResult attempt_result = metrics_utils::GetAttemptResult(code);
 
@@ -730,8 +729,8 @@
 
   int download_overhead_percentage = 0;
   if (successful_bytes > 0) {
-    download_overhead_percentage = (total_bytes - successful_bytes) * 100ULL /
-                                   successful_bytes;
+    download_overhead_percentage =
+        (total_bytes - successful_bytes) * 100ULL / successful_bytes;
   }
 
   int url_switch_count = static_cast<int>(url_switch_count_);
@@ -887,7 +886,7 @@
   full_payload_attempt_number_ = full_payload_attempt_number;
   LOG(INFO) << "Full Payload Attempt Number = " << full_payload_attempt_number_;
   prefs_->SetInt64(kPrefsFullPayloadAttemptNumber,
-      full_payload_attempt_number_);
+                   full_payload_attempt_number_);
 }
 
 void PayloadState::SetPayloadIndex(size_t payload_index) {
@@ -1007,8 +1006,8 @@
 
 TimeDelta PayloadState::GetUpdateDuration() {
   Time end_time = update_timestamp_end_.is_null()
-    ? system_state_->clock()->GetWallclockTime() :
-      update_timestamp_end_;
+                      ? system_state_->clock()->GetWallclockTime()
+                      : update_timestamp_end_;
   return end_time - update_timestamp_start_;
 }
 
@@ -1038,8 +1037,7 @@
   TimeDelta duration_according_to_stored_time = now - stored_time;
   if (duration_according_to_stored_time < -kDurationSlack) {
     LOG(ERROR) << "The UpdateTimestampStart value ("
-               << utils::ToString(stored_time)
-               << ") in persisted state is "
+               << utils::ToString(stored_time) << ") in persisted state is "
                << utils::FormatTimeDelta(duration_according_to_stored_time)
                << " in the future. Resetting.";
     stored_time = now;
@@ -1086,8 +1084,7 @@
   if (diff < -kDurationSlack) {
     LOG(ERROR) << "The UpdateDurationUptime value ("
                << utils::FormatTimeDelta(stored_delta)
-               << ") in persisted state is "
-               << utils::FormatTimeDelta(diff)
+               << ") in persisted state is " << utils::FormatTimeDelta(diff)
                << " larger than the wall-clock delta. Resetting.";
     stored_delta = update_duration_current_;
   }
@@ -1129,7 +1126,7 @@
 
 void PayloadState::SetRollbackVersion(const string& rollback_version) {
   CHECK(powerwash_safe_prefs_);
-  LOG(INFO) << "Blacklisting version "<< rollback_version;
+  LOG(INFO) << "Blacklisting version " << rollback_version;
   rollback_version_ = rollback_version;
   powerwash_safe_prefs_->SetString(kPrefsRollbackVersion, rollback_version);
 }
@@ -1173,10 +1170,9 @@
   SetCurrentBytesDownloaded(source, GetPersistedValue(key, prefs_), true);
 }
 
-void PayloadState::SetCurrentBytesDownloaded(
-    DownloadSource source,
-    uint64_t current_bytes_downloaded,
-    bool log) {
+void PayloadState::SetCurrentBytesDownloaded(DownloadSource source,
+                                             uint64_t current_bytes_downloaded,
+                                             bool log) {
   CHECK(prefs_);
 
   if (source >= kNumDownloadSources)
@@ -1197,10 +1193,9 @@
   SetTotalBytesDownloaded(source, GetPersistedValue(key, prefs_), true);
 }
 
-void PayloadState::SetTotalBytesDownloaded(
-    DownloadSource source,
-    uint64_t total_bytes_downloaded,
-    bool log) {
+void PayloadState::SetTotalBytesDownloaded(DownloadSource source,
+                                           uint64_t total_bytes_downloaded,
+                                           bool log) {
   CHECK(prefs_);
 
   if (source >= kNumDownloadSources)
@@ -1212,9 +1207,8 @@
   // Persist.
   string prefs_key = GetPrefsKey(kPrefsTotalBytesDownloaded, source);
   prefs_->SetInt64(prefs_key, total_bytes_downloaded);
-  LOG_IF(INFO, log) << "Total bytes downloaded for "
-                    << utils::ToString(source) << " = "
-                    << GetTotalBytesDownloaded(source);
+  LOG_IF(INFO, log) << "Total bytes downloaded for " << utils::ToString(source)
+                    << " = " << GetTotalBytesDownloaded(source);
 }
 
 void PayloadState::LoadNumResponsesSeen() {
@@ -1400,8 +1394,7 @@
 bool PayloadState::P2PAttemptAllowed() {
   if (p2p_num_attempts_ > kMaxP2PAttempts) {
     LOG(INFO) << "Number of p2p attempts is " << p2p_num_attempts_
-              << " which is greater than "
-              << kMaxP2PAttempts
+              << " which is greater than " << kMaxP2PAttempts
               << " - disallowing p2p.";
     return false;
   }
@@ -1418,8 +1411,8 @@
       LOG(INFO) << "Time spent attempting p2p is "
                 << utils::FormatTimeDelta(time_spent_attempting_p2p)
                 << " which is greater than "
-                << utils::FormatTimeDelta(TimeDelta::FromSeconds(
-                       kMaxP2PAttemptTimeSeconds))
+                << utils::FormatTimeDelta(
+                       TimeDelta::FromSeconds(kMaxP2PAttemptTimeSeconds))
                 << " - disallowing p2p.";
       return false;
     }
diff --git a/payload_state.h b/payload_state.h
index cb6454f..5ef1220 100644
--- a/payload_state.h
+++ b/payload_state.h
@@ -86,17 +86,11 @@
                : "";
   }
 
-  inline uint32_t GetUrlFailureCount() override {
-    return url_failure_count_;
-  }
+  inline uint32_t GetUrlFailureCount() override { return url_failure_count_; }
 
-  inline uint32_t GetUrlSwitchCount() override {
-    return url_switch_count_;
-  }
+  inline uint32_t GetUrlSwitchCount() override { return url_switch_count_; }
 
-  inline int GetNumResponsesSeen() override {
-    return num_responses_seen_;
-  }
+  inline int GetNumResponsesSeen() override { return num_responses_seen_; }
 
   inline base::Time GetBackoffExpiryTime() override {
     return backoff_expiry_time_;
@@ -114,9 +108,7 @@
     return source < kNumDownloadSources ? total_bytes_downloaded_[source] : 0;
   }
 
-  inline uint32_t GetNumReboots() override {
-    return num_reboots_;
-  }
+  inline uint32_t GetNumReboots() override { return num_reboots_; }
 
   void UpdateEngineStarted() override;
 
@@ -124,9 +116,7 @@
 
   void SetRollbackHappened(bool rollback_happened) override;
 
-  inline std::string GetRollbackVersion() override {
-    return rollback_version_;
-  }
+  inline std::string GetRollbackVersion() override { return rollback_version_; }
 
   int GetP2PNumAttempts() override;
   base::Time GetP2PFirstAttemptTimestamp() override;
@@ -137,9 +127,7 @@
     return using_p2p_for_downloading_;
   }
 
-  bool GetUsingP2PForSharing() const override {
-    return using_p2p_for_sharing_;
-  }
+  bool GetUsingP2PForSharing() const override { return using_p2p_for_sharing_; }
 
   base::TimeDelta GetScatteringWaitPeriod() override {
     return scattering_wait_period_;
@@ -149,13 +137,9 @@
 
   void SetStagingWaitPeriod(base::TimeDelta wait_period) override;
 
-  void SetP2PUrl(const std::string& url) override {
-    p2p_url_ = url;
-  }
+  void SetP2PUrl(const std::string& url) override { p2p_url_ = url; }
 
-  std::string GetP2PUrl() const override {
-    return p2p_url_;
-  }
+  std::string GetP2PUrl() const override { return p2p_url_; }
 
   bool NextPayload() override;
 
diff --git a/payload_state_unittest.cc b/payload_state_unittest.cc
index 637891b..869c24e 100644
--- a/payload_state_unittest.cc
+++ b/payload_state_unittest.cc
@@ -37,28 +37,28 @@
 using base::Time;
 using base::TimeDelta;
 using std::string;
+using testing::_;
 using testing::AnyNumber;
 using testing::AtLeast;
 using testing::Mock;
 using testing::NiceMock;
 using testing::Return;
 using testing::SetArgPointee;
-using testing::_;
 
 namespace chromeos_update_engine {
 
 const char* kCurrentBytesDownloadedFromHttps =
-  "current-bytes-downloaded-from-HttpsServer";
+    "current-bytes-downloaded-from-HttpsServer";
 const char* kTotalBytesDownloadedFromHttps =
-  "total-bytes-downloaded-from-HttpsServer";
+    "total-bytes-downloaded-from-HttpsServer";
 const char* kCurrentBytesDownloadedFromHttp =
-  "current-bytes-downloaded-from-HttpServer";
+    "current-bytes-downloaded-from-HttpServer";
 const char* kTotalBytesDownloadedFromHttp =
-  "total-bytes-downloaded-from-HttpServer";
+    "total-bytes-downloaded-from-HttpServer";
 const char* kCurrentBytesDownloadedFromHttpPeer =
-  "current-bytes-downloaded-from-HttpPeer";
+    "current-bytes-downloaded-from-HttpPeer";
 const char* kTotalBytesDownloadedFromHttpPeer =
-  "total-bytes-downloaded-from-HttpPeer";
+    "total-bytes-downloaded-from-HttpPeer";
 
 static void SetupPayloadStateWith2Urls(string hash,
                                        bool http_enabled,
@@ -103,7 +103,7 @@
   EXPECT_EQ(expected_response_sign, stored_response_sign);
 }
 
-class PayloadStateTest : public ::testing::Test { };
+class PayloadStateTest : public ::testing::Test {};
 
 TEST(PayloadStateTest, SetResponseWorksWithEmptyResponse) {
   OmahaResponse response;
@@ -111,23 +111,23 @@
   NiceMock<MockPrefs>* prefs = fake_system_state.mock_prefs();
   EXPECT_CALL(*prefs, SetInt64(_, _)).Times(AnyNumber());
   EXPECT_CALL(*prefs, SetInt64(kPrefsPayloadAttemptNumber, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsBackoffExpiryTime, 0)).Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlIndex, 0)).Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlFailureCount, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsUpdateTimestampStart, _))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsUpdateDurationUptime, _))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttps, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttp, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttpPeer, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsNumReboots, 0)).Times(AtLeast(1));
   PayloadState payload_state;
   EXPECT_TRUE(payload_state.Initialize(&fake_system_state));
@@ -154,27 +154,24 @@
   NiceMock<MockPrefs>* prefs = fake_system_state.mock_prefs();
   EXPECT_CALL(*prefs, SetInt64(_, _)).Times(AnyNumber());
   EXPECT_CALL(*prefs, SetInt64(kPrefsPayloadAttemptNumber, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsBackoffExpiryTime, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlIndex, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlFailureCount, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsUpdateTimestampStart, _))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsUpdateDurationUptime, _))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttps, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttp, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttpPeer, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsNumReboots, 0))
       .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 0))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsBackoffExpiryTime, 0)).Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlIndex, 0)).Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlFailureCount, 0))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsUpdateTimestampStart, _))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsUpdateDurationUptime, _))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttps, 0))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttp, 0))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttpPeer, 0))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsNumReboots, 0)).Times(AtLeast(1));
   PayloadState payload_state;
   EXPECT_TRUE(payload_state.Initialize(&fake_system_state));
   payload_state.SetResponse(response);
@@ -209,23 +206,20 @@
   NiceMock<MockPrefs>* prefs = fake_system_state.mock_prefs();
   EXPECT_CALL(*prefs, SetInt64(_, _)).Times(AnyNumber());
   EXPECT_CALL(*prefs, SetInt64(kPrefsPayloadAttemptNumber, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsBackoffExpiryTime, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlIndex, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlFailureCount, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttps, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttp, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttpPeer, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsNumReboots, 0))
       .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 0))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsBackoffExpiryTime, 0)).Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlIndex, 0)).Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlFailureCount, 0))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttps, 0))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttp, 0))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttpPeer, 0))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsNumReboots, 0)).Times(AtLeast(1));
 
   PayloadState payload_state;
   EXPECT_TRUE(payload_state.Initialize(&fake_system_state));
@@ -259,13 +253,13 @@
   EXPECT_CALL(*prefs, SetInt64(_, _)).Times(AnyNumber());
   // Payload attempt should start with 0 and then advance to 1.
   EXPECT_CALL(*prefs, SetInt64(kPrefsPayloadAttemptNumber, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsPayloadAttemptNumber, 1))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 1))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsBackoffExpiryTime, _)).Times(AtLeast(2));
 
   // Reboots will be set
@@ -278,7 +272,7 @@
   // Failure count should be called each times url index is set, so that's
   // 4 times for this test.
   EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlFailureCount, 0))
-    .Times(AtLeast(4));
+      .Times(AtLeast(4));
 
   EXPECT_TRUE(payload_state.Initialize(&fake_system_state));
 
@@ -361,18 +355,18 @@
 
   EXPECT_CALL(*prefs, SetInt64(_, _)).Times(AnyNumber());
   EXPECT_CALL(*prefs, SetInt64(kPrefsPayloadAttemptNumber, 0))
-    .Times(AtLeast(2));
+      .Times(AtLeast(2));
   EXPECT_CALL(*prefs, SetInt64(kPrefsPayloadAttemptNumber, 1))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsPayloadAttemptNumber, 2))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
 
   EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 0))
-    .Times(AtLeast(2));
+      .Times(AtLeast(2));
   EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 1))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 2))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
 
   EXPECT_CALL(*prefs, SetInt64(kPrefsBackoffExpiryTime, _)).Times(AtLeast(4));
 
@@ -380,29 +374,28 @@
   EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlIndex, 1)).Times(AtLeast(2));
 
   EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlFailureCount, 0))
-    .Times(AtLeast(7));
+      .Times(AtLeast(7));
   EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlFailureCount, 1))
-    .Times(AtLeast(2));
+      .Times(AtLeast(2));
   EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlFailureCount, 2))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
 
   EXPECT_CALL(*prefs, SetInt64(kPrefsUpdateTimestampStart, _))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsUpdateDurationUptime, _))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
 
   EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttps, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttp, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttpPeer, 0))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttp, progress_bytes))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kTotalBytesDownloadedFromHttp, progress_bytes))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs, SetInt64(kPrefsNumReboots, 0))
       .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttp, 0))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttpPeer, 0))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kCurrentBytesDownloadedFromHttp, progress_bytes))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kTotalBytesDownloadedFromHttp, progress_bytes))
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsNumReboots, 0)).Times(AtLeast(1));
 
   EXPECT_TRUE(payload_state.Initialize(&fake_system_state));
 
@@ -507,22 +500,20 @@
 
   EXPECT_CALL(*prefs, SetInt64(_, _)).Times(AnyNumber());
   EXPECT_CALL(*prefs, SetInt64(kPrefsPayloadAttemptNumber, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsPayloadAttemptNumber, 1))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
 
   EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 1))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
 
-  EXPECT_CALL(*prefs, SetInt64(kPrefsBackoffExpiryTime, _))
-    .Times(AtLeast(2));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsBackoffExpiryTime, _)).Times(AtLeast(2));
 
-  EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlIndex, 0))
-    .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlIndex, 0)).Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlFailureCount, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
 
   EXPECT_TRUE(payload_state.Initialize(&fake_system_state));
 
@@ -548,21 +539,19 @@
 
   EXPECT_CALL(*prefs, SetInt64(_, _)).Times(AnyNumber());
   EXPECT_CALL(*prefs, SetInt64(kPrefsPayloadAttemptNumber, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsPayloadAttemptNumber, 1))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
 
   // kPrefsFullPayloadAttemptNumber is not incremented for delta payloads.
   EXPECT_CALL(*prefs, SetInt64(kPrefsFullPayloadAttemptNumber, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
 
-  EXPECT_CALL(*prefs, SetInt64(kPrefsBackoffExpiryTime, _))
-    .Times(1);
+  EXPECT_CALL(*prefs, SetInt64(kPrefsBackoffExpiryTime, _)).Times(1);
 
-  EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlIndex, 0))
-    .Times(AtLeast(1));
+  EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlIndex, 0)).Times(AtLeast(1));
   EXPECT_CALL(*prefs, SetInt64(kPrefsCurrentUrlFailureCount, 0))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
 
   EXPECT_TRUE(payload_state.Initialize(&fake_system_state));
 
@@ -607,15 +596,14 @@
   EXPECT_CALL(*prefs2, Exists(_)).WillRepeatedly(Return(true));
   EXPECT_CALL(*prefs2, GetInt64(_, _)).Times(AtLeast(1));
   EXPECT_CALL(*prefs2, GetInt64(kPrefsPayloadAttemptNumber, _))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs2, GetInt64(kPrefsFullPayloadAttemptNumber, _))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
   EXPECT_CALL(*prefs2, GetInt64(kPrefsCurrentUrlIndex, _))
       .WillRepeatedly(DoAll(SetArgPointee<1>(2), Return(true)));
   EXPECT_CALL(*prefs2, GetInt64(kPrefsCurrentUrlFailureCount, _))
-    .Times(AtLeast(1));
-  EXPECT_CALL(*prefs2, GetInt64(kPrefsUrlSwitchCount, _))
-    .Times(AtLeast(1));
+      .Times(AtLeast(1));
+  EXPECT_CALL(*prefs2, GetInt64(kPrefsUrlSwitchCount, _)).Times(AtLeast(1));
 
   // Note: This will be a different payload object, but the response should
   // have the same hash as before so as to not trivially reset because the
@@ -719,7 +707,7 @@
                                      TimeDelta expected_days) {
   payload_state->DownloadComplete();
   EXPECT_EQ(expected_attempt_number,
-      payload_state->GetFullPayloadAttemptNumber());
+            payload_state->GetFullPayloadAttemptNumber());
   EXPECT_TRUE(payload_state->ShouldBackoffDownload());
   Time backoff_expiry_time = payload_state->GetBackoffExpiryTime();
   // Add 1 hour extra to the 6 hour fuzz check to tolerate edge cases.
@@ -741,16 +729,16 @@
   SetupPayloadStateWith2Urls(
       "Hash8939", true, false, &payload_state, &response);
 
-  CheckPayloadBackoffState(&payload_state, 1,  TimeDelta::FromDays(1));
-  CheckPayloadBackoffState(&payload_state, 2,  TimeDelta::FromDays(2));
-  CheckPayloadBackoffState(&payload_state, 3,  TimeDelta::FromDays(4));
-  CheckPayloadBackoffState(&payload_state, 4,  TimeDelta::FromDays(8));
-  CheckPayloadBackoffState(&payload_state, 5,  TimeDelta::FromDays(16));
-  CheckPayloadBackoffState(&payload_state, 6,  TimeDelta::FromDays(16));
-  CheckPayloadBackoffState(&payload_state, 7,  TimeDelta::FromDays(16));
-  CheckPayloadBackoffState(&payload_state, 8,  TimeDelta::FromDays(16));
-  CheckPayloadBackoffState(&payload_state, 9,  TimeDelta::FromDays(16));
-  CheckPayloadBackoffState(&payload_state, 10,  TimeDelta::FromDays(16));
+  CheckPayloadBackoffState(&payload_state, 1, TimeDelta::FromDays(1));
+  CheckPayloadBackoffState(&payload_state, 2, TimeDelta::FromDays(2));
+  CheckPayloadBackoffState(&payload_state, 3, TimeDelta::FromDays(4));
+  CheckPayloadBackoffState(&payload_state, 4, TimeDelta::FromDays(8));
+  CheckPayloadBackoffState(&payload_state, 5, TimeDelta::FromDays(16));
+  CheckPayloadBackoffState(&payload_state, 6, TimeDelta::FromDays(16));
+  CheckPayloadBackoffState(&payload_state, 7, TimeDelta::FromDays(16));
+  CheckPayloadBackoffState(&payload_state, 8, TimeDelta::FromDays(16));
+  CheckPayloadBackoffState(&payload_state, 9, TimeDelta::FromDays(16));
+  CheckPayloadBackoffState(&payload_state, 10, TimeDelta::FromDays(16));
 }
 
 TEST(PayloadStateTest, BackoffLogicCanBeDisabled) {
@@ -820,8 +808,8 @@
             payload_state.GetCurrentBytesDownloaded(kDownloadSourceHttpServer));
   EXPECT_EQ(http_total,
             payload_state.GetTotalBytesDownloaded(kDownloadSourceHttpServer));
-  EXPECT_EQ(0U, payload_state.GetCurrentBytesDownloaded(
-                 kDownloadSourceHttpsServer));
+  EXPECT_EQ(
+      0U, payload_state.GetCurrentBytesDownloaded(kDownloadSourceHttpsServer));
   EXPECT_EQ(https_total,
             payload_state.GetTotalBytesDownloaded(kDownloadSourceHttpsServer));
 
@@ -837,8 +825,9 @@
             payload_state.GetCurrentBytesDownloaded(kDownloadSourceHttpServer));
   EXPECT_EQ(http_total,
             payload_state.GetTotalBytesDownloaded(kDownloadSourceHttpServer));
-  EXPECT_EQ(second_chunk, payload_state.GetCurrentBytesDownloaded(
-              kDownloadSourceHttpsServer));
+  EXPECT_EQ(
+      second_chunk,
+      payload_state.GetCurrentBytesDownloaded(kDownloadSourceHttpsServer));
   EXPECT_EQ(https_total,
             payload_state.GetTotalBytesDownloaded(kDownloadSourceHttpsServer));
 
@@ -854,8 +843,9 @@
             payload_state.GetCurrentBytesDownloaded(kDownloadSourceHttpServer));
   EXPECT_EQ(http_total,
             payload_state.GetTotalBytesDownloaded(kDownloadSourceHttpServer));
-  EXPECT_EQ(second_chunk, payload_state.GetCurrentBytesDownloaded(
-                 kDownloadSourceHttpsServer));
+  EXPECT_EQ(
+      second_chunk,
+      payload_state.GetCurrentBytesDownloaded(kDownloadSourceHttpsServer));
   EXPECT_EQ(https_total,
             payload_state.GetTotalBytesDownloaded(kDownloadSourceHttpsServer));
 
@@ -880,8 +870,8 @@
             payload_state.GetCurrentBytesDownloaded(kDownloadSourceHttpServer));
   EXPECT_EQ(0U,
             payload_state.GetTotalBytesDownloaded(kDownloadSourceHttpServer));
-  EXPECT_EQ(0U, payload_state.GetCurrentBytesDownloaded(
-                 kDownloadSourceHttpsServer));
+  EXPECT_EQ(
+      0U, payload_state.GetCurrentBytesDownloaded(kDownloadSourceHttpsServer));
   EXPECT_EQ(0U,
             payload_state.GetTotalBytesDownloaded(kDownloadSourceHttpsServer));
   EXPECT_EQ(0, payload_state.GetNumResponsesSeen());
@@ -944,8 +934,8 @@
             payload_state.GetCurrentBytesDownloaded(kDownloadSourceHttpServer));
   EXPECT_EQ(num_bytes,
             payload_state.GetTotalBytesDownloaded(kDownloadSourceHttpServer));
-  EXPECT_EQ(0U, payload_state.GetCurrentBytesDownloaded(
-                 kDownloadSourceHttpsServer));
+  EXPECT_EQ(
+      0U, payload_state.GetCurrentBytesDownloaded(kDownloadSourceHttpsServer));
   EXPECT_EQ(0U,
             payload_state.GetTotalBytesDownloaded(kDownloadSourceHttpsServer));
 
@@ -1033,8 +1023,8 @@
   params.Init(rollback_version, "", false);
   fake_system_state.set_request_params(&params);
 
-  EXPECT_CALL(*mock_powerwash_safe_prefs, SetString(kPrefsRollbackVersion,
-                                                    rollback_version));
+  EXPECT_CALL(*mock_powerwash_safe_prefs,
+              SetString(kPrefsRollbackVersion, rollback_version));
   payload_state.Rollback();
 
   EXPECT_EQ(rollback_version, payload_state.GetRollbackVersion());
@@ -1042,11 +1032,10 @@
   // Change it up a little and verify we load it correctly.
   rollback_version = "2345.0.1";
   // Let's verify we can reload it correctly.
-  EXPECT_CALL(*mock_powerwash_safe_prefs, GetString(
-      kPrefsRollbackVersion, _)).WillOnce(DoAll(
-          SetArgPointee<1>(rollback_version), Return(true)));
-  EXPECT_CALL(*mock_powerwash_safe_prefs, SetString(kPrefsRollbackVersion,
-                                                    rollback_version));
+  EXPECT_CALL(*mock_powerwash_safe_prefs, GetString(kPrefsRollbackVersion, _))
+      .WillOnce(DoAll(SetArgPointee<1>(rollback_version), Return(true)));
+  EXPECT_CALL(*mock_powerwash_safe_prefs,
+              SetString(kPrefsRollbackVersion, rollback_version));
   payload_state.LoadRollbackVersion();
   EXPECT_EQ(rollback_version, payload_state.GetRollbackVersion());
 
@@ -1570,8 +1559,8 @@
   EXPECT_TRUE(payload_state.P2PAttemptAllowed());
 
   // Set clock to half the deadline - this should work.
-  fake_clock.SetWallclockTime(epoch +
-      TimeDelta::FromSeconds(kMaxP2PAttemptTimeSeconds) / 2);
+  fake_clock.SetWallclockTime(
+      epoch + TimeDelta::FromSeconds(kMaxP2PAttemptTimeSeconds) / 2);
   EXPECT_TRUE(payload_state.P2PAttemptAllowed());
 
   // Check that the first attempt timestamp hasn't changed just
@@ -1579,13 +1568,13 @@
   EXPECT_EQ(epoch, payload_state.GetP2PFirstAttemptTimestamp());
 
   // Set clock to _just_ before the deadline - this should work.
-  fake_clock.SetWallclockTime(epoch +
-      TimeDelta::FromSeconds(kMaxP2PAttemptTimeSeconds - 1));
+  fake_clock.SetWallclockTime(
+      epoch + TimeDelta::FromSeconds(kMaxP2PAttemptTimeSeconds - 1));
   EXPECT_TRUE(payload_state.P2PAttemptAllowed());
 
   // Set clock to _just_ after the deadline - this should not work.
-  fake_clock.SetWallclockTime(epoch +
-      TimeDelta::FromSeconds(kMaxP2PAttemptTimeSeconds + 1));
+  fake_clock.SetWallclockTime(
+      epoch + TimeDelta::FromSeconds(kMaxP2PAttemptTimeSeconds + 1));
   EXPECT_FALSE(payload_state.P2PAttemptAllowed());
 }
 
diff --git a/power_manager_android.cc b/power_manager_android.cc
index 6b7e880..63a0351 100644
--- a/power_manager_android.cc
+++ b/power_manager_android.cc
@@ -16,6 +16,8 @@
 
 #include "update_engine/power_manager_android.h"
 
+#include <memory>
+
 #include <base/logging.h>
 
 namespace chromeos_update_engine {
@@ -24,7 +26,7 @@
 std::unique_ptr<PowerManagerInterface> CreatePowerManager() {
   return std::unique_ptr<PowerManagerInterface>(new PowerManagerAndroid());
 }
-}
+}  // namespace power_manager
 
 bool PowerManagerAndroid::RequestReboot() {
   LOG(WARNING) << "PowerManager not implemented.";
diff --git a/power_manager_chromeos.cc b/power_manager_chromeos.cc
index 23fb032..531d367 100644
--- a/power_manager_chromeos.cc
+++ b/power_manager_chromeos.cc
@@ -29,7 +29,7 @@
 std::unique_ptr<PowerManagerInterface> CreatePowerManager() {
   return std::unique_ptr<PowerManagerInterface>(new PowerManagerChromeOS());
 }
-}
+}  // namespace power_manager
 
 PowerManagerChromeOS::PowerManagerChromeOS()
     : power_manager_proxy_(DBusConnection::Get()->GetDBus()) {}
diff --git a/power_manager_interface.h b/power_manager_interface.h
index be059ec..8f77650 100644
--- a/power_manager_interface.h
+++ b/power_manager_interface.h
@@ -40,7 +40,7 @@
 namespace power_manager {
 // Factory function which create a PowerManager.
 std::unique_ptr<PowerManagerInterface> CreatePowerManager();
-}
+}  // namespace power_manager
 
 }  // namespace chromeos_update_engine
 
diff --git a/real_system_state.cc b/real_system_state.cc
index 9474741..2f18b4d 100644
--- a/real_system_state.cc
+++ b/real_system_state.cc
@@ -149,8 +149,8 @@
       new CertificateChecker(prefs_.get(), &openssl_wrapper_));
   certificate_checker_->Init();
 
-  update_attempter_.reset(new UpdateAttempter(this,
-                                              certificate_checker_.get()));
+  update_attempter_.reset(
+      new UpdateAttempter(this, certificate_checker_.get()));
 
   // Initialize the UpdateAttempter before the UpdateManager.
   update_attempter_->Init();
@@ -169,15 +169,20 @@
     LOG(ERROR) << "Failed to initialize the Update Manager.";
     return false;
   }
-  update_manager_.reset(
-      new chromeos_update_manager::UpdateManager(
-          &clock_, base::TimeDelta::FromSeconds(5),
-          base::TimeDelta::FromHours(12), um_state));
+  update_manager_.reset(new chromeos_update_manager::UpdateManager(
+      &clock_,
+      base::TimeDelta::FromSeconds(5),
+      base::TimeDelta::FromHours(12),
+      um_state));
 
   // The P2P Manager depends on the Update Manager for its initialization.
-  p2p_manager_.reset(P2PManager::Construct(
-          nullptr, &clock_, update_manager_.get(), "cros_au",
-          kMaxP2PFilesToKeep, base::TimeDelta::FromDays(kMaxP2PFileAgeDays)));
+  p2p_manager_.reset(
+      P2PManager::Construct(nullptr,
+                            &clock_,
+                            update_manager_.get(),
+                            "cros_au",
+                            kMaxP2PFilesToKeep,
+                            base::TimeDelta::FromDays(kMaxP2PFileAgeDays)));
 
   if (!payload_state_.Initialize(this)) {
     LOG(ERROR) << "Failed to initialize the payload state object.";
@@ -215,14 +220,16 @@
 
   // Broadcast the update engine status on startup to ensure consistent system
   // state on crashes.
-  MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
-      &UpdateAttempter::BroadcastStatus,
-      base::Unretained(update_attempter_.get())));
+  MessageLoop::current()->PostTask(
+      FROM_HERE,
+      base::Bind(&UpdateAttempter::BroadcastStatus,
+                 base::Unretained(update_attempter_.get())));
 
   // Run the UpdateEngineStarted() method on |update_attempter|.
-  MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
-      &UpdateAttempter::UpdateEngineStarted,
-      base::Unretained(update_attempter_.get())));
+  MessageLoop::current()->PostTask(
+      FROM_HERE,
+      base::Bind(&UpdateAttempter::UpdateEngineStarted,
+                 base::Unretained(update_attempter_.get())));
   return true;
 }
 
diff --git a/sideload_main.cc b/sideload_main.cc
index 4bbb4b8..818fa5c 100644
--- a/sideload_main.cc
+++ b/sideload_main.cc
@@ -40,8 +40,8 @@
 
 using std::string;
 using std::vector;
-using update_engine::UpdateStatus;
 using update_engine::UpdateEngineStatus;
+using update_engine::UpdateStatus;
 
 namespace chromeos_update_engine {
 namespace {
diff --git a/test_http_server.cc b/test_http_server.cc
index cf15672..4536f37 100644
--- a/test_http_server.cc
+++ b/test_http_server.cc
@@ -48,14 +48,12 @@
 
 #include "update_engine/common/http_common.h"
 
-
 // HTTP end-of-line delimiter; sorry, this needs to be a macro.
 #define EOL "\r\n"
 
 using std::string;
 using std::vector;
 
-
 namespace chromeos_update_engine {
 
 static const char* kListeningMsgPrefix = "listening on port ";
@@ -93,8 +91,7 @@
   } while (!base::EndsWith(headers, EOL EOL, base::CompareCase::SENSITIVE));
 
   LOG(INFO) << "got headers:\n--8<------8<------8<------8<----\n"
-            << headers
-            << "\n--8<------8<------8<------8<----";
+            << headers << "\n--8<------8<------8<------8<----";
   request->raw_headers = headers;
 
   // Break header into lines.
@@ -105,7 +102,8 @@
       base::SPLIT_WANT_ALL);
 
   // Decode URL line.
-  vector<string> terms = base::SplitString(lines[0], base::kWhitespaceASCII,
+  vector<string> terms = base::SplitString(lines[0],
+                                           base::kWhitespaceASCII,
                                            base::KEEP_WHITESPACE,
                                            base::SPLIT_WANT_NONEMPTY);
   CHECK_EQ(terms.size(), static_cast<vector<string>::size_type>(3));
@@ -116,12 +114,14 @@
   // Decode remaining lines.
   size_t i;
   for (i = 1; i < lines.size(); i++) {
-    terms = base::SplitString(lines[i], base::kWhitespaceASCII,
-                              base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
+    terms = base::SplitString(lines[i],
+                              base::kWhitespaceASCII,
+                              base::KEEP_WHITESPACE,
+                              base::SPLIT_WANT_NONEMPTY);
 
     if (terms[0] == "Range:") {
       CHECK_EQ(terms.size(), static_cast<vector<string>::size_type>(2));
-      string &range = terms[1];
+      string& range = terms[1];
       LOG(INFO) << "range attribute: " << range;
       CHECK(base::StartsWith(range, "bytes=", base::CompareCase::SENSITIVE) &&
             range.find('-') != string::npos);
@@ -130,12 +130,13 @@
       if (range.find('-') < range.length() - 1)
         request->end_offset = atoll(range.c_str() + range.find('-') + 1) + 1;
       request->return_code = kHttpResponsePartialContent;
-      string tmp_str = base::StringPrintf("decoded range offsets: "
-                                               "start=%jd end=",
-                                               (intmax_t)request->start_offset);
+      string tmp_str = base::StringPrintf(
+          "decoded range offsets: "
+          "start=%jd end=",
+          (intmax_t)request->start_offset);
       if (request->end_offset > 0)
-        base::StringAppendF(&tmp_str, "%jd (non-inclusive)",
-                            (intmax_t)request->end_offset);
+        base::StringAppendF(
+            &tmp_str, "%jd (non-inclusive)", (intmax_t)request->end_offset);
       else
         base::StringAppendF(&tmp_str, "unspecified");
       LOG(INFO) << tmp_str;
@@ -162,7 +163,7 @@
 ssize_t WriteString(int fd, const string& str) {
   const size_t total_size = str.size();
   size_t remaining_size = total_size;
-  char const *data = str.data();
+  char const* data = str.data();
 
   while (remaining_size) {
     ssize_t written = write(fd, data, remaining_size);
@@ -179,38 +180,38 @@
 }
 
 // Writes the headers of an HTTP response into a file.
-ssize_t WriteHeaders(int fd, const off_t start_offset, const off_t end_offset,
+ssize_t WriteHeaders(int fd,
+                     const off_t start_offset,
+                     const off_t end_offset,
                      HttpResponseCode return_code) {
   ssize_t written = 0, ret;
 
   ret = WriteString(fd,
                     string("HTTP/1.1 ") + Itoa(return_code) + " " +
-                    GetHttpResponseDescription(return_code) +
-                    EOL
-                    "Content-Type: application/octet-stream" EOL);
+                        GetHttpResponseDescription(return_code) +
+                        EOL "Content-Type: application/octet-stream" EOL);
   if (ret < 0)
     return -1;
   written += ret;
 
   // Compute content legnth.
-  const off_t content_length = end_offset - start_offset;;
+  const off_t content_length = end_offset - start_offset;
 
   // A start offset that equals the end offset indicates that the response
   // should contain the full range of bytes in the requested resource.
   if (start_offset || start_offset == end_offset) {
-    ret = WriteString(fd,
-                      string("Accept-Ranges: bytes" EOL
-                             "Content-Range: bytes ") +
-                      Itoa(start_offset == end_offset ? 0 : start_offset) +
-                      "-" + Itoa(end_offset - 1) + "/" + Itoa(end_offset) +
-                      EOL);
+    ret = WriteString(
+        fd,
+        string("Accept-Ranges: bytes" EOL "Content-Range: bytes ") +
+            Itoa(start_offset == end_offset ? 0 : start_offset) + "-" +
+            Itoa(end_offset - 1) + "/" + Itoa(end_offset) + EOL);
     if (ret < 0)
       return -1;
     written += ret;
   }
 
-  ret = WriteString(fd, string("Content-Length: ") + Itoa(content_length) +
-                    EOL EOL);
+  ret = WriteString(
+      fd, string("Content-Length: ") + Itoa(content_length) + EOL EOL);
   if (ret < 0)
     return -1;
   written += ret;
@@ -221,8 +222,11 @@
 // Writes a predetermined payload of lines of ascending bytes to a file. The
 // first byte of output is appropriately offset with respect to the request line
 // length.  Returns the number of successfully written bytes.
-size_t WritePayload(int fd, const off_t start_offset, const off_t end_offset,
-                    const char first_byte, const size_t line_len) {
+size_t WritePayload(int fd,
+                    const off_t start_offset,
+                    const off_t end_offset,
+                    const char first_byte,
+                    const size_t line_len) {
   CHECK_LE(start_offset, end_offset);
   CHECK_GT(line_len, static_cast<size_t>(0));
 
@@ -248,14 +252,14 @@
   if (start_modulo) {
     string partial = line.substr(start_modulo, remaining_len);
     ssize_t ret = WriteString(fd, partial);
-    if ((success = (ret >= 0 && (size_t) ret == partial.length())))
+    if ((success = (ret >= 0 && (size_t)ret == partial.length())))
       remaining_len -= partial.length();
   }
 
   // Output full lines up to the maximal line boundary below the end offset.
   while (success && remaining_len >= line_len) {
     ssize_t ret = WriteString(fd, line);
-    if ((success = (ret >= 0 && (size_t) ret == line_len)))
+    if ((success = (ret >= 0 && (size_t)ret == line_len)))
       remaining_len -= line_len;
   }
 
@@ -263,7 +267,7 @@
   if (success && remaining_len) {
     string partial = line.substr(0, remaining_len);
     ssize_t ret = WriteString(fd, partial);
-    if ((success = (ret >= 0 && (size_t) ret == partial.length())))
+    if ((success = (ret >= 0 && (size_t)ret == partial.length())))
       remaining_len -= partial.length();
   }
 
@@ -271,7 +275,8 @@
 }
 
 // Write default payload lines of the form 'abcdefghij'.
-inline size_t WritePayload(int fd, const off_t start_offset,
+inline size_t WritePayload(int fd,
+                           const off_t start_offset,
                            const off_t end_offset) {
   return WritePayload(fd, start_offset, end_offset, 'a', 10);
 }
@@ -279,17 +284,19 @@
 // Send an empty response, then kill the server.
 void HandleQuit(int fd) {
   WriteHeaders(fd, 0, 0, kHttpResponseOk);
-  LOG(INFO) << "pid(" << getpid() <<  "): HTTP server exiting ...";
+  LOG(INFO) << "pid(" << getpid() << "): HTTP server exiting ...";
   exit(RC_OK);
 }
 
-
 // Generates an HTTP response with payload corresponding to requested offsets
 // and length.  Optionally, truncate the payload at a given length and add a
 // pause midway through the transfer.  Returns the total number of bytes
 // delivered or -1 for error.
-ssize_t HandleGet(int fd, const HttpRequest& request, const size_t total_length,
-                  const size_t truncate_length, const int sleep_every,
+ssize_t HandleGet(int fd,
+                  const HttpRequest& request,
+                  const size_t total_length,
+                  const size_t truncate_length,
+                  const int sleep_every,
                   const int sleep_secs) {
   ssize_t ret;
   size_t written = 0;
@@ -301,14 +308,14 @@
                  << ") exceeds total length (" << total_length
                  << "), generating error response ("
                  << kHttpResponseReqRangeNotSat << ")";
-    return WriteHeaders(fd, total_length, total_length,
-                        kHttpResponseReqRangeNotSat);
+    return WriteHeaders(
+        fd, total_length, total_length, kHttpResponseReqRangeNotSat);
   }
 
   // Obtain end offset, adjust to fit in total payload length and ensure it does
   // not preceded the start offset.
-  size_t end_offset = (request.end_offset > 0 ?
-                       request.end_offset : total_length);
+  size_t end_offset =
+      (request.end_offset > 0 ? request.end_offset : total_length);
   if (end_offset < start_offset) {
     LOG(WARNING) << "end offset (" << end_offset << ") precedes start offset ("
                  << start_offset << "), generating error response";
@@ -324,8 +331,8 @@
   LOG(INFO) << "generating response header: range=" << start_offset << "-"
             << (end_offset - 1) << "/" << (end_offset - start_offset)
             << ", return code=" << request.return_code;
-  if ((ret = WriteHeaders(fd, start_offset, end_offset,
-                          request.return_code)) < 0)
+  if ((ret = WriteHeaders(fd, start_offset, end_offset, request.return_code)) <
+      0)
     return -1;
   LOG(INFO) << ret << " header bytes written";
   written += ret;
@@ -371,7 +378,8 @@
   return written;
 }
 
-ssize_t HandleGet(int fd, const HttpRequest& request,
+ssize_t HandleGet(int fd,
+                  const HttpRequest& request,
                   const size_t total_length) {
   return HandleGet(fd, request, total_length, 0, 0, 0);
 }
@@ -388,15 +396,15 @@
   HttpResponseCode code = StringToHttpResponseCode(url.c_str());
   url.erase(0, url_start);
   url = "http://" + request.host + url;
-  const char *status = GetHttpResponseDescription(code);
+  const char* status = GetHttpResponseDescription(code);
   if (!status)
     CHECK(false) << "Unrecognized redirection code: " << code;
   LOG(INFO) << "Code: " << code << " " << status;
   LOG(INFO) << "New URL: " << url;
 
   ssize_t ret;
-  if ((ret = WriteString(fd, "HTTP/1.1 " + Itoa(code) + " " +
-                         status + EOL)) < 0)
+  if ((ret = WriteString(fd, "HTTP/1.1 " + Itoa(code) + " " + status + EOL)) <
+      0)
     return;
   WriteString(fd, "Location: " + url + EOL);
 }
@@ -425,8 +433,10 @@
 // Generate an error response if the requested offset is nonzero, up to a given
 // maximal number of successive failures.  The error generated is an "Internal
 // Server Error" (500).
-ssize_t HandleErrorIfOffset(int fd, const HttpRequest& request,
-                            size_t end_offset, int max_fails) {
+ssize_t HandleErrorIfOffset(int fd,
+                            const HttpRequest& request,
+                            size_t end_offset,
+                            int max_fails) {
   static int num_fails = 0;
 
   if (request.start_offset > 0 && num_fails < max_fails) {
@@ -437,8 +447,8 @@
 
     const string data("This is an error page.");
 
-    if ((ret = WriteHeaders(fd, 0, data.size(),
-                            kHttpResponseInternalServerError)) < 0)
+    if ((ret = WriteHeaders(
+             fd, 0, data.size(), kHttpResponseInternalServerError)) < 0)
       return -1;
     written += ret;
 
@@ -464,7 +474,8 @@
 void HandleHang(int fd) {
   LOG(INFO) << "Hanging until the other side of the connection is closed.";
   char c;
-  while (HANDLE_EINTR(read(fd, &c, 1)) > 0) {}
+  while (HANDLE_EINTR(read(fd, &c, 1)) > 0) {
+  }
 }
 
 void HandleDefault(int fd, const HttpRequest& request) {
@@ -475,36 +486,33 @@
 
   if ((ret = WriteHeaders(fd, start_offset, size, request.return_code)) < 0)
     return;
-  WriteString(fd, (start_offset < static_cast<off_t>(size) ?
-                   data.substr(start_offset) : ""));
+  WriteString(
+      fd,
+      (start_offset < static_cast<off_t>(size) ? data.substr(start_offset)
+                                               : ""));
 }
 
-
 // Break a URL into terms delimited by slashes.
 class UrlTerms {
  public:
-  UrlTerms(const string &url, size_t num_terms) {
+  UrlTerms(const string& url, size_t num_terms) {
     // URL must be non-empty and start with a slash.
     CHECK_GT(url.size(), static_cast<size_t>(0));
     CHECK_EQ(url[0], '/');
 
     // Split it into terms delimited by slashes, omitting the preceding slash.
-    terms = base::SplitString(url.substr(1), "/", base::KEEP_WHITESPACE,
-                              base::SPLIT_WANT_ALL);
+    terms = base::SplitString(
+        url.substr(1), "/", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
 
     // Ensure expected length.
     CHECK_EQ(terms.size(), num_terms);
   }
 
-  inline const string& Get(const off_t index) const {
-    return terms[index];
-  }
-  inline const char *GetCStr(const off_t index) const {
+  inline const string& Get(const off_t index) const { return terms[index]; }
+  inline const char* GetCStr(const off_t index) const {
     return Get(index).c_str();
   }
-  inline int GetInt(const off_t index) const {
-    return atoi(GetCStr(index));
-  }
+  inline int GetInt(const off_t index) const { return atoi(GetCStr(index)); }
   inline size_t GetSizeT(const off_t index) const {
     return static_cast<size_t>(atol(GetCStr(index)));
   }
@@ -517,8 +525,8 @@
   HttpRequest request;
   ParseRequest(fd, &request);
 
-  string &url = request.url;
-  LOG(INFO) << "pid(" << getpid() <<  "): handling url " << url;
+  string& url = request.url;
+  LOG(INFO) << "pid(" << getpid() << "): handling url " << url;
   if (url == "/quitquitquit") {
     HandleQuit(fd);
   } else if (base::StartsWith(
@@ -527,14 +535,18 @@
     HandleGet(fd, request, terms.GetSizeT(1));
   } else if (base::StartsWith(url, "/flaky/", base::CompareCase::SENSITIVE)) {
     const UrlTerms terms(url, 5);
-    HandleGet(fd, request, terms.GetSizeT(1), terms.GetSizeT(2),
-              terms.GetInt(3), terms.GetInt(4));
+    HandleGet(fd,
+              request,
+              terms.GetSizeT(1),
+              terms.GetSizeT(2),
+              terms.GetInt(3),
+              terms.GetInt(4));
   } else if (url.find("/redirect/") == 0) {
     HandleRedirect(fd, request);
   } else if (url == "/error") {
     HandleError(fd, request);
-  } else if (base::StartsWith(url, "/error-if-offset/",
-                              base::CompareCase::SENSITIVE)) {
+  } else if (base::StartsWith(
+                 url, "/error-if-offset/", base::CompareCase::SENSITIVE)) {
     const UrlTerms terms(url, 3);
     HandleErrorIfOffset(fd, request, terms.GetSizeT(1), terms.GetInt(2));
   } else if (url == "/echo-headers") {
@@ -552,15 +564,14 @@
 
 using namespace chromeos_update_engine;  // NOLINT(build/namespaces)
 
-
-void usage(const char *prog_arg) {
-  fprintf(
-      stderr,
-      "Usage: %s [ FILE ]\n"
-      "Once accepting connections, the following is written to FILE (or "
-      "stdout):\n"
-      "\"%sN\" (where N is an integer port number)\n",
-      basename(prog_arg), kListeningMsgPrefix);
+void usage(const char* prog_arg) {
+  fprintf(stderr,
+          "Usage: %s [ FILE ]\n"
+          "Once accepting connections, the following is written to FILE (or "
+          "stdout):\n"
+          "\"%sN\" (where N is an integer port number)\n",
+          basename(prog_arg),
+          kListeningMsgPrefix);
 }
 
 int main(int argc, char** argv) {
@@ -594,15 +605,16 @@
   {
     // Get rid of "Address in use" error
     int tr = 1;
-    if (setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &tr,
-                   sizeof(int)) == -1) {
+    if (setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &tr, sizeof(int)) ==
+        -1) {
       perror("setsockopt");
       exit(RC_ERR_SETSOCKOPT);
     }
   }
 
   // Bind the socket and set for listening.
-  if (bind(listen_fd, reinterpret_cast<struct sockaddr *>(&server_addr),
+  if (bind(listen_fd,
+           reinterpret_cast<struct sockaddr*>(&server_addr),
            sizeof(server_addr)) < 0) {
     perror("bind");
     exit(RC_ERR_BIND);
@@ -615,7 +627,8 @@
   // Check the actual port.
   struct sockaddr_in bound_addr = sockaddr_in();
   socklen_t bound_addr_len = sizeof(bound_addr);
-  if (getsockname(listen_fd, reinterpret_cast<struct sockaddr*>(&bound_addr),
+  if (getsockname(listen_fd,
+                  reinterpret_cast<struct sockaddr*>(&bound_addr),
                   &bound_addr_len) < 0) {
     perror("getsockname");
     exit(RC_ERR_GETSOCKNAME);
@@ -638,7 +651,7 @@
     close(report_fd);
 
   while (1) {
-    LOG(INFO) << "pid(" << getpid() <<  "): waiting to accept new connection";
+    LOG(INFO) << "pid(" << getpid() << "): waiting to accept new connection";
     int client_fd = accept(listen_fd, nullptr, nullptr);
     LOG(INFO) << "got past accept";
     if (client_fd < 0)
diff --git a/testrunner.cc b/testrunner.cc
index 81d4548..db0b347 100644
--- a/testrunner.cc
+++ b/testrunner.cc
@@ -26,7 +26,7 @@
 #include "update_engine/common/terminator.h"
 #include "update_engine/payload_generator/xz.h"
 
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
   LOG(INFO) << "started";
   base::AtExitManager exit_manager;
   // xz-embedded requires to initialize its CRC-32 table once on startup.
diff --git a/update_attempter.cc b/update_attempter.cc
index 5f32312..ee571db 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -72,11 +72,11 @@
 using base::TimeDelta;
 using base::TimeTicks;
 using brillo::MessageLoop;
+using chromeos_update_manager::CalculateStagingCase;
 using chromeos_update_manager::EvalStatus;
 using chromeos_update_manager::Policy;
-using chromeos_update_manager::UpdateCheckParams;
-using chromeos_update_manager::CalculateStagingCase;
 using chromeos_update_manager::StagingCase;
+using chromeos_update_manager::UpdateCheckParams;
 using std::string;
 using std::vector;
 using update_engine::UpdateAttemptFlags;
@@ -100,10 +100,6 @@
 const char kScheduledAUTestURLRequest[] = "autest-scheduled";
 }  // namespace
 
-// Turns a generic ErrorCode::kError to a generic error code specific
-// to |action| (e.g., ErrorCode::kFilesystemVerifierError). If |code| is
-// not ErrorCode::kError, or the action is not matched, returns |code|
-// unchanged.
 ErrorCode GetErrorCodeForAction(AbstractAction* action, ErrorCode code) {
   if (code != ErrorCode::kError)
     return code;
@@ -162,8 +158,8 @@
   chromeos_update_manager::UpdateManager* const update_manager =
       system_state_->update_manager();
   CHECK(update_manager);
-  Callback<void(EvalStatus, const UpdateCheckParams&)> callback = Bind(
-      &UpdateAttempter::OnUpdateScheduled, base::Unretained(this));
+  Callback<void(EvalStatus, const UpdateCheckParams&)> callback =
+      Bind(&UpdateAttempter::OnUpdateScheduled, base::Unretained(this));
   // We limit the async policy request to a reasonably short time, to avoid a
   // starvation due to a transient bug.
   update_manager->AsyncPolicyRequest(callback, &Policy::UpdateCheckAllowed);
@@ -193,7 +189,7 @@
                    << "is wrong.";
       // In this case, report daily metrics to reset.
     } else {
-      if (time_reported_since.InSeconds() < 24*60*60) {
+      if (time_reported_since.InSeconds() < 24 * 60 * 60) {
         LOG(INFO) << "Last reported daily metrics "
                   << utils::FormatTimeDelta(time_reported_since) << " ago.";
         return false;
@@ -388,9 +384,7 @@
     }
   }
 
-  if (!omaha_request_params_->Init(app_version,
-                                   omaha_url,
-                                   interactive)) {
+  if (!omaha_request_params_->Init(app_version, omaha_url, interactive)) {
     LOG(ERROR) << "Unable to initialize Omaha request params.";
     return false;
   }
@@ -403,8 +397,8 @@
     // Pass in false for powerwash_allowed until we add it to the policy
     // protobuf.
     string error_message;
-    if (!omaha_request_params_->SetTargetChannel(target_channel, false,
-                                                 &error_message)) {
+    if (!omaha_request_params_->SetTargetChannel(
+            target_channel, false, &error_message)) {
       LOG(ERROR) << "Setting the channel failed: " << error_message;
     }
 
@@ -430,8 +424,9 @@
             << omaha_request_params_->wall_clock_based_wait_enabled()
             << ", Update Check Count Wait Enabled = "
             << omaha_request_params_->update_check_count_wait_enabled()
-            << ", Waiting Period = " << utils::FormatSecs(
-               omaha_request_params_->waiting_period().InSeconds());
+            << ", Waiting Period = "
+            << utils::FormatSecs(
+                   omaha_request_params_->waiting_period().InSeconds());
 
   LOG(INFO) << "Use p2p For Downloading = "
             << payload_state->GetUsingP2PForDownloading()
@@ -451,9 +446,9 @@
   } else if (base::RandInt(0, 4) == 0) {
     obeying_proxies_ = false;
   }
-  LOG_IF(INFO, !obeying_proxies_) << "To help ensure updates work, this update "
-      "check we are ignoring the proxy settings and using "
-      "direct connections.";
+  LOG_IF(INFO, !obeying_proxies_)
+      << "To help ensure updates work, this update check we are ignoring the "
+      << "proxy settings and using direct connections.";
 
   DisableDeltaUpdateIfNeeded();
   return true;
@@ -468,7 +463,7 @@
     int64_t new_scatter_factor_in_secs = 0;
     device_policy->GetScatterFactorInSeconds(&new_scatter_factor_in_secs);
     if (new_scatter_factor_in_secs < 0)  // sanitize input, just in case.
-      new_scatter_factor_in_secs  = 0;
+      new_scatter_factor_in_secs = 0;
     scatter_factor_ = TimeDelta::FromSeconds(new_scatter_factor_in_secs);
   }
 
@@ -509,10 +504,10 @@
         // generating a new random value to improve the chances of a good
         // distribution for scattering.
         omaha_request_params_->set_waiting_period(
-          TimeDelta::FromSeconds(wait_period_in_secs));
-        LOG(INFO) << "Using persisted wall-clock waiting period: " <<
-            utils::FormatSecs(
-                omaha_request_params_->waiting_period().InSeconds());
+            TimeDelta::FromSeconds(wait_period_in_secs));
+        LOG(INFO) << "Using persisted wall-clock waiting period: "
+                  << utils::FormatSecs(
+                         omaha_request_params_->waiting_period().InSeconds());
       } else {
         // This means there's no persisted value for the waiting period
         // available or its value is invalid given the new scatter_factor value.
@@ -532,9 +527,9 @@
     } else {
       // Neither the first time scattering is enabled nor the scattering value
       // changed. Nothing to do.
-      LOG(INFO) << "Keeping current wall-clock waiting period: " <<
-          utils::FormatSecs(
-              omaha_request_params_->waiting_period().InSeconds());
+      LOG(INFO) << "Keeping current wall-clock waiting period: "
+                << utils::FormatSecs(
+                       omaha_request_params_->waiting_period().InSeconds());
     }
 
     // The invariant at this point is that omaha_request_params_->waiting_period
@@ -550,7 +545,7 @@
     // the update check count value, we'll turn that on as well.
     bool decrement_succeeded = DecrementUpdateCheckCount();
     omaha_request_params_->set_update_check_count_wait_enabled(
-      decrement_succeeded);
+        decrement_succeeded);
   } else {
     // This means the scattering feature is turned off or disabled for
     // this particular update check. Make sure to disable
@@ -569,11 +564,12 @@
 }
 
 void UpdateAttempter::GenerateNewWaitingPeriod() {
-  omaha_request_params_->set_waiting_period(TimeDelta::FromSeconds(
-      base::RandInt(1, scatter_factor_.InSeconds())));
+  omaha_request_params_->set_waiting_period(
+      TimeDelta::FromSeconds(base::RandInt(1, scatter_factor_.InSeconds())));
 
-  LOG(INFO) << "Generated new wall-clock waiting period: " << utils::FormatSecs(
-                omaha_request_params_->waiting_period().InSeconds());
+  LOG(INFO) << "Generated new wall-clock waiting period: "
+            << utils::FormatSecs(
+                   omaha_request_params_->waiting_period().InSeconds());
 
   // Do a best-effort to persist this in all cases. Even if the persistence
   // fails, we'll still be able to scatter based on our in-memory value.
@@ -1013,7 +1009,7 @@
       return;
     }
     LOG(INFO) << "Booted from FW B and tried to install new firmware, "
-        "so requesting reboot from user.";
+                 "so requesting reboot from user.";
   }
 
   attempt_error_code_ = utils::GetBaseErrorCode(code);
@@ -1267,7 +1263,7 @@
       // no-op.
       return true;
 
-    case UpdateStatus::UPDATED_NEED_REBOOT:  {
+    case UpdateStatus::UPDATED_NEED_REBOOT: {
       bool ret_value = true;
       status_ = UpdateStatus::IDLE;
 
@@ -1285,7 +1281,7 @@
       // Mark the current slot as successful again, since marking it as active
       // may reset the successful bit. We ignore the result of whether marking
       // the current slot as successful worked.
-      if (!boot_control->MarkBootSuccessfulAsync(Bind([](bool successful){})))
+      if (!boot_control->MarkBootSuccessfulAsync(Bind([](bool successful) {})))
         ret_value = false;
 
       // Notify the PayloadState that the successful payload was canceled.
@@ -1330,7 +1326,7 @@
   last_notify_time_ = TimeTicks::Now();
 }
 
-uint32_t UpdateAttempter::GetErrorCodeFlags()  {
+uint32_t UpdateAttempter::GetErrorCodeFlags() {
   uint32_t flags = 0;
 
   if (!system_state_->hardware()->IsNormalBootMode())
@@ -1399,11 +1395,10 @@
   fake_update_success_ = code == ErrorCode::kPostinstallBootedFromFirmwareB;
 
   // Compute the final error code with all the bit flags to be sent to Omaha.
-  code = static_cast<ErrorCode>(
-      static_cast<uint32_t>(code) | GetErrorCodeFlags());
-  error_event_.reset(new OmahaEvent(OmahaEvent::kTypeUpdateComplete,
-                                    event_result,
-                                    code));
+  code =
+      static_cast<ErrorCode>(static_cast<uint32_t>(code) | GetErrorCodeFlags());
+  error_event_.reset(
+      new OmahaEvent(OmahaEvent::kTypeUpdateComplete, event_result, code));
 }
 
 bool UpdateAttempter::ScheduleErrorEventAction() {
@@ -1497,7 +1492,6 @@
   ScheduleUpdates();
 }
 
-
 bool UpdateAttempter::DecrementUpdateCheckCount() {
   int64_t update_check_count_value;
 
@@ -1546,7 +1540,6 @@
   return false;
 }
 
-
 void UpdateAttempter::UpdateEngineStarted() {
   // If we just booted into a new update, keep the previous OS version
   // in case we rebooted because of a crash of the old version, so we
@@ -1607,7 +1600,7 @@
   return true;
 }
 
-bool UpdateAttempter::GetBootTimeAtUpdate(Time *out_boot_time) {
+bool UpdateAttempter::GetBootTimeAtUpdate(Time* out_boot_time) {
   // In case of an update_engine restart without a reboot, we stored the boot_id
   // when the update was completed by setting a pref, so we can check whether
   // the last update was on this boot or a previous one.
diff --git a/update_attempter.h b/update_attempter.h
index af62ba6..c27f8a4 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -186,7 +186,7 @@
   // Stores in |out_boot_time| the boottime (CLOCK_BOOTTIME) recorded at the
   // time of the last successful update in the current boot. Returns false if
   // there wasn't a successful update in the current boot.
-  virtual bool GetBootTimeAtUpdate(base::Time *out_boot_time);
+  virtual bool GetBootTimeAtUpdate(base::Time* out_boot_time);
 
   // Returns a version OS version that was being used before the last reboot,
   // and if that reboot happened to be into an update (current version).
@@ -521,6 +521,13 @@
   DISALLOW_COPY_AND_ASSIGN(UpdateAttempter);
 };
 
+// Turns a generic ErrorCode::kError to a generic error code specific
+// to |action| (e.g., ErrorCode::kFilesystemVerifierError). If |code| is
+// not ErrorCode::kError, or the action is not matched, returns |code|
+// unchanged.
+
+ErrorCode GetErrorCodeForAction(AbstractAction* action, ErrorCode code);
+
 }  // namespace chromeos_update_engine
 
 #endif  // UPDATE_ENGINE_UPDATE_ATTEMPTER_H_
diff --git a/update_attempter_android.cc b/update_attempter_android.cc
index a3974ab..c738e4e 100644
--- a/update_attempter_android.cc
+++ b/update_attempter_android.cc
@@ -317,7 +317,7 @@
     case UpdateStatus::IDLE:
       return true;
 
-    case UpdateStatus::UPDATED_NEED_REBOOT:  {
+    case UpdateStatus::UPDATED_NEED_REBOOT: {
       // Remove the reboot marker so that if the machine is rebooted
       // after resetting to idle state, it doesn't go back to
       // UpdateStatus::UPDATED_NEED_REBOOT state.
@@ -331,14 +331,12 @@
       // Mark the current slot as successful again, since marking it as active
       // may reset the successful bit. We ignore the result of whether marking
       // the current slot as successful worked.
-      if (!boot_control_->MarkBootSuccessfulAsync(Bind([](bool successful){})))
+      if (!boot_control_->MarkBootSuccessfulAsync(Bind([](bool successful) {})))
         ret_value = false;
 
       if (!ret_value) {
         return LogAndSetError(
-            error,
-            FROM_HERE,
-            "Failed to reset the status to ");
+            error, FROM_HERE, "Failed to reset the status to ");
       }
 
       SetStatusAndNotify(UpdateStatus::IDLE);
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index 3209f15..579c736 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -201,9 +201,7 @@
   bool actual_using_p2p_for_downloading() {
     return actual_using_p2p_for_downloading_;
   }
-  bool actual_using_p2p_for_sharing() {
-    return actual_using_p2p_for_sharing_;
-  }
+  bool actual_using_p2p_for_sharing() { return actual_using_p2p_for_sharing_; }
 
   base::MessageLoopForIO base_loop_;
   brillo::BaseMessageLoop loop_{&base_loop_};
@@ -338,8 +336,8 @@
 TEST_F(UpdateAttempterTest, ActionCompletedOmahaRequestTest) {
   unique_ptr<MockHttpFetcher> fetcher(new MockHttpFetcher("", 0, nullptr));
   fetcher->FailTransfer(500);  // Sets the HTTP response code.
-  OmahaRequestAction action(&fake_system_state_, nullptr,
-                            std::move(fetcher), false);
+  OmahaRequestAction action(
+      &fake_system_state_, nullptr, std::move(fetcher), false);
   ObjectCollectorAction<OmahaResponse> collector_action;
   BondActions(&action, &collector_action);
   OmahaResponse response;
@@ -364,29 +362,27 @@
 }
 
 TEST_F(UpdateAttempterTest, GetErrorCodeForActionTest) {
-  extern ErrorCode GetErrorCodeForAction(AbstractAction* action,
-                                              ErrorCode code);
   EXPECT_EQ(ErrorCode::kSuccess,
             GetErrorCodeForAction(nullptr, ErrorCode::kSuccess));
 
   FakeSystemState fake_system_state;
-  OmahaRequestAction omaha_request_action(&fake_system_state, nullptr,
-                                          nullptr, false);
+  OmahaRequestAction omaha_request_action(
+      &fake_system_state, nullptr, nullptr, false);
   EXPECT_EQ(ErrorCode::kOmahaRequestError,
             GetErrorCodeForAction(&omaha_request_action, ErrorCode::kError));
   OmahaResponseHandlerAction omaha_response_handler_action(&fake_system_state_);
-  EXPECT_EQ(ErrorCode::kOmahaResponseHandlerError,
-            GetErrorCodeForAction(&omaha_response_handler_action,
-                                  ErrorCode::kError));
+  EXPECT_EQ(
+      ErrorCode::kOmahaResponseHandlerError,
+      GetErrorCodeForAction(&omaha_response_handler_action, ErrorCode::kError));
   FilesystemVerifierAction filesystem_verifier_action;
-  EXPECT_EQ(ErrorCode::kFilesystemVerifierError,
-            GetErrorCodeForAction(&filesystem_verifier_action,
-                                  ErrorCode::kError));
+  EXPECT_EQ(
+      ErrorCode::kFilesystemVerifierError,
+      GetErrorCodeForAction(&filesystem_verifier_action, ErrorCode::kError));
   PostinstallRunnerAction postinstall_runner_action(
       fake_system_state.fake_boot_control(), fake_system_state.fake_hardware());
-  EXPECT_EQ(ErrorCode::kPostinstallRunnerError,
-            GetErrorCodeForAction(&postinstall_runner_action,
-                                  ErrorCode::kError));
+  EXPECT_EQ(
+      ErrorCode::kPostinstallRunnerError,
+      GetErrorCodeForAction(&postinstall_runner_action, ErrorCode::kError));
   MockAction action_mock;
   EXPECT_CALL(action_mock, Type()).WillOnce(Return("MockAction"));
   EXPECT_EQ(ErrorCode::kError,
@@ -400,15 +396,15 @@
   attempter_.DisableDeltaUpdateIfNeeded();
   EXPECT_TRUE(attempter_.omaha_request_params_->delta_okay());
   EXPECT_CALL(*prefs_, GetInt64(kPrefsDeltaUpdateFailures, _))
-      .WillOnce(DoAll(
-          SetArgPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures - 1),
-          Return(true)));
+      .WillOnce(
+          DoAll(SetArgPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures - 1),
+                Return(true)));
   attempter_.DisableDeltaUpdateIfNeeded();
   EXPECT_TRUE(attempter_.omaha_request_params_->delta_okay());
   EXPECT_CALL(*prefs_, GetInt64(kPrefsDeltaUpdateFailures, _))
-      .WillOnce(DoAll(
-          SetArgPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures),
-          Return(true)));
+      .WillOnce(
+          DoAll(SetArgPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures),
+                Return(true)));
   attempter_.DisableDeltaUpdateIfNeeded();
   EXPECT_FALSE(attempter_.omaha_request_params_->delta_okay());
   EXPECT_CALL(*prefs_, GetInt64(_, _)).Times(0);
@@ -421,16 +417,17 @@
       .WillOnce(Return(false))
       .WillOnce(DoAll(SetArgPointee<1>(-1), Return(true)))
       .WillOnce(DoAll(SetArgPointee<1>(1), Return(true)))
-      .WillOnce(DoAll(
-          SetArgPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures),
-          Return(true)));
+      .WillOnce(
+          DoAll(SetArgPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures),
+                Return(true)));
   EXPECT_CALL(*prefs_, SetInt64(Ne(kPrefsDeltaUpdateFailures), _))
       .WillRepeatedly(Return(true));
   EXPECT_CALL(*prefs_, SetInt64(kPrefsDeltaUpdateFailures, 1)).Times(2);
   EXPECT_CALL(*prefs_, SetInt64(kPrefsDeltaUpdateFailures, 2));
-  EXPECT_CALL(*prefs_, SetInt64(kPrefsDeltaUpdateFailures,
-                               UpdateAttempter::kMaxDeltaUpdateFailures + 1));
-  for (int i = 0; i < 4; i ++)
+  EXPECT_CALL(*prefs_,
+              SetInt64(kPrefsDeltaUpdateFailures,
+                       UpdateAttempter::kMaxDeltaUpdateFailures + 1));
+  for (int i = 0; i < 4; i++)
     attempter_.MarkDeltaUpdateFailure();
 }
 
@@ -456,9 +453,8 @@
   EXPECT_CALL(*processor_, StartProcessing());
   ErrorCode err = ErrorCode::kError;
   EXPECT_CALL(*fake_system_state_.mock_payload_state(), UpdateFailed(err));
-  attempter_.error_event_.reset(new OmahaEvent(OmahaEvent::kTypeUpdateComplete,
-                                               OmahaEvent::kResultError,
-                                               err));
+  attempter_.error_event_.reset(new OmahaEvent(
+      OmahaEvent::kTypeUpdateComplete, OmahaEvent::kResultError, err));
   attempter_.ScheduleErrorEventAction();
   EXPECT_EQ(UpdateStatus::REPORTING_ERROR_EVENT, attempter_.status());
 }
@@ -477,9 +473,10 @@
     OmahaRequestAction::StaticType()};
 
 // Actions that will be built as part of a user-initiated rollback.
-const string kRollbackActionTypes[] = {  // NOLINT(runtime/string)
-  InstallPlanAction::StaticType(),
-  PostinstallRunnerAction::StaticType(),
+const string kRollbackActionTypes[] = {
+    // NOLINT(runtime/string)
+    InstallPlanAction::StaticType(),
+    PostinstallRunnerAction::StaticType(),
 };
 
 const StagingSchedule kValidStagingSchedule = {
@@ -494,7 +491,8 @@
   // point by calling RefreshDevicePolicy.
   auto device_policy = std::make_unique<policy::MockDevicePolicy>();
   EXPECT_CALL(*device_policy, LoadPolicy())
-      .Times(testing::AtLeast(1)).WillRepeatedly(Return(true));
+      .Times(testing::AtLeast(1))
+      .WillRepeatedly(Return(true));
   attempter_.policy_provider_.reset(
       new policy::PolicyProvider(std::move(device_policy)));
 
@@ -521,22 +519,21 @@
   loop_.BreakLoop();
 }
 
-void UpdateAttempterTest::RollbackTestStart(
-    bool enterprise_rollback, bool valid_slot) {
+void UpdateAttempterTest::RollbackTestStart(bool enterprise_rollback,
+                                            bool valid_slot) {
   // Create a device policy so that we can change settings.
   auto device_policy = std::make_unique<policy::MockDevicePolicy>();
   EXPECT_CALL(*device_policy, LoadPolicy()).WillRepeatedly(Return(true));
   fake_system_state_.set_device_policy(device_policy.get());
   if (enterprise_rollback) {
     // We return an empty owner as this is an enterprise.
-    EXPECT_CALL(*device_policy, GetOwner(_)).WillRepeatedly(
-        DoAll(SetArgPointee<0>(string("")),
-        Return(true)));
+    EXPECT_CALL(*device_policy, GetOwner(_))
+        .WillRepeatedly(DoAll(SetArgPointee<0>(string("")), Return(true)));
   } else {
     // We return a fake owner as this is an owned consumer device.
-    EXPECT_CALL(*device_policy, GetOwner(_)).WillRepeatedly(
-        DoAll(SetArgPointee<0>(string("[email protected]")),
-        Return(true)));
+    EXPECT_CALL(*device_policy, GetOwner(_))
+        .WillRepeatedly(DoAll(SetArgPointee<0>(string("[email protected]")),
+                              Return(true)));
   }
 
   attempter_.policy_provider_.reset(
@@ -555,7 +552,7 @@
   // We only allow rollback on devices that are not enterprise enrolled and
   // which have a valid slot to rollback to.
   if (!enterprise_rollback && valid_slot) {
-     is_rollback_allowed = true;
+    is_rollback_allowed = true;
   }
 
   if (is_rollback_allowed) {
@@ -595,7 +592,8 @@
   loop_.PostTask(FROM_HERE,
                  base::Bind(&UpdateAttempterTest::RollbackTestStart,
                             base::Unretained(this),
-                            false, true));
+                            false,
+                            true));
   loop_.Run();
 }
 
@@ -603,7 +601,8 @@
   loop_.PostTask(FROM_HERE,
                  base::Bind(&UpdateAttempterTest::RollbackTestStart,
                             base::Unretained(this),
-                            false, false));
+                            false,
+                            false));
   loop_.Run();
 }
 
@@ -611,7 +610,8 @@
   loop_.PostTask(FROM_HERE,
                  base::Bind(&UpdateAttempterTest::RollbackTestStart,
                             base::Unretained(this),
-                            true, true));
+                            true,
+                            true));
   loop_.Run();
 }
 
@@ -661,10 +661,9 @@
   EXPECT_EQ(OmahaEvent::kTypeUpdateComplete, attempter_.error_event_->type);
   EXPECT_EQ(OmahaEvent::kResultError, attempter_.error_event_->result);
   EXPECT_EQ(
-      static_cast<ErrorCode>(
-          static_cast<int>(kCode) |
-          static_cast<int>(ErrorCode::kResumedFlag) |
-          static_cast<int>(ErrorCode::kTestOmahaUrlFlag)),
+      static_cast<ErrorCode>(static_cast<int>(kCode) |
+                             static_cast<int>(ErrorCode::kResumedFlag) |
+                             static_cast<int>(ErrorCode::kTestOmahaUrlFlag)),
       attempter_.error_event_->error_code);
 }
 
@@ -827,9 +826,8 @@
   fake_system_state_.set_device_policy(device_policy.get());
 
   EXPECT_CALL(*device_policy, GetScatterFactorInSeconds(_))
-      .WillRepeatedly(DoAll(
-          SetArgPointee<0>(scatter_factor_in_seconds),
-          Return(true)));
+      .WillRepeatedly(
+          DoAll(SetArgPointee<0>(scatter_factor_in_seconds), Return(true)));
 
   attempter_.policy_provider_.reset(
       new policy::PolicyProvider(std::move(device_policy)));
@@ -866,9 +864,8 @@
   fake_system_state_.set_device_policy(device_policy.get());
 
   EXPECT_CALL(*device_policy, GetScatterFactorInSeconds(_))
-      .WillRepeatedly(DoAll(
-          SetArgPointee<0>(scatter_factor_in_seconds),
-          Return(true)));
+      .WillRepeatedly(
+          DoAll(SetArgPointee<0>(scatter_factor_in_seconds), Return(true)));
 
   attempter_.policy_provider_.reset(
       new policy::PolicyProvider(std::move(device_policy)));
@@ -898,9 +895,11 @@
 }
 
 TEST_F(UpdateAttempterTest, NoScatteringDoneDuringManualUpdateTestStart) {
-  loop_.PostTask(FROM_HERE, base::Bind(
-      &UpdateAttempterTest::NoScatteringDoneDuringManualUpdateTestStart,
-      base::Unretained(this)));
+  loop_.PostTask(
+      FROM_HERE,
+      base::Bind(
+          &UpdateAttempterTest::NoScatteringDoneDuringManualUpdateTestStart,
+          base::Unretained(this)));
   loop_.Run();
 }
 
@@ -927,9 +926,8 @@
   fake_system_state_.set_device_policy(device_policy.get());
 
   EXPECT_CALL(*device_policy, GetScatterFactorInSeconds(_))
-      .WillRepeatedly(DoAll(
-          SetArgPointee<0>(scatter_factor_in_seconds),
-          Return(true)));
+      .WillRepeatedly(
+          DoAll(SetArgPointee<0>(scatter_factor_in_seconds), Return(true)));
 
   attempter_.policy_provider_.reset(
       new policy::PolicyProvider(std::move(device_policy)));
diff --git a/update_engine_client.cc b/update_engine_client.cc
index f36949b..7446041 100644
--- a/update_engine_client.cc
+++ b/update_engine_client.cc
@@ -61,15 +61,15 @@
 
 class UpdateEngineClient : public brillo::Daemon {
  public:
-  UpdateEngineClient(int argc, char** argv) : argc_(argc), argv_(argv) {
-  }
+  UpdateEngineClient(int argc, char** argv) : argc_(argc), argv_(argv) {}
 
   ~UpdateEngineClient() override = default;
 
  protected:
   int OnInit() override {
     int ret = Daemon::OnInit();
-    if (ret != EX_OK) return ret;
+    if (ret != EX_OK)
+      return ret;
 
     client_ = update_engine::UpdateEngineClient::CreateInstance();
 
@@ -140,8 +140,11 @@
 };
 
 void WatchingStatusUpdateHandler::HandleStatusUpdate(
-    int64_t last_checked_time, double progress, UpdateStatus current_operation,
-    const string& new_version, int64_t new_size) {
+    int64_t last_checked_time,
+    double progress,
+    UpdateStatus current_operation,
+    const string& new_version,
+    int64_t new_size) {
   LOG(INFO) << "Got status update:";
   LOG(INFO) << "  last_checked_time: " << last_checked_time;
   LOG(INFO) << "  progress: " << progress;
@@ -160,8 +163,11 @@
 
   int retry_count = kShowStatusRetryCount;
   while (retry_count > 0) {
-    if (client_->GetStatus(&last_checked_time, &progress, &current_op,
-                           &new_version, &new_size)) {
+    if (client_->GetStatus(&last_checked_time,
+                           &progress,
+                           &current_op,
+                           &new_version,
+                           &new_size)) {
       break;
     }
     if (--retry_count == 0) {
@@ -175,8 +181,11 @@
   printf("LAST_CHECKED_TIME=%" PRIi64
          "\nPROGRESS=%f\nCURRENT_OP=%s\n"
          "NEW_VERSION=%s\nNEW_SIZE=%" PRIi64 "\n",
-         last_checked_time, progress, UpdateStatusToString(current_op),
-         new_version.c_str(), new_size);
+         last_checked_time,
+         progress,
+         UpdateStatusToString(current_op),
+         new_version.c_str(),
+         new_size);
 
   return true;
 }
@@ -188,8 +197,11 @@
   string new_version;
   int64_t new_size = 0;
 
-  if (!client_->GetStatus(&last_checked_time, &progress, &current_op,
-                          &new_version, &new_size)) {
+  if (!client_->GetStatus(&last_checked_time,
+                          &progress,
+                          &current_op,
+                          &new_version,
+                          &new_size)) {
     return 1;
   }
 
@@ -244,54 +256,68 @@
 
 int UpdateEngineClient::ProcessFlags() {
   DEFINE_string(app_version, "", "Force the current app version.");
-  DEFINE_string(channel, "",
+  DEFINE_string(channel,
+                "",
                 "Set the target channel. The device will be powerwashed if the "
                 "target channel is more stable than the current channel unless "
                 "--nopowerwash is specified.");
   DEFINE_bool(check_for_update, false, "Initiate check for updates.");
   DEFINE_string(
       cohort_hint, "", "Set the current cohort hint to the passed value.");
-  DEFINE_bool(follow, false,
+  DEFINE_bool(follow,
+              false,
               "Wait for any update operations to complete."
               "Exit status is 0 if the update succeeded, and 1 otherwise.");
   DEFINE_bool(interactive, true, "Mark the update request as interactive.");
   DEFINE_string(omaha_url, "", "The URL of the Omaha update server.");
-  DEFINE_string(p2p_update, "",
+  DEFINE_string(p2p_update,
+                "",
                 "Enables (\"yes\") or disables (\"no\") the peer-to-peer update"
                 " sharing.");
-  DEFINE_bool(powerwash, true,
+  DEFINE_bool(powerwash,
+              true,
               "When performing rollback or channel change, "
               "do a powerwash or allow it respectively.");
   DEFINE_bool(reboot, false, "Initiate a reboot if needed.");
-  DEFINE_bool(is_reboot_needed, false,
+  DEFINE_bool(is_reboot_needed,
+              false,
               "Exit status 0 if reboot is needed, "
               "2 if reboot is not needed or 1 if an error occurred.");
-  DEFINE_bool(block_until_reboot_is_needed, false,
+  DEFINE_bool(block_until_reboot_is_needed,
+              false,
               "Blocks until reboot is "
               "needed. Returns non-zero exit status if an error occurred.");
   DEFINE_bool(reset_status, false, "Sets the status in update_engine to idle.");
-  DEFINE_bool(rollback, false,
+  DEFINE_bool(rollback,
+              false,
               "Perform a rollback to the previous partition. The device will "
               "be powerwashed unless --nopowerwash is specified.");
-  DEFINE_bool(can_rollback, false,
+  DEFINE_bool(can_rollback,
+              false,
               "Shows whether rollback partition "
               "is available.");
   DEFINE_bool(show_channel, false, "Show the current and target channels.");
   DEFINE_bool(show_cohort_hint, false, "Show the current cohort hint.");
-  DEFINE_bool(show_p2p_update, false,
+  DEFINE_bool(show_p2p_update,
+              false,
               "Show the current setting for peer-to-peer update sharing.");
-  DEFINE_bool(show_update_over_cellular, false,
+  DEFINE_bool(show_update_over_cellular,
+              false,
               "Show the current setting for updates over cellular networks.");
   DEFINE_bool(status, false, "Print the status to stdout.");
-  DEFINE_bool(update, false,
+  DEFINE_bool(update,
+              false,
               "Forces an update and waits for it to complete. "
               "Implies --follow.");
-  DEFINE_string(update_over_cellular, "",
+  DEFINE_string(update_over_cellular,
+                "",
                 "Enables (\"yes\") or disables (\"no\") the updates over "
                 "cellular networks.");
-  DEFINE_bool(watch_for_updates, false,
+  DEFINE_bool(watch_for_updates,
+              false,
               "Listen for status updates and print them to the screen.");
-  DEFINE_bool(prev_version, false,
+  DEFINE_bool(prev_version,
+              false,
               "Show the previous OS version used before the update reboot.");
   DEFINE_bool(last_attempt_error, false, "Show the last attempt error.");
   DEFINE_bool(eol_status, false, "Show the current end-of-life status.");
@@ -464,7 +490,8 @@
   bool do_update_request = FLAGS_check_for_update || FLAGS_update ||
                            !FLAGS_app_version.empty() ||
                            !FLAGS_omaha_url.empty();
-  if (FLAGS_update) FLAGS_follow = true;
+  if (FLAGS_update)
+    FLAGS_follow = true;
 
   if (do_update_request && FLAGS_rollback) {
     LOG(ERROR) << "Incompatible flags specified with rollback."
@@ -513,8 +540,8 @@
       LOG(INFO) << "Forcing an update by setting app_version to ForcedUpdate.";
     }
     LOG(INFO) << "Initiating update check and install.";
-    if (!client_->AttemptUpdate(app_version, FLAGS_omaha_url,
-                                FLAGS_interactive)) {
+    if (!client_->AttemptUpdate(
+            app_version, FLAGS_omaha_url, FLAGS_interactive)) {
       LOG(ERROR) << "Error checking for update.";
       return 1;
     }
diff --git a/update_engine_client_android.cc b/update_engine_client_android.cc
index 82a9f84..6863799 100644
--- a/update_engine_client_android.cc
+++ b/update_engine_client_android.cc
@@ -49,8 +49,7 @@
 
 class UpdateEngineClientAndroid : public brillo::Daemon {
  public:
-  UpdateEngineClientAndroid(int argc, char** argv) : argc_(argc), argv_(argv) {
-  }
+  UpdateEngineClientAndroid(int argc, char** argv) : argc_(argc), argv_(argv) {}
 
   int ExitWhenIdle(const Status& status);
   int ExitWhenIdle(int return_code);
@@ -83,8 +82,8 @@
   brillo::BinderWatcher binder_watcher_;
 };
 
-Status UpdateEngineClientAndroid::UECallback::onStatusUpdate(
-    int status_code, float progress) {
+Status UpdateEngineClientAndroid::UECallback::onStatusUpdate(int status_code,
+                                                             float progress) {
   update_engine::UpdateStatus status =
       static_cast<update_engine::UpdateStatus>(status_code);
   LOG(INFO) << "onStatusUpdate(" << UpdateStatusToString(status) << " ("
@@ -113,10 +112,12 @@
   DEFINE_string(payload,
                 "http://127.0.0.1:8080/payload",
                 "The URI to the update payload to use.");
-  DEFINE_int64(offset, 0,
+  DEFINE_int64(offset,
+               0,
                "The offset in the payload where the CrAU update starts. "
                "Used when --update is passed.");
-  DEFINE_int64(size, 0,
+  DEFINE_int64(size,
+               0,
                "The size of the CrAU part of the payload. If 0 is passed, it "
                "will be autodetected. Used when --update is passed.");
   DEFINE_string(headers,
@@ -264,7 +265,7 @@
 }  // namespace chromeos_update_engine
 
 int main(int argc, char** argv) {
-  chromeos_update_engine::internal::UpdateEngineClientAndroid client(
-      argc, argv);
+  chromeos_update_engine::internal::UpdateEngineClientAndroid client(argc,
+                                                                     argv);
   return client.Run();
 }
diff --git a/update_status_utils.cc b/update_status_utils.cc
index 5de3381..cbc4f14 100644
--- a/update_status_utils.cc
+++ b/update_status_utils.cc
@@ -52,8 +52,7 @@
   return nullptr;
 }
 
-bool StringToUpdateStatus(const std::string& s,
-                          UpdateStatus* status) {
+bool StringToUpdateStatus(const std::string& s, UpdateStatus* status) {
   if (s == update_engine::kUpdateStatusIdle) {
     *status = UpdateStatus::IDLE;
     return true;