Merge aosp/upstream-master into aosp/master.

Test: update_engine_unittests
Change-Id: I6cbf56a3644cae2d26e65d78e235ca5652a8c6e6
diff --git a/Android.bp b/Android.bp
index 906731f..dac1acd 100644
--- a/Android.bp
+++ b/Android.bp
@@ -28,6 +28,7 @@
     name: "ue_defaults",
 
     cflags: [
+        "-DBASE_VER=576279",
         "-DUSE_BINDER=1",
         "-DUSE_CHROME_NETWORK_PROXY=0",
         "-DUSE_CHROME_KIOSK_APP=0",
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/client_library/client.cc b/client_library/client.cc
index 9a42696..b05df90 100644
--- a/client_library/client.cc
+++ b/client_library/client.cc
@@ -31,13 +31,13 @@
 unique_ptr<UpdateEngineClient> UpdateEngineClient::CreateInstance() {
 #if USE_BINDER
   auto update_engine_client_impl = new internal::BinderUpdateEngineClient{};
-#else  // !USE_BINDER
+#else   // !USE_BINDER
   auto update_engine_client_impl = new internal::DBusUpdateEngineClient{};
 #endif  // USE_BINDER
   auto ret = unique_ptr<UpdateEngineClient>{update_engine_client_impl};
 
   if (!update_engine_client_impl->Init()) {
-      ret.reset();
+    ret.reset();
   }
 
   return ret;
diff --git a/client_library/client_binder.cc b/client_library/client_binder.cc
index 5c22f84..588bc64 100644
--- a/client_library/client_binder.cc
+++ b/client_library/client_binder.cc
@@ -25,12 +25,12 @@
 #include "update_engine/parcelable_update_engine_status.h"
 #include "update_engine/update_status_utils.h"
 
-using android::binder::Status;
-using android::brillo::ParcelableUpdateEngineStatus;
 using android::getService;
 using android::OK;
 using android::String16;
 using android::String8;
+using android::binder::Status;
+using android::brillo::ParcelableUpdateEngineStatus;
 using chromeos_update_engine::StringToUpdateStatus;
 using std::string;
 using update_engine::UpdateAttemptFlags;
@@ -39,10 +39,11 @@
 namespace internal {
 
 bool BinderUpdateEngineClient::Init() {
-  if (!binder_watcher_.Init()) return false;
+  if (!binder_watcher_.Init())
+    return false;
 
   return getService(String16{"android.brillo.UpdateEngineService"},
-      &service_) == OK;
+                    &service_) == OK;
 }
 
 bool BinderUpdateEngineClient::AttemptUpdate(const string& in_app_version,
@@ -172,8 +173,7 @@
 bool BinderUpdateEngineClient::RegisterStatusUpdateHandler(
     StatusUpdateHandler* handler) {
   if (!status_callback_.get()) {
-    status_callback_ =
-        new BinderUpdateEngineClient::StatusUpdateCallback(this);
+    status_callback_ = new BinderUpdateEngineClient::StatusUpdateCallback(this);
     if (!service_->RegisterStatusCallback(status_callback_).isOk()) {
       return false;
     }
@@ -187,13 +187,16 @@
   string new_version;
   int64_t new_size;
 
-  if (!GetStatus(&last_checked_time, &progress, &update_status,
-                 &new_version, &new_size)) {
+  if (!GetStatus(&last_checked_time,
+                 &progress,
+                 &update_status,
+                 &new_version,
+                 &new_size)) {
     handler->IPCError("Could not get status from binder service");
   }
 
-  handler->HandleStatusUpdate(last_checked_time, progress, update_status,
-                              new_version, new_size);
+  handler->HandleStatusUpdate(
+      last_checked_time, progress, update_status, new_version, new_size);
 
   return true;
 }
@@ -211,8 +214,9 @@
 
 bool BinderUpdateEngineClient::SetTargetChannel(const string& in_target_channel,
                                                 bool allow_powerwash) {
-  return service_->SetChannel(String16{in_target_channel.c_str()},
-                              allow_powerwash).isOk();
+  return service_
+      ->SetChannel(String16{in_target_channel.c_str()}, allow_powerwash)
+      .isOk();
 }
 
 bool BinderUpdateEngineClient::GetTargetChannel(string* out_channel) const {
diff --git a/client_library/client_binder.h b/client_library/client_binder.h
index b3c8940..f3e4102 100644
--- a/client_library/client_binder.h
+++ b/client_library/client_binder.h
@@ -90,8 +90,8 @@
   bool GetEolStatus(int32_t* eol_status) const override;
 
  private:
-  class StatusUpdateCallback :
-      public android::brillo::BnUpdateEngineStatusCallback {
+  class StatusUpdateCallback
+      : public android::brillo::BnUpdateEngineStatusCallback {
    public:
     explicit StatusUpdateCallback(BinderUpdateEngineClient* client)
         : client_(client) {}
diff --git a/client_library/client_dbus.cc b/client_library/client_dbus.cc
index e0d1f64..7ca6307 100644
--- a/client_library/client_dbus.cc
+++ b/client_library/client_dbus.cc
@@ -147,13 +147,11 @@
 }
 
 void DBusUpdateEngineClient::DBusStatusHandlersRegistered(
-    const string& interface,
-    const string& signal_name,
-    bool success) const {
+    const string& interface, const string& signal_name, bool success) const {
   if (!success) {
     for (auto handler : handlers_) {
-      handler->IPCError("Could not connect to" + signal_name +
-                        " on " + interface);
+      handler->IPCError("Could not connect to" + signal_name + " on " +
+                        interface);
     }
   } else {
     StatusUpdateHandlersRegistered(nullptr);
diff --git a/common/action.h b/common/action.h
index 6c88216..9e2f5ff 100644
--- a/common/action.h
+++ b/common/action.h
@@ -145,12 +145,12 @@
 };
 
 // Forward declare a couple classes we use.
-template<typename T>
+template <typename T>
 class ActionPipe;
-template<typename T>
+template <typename T>
 class ActionTraits;
 
-template<typename SubClass>
+template <typename SubClass>
 class Action : public AbstractAction {
  public:
   ~Action() override {}
@@ -162,8 +162,9 @@
   void set_in_pipe(
       // this type is a fancy way of saying: a shared_ptr to an
       // ActionPipe<InputObjectType>.
-      const std::shared_ptr<ActionPipe<
-          typename ActionTraits<SubClass>::InputObjectType>>& in_pipe) {
+      const std::shared_ptr<
+          ActionPipe<typename ActionTraits<SubClass>::InputObjectType>>&
+          in_pipe) {
     in_pipe_ = in_pipe;
   }
 
@@ -174,8 +175,9 @@
   void set_out_pipe(
       // this type is a fancy way of saying: a shared_ptr to an
       // ActionPipe<OutputObjectType>.
-      const std::shared_ptr<ActionPipe<
-          typename ActionTraits<SubClass>::OutputObjectType>>& out_pipe) {
+      const std::shared_ptr<
+          ActionPipe<typename ActionTraits<SubClass>::OutputObjectType>>&
+          out_pipe) {
     out_pipe_ = out_pipe;
   }
 
@@ -192,9 +194,7 @@
   }
 
   // Returns true iff there's an output pipe.
-  bool HasOutputPipe() const {
-    return out_pipe_.get();
-  }
+  bool HasOutputPipe() const { return out_pipe_.get(); }
 
   // Copies the object passed into the output pipe. It will be accessible to
   // the next Action via that action's input pipe (which is the same as this
diff --git a/common/action_pipe.h b/common/action_pipe.h
index 376c2f1..0c98ee1 100644
--- a/common/action_pipe.h
+++ b/common/action_pipe.h
@@ -48,10 +48,10 @@
 // for that type, no object is taken/given.
 class NoneType {};
 
-template<typename T>
+template <typename T>
 class Action;
 
-template<typename ObjectType>
+template <typename ObjectType>
 class ActionPipe {
  public:
   virtual ~ActionPipe() {}
@@ -67,7 +67,7 @@
   // Bonds two Actions together with a new ActionPipe. The ActionPipe is
   // jointly owned by the two Actions and will be automatically destroyed
   // when the last Action is destroyed.
-  template<typename FromAction, typename ToAction>
+  template <typename FromAction, typename ToAction>
   static void Bond(FromAction* from, ToAction* to) {
     std::shared_ptr<ActionPipe<ObjectType>> pipe(new ActionPipe<ObjectType>);
     from->set_out_pipe(pipe);
@@ -87,7 +87,7 @@
 };
 
 // Utility function
-template<typename FromAction, typename ToAction>
+template <typename FromAction, typename ToAction>
 void BondActions(FromAction* from, ToAction* to) {
   static_assert(
       std::is_same<typename FromAction::OutputObjectType,
diff --git a/common/action_pipe_unittest.cc b/common/action_pipe_unittest.cc
index 9bfbc83..233561d 100644
--- a/common/action_pipe_unittest.cc
+++ b/common/action_pipe_unittest.cc
@@ -28,7 +28,7 @@
 
 class ActionPipeTestAction;
 
-template<>
+template <>
 class ActionTraits<ActionPipeTestAction> {
  public:
   typedef string OutputObjectType;
@@ -46,7 +46,7 @@
   string Type() const { return "ActionPipeTestAction"; }
 };
 
-class ActionPipeTest : public ::testing::Test { };
+class ActionPipeTest : public ::testing::Test {};
 
 // This test creates two simple Actions and sends a message via an ActionPipe
 // from one to the other.
diff --git a/common/action_processor.cc b/common/action_processor.cc
index ead99c4..6e555dd 100644
--- a/common/action_processor.cc
+++ b/common/action_processor.cc
@@ -115,8 +115,8 @@
   current_action_.reset();
   LOG(INFO) << "ActionProcessor: finished "
             << (actions_.empty() ? "last action " : "") << old_type
-            << (suspended_ ? " while suspended" : "")
-            << " with code " << utils::ErrorCodeToString(code);
+            << (suspended_ ? " while suspended" : "") << " with code "
+            << utils::ErrorCodeToString(code);
   if (!actions_.empty() && code != ErrorCode::kSuccess) {
     LOG(INFO) << "ActionProcessor: Aborting processing due to failure.";
     actions_.clear();
diff --git a/common/action_processor.h b/common/action_processor.h
index 1a67c99..735a106 100644
--- a/common/action_processor.h
+++ b/common/action_processor.h
@@ -80,9 +80,7 @@
 
   // Sets/gets the current delegate. Set to null to remove a delegate.
   ActionProcessorDelegate* delegate() const { return delegate_; }
-  void set_delegate(ActionProcessorDelegate *delegate) {
-    delegate_ = delegate;
-  }
+  void set_delegate(ActionProcessorDelegate* delegate) { delegate_ = delegate; }
 
   // Returns a pointer to the current Action that's processing.
   AbstractAction* current_action() const { return current_action_.get(); }
diff --git a/common/action_processor_unittest.cc b/common/action_processor_unittest.cc
index eb646ef..4057abd 100644
--- a/common/action_processor_unittest.cc
+++ b/common/action_processor_unittest.cc
@@ -32,7 +32,7 @@
 
 class ActionProcessorTestAction;
 
-template<>
+template <>
 class ActionTraits<ActionProcessorTestAction> {
  public:
   typedef string OutputObjectType;
@@ -104,9 +104,7 @@
     EXPECT_CALL(*mock_action_, Type()).Times(testing::AnyNumber());
   }
 
-  void TearDown() override {
-    action_processor_.set_delegate(nullptr);
-  }
+  void TearDown() override { action_processor_.set_delegate(nullptr); }
 
  protected:
   // The ActionProcessor under test.
diff --git a/common/action_unittest.cc b/common/action_unittest.cc
index b2f9ba4..ca48bee 100644
--- a/common/action_unittest.cc
+++ b/common/action_unittest.cc
@@ -31,7 +31,7 @@
 
 class ActionTestAction;
 
-template<>
+template <>
 class ActionTraits<ActionTestAction> {
  public:
   typedef string OutputObjectType;
@@ -54,7 +54,7 @@
   string Type() const { return "ActionTestAction"; }
 };
 
-class ActionTest : public ::testing::Test { };
+class ActionTest : public ::testing::Test {};
 
 // This test creates two simple Actions and sends a message via an ActionPipe
 // from one to the other.
diff --git a/common/clock.cc b/common/clock.cc
index f0eff44..05c495c 100644
--- a/common/clock.cc
+++ b/common/clock.cc
@@ -36,7 +36,7 @@
   }
   struct timeval now_tv;
   now_tv.tv_sec = now_ts.tv_sec;
-  now_tv.tv_usec = now_ts.tv_nsec/base::Time::kNanosecondsPerMicrosecond;
+  now_tv.tv_usec = now_ts.tv_nsec / base::Time::kNanosecondsPerMicrosecond;
   return base::Time::FromTimeVal(now_tv);
 }
 
@@ -51,7 +51,7 @@
   }
   struct timeval now_tv;
   now_tv.tv_sec = now_ts.tv_sec;
-  now_tv.tv_usec = now_ts.tv_nsec/base::Time::kNanosecondsPerMicrosecond;
+  now_tv.tv_usec = now_ts.tv_nsec / base::Time::kNanosecondsPerMicrosecond;
   return base::Time::FromTimeVal(now_tv);
 }
 
diff --git a/common/error_code_utils.cc b/common/error_code_utils.cc
index a1607f5..b0bbbd4 100644
--- a/common/error_code_utils.cc
+++ b/common/error_code_utils.cc
@@ -30,12 +30,15 @@
   // doesn't support any combinations of those.
   if ((static_cast<int>(code) & static_cast<int>(ErrorCode::kSpecialFlags)) &&
       (static_cast<int>(code) & ~static_cast<int>(ErrorCode::kSpecialFlags)))
-    code = static_cast<ErrorCode>(
-        static_cast<int>(code) & ~static_cast<int>(ErrorCode::kSpecialFlags));
+    code = static_cast<ErrorCode>(static_cast<int>(code) &
+                                  ~static_cast<int>(ErrorCode::kSpecialFlags));
   switch (code) {
-    case ErrorCode::kSuccess: return "ErrorCode::kSuccess";
-    case ErrorCode::kError: return "ErrorCode::kError";
-    case ErrorCode::kOmahaRequestError: return "ErrorCode::kOmahaRequestError";
+    case ErrorCode::kSuccess:
+      return "ErrorCode::kSuccess";
+    case ErrorCode::kError:
+      return "ErrorCode::kError";
+    case ErrorCode::kOmahaRequestError:
+      return "ErrorCode::kOmahaRequestError";
     case ErrorCode::kOmahaResponseHandlerError:
       return "ErrorCode::kOmahaResponseHandlerError";
     case ErrorCode::kFilesystemCopierError:
diff --git a/common/fake_boot_control.h b/common/fake_boot_control.h
index ba975a2..3d65075 100644
--- a/common/fake_boot_control.h
+++ b/common/fake_boot_control.h
@@ -89,9 +89,7 @@
     devices_.resize(num_slots_);
   }
 
-  void SetCurrentSlot(BootControlInterface::Slot slot) {
-    current_slot_ = slot;
-  }
+  void SetCurrentSlot(BootControlInterface::Slot slot) { current_slot_ = slot; }
 
   void SetPartitionDevice(const std::string& partition_name,
                           BootControlInterface::Slot slot,
diff --git a/common/fake_clock.h b/common/fake_clock.h
index 3d3bad8..165ec4d 100644
--- a/common/fake_clock.h
+++ b/common/fake_clock.h
@@ -26,29 +26,17 @@
  public:
   FakeClock() {}
 
-  base::Time GetWallclockTime() override {
-    return wallclock_time_;
-  }
+  base::Time GetWallclockTime() override { return wallclock_time_; }
 
-  base::Time GetMonotonicTime() override {
-    return monotonic_time_;
-  }
+  base::Time GetMonotonicTime() override { return monotonic_time_; }
 
-  base::Time GetBootTime() override {
-    return boot_time_;
-  }
+  base::Time GetBootTime() override { return boot_time_; }
 
-  void SetWallclockTime(const base::Time &time) {
-    wallclock_time_ = time;
-  }
+  void SetWallclockTime(const base::Time& time) { wallclock_time_ = time; }
 
-  void SetMonotonicTime(const base::Time &time) {
-    monotonic_time_ = time;
-  }
+  void SetMonotonicTime(const base::Time& time) { monotonic_time_ = time; }
 
-  void SetBootTime(const base::Time &time) {
-    boot_time_ = time;
-  }
+  void SetBootTime(const base::Time& time) { boot_time_ = time; }
 
  private:
   base::Time wallclock_time_;
diff --git a/common/fake_hardware.h b/common/fake_hardware.h
index 55ef32d..3e5a66e 100644
--- a/common/fake_hardware.h
+++ b/common/fake_hardware.h
@@ -104,13 +104,15 @@
 
   int GetPowerwashCount() const override { return powerwash_count_; }
 
-  bool SchedulePowerwash() override {
+  bool SchedulePowerwash(bool is_rollback) override {
     powerwash_scheduled_ = true;
+    is_rollback_powerwash_ = is_rollback;
     return true;
   }
 
   bool CancelPowerwash() override {
     powerwash_scheduled_ = false;
+    is_rollback_powerwash_ = false;
     return true;
   }
 
@@ -159,9 +161,7 @@
     oobe_timestamp_ = oobe_timestamp;
   }
 
-  void UnsetIsOOBEComplete() {
-    is_oobe_complete_ = false;
-  }
+  void UnsetIsOOBEComplete() { is_oobe_complete_ = false; }
 
   void SetHardwareClass(const std::string& hardware_class) {
     hardware_class_ = hardware_class;
@@ -171,9 +171,7 @@
     firmware_version_ = firmware_version;
   }
 
-  void SetECVersion(const std::string& ec_version) {
-    ec_version_ = ec_version;
-  }
+  void SetECVersion(const std::string& ec_version) { ec_version_ = ec_version; }
 
   void SetMinKernelKeyVersion(int min_kernel_key_version) {
     min_kernel_key_version_ = min_kernel_key_version;
@@ -194,6 +192,10 @@
   // Getters to verify state.
   int GetMaxKernelKeyRollforward() const { return kernel_max_rollforward_; }
 
+  bool GetIsRollbackPowerwashScheduled() const {
+    return powerwash_scheduled_ && is_rollback_powerwash_;
+  }
+
  private:
   bool is_official_build_{true};
   bool is_normal_boot_mode_{true};
@@ -211,6 +213,7 @@
   int firmware_max_rollforward_{kFirmwareMaxRollforward};
   int powerwash_count_{kPowerwashCountNotSet};
   bool powerwash_scheduled_{false};
+  bool is_rollback_powerwash_{false};
   int64_t build_timestamp_{0};
   bool first_active_omaha_ping_sent_{false};
 
diff --git a/common/fake_prefs.cc b/common/fake_prefs.cc
index 5a0a3af..c446e06 100644
--- a/common/fake_prefs.cc
+++ b/common/fake_prefs.cc
@@ -27,8 +27,8 @@
 namespace {
 
 void CheckNotNull(const string& key, void* ptr) {
-  EXPECT_NE(nullptr, ptr)
-      << "Called Get*() for key \"" << key << "\" with a null parameter.";
+  EXPECT_NE(nullptr, ptr) << "Called Get*() for key \"" << key
+                          << "\" with a null parameter.";
 }
 
 }  // namespace
@@ -40,25 +40,25 @@
 }
 
 // Compile-time type-dependent constants definitions.
-template<>
+template <>
 FakePrefs::PrefType const FakePrefs::PrefConsts<string>::type =
     FakePrefs::PrefType::kString;
-template<>
-string FakePrefs::PrefValue::* const  // NOLINT(runtime/string), not static str.
+template <>
+string FakePrefs::PrefValue::*const  // NOLINT(runtime/string), not static str.
     FakePrefs::PrefConsts<string>::member = &FakePrefs::PrefValue::as_str;
 
-template<>
+template <>
 FakePrefs::PrefType const FakePrefs::PrefConsts<int64_t>::type =
     FakePrefs::PrefType::kInt64;
-template<>
-int64_t FakePrefs::PrefValue::* const FakePrefs::PrefConsts<int64_t>::member =
+template <>
+int64_t FakePrefs::PrefValue::*const FakePrefs::PrefConsts<int64_t>::member =
     &FakePrefs::PrefValue::as_int64;
 
-template<>
+template <>
 FakePrefs::PrefType const FakePrefs::PrefConsts<bool>::type =
     FakePrefs::PrefType::kBool;
-template<>
-bool FakePrefs::PrefValue::* const FakePrefs::PrefConsts<bool>::member =
+template <>
+bool FakePrefs::PrefValue::*const FakePrefs::PrefConsts<bool>::member =
     &FakePrefs::PrefValue::as_bool;
 
 bool FakePrefs::GetString(const string& key, string* value) const {
@@ -124,7 +124,7 @@
       << " but is accessed as a " << GetTypeName(type);
 }
 
-template<typename T>
+template <typename T>
 void FakePrefs::SetValue(const string& key, const T& value) {
   CheckKeyType(key, PrefConsts<T>::type);
   values_[key].type = PrefConsts<T>::type;
@@ -137,7 +137,7 @@
   }
 }
 
-template<typename T>
+template <typename T>
 bool FakePrefs::GetValue(const string& key, T* value) const {
   CheckKeyType(key, PrefConsts<T>::type);
   auto it = values_.find(key);
@@ -157,8 +157,7 @@
   auto observer_it =
       std::find(observers_for_key.begin(), observers_for_key.end(), observer);
   EXPECT_NE(observer_it, observers_for_key.end())
-      << "Trying to remove an observer instance not watching the key "
-      << key;
+      << "Trying to remove an observer instance not watching the key " << key;
   if (observer_it != observers_for_key.end())
     observers_for_key.erase(observer_it);
   if (observers_for_key.empty())
diff --git a/common/fake_prefs.h b/common/fake_prefs.h
index d194060..b1c5b71 100644
--- a/common/fake_prefs.h
+++ b/common/fake_prefs.h
@@ -72,14 +72,14 @@
   };
 
   // Class to store compile-time type-dependent constants.
-  template<typename T>
+  template <typename T>
   class PrefConsts {
    public:
     // The PrefType associated with T.
     static FakePrefs::PrefType const type;
 
     // The data member pointer to PrefValue associated with T.
-    static T FakePrefs::PrefValue::* const member;
+    static T FakePrefs::PrefValue::*const member;
   };
 
   // Returns a string representation of the PrefType useful for logging.
@@ -90,13 +90,13 @@
 
   // Helper function to set a value of the passed |key|. It sets the type based
   // on the template parameter T.
-  template<typename T>
+  template <typename T>
   void SetValue(const std::string& key, const T& value);
 
   // Helper function to get a value from the map checking for invalid calls.
   // The function fails the test if you attempt to read a value  defined as a
   // different type. Returns whether the get succeeded.
-  template<typename T>
+  template <typename T>
   bool GetValue(const std::string& key, T* value) const;
 
   // Container for all the key/value pairs.
diff --git a/common/file_fetcher.h b/common/file_fetcher.h
index 2368b1d..fbdfc32 100644
--- a/common/file_fetcher.h
+++ b/common/file_fetcher.h
@@ -57,7 +57,7 @@
 
   // Ignore all extra headers for files.
   void SetHeader(const std::string& header_name,
-                 const std::string& header_value) override {};
+                 const std::string& header_value) override {}
 
   // Suspend the asynchronous file read.
   void Pause() override;
diff --git a/common/hardware_interface.h b/common/hardware_interface.h
index bbc8660..0140588 100644
--- a/common/hardware_interface.h
+++ b/common/hardware_interface.h
@@ -102,8 +102,9 @@
   virtual int GetPowerwashCount() const = 0;
 
   // Signals that a powerwash (stateful partition wipe) should be performed
-  // after reboot.
-  virtual bool SchedulePowerwash() = 0;
+  // after reboot. If |is_rollback| is true additional state is preserved
+  // during shutdown that can be restored after the powerwash.
+  virtual bool SchedulePowerwash(bool is_rollback) = 0;
 
   // Cancel the powerwash operation scheduled to be performed on next boot.
   virtual bool CancelPowerwash() = 0;
diff --git a/common/hash_calculator.cc b/common/hash_calculator.cc
index ebfdb6e..d010a53 100644
--- a/common/hash_calculator.cc
+++ b/common/hash_calculator.cc
@@ -95,7 +95,8 @@
   return RawHashOfBytes(data.data(), data.size(), out_hash);
 }
 
-off_t HashCalculator::RawHashOfFile(const string& name, off_t length,
+off_t HashCalculator::RawHashOfFile(const string& name,
+                                    off_t length,
                                     brillo::Blob* out_hash) {
   HashCalculator calc;
   off_t res = calc.UpdateFile(name, length);
diff --git a/common/hash_calculator.h b/common/hash_calculator.h
index 06d2cfb..b7e4d86 100644
--- a/common/hash_calculator.h
+++ b/common/hash_calculator.h
@@ -71,9 +71,9 @@
   static bool RawHashOfBytes(const void* data,
                              size_t length,
                              brillo::Blob* out_hash);
-  static bool RawHashOfData(const brillo::Blob& data,
-                            brillo::Blob* out_hash);
-  static off_t RawHashOfFile(const std::string& name, off_t length,
+  static bool RawHashOfData(const brillo::Blob& data, brillo::Blob* out_hash);
+  static off_t RawHashOfFile(const std::string& name,
+                             off_t length,
                              brillo::Blob* out_hash);
 
  private:
diff --git a/common/hash_calculator_unittest.cc b/common/hash_calculator_unittest.cc
index 79f22ad..e8f73d5 100644
--- a/common/hash_calculator_unittest.cc
+++ b/common/hash_calculator_unittest.cc
@@ -38,11 +38,9 @@
 // $ echo -n hi | openssl dgst -sha256 -binary |
 //   hexdump -v -e '"    " 12/1 "0x%02x, " "\n"'
 static const uint8_t kExpectedRawHash[] = {
-  0x8f, 0x43, 0x43, 0x46, 0x64, 0x8f, 0x6b, 0x96,
-  0xdf, 0x89, 0xdd, 0xa9, 0x01, 0xc5, 0x17, 0x6b,
-  0x10, 0xa6, 0xd8, 0x39, 0x61, 0xdd, 0x3c, 0x1a,
-  0xc8, 0x8b, 0x59, 0xb2, 0xdc, 0x32, 0x7a, 0xa4
-};
+    0x8f, 0x43, 0x43, 0x46, 0x64, 0x8f, 0x6b, 0x96, 0xdf, 0x89, 0xdd,
+    0xa9, 0x01, 0xc5, 0x17, 0x6b, 0x10, 0xa6, 0xd8, 0x39, 0x61, 0xdd,
+    0x3c, 0x1a, 0xc8, 0x8b, 0x59, 0xb2, 0xdc, 0x32, 0x7a, 0xa4};
 
 class HashCalculatorTest : public ::testing::Test {};
 
@@ -148,9 +146,7 @@
 
 TEST_F(HashCalculatorTest, AbortTest) {
   // Just make sure we don't crash and valgrind doesn't detect memory leaks
-  {
-    HashCalculator calc;
-  }
+  { HashCalculator calc; }
   {
     HashCalculator calc;
     calc.Update("h", 1);
diff --git a/common/http_common.cc b/common/http_common.cc
index d07ced3..5f234b0 100644
--- a/common/http_common.cc
+++ b/common/http_common.cc
@@ -24,34 +24,34 @@
 
 namespace chromeos_update_engine {
 
-const char *GetHttpResponseDescription(HttpResponseCode code) {
+const char* GetHttpResponseDescription(HttpResponseCode code) {
   static const struct {
     HttpResponseCode code;
     const char* description;
   } http_response_table[] = {
-    { kHttpResponseOk,                  "OK" },
-    { kHttpResponseCreated,             "Created" },
-    { kHttpResponseAccepted,            "Accepted" },
-    { kHttpResponseNonAuthInfo,         "Non-Authoritative Information" },
-    { kHttpResponseNoContent,           "No Content" },
-    { kHttpResponseResetContent,        "Reset Content" },
-    { kHttpResponsePartialContent,      "Partial Content" },
-    { kHttpResponseMultipleChoices,     "Multiple Choices" },
-    { kHttpResponseMovedPermanently,    "Moved Permanently" },
-    { kHttpResponseFound,               "Found" },
-    { kHttpResponseSeeOther,            "See Other" },
-    { kHttpResponseNotModified,         "Not Modified" },
-    { kHttpResponseUseProxy,            "Use Proxy" },
-    { kHttpResponseTempRedirect,        "Temporary Redirect" },
-    { kHttpResponseBadRequest,          "Bad Request" },
-    { kHttpResponseUnauth,              "Unauthorized" },
-    { kHttpResponseForbidden,           "Forbidden" },
-    { kHttpResponseNotFound,            "Not Found" },
-    { kHttpResponseRequestTimeout,      "Request Timeout" },
-    { kHttpResponseInternalServerError, "Internal Server Error" },
-    { kHttpResponseNotImplemented,      "Not Implemented" },
-    { kHttpResponseServiceUnavailable,  "Service Unavailable" },
-    { kHttpResponseVersionNotSupported, "HTTP Version Not Supported" },
+      {kHttpResponseOk, "OK"},
+      {kHttpResponseCreated, "Created"},
+      {kHttpResponseAccepted, "Accepted"},
+      {kHttpResponseNonAuthInfo, "Non-Authoritative Information"},
+      {kHttpResponseNoContent, "No Content"},
+      {kHttpResponseResetContent, "Reset Content"},
+      {kHttpResponsePartialContent, "Partial Content"},
+      {kHttpResponseMultipleChoices, "Multiple Choices"},
+      {kHttpResponseMovedPermanently, "Moved Permanently"},
+      {kHttpResponseFound, "Found"},
+      {kHttpResponseSeeOther, "See Other"},
+      {kHttpResponseNotModified, "Not Modified"},
+      {kHttpResponseUseProxy, "Use Proxy"},
+      {kHttpResponseTempRedirect, "Temporary Redirect"},
+      {kHttpResponseBadRequest, "Bad Request"},
+      {kHttpResponseUnauth, "Unauthorized"},
+      {kHttpResponseForbidden, "Forbidden"},
+      {kHttpResponseNotFound, "Not Found"},
+      {kHttpResponseRequestTimeout, "Request Timeout"},
+      {kHttpResponseInternalServerError, "Internal Server Error"},
+      {kHttpResponseNotImplemented, "Not Implemented"},
+      {kHttpResponseServiceUnavailable, "Service Unavailable"},
+      {kHttpResponseVersionNotSupported, "HTTP Version Not Supported"},
   };
 
   bool is_found = false;
@@ -63,17 +63,16 @@
   return (is_found ? http_response_table[i].description : "(unsupported)");
 }
 
-HttpResponseCode StringToHttpResponseCode(const char *s) {
+HttpResponseCode StringToHttpResponseCode(const char* s) {
   return static_cast<HttpResponseCode>(strtoul(s, nullptr, 10));
 }
 
-
-const char *GetHttpContentTypeString(HttpContentType type) {
+const char* GetHttpContentTypeString(HttpContentType type) {
   static const struct {
     HttpContentType type;
     const char* str;
   } http_content_type_table[] = {
-    { kHttpContentTypeTextXml, "text/xml" },
+      {kHttpContentTypeTextXml, "text/xml"},
   };
 
   bool is_found = false;
diff --git a/common/http_common.h b/common/http_common.h
index 6d444ed..7a68da0 100644
--- a/common/http_common.h
+++ b/common/http_common.h
@@ -24,39 +24,38 @@
 
 // Enumeration type for HTTP response codes.
 enum HttpResponseCode {
-  kHttpResponseUndefined           = 0,
-  kHttpResponseOk                  = 200,
-  kHttpResponseCreated             = 201,
-  kHttpResponseAccepted            = 202,
-  kHttpResponseNonAuthInfo         = 203,
-  kHttpResponseNoContent           = 204,
-  kHttpResponseResetContent        = 205,
-  kHttpResponsePartialContent      = 206,
-  kHttpResponseMultipleChoices     = 300,
-  kHttpResponseMovedPermanently    = 301,
-  kHttpResponseFound               = 302,
-  kHttpResponseSeeOther            = 303,
-  kHttpResponseNotModified         = 304,
-  kHttpResponseUseProxy            = 305,
-  kHttpResponseTempRedirect        = 307,
-  kHttpResponseBadRequest          = 400,
-  kHttpResponseUnauth              = 401,
-  kHttpResponseForbidden           = 403,
-  kHttpResponseNotFound            = 404,
-  kHttpResponseRequestTimeout      = 408,
-  kHttpResponseReqRangeNotSat      = 416,
+  kHttpResponseUndefined = 0,
+  kHttpResponseOk = 200,
+  kHttpResponseCreated = 201,
+  kHttpResponseAccepted = 202,
+  kHttpResponseNonAuthInfo = 203,
+  kHttpResponseNoContent = 204,
+  kHttpResponseResetContent = 205,
+  kHttpResponsePartialContent = 206,
+  kHttpResponseMultipleChoices = 300,
+  kHttpResponseMovedPermanently = 301,
+  kHttpResponseFound = 302,
+  kHttpResponseSeeOther = 303,
+  kHttpResponseNotModified = 304,
+  kHttpResponseUseProxy = 305,
+  kHttpResponseTempRedirect = 307,
+  kHttpResponseBadRequest = 400,
+  kHttpResponseUnauth = 401,
+  kHttpResponseForbidden = 403,
+  kHttpResponseNotFound = 404,
+  kHttpResponseRequestTimeout = 408,
+  kHttpResponseReqRangeNotSat = 416,
   kHttpResponseInternalServerError = 500,
-  kHttpResponseNotImplemented      = 501,
-  kHttpResponseServiceUnavailable  = 503,
+  kHttpResponseNotImplemented = 501,
+  kHttpResponseServiceUnavailable = 503,
   kHttpResponseVersionNotSupported = 505,
 };
 
 // Returns a standard HTTP status line string for a given response code.
-const char *GetHttpResponseDescription(HttpResponseCode code);
+const char* GetHttpResponseDescription(HttpResponseCode code);
 
 // Converts a string beginning with an HTTP error code into numerical value.
-HttpResponseCode StringToHttpResponseCode(const char *s);
-
+HttpResponseCode StringToHttpResponseCode(const char* s);
 
 // Enumeration type for HTTP Content-Type.
 enum HttpContentType {
@@ -65,7 +64,7 @@
 };
 
 // Returns a standard HTTP Content-Type string.
-const char *GetHttpContentTypeString(HttpContentType type);
+const char* GetHttpContentTypeString(HttpContentType type);
 
 }  // namespace chromeos_update_engine
 
diff --git a/common/http_fetcher.cc b/common/http_fetcher.cc
index 73c0d48..5a98dfc 100644
--- a/common/http_fetcher.cc
+++ b/common/http_fetcher.cc
@@ -29,7 +29,8 @@
   CancelProxyResolution();
 }
 
-void HttpFetcher::SetPostData(const void* data, size_t size,
+void HttpFetcher::SetPostData(const void* data,
+                              size_t size,
                               HttpContentType type) {
   post_data_set_ = true;
   post_data_.clear();
diff --git a/common/http_fetcher.h b/common/http_fetcher.h
index 1f5c945..2b4fc83 100644
--- a/common/http_fetcher.h
+++ b/common/http_fetcher.h
@@ -73,9 +73,7 @@
   void SetProxies(const std::deque<std::string>& proxies) {
     proxies_ = proxies;
   }
-  const std::string& GetCurrentProxy() const {
-    return proxies_.front();
-  }
+  const std::string& GetCurrentProxy() const { return proxies_.front(); }
   bool HasProxy() const { return !proxies_.empty(); }
   void PopProxy() { proxies_.pop_front(); }
 
diff --git a/common/http_fetcher_unittest.cc b/common/http_fetcher_unittest.cc
index 00ea128..237ea20 100644
--- a/common/http_fetcher_unittest.cc
+++ b/common/http_fetcher_unittest.cc
@@ -58,30 +58,29 @@
 using std::string;
 using std::unique_ptr;
 using std::vector;
+using testing::_;
 using testing::DoAll;
 using testing::Return;
 using testing::SaveArg;
-using testing::_;
 
 namespace {
 
-const int kBigLength           = 100000;
-const int kMediumLength        = 1000;
+const int kBigLength = 100000;
+const int kMediumLength = 1000;
 const int kFlakyTruncateLength = 29000;
-const int kFlakySleepEvery     = 3;
-const int kFlakySleepSecs      = 10;
+const int kFlakySleepEvery = 3;
+const int kFlakySleepSecs = 10;
 
 }  // namespace
 
 namespace chromeos_update_engine {
 
-static const char *kUnusedUrl = "unused://unused";
+static const char* kUnusedUrl = "unused://unused";
 
-static inline string LocalServerUrlForPath(in_port_t port,
-                                           const string& path) {
+static inline string LocalServerUrlForPath(in_port_t port, const string& path) {
   string port_str = (port ? base::StringPrintf(":%hu", port) : "");
-  return base::StringPrintf("http://127.0.0.1%s%s", port_str.c_str(),
-                            path.c_str());
+  return base::StringPrintf(
+      "http://127.0.0.1%s%s", port_str.c_str(), path.c_str());
 }
 
 //
@@ -93,24 +92,18 @@
   // This makes it an abstract class (dirty but works).
   virtual ~HttpServer() = 0;
 
-  virtual in_port_t GetPort() const {
-    return 0;
-  }
+  virtual in_port_t GetPort() const { return 0; }
 
   bool started_;
 };
 
 HttpServer::~HttpServer() {}
 
-
 class NullHttpServer : public HttpServer {
  public:
-  NullHttpServer() {
-    started_ = true;
-  }
+  NullHttpServer() { started_ = true; }
 };
 
-
 class PythonHttpServer : public HttpServer {
  public:
   PythonHttpServer() : port_(0) {
@@ -175,9 +168,7 @@
     http_server_->Kill(SIGTERM, 10);
   }
 
-  in_port_t GetPort() const override {
-    return port_;
-  }
+  in_port_t GetPort() const override { return port_; }
 
  private:
   static const char* kServerListeningMsgPrefix;
@@ -202,9 +193,7 @@
     proxy_resolver_.set_num_proxies(num_proxies);
     return NewLargeFetcher(&proxy_resolver_);
   }
-  HttpFetcher* NewLargeFetcher() {
-    return NewLargeFetcher(1);
-  }
+  HttpFetcher* NewLargeFetcher() { return NewLargeFetcher(1); }
 
   virtual HttpFetcher* NewSmallFetcher(ProxyResolver* proxy_resolver) = 0;
   HttpFetcher* NewSmallFetcher() {
@@ -225,9 +214,7 @@
 
   virtual HttpServer* CreateServer() = 0;
 
-  FakeHardware* fake_hardware() {
-    return &fake_hardware_;
-  }
+  FakeHardware* fake_hardware() { return &fake_hardware_; }
 
  protected:
   DirectProxyResolver proxy_resolver_;
@@ -255,9 +242,7 @@
   bool IsHttpSupported() const override { return true; }
   bool IsFileFetcher() const override { return false; }
 
-  HttpServer* CreateServer() override {
-    return new NullHttpServer;
-  }
+  HttpServer* CreateServer() override { return new NullHttpServer; }
 };
 
 class LibcurlHttpFetcherTest : public AnyHttpFetcherTest {
@@ -281,9 +266,8 @@
   }
 
   string BigUrl(in_port_t port) const override {
-    return LocalServerUrlForPath(port,
-                                 base::StringPrintf("/download/%d",
-                                                    kBigLength));
+    return LocalServerUrlForPath(
+        port, base::StringPrintf("/download/%d", kBigLength));
   }
   string SmallUrl(in_port_t port) const override {
     return LocalServerUrlForPath(port, "/foo");
@@ -301,9 +285,7 @@
     // Nothing to do.
   }
 
-  HttpServer* CreateServer() override {
-    return new PythonHttpServer;
-  }
+  HttpServer* CreateServer() override { return new PythonHttpServer; }
 };
 
 class MultiRangeHttpFetcherTest : public LibcurlHttpFetcherTest {
@@ -422,9 +404,7 @@
   T test_;
 
  protected:
-  HttpFetcherTest() {
-    loop_.SetAsCurrent();
-  }
+  HttpFetcherTest() { loop_.SetAsCurrent(); }
 
   void TearDown() override {
     EXPECT_EQ(0, brillo::MessageLoopRunMaxIterations(&loop_, 1));
@@ -432,7 +412,7 @@
 
  private:
   static void TypeConstraint(T* a) {
-    AnyHttpFetcherTest *b = a;
+    AnyHttpFetcherTest* b = a;
     if (b == 0)  // Silence compiler warning of unused variable.
       *b = a;
   }
@@ -447,7 +427,6 @@
     HttpFetcherTestTypes;
 TYPED_TEST_CASE(HttpFetcherTest, HttpFetcherTestTypes);
 
-
 namespace {
 class HttpFetcherTestDelegate : public HttpFetcherDelegate {
  public:
@@ -490,7 +469,6 @@
   string data;
 };
 
-
 void StartTransfer(HttpFetcher* http_fetcher, const string& url) {
   http_fetcher->BeginTransfer(url);
 }
@@ -504,10 +482,10 @@
   unique_ptr<HttpServer> server(this->test_.CreateServer());
   ASSERT_TRUE(server->started_);
 
-  this->loop_.PostTask(FROM_HERE, base::Bind(
-      StartTransfer,
-      fetcher.get(),
-      this->test_.SmallUrl(server->GetPort())));
+  this->loop_.PostTask(FROM_HERE,
+                       base::Bind(StartTransfer,
+                                  fetcher.get(),
+                                  this->test_.SmallUrl(server->GetPort())));
   this->loop_.Run();
   EXPECT_EQ(0, delegate.times_transfer_terminated_called_);
 }
@@ -520,10 +498,10 @@
   unique_ptr<HttpServer> server(this->test_.CreateServer());
   ASSERT_TRUE(server->started_);
 
-  this->loop_.PostTask(FROM_HERE, base::Bind(
-      StartTransfer,
-      fetcher.get(),
-      this->test_.BigUrl(server->GetPort())));
+  this->loop_.PostTask(
+      FROM_HERE,
+      base::Bind(
+          StartTransfer, fetcher.get(), this->test_.BigUrl(server->GetPort())));
   this->loop_.Run();
   EXPECT_EQ(0, delegate.times_transfer_terminated_called_);
 }
@@ -544,10 +522,10 @@
   unique_ptr<HttpServer> server(this->test_.CreateServer());
   ASSERT_TRUE(server->started_);
 
-  this->loop_.PostTask(FROM_HERE, base::Bind(
-      StartTransfer,
-      fetcher.get(),
-      this->test_.ErrorUrl(server->GetPort())));
+  this->loop_.PostTask(FROM_HERE,
+                       base::Bind(StartTransfer,
+                                  fetcher.get(),
+                                  this->test_.ErrorUrl(server->GetPort())));
   this->loop_.Run();
 
   // Make sure that no bytes were received.
@@ -613,9 +591,7 @@
   void TransferComplete(HttpFetcher* fetcher, bool successful) override {
     MessageLoop::current()->BreakLoop();
   }
-  void TransferTerminated(HttpFetcher* fetcher) override {
-    ADD_FAILURE();
-  }
+  void TransferTerminated(HttpFetcher* fetcher) override { ADD_FAILURE(); }
   void Unpause() {
     CHECK(paused_);
     paused_ = false;
@@ -708,9 +684,7 @@
     once_ = false;
     fetcher_->TerminateTransfer();
   }
-  void EndLoop() {
-    MessageLoop::current()->BreakLoop();
-  }
+  void EndLoop() { MessageLoop::current()->BreakLoop(); }
   bool once_;
   bool callback_once_;
   unique_ptr<HttpFetcher> fetcher_;
@@ -721,8 +695,7 @@
   if (delegate->once_) {
     delegate->TerminateTransfer();
     *my_id = MessageLoop::current()->PostTask(
-        FROM_HERE,
-        base::Bind(AbortingTimeoutCallback, delegate, my_id));
+        FROM_HERE, base::Bind(AbortingTimeoutCallback, delegate, my_id));
   } else {
     delegate->EndLoop();
     *my_id = MessageLoop::kTaskIdNull;
@@ -744,8 +717,7 @@
   MessageLoop::TaskId task_id = MessageLoop::kTaskIdNull;
 
   task_id = this->loop_.PostTask(
-      FROM_HERE,
-      base::Bind(AbortingTimeoutCallback, &delegate, &task_id));
+      FROM_HERE, base::Bind(AbortingTimeoutCallback, &delegate, &task_id));
   delegate.fetcher_->BeginTransfer(this->test_.BigUrl(server->GetPort()));
 
   this->loop_.Run();
@@ -794,9 +766,7 @@
     EXPECT_EQ(kHttpResponsePartialContent, fetcher->http_response_code());
     MessageLoop::current()->BreakLoop();
   }
-  void TransferTerminated(HttpFetcher* fetcher) override {
-    ADD_FAILURE();
-  }
+  void TransferTerminated(HttpFetcher* fetcher) override { ADD_FAILURE(); }
   string data;
 };
 }  // namespace
@@ -812,15 +782,16 @@
     unique_ptr<HttpServer> server(this->test_.CreateServer());
     ASSERT_TRUE(server->started_);
 
-    this->loop_.PostTask(FROM_HERE, base::Bind(
-        &StartTransfer,
-        fetcher.get(),
-        LocalServerUrlForPath(server->GetPort(),
-                              base::StringPrintf("/flaky/%d/%d/%d/%d",
-                                                 kBigLength,
-                                                 kFlakyTruncateLength,
-                                                 kFlakySleepEvery,
-                                                 kFlakySleepSecs))));
+    this->loop_.PostTask(FROM_HERE,
+                         base::Bind(&StartTransfer,
+                                    fetcher.get(),
+                                    LocalServerUrlForPath(
+                                        server->GetPort(),
+                                        base::StringPrintf("/flaky/%d/%d/%d/%d",
+                                                           kBigLength,
+                                                           kFlakyTruncateLength,
+                                                           kFlakySleepEvery,
+                                                           kFlakySleepSecs))));
     this->loop_.Run();
 
     // verify the data we get back
@@ -875,7 +846,6 @@
 };
 }  // namespace
 
-
 TYPED_TEST(HttpFetcherTest, FailureTest) {
   // This test ensures that a fetcher responds correctly when a server isn't
   // available at all.
@@ -916,10 +886,10 @@
   // expired.
   fetcher->set_low_speed_limit(kDownloadLowSpeedLimitBps, 1);
 
-  this->loop_.PostTask(FROM_HERE, base::Bind(
-      StartTransfer,
-      fetcher.get(),
-      LocalServerUrlForPath(port, "/hang")));
+  this->loop_.PostTask(
+      FROM_HERE,
+      base::Bind(
+          StartTransfer, fetcher.get(), LocalServerUrlForPath(port, "/hang")));
   this->loop_.Run();
   EXPECT_EQ(1, delegate.times_transfer_complete_called_);
   EXPECT_EQ(0, delegate.times_transfer_terminated_called_);
@@ -929,8 +899,8 @@
   bool timeout = false;
   auto callback = base::Bind([](bool* timeout) { *timeout = true; },
                              base::Unretained(&timeout));
-  this->loop_.PostDelayedTask(FROM_HERE, callback,
-                              base::TimeDelta::FromSeconds(2));
+  this->loop_.PostDelayedTask(
+      FROM_HERE, callback, base::TimeDelta::FromSeconds(2));
   EXPECT_TRUE(this->loop_.RunOnce(true));
   EXPECT_TRUE(timeout);
 }
@@ -1016,10 +986,10 @@
 }
 
 namespace {
-const HttpResponseCode kRedirectCodes[] = {
-  kHttpResponseMovedPermanently, kHttpResponseFound, kHttpResponseSeeOther,
-  kHttpResponseTempRedirect
-};
+const HttpResponseCode kRedirectCodes[] = {kHttpResponseMovedPermanently,
+                                           kHttpResponseFound,
+                                           kHttpResponseSeeOther,
+                                           kHttpResponseTempRedirect};
 
 class RedirectHttpFetcherTestDelegate : public HttpFetcherDelegate {
  public:
@@ -1041,9 +1011,7 @@
     }
     MessageLoop::current()->BreakLoop();
   }
-  void TransferTerminated(HttpFetcher* fetcher) override {
-    ADD_FAILURE();
-  }
+  void TransferTerminated(HttpFetcher* fetcher) override { ADD_FAILURE(); }
   bool expected_successful_;
   string data;
 };
@@ -1057,10 +1025,11 @@
   unique_ptr<HttpFetcher> fetcher(http_fetcher);
   fetcher->set_delegate(&delegate);
 
-  MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
-      StartTransfer,
-      fetcher.get(),
-      LocalServerUrlForPath(server->GetPort(), url)));
+  MessageLoop::current()->PostTask(
+      FROM_HERE,
+      base::Bind(StartTransfer,
+                 fetcher.get(),
+                 LocalServerUrlForPath(server->GetPort(), url)));
   MessageLoop::current()->Run();
   if (expected_successful) {
     // verify the data we get back
@@ -1081,9 +1050,8 @@
   ASSERT_TRUE(server->started_);
 
   for (size_t c = 0; c < arraysize(kRedirectCodes); ++c) {
-    const string url = base::StringPrintf("/redirect/%d/download/%d",
-                                          kRedirectCodes[c],
-                                          kMediumLength);
+    const string url = base::StringPrintf(
+        "/redirect/%d/download/%d", kRedirectCodes[c], kMediumLength);
     RedirectTest(server.get(), true, url, this->test_.NewLargeFetcher());
   }
 }
@@ -1144,9 +1112,7 @@
     MessageLoop::current()->BreakLoop();
   }
 
-  void TransferTerminated(HttpFetcher* fetcher) override {
-    ADD_FAILURE();
-  }
+  void TransferTerminated(HttpFetcher* fetcher) override { ADD_FAILURE(); }
 
   unique_ptr<HttpFetcher> fetcher_;
   int expected_response_code_;
@@ -1168,7 +1134,9 @@
   ASSERT_TRUE(multi_fetcher);
   multi_fetcher->ClearRanges();
   for (vector<pair<off_t, off_t>>::const_iterator it = ranges.begin(),
-           e = ranges.end(); it != e; ++it) {
+                                                  e = ranges.end();
+       it != e;
+       ++it) {
     string tmp_str = base::StringPrintf("%jd+", it->first);
     if (it->second > 0) {
       base::StringAppendF(&tmp_str, "%jd", it->second);
@@ -1183,8 +1151,7 @@
   multi_fetcher->set_delegate(&delegate);
 
   MessageLoop::current()->PostTask(
-      FROM_HERE,
-      base::Bind(StartTransfer, multi_fetcher, url));
+      FROM_HERE, base::Bind(StartTransfer, multi_fetcher, url));
   MessageLoop::current()->Run();
 
   EXPECT_EQ(expected_size, delegate.data.size());
@@ -1309,9 +1276,9 @@
   ranges.push_back(make_pair(99, 0));
   MultiTest(this->test_.NewLargeFetcher(3),
             this->test_.fake_hardware(),
-            LocalServerUrlForPath(server->GetPort(),
-                                  base::StringPrintf("/error-if-offset/%d/2",
-                                                     kBigLength)),
+            LocalServerUrlForPath(
+                server->GetPort(),
+                base::StringPrintf("/error-if-offset/%d/2", kBigLength)),
             ranges,
             "abcdefghijabcdefghijabcdejabcdefghijabcdef",
             kBigLength - (99 - 25),
@@ -1332,9 +1299,9 @@
   ranges.push_back(make_pair(99, 0));
   MultiTest(this->test_.NewLargeFetcher(2),
             this->test_.fake_hardware(),
-            LocalServerUrlForPath(server->GetPort(),
-                                  base::StringPrintf("/error-if-offset/%d/3",
-                                                     kBigLength)),
+            LocalServerUrlForPath(
+                server->GetPort(),
+                base::StringPrintf("/error-if-offset/%d/3", kBigLength)),
             ranges,
             "abcdefghijabcdefghijabcde",  // only received the first chunk
             25,
@@ -1427,9 +1394,7 @@
     EXPECT_FALSE(successful);
     MessageLoop::current()->BreakLoop();
   }
-  void TransferTerminated(HttpFetcher* fetcher) override {
-    ADD_FAILURE();
-  }
+  void TransferTerminated(HttpFetcher* fetcher) override { ADD_FAILURE(); }
 };
 
 void BlockedTransferTestHelper(AnyHttpFetcherTest* fetcher_test,
@@ -1447,11 +1412,13 @@
   fetcher_test->fake_hardware()->SetIsOfficialBuild(is_official_build);
   fetcher->set_delegate(&delegate);
 
-  MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
-      StartTransfer,
-      fetcher.get(),
-      LocalServerUrlForPath(server->GetPort(),
-                            fetcher_test->SmallUrl(server->GetPort()))));
+  MessageLoop::current()->PostTask(
+      FROM_HERE,
+      base::Bind(
+          StartTransfer,
+          fetcher.get(),
+          LocalServerUrlForPath(server->GetPort(),
+                                fetcher_test->SmallUrl(server->GetPort()))));
   MessageLoop::current()->Run();
 }
 }  // namespace
diff --git a/common/mock_hardware.h b/common/mock_hardware.h
index f972df2..84c0c5b 100644
--- a/common/mock_hardware.h
+++ b/common/mock_hardware.h
@@ -31,29 +31,25 @@
   MockHardware() {
     // Delegate all calls to the fake instance
     ON_CALL(*this, IsOfficialBuild())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::IsOfficialBuild));
+        .WillByDefault(testing::Invoke(&fake_, &FakeHardware::IsOfficialBuild));
     ON_CALL(*this, IsNormalBootMode())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::IsNormalBootMode));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeHardware::IsNormalBootMode));
     ON_CALL(*this, AreDevFeaturesEnabled())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::AreDevFeaturesEnabled));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeHardware::AreDevFeaturesEnabled));
     ON_CALL(*this, IsOOBEEnabled())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::IsOOBEEnabled));
+        .WillByDefault(testing::Invoke(&fake_, &FakeHardware::IsOOBEEnabled));
     ON_CALL(*this, IsOOBEComplete(testing::_))
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::IsOOBEComplete));
+        .WillByDefault(testing::Invoke(&fake_, &FakeHardware::IsOOBEComplete));
     ON_CALL(*this, GetHardwareClass())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::GetHardwareClass));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeHardware::GetHardwareClass));
     ON_CALL(*this, GetFirmwareVersion())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::GetFirmwareVersion));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeHardware::GetFirmwareVersion));
     ON_CALL(*this, GetECVersion())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::GetECVersion));
+        .WillByDefault(testing::Invoke(&fake_, &FakeHardware::GetECVersion));
     ON_CALL(*this, GetMinKernelKeyVersion())
         .WillByDefault(
             testing::Invoke(&fake_, &FakeHardware::GetMinKernelKeyVersion));
@@ -70,20 +66,20 @@
         .WillByDefault(
             testing::Invoke(&fake_, &FakeHardware::SetMaxKernelKeyRollforward));
     ON_CALL(*this, GetPowerwashCount())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::GetPowerwashCount));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeHardware::GetPowerwashCount));
     ON_CALL(*this, GetNonVolatileDirectory(testing::_))
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::GetNonVolatileDirectory));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeHardware::GetNonVolatileDirectory));
     ON_CALL(*this, GetPowerwashSafeDirectory(testing::_))
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::GetPowerwashSafeDirectory));
+        .WillByDefault(
+            testing::Invoke(&fake_, &FakeHardware::GetPowerwashSafeDirectory));
     ON_CALL(*this, GetFirstActiveOmahaPingSent())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::GetFirstActiveOmahaPingSent()));
+        .WillByDefault(testing::Invoke(
+            &fake_, &FakeHardware::GetFirstActiveOmahaPingSent()));
     ON_CALL(*this, SetFirstActiveOmahaPingSent())
-      .WillByDefault(testing::Invoke(&fake_,
-            &FakeHardware::SetFirstActiveOmahaPingSent()));
+        .WillByDefault(testing::Invoke(
+            &fake_, &FakeHardware::SetFirstActiveOmahaPingSent()));
   }
 
   ~MockHardware() override = default;
@@ -109,9 +105,7 @@
   MOCK_CONST_METHOD0(GetFirstActiveOmahaPingSent, bool());
 
   // Returns a reference to the underlying FakeHardware.
-  FakeHardware& fake() {
-    return fake_;
-  }
+  FakeHardware& fake() { return fake_; }
 
  private:
   // The underlying FakeHardware.
@@ -120,7 +114,6 @@
   DISALLOW_COPY_AND_ASSIGN(MockHardware);
 };
 
-
 }  // namespace chromeos_update_engine
 
 #endif  // UPDATE_ENGINE_COMMON_MOCK_HARDWARE_H_
diff --git a/common/mock_http_fetcher.cc b/common/mock_http_fetcher.cc
index 9507c9d..10e3b9e 100644
--- a/common/mock_http_fetcher.cc
+++ b/common/mock_http_fetcher.cc
@@ -32,8 +32,8 @@
 namespace chromeos_update_engine {
 
 MockHttpFetcher::~MockHttpFetcher() {
-  CHECK(timeout_id_ == MessageLoop::kTaskIdNull) <<
-      "Call TerminateTransfer() before dtor.";
+  CHECK(timeout_id_ == MessageLoop::kTaskIdNull)
+      << "Call TerminateTransfer() before dtor.";
 }
 
 void MockHttpFetcher::BeginTransfer(const std::string& url) {
diff --git a/common/mock_http_fetcher.h b/common/mock_http_fetcher.h
index 00f4e2b..492e6ce 100644
--- a/common/mock_http_fetcher.h
+++ b/common/mock_http_fetcher.h
@@ -56,8 +56,8 @@
 
   // Constructor overload for string data.
   MockHttpFetcher(const char* data, size_t size, ProxyResolver* proxy_resolver)
-      : MockHttpFetcher(reinterpret_cast<const uint8_t*>(data), size,
-                        proxy_resolver) {}
+      : MockHttpFetcher(
+            reinterpret_cast<const uint8_t*>(data), size, proxy_resolver) {}
 
   // Cleans up all internal state. Does not notify delegate
   ~MockHttpFetcher() override;
@@ -77,9 +77,7 @@
   void set_max_retry_count(int max_retry_count) override {}
 
   // Dummy: no bytes were downloaded.
-  size_t GetBytesDownloaded() override {
-    return sent_size_;
-  }
+  size_t GetBytesDownloaded() override { return sent_size_; }
 
   // Begins the transfer if it hasn't already begun.
   void BeginTransfer(const std::string& url) override;
@@ -107,9 +105,7 @@
   // If set to true, this will EXPECT fail on BeginTransfer
   void set_never_use(bool never_use) { never_use_ = never_use; }
 
-  const brillo::Blob& post_data() const {
-    return post_data_;
-  }
+  const brillo::Blob& post_data() const { return post_data_; }
 
  private:
   // Sends data to the delegate and sets up a timeout callback if needed. There
diff --git a/common/mock_prefs.h b/common/mock_prefs.h
index 0e639a2..2582e19 100644
--- a/common/mock_prefs.h
+++ b/common/mock_prefs.h
@@ -30,8 +30,8 @@
  public:
   MOCK_CONST_METHOD2(GetString,
                      bool(const std::string& key, std::string* value));
-  MOCK_METHOD2(SetString, bool(const std::string& key,
-                               const std::string& value));
+  MOCK_METHOD2(SetString,
+               bool(const std::string& key, const std::string& value));
   MOCK_CONST_METHOD2(GetInt64, bool(const std::string& key, int64_t* value));
   MOCK_METHOD2(SetInt64, bool(const std::string& key, const int64_t value));
 
diff --git a/common/multi_range_http_fetcher.cc b/common/multi_range_http_fetcher.cc
index 230106d..6ce3dae 100644
--- a/common/multi_range_http_fetcher.cc
+++ b/common/multi_range_http_fetcher.cc
@@ -95,8 +95,8 @@
   size_t next_size = length;
   Range range = ranges_[current_index_];
   if (range.HasLength()) {
-    next_size = std::min(next_size,
-                         range.length() - bytes_received_this_range_);
+    next_size =
+        std::min(next_size, range.length() - bytes_received_this_range_);
   }
   LOG_IF(WARNING, next_size <= 0) << "Asked to write length <= 0";
   // bytes_received_this_range_ needs to be updated regardless of the delegate_
diff --git a/common/multi_range_http_fetcher.h b/common/multi_range_http_fetcher.h
index 763c287..f57ea7f 100644
--- a/common/multi_range_http_fetcher.h
+++ b/common/multi_range_http_fetcher.h
@@ -62,9 +62,7 @@
     ranges_.push_back(Range(offset, size));
   }
 
-  void AddRange(off_t offset) {
-    ranges_.push_back(Range(offset));
-  }
+  void AddRange(off_t offset) { ranges_.push_back(Range(offset)); }
 
   // HttpFetcher overrides.
   void SetOffset(off_t offset) override;
diff --git a/common/platform_constants_android.cc b/common/platform_constants_android.cc
index 371fe26..9d8d30e 100644
--- a/common/platform_constants_android.cc
+++ b/common/platform_constants_android.cc
@@ -32,7 +32,7 @@
 const char kOmahaResponseDeadlineFile[] = "";
 const char kNonVolatileDirectory[] = "/data/misc/update_engine";
 const char kPostinstallMountOptions[] =
-  "context=u:object_r:postinstall_file:s0";
+    "context=u:object_r:postinstall_file:s0";
 
 }  // namespace constants
 }  // namespace chromeos_update_engine
diff --git a/common/platform_constants_chromeos.cc b/common/platform_constants_chromeos.cc
index 3653432..f1ac490 100644
--- a/common/platform_constants_chromeos.cc
+++ b/common/platform_constants_chromeos.cc
@@ -28,8 +28,7 @@
 const char kUpdatePayloadPublicKeyPath[] =
     "/usr/share/update_engine/update-payload-key.pub.pem";
 const char kCACertificatesPath[] = "/usr/share/chromeos-ca-certificates";
-const char kOmahaResponseDeadlineFile[] =
-    "/tmp/update-check-response-deadline";
+const char kOmahaResponseDeadlineFile[] = "/tmp/update-check-response-deadline";
 // This directory is wiped during powerwash.
 const char kNonVolatileDirectory[] = "/var/lib/update_engine";
 const char kPostinstallMountOptions[] = "";
diff --git a/common/prefs_unittest.cc b/common/prefs_unittest.cc
index aa2eb04..cb6fc70 100644
--- a/common/prefs_unittest.cc
+++ b/common/prefs_unittest.cc
@@ -30,13 +30,13 @@
 #include <gtest/gtest.h>
 
 using std::string;
-using testing::Eq;
 using testing::_;
+using testing::Eq;
 
 namespace {
 // Test key used along the tests.
 const char kKey[] = "test-key";
-}
+}  // namespace
 
 namespace chromeos_update_engine {
 
@@ -49,7 +49,8 @@
   }
 
   bool SetValue(const string& key, const string& value) {
-    return base::WriteFile(prefs_dir_.Append(key), value.data(),
+    return base::WriteFile(prefs_dir_.Append(key),
+                           value.data(),
                            value.length()) == static_cast<int>(value.length());
   }
 
@@ -143,16 +144,18 @@
 }
 
 TEST_F(PrefsTest, GetInt64Max) {
-  ASSERT_TRUE(SetValue(kKey, base::StringPrintf(
-      "%" PRIi64, std::numeric_limits<int64_t>::max())));
+  ASSERT_TRUE(SetValue(
+      kKey,
+      base::StringPrintf("%" PRIi64, std::numeric_limits<int64_t>::max())));
   int64_t value;
   EXPECT_TRUE(prefs_.GetInt64(kKey, &value));
   EXPECT_EQ(std::numeric_limits<int64_t>::max(), value);
 }
 
 TEST_F(PrefsTest, GetInt64Min) {
-  ASSERT_TRUE(SetValue(kKey, base::StringPrintf(
-        "%" PRIi64, std::numeric_limits<int64_t>::min())));
+  ASSERT_TRUE(SetValue(
+      kKey,
+      base::StringPrintf("%" PRIi64, std::numeric_limits<int64_t>::min())));
   int64_t value;
   EXPECT_TRUE(prefs_.GetInt64(kKey, &value));
   EXPECT_EQ(std::numeric_limits<int64_t>::min(), value);
diff --git a/common/subprocess.cc b/common/subprocess.cc
index 1715cb0..0131f10 100644
--- a/common/subprocess.cc
+++ b/common/subprocess.cc
@@ -101,7 +101,7 @@
 }  // namespace
 
 void Subprocess::Init(
-      brillo::AsynchronousSignalHandlerInterface* async_signal_handler) {
+    brillo::AsynchronousSignalHandlerInterface* async_signal_handler) {
   if (subprocess_singleton_ == this)
     return;
   CHECK(subprocess_singleton_ == nullptr);
@@ -186,9 +186,10 @@
   }
 
   pid_t pid = record->proc.pid();
-  CHECK(process_reaper_.WatchForChild(FROM_HERE, pid, base::Bind(
-      &Subprocess::ChildExitedCallback,
-      base::Unretained(this))));
+  CHECK(process_reaper_.WatchForChild(
+      FROM_HERE,
+      pid,
+      base::Bind(&Subprocess::ChildExitedCallback, base::Unretained(this))));
 
   record->stdout_fd = record->proc.GetPipe(STDOUT_FILENO);
   // Capture the subprocess output. Make our end of the pipe non-blocking.
@@ -237,10 +238,7 @@
   // The default for SynchronousExec is to use kSearchPath since the code relies
   // on that.
   return SynchronousExecFlags(
-      cmd,
-      kRedirectStderrToStdout | kSearchPath,
-      return_code,
-      stdout);
+      cmd, kRedirectStderrToStdout | kSearchPath, return_code, stdout);
 }
 
 bool Subprocess::SynchronousExecFlags(const vector<string>& cmd,
@@ -297,7 +295,6 @@
   }
 }
 
-
 Subprocess* Subprocess::subprocess_singleton_ = nullptr;
 
 }  // namespace chromeos_update_engine
diff --git a/common/subprocess.h b/common/subprocess.h
index 209158b..bc19d16 100644
--- a/common/subprocess.h
+++ b/common/subprocess.h
@@ -97,9 +97,7 @@
                                    std::string* stdout);
 
   // Gets the one instance.
-  static Subprocess& Get() {
-    return *subprocess_singleton_;
-  }
+  static Subprocess& Get() { return *subprocess_singleton_; }
 
   // Tries to log all in flight processes's output. It is used right before
   // exiting the update_engine, probably when the subprocess caused a system
@@ -111,7 +109,7 @@
 
   struct SubprocessRecord {
     explicit SubprocessRecord(const ExecCallback& callback)
-      : callback(callback) {}
+        : callback(callback) {}
 
     // The callback supplied by the caller.
     ExecCallback callback;
diff --git a/common/subprocess_unittest.cc b/common/subprocess_unittest.cc
index c8996db..104ef41 100644
--- a/common/subprocess_unittest.cc
+++ b/common/subprocess_unittest.cc
@@ -77,8 +77,10 @@
 
 namespace {
 
-void ExpectedResults(int expected_return_code, const string& expected_output,
-                     int return_code, const string& output) {
+void ExpectedResults(int expected_return_code,
+                     const string& expected_output,
+                     int return_code,
+                     const string& output) {
   EXPECT_EQ(expected_return_code, return_code);
   EXPECT_EQ(expected_output, output);
   MessageLoop::current()->BreakLoop();
@@ -88,8 +90,8 @@
   EXPECT_EQ(0, return_code);
   const std::set<string> allowed_envs = {"LD_LIBRARY_PATH", "PATH"};
   for (const string& key_value : brillo::string_utils::Split(output, "\n")) {
-    auto key_value_pair = brillo::string_utils::SplitAtFirst(
-        key_value, "=", true);
+    auto key_value_pair =
+        brillo::string_utils::SplitAtFirst(key_value, "=", true);
     EXPECT_NE(allowed_envs.end(), allowed_envs.find(key_value_pair.first));
   }
   MessageLoop::current()->BreakLoop();
@@ -197,9 +199,7 @@
 
 TEST_F(SubprocessTest, SynchronousEchoTest) {
   vector<string> cmd = {
-      kBinPath "/sh",
-      "-c",
-      "echo -n stdout-here; echo -n stderr-there >&2"};
+      kBinPath "/sh", "-c", "echo -n stdout-here; echo -n stderr-there >&2"};
   int rc = -1;
   string stdout;
   ASSERT_TRUE(Subprocess::SynchronousExec(cmd, &rc, &stdout));
@@ -259,20 +259,24 @@
                             fifo_fd,
                             MessageLoop::WatchMode::kWatchRead,
                             false,
-                            base::Bind([](int fifo_fd, uint32_t tag) {
-                              char c;
-                              EXPECT_EQ(1, HANDLE_EINTR(read(fifo_fd, &c, 1)));
-                              EXPECT_EQ('X', c);
-                              LOG(INFO) << "Killing tag " << tag;
-                              Subprocess::Get().KillExec(tag);
-                            }, fifo_fd, tag));
+                            base::Bind(
+                                [](int fifo_fd, uint32_t tag) {
+                                  char c;
+                                  EXPECT_EQ(1,
+                                            HANDLE_EINTR(read(fifo_fd, &c, 1)));
+                                  EXPECT_EQ('X', c);
+                                  LOG(INFO) << "Killing tag " << tag;
+                                  Subprocess::Get().KillExec(tag);
+                                },
+                                fifo_fd,
+                                tag));
 
   // This test would leak a callback that runs when the child process exits
   // unless we wait for it to run.
   brillo::MessageLoopRunUntil(
-      &loop_,
-      TimeDelta::FromSeconds(120),
-      base::Bind([] { return Subprocess::Get().subprocess_records_.empty(); }));
+      &loop_, TimeDelta::FromSeconds(120), base::Bind([] {
+        return Subprocess::Get().subprocess_records_.empty();
+      }));
   EXPECT_TRUE(Subprocess::Get().subprocess_records_.empty());
   // Check that there isn't anything else to read from the pipe.
   char c;
diff --git a/common/test_utils.cc b/common/test_utils.cc
index 2e44ff8..50b0962 100644
--- a/common/test_utils.cc
+++ b/common/test_utils.cc
@@ -68,44 +68,31 @@
 namespace test_utils {
 
 const uint8_t kRandomString[] = {
-  0xf2, 0xb7, 0x55, 0x92, 0xea, 0xa6, 0xc9, 0x57,
-  0xe0, 0xf8, 0xeb, 0x34, 0x93, 0xd9, 0xc4, 0x8f,
-  0xcb, 0x20, 0xfa, 0x37, 0x4b, 0x40, 0xcf, 0xdc,
-  0xa5, 0x08, 0x70, 0x89, 0x79, 0x35, 0xe2, 0x3d,
-  0x56, 0xa4, 0x75, 0x73, 0xa3, 0x6d, 0xd1, 0xd5,
-  0x26, 0xbb, 0x9c, 0x60, 0xbd, 0x2f, 0x5a, 0xfa,
-  0xb7, 0xd4, 0x3a, 0x50, 0xa7, 0x6b, 0x3e, 0xfd,
-  0x61, 0x2b, 0x3a, 0x31, 0x30, 0x13, 0x33, 0x53,
-  0xdb, 0xd0, 0x32, 0x71, 0x5c, 0x39, 0xed, 0xda,
-  0xb4, 0x84, 0xca, 0xbc, 0xbd, 0x78, 0x1c, 0x0c,
-  0xd8, 0x0b, 0x41, 0xe8, 0xe1, 0xe0, 0x41, 0xad,
-  0x03, 0x12, 0xd3, 0x3d, 0xb8, 0x75, 0x9b, 0xe6,
-  0xd9, 0x01, 0xd0, 0x87, 0xf4, 0x36, 0xfa, 0xa7,
-  0x0a, 0xfa, 0xc5, 0x87, 0x65, 0xab, 0x9a, 0x7b,
-  0xeb, 0x58, 0x23, 0xf0, 0xa8, 0x0a, 0xf2, 0x33,
-  0x3a, 0xe2, 0xe3, 0x35, 0x74, 0x95, 0xdd, 0x3c,
-  0x59, 0x5a, 0xd9, 0x52, 0x3a, 0x3c, 0xac, 0xe5,
-  0x15, 0x87, 0x6d, 0x82, 0xbc, 0xf8, 0x7d, 0xbe,
-  0xca, 0xd3, 0x2c, 0xd6, 0xec, 0x38, 0xeb, 0xe4,
-  0x53, 0xb0, 0x4c, 0x3f, 0x39, 0x29, 0xf7, 0xa4,
-  0x73, 0xa8, 0xcb, 0x32, 0x50, 0x05, 0x8c, 0x1c,
-  0x1c, 0xca, 0xc9, 0x76, 0x0b, 0x8f, 0x6b, 0x57,
-  0x1f, 0x24, 0x2b, 0xba, 0x82, 0xba, 0xed, 0x58,
-  0xd8, 0xbf, 0xec, 0x06, 0x64, 0x52, 0x6a, 0x3f,
-  0xe4, 0xad, 0xce, 0x84, 0xb4, 0x27, 0x55, 0x14,
-  0xe3, 0x75, 0x59, 0x73, 0x71, 0x51, 0xea, 0xe8,
-  0xcc, 0xda, 0x4f, 0x09, 0xaf, 0xa4, 0xbc, 0x0e,
-  0xa6, 0x1f, 0xe2, 0x3a, 0xf8, 0x96, 0x7d, 0x30,
-  0x23, 0xc5, 0x12, 0xb5, 0xd8, 0x73, 0x6b, 0x71,
-  0xab, 0xf1, 0xd7, 0x43, 0x58, 0xa7, 0xc9, 0xf0,
-  0xe4, 0x85, 0x1c, 0xd6, 0x92, 0x50, 0x2c, 0x98,
-  0x36, 0xfe, 0x87, 0xaf, 0x43, 0x8f, 0x8f, 0xf5,
-  0x88, 0x48, 0x18, 0x42, 0xcf, 0x42, 0xc1, 0xa8,
-  0xe8, 0x05, 0x08, 0xa1, 0x45, 0x70, 0x5b, 0x8c,
-  0x39, 0x28, 0xab, 0xe9, 0x6b, 0x51, 0xd2, 0xcb,
-  0x30, 0x04, 0xea, 0x7d, 0x2f, 0x6e, 0x6c, 0x3b,
-  0x5f, 0x82, 0xd9, 0x5b, 0x89, 0x37, 0x65, 0x65,
-  0xbe, 0x9f, 0xa3, 0x5d,
+    0xf2, 0xb7, 0x55, 0x92, 0xea, 0xa6, 0xc9, 0x57, 0xe0, 0xf8, 0xeb, 0x34,
+    0x93, 0xd9, 0xc4, 0x8f, 0xcb, 0x20, 0xfa, 0x37, 0x4b, 0x40, 0xcf, 0xdc,
+    0xa5, 0x08, 0x70, 0x89, 0x79, 0x35, 0xe2, 0x3d, 0x56, 0xa4, 0x75, 0x73,
+    0xa3, 0x6d, 0xd1, 0xd5, 0x26, 0xbb, 0x9c, 0x60, 0xbd, 0x2f, 0x5a, 0xfa,
+    0xb7, 0xd4, 0x3a, 0x50, 0xa7, 0x6b, 0x3e, 0xfd, 0x61, 0x2b, 0x3a, 0x31,
+    0x30, 0x13, 0x33, 0x53, 0xdb, 0xd0, 0x32, 0x71, 0x5c, 0x39, 0xed, 0xda,
+    0xb4, 0x84, 0xca, 0xbc, 0xbd, 0x78, 0x1c, 0x0c, 0xd8, 0x0b, 0x41, 0xe8,
+    0xe1, 0xe0, 0x41, 0xad, 0x03, 0x12, 0xd3, 0x3d, 0xb8, 0x75, 0x9b, 0xe6,
+    0xd9, 0x01, 0xd0, 0x87, 0xf4, 0x36, 0xfa, 0xa7, 0x0a, 0xfa, 0xc5, 0x87,
+    0x65, 0xab, 0x9a, 0x7b, 0xeb, 0x58, 0x23, 0xf0, 0xa8, 0x0a, 0xf2, 0x33,
+    0x3a, 0xe2, 0xe3, 0x35, 0x74, 0x95, 0xdd, 0x3c, 0x59, 0x5a, 0xd9, 0x52,
+    0x3a, 0x3c, 0xac, 0xe5, 0x15, 0x87, 0x6d, 0x82, 0xbc, 0xf8, 0x7d, 0xbe,
+    0xca, 0xd3, 0x2c, 0xd6, 0xec, 0x38, 0xeb, 0xe4, 0x53, 0xb0, 0x4c, 0x3f,
+    0x39, 0x29, 0xf7, 0xa4, 0x73, 0xa8, 0xcb, 0x32, 0x50, 0x05, 0x8c, 0x1c,
+    0x1c, 0xca, 0xc9, 0x76, 0x0b, 0x8f, 0x6b, 0x57, 0x1f, 0x24, 0x2b, 0xba,
+    0x82, 0xba, 0xed, 0x58, 0xd8, 0xbf, 0xec, 0x06, 0x64, 0x52, 0x6a, 0x3f,
+    0xe4, 0xad, 0xce, 0x84, 0xb4, 0x27, 0x55, 0x14, 0xe3, 0x75, 0x59, 0x73,
+    0x71, 0x51, 0xea, 0xe8, 0xcc, 0xda, 0x4f, 0x09, 0xaf, 0xa4, 0xbc, 0x0e,
+    0xa6, 0x1f, 0xe2, 0x3a, 0xf8, 0x96, 0x7d, 0x30, 0x23, 0xc5, 0x12, 0xb5,
+    0xd8, 0x73, 0x6b, 0x71, 0xab, 0xf1, 0xd7, 0x43, 0x58, 0xa7, 0xc9, 0xf0,
+    0xe4, 0x85, 0x1c, 0xd6, 0x92, 0x50, 0x2c, 0x98, 0x36, 0xfe, 0x87, 0xaf,
+    0x43, 0x8f, 0x8f, 0xf5, 0x88, 0x48, 0x18, 0x42, 0xcf, 0x42, 0xc1, 0xa8,
+    0xe8, 0x05, 0x08, 0xa1, 0x45, 0x70, 0x5b, 0x8c, 0x39, 0x28, 0xab, 0xe9,
+    0x6b, 0x51, 0xd2, 0xcb, 0x30, 0x04, 0xea, 0x7d, 0x2f, 0x6e, 0x6c, 0x3b,
+    0x5f, 0x82, 0xd9, 0x5b, 0x89, 0x37, 0x65, 0x65, 0xbe, 0x9f, 0xa3, 0x5d,
 };
 
 string Readlink(const string& path) {
@@ -205,8 +192,7 @@
   return true;
 }
 
-bool ExpectVectorsEq(const brillo::Blob& expected,
-                     const brillo::Blob& actual) {
+bool ExpectVectorsEq(const brillo::Blob& expected, const brillo::Blob& actual) {
   EXPECT_EQ(expected.size(), actual.size());
   if (expected.size() != actual.size())
     return false;
diff --git a/common/test_utils.h b/common/test_utils.h
index 5be48cf..44b7aa1 100644
--- a/common/test_utils.h
+++ b/common/test_utils.h
@@ -87,14 +87,14 @@
 class ScopedFilesystemUnmounter {
  public:
   explicit ScopedFilesystemUnmounter(const std::string& mountpoint)
-      : mountpoint_(mountpoint),
-        should_unmount_(true) {}
+      : mountpoint_(mountpoint), should_unmount_(true) {}
   ~ScopedFilesystemUnmounter() {
     if (should_unmount_) {
       utils::UnmountFilesystem(mountpoint_);
     }
   }
   void set_should_unmount(bool unmount) { should_unmount_ = unmount; }
+
  private:
   const std::string mountpoint_;
   bool should_unmount_;
@@ -183,10 +183,10 @@
 
 class NoneType;
 
-template<typename T>
+template <typename T>
 class ObjectFeederAction;
 
-template<typename T>
+template <typename T>
 class ActionTraits<ObjectFeederAction<T>> {
  public:
   typedef T OutputObjectType;
@@ -195,7 +195,7 @@
 
 // This is a simple Action class for testing. It feeds an object into
 // another action.
-template<typename T>
+template <typename T>
 class ObjectFeederAction : public Action<ObjectFeederAction<T>> {
  public:
   typedef NoneType InputObjectType;
@@ -210,17 +210,16 @@
   }
   static std::string StaticType() { return "ObjectFeederAction"; }
   std::string Type() const { return StaticType(); }
-  void set_obj(const T& out_obj) {
-    out_obj_ = out_obj;
-  }
+  void set_obj(const T& out_obj) { out_obj_ = out_obj; }
+
  private:
   T out_obj_;
 };
 
-template<typename T>
+template <typename T>
 class ObjectCollectorAction;
 
-template<typename T>
+template <typename T>
 class ActionTraits<ObjectCollectorAction<T>> {
  public:
   typedef NoneType OutputObjectType;
@@ -229,7 +228,7 @@
 
 // This is a simple Action class for testing. It receives an object from
 // another action.
-template<typename T>
+template <typename T>
 class ObjectCollectorAction : public Action<ObjectCollectorAction<T>> {
  public:
   typedef T InputObjectType;
@@ -245,6 +244,7 @@
   static std::string StaticType() { return "ObjectCollectorAction"; }
   std::string Type() const { return StaticType(); }
   const T& object() const { return object_; }
+
  private:
   T object_;
 };
diff --git a/common/utils.cc b/common/utils.cc
index c609013..34d97a2 100644
--- a/common/utils.cc
+++ b/common/utils.cc
@@ -86,8 +86,8 @@
 // Return true if |disk_name| is an MTD or a UBI device. Note that this test is
 // simply based on the name of the device.
 bool IsMtdDeviceName(const string& disk_name) {
-  return base::StartsWith(disk_name, "/dev/ubi",
-                          base::CompareCase::SENSITIVE) ||
+  return base::StartsWith(
+             disk_name, "/dev/ubi", base::CompareCase::SENSITIVE) ||
          base::StartsWith(disk_name, "/dev/mtd", base::CompareCase::SENSITIVE);
 }
 
@@ -228,13 +228,15 @@
   int num_attempts = 0;
   while (bytes_written < count) {
     num_attempts++;
-    ssize_t rc = pwrite(fd, c_buf + bytes_written, count - bytes_written,
+    ssize_t rc = pwrite(fd,
+                        c_buf + bytes_written,
+                        count - bytes_written,
                         offset + bytes_written);
     // TODO(garnold) for debugging failure in chromium-os:31077; to be removed.
     if (rc < 0) {
       PLOG(ERROR) << "pwrite error; num_attempts=" << num_attempts
-                  << " bytes_written=" << bytes_written
-                  << " count=" << count << " offset=" << offset;
+                  << " bytes_written=" << bytes_written << " count=" << count
+                  << " offset=" << offset;
     }
     TEST_AND_RETURN_FALSE_ERRNO(rc >= 0);
     bytes_written += rc;
@@ -262,13 +264,13 @@
   return WriteAll(fd, buf, count);
 }
 
-bool PReadAll(int fd, void* buf, size_t count, off_t offset,
-              ssize_t* out_bytes_read) {
+bool PReadAll(
+    int fd, void* buf, size_t count, off_t offset, ssize_t* out_bytes_read) {
   char* c_buf = static_cast<char*>(buf);
   ssize_t bytes_read = 0;
   while (bytes_read < static_cast<ssize_t>(count)) {
-    ssize_t rc = pread(fd, c_buf + bytes_read, count - bytes_read,
-                       offset + bytes_read);
+    ssize_t rc =
+        pread(fd, c_buf + bytes_read, count - bytes_read, offset + bytes_read);
     TEST_AND_RETURN_FALSE_ERRNO(rc >= 0);
     if (rc == 0) {
       break;
@@ -302,14 +304,14 @@
 
 // Append |nbytes| of content from |buf| to the vector pointed to by either
 // |vec_p| or |str_p|.
-static void AppendBytes(const uint8_t* buf, size_t nbytes,
+static void AppendBytes(const uint8_t* buf,
+                        size_t nbytes,
                         brillo::Blob* vec_p) {
   CHECK(buf);
   CHECK(vec_p);
   vec_p->insert(vec_p->end(), buf, buf + nbytes);
 }
-static void AppendBytes(const uint8_t* buf, size_t nbytes,
-                        string* str_p) {
+static void AppendBytes(const uint8_t* buf, size_t nbytes, string* str_p) {
   CHECK(buf);
   CHECK(str_p);
   str_p->append(buf, buf + nbytes);
@@ -387,7 +389,9 @@
   return ReadFileChunkAndAppend(path, 0, -1, out_p);
 }
 
-bool ReadFileChunk(const string& path, off_t offset, off_t size,
+bool ReadFileChunk(const string& path,
+                   off_t offset,
+                   off_t size,
                    brillo::Blob* out_p) {
   return ReadFileChunkAndAppend(path, offset, size, out_p);
 }
@@ -436,8 +440,8 @@
   const unsigned int bytes_per_line = 16;
   for (uint32_t i = 0; i < length; i += bytes_per_line) {
     const unsigned int bytes_remaining = length - i;
-    const unsigned int bytes_per_this_line = min(bytes_per_line,
-                                                 bytes_remaining);
+    const unsigned int bytes_per_this_line =
+        min(bytes_per_line, bytes_remaining);
     char header[100];
     int r = snprintf(header, sizeof(header), "0x%08x : ", i);
     TEST_AND_RETURN(r == 13);
@@ -456,8 +460,8 @@
 bool SplitPartitionName(const string& partition_name,
                         string* out_disk_name,
                         int* out_partition_num) {
-  if (!base::StartsWith(partition_name, "/dev/",
-                        base::CompareCase::SENSITIVE)) {
+  if (!base::StartsWith(
+          partition_name, "/dev/", base::CompareCase::SENSITIVE)) {
     LOG(ERROR) << "Invalid partition device name: " << partition_name;
     return false;
   }
@@ -489,8 +493,7 @@
     // Special case for MMC devices which have the following naming scheme:
     // mmcblk0p2
     size_t disk_name_len = last_nondigit_pos;
-    if (partition_name[last_nondigit_pos] != 'p' ||
-        last_nondigit_pos == 0 ||
+    if (partition_name[last_nondigit_pos] != 'p' || last_nondigit_pos == 0 ||
         !isdigit(partition_name[last_nondigit_pos - 1])) {
       disk_name_len++;
     }
@@ -498,8 +501,8 @@
   }
 
   if (out_partition_num) {
-    string partition_str = partition_name.substr(last_nondigit_pos + 1,
-                                                 partition_name_len);
+    string partition_str =
+        partition_name.substr(last_nondigit_pos + 1, partition_name_len);
     *out_partition_num = atoi(partition_str.c_str());
   }
   return true;
@@ -570,21 +573,15 @@
   }
 
   int exit_code;
-  vector<string> cmd = {
-      "ubiattach",
-      "-m",
-      base::StringPrintf("%d", volume_num),
-      "-d",
-      base::StringPrintf("%d", volume_num)
-  };
+  vector<string> cmd = {"ubiattach",
+                        "-m",
+                        base::StringPrintf("%d", volume_num),
+                        "-d",
+                        base::StringPrintf("%d", volume_num)};
   TEST_AND_RETURN_FALSE(Subprocess::SynchronousExec(cmd, &exit_code, nullptr));
   TEST_AND_RETURN_FALSE(exit_code == 0);
 
-  cmd = {
-      "ubiblock",
-      "--create",
-      volume_path
-  };
+  cmd = {"ubiblock", "--create", volume_path};
   TEST_AND_RETURN_FALSE(Subprocess::SynchronousExec(cmd, &exit_code, nullptr));
   TEST_AND_RETURN_FALSE(exit_code == 0);
 
@@ -604,7 +601,8 @@
       GetTempName(base_filename_template, &filename_template));
   DCHECK(filename || fd);
   vector<char> buf(filename_template.value().size() + 1);
-  memcpy(buf.data(), filename_template.value().data(),
+  memcpy(buf.data(),
+         filename_template.value().data(),
          filename_template.value().size());
   buf[filename_template.value().size()] = '\0';
 
@@ -638,8 +636,8 @@
 
   rc = ioctl(fd, BLKROSET, &expected_flag);
   if (rc != 0) {
-    PLOG(ERROR) << "Marking block device " << device << " as read_only="
-                << expected_flag;
+    PLOG(ERROR) << "Marking block device " << device
+                << " as read_only=" << expected_flag;
     return false;
   }
   return true;
@@ -657,13 +655,16 @@
     fstypes = {type.c_str()};
   }
   for (const char* fstype : fstypes) {
-    int rc = mount(device.c_str(), mountpoint.c_str(), fstype, mountflags,
+    int rc = mount(device.c_str(),
+                   mountpoint.c_str(),
+                   fstype,
+                   mountflags,
                    fs_mount_options.c_str());
     if (rc == 0)
       return true;
 
-    PLOG(WARNING) << "Unable to mount destination device " << device
-                  << " on " << mountpoint << " as " << fstype;
+    PLOG(WARNING) << "Unable to mount destination device " << device << " on "
+                  << mountpoint << " as " << fstype;
   }
   if (!type.empty()) {
     LOG(ERROR) << "Unable to mount " << device << " with any supported type";
@@ -721,7 +722,8 @@
 
 // Tries to parse the header of an ELF file to obtain a human-readable
 // description of it on the |output| string.
-static bool GetFileFormatELF(const uint8_t* buffer, size_t size,
+static bool GetFileFormatELF(const uint8_t* buffer,
+                             size_t size,
                              string* output) {
   // 0x00: EI_MAG - ELF magic header, 4 bytes.
   if (size < SELFMAG || memcmp(buffer, ELFMAG, SELFMAG) != 0)
@@ -855,12 +857,12 @@
   Time::Exploded exp_time;
   utc_time.UTCExplode(&exp_time);
   return base::StringPrintf("%d/%d/%d %d:%02d:%02d GMT",
-                      exp_time.month,
-                      exp_time.day_of_month,
-                      exp_time.year,
-                      exp_time.hour,
-                      exp_time.minute,
-                      exp_time.second);
+                            exp_time.month,
+                            exp_time.day_of_month,
+                            exp_time.year,
+                            exp_time.hour,
+                            exp_time.minute,
+                            exp_time.second);
 }
 
 string ToString(bool b) {
@@ -869,12 +871,16 @@
 
 string ToString(DownloadSource source) {
   switch (source) {
-    case kDownloadSourceHttpsServer: return "HttpsServer";
-    case kDownloadSourceHttpServer:  return "HttpServer";
-    case kDownloadSourceHttpPeer:    return "HttpPeer";
-    case kNumDownloadSources:        return "Unknown";
-    // Don't add a default case to let the compiler warn about newly added
-    // download sources which should be added here.
+    case kDownloadSourceHttpsServer:
+      return "HttpsServer";
+    case kDownloadSourceHttpServer:
+      return "HttpServer";
+    case kDownloadSourceHttpPeer:
+      return "HttpPeer";
+    case kNumDownloadSources:
+      return "Unknown";
+      // Don't add a default case to let the compiler warn about newly added
+      // download sources which should be added here.
   }
 
   return "Unknown";
@@ -882,12 +888,16 @@
 
 string ToString(PayloadType payload_type) {
   switch (payload_type) {
-    case kPayloadTypeDelta:      return "Delta";
-    case kPayloadTypeFull:       return "Full";
-    case kPayloadTypeForcedFull: return "ForcedFull";
-    case kNumPayloadTypes:       return "Unknown";
-    // Don't add a default case to let the compiler warn about newly added
-    // payload types which should be added here.
+    case kPayloadTypeDelta:
+      return "Delta";
+    case kPayloadTypeFull:
+      return "Full";
+    case kPayloadTypeForcedFull:
+      return "ForcedFull";
+    case kNumPayloadTypes:
+      return "Unknown";
+      // Don't add a default case to let the compiler warn about newly added
+      // payload types which should be added here.
   }
 
   return "Unknown";
@@ -916,8 +926,8 @@
 
 string StringVectorToString(const vector<string> &vec_str) {
   string str = "[";
-  for (vector<string>::const_iterator i = vec_str.begin();
-       i != vec_str.end(); ++i) {
+  for (vector<string>::const_iterator i = vec_str.begin(); i != vec_str.end();
+       ++i) {
     if (i != vec_str.begin())
       str += ", ";
     str += '"';
@@ -947,7 +957,7 @@
   time_t unix_time = time.ToTimeT();
   // Output of: date +"%s" --date="Jan 1, 2007 0:00 PST".
   const time_t kOmahaEpoch = 1167638400;
-  const int64_t kNumSecondsPerWeek = 7*24*3600;
+  const int64_t kNumSecondsPerWeek = 7 * 24 * 3600;
   const int64_t kNumDaysPerWeek = 7;
 
   time_t omaha_time = unix_time - kOmahaEpoch;
@@ -977,8 +987,10 @@
   return false;
 }
 
-bool ReadExtents(const string& path, const vector<Extent>& extents,
-                 brillo::Blob* out_data, ssize_t out_data_size,
+bool ReadExtents(const string& path,
+                 const vector<Extent>& extents,
+                 brillo::Blob* out_data,
+                 ssize_t out_data_size,
                  size_t block_size) {
   brillo::Blob data(out_data_size);
   ssize_t bytes_read = 0;
diff --git a/common/utils.h b/common/utils.h
index 4b83cc4..9160d9f 100644
--- a/common/utils.h
+++ b/common/utils.h
@@ -46,7 +46,7 @@
 
 // Formats |vec_str| as a string of the form ["<elem1>", "<elem2>"].
 // Does no escaping, only use this for presentation in error messages.
-std::string StringVectorToString(const std::vector<std::string> &vec_str);
+std::string StringVectorToString(const std::vector<std::string>& vec_str);
 
 // Calculates the p2p file id from payload hash and size
 std::string CalculateP2PFileId(const brillo::Blob& payload_hash,
@@ -81,11 +81,14 @@
 
 // Calls pread() repeatedly until count bytes are read, or EOF is reached.
 // Returns number of bytes read in *bytes_read. Returns true on success.
-bool PReadAll(int fd, void* buf, size_t count, off_t offset,
-              ssize_t* out_bytes_read);
+bool PReadAll(
+    int fd, void* buf, size_t count, off_t offset, ssize_t* out_bytes_read);
 
-bool PReadAll(const FileDescriptorPtr& fd, void* buf, size_t count,
-              off_t offset, ssize_t* out_bytes_read);
+bool PReadAll(const FileDescriptorPtr& fd,
+              void* buf,
+              size_t count,
+              off_t offset,
+              ssize_t* out_bytes_read);
 
 // Opens |path| for reading and appends its entire content to the container
 // pointed to by |out_p|. Returns true upon successfully reading all of the
@@ -94,7 +97,9 @@
 // |size| is not -1, only up to |size| bytes are read in.
 bool ReadFile(const std::string& path, brillo::Blob* out_p);
 bool ReadFile(const std::string& path, std::string* out_p);
-bool ReadFileChunk(const std::string& path, off_t offset, off_t size,
+bool ReadFileChunk(const std::string& path,
+                   off_t offset,
+                   off_t size,
                    brillo::Blob* out_p);
 
 // Invokes |cmd| in a pipe and appends its stdout to the container pointed to by
@@ -155,8 +160,7 @@
 // {"/dev/sda", 1} => "/dev/sda1"
 // {"/dev/mmcblk2", 12} => "/dev/mmcblk2p12"
 // Returns empty string when invalid parameters are passed in
-std::string MakePartitionName(const std::string& disk_name,
-                              int partition_num);
+std::string MakePartitionName(const std::string& disk_name, int partition_num);
 
 // Similar to "MakePartitionName" but returns a name that is suitable for
 // mounting. On NAND system we can write to "/dev/ubiX_0", which is what
@@ -217,12 +221,12 @@
   HexDumpArray(vect.data(), vect.size());
 }
 
-template<typename T>
-bool VectorIndexOf(const std::vector<T>& vect, const T& value,
+template <typename T>
+bool VectorIndexOf(const std::vector<T>& vect,
+                   const T& value,
                    typename std::vector<T>::size_type* out_index) {
-  typename std::vector<T>::const_iterator it = std::find(vect.begin(),
-                                                         vect.end(),
-                                                         value);
+  typename std::vector<T>::const_iterator it =
+      std::find(vect.begin(), vect.end(), value);
   if (it == vect.end()) {
     return false;
   } else {
@@ -278,7 +282,7 @@
 // into account so the result may up to one hour off. This is because
 // the glibc date and timezone routines depend on the TZ environment
 // variable and changing environment variables is not thread-safe.
-bool ConvertToOmahaInstallDate(base::Time time, int *out_num_days);
+bool ConvertToOmahaInstallDate(base::Time time, int* out_num_days);
 
 // Look for the minor version value in the passed |store| and set
 // |minor_version| to that value. Return whether the value was found and valid.
@@ -289,8 +293,10 @@
 // extents are read from the file at |path|. |out_data_size| is the size of
 // |out_data|. Returns false if the number of bytes to read given in
 // |extents| does not equal |out_data_size|.
-bool ReadExtents(const std::string& path, const std::vector<Extent>& extents,
-                 brillo::Blob* out_data, ssize_t out_data_size,
+bool ReadExtents(const std::string& path,
+                 const std::vector<Extent>& extents,
+                 brillo::Blob* out_data,
+                 ssize_t out_data_size,
                  size_t block_size);
 
 // Read the current boot identifier and store it in |boot_id|. This identifier
@@ -322,7 +328,6 @@
 
 }  // namespace utils
 
-
 // Utility class to close a file descriptor
 class ScopedFdCloser {
  public:
@@ -332,6 +337,7 @@
       *fd_ = -1;
   }
   void set_should_close(bool should_close) { should_close_ = should_close; }
+
  private:
   int* fd_;
   bool should_close_ = true;
@@ -342,8 +348,7 @@
 class ScopedPathUnlinker {
  public:
   explicit ScopedPathUnlinker(const std::string& path)
-      : path_(path),
-        should_remove_(true) {}
+      : path_(path), should_remove_(true) {}
   ~ScopedPathUnlinker() {
     if (should_remove_ && unlink(path_.c_str()) < 0) {
       PLOG(ERROR) << "Unable to unlink path " << path_;
@@ -389,54 +394,54 @@
 
 }  // namespace chromeos_update_engine
 
-#define TEST_AND_RETURN_FALSE_ERRNO(_x)                                        \
-  do {                                                                         \
-    bool _success = static_cast<bool>(_x);                                     \
-    if (!_success) {                                                           \
-      std::string _msg =                                                       \
-          chromeos_update_engine::utils::ErrnoNumberAsString(errno);           \
-      LOG(ERROR) << #_x " failed: " << _msg;                                   \
-      return false;                                                            \
-    }                                                                          \
+#define TEST_AND_RETURN_FALSE_ERRNO(_x)                              \
+  do {                                                               \
+    bool _success = static_cast<bool>(_x);                           \
+    if (!_success) {                                                 \
+      std::string _msg =                                             \
+          chromeos_update_engine::utils::ErrnoNumberAsString(errno); \
+      LOG(ERROR) << #_x " failed: " << _msg;                         \
+      return false;                                                  \
+    }                                                                \
   } while (0)
 
-#define TEST_AND_RETURN_FALSE(_x)                                              \
-  do {                                                                         \
-    bool _success = static_cast<bool>(_x);                                     \
-    if (!_success) {                                                           \
-      LOG(ERROR) << #_x " failed.";                                            \
-      return false;                                                            \
-    }                                                                          \
+#define TEST_AND_RETURN_FALSE(_x)          \
+  do {                                     \
+    bool _success = static_cast<bool>(_x); \
+    if (!_success) {                       \
+      LOG(ERROR) << #_x " failed.";        \
+      return false;                        \
+    }                                      \
   } while (0)
 
-#define TEST_AND_RETURN_ERRNO(_x)                                              \
-  do {                                                                         \
-    bool _success = static_cast<bool>(_x);                                     \
-    if (!_success) {                                                           \
-      std::string _msg =                                                       \
-          chromeos_update_engine::utils::ErrnoNumberAsString(errno);           \
-      LOG(ERROR) << #_x " failed: " << _msg;                                   \
-      return;                                                                  \
-    }                                                                          \
+#define TEST_AND_RETURN_ERRNO(_x)                                    \
+  do {                                                               \
+    bool _success = static_cast<bool>(_x);                           \
+    if (!_success) {                                                 \
+      std::string _msg =                                             \
+          chromeos_update_engine::utils::ErrnoNumberAsString(errno); \
+      LOG(ERROR) << #_x " failed: " << _msg;                         \
+      return;                                                        \
+    }                                                                \
   } while (0)
 
-#define TEST_AND_RETURN(_x)                                                    \
-  do {                                                                         \
-    bool _success = static_cast<bool>(_x);                                     \
-    if (!_success) {                                                           \
-      LOG(ERROR) << #_x " failed.";                                            \
-      return;                                                                  \
-    }                                                                          \
+#define TEST_AND_RETURN(_x)                \
+  do {                                     \
+    bool _success = static_cast<bool>(_x); \
+    if (!_success) {                       \
+      LOG(ERROR) << #_x " failed.";        \
+      return;                              \
+    }                                      \
   } while (0)
 
-#define TEST_AND_RETURN_FALSE_ERRCODE(_x)                                      \
-  do {                                                                         \
-    errcode_t _error = (_x);                                                   \
-    if (_error) {                                                              \
-      errno = _error;                                                          \
-      LOG(ERROR) << #_x " failed: " << _error;                                 \
-      return false;                                                            \
-    }                                                                          \
+#define TEST_AND_RETURN_FALSE_ERRCODE(_x)      \
+  do {                                         \
+    errcode_t _error = (_x);                   \
+    if (_error) {                              \
+      errno = _error;                          \
+      LOG(ERROR) << #_x " failed: " << _error; \
+      return false;                            \
+    }                                          \
   } while (0)
 
 #endif  // UPDATE_ENGINE_COMMON_UTILS_H_
diff --git a/common/utils_unittest.cc b/common/utils_unittest.cc
index b30b2d2..7d1c59e 100644
--- a/common/utils_unittest.cc
+++ b/common/utils_unittest.cc
@@ -39,16 +39,16 @@
 
 namespace chromeos_update_engine {
 
-class UtilsTest : public ::testing::Test { };
+class UtilsTest : public ::testing::Test {};
 
 TEST(UtilsTest, CanParseECVersion) {
   // Should be able to parse and valid key value line.
   EXPECT_EQ("12345", utils::ParseECVersion("fw_version=12345"));
-  EXPECT_EQ("123456", utils::ParseECVersion(
-      "b=1231a fw_version=123456 a=fasd2"));
+  EXPECT_EQ("123456",
+            utils::ParseECVersion("b=1231a fw_version=123456 a=fasd2"));
   EXPECT_EQ("12345", utils::ParseECVersion("fw_version=12345"));
-  EXPECT_EQ("00VFA616", utils::ParseECVersion(
-      "vendor=\"sam\" fw_version=\"00VFA616\""));
+  EXPECT_EQ("00VFA616",
+            utils::ParseECVersion("vendor=\"sam\" fw_version=\"00VFA616\""));
 
   // For invalid entries, should return the empty string.
   EXPECT_EQ("", utils::ParseECVersion("b=1231a fw_version a=fasd2"));
@@ -172,21 +172,18 @@
             utils::MakePartitionNameForMount("/dev/mmcblk0p2"));
   EXPECT_EQ("/dev/loop0", utils::MakePartitionNameForMount("/dev/loop0"));
   EXPECT_EQ("/dev/loop8", utils::MakePartitionNameForMount("/dev/loop8"));
-  EXPECT_EQ("/dev/loop12p2",
-            utils::MakePartitionNameForMount("/dev/loop12p2"));
+  EXPECT_EQ("/dev/loop12p2", utils::MakePartitionNameForMount("/dev/loop12p2"));
   EXPECT_EQ("/dev/ubiblock5_0",
             utils::MakePartitionNameForMount("/dev/ubiblock5_0"));
-  EXPECT_EQ("/dev/mtd4",
-            utils::MakePartitionNameForMount("/dev/ubi4_0"));
+  EXPECT_EQ("/dev/mtd4", utils::MakePartitionNameForMount("/dev/ubi4_0"));
   EXPECT_EQ("/dev/ubiblock3_0",
             utils::MakePartitionNameForMount("/dev/ubiblock3"));
   EXPECT_EQ("/dev/mtd2", utils::MakePartitionNameForMount("/dev/ubi2"));
-  EXPECT_EQ("/dev/ubi1_0",
-            utils::MakePartitionNameForMount("/dev/ubiblock1"));
+  EXPECT_EQ("/dev/ubi1_0", utils::MakePartitionNameForMount("/dev/ubiblock1"));
 }
 
 TEST(UtilsTest, FuzzIntTest) {
-  static const uint32_t kRanges[] = { 0, 1, 2, 20 };
+  static const uint32_t kRanges[] = {0, 1, 2, 20};
   for (uint32_t range : kRanges) {
     const int kValue = 50;
     for (int tries = 0; tries < 100; ++tries) {
@@ -252,18 +249,12 @@
   // which is not localized) so we only need to test the C locale
   EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromMilliseconds(100)),
             "0.1s");
-  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(0)),
-            "0s");
-  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(1)),
-            "1s");
-  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(59)),
-            "59s");
-  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(60)),
-            "1m0s");
-  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(61)),
-            "1m1s");
-  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(90)),
-            "1m30s");
+  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(0)), "0s");
+  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(1)), "1s");
+  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(59)), "59s");
+  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(60)), "1m0s");
+  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(61)), "1m1s");
+  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(90)), "1m30s");
   EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(1205)),
             "20m5s");
   EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(3600)),
@@ -283,8 +274,7 @@
   EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(200000) +
                                    base::TimeDelta::FromMilliseconds(1)),
             "2d7h33m20.001s");
-  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(-1)),
-            "-1s");
+  EXPECT_EQ(utils::FormatTimeDelta(base::TimeDelta::FromSeconds(-1)), "-1s");
 }
 
 TEST(UtilsTest, ConvertToOmahaInstallDate) {
@@ -305,29 +295,29 @@
   EXPECT_FALSE(utils::ConvertToOmahaInstallDate(
       base::Time::FromTimeT(omaha_epoch - 1), &value));
   EXPECT_FALSE(utils::ConvertToOmahaInstallDate(
-      base::Time::FromTimeT(omaha_epoch - 100*24*3600), &value));
+      base::Time::FromTimeT(omaha_epoch - 100 * 24 * 3600), &value));
 
   // Check that we jump from 0 to 7 exactly on the one-week mark, e.g.
   // on Jan 8, 2007 0:00 PST.
   EXPECT_TRUE(utils::ConvertToOmahaInstallDate(
-      base::Time::FromTimeT(omaha_epoch + 7*24*3600 - 1), &value));
+      base::Time::FromTimeT(omaha_epoch + 7 * 24 * 3600 - 1), &value));
   EXPECT_EQ(value, 0);
   EXPECT_TRUE(utils::ConvertToOmahaInstallDate(
-      base::Time::FromTimeT(omaha_epoch + 7*24*3600), &value));
+      base::Time::FromTimeT(omaha_epoch + 7 * 24 * 3600), &value));
   EXPECT_EQ(value, 7);
 
   // Check a couple of more values.
   EXPECT_TRUE(utils::ConvertToOmahaInstallDate(
-      base::Time::FromTimeT(omaha_epoch + 10*24*3600), &value));
+      base::Time::FromTimeT(omaha_epoch + 10 * 24 * 3600), &value));
   EXPECT_EQ(value, 7);
   EXPECT_TRUE(utils::ConvertToOmahaInstallDate(
-      base::Time::FromTimeT(omaha_epoch + 20*24*3600), &value));
+      base::Time::FromTimeT(omaha_epoch + 20 * 24 * 3600), &value));
   EXPECT_EQ(value, 14);
   EXPECT_TRUE(utils::ConvertToOmahaInstallDate(
-      base::Time::FromTimeT(omaha_epoch + 26*24*3600), &value));
+      base::Time::FromTimeT(omaha_epoch + 26 * 24 * 3600), &value));
   EXPECT_EQ(value, 21);
   EXPECT_TRUE(utils::ConvertToOmahaInstallDate(
-      base::Time::FromTimeT(omaha_epoch + 29*24*3600), &value));
+      base::Time::FromTimeT(omaha_epoch + 29 * 24 * 3600), &value));
   EXPECT_EQ(value, 28);
 
   // The date Jun 4, 2007 0:00 PDT is a Monday and is hence a point
diff --git a/common_service.cc b/common_service.cc
index 0f88151..0d5ee6d 100644
--- a/common_service.cc
+++ b/common_service.cc
@@ -50,7 +50,11 @@
 namespace {
 // Log and set the error on the passed ErrorPtr.
 void LogAndSetError(ErrorPtr* error,
+#if BASE_VER < 576279
+                    const tracked_objects::Location& location,
+#else
                     const base::Location& location,
+#endif
                     const string& reason) {
   brillo::Error::AddTo(error,
                        location,
@@ -67,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_android.cc b/hardware_android.cc
index a8a479d..21d4659 100644
--- a/hardware_android.cc
+++ b/hardware_android.cc
@@ -152,8 +152,9 @@
   return 0;
 }
 
-bool HardwareAndroid::SchedulePowerwash() {
+bool HardwareAndroid::SchedulePowerwash(bool is_rollback) {
   LOG(INFO) << "Scheduling a powerwash to BCB.";
+  LOG_IF(WARNING, is_rollback) << "is_rollback was true but isn't supported.";
   string err;
   if (!update_bootloader_message({"--wipe_data", "--reason=wipe_data_from_ota"},
                                  &err)) {
diff --git a/hardware_android.h b/hardware_android.h
index 920b659..5b3c99d 100644
--- a/hardware_android.h
+++ b/hardware_android.h
@@ -48,7 +48,7 @@
   bool SetMaxFirmwareKeyRollforward(int firmware_max_rollforward) override;
   bool SetMaxKernelKeyRollforward(int kernel_max_rollforward) override;
   int GetPowerwashCount() const override;
-  bool SchedulePowerwash() override;
+  bool SchedulePowerwash(bool is_rollback) override;
   bool CancelPowerwash() override;
   bool GetNonVolatileDirectory(base::FilePath* path) const override;
   bool GetPowerwashSafeDirectory(base::FilePath* path) const override;
diff --git a/hardware_chromeos.cc b/hardware_chromeos.cc
index 3949328..8ef05b2 100644
--- a/hardware_chromeos.cc
+++ b/hardware_chromeos.cc
@@ -61,9 +61,13 @@
 const char kPowerwashMarkerFile[] =
     "/mnt/stateful_partition/factory_install_reset";
 
-// The contents of the powerwash marker file.
+// The contents of the powerwash marker file for the non-rollback case.
 const char kPowerwashCommand[] = "safe fast keepimg reason=update_engine\n";
 
+// The contents of the powerwas marker file for the rollback case.
+const char kRollbackPowerwashCommand[] =
+    "safe fast keepimg rollback reason=update_engine\n";
+
 // UpdateManager config path.
 const char* kConfigFilePath = "/etc/update_manager.conf";
 
@@ -131,8 +135,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 +148,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 +215,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;
@@ -223,12 +226,15 @@
   return powerwash_count;
 }
 
-bool HardwareChromeOS::SchedulePowerwash() {
+bool HardwareChromeOS::SchedulePowerwash(bool is_rollback) {
+  const char* powerwash_command =
+      is_rollback ? kRollbackPowerwashCommand : kPowerwashCommand;
   bool result = utils::WriteFile(
-      kPowerwashMarkerFile, kPowerwashCommand, strlen(kPowerwashCommand));
+      kPowerwashMarkerFile, powerwash_command, strlen(powerwash_command));
   if (result) {
     LOG(INFO) << "Created " << kPowerwashMarkerFile
-              << " to powerwash on next reboot";
+              << " to powerwash on next reboot (is_rollback=" << is_rollback
+              << ")";
   } else {
     PLOG(ERROR) << "Error in creating powerwash marker file: "
                 << kPowerwashMarkerFile;
@@ -287,7 +293,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 +301,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 +315,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/hardware_chromeos.h b/hardware_chromeos.h
index 5c66641..8829866 100644
--- a/hardware_chromeos.h
+++ b/hardware_chromeos.h
@@ -53,7 +53,7 @@
   bool SetMaxFirmwareKeyRollforward(int firmware_max_rollforward) override;
   bool SetMaxKernelKeyRollforward(int kernel_max_rollforward) override;
   int GetPowerwashCount() const override;
-  bool SchedulePowerwash() override;
+  bool SchedulePowerwash(bool is_rollback) override;
   bool CancelPowerwash() override;
   bool GetNonVolatileDirectory(base::FilePath* path) const override;
   bool GetPowerwashSafeDirectory(base::FilePath* path) const override;
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_consumer/bzip_extent_writer.cc b/payload_consumer/bzip_extent_writer.cc
index 8926047..0c25c71 100644
--- a/payload_consumer/bzip_extent_writer.cc
+++ b/payload_consumer/bzip_extent_writer.cc
@@ -68,9 +68,8 @@
     if (stream_.avail_out == output_buffer.size())
       break;  // got no new bytes
 
-    TEST_AND_RETURN_FALSE(
-        next_->Write(output_buffer.data(),
-                     output_buffer.size() - stream_.avail_out));
+    TEST_AND_RETURN_FALSE(next_->Write(
+        output_buffer.data(), output_buffer.size() - stream_.avail_out));
 
     if (rc == BZ_STREAM_END)
       CHECK_EQ(stream_.avail_in, 0u);
diff --git a/payload_consumer/bzip_extent_writer.h b/payload_consumer/bzip_extent_writer.h
index 023db75..ec181a7 100644
--- a/payload_consumer/bzip_extent_writer.h
+++ b/payload_consumer/bzip_extent_writer.h
@@ -47,7 +47,7 @@
 
  private:
   std::unique_ptr<ExtentWriter> next_;  // The underlying ExtentWriter.
-  bz_stream stream_;  // the libbz2 stream
+  bz_stream stream_;                    // the libbz2 stream
   brillo::Blob input_buffer_;
 };
 
diff --git a/payload_consumer/bzip_extent_writer_unittest.cc b/payload_consumer/bzip_extent_writer_unittest.cc
index c121e11..125e1e5 100644
--- a/payload_consumer/bzip_extent_writer_unittest.cc
+++ b/payload_consumer/bzip_extent_writer_unittest.cc
@@ -46,9 +46,7 @@
     fd_.reset(new EintrSafeFileDescriptor);
     ASSERT_TRUE(fd_->Open(temp_file_.path().c_str(), O_RDWR, 0600));
   }
-  void TearDown() override {
-    fd_->Close();
-  }
+  void TearDown() override { fd_->Close(); }
 
   FileDescriptorPtr fd_;
   test_utils::ScopedTempFile temp_file_{"BzipExtentWriterTest-file.XXXXXX"};
@@ -60,10 +58,10 @@
   // 'echo test | bzip2 | hexdump' yields:
   static const char test_uncompressed[] = "test\n";
   static const uint8_t test[] = {
-    0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0xcc, 0xc3,
-    0x71, 0xd4, 0x00, 0x00, 0x02, 0x41, 0x80, 0x00, 0x10, 0x02, 0x00, 0x0c,
-    0x00, 0x20, 0x00, 0x21, 0x9a, 0x68, 0x33, 0x4d, 0x19, 0x97, 0x8b, 0xb9,
-    0x22, 0x9c, 0x28, 0x48, 0x66, 0x61, 0xb8, 0xea, 0x00,
+      0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0xcc, 0xc3,
+      0x71, 0xd4, 0x00, 0x00, 0x02, 0x41, 0x80, 0x00, 0x10, 0x02, 0x00, 0x0c,
+      0x00, 0x20, 0x00, 0x21, 0x9a, 0x68, 0x33, 0x4d, 0x19, 0x97, 0x8b, 0xb9,
+      0x22, 0x9c, 0x28, 0x48, 0x66, 0x61, 0xb8, 0xea, 0x00,
   };
 
   BzipExtentWriter bzip_writer(std::make_unique<DirectExtentWriter>());
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index 2834e61..f405bd9 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -176,7 +176,6 @@
 
 }  // namespace
 
-
 // Computes the ratio of |part| and |total|, scaled to |norm|, using integer
 // arithmetic.
 static uint64_t IntRatio(uint64_t part, uint64_t total, uint64_t norm) {
@@ -190,10 +189,9 @@
   if (num_total_operations_) {
     total_operations_str = std::to_string(num_total_operations_);
     // Upcasting to 64-bit to avoid overflow, back to size_t for formatting.
-    completed_percentage_str =
-        base::StringPrintf(" (%" PRIu64 "%%)",
-                           IntRatio(next_operation_num_, num_total_operations_,
-                                    100));
+    completed_percentage_str = base::StringPrintf(
+        " (%" PRIu64 "%%)",
+        IntRatio(next_operation_num_, num_total_operations_, 100));
   }
 
   // Format download total count and percentage.
@@ -203,15 +201,14 @@
   if (payload_size) {
     payload_size_str = std::to_string(payload_size);
     // Upcasting to 64-bit to avoid overflow, back to size_t for formatting.
-    downloaded_percentage_str =
-        base::StringPrintf(" (%" PRIu64 "%%)",
-                           IntRatio(total_bytes_received_, payload_size, 100));
+    downloaded_percentage_str = base::StringPrintf(
+        " (%" PRIu64 "%%)", IntRatio(total_bytes_received_, payload_size, 100));
   }
 
   LOG(INFO) << (message_prefix ? message_prefix : "") << next_operation_num_
             << "/" << total_operations_str << " operations"
-            << completed_percentage_str << ", " << total_bytes_received_
-            << "/" << payload_size_str << " bytes downloaded"
+            << completed_percentage_str << ", " << total_bytes_received_ << "/"
+            << payload_size_str << " bytes downloaded"
             << downloaded_percentage_str << ", overall progress "
             << overall_progress_ << "%";
 }
@@ -235,10 +232,10 @@
   size_t payload_size = payload_->size;
   unsigned actual_operations_weight = kProgressOperationsWeight;
   if (payload_size)
-    new_overall_progress += min(
-        static_cast<unsigned>(IntRatio(total_bytes_received_, payload_size,
-                                       kProgressDownloadWeight)),
-        kProgressDownloadWeight);
+    new_overall_progress +=
+        min(static_cast<unsigned>(IntRatio(
+                total_bytes_received_, payload_size, kProgressDownloadWeight)),
+            kProgressDownloadWeight);
   else
     actual_operations_weight += kProgressDownloadWeight;
 
@@ -246,8 +243,8 @@
   // expect an update to have at least one operation, so the expectation is that
   // this will eventually reach |actual_operations_weight|.
   if (num_total_operations_)
-    new_overall_progress += IntRatio(next_operation_num_, num_total_operations_,
-                                     actual_operations_weight);
+    new_overall_progress += IntRatio(
+        next_operation_num_, num_total_operations_, actual_operations_weight);
 
   // Progress ratio cannot recede, unless our assumptions about the total
   // payload size, total number of operations, or the monotonicity of progress
@@ -272,8 +269,8 @@
   last_progress_chunk_ = curr_progress_chunk;
 }
 
-
-size_t DeltaPerformer::CopyDataToBuffer(const char** bytes_p, size_t* count_p,
+size_t DeltaPerformer::CopyDataToBuffer(const char** bytes_p,
+                                        size_t* count_p,
                                         size_t max) {
   const size_t count = *count_p;
   if (!count)
@@ -288,8 +285,8 @@
   return read_len;
 }
 
-
-bool DeltaPerformer::HandleOpResult(bool op_result, const char* op_type_name,
+bool DeltaPerformer::HandleOpResult(bool op_result,
+                                    const char* op_type_name,
                                     ErrorCode* error) {
   if (op_result)
     return true;
@@ -308,8 +305,9 @@
 
 int DeltaPerformer::Close() {
   int err = -CloseCurrentPartition();
-  LOG_IF(ERROR, !payload_hash_calculator_.Finalize() ||
-                !signed_hash_calculator_.Finalize())
+  LOG_IF(ERROR,
+         !payload_hash_calculator_.Finalize() ||
+             !signed_hash_calculator_.Finalize())
       << "Unable to finalize the hash.";
   if (!buffer_.empty()) {
     LOG(INFO) << "Discarding " << buffer_.size() << " unused downloaded bytes";
@@ -560,19 +558,18 @@
   return MetadataParseResult::kSuccess;
 }
 
-#define OP_DURATION_HISTOGRAM(_op_name, _start_time)      \
-    LOCAL_HISTOGRAM_CUSTOM_TIMES(                         \
-        "UpdateEngine.DownloadAction.InstallOperation::"  \
-        _op_name ".Duration",                             \
-        base::TimeTicks::Now() - _start_time,             \
-        base::TimeDelta::FromMilliseconds(10),            \
-        base::TimeDelta::FromMinutes(5),                  \
-        20);
+#define OP_DURATION_HISTOGRAM(_op_name, _start_time)                         \
+  LOCAL_HISTOGRAM_CUSTOM_TIMES(                                              \
+      "UpdateEngine.DownloadAction.InstallOperation::" _op_name ".Duration", \
+      base::TimeTicks::Now() - _start_time,                                  \
+      base::TimeDelta::FromMilliseconds(10),                                 \
+      base::TimeDelta::FromMinutes(5),                                       \
+      20);
 
 // Wrapper around write. Returns true if all requested bytes
 // were written, or false on any error, regardless of progress
 // and stores an action exit code in |error|.
-bool DeltaPerformer::Write(const void* bytes, size_t count, ErrorCode *error) {
+bool DeltaPerformer::Write(const void* bytes, size_t count, ErrorCode* error) {
   *error = ErrorCode::kSuccess;
   const char* c_bytes = reinterpret_cast<const char*>(bytes);
 
@@ -584,9 +581,11 @@
     // Read data up to the needed limit; this is either maximium payload header
     // size, or the full metadata size (once it becomes known).
     const bool do_read_header = !IsHeaderParsed();
-    CopyDataToBuffer(&c_bytes, &count,
-                     (do_read_header ? kMaxPayloadHeaderSize :
-                      metadata_size_ + metadata_signature_size_));
+    CopyDataToBuffer(
+        &c_bytes,
+        &count,
+        (do_read_header ? kMaxPayloadHeaderSize
+                        : metadata_size_ + metadata_signature_size_));
 
     MetadataParseResult result = ParsePayloadMetadata(buffer_, error);
     if (result == MetadataParseResult::kError)
@@ -626,11 +625,12 @@
       acc_num_operations_.push_back(num_total_operations_);
     }
 
-    LOG_IF(WARNING, !prefs_->SetInt64(kPrefsManifestMetadataSize,
-                                      metadata_size_))
+    LOG_IF(WARNING,
+           !prefs_->SetInt64(kPrefsManifestMetadataSize, metadata_size_))
         << "Unable to save the manifest metadata size.";
-    LOG_IF(WARNING, !prefs_->SetInt64(kPrefsManifestSignatureSize,
-                                      metadata_signature_size_))
+    LOG_IF(WARNING,
+           !prefs_->SetInt64(kPrefsManifestSignatureSize,
+                             metadata_signature_size_))
         << "Unable to save the manifest signature size.";
 
     if (!PrimeUpdateState()) {
@@ -671,8 +671,9 @@
         return false;
       }
     }
-    const size_t partition_operation_num = next_operation_num_ - (
-        current_partition_ ? acc_num_operations_[current_partition_ - 1] : 0);
+    const size_t partition_operation_num =
+        next_operation_num_ -
+        (current_partition_ ? acc_num_operations_[current_partition_ - 1] : 0);
 
     const InstallOperation& op =
         partitions_[current_partition_].operations(partition_operation_num);
@@ -769,8 +770,7 @@
     if (manifest_.signatures_offset() != buffer_offset_) {
       LOG(ERROR) << "Payload signatures offset points to blob offset "
                  << manifest_.signatures_offset()
-                 << " but signatures are expected at offset "
-                 << buffer_offset_;
+                 << " but signatures are expected at offset " << buffer_offset_;
       *error = ErrorCode::kDownloadPayloadVerificationError;
       return false;
     }
@@ -1044,7 +1044,7 @@
   bool attempt_ioctl = true;
   int request =
       (operation.type() == InstallOperation::ZERO ? BLKZEROOUT : BLKDISCARD);
-#else  // !defined(BLKZEROOUT)
+#else   // !defined(BLKZEROOUT)
   bool attempt_ioctl = false;
   int request = 0;
 #endif  // !defined(BLKZEROOUT)
@@ -1062,8 +1062,8 @@
     // In case of failure, we fall back to writing 0 to the selected region.
     zeros.resize(16 * block_size_);
     for (uint64_t offset = 0; offset < length; offset += zeros.size()) {
-      uint64_t chunk_length = min(length - offset,
-                                  static_cast<uint64_t>(zeros.size()));
+      uint64_t chunk_length =
+          min(length - offset, static_cast<uint64_t>(zeros.size()));
       TEST_AND_RETURN_FALSE(utils::PWriteAll(
           target_fd_, zeros.data(), chunk_length, start + offset));
     }
@@ -1100,8 +1100,8 @@
                                           bytes,
                                           extent.start_block() * block_size_,
                                           &bytes_read_this_iteration));
-    TEST_AND_RETURN_FALSE(
-        bytes_read_this_iteration == static_cast<ssize_t>(bytes));
+    TEST_AND_RETURN_FALSE(bytes_read_this_iteration ==
+                          static_cast<ssize_t>(bytes));
     bytes_read += bytes_read_this_iteration;
   }
 
@@ -1573,8 +1573,7 @@
   TEST_AND_RETURN_FALSE(buffer_offset_ == manifest_.signatures_offset());
   TEST_AND_RETURN_FALSE(buffer_.size() >= manifest_.signatures_size());
   signatures_message_data_.assign(
-      buffer_.begin(),
-      buffer_.begin() + manifest_.signatures_size());
+      buffer_.begin(), buffer_.begin() + manifest_.signatures_size());
 
   // Save the signature blob because if the update is interrupted after the
   // download phase we don't go through this path anymore. Some alternatives to
@@ -1585,9 +1584,10 @@
   //
   // 2. Verify the signature as soon as it's received and don't checkpoint the
   // blob and the signed sha-256 context.
-  LOG_IF(WARNING, !prefs_->SetString(kPrefsUpdateStateSignatureBlob,
-                                     string(signatures_message_data_.begin(),
-                                            signatures_message_data_.end())))
+  LOG_IF(WARNING,
+         !prefs_->SetString(kPrefsUpdateStateSignatureBlob,
+                            string(signatures_message_data_.begin(),
+                                   signatures_message_data_.end())))
       << "Unable to store the signature blob.";
 
   LOG(INFO) << "Extracted signature data of size "
@@ -1666,10 +1666,8 @@
   }
 
   if (major_payload_version_ != kChromeOSMajorPayloadVersion) {
-    if (manifest_.has_old_rootfs_info() ||
-        manifest_.has_new_rootfs_info() ||
-        manifest_.has_old_kernel_info() ||
-        manifest_.has_new_kernel_info() ||
+    if (manifest_.has_old_rootfs_info() || manifest_.has_new_rootfs_info() ||
+        manifest_.has_old_kernel_info() || manifest_.has_new_kernel_info() ||
         manifest_.install_operations_size() != 0 ||
         manifest_.kernel_install_operations_size() != 0) {
       LOG(ERROR) << "Manifest contains deprecated field only supported in "
@@ -1766,12 +1764,12 @@
   return ErrorCode::kSuccess;
 }
 
-#define TEST_AND_RETURN_VAL(_retval, _condition)                \
-  do {                                                          \
-    if (!(_condition)) {                                        \
-      LOG(ERROR) << "VerifyPayload failure: " << #_condition;   \
-      return _retval;                                           \
-    }                                                           \
+#define TEST_AND_RETURN_VAL(_retval, _condition)              \
+  do {                                                        \
+    if (!(_condition)) {                                      \
+      LOG(ERROR) << "VerifyPayload failure: " << #_condition; \
+      return _retval;                                         \
+    }                                                         \
   } while (0);
 
 ErrorCode DeltaPerformer::VerifyPayload(
@@ -1843,8 +1841,7 @@
                                      const string& update_check_response_hash) {
   int64_t next_operation = kUpdateStateOperationInvalid;
   if (!(prefs->GetInt64(kPrefsUpdateStateNextOperation, &next_operation) &&
-        next_operation != kUpdateStateOperationInvalid &&
-        next_operation > 0))
+        next_operation != kUpdateStateOperationInvalid && next_operation > 0))
     return false;
 
   string interrupted_hash;
@@ -1916,33 +1913,33 @@
   if (last_updated_buffer_offset_ != buffer_offset_) {
     // Resets the progress in case we die in the middle of the state update.
     ResetUpdateProgress(prefs_, true);
-    TEST_AND_RETURN_FALSE(
-        prefs_->SetString(kPrefsUpdateStateSHA256Context,
-                          payload_hash_calculator_.GetContext()));
+    TEST_AND_RETURN_FALSE(prefs_->SetString(
+        kPrefsUpdateStateSHA256Context, payload_hash_calculator_.GetContext()));
     TEST_AND_RETURN_FALSE(
         prefs_->SetString(kPrefsUpdateStateSignedSHA256Context,
                           signed_hash_calculator_.GetContext()));
-    TEST_AND_RETURN_FALSE(prefs_->SetInt64(kPrefsUpdateStateNextDataOffset,
-                                           buffer_offset_));
+    TEST_AND_RETURN_FALSE(
+        prefs_->SetInt64(kPrefsUpdateStateNextDataOffset, buffer_offset_));
     last_updated_buffer_offset_ = buffer_offset_;
 
     if (next_operation_num_ < num_total_operations_) {
       size_t partition_index = current_partition_;
       while (next_operation_num_ >= acc_num_operations_[partition_index])
         partition_index++;
-      const size_t partition_operation_num = next_operation_num_ - (
-          partition_index ? acc_num_operations_[partition_index - 1] : 0);
+      const size_t partition_operation_num =
+          next_operation_num_ -
+          (partition_index ? acc_num_operations_[partition_index - 1] : 0);
       const InstallOperation& op =
           partitions_[partition_index].operations(partition_operation_num);
-      TEST_AND_RETURN_FALSE(prefs_->SetInt64(kPrefsUpdateStateNextDataLength,
-                                             op.data_length()));
+      TEST_AND_RETURN_FALSE(
+          prefs_->SetInt64(kPrefsUpdateStateNextDataLength, op.data_length()));
     } else {
-      TEST_AND_RETURN_FALSE(prefs_->SetInt64(kPrefsUpdateStateNextDataLength,
-                                             0));
+      TEST_AND_RETURN_FALSE(
+          prefs_->SetInt64(kPrefsUpdateStateNextDataLength, 0));
     }
   }
-  TEST_AND_RETURN_FALSE(prefs_->SetInt64(kPrefsUpdateStateNextOperation,
-                                         next_operation_num_));
+  TEST_AND_RETURN_FALSE(
+      prefs_->SetInt64(kPrefsUpdateStateNextOperation, next_operation_num_));
   return true;
 }
 
@@ -1951,8 +1948,7 @@
 
   int64_t next_operation = kUpdateStateOperationInvalid;
   if (!prefs_->GetInt64(kPrefsUpdateStateNextOperation, &next_operation) ||
-      next_operation == kUpdateStateOperationInvalid ||
-      next_operation <= 0) {
+      next_operation == kUpdateStateOperationInvalid || next_operation <= 0) {
     // Initiating a new update, no more state needs to be initialized.
     return true;
   }
@@ -1960,9 +1956,9 @@
 
   // Resuming an update -- load the rest of the update state.
   int64_t next_data_offset = -1;
-  TEST_AND_RETURN_FALSE(prefs_->GetInt64(kPrefsUpdateStateNextDataOffset,
-                                         &next_data_offset) &&
-                        next_data_offset >= 0);
+  TEST_AND_RETURN_FALSE(
+      prefs_->GetInt64(kPrefsUpdateStateNextDataOffset, &next_data_offset) &&
+      next_data_offset >= 0);
   buffer_offset_ = next_data_offset;
 
   // The signed hash context and the signature blob may be empty if the
@@ -1981,14 +1977,14 @@
   }
 
   string hash_context;
-  TEST_AND_RETURN_FALSE(prefs_->GetString(kPrefsUpdateStateSHA256Context,
-                                          &hash_context) &&
-                        payload_hash_calculator_.SetContext(hash_context));
+  TEST_AND_RETURN_FALSE(
+      prefs_->GetString(kPrefsUpdateStateSHA256Context, &hash_context) &&
+      payload_hash_calculator_.SetContext(hash_context));
 
   int64_t manifest_metadata_size = 0;
-  TEST_AND_RETURN_FALSE(prefs_->GetInt64(kPrefsManifestMetadataSize,
-                                         &manifest_metadata_size) &&
-                        manifest_metadata_size > 0);
+  TEST_AND_RETURN_FALSE(
+      prefs_->GetInt64(kPrefsManifestMetadataSize, &manifest_metadata_size) &&
+      manifest_metadata_size > 0);
   metadata_size_ = manifest_metadata_size;
 
   int64_t manifest_signature_size = 0;
diff --git a/payload_consumer/delta_performer.h b/payload_consumer/delta_performer.h
index 402e4be..55cb2a4 100644
--- a/payload_consumer/delta_performer.h
+++ b/payload_consumer/delta_performer.h
@@ -86,7 +86,7 @@
 
   // FileWriter's Write implementation that returns a more specific |error| code
   // in case of failures in Write operation.
-  bool Write(const void* bytes, size_t count, ErrorCode *error) override;
+  bool Write(const void* bytes, size_t count, ErrorCode* error) override;
 
   // Wrapper around close. Returns 0 on success or -errno on error.
   // Closes both 'path' given to Open() and the kernel path.
@@ -192,7 +192,8 @@
 
   // If |op_result| is false, emits an error message using |op_type_name| and
   // sets |*error| accordingly. Otherwise does nothing. Returns |op_result|.
-  bool HandleOpResult(bool op_result, const char* op_type_name,
+  bool HandleOpResult(bool op_result,
+                      const char* op_type_name,
                       ErrorCode* error);
 
   // Logs the progress of downloading/applying an update.
diff --git a/payload_consumer/delta_performer_integration_test.cc b/payload_consumer/delta_performer_integration_test.cc
index 0912764..e064077 100644
--- a/payload_consumer/delta_performer_integration_test.cc
+++ b/payload_consumer/delta_performer_integration_test.cc
@@ -50,11 +50,11 @@
 using std::string;
 using std::vector;
 using test_utils::GetBuildArtifactsPath;
+using test_utils::kRandomString;
 using test_utils::ScopedLoopMounter;
 using test_utils::System;
-using test_utils::kRandomString;
-using testing::Return;
 using testing::_;
+using testing::Return;
 
 extern const char* kUnittestPrivateKeyPath;
 extern const char* kUnittestPublicKeyPath;
@@ -62,8 +62,10 @@
 extern const char* kUnittestPublicKey2Path;
 
 static const uint32_t kDefaultKernelSize = 4096;  // Something small for a test
+// clang-format off
 static const uint8_t kNewData[] = {'T', 'h', 'i', 's', ' ', 'i', 's', ' ',
                                    'n', 'e', 'w', ' ', 'd', 'a', 't', 'a', '.'};
+// clang-format on
 
 namespace {
 struct DeltaState {
@@ -99,13 +101,13 @@
 };
 
 enum SignatureTest {
-  kSignatureNone,  // No payload signing.
-  kSignatureGenerator,  // Sign the payload at generation time.
-  kSignatureGenerated,  // Sign the payload after it's generated.
+  kSignatureNone,                  // No payload signing.
+  kSignatureGenerator,             // Sign the payload at generation time.
+  kSignatureGenerated,             // Sign the payload after it's generated.
   kSignatureGeneratedPlaceholder,  // Insert placeholder signatures, then real.
   kSignatureGeneratedPlaceholderMismatch,  // Insert a wrong sized placeholder.
   kSignatureGeneratedShell,  // Sign the generated payload through shell cmds.
-  kSignatureGeneratedShellBadKey,  // Sign with a bad key through shell cmds.
+  kSignatureGeneratedShellBadKey,     // Sign with a bad key through shell cmds.
   kSignatureGeneratedShellRotateCl1,  // Rotate key, test client v1
   kSignatureGeneratedShellRotateCl2,  // Rotate key, test client v2
 };
@@ -119,7 +121,8 @@
 
 class DeltaPerformerIntegrationTest : public ::testing::Test {};
 
-static void CompareFilesByBlock(const string& a_file, const string& b_file,
+static void CompareFilesByBlock(const string& a_file,
+                                const string& b_file,
                                 size_t image_size) {
   EXPECT_EQ(0U, image_size % kBlockSize);
 
@@ -133,7 +136,7 @@
     EXPECT_EQ(0U, i % kBlockSize);
     brillo::Blob a_sub(&a_data[i], &a_data[i + kBlockSize]);
     brillo::Blob b_sub(&b_data[i], &b_data[i + kBlockSize]);
-    EXPECT_TRUE(a_sub == b_sub) << "Block " << (i/kBlockSize) << " differs";
+    EXPECT_TRUE(a_sub == b_sub) << "Block " << (i / kBlockSize) << " differs";
   }
   if (::testing::Test::HasNonfatalFailure()) {
     LOG(INFO) << "Compared filesystems with size " << image_size
@@ -166,9 +169,7 @@
   brillo::Blob hash;
   EXPECT_TRUE(HashCalculator::RawHashOfData(data, &hash));
   brillo::Blob signature;
-  EXPECT_TRUE(PayloadSigner::SignHash(hash,
-                                      private_key_path,
-                                      &signature));
+  EXPECT_TRUE(PayloadSigner::SignHash(hash, private_key_path, &signature));
   return signature.size();
 }
 
@@ -179,11 +180,7 @@
   signatures.push_back(brillo::Blob(signature_size, 0));
 
   return PayloadSigner::AddSignatureToPayload(
-      payload_path,
-      signatures,
-      {},
-      payload_path,
-      out_metadata_size);
+      payload_path, signatures, {}, payload_path, out_metadata_size);
 }
 
 static void SignGeneratedPayload(const string& payload_path,
@@ -205,9 +202,7 @@
                                       const string& payload_path) {
   string private_key_path = GetBuildArtifactsPath(kUnittestPrivateKeyPath);
   if (signature_test == kSignatureGeneratedShellBadKey) {
-    ASSERT_TRUE(utils::MakeTempFile("key.XXXXXX",
-                                    &private_key_path,
-                                    nullptr));
+    ASSERT_TRUE(utils::MakeTempFile("key.XXXXXX", &private_key_path, nullptr));
   } else {
     ASSERT_TRUE(signature_test == kSignatureGeneratedShell ||
                 signature_test == kSignatureGeneratedShellRotateCl1 ||
@@ -239,8 +234,8 @@
   string signature_size_string;
   if (signature_test == kSignatureGeneratedShellRotateCl1 ||
       signature_test == kSignatureGeneratedShellRotateCl2)
-    signature_size_string = base::StringPrintf("%d:%d",
-                                               signature_size, signature_size);
+    signature_size_string =
+        base::StringPrintf("%d:%d", signature_size, signature_size);
   else
     signature_size_string = base::StringPrintf("%d", signature_size);
   string delta_generator_path = GetBuildArtifactsPath("delta_generator");
@@ -299,7 +294,7 @@
                               bool noop,
                               ssize_t chunk_size,
                               SignatureTest signature_test,
-                              DeltaState *state,
+                              DeltaState* state,
                               uint32_t minor_version) {
   EXPECT_TRUE(utils::MakeTempFile("a_img.XXXXXX", &state->a_img, nullptr));
   EXPECT_TRUE(utils::MakeTempFile("b_img.XXXXXX", &state->b_img, nullptr));
@@ -343,12 +338,13 @@
     brillo::Blob hardtocompress;
     while (hardtocompress.size() < 3 * kBlockSize) {
       hardtocompress.insert(hardtocompress.end(),
-                            std::begin(kRandomString), std::end(kRandomString));
+                            std::begin(kRandomString),
+                            std::end(kRandomString));
     }
-    EXPECT_TRUE(utils::WriteFile(base::StringPrintf("%s/hardtocompress",
-                                                    a_mnt.c_str()).c_str(),
-                                 hardtocompress.data(),
-                                 hardtocompress.size()));
+    EXPECT_TRUE(utils::WriteFile(
+        base::StringPrintf("%s/hardtocompress", a_mnt.c_str()).c_str(),
+        hardtocompress.data(),
+        hardtocompress.size()));
 
     brillo::Blob zeros(16 * 1024, 0);
     EXPECT_EQ(static_cast<int>(zeros.size()),
@@ -357,9 +353,8 @@
                               reinterpret_cast<const char*>(zeros.data()),
                               zeros.size()));
 
-    EXPECT_TRUE(
-        WriteSparseFile(base::StringPrintf("%s/move-from-sparse",
-                                           a_mnt.c_str()), 16 * 1024));
+    EXPECT_TRUE(WriteSparseFile(
+        base::StringPrintf("%s/move-from-sparse", a_mnt.c_str()), 16 * 1024));
 
     EXPECT_TRUE(WriteByteAtOffset(
         base::StringPrintf("%s/move-semi-sparse", a_mnt.c_str()), 4096));
@@ -367,10 +362,10 @@
     // Write 1 MiB of 0xff to try to catch the case where writing a bsdiff
     // patch fails to zero out the final block.
     brillo::Blob ones(1024 * 1024, 0xff);
-    EXPECT_TRUE(utils::WriteFile(base::StringPrintf("%s/ones",
-                                                    a_mnt.c_str()).c_str(),
-                                 ones.data(),
-                                 ones.size()));
+    EXPECT_TRUE(
+        utils::WriteFile(base::StringPrintf("%s/ones", a_mnt.c_str()).c_str(),
+                         ones.data(),
+                         ones.size()));
   }
 
   if (noop) {
@@ -381,9 +376,8 @@
     if (minor_version == kSourceMinorPayloadVersion) {
       // Create a result image with image_size bytes of garbage.
       brillo::Blob ones(state->image_size, 0xff);
-      EXPECT_TRUE(utils::WriteFile(state->result_img.c_str(),
-                                   ones.data(),
-                                   ones.size()));
+      EXPECT_TRUE(utils::WriteFile(
+          state->result_img.c_str(), ones.data(), ones.size()));
       EXPECT_EQ(utils::FileSize(state->a_img),
                 utils::FileSize(state->result_img));
     }
@@ -433,28 +427,26 @@
     brillo::Blob hardtocompress;
     while (hardtocompress.size() < 3 * kBlockSize) {
       hardtocompress.insert(hardtocompress.end(),
-                            std::begin(kRandomString), std::end(kRandomString));
+                            std::begin(kRandomString),
+                            std::end(kRandomString));
     }
-    EXPECT_TRUE(utils::WriteFile(base::StringPrintf("%s/hardtocompress",
-                                              b_mnt.c_str()).c_str(),
-                                 hardtocompress.data(),
-                                 hardtocompress.size()));
+    EXPECT_TRUE(utils::WriteFile(
+        base::StringPrintf("%s/hardtocompress", b_mnt.c_str()).c_str(),
+        hardtocompress.data(),
+        hardtocompress.size()));
   }
 
   string old_kernel;
-  EXPECT_TRUE(utils::MakeTempFile("old_kernel.XXXXXX",
-                                  &state->old_kernel,
-                                  nullptr));
+  EXPECT_TRUE(
+      utils::MakeTempFile("old_kernel.XXXXXX", &state->old_kernel, nullptr));
 
   string new_kernel;
-  EXPECT_TRUE(utils::MakeTempFile("new_kernel.XXXXXX",
-                                  &state->new_kernel,
-                                  nullptr));
+  EXPECT_TRUE(
+      utils::MakeTempFile("new_kernel.XXXXXX", &state->new_kernel, nullptr));
 
   string result_kernel;
-  EXPECT_TRUE(utils::MakeTempFile("result_kernel.XXXXXX",
-                                  &state->result_kernel,
-                                  nullptr));
+  EXPECT_TRUE(utils::MakeTempFile(
+      "result_kernel.XXXXXX", &state->result_kernel, nullptr));
 
   state->kernel_size = kDefaultKernelSize;
   state->old_kernel_data.resize(kDefaultKernelSize);
@@ -465,8 +457,8 @@
   test_utils::FillWithData(&state->result_kernel_data);
 
   // change the new kernel data
-  std::copy(std::begin(kNewData), std::end(kNewData),
-            state->new_kernel_data.begin());
+  std::copy(
+      std::begin(kNewData), std::end(kNewData), state->new_kernel_data.begin());
 
   if (noop) {
     state->old_kernel_data = state->new_kernel_data;
@@ -483,9 +475,7 @@
                                state->result_kernel_data.data(),
                                state->result_kernel_data.size()));
 
-  EXPECT_TRUE(utils::MakeTempFile("delta.XXXXXX",
-                                  &state->delta_path,
-                                  nullptr));
+  EXPECT_TRUE(utils::MakeTempFile("delta.XXXXXX", &state->delta_path, nullptr));
   LOG(INFO) << "delta path: " << state->delta_path;
   {
     const string private_key =
@@ -524,20 +514,18 @@
       EXPECT_TRUE(part.OpenFilesystem());
 
     EXPECT_TRUE(payload_config.Validate());
-    EXPECT_TRUE(
-        GenerateUpdatePayloadFile(
-            payload_config,
-            state->delta_path,
-            private_key,
-            &state->metadata_size));
+    EXPECT_TRUE(GenerateUpdatePayloadFile(
+        payload_config, state->delta_path, private_key, &state->metadata_size));
   }
   // Extend the "partitions" holding the file system a bit.
-  EXPECT_EQ(0, HANDLE_EINTR(truncate(state->a_img.c_str(),
-                                     state->image_size + 1024 * 1024)));
+  EXPECT_EQ(0,
+            HANDLE_EINTR(truncate(state->a_img.c_str(),
+                                  state->image_size + 1024 * 1024)));
   EXPECT_EQ(static_cast<off_t>(state->image_size + 1024 * 1024),
             utils::FileSize(state->a_img));
-  EXPECT_EQ(0, HANDLE_EINTR(truncate(state->b_img.c_str(),
-                                     state->image_size + 1024 * 1024)));
+  EXPECT_EQ(0,
+            HANDLE_EINTR(truncate(state->b_img.c_str(),
+                                  state->image_size + 1024 * 1024)));
   EXPECT_EQ(static_cast<off_t>(state->image_size + 1024 * 1024),
             utils::FileSize(state->b_img));
 
@@ -546,14 +534,14 @@
     int signature_size =
         GetSignatureSize(GetBuildArtifactsPath(kUnittestPrivateKeyPath));
     LOG(INFO) << "Inserting placeholder signature.";
-    ASSERT_TRUE(InsertSignaturePlaceholder(signature_size, state->delta_path,
-                                           &state->metadata_size));
+    ASSERT_TRUE(InsertSignaturePlaceholder(
+        signature_size, state->delta_path, &state->metadata_size));
 
     if (signature_test == kSignatureGeneratedPlaceholderMismatch) {
       signature_size -= 1;
       LOG(INFO) << "Inserting mismatched placeholder signature.";
-      ASSERT_FALSE(InsertSignaturePlaceholder(signature_size, state->delta_path,
-                                              &state->metadata_size));
+      ASSERT_FALSE(InsertSignaturePlaceholder(
+          signature_size, state->delta_path, &state->metadata_size));
       return;
     }
   }
@@ -574,8 +562,11 @@
   }
 }
 
-static void ApplyDeltaFile(bool full_kernel, bool full_rootfs, bool noop,
-                           SignatureTest signature_test, DeltaState* state,
+static void ApplyDeltaFile(bool full_kernel,
+                           bool full_rootfs,
+                           bool noop,
+                           SignatureTest signature_test,
+                           DeltaState* state,
                            bool hash_checks_mandatory,
                            OperationHashTest op_hash_test,
                            DeltaPerformer** performer,
@@ -615,8 +606,7 @@
         key_paths.push_back(GetBuildArtifactsPath(kUnittestPrivateKey2Path));
       }
       EXPECT_TRUE(PayloadSigner::SignatureBlobLength(
-          key_paths,
-          &expected_sig_data_length));
+          key_paths, &expected_sig_data_length));
       EXPECT_EQ(expected_sig_data_length, manifest.signatures_size());
       EXPECT_FALSE(signature.data().empty());
     }
@@ -663,7 +653,6 @@
       }
     }
 
-
     if (full_rootfs) {
       EXPECT_FALSE(manifest.has_old_rootfs_info());
       EXPECT_FALSE(manifest.has_old_image_info());
@@ -681,8 +670,8 @@
   }
 
   MockPrefs prefs;
-  EXPECT_CALL(prefs, SetInt64(kPrefsManifestMetadataSize,
-                              state->metadata_size)).WillOnce(Return(true));
+  EXPECT_CALL(prefs, SetInt64(kPrefsManifestMetadataSize, state->metadata_size))
+      .WillOnce(Return(true));
   EXPECT_CALL(prefs, SetInt64(kPrefsManifestSignatureSize, 0))
       .WillOnce(Return(true));
   EXPECT_CALL(prefs, SetInt64(kPrefsUpdateStateNextOperation, _))
@@ -745,12 +734,9 @@
 
   EXPECT_EQ(static_cast<off_t>(state->image_size),
             HashCalculator::RawHashOfFile(
-                state->a_img,
-                state->image_size,
-                &root_part.source_hash));
-  EXPECT_TRUE(HashCalculator::RawHashOfData(
-                  state->old_kernel_data,
-                  &kernel_part.source_hash));
+                state->a_img, state->image_size, &root_part.source_hash));
+  EXPECT_TRUE(HashCalculator::RawHashOfData(state->old_kernel_data,
+                                            &kernel_part.source_hash));
 
   // The partitions should be empty before DeltaPerformer.
   install_plan->partitions.clear();
@@ -801,9 +787,8 @@
   const size_t kBytesPerWrite = 5;
   for (size_t i = 0; i < state->delta.size(); i += kBytesPerWrite) {
     size_t count = std::min(state->delta.size() - i, kBytesPerWrite);
-    bool write_succeeded = ((*performer)->Write(&state->delta[i],
-                                                count,
-                                                &actual_error));
+    bool write_succeeded =
+        ((*performer)->Write(&state->delta[i], count, &actual_error));
     // Normally write_succeeded should be true every time and
     // actual_error should be ErrorCode::kSuccess. If so, continue the loop.
     // But if we seeded an operation hash error above, then write_succeeded
@@ -855,22 +840,21 @@
 
   brillo::Blob updated_kernel_partition;
   if (minor_version == kSourceMinorPayloadVersion) {
-    CompareFilesByBlock(state->result_kernel, state->new_kernel,
-                        state->kernel_size);
-    CompareFilesByBlock(state->result_img, state->b_img,
-                        state->image_size);
-    EXPECT_TRUE(utils::ReadFile(state->result_kernel,
-                                &updated_kernel_partition));
+    CompareFilesByBlock(
+        state->result_kernel, state->new_kernel, state->kernel_size);
+    CompareFilesByBlock(state->result_img, state->b_img, state->image_size);
+    EXPECT_TRUE(
+        utils::ReadFile(state->result_kernel, &updated_kernel_partition));
   } else {
-    CompareFilesByBlock(state->old_kernel, state->new_kernel,
-                        state->kernel_size);
-    CompareFilesByBlock(state->a_img, state->b_img,
-                        state->image_size);
+    CompareFilesByBlock(
+        state->old_kernel, state->new_kernel, state->kernel_size);
+    CompareFilesByBlock(state->a_img, state->b_img, state->image_size);
     EXPECT_TRUE(utils::ReadFile(state->old_kernel, &updated_kernel_partition));
   }
 
   ASSERT_GE(updated_kernel_partition.size(), arraysize(kNewData));
-  EXPECT_TRUE(std::equal(std::begin(kNewData), std::end(kNewData),
+  EXPECT_TRUE(std::equal(std::begin(kNewData),
+                         std::end(kNewData),
                          updated_kernel_partition.begin()));
 
   const auto& partitions = state->install_plan.partitions;
@@ -887,9 +871,8 @@
   EXPECT_EQ(state->image_size, partitions[0].target_size);
   brillo::Blob expected_new_rootfs_hash;
   EXPECT_EQ(static_cast<off_t>(state->image_size),
-            HashCalculator::RawHashOfFile(state->b_img,
-                                          state->image_size,
-                                          &expected_new_rootfs_hash));
+            HashCalculator::RawHashOfFile(
+                state->b_img, state->image_size, &expected_new_rootfs_hash));
   EXPECT_EQ(expected_new_rootfs_hash, partitions[0].target_hash);
 }
 
@@ -905,20 +888,29 @@
     case kSignatureGeneratedShellBadKey:
       expected_result = ErrorCode::kDownloadPayloadPubKeyVerificationError;
       break;
-    default: break;  // appease gcc
+    default:
+      break;  // appease gcc
   }
 
   VerifyPayloadResult(performer, state, expected_result, minor_version);
 }
 
-void DoSmallImageTest(bool full_kernel, bool full_rootfs, bool noop,
+void DoSmallImageTest(bool full_kernel,
+                      bool full_rootfs,
+                      bool noop,
                       ssize_t chunk_size,
                       SignatureTest signature_test,
-                      bool hash_checks_mandatory, uint32_t minor_version) {
+                      bool hash_checks_mandatory,
+                      uint32_t minor_version) {
   DeltaState state;
-  DeltaPerformer *performer = nullptr;
-  GenerateDeltaFile(full_kernel, full_rootfs, noop, chunk_size,
-                    signature_test, &state, minor_version);
+  DeltaPerformer* performer = nullptr;
+  GenerateDeltaFile(full_kernel,
+                    full_rootfs,
+                    noop,
+                    chunk_size,
+                    signature_test,
+                    &state,
+                    minor_version);
 
   ScopedPathUnlinker a_img_unlinker(state.a_img);
   ScopedPathUnlinker b_img_unlinker(state.b_img);
@@ -927,9 +919,15 @@
   ScopedPathUnlinker old_kernel_unlinker(state.old_kernel);
   ScopedPathUnlinker new_kernel_unlinker(state.new_kernel);
   ScopedPathUnlinker result_kernel_unlinker(state.result_kernel);
-  ApplyDeltaFile(full_kernel, full_rootfs, noop, signature_test,
-                 &state, hash_checks_mandatory, kValidOperationData,
-                 &performer, minor_version);
+  ApplyDeltaFile(full_kernel,
+                 full_rootfs,
+                 noop,
+                 signature_test,
+                 &state,
+                 hash_checks_mandatory,
+                 kValidOperationData,
+                 &performer,
+                 minor_version);
   VerifyPayload(performer, &state, signature_test, minor_version);
   delete performer;
 }
@@ -938,96 +936,170 @@
                                  bool hash_checks_mandatory) {
   DeltaState state;
   uint64_t minor_version = kFullPayloadMinorVersion;
-  GenerateDeltaFile(true, true, false, -1, kSignatureGenerated, &state,
-                    minor_version);
+  GenerateDeltaFile(
+      true, true, false, -1, kSignatureGenerated, &state, minor_version);
   ScopedPathUnlinker a_img_unlinker(state.a_img);
   ScopedPathUnlinker b_img_unlinker(state.b_img);
   ScopedPathUnlinker delta_unlinker(state.delta_path);
   ScopedPathUnlinker old_kernel_unlinker(state.old_kernel);
   ScopedPathUnlinker new_kernel_unlinker(state.new_kernel);
-  DeltaPerformer *performer = nullptr;
-  ApplyDeltaFile(true, true, false, kSignatureGenerated, &state,
-                 hash_checks_mandatory, op_hash_test, &performer,
+  DeltaPerformer* performer = nullptr;
+  ApplyDeltaFile(true,
+                 true,
+                 false,
+                 kSignatureGenerated,
+                 &state,
+                 hash_checks_mandatory,
+                 op_hash_test,
+                 &performer,
                  minor_version);
   delete performer;
 }
 
-
 TEST(DeltaPerformerIntegrationTest, RunAsRootSmallImageTest) {
-  DoSmallImageTest(false, false, false, -1, kSignatureGenerator,
-                   false, kInPlaceMinorPayloadVersion);
+  DoSmallImageTest(false,
+                   false,
+                   false,
+                   -1,
+                   kSignatureGenerator,
+                   false,
+                   kInPlaceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest,
      RunAsRootSmallImageSignaturePlaceholderTest) {
-  DoSmallImageTest(false, false, false, -1, kSignatureGeneratedPlaceholder,
-                   false, kInPlaceMinorPayloadVersion);
+  DoSmallImageTest(false,
+                   false,
+                   false,
+                   -1,
+                   kSignatureGeneratedPlaceholder,
+                   false,
+                   kInPlaceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest,
      RunAsRootSmallImageSignaturePlaceholderMismatchTest) {
   DeltaState state;
-  GenerateDeltaFile(false, false, false, -1,
-                    kSignatureGeneratedPlaceholderMismatch, &state,
+  GenerateDeltaFile(false,
+                    false,
+                    false,
+                    -1,
+                    kSignatureGeneratedPlaceholderMismatch,
+                    &state,
                     kInPlaceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest, RunAsRootSmallImageChunksTest) {
-  DoSmallImageTest(false, false, false, kBlockSize, kSignatureGenerator,
-                   false, kInPlaceMinorPayloadVersion);
+  DoSmallImageTest(false,
+                   false,
+                   false,
+                   kBlockSize,
+                   kSignatureGenerator,
+                   false,
+                   kInPlaceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest, RunAsRootFullKernelSmallImageTest) {
-  DoSmallImageTest(true, false, false, -1, kSignatureGenerator,
-                   false, kInPlaceMinorPayloadVersion);
+  DoSmallImageTest(true,
+                   false,
+                   false,
+                   -1,
+                   kSignatureGenerator,
+                   false,
+                   kInPlaceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest, RunAsRootFullSmallImageTest) {
-  DoSmallImageTest(true, true, false, -1, kSignatureGenerator,
-                   true, kFullPayloadMinorVersion);
+  DoSmallImageTest(true,
+                   true,
+                   false,
+                   -1,
+                   kSignatureGenerator,
+                   true,
+                   kFullPayloadMinorVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest, RunAsRootNoopSmallImageTest) {
-  DoSmallImageTest(false, false, true, -1, kSignatureGenerator,
-                   false, kInPlaceMinorPayloadVersion);
+  DoSmallImageTest(false,
+                   false,
+                   true,
+                   -1,
+                   kSignatureGenerator,
+                   false,
+                   kInPlaceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest, RunAsRootSmallImageSignNoneTest) {
-  DoSmallImageTest(false, false, false, -1, kSignatureNone,
-                   false, kInPlaceMinorPayloadVersion);
+  DoSmallImageTest(false,
+                   false,
+                   false,
+                   -1,
+                   kSignatureNone,
+                   false,
+                   kInPlaceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest, RunAsRootSmallImageSignGeneratedTest) {
-  DoSmallImageTest(false, false, false, -1, kSignatureGenerated,
-                   true, kInPlaceMinorPayloadVersion);
+  DoSmallImageTest(false,
+                   false,
+                   false,
+                   -1,
+                   kSignatureGenerated,
+                   true,
+                   kInPlaceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest, RunAsRootSmallImageSignGeneratedShellTest) {
-  DoSmallImageTest(false, false, false, -1, kSignatureGeneratedShell,
-                   false, kInPlaceMinorPayloadVersion);
+  DoSmallImageTest(false,
+                   false,
+                   false,
+                   -1,
+                   kSignatureGeneratedShell,
+                   false,
+                   kInPlaceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest,
      RunAsRootSmallImageSignGeneratedShellBadKeyTest) {
-  DoSmallImageTest(false, false, false, -1, kSignatureGeneratedShellBadKey,
-                   false, kInPlaceMinorPayloadVersion);
+  DoSmallImageTest(false,
+                   false,
+                   false,
+                   -1,
+                   kSignatureGeneratedShellBadKey,
+                   false,
+                   kInPlaceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest,
      RunAsRootSmallImageSignGeneratedShellRotateCl1Test) {
-  DoSmallImageTest(false, false, false, -1, kSignatureGeneratedShellRotateCl1,
-                   false, kInPlaceMinorPayloadVersion);
+  DoSmallImageTest(false,
+                   false,
+                   false,
+                   -1,
+                   kSignatureGeneratedShellRotateCl1,
+                   false,
+                   kInPlaceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest,
      RunAsRootSmallImageSignGeneratedShellRotateCl2Test) {
-  DoSmallImageTest(false, false, false, -1, kSignatureGeneratedShellRotateCl2,
-                   false, kInPlaceMinorPayloadVersion);
+  DoSmallImageTest(false,
+                   false,
+                   false,
+                   -1,
+                   kSignatureGeneratedShellRotateCl2,
+                   false,
+                   kInPlaceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest, RunAsRootSmallImageSourceOpsTest) {
-  DoSmallImageTest(false, false, false, -1, kSignatureGenerator,
-                   false, kSourceMinorPayloadVersion);
+  DoSmallImageTest(false,
+                   false,
+                   false,
+                   -1,
+                   kSignatureGenerator,
+                   false,
+                   kSourceMinorPayloadVersion);
 }
 
 TEST(DeltaPerformerIntegrationTest,
diff --git a/payload_consumer/delta_performer_unittest.cc b/payload_consumer/delta_performer_unittest.cc
index 4cf9756..61b58ed 100644
--- a/payload_consumer/delta_performer_unittest.cc
+++ b/payload_consumer/delta_performer_unittest.cc
@@ -54,8 +54,8 @@
 using std::string;
 using std::vector;
 using test_utils::GetBuildArtifactsPath;
-using test_utils::System;
 using test_utils::kRandomString;
+using test_utils::System;
 using testing::_;
 
 extern const char* kUnittestPrivateKeyPath;
@@ -93,6 +93,7 @@
     0xa8, 0x00, 0x0a, 0xfc, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x5a,
 };
 
+// clang-format off
 const uint8_t src_deflates[] = {
   /* raw      0  */ 0x11, 0x22,
   /* deflate  2  */ 0x63, 0x64, 0x62, 0x66, 0x61, 0x05, 0x00,
@@ -109,6 +110,7 @@
   /* deflate  9  */ 0x01, 0x05, 0x00, 0xFA, 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05,
   /* deflate  19 */ 0x63, 0x04, 0x00
 };
+// clang-format on
 
 // To generate this patch either:
 // - Use puffin/src/patching_unittest.cc:TestPatching
@@ -124,29 +126,29 @@
 //   --patch_file=patch.bin
 // * hexdump -ve '"  " 12/1 "0x%02x, " "\n"' patch.bin
 const uint8_t puffdiff_patch[] = {
-  0x50, 0x55, 0x46, 0x31, 0x00, 0x00, 0x00, 0x51, 0x08, 0x01, 0x12, 0x27,
-  0x0A, 0x04, 0x08, 0x10, 0x10, 0x32, 0x0A, 0x04, 0x08, 0x50, 0x10, 0x0A,
-  0x0A, 0x04, 0x08, 0x60, 0x10, 0x12, 0x12, 0x04, 0x08, 0x10, 0x10, 0x58,
-  0x12, 0x04, 0x08, 0x78, 0x10, 0x28, 0x12, 0x05, 0x08, 0xA8, 0x01, 0x10,
-  0x38, 0x18, 0x1F, 0x1A, 0x24, 0x0A, 0x02, 0x10, 0x32, 0x0A, 0x04, 0x08,
-  0x48, 0x10, 0x50, 0x0A, 0x05, 0x08, 0x98, 0x01, 0x10, 0x12, 0x12, 0x02,
-  0x10, 0x58, 0x12, 0x04, 0x08, 0x70, 0x10, 0x58, 0x12, 0x05, 0x08, 0xC8,
-  0x01, 0x10, 0x38, 0x18, 0x21, 0x42, 0x53, 0x44, 0x49, 0x46, 0x46, 0x34,
-  0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x42, 0x5A, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0x65,
-  0x29, 0x8C, 0x9B, 0x00, 0x00, 0x03, 0x60, 0x40, 0x7A, 0x0E, 0x08, 0x00,
-  0x40, 0x00, 0x20, 0x00, 0x21, 0x22, 0x9A, 0x3D, 0x4F, 0x50, 0x40, 0x0C,
-  0x3B, 0xC7, 0x9B, 0xB2, 0x21, 0x0E, 0xE9, 0x15, 0x98, 0x7A, 0x7C, 0x5D,
-  0xC9, 0x14, 0xE1, 0x42, 0x41, 0x94, 0xA6, 0x32, 0x6C, 0x42, 0x5A, 0x68,
-  0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0xF1, 0x20, 0x5F, 0x0D, 0x00,
-  0x00, 0x02, 0x41, 0x15, 0x42, 0x08, 0x20, 0x00, 0x40, 0x00, 0x00, 0x02,
-  0x40, 0x00, 0x20, 0x00, 0x22, 0x3D, 0x23, 0x10, 0x86, 0x03, 0x96, 0x54,
-  0x11, 0x16, 0x5F, 0x17, 0x72, 0x45, 0x38, 0x50, 0x90, 0xF1, 0x20, 0x5F,
-  0x0D, 0x42, 0x5A, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0x07,
-  0xD4, 0xCB, 0x6E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x20, 0x00,
-  0x21, 0x18, 0x46, 0x82, 0xEE, 0x48, 0xA7, 0x0A, 0x12, 0x00, 0xFA, 0x99,
-  0x6D, 0xC0};
+    0x50, 0x55, 0x46, 0x31, 0x00, 0x00, 0x00, 0x51, 0x08, 0x01, 0x12, 0x27,
+    0x0A, 0x04, 0x08, 0x10, 0x10, 0x32, 0x0A, 0x04, 0x08, 0x50, 0x10, 0x0A,
+    0x0A, 0x04, 0x08, 0x60, 0x10, 0x12, 0x12, 0x04, 0x08, 0x10, 0x10, 0x58,
+    0x12, 0x04, 0x08, 0x78, 0x10, 0x28, 0x12, 0x05, 0x08, 0xA8, 0x01, 0x10,
+    0x38, 0x18, 0x1F, 0x1A, 0x24, 0x0A, 0x02, 0x10, 0x32, 0x0A, 0x04, 0x08,
+    0x48, 0x10, 0x50, 0x0A, 0x05, 0x08, 0x98, 0x01, 0x10, 0x12, 0x12, 0x02,
+    0x10, 0x58, 0x12, 0x04, 0x08, 0x70, 0x10, 0x58, 0x12, 0x05, 0x08, 0xC8,
+    0x01, 0x10, 0x38, 0x18, 0x21, 0x42, 0x53, 0x44, 0x49, 0x46, 0x46, 0x34,
+    0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x42, 0x5A, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0x65,
+    0x29, 0x8C, 0x9B, 0x00, 0x00, 0x03, 0x60, 0x40, 0x7A, 0x0E, 0x08, 0x00,
+    0x40, 0x00, 0x20, 0x00, 0x21, 0x22, 0x9A, 0x3D, 0x4F, 0x50, 0x40, 0x0C,
+    0x3B, 0xC7, 0x9B, 0xB2, 0x21, 0x0E, 0xE9, 0x15, 0x98, 0x7A, 0x7C, 0x5D,
+    0xC9, 0x14, 0xE1, 0x42, 0x41, 0x94, 0xA6, 0x32, 0x6C, 0x42, 0x5A, 0x68,
+    0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0xF1, 0x20, 0x5F, 0x0D, 0x00,
+    0x00, 0x02, 0x41, 0x15, 0x42, 0x08, 0x20, 0x00, 0x40, 0x00, 0x00, 0x02,
+    0x40, 0x00, 0x20, 0x00, 0x22, 0x3D, 0x23, 0x10, 0x86, 0x03, 0x96, 0x54,
+    0x11, 0x16, 0x5F, 0x17, 0x72, 0x45, 0x38, 0x50, 0x90, 0xF1, 0x20, 0x5F,
+    0x0D, 0x42, 0x5A, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0x07,
+    0xD4, 0xCB, 0x6E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x20, 0x00,
+    0x21, 0x18, 0x46, 0x82, 0xEE, 0x48, 0xA7, 0x0A, 0x12, 0x00, 0xFA, 0x99,
+    0x6D, 0xC0};
 
 }  // namespace
 
@@ -254,8 +256,8 @@
   brillo::Blob ApplyPayload(const brillo::Blob& payload_data,
                             const string& source_path,
                             bool expect_success) {
-    return ApplyPayloadToData(payload_data, source_path, brillo::Blob(),
-                              expect_success);
+    return ApplyPayloadToData(
+        payload_data, source_path, brillo::Blob(), expect_success);
   }
 
   // Apply the payload provided in |payload_data| reading from the |source_path|
@@ -329,8 +331,10 @@
                                bool hash_checks_mandatory) {
     // Loads the payload and parses the manifest.
     brillo::Blob payload = GeneratePayload(brillo::Blob(),
-        vector<AnnotatedOperation>(), sign_payload,
-        kChromeOSMajorPayloadVersion, kFullPayloadMinorVersion);
+                                           vector<AnnotatedOperation>(),
+                                           sign_payload,
+                                           kChromeOSMajorPayloadVersion,
+                                           kFullPayloadMinorVersion);
 
     LOG(INFO) << "Payload size: " << payload.size();
 
@@ -429,8 +433,8 @@
 
 TEST_F(DeltaPerformerTest, FullPayloadWriteTest) {
   payload_.type = InstallPayloadType::kFull;
-  brillo::Blob expected_data = brillo::Blob(std::begin(kRandomString),
-                                            std::end(kRandomString));
+  brillo::Blob expected_data =
+      brillo::Blob(std::begin(kRandomString), std::end(kRandomString));
   expected_data.resize(4096);  // block size
   vector<AnnotatedOperation> aops;
   AnnotatedOperation aop;
@@ -440,16 +444,19 @@
   aop.op.set_type(InstallOperation::REPLACE);
   aops.push_back(aop);
 
-  brillo::Blob payload_data = GeneratePayload(expected_data, aops, false,
-      kChromeOSMajorPayloadVersion, kFullPayloadMinorVersion);
+  brillo::Blob payload_data = GeneratePayload(expected_data,
+                                              aops,
+                                              false,
+                                              kChromeOSMajorPayloadVersion,
+                                              kFullPayloadMinorVersion);
 
   EXPECT_EQ(expected_data, ApplyPayload(payload_data, "/dev/null", true));
 }
 
 TEST_F(DeltaPerformerTest, ShouldCancelTest) {
   payload_.type = InstallPayloadType::kFull;
-  brillo::Blob expected_data = brillo::Blob(std::begin(kRandomString),
-                                            std::end(kRandomString));
+  brillo::Blob expected_data =
+      brillo::Blob(std::begin(kRandomString), std::end(kRandomString));
   expected_data.resize(4096);  // block size
   vector<AnnotatedOperation> aops;
   AnnotatedOperation aop;
@@ -459,21 +466,23 @@
   aop.op.set_type(InstallOperation::REPLACE);
   aops.push_back(aop);
 
-  brillo::Blob payload_data = GeneratePayload(expected_data, aops, false,
-      kChromeOSMajorPayloadVersion, kFullPayloadMinorVersion);
+  brillo::Blob payload_data = GeneratePayload(expected_data,
+                                              aops,
+                                              false,
+                                              kChromeOSMajorPayloadVersion,
+                                              kFullPayloadMinorVersion);
 
   testing::Mock::VerifyAndClearExpectations(&mock_delegate_);
   EXPECT_CALL(mock_delegate_, ShouldCancel(_))
-      .WillOnce(
-          testing::DoAll(testing::SetArgPointee<0>(ErrorCode::kError),
-                         testing::Return(true)));
+      .WillOnce(testing::DoAll(testing::SetArgPointee<0>(ErrorCode::kError),
+                               testing::Return(true)));
 
   ApplyPayload(payload_data, "/dev/null", false);
 }
 
 TEST_F(DeltaPerformerTest, ReplaceOperationTest) {
-  brillo::Blob expected_data = brillo::Blob(std::begin(kRandomString),
-                                            std::end(kRandomString));
+  brillo::Blob expected_data =
+      brillo::Blob(std::begin(kRandomString), std::end(kRandomString));
   expected_data.resize(4096);  // block size
   vector<AnnotatedOperation> aops;
   AnnotatedOperation aop;
@@ -489,8 +498,8 @@
 }
 
 TEST_F(DeltaPerformerTest, ReplaceBzOperationTest) {
-  brillo::Blob expected_data = brillo::Blob(std::begin(kRandomString),
-                                            std::end(kRandomString));
+  brillo::Blob expected_data =
+      brillo::Blob(std::begin(kRandomString), std::end(kRandomString));
   expected_data.resize(4096);  // block size
   brillo::Blob bz_data;
   EXPECT_TRUE(BzipCompress(expected_data, &bz_data));
@@ -510,7 +519,7 @@
 
 TEST_F(DeltaPerformerTest, ReplaceXzOperationTest) {
   brillo::Blob xz_data(std::begin(kXzCompressedData),
-                         std::end(kXzCompressedData));
+                       std::end(kXzCompressedData));
   // The compressed xz data contains a single "a" and padded with zero for the
   // rest of the block.
   brillo::Blob expected_data = brillo::Blob(4096, 0);
@@ -533,10 +542,10 @@
   brillo::Blob expected_data = existing_data;
   // Blocks 4, 5 and 7 should have zeros instead of 'a' after the operation is
   // applied.
-  std::fill(expected_data.data() + 4096 * 4, expected_data.data() + 4096 * 6,
-            0);
-  std::fill(expected_data.data() + 4096 * 7, expected_data.data() + 4096 * 8,
-            0);
+  std::fill(
+      expected_data.data() + 4096 * 4, expected_data.data() + 4096 * 6, 0);
+  std::fill(
+      expected_data.data() + 4096 * 7, expected_data.data() + 4096 * 8, 0);
 
   AnnotatedOperation aop;
   *(aop.op.add_dst_extents()) = ExtentForRange(4, 2);
@@ -708,10 +717,8 @@
 
   string expected_output = "4096:4096,16384:8192,0:4083";
   string actual_output;
-  EXPECT_TRUE(DeltaPerformer::ExtentsToBsdiffPositionsString(extents,
-                                                             block_size,
-                                                             file_length,
-                                                             &actual_output));
+  EXPECT_TRUE(DeltaPerformer::ExtentsToBsdiffPositionsString(
+      extents, block_size, file_length, &actual_output));
   EXPECT_EQ(expected_output, actual_output);
 }
 
@@ -876,9 +883,8 @@
 }
 
 TEST_F(DeltaPerformerTest, BrilloParsePayloadMetadataTest) {
-  brillo::Blob payload_data = GeneratePayload({}, {}, true,
-                                              kBrilloMajorPayloadVersion,
-                                              kSourceMinorPayloadVersion);
+  brillo::Blob payload_data = GeneratePayload(
+      {}, {}, true, kBrilloMajorPayloadVersion, kSourceMinorPayloadVersion);
   install_plan_.hash_checks_mandatory = true;
   performer_.set_public_key_path(GetBuildArtifactsPath(kUnittestPublicKeyPath));
   ErrorCode error;
diff --git a/payload_consumer/download_action.cc b/payload_consumer/download_action.cc
index cfa8846..09afc42 100644
--- a/payload_consumer/download_action.cc
+++ b/payload_consumer/download_action.cc
@@ -56,6 +56,9 @@
       delegate_(nullptr),
       p2p_sharing_fd_(-1),
       p2p_visible_(true) {
+#if BASE_VER < 576279
+  base::StatisticsRecorder::Initialize();
+#endif
 }
 
 DownloadAction::~DownloadAction() {}
@@ -69,8 +72,7 @@
   }
 
   if (delete_p2p_file) {
-    FilePath path =
-      system_state_->p2p_manager()->FileGetPath(p2p_file_id_);
+    FilePath path = system_state_->p2p_manager()->FileGetPath(p2p_file_id_);
     if (unlink(path.value().c_str()) != 0) {
       PLOG(ERROR) << "Error deleting p2p file " << path.value();
     } else {
@@ -83,7 +85,7 @@
 }
 
 bool DownloadAction::SetupP2PSharingFd() {
-  P2PManager *p2p_manager = system_state_->p2p_manager();
+  P2PManager* p2p_manager = system_state_->p2p_manager();
 
   if (!p2p_manager->FileShare(p2p_file_id_, payload_->size)) {
     LOG(ERROR) << "Unable to share file via p2p";
@@ -144,23 +146,21 @@
   }
   if (p2p_size < file_offset) {
     LOG(ERROR) << "Wanting to write to file offset " << file_offset
-               << " but existing p2p file is only " << p2p_size
-               << " bytes.";
+               << " but existing p2p file is only " << p2p_size << " bytes.";
     CloseP2PSharingFd(true);  // Delete p2p file.
     return;
   }
 
   off_t cur_file_offset = lseek(p2p_sharing_fd_, file_offset, SEEK_SET);
   if (cur_file_offset != static_cast<off_t>(file_offset)) {
-    PLOG(ERROR) << "Error seeking to position "
-                << file_offset << " in p2p file";
+    PLOG(ERROR) << "Error seeking to position " << file_offset
+                << " in p2p file";
     CloseP2PSharingFd(true);  // Delete p2p file.
   } else {
     // OK, seeking worked, now write the data
     ssize_t bytes_written = write(p2p_sharing_fd_, data, length);
     if (bytes_written != static_cast<ssize_t>(length)) {
-      PLOG(ERROR) << "Error writing "
-                  << length << " bytes at file offset "
+      PLOG(ERROR) << "Error writing " << length << " bytes at file offset "
                   << file_offset << " in p2p file";
       CloseP2PSharingFd(true);  // Delete p2p file.
     }
@@ -374,7 +374,7 @@
       code = delta_performer_->VerifyPayload(payload_->hash, payload_->size);
     if (code == ErrorCode::kSuccess) {
       if (payload_ < &install_plan_.payloads.back() &&
-                 system_state_->payload_state()->NextPayload()) {
+          system_state_->payload_state()->NextPayload()) {
         LOG(INFO) << "Incrementing to next payload";
         // No need to reset if this payload was already applied.
         if (delta_performer_ && !payload_->already_applied)
@@ -395,8 +395,8 @@
       // Log UpdateEngine.DownloadAction.* histograms to help diagnose
       // long-blocking operations.
       std::string histogram_output;
-      base::StatisticsRecorder::WriteGraph(
-          "UpdateEngine.DownloadAction.", &histogram_output);
+      base::StatisticsRecorder::WriteGraph("UpdateEngine.DownloadAction.",
+                                           &histogram_output);
       LOG(INFO) << histogram_output;
     } else {
       LOG(ERROR) << "Download of " << install_plan_.download_url
diff --git a/payload_consumer/download_action.h b/payload_consumer/download_action.h
index 028a99a..1777e22 100644
--- a/payload_consumer/download_action.h
+++ b/payload_consumer/download_action.h
@@ -64,8 +64,7 @@
 
 class PrefsInterface;
 
-class DownloadAction : public InstallPlanAction,
-                       public HttpFetcherDelegate {
+class DownloadAction : public InstallPlanAction, public HttpFetcherDelegate {
  public:
   // Debugging/logging
   static std::string StaticType() { return "DownloadAction"; }
@@ -90,9 +89,7 @@
   std::string Type() const override { return StaticType(); }
 
   // Testing
-  void SetTestFileWriter(FileWriter* writer) {
-    writer_ = writer;
-  }
+  void SetTestFileWriter(FileWriter* writer) { writer_ = writer; }
 
   int GetHTTPResponseCode() { return http_fetcher_->http_response_code(); }
 
@@ -105,9 +102,7 @@
   void TransferTerminated(HttpFetcher* fetcher) override;
 
   DownloadActionDelegate* delegate() const { return delegate_; }
-  void set_delegate(DownloadActionDelegate* delegate) {
-    delegate_ = delegate;
-  }
+  void set_delegate(DownloadActionDelegate* delegate) { delegate_ = delegate; }
 
   void set_base_offset(int64_t base_offset) { base_offset_ = base_offset; }
 
diff --git a/payload_consumer/download_action_unittest.cc b/payload_consumer/download_action_unittest.cc
index 84673c8..e6ca219 100644
--- a/payload_consumer/download_action_unittest.cc
+++ b/payload_consumer/download_action_unittest.cc
@@ -52,13 +52,13 @@
 using std::string;
 using std::unique_ptr;
 using test_utils::ScopedTempFile;
+using testing::_;
 using testing::AtLeast;
 using testing::InSequence;
 using testing::Return;
 using testing::SetArgPointee;
-using testing::_;
 
-class DownloadActionTest : public ::testing::Test { };
+class DownloadActionTest : public ::testing::Test {};
 
 namespace {
 
@@ -158,9 +158,8 @@
   auto feeder_action = std::make_unique<ObjectFeederAction<InstallPlan>>();
   feeder_action->set_obj(install_plan);
   MockPrefs prefs;
-  MockHttpFetcher* http_fetcher = new MockHttpFetcher(data.data(),
-                                                      data.size(),
-                                                      nullptr);
+  MockHttpFetcher* http_fetcher =
+      new MockHttpFetcher(data.data(), data.size(), nullptr);
   // takes ownership of passed in HttpFetcher
   auto download_action =
       std::make_unique<DownloadAction>(&prefs,
@@ -209,7 +208,7 @@
   const char* foo = "foo";
   small.insert(small.end(), foo, foo + strlen(foo));
   TestWithData(small,
-               0,  // fail_write
+               0,      // fail_write
                true);  // use_download_delegate
 }
 
@@ -221,7 +220,7 @@
     c = ('9' == c) ? '0' : c + 1;
   }
   TestWithData(big,
-               0,  // fail_write
+               0,      // fail_write
                true);  // use_download_delegate
 }
 
@@ -233,7 +232,7 @@
     c = ('9' == c) ? '0' : c + 1;
   }
   TestWithData(big,
-               2,  // fail_write
+               2,      // fail_write
                true);  // use_download_delegate
 }
 
@@ -242,7 +241,7 @@
   const char* foo = "foofoo";
   small.insert(small.end(), foo, foo + strlen(foo));
   TestWithData(small,
-               0,  // fail_write
+               0,       // fail_write
                false);  // use_download_delegate
 }
 
@@ -352,8 +351,7 @@
   brillo::FakeMessageLoop loop(nullptr);
   loop.SetAsCurrent();
 
-  brillo::Blob data(kMockHttpFetcherChunkSize +
-                      kMockHttpFetcherChunkSize / 2);
+  brillo::Blob data(kMockHttpFetcherChunkSize + kMockHttpFetcherChunkSize / 2);
   memset(data.data(), 0, data.size());
 
   ScopedTempFile temp_file;
@@ -414,7 +412,7 @@
 
 class DownloadActionTestAction;
 
-template<>
+template <>
 class ActionTraits<DownloadActionTestAction> {
  public:
   typedef InstallPlan OutputObjectType;
@@ -516,20 +514,15 @@
 class P2PDownloadActionTest : public testing::Test {
  protected:
   P2PDownloadActionTest()
-    : start_at_offset_(0),
-      fake_um_(fake_system_state_.fake_clock()) {}
+      : start_at_offset_(0), fake_um_(fake_system_state_.fake_clock()) {}
 
   ~P2PDownloadActionTest() override {}
 
   // Derived from testing::Test.
-  void SetUp() override {
-    loop_.SetAsCurrent();
-  }
+  void SetUp() override { loop_.SetAsCurrent(); }
 
   // Derived from testing::Test.
-  void TearDown() override {
-    EXPECT_FALSE(loop_.PendingTasks());
-  }
+  void TearDown() override { EXPECT_FALSE(loop_.PendingTasks()); }
 
   // To be called by tests to setup the download. The
   // |starting_offset| parameter is for where to resume.
@@ -541,10 +534,13 @@
       data_ += 'a' + (i % 25);
 
     // Setup p2p.
-    FakeP2PManagerConfiguration *test_conf = new FakeP2PManagerConfiguration();
-    p2p_manager_.reset(P2PManager::Construct(
-        test_conf, nullptr, &fake_um_, "cros_au", 3,
-        base::TimeDelta::FromDays(5)));
+    FakeP2PManagerConfiguration* test_conf = new FakeP2PManagerConfiguration();
+    p2p_manager_.reset(P2PManager::Construct(test_conf,
+                                             nullptr,
+                                             &fake_um_,
+                                             "cros_au",
+                                             3,
+                                             base::TimeDelta::FromDays(5)));
     fake_system_state_.set_p2p_manager(p2p_manager_.get());
   }
 
@@ -634,8 +630,8 @@
   EXPECT_EQ(static_cast<int>(data_.length()),
             p2p_manager_->FileGetExpectedSize(file_id));
   string p2p_file_contents;
-  EXPECT_TRUE(ReadFileToString(p2p_manager_->FileGetPath(file_id),
-                               &p2p_file_contents));
+  EXPECT_TRUE(
+      ReadFileToString(p2p_manager_->FileGetPath(file_id), &p2p_file_contents));
   EXPECT_EQ(data_, p2p_file_contents);
 }
 
@@ -660,8 +656,10 @@
   string existing_data;
   for (unsigned int i = 0; i < 1000; i++)
     existing_data += '0' + (i % 10);
-  ASSERT_EQ(WriteFile(p2p_manager_->FileGetPath(file_id), existing_data.c_str(),
-                      1000), 1000);
+  ASSERT_EQ(
+      WriteFile(
+          p2p_manager_->FileGetPath(file_id), existing_data.c_str(), 1000),
+      1000);
 
   StartDownload(true);  // use_p2p_to_share
 
@@ -675,8 +673,8 @@
   string p2p_file_contents;
   // Check that the first 1000 bytes wasn't touched and that we
   // appended the remaining as appropriate.
-  EXPECT_TRUE(ReadFileToString(p2p_manager_->FileGetPath(file_id),
-                               &p2p_file_contents));
+  EXPECT_TRUE(
+      ReadFileToString(p2p_manager_->FileGetPath(file_id), &p2p_file_contents));
   EXPECT_EQ(existing_data, p2p_file_contents.substr(0, 1000));
   EXPECT_EQ(data_.substr(1000), p2p_file_contents.substr(1000));
 }
@@ -692,8 +690,10 @@
   string existing_data;
   for (unsigned int i = 0; i < 1000; i++)
     existing_data += '0' + (i % 10);
-  ASSERT_EQ(WriteFile(p2p_manager_->FileGetPath(file_id), existing_data.c_str(),
-                      1000), 1000);
+  ASSERT_EQ(
+      WriteFile(
+          p2p_manager_->FileGetPath(file_id), existing_data.c_str(), 1000),
+      1000);
 
   // Check that the file is there.
   EXPECT_EQ(1000, p2p_manager_->FileGetSize(file_id));
diff --git a/payload_consumer/extent_reader.cc b/payload_consumer/extent_reader.cc
index 96ea918..ad983ae 100644
--- a/payload_consumer/extent_reader.cc
+++ b/payload_consumer/extent_reader.cc
@@ -16,6 +16,8 @@
 
 #include "update_engine/payload_consumer/extent_reader.h"
 
+#include <algorithm>
+
 #include <sys/types.h>
 #include <unistd.h>
 
@@ -52,8 +54,9 @@
   }
   // The first item is zero and upper_bound never returns it because it always
   // return the item which is greater than the given value.
-  auto extent_idx = std::upper_bound(
-      extents_upper_bounds_.begin(), extents_upper_bounds_.end(), offset) -
+  auto extent_idx =
+      std::upper_bound(
+          extents_upper_bounds_.begin(), extents_upper_bounds_.end(), offset) -
       extents_upper_bounds_.begin() - 1;
   cur_extent_ = std::next(extents_.begin(), extent_idx);
   offset_ = offset;
diff --git a/payload_consumer/extent_writer_unittest.cc b/payload_consumer/extent_writer_unittest.cc
index 580c4a6..aef856b 100644
--- a/payload_consumer/extent_writer_unittest.cc
+++ b/payload_consumer/extent_writer_unittest.cc
@@ -50,9 +50,7 @@
     fd_.reset(new EintrSafeFileDescriptor);
     ASSERT_TRUE(fd_->Open(temp_file_.path().c_str(), O_RDWR, 0600));
   }
-  void TearDown() override {
-    fd_->Close();
-  }
+  void TearDown() override { fd_->Close(); }
 
   // Writes data to an extent writer in 'chunk_size' chunks with
   // the first chunk of size first_chunk_size. It calculates what the
@@ -79,8 +77,8 @@
   EXPECT_TRUE(utils::ReadFile(temp_file_.path(), &result_file));
 
   brillo::Blob expected_file(kBlockSize);
-  expected_file.insert(expected_file.end(),
-                       bytes.data(), bytes.data() + bytes.size());
+  expected_file.insert(
+      expected_file.end(), bytes.data(), bytes.data() + bytes.size());
   ExpectVectorsEq(expected_file, result_file);
 }
 
@@ -135,10 +133,10 @@
   expected_file.insert(expected_file.end(),
                        data.begin() + kBlockSize,
                        data.begin() + kBlockSize * 2);
-  expected_file.insert(expected_file.end(),
-                       data.begin(), data.begin() + kBlockSize);
-  expected_file.insert(expected_file.end(),
-                       data.begin() + kBlockSize * 2, data.end());
+  expected_file.insert(
+      expected_file.end(), data.begin(), data.begin() + kBlockSize);
+  expected_file.insert(
+      expected_file.end(), data.begin() + kBlockSize * 2, data.end());
   ExpectVectorsEq(expected_file, result_file);
 }
 
@@ -158,8 +156,8 @@
 
   size_t bytes_written = 0;
   while (bytes_written < (block_count * kBlockSize)) {
-    size_t bytes_to_write = min(block_count * kBlockSize - bytes_written,
-                                data.size());
+    size_t bytes_to_write =
+        min(block_count * kBlockSize - bytes_written, data.size());
     EXPECT_TRUE(direct_writer.Write(data.data(), bytes_to_write));
     bytes_written += bytes_to_write;
   }
diff --git a/payload_consumer/fake_file_descriptor.h b/payload_consumer/fake_file_descriptor.h
index c9fea7d..8dbd10b 100644
--- a/payload_consumer/fake_file_descriptor.h
+++ b/payload_consumer/fake_file_descriptor.h
@@ -69,9 +69,7 @@
     return false;
   }
 
-  bool Flush() override {
-    return open_;
-  }
+  bool Flush() override { return open_; }
 
   bool Close() override {
     if (!open_)
diff --git a/payload_consumer/file_descriptor.cc b/payload_consumer/file_descriptor.cc
index 4eabb8f..1de615c 100644
--- a/payload_consumer/file_descriptor.cc
+++ b/payload_consumer/file_descriptor.cc
@@ -89,7 +89,7 @@
   // operations.
 #ifndef BLKZEROOUT
   return false;
-#else  // defined(BLKZEROOUT)
+#else   // defined(BLKZEROOUT)
   DCHECK(request == BLKDISCARD || request == BLKZEROOUT ||
          request == BLKSECDISCARD);
   // On some devices, the BLKDISCARD will actually read back as zeros, instead
diff --git a/payload_consumer/file_descriptor.h b/payload_consumer/file_descriptor.h
index 5e524d9..55f76c6 100644
--- a/payload_consumer/file_descriptor.h
+++ b/payload_consumer/file_descriptor.h
@@ -18,8 +18,8 @@
 #define UPDATE_ENGINE_PAYLOAD_CONSUMER_FILE_DESCRIPTOR_H_
 
 #include <errno.h>
-#include <memory>
 #include <sys/types.h>
+#include <memory>
 
 #include <base/logging.h>
 
@@ -125,12 +125,8 @@
                 int* result) override;
   bool Flush() override;
   bool Close() override;
-  bool IsSettingErrno() override {
-    return true;
-  }
-  bool IsOpen() override {
-    return (fd_ >= 0);
-  }
+  bool IsSettingErrno() override { return true; }
+  bool IsOpen() override { return (fd_ >= 0); }
 
  protected:
   int fd_;
diff --git a/payload_consumer/file_writer.cc b/payload_consumer/file_writer.cc
index d280ddb..84b19ed 100644
--- a/payload_consumer/file_writer.cc
+++ b/payload_consumer/file_writer.cc
@@ -34,8 +34,7 @@
 
   size_t bytes_written = 0;
   while (bytes_written < count) {
-    ssize_t rc = write(fd_, char_bytes + bytes_written,
-                       count - bytes_written);
+    ssize_t rc = write(fd_, char_bytes + bytes_written, count - bytes_written);
     if (rc < 0)
       return false;
     bytes_written += rc;
diff --git a/payload_consumer/file_writer.h b/payload_consumer/file_writer.h
index 96ebde6..cdc9fa0 100644
--- a/payload_consumer/file_writer.h
+++ b/payload_consumer/file_writer.h
@@ -47,11 +47,9 @@
   // in addition if the returned value is false. By default this method
   // returns kActionExitDownloadWriteError as the error code, but subclasses
   // can override if they wish to return more specific error codes.
-  virtual bool Write(const void* bytes,
-                     size_t count,
-                     ErrorCode* error) {
-     *error = ErrorCode::kDownloadWriteError;
-     return Write(bytes, count);
+  virtual bool Write(const void* bytes, size_t count, ErrorCode* error) {
+    *error = ErrorCode::kDownloadWriteError;
+    return Write(bytes, count);
   }
 
   // Wrapper around close. Returns 0 on success or -errno on error.
@@ -92,6 +90,7 @@
       LOG(ERROR) << "FileWriter::Close failed: "
                  << utils::ErrnoNumberAsString(-err);
   }
+
  private:
   FileWriter* writer_;
 
diff --git a/payload_consumer/file_writer_unittest.cc b/payload_consumer/file_writer_unittest.cc
index 05df307..59cfe2b 100644
--- a/payload_consumer/file_writer_unittest.cc
+++ b/payload_consumer/file_writer_unittest.cc
@@ -32,7 +32,7 @@
 
 namespace chromeos_update_engine {
 
-class FileWriterTest : public ::testing::Test { };
+class FileWriterTest : public ::testing::Test {};
 
 TEST(FileWriterTest, SimpleTest) {
   // Create a uniquely named file for testing.
@@ -53,8 +53,9 @@
 TEST(FileWriterTest, ErrorTest) {
   DirectFileWriter file_writer;
   const string path("/tmp/ENOENT/FileWriterTest");
-  EXPECT_EQ(-ENOENT, file_writer.Open(path.c_str(),
-                                      O_CREAT | O_LARGEFILE | O_TRUNC, 0644));
+  EXPECT_EQ(
+      -ENOENT,
+      file_writer.Open(path.c_str(), O_CREAT | O_LARGEFILE | O_TRUNC, 0644));
 }
 
 TEST(FileWriterTest, WriteErrorTest) {
@@ -69,5 +70,4 @@
   EXPECT_EQ(0, file_writer.Close());
 }
 
-
 }  // namespace chromeos_update_engine
diff --git a/payload_consumer/filesystem_verifier_action.cc b/payload_consumer/filesystem_verifier_action.cc
index c9cb5af..36e5a35 100644
--- a/payload_consumer/filesystem_verifier_action.cc
+++ b/payload_consumer/filesystem_verifier_action.cc
@@ -118,11 +118,11 @@
             << partition.name << ") on device " << part_path;
 
   brillo::ErrorPtr error;
-  src_stream_ = brillo::FileStream::Open(
-      base::FilePath(part_path),
-      brillo::Stream::AccessMode::READ,
-      brillo::FileStream::Disposition::OPEN_EXISTING,
-      &error);
+  src_stream_ =
+      brillo::FileStream::Open(base::FilePath(part_path),
+                               brillo::Stream::AccessMode::READ,
+                               brillo::FileStream::Disposition::OPEN_EXISTING,
+                               &error);
 
   if (!src_stream_) {
     LOG(ERROR) << "Unable to open " << part_path << " for reading";
@@ -220,8 +220,7 @@
   ScheduleRead();
 }
 
-void FilesystemVerifierAction::OnReadErrorCallback(
-      const brillo::Error* error) {
+void FilesystemVerifierAction::OnReadErrorCallback(const brillo::Error* error) {
   // TODO(deymo): Transform the read-error into an specific ErrorCode.
   LOG(ERROR) << "Asynchronous read failed.";
   Cleanup(ErrorCode::kError);
diff --git a/payload_consumer/filesystem_verifier_action_unittest.cc b/payload_consumer/filesystem_verifier_action_unittest.cc
index 7fa61c0..cb33404 100644
--- a/payload_consumer/filesystem_verifier_action_unittest.cc
+++ b/payload_consumer/filesystem_verifier_action_unittest.cc
@@ -38,9 +38,7 @@
 
 class FilesystemVerifierActionTest : public ::testing::Test {
  protected:
-  void SetUp() override {
-    loop_.SetAsCurrent();
-  }
+  void SetUp() override { loop_.SetAsCurrent(); }
 
   void TearDown() override {
     EXPECT_EQ(0, brillo::MessageLoopRunMaxIterations(&loop_, 1));
@@ -270,11 +268,12 @@
   ASSERT_EQ(0U, getuid());
   EXPECT_TRUE(DoTest(true, false));
   // TerminateEarlyTest may leak some null callbacks from the Stream class.
-  while (loop_.RunOnce(false)) {}
+  while (loop_.RunOnce(false)) {
+  }
 }
 
 #ifdef __ANDROID__
-TEST_F(FilesystemVerifierActionTest, WriteVerityTest) {
+TEST_F(FilesystemVerifierActionTest, RunAsRootWriteVerityTest) {
   test_utils::ScopedTempFile part_file("part_file.XXXXXX");
   constexpr size_t filesystem_size = 200 * 4096;
   constexpr size_t part_size = 256 * 4096;
@@ -336,7 +335,7 @@
 }
 #endif  // __ANDROID__
 
-TEST_F(FilesystemVerifierActionTest, SkipWriteVerityTest) {
+TEST_F(FilesystemVerifierActionTest, RunAsRootSkipWriteVerityTest) {
   test_utils::ScopedTempFile part_file("part_file.XXXXXX");
   constexpr size_t filesystem_size = 200 * 4096;
   constexpr size_t part_size = 256 * 4096;
diff --git a/payload_consumer/install_plan.cc b/payload_consumer/install_plan.cc
index 1fa27ab..f52cd2d 100644
--- a/payload_consumer/install_plan.cc
+++ b/payload_consumer/install_plan.cc
@@ -120,12 +120,9 @@
 
 bool InstallPlan::Partition::operator==(
     const InstallPlan::Partition& that) const {
-  return (name == that.name &&
-          source_path == that.source_path &&
-          source_size == that.source_size &&
-          source_hash == that.source_hash &&
-          target_path == that.target_path &&
-          target_size == that.target_size &&
+  return (name == that.name && source_path == that.source_path &&
+          source_size == that.source_size && source_hash == that.source_hash &&
+          target_path == that.target_path && target_size == that.target_size &&
           target_hash == that.target_hash &&
           run_postinstall == that.run_postinstall &&
           postinstall_path == that.postinstall_path &&
diff --git a/payload_consumer/install_plan.h b/payload_consumer/install_plan.h
index 755d913..ede36b3 100644
--- a/payload_consumer/install_plan.h
+++ b/payload_consumer/install_plan.h
@@ -157,7 +157,7 @@
 
 class InstallPlanAction;
 
-template<>
+template <>
 class ActionTraits<InstallPlanAction> {
  public:
   // Takes the install plan as input
@@ -172,8 +172,8 @@
 class InstallPlanAction : public Action<InstallPlanAction> {
  public:
   InstallPlanAction() {}
-  explicit InstallPlanAction(const InstallPlan& install_plan):
-    install_plan_(install_plan) {}
+  explicit InstallPlanAction(const InstallPlan& install_plan)
+      : install_plan_(install_plan) {}
 
   void PerformAction() override {
     if (HasOutputPipe()) {
diff --git a/payload_consumer/mtd_file_descriptor.cc b/payload_consumer/mtd_file_descriptor.cc
index 5d7758a..5d940cb 100644
--- a/payload_consumer/mtd_file_descriptor.cc
+++ b/payload_consumer/mtd_file_descriptor.cc
@@ -67,9 +67,8 @@
     return ret;
   }
 
-  base::TrimWhitespaceASCII(s_reserved_ebs,
-                            base::TRIM_TRAILING,
-                            &s_reserved_ebs);
+  base::TrimWhitespaceASCII(
+      s_reserved_ebs, base::TRIM_TRAILING, &s_reserved_ebs);
   base::TrimWhitespaceASCII(s_eb_size, base::TRIM_TRAILING, &s_eb_size);
 
   uint64_t reserved_ebs, eb_size;
@@ -142,9 +141,8 @@
 
 ssize_t MtdFileDescriptor::Write(const void* buf, size_t count) {
   CHECK(write_ctx_);
-  ssize_t result = mtd_write_data(write_ctx_.get(),
-                                  static_cast<const char*>(buf),
-                                  count);
+  ssize_t result =
+      mtd_write_data(write_ctx_.get(), static_cast<const char*>(buf), count);
   if (result > 0) {
     nr_written_ += result;
   }
@@ -168,8 +166,8 @@
 bool UbiFileDescriptor::IsUbi(const char* path) {
   base::FilePath device_node(path);
   base::FilePath ubi_name(device_node.BaseName());
-  TEST_AND_RETURN_FALSE(base::StartsWith(ubi_name.MaybeAsASCII(), "ubi",
-                                         base::CompareCase::SENSITIVE));
+  TEST_AND_RETURN_FALSE(base::StartsWith(
+      ubi_name.MaybeAsASCII(), "ubi", base::CompareCase::SENSITIVE));
 
   return static_cast<bool>(GetUbiVolumeInfo(path));
 }
diff --git a/payload_consumer/mtd_file_descriptor.h b/payload_consumer/mtd_file_descriptor.h
index 6c945b2..c0170b7 100644
--- a/payload_consumer/mtd_file_descriptor.h
+++ b/payload_consumer/mtd_file_descriptor.h
@@ -20,6 +20,8 @@
 // This module defines file descriptors that deal with NAND media. We are
 // concerned with raw NAND access (as MTD device), and through UBI layer.
 
+#include <memory>
+
 #include <mtdutils.h>
 
 #include "update_engine/payload_consumer/file_descriptor.h"
@@ -86,10 +88,7 @@
   bool Close() override;
 
  private:
-  enum Mode {
-    kReadOnly,
-    kWriteOnly
-  };
+  enum Mode { kReadOnly, kWriteOnly };
 
   uint64_t usable_eb_blocks_;
   uint64_t eraseblock_size_;
diff --git a/payload_consumer/payload_verifier.cc b/payload_consumer/payload_verifier.cc
index f3d4626..2f7c133 100644
--- a/payload_consumer/payload_verifier.cc
+++ b/payload_consumer/payload_verifier.cc
@@ -50,39 +50,32 @@
 //   }
 //   OCTET STRING(2+32) <actual signature bytes...>
 //  }
+// clang-format off
 const uint8_t kRSA2048SHA256Padding[] = {
-  // PKCS1-v1_5 padding
-  0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0x00,
-  // ASN.1 header
-  0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
-  0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05,
-  0x00, 0x04, 0x20,
+    // PKCS1-v1_5 padding
+    0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0x00,
+    // ASN.1 header
+    0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
+    0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20,
 };
+// clang-format on
 
 }  // namespace
 
@@ -90,9 +83,9 @@
                                       const string& pem_public_key,
                                       const brillo::Blob& hash_data) {
   Signatures signatures;
-  LOG(INFO) << "signature blob size = " <<  signature_blob.size();
-  TEST_AND_RETURN_FALSE(signatures.ParseFromArray(signature_blob.data(),
-                                                  signature_blob.size()));
+  LOG(INFO) << "signature blob size = " << signature_blob.size();
+  TEST_AND_RETURN_FALSE(
+      signatures.ParseFromArray(signature_blob.data(), signature_blob.size()));
 
   if (!signatures.signatures_size()) {
     LOG(ERROR) << "No signatures stored in the blob.";
@@ -148,11 +141,8 @@
 
   // Decrypts the signature.
   brillo::Blob hash_data(keysize);
-  int decrypt_size = RSA_public_decrypt(sig_data.size(),
-                                        sig_data.data(),
-                                        hash_data.data(),
-                                        rsa,
-                                        RSA_NO_PADDING);
+  int decrypt_size = RSA_public_decrypt(
+      sig_data.size(), sig_data.data(), hash_data.data(), rsa, RSA_NO_PADDING);
   RSA_free(rsa);
   TEST_AND_RETURN_FALSE(decrypt_size > 0 &&
                         decrypt_size <= static_cast<int>(hash_data.size()));
diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
index 83d910f..a782b8f 100644
--- a/payload_consumer/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -59,7 +59,7 @@
 
   // Currently we're always powerwashing when rolling back.
   if (install_plan_.powerwash_required || install_plan_.is_rollback) {
-    if (hardware_->SchedulePowerwash()) {
+    if (hardware_->SchedulePowerwash(install_plan_.is_rollback)) {
       powerwash_scheduled_ = true;
     } else {
       return CompletePostinstall(ErrorCode::kPostinstallPowerwashError);
diff --git a/payload_consumer/postinstall_runner_action.h b/payload_consumer/postinstall_runner_action.h
index 2e48e11..b9b7069 100644
--- a/payload_consumer/postinstall_runner_action.h
+++ b/payload_consumer/postinstall_runner_action.h
@@ -89,8 +89,7 @@
   void Cleanup();
 
   // Subprocess::Exec callback.
-  void CompletePartitionPostinstall(int return_code,
-                                    const std::string& output);
+  void CompletePartitionPostinstall(int return_code, const std::string& output);
 
   // Complete the Action with the passed |error_code| and mark the new slot as
   // ready. Called when the post-install script was run for all the partitions.
diff --git a/payload_consumer/postinstall_runner_action_unittest.cc b/payload_consumer/postinstall_runner_action_unittest.cc
index 8d461d5..caee5e2 100644
--- a/payload_consumer/postinstall_runner_action_unittest.cc
+++ b/payload_consumer/postinstall_runner_action_unittest.cc
@@ -255,6 +255,7 @@
 
   // Since powerwash_required was false, this should not trigger a powerwash.
   EXPECT_FALSE(fake_hardware_.IsPowerwashScheduled());
+  EXPECT_FALSE(fake_hardware_.GetIsRollbackPowerwashScheduled());
 }
 
 TEST_F(PostinstallRunnerActionTest, RunAsRootRunSymlinkFileTest) {
@@ -274,6 +275,7 @@
 
   // Check that powerwash was scheduled.
   EXPECT_TRUE(fake_hardware_.IsPowerwashScheduled());
+  EXPECT_FALSE(fake_hardware_.GetIsRollbackPowerwashScheduled());
 }
 
 TEST_F(PostinstallRunnerActionTest, RunAsRootRollbackTest) {
@@ -286,8 +288,9 @@
                        /*is_rollback=*/true);
   EXPECT_EQ(ErrorCode::kSuccess, processor_delegate_.code_);
 
-  // Check that powerwash was scheduled.
+  // Check that powerwash was scheduled and that it's a rollback powerwash.
   EXPECT_TRUE(fake_hardware_.IsPowerwashScheduled());
+  EXPECT_TRUE(fake_hardware_.GetIsRollbackPowerwashScheduled());
 }
 
 // Runs postinstall from a partition file that doesn't mount, so it should
@@ -299,6 +302,7 @@
   // In case of failure, Postinstall should not signal a powerwash even if it
   // was requested.
   EXPECT_FALSE(fake_hardware_.IsPowerwashScheduled());
+  EXPECT_FALSE(fake_hardware_.GetIsRollbackPowerwashScheduled());
 }
 
 // Check that the failures from the postinstall script cause the action to
diff --git a/payload_consumer/xz_extent_writer.cc b/payload_consumer/xz_extent_writer.cc
index 835dcf7..a5b939d 100644
--- a/payload_consumer/xz_extent_writer.cc
+++ b/payload_consumer/xz_extent_writer.cc
@@ -32,7 +32,9 @@
 const uint32_t kXzMaxDictSize = 64 * 1024 * 1024;
 
 const char* XzErrorString(enum xz_ret error) {
-  #define __XZ_ERROR_STRING_CASE(code) case code: return #code;
+#define __XZ_ERROR_STRING_CASE(code) \
+  case code:                         \
+    return #code;
   switch (error) {
     __XZ_ERROR_STRING_CASE(XZ_OK)
     __XZ_ERROR_STRING_CASE(XZ_STREAM_END)
@@ -46,7 +48,7 @@
     default:
       return "<unknown xz error>";
   }
-  #undef __XZ_ERROR_STRING_CASE
+#undef __XZ_ERROR_STRING_CASE
 }
 }  // namespace
 
diff --git a/payload_consumer/xz_extent_writer_unittest.cc b/payload_consumer/xz_extent_writer_unittest.cc
index 76a53a4..34980a9 100644
--- a/payload_consumer/xz_extent_writer_unittest.cc
+++ b/payload_consumer/xz_extent_writer_unittest.cc
@@ -99,8 +99,7 @@
   std::unique_ptr<XzExtentWriter> xz_writer_;
 
   const brillo::Blob sample_data_{
-      std::begin(kSampleData),
-      std::begin(kSampleData) + strlen(kSampleData)};
+      std::begin(kSampleData), std::begin(kSampleData) + strlen(kSampleData)};
   FileDescriptorPtr fd_;
 };
 
@@ -111,13 +110,13 @@
 
 TEST_F(XzExtentWriterTest, CompressedSampleData) {
   WriteAll(brillo::Blob(std::begin(kCompressedDataNoCheck),
-                          std::end(kCompressedDataNoCheck)));
+                        std::end(kCompressedDataNoCheck)));
   EXPECT_EQ(sample_data_, fake_extent_writer_->WrittenData());
 }
 
 TEST_F(XzExtentWriterTest, CompressedSampleDataWithCrc) {
   WriteAll(brillo::Blob(std::begin(kCompressedDataCRC32),
-                          std::end(kCompressedDataCRC32)));
+                        std::end(kCompressedDataCRC32)));
   EXPECT_EQ(sample_data_, fake_extent_writer_->WrittenData());
 }
 
@@ -125,7 +124,7 @@
   // Test that even if the output data is bigger than the internal buffer, all
   // the data is written.
   WriteAll(brillo::Blob(std::begin(kCompressed30KiBofA),
-                          std::end(kCompressed30KiBofA)));
+                        std::end(kCompressed30KiBofA)));
   brillo::Blob expected_data(30 * 1024, 'a');
   EXPECT_EQ(expected_data, fake_extent_writer_->WrittenData());
 }
@@ -138,7 +137,7 @@
 
 TEST_F(XzExtentWriterTest, PartialDataIsKept) {
   brillo::Blob compressed(std::begin(kCompressed30KiBofA),
-                            std::end(kCompressed30KiBofA));
+                          std::end(kCompressed30KiBofA));
   EXPECT_TRUE(xz_writer_->Init(fd_, {}, 1024));
   for (uint8_t byte : compressed) {
     EXPECT_TRUE(xz_writer_->Write(&byte, 1));
diff --git a/payload_generator/ab_generator.cc b/payload_generator/ab_generator.cc
index eb64f4a..f4cc9fb 100644
--- a/payload_generator/ab_generator.cc
+++ b/payload_generator/ab_generator.cc
@@ -35,16 +35,17 @@
 
 namespace chromeos_update_engine {
 
-bool ABGenerator::GenerateOperations(
-    const PayloadGenerationConfig& config,
-    const PartitionConfig& old_part,
-    const PartitionConfig& new_part,
-    BlobFileWriter* blob_file,
-    vector<AnnotatedOperation>* aops) {
+bool ABGenerator::GenerateOperations(const PayloadGenerationConfig& config,
+                                     const PartitionConfig& old_part,
+                                     const PartitionConfig& new_part,
+                                     BlobFileWriter* blob_file,
+                                     vector<AnnotatedOperation>* aops) {
   TEST_AND_RETURN_FALSE(old_part.name == new_part.name);
 
-  ssize_t hard_chunk_blocks = (config.hard_chunk_size == -1 ? -1 :
-                               config.hard_chunk_size / config.block_size);
+  ssize_t hard_chunk_blocks =
+      (config.hard_chunk_size == -1
+           ? -1
+           : config.hard_chunk_size / config.block_size);
   size_t soft_chunk_blocks = config.soft_chunk_size / config.block_size;
 
   aops->clear();
@@ -107,9 +108,8 @@
   return true;
 }
 
-bool ABGenerator::SplitSourceCopy(
-    const AnnotatedOperation& original_aop,
-    vector<AnnotatedOperation>* result_aops) {
+bool ABGenerator::SplitSourceCopy(const AnnotatedOperation& original_aop,
+                                  vector<AnnotatedOperation>* result_aops) {
   InstallOperation original_op = original_aop.op;
   TEST_AND_RETURN_FALSE(original_op.type() == InstallOperation::SOURCE_COPY);
   // Keeps track of the index of curr_src_ext.
@@ -231,9 +231,8 @@
       // merge), are contiguous, are fragmented to have one destination extent,
       // and their combined block count would be less than chunk size, merge
       // them.
-      last_aop.name = base::StringPrintf("%s,%s",
-                                         last_aop.name.c_str(),
-                                         curr_aop.name.c_str());
+      last_aop.name = base::StringPrintf(
+          "%s,%s", last_aop.name.c_str(), curr_aop.name.c_str());
 
       if (is_delta_op) {
         ExtendExtents(last_aop.op.mutable_src_extents(),
@@ -273,11 +272,8 @@
   vector<Extent> dst_extents;
   ExtentsToVector(aop->op.dst_extents(), &dst_extents);
   brillo::Blob data(utils::BlocksInExtents(dst_extents) * kBlockSize);
-  TEST_AND_RETURN_FALSE(utils::ReadExtents(target_part_path,
-                                           dst_extents,
-                                           &data,
-                                           data.size(),
-                                           kBlockSize));
+  TEST_AND_RETURN_FALSE(utils::ReadExtents(
+      target_part_path, dst_extents, &data, data.size(), kBlockSize));
 
   brillo::Blob blob;
   InstallOperation_Type op_type;
diff --git a/payload_generator/ab_generator.h b/payload_generator/ab_generator.h
index 343b546..2accf1e 100644
--- a/payload_generator/ab_generator.h
+++ b/payload_generator/ab_generator.h
@@ -48,12 +48,11 @@
   // order. The operations are stored in |aops| and should be executed in that
   // order. All the offsets in the operations reference the data written to
   // |blob_file|.
-  bool GenerateOperations(
-      const PayloadGenerationConfig& config,
-      const PartitionConfig& old_part,
-      const PartitionConfig& new_part,
-      BlobFileWriter* blob_file,
-      std::vector<AnnotatedOperation>* aops) override;
+  bool GenerateOperations(const PayloadGenerationConfig& config,
+                          const PartitionConfig& old_part,
+                          const PartitionConfig& new_part,
+                          BlobFileWriter* blob_file,
+                          std::vector<AnnotatedOperation>* aops) override;
 
   // Split the operations in the vector of AnnotatedOperations |aops| such that
   // for every operation there is only one dst extent and updates |aops| with
diff --git a/payload_generator/ab_generator_unittest.cc b/payload_generator/ab_generator_unittest.cc
index 90039f1..2f8c0c6 100644
--- a/payload_generator/ab_generator_unittest.cc
+++ b/payload_generator/ab_generator_unittest.cc
@@ -81,10 +81,10 @@
   const size_t op_ex2_size = op_ex2_num_blocks * kBlockSize;
   InstallOperation op;
   op.set_type(orig_type);
-  *(op.add_dst_extents()) = ExtentForRange(op_ex1_start_block,
-                                           op_ex1_num_blocks);
-  *(op.add_dst_extents()) = ExtentForRange(op_ex2_start_block,
-                                           op_ex2_num_blocks);
+  *(op.add_dst_extents()) =
+      ExtentForRange(op_ex1_start_block, op_ex1_num_blocks);
+  *(op.add_dst_extents()) =
+      ExtentForRange(op_ex2_start_block, op_ex2_num_blocks);
 
   brillo::Blob op_data;
   op_data.insert(op_data.end(),
@@ -135,8 +135,8 @@
   EXPECT_FALSE(first_op.has_src_length());
   EXPECT_FALSE(first_op.has_dst_length());
   EXPECT_EQ(1, first_op.dst_extents().size());
-  EXPECT_TRUE(ExtentEquals(first_op.dst_extents(0), op_ex1_start_block,
-                           op_ex1_num_blocks));
+  EXPECT_TRUE(ExtentEquals(
+      first_op.dst_extents(0), op_ex1_start_block, op_ex1_num_blocks));
   // Obtain the expected blob.
   brillo::Blob first_expected_data(
       part_data.begin() + op_ex1_offset,
@@ -165,8 +165,8 @@
   EXPECT_FALSE(second_op.has_src_length());
   EXPECT_FALSE(second_op.has_dst_length());
   EXPECT_EQ(1, second_op.dst_extents().size());
-  EXPECT_TRUE(ExtentEquals(second_op.dst_extents(0), op_ex2_start_block,
-                           op_ex2_num_blocks));
+  EXPECT_TRUE(ExtentEquals(
+      second_op.dst_extents(0), op_ex2_start_block, op_ex2_num_blocks));
   // Obtain the expected blob.
   brillo::Blob second_expected_data(
       part_data.begin() + op_ex2_offset,
@@ -234,7 +234,7 @@
   const size_t first_op_size = first_op_num_blocks * kBlockSize;
   *(first_op.add_dst_extents()) = ExtentForRange(0, first_op_num_blocks);
   brillo::Blob first_op_data(part_data.begin(),
-                               part_data.begin() + first_op_size);
+                             part_data.begin() + first_op_size);
   brillo::Blob first_op_blob;
   if (orig_type == InstallOperation::REPLACE) {
     first_op_blob = first_op_data;
@@ -251,10 +251,10 @@
 
   InstallOperation second_op;
   second_op.set_type(orig_type);
-  *(second_op.add_dst_extents()) = ExtentForRange(first_op_num_blocks,
-                                                  second_op_num_blocks);
+  *(second_op.add_dst_extents()) =
+      ExtentForRange(first_op_num_blocks, second_op_num_blocks);
   brillo::Blob second_op_data(part_data.begin() + first_op_size,
-                                part_data.begin() + total_op_size);
+                              part_data.begin() + total_op_size);
   brillo::Blob second_op_blob;
   if (orig_type == InstallOperation::REPLACE) {
     second_op_blob = second_op_data;
@@ -263,8 +263,8 @@
   }
   second_op.set_data_offset(first_op_blob.size());
   second_op.set_data_length(second_op_blob.size());
-  blob_data.insert(blob_data.end(), second_op_blob.begin(),
-                   second_op_blob.end());
+  blob_data.insert(
+      blob_data.end(), second_op_blob.begin(), second_op_blob.end());
   AnnotatedOperation second_aop;
   second_aop.op = second_op;
   second_aop.name = "second";
@@ -300,7 +300,7 @@
 
   // Check to see if the blob pointed to in the new extent has what we expect.
   brillo::Blob expected_data(part_data.begin(),
-                               part_data.begin() + total_op_size);
+                             part_data.begin() + total_op_size);
   brillo::Blob expected_blob;
   if (compressible) {
     ASSERT_TRUE(BzipCompress(expected_data, &expected_blob));
diff --git a/payload_generator/annotated_operation.cc b/payload_generator/annotated_operation.cc
index e28fe85..5637cb1 100644
--- a/payload_generator/annotated_operation.cc
+++ b/payload_generator/annotated_operation.cc
@@ -55,7 +55,7 @@
   // REPLACE_BZ 500 @3000
   //   name: /foo/bar
   //    dst: (123, 3) (127, 2)
-  os << InstallOperationTypeName(aop.op.type()) << " "  << aop.op.data_length();
+  os << InstallOperationTypeName(aop.op.type()) << " " << aop.op.data_length();
   if (aop.op.data_length() > 0)
     os << " @" << aop.op.data_offset();
   if (!aop.name.empty()) {
diff --git a/payload_generator/blob_file_writer.cc b/payload_generator/blob_file_writer.cc
index 8225df4..7cdeb35 100644
--- a/payload_generator/blob_file_writer.cc
+++ b/payload_generator/blob_file_writer.cc
@@ -29,11 +29,10 @@
   *blob_file_size_ += blob.size();
 
   stored_blobs_++;
-  if (total_blobs_ > 0 &&
-      (10 * (stored_blobs_ - 1) / total_blobs_) !=
-      (10 * stored_blobs_ / total_blobs_)) {
-    LOG(INFO) << (100 * stored_blobs_ / total_blobs_)
-              << "% complete " << stored_blobs_ << "/" << total_blobs_
+  if (total_blobs_ > 0 && (10 * (stored_blobs_ - 1) / total_blobs_) !=
+                              (10 * stored_blobs_ / total_blobs_)) {
+    LOG(INFO) << (100 * stored_blobs_ / total_blobs_) << "% complete "
+              << stored_blobs_ << "/" << total_blobs_
               << " ops (output size: " << *blob_file_size_ << ")";
   }
   return result;
diff --git a/payload_generator/blob_file_writer.h b/payload_generator/blob_file_writer.h
index cbc13ae..48553be 100644
--- a/payload_generator/blob_file_writer.h
+++ b/payload_generator/blob_file_writer.h
@@ -29,8 +29,7 @@
   // Create the BlobFileWriter object that will manage the blobs stored to
   // |blob_fd| in a thread safe way.
   BlobFileWriter(int blob_fd, off_t* blob_file_size)
-    : blob_fd_(blob_fd),
-      blob_file_size_(blob_file_size) {}
+      : blob_fd_(blob_fd), blob_file_size_(blob_file_size) {}
 
   // Store the passed |blob| in the blob file. Returns the offset at which it
   // was stored, or -1 in case of failure.
diff --git a/payload_generator/blob_file_writer_unittest.cc b/payload_generator/blob_file_writer_unittest.cc
index 5f94ef3..487bc73 100644
--- a/payload_generator/blob_file_writer_unittest.cc
+++ b/payload_generator/blob_file_writer_unittest.cc
@@ -33,9 +33,8 @@
 TEST(BlobFileWriterTest, SimpleTest) {
   string blob_path;
   int blob_fd;
-  EXPECT_TRUE(utils::MakeTempFile("BlobFileWriterTest.XXXXXX",
-                                  &blob_path,
-                                  &blob_fd));
+  EXPECT_TRUE(
+      utils::MakeTempFile("BlobFileWriterTest.XXXXXX", &blob_path, &blob_fd));
   off_t blob_file_size = 0;
   BlobFileWriter blob_file(blob_fd, &blob_file_size);
 
@@ -47,11 +46,8 @@
 
   brillo::Blob stored_blob(blob_size);
   ssize_t bytes_read;
-  ASSERT_TRUE(utils::PReadAll(blob_fd,
-                              stored_blob.data(),
-                              blob_size,
-                              0,
-                              &bytes_read));
+  ASSERT_TRUE(
+      utils::PReadAll(blob_fd, stored_blob.data(), blob_size, 0, &bytes_read));
   EXPECT_EQ(bytes_read, blob_size);
   EXPECT_EQ(blob, stored_blob);
 }
diff --git a/payload_generator/block_mapping.cc b/payload_generator/block_mapping.cc
index ff10f0b..d0f0178 100644
--- a/payload_generator/block_mapping.cc
+++ b/payload_generator/block_mapping.cc
@@ -22,6 +22,7 @@
 
 #include <functional>
 #include <string>
+#include <utility>
 #include <vector>
 
 #include "update_engine/common/utils.h"
@@ -61,8 +62,8 @@
   bool ret = true;
   block_ids->resize(num_blocks);
   for (size_t block = 0; block < num_blocks; block++) {
-    (*block_ids)[block] = AddDiskBlock(
-        fd, initial_byte_offset + block * block_size_);
+    (*block_ids)[block] =
+        AddDiskBlock(fd, initial_byte_offset + block * block_size_);
     ret = ret && (*block_ids)[block] != -1;
   }
   return ret;
@@ -78,7 +79,7 @@
   // We either reuse a UniqueBlock or create a new one. If we need a new
   // UniqueBlock it could also be part of a new or existing bucket (if there is
   // a hash collision).
-  vector<UniqueBlock> *bucket = nullptr;
+  vector<UniqueBlock>* bucket = nullptr;
 
   auto mapping_it = mapping_.find(h);
   if (mapping_it == mapping_.end()) {
@@ -97,7 +98,7 @@
   // No existing block was found at this point, so we create and fill in a new
   // one.
   bucket->emplace_back();
-  UniqueBlock *new_ublock = &bucket->back();
+  UniqueBlock* new_ublock = &bucket->back();
 
   new_ublock->times_read = 1;
   new_ublock->fd = fd;
diff --git a/payload_generator/block_mapping.h b/payload_generator/block_mapping.h
index 3fe94ab..3738f6f 100644
--- a/payload_generator/block_mapping.h
+++ b/payload_generator/block_mapping.h
@@ -53,7 +53,9 @@
   // from the file descriptor |fd| starting at offset |initial_byte_offset|.
   // Returns whether it succeeded to add all the disk blocks and stores in
   // |block_ids| the block id for each one of the added blocks.
-  bool AddManyDiskBlocks(int fd, off_t initial_byte_offset, size_t num_blocks,
+  bool AddManyDiskBlocks(int fd,
+                         off_t initial_byte_offset,
+                         size_t num_blocks,
                          std::vector<BlockId>* block_ids);
 
  private:
diff --git a/payload_generator/block_mapping_unittest.cc b/payload_generator/block_mapping_unittest.cc
index e1870ec..9b9b4f1 100644
--- a/payload_generator/block_mapping_unittest.cc
+++ b/payload_generator/block_mapping_unittest.cc
@@ -33,10 +33,6 @@
 
 namespace chromeos_update_engine {
 
-namespace {
-
-}  // namespace
-
 class BlockMappingTest : public ::testing::Test {
  protected:
   // Old new partition files used in testing.
@@ -113,8 +109,7 @@
 
   EXPECT_EQ((vector<BlockMapping::BlockId>{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}),
             old_ids);
-  EXPECT_EQ((vector<BlockMapping::BlockId>{0, 11, 12, 13, 1, 2}),
-            new_ids);
+  EXPECT_EQ((vector<BlockMapping::BlockId>{0, 11, 12, 13, 1, 2}), new_ids);
 }
 
 }  // namespace chromeos_update_engine
diff --git a/payload_generator/cycle_breaker.cc b/payload_generator/cycle_breaker.cc
index a8a04ab..d76f679 100644
--- a/payload_generator/cycle_breaker.cc
+++ b/payload_generator/cycle_breaker.cc
@@ -78,10 +78,12 @@
 
     // Set subgraph edges for the components in the SCC.
     for (vector<Vertex::Index>::iterator it = component_indexes.begin();
-         it != component_indexes.end(); ++it) {
+         it != component_indexes.end();
+         ++it) {
       subgraph_[*it].subgraph_edges.clear();
       for (vector<Vertex::Index>::iterator jt = component_indexes.begin();
-           jt != component_indexes.end(); ++jt) {
+           jt != component_indexes.end();
+           ++jt) {
         // If there's a link from *it -> *jt in the graph,
         // add a subgraph_ edge
         if (base::ContainsKey(subgraph_[*it].out_edges, *jt))
@@ -106,13 +108,13 @@
 
 void CycleBreaker::HandleCircuit() {
   stack_.push_back(current_vertex_);
-  CHECK_GE(stack_.size(),
-           static_cast<vector<Vertex::Index>::size_type>(2));
+  CHECK_GE(stack_.size(), static_cast<vector<Vertex::Index>::size_type>(2));
   Edge min_edge = make_pair(stack_[0], stack_[1]);
   uint64_t min_edge_weight = std::numeric_limits<uint64_t>::max();
   size_t edges_considered = 0;
   for (vector<Vertex::Index>::const_iterator it = stack_.begin();
-       it != (stack_.end() - 1); ++it) {
+       it != (stack_.end() - 1);
+       ++it) {
     Edge edge = make_pair(*it, *(it + 1));
     if (cut_edges_.find(edge) != cut_edges_.end()) {
       stack_.pop_back();
@@ -135,7 +137,7 @@
   blocked_[u] = false;
 
   for (Vertex::EdgeMap::iterator it = blocked_graph_[u].out_edges.begin();
-       it != blocked_graph_[u].out_edges.end(); ) {
+       it != blocked_graph_[u].out_edges.end();) {
     Vertex::Index w = it->first;
     blocked_graph_[u].out_edges.erase(it++);
     if (blocked_[w])
@@ -145,7 +147,9 @@
 
 bool CycleBreaker::StackContainsCutEdge() const {
   for (vector<Vertex::Index>::const_iterator it = ++stack_.begin(),
-           e = stack_.end(); it != e; ++it) {
+                                             e = stack_.end();
+       it != e;
+       ++it) {
     Edge edge = make_pair(*(it - 1), *it);
     if (base::ContainsKey(cut_edges_, edge)) {
       return true;
@@ -175,7 +179,8 @@
 
   for (Vertex::SubgraphEdgeMap::iterator w =
            subgraph_[vertex].subgraph_edges.begin();
-       w != subgraph_[vertex].subgraph_edges.end(); ++w) {
+       w != subgraph_[vertex].subgraph_edges.end();
+       ++w) {
     if (*w == current_vertex_) {
       // The original paper called for printing stack_ followed by
       // current_vertex_ here, which is a cycle. Instead, we call
@@ -196,11 +201,12 @@
   } else {
     for (Vertex::SubgraphEdgeMap::iterator w =
              subgraph_[vertex].subgraph_edges.begin();
-         w != subgraph_[vertex].subgraph_edges.end(); ++w) {
+         w != subgraph_[vertex].subgraph_edges.end();
+         ++w) {
       if (blocked_graph_[*w].out_edges.find(vertex) ==
           blocked_graph_[*w].out_edges.end()) {
-        blocked_graph_[*w].out_edges.insert(make_pair(vertex,
-                                                      EdgeProperties()));
+        blocked_graph_[*w].out_edges.insert(
+            make_pair(vertex, EdgeProperties()));
       }
     }
   }
diff --git a/payload_generator/cycle_breaker.h b/payload_generator/cycle_breaker.h
index 231d63a..01518fe 100644
--- a/payload_generator/cycle_breaker.h
+++ b/payload_generator/cycle_breaker.h
@@ -53,11 +53,11 @@
   bool Circuit(Vertex::Index vertex, Vertex::Index depth);
   bool StackContainsCutEdge() const;
 
-  std::vector<bool> blocked_;  // "blocked" in the paper
-  Vertex::Index current_vertex_;  // "s" in the paper
+  std::vector<bool> blocked_;         // "blocked" in the paper
+  Vertex::Index current_vertex_;      // "s" in the paper
   std::vector<Vertex::Index> stack_;  // the stack variable in the paper
-  Graph subgraph_;  // "A_K" in the paper
-  Graph blocked_graph_;  // "B" in the paper
+  Graph subgraph_;                    // "A_K" in the paper
+  Graph blocked_graph_;               // "B" in the paper
 
   std::set<Edge> cut_edges_;
 
diff --git a/payload_generator/cycle_breaker_unittest.cc b/payload_generator/cycle_breaker_unittest.cc
index 7554dbb..fdcf49b 100644
--- a/payload_generator/cycle_breaker_unittest.cc
+++ b/payload_generator/cycle_breaker_unittest.cc
@@ -96,7 +96,7 @@
 
 namespace {
 pair<Vertex::Index, EdgeProperties> EdgeWithWeight(Vertex::Index dest,
-uint64_t weight) {
+                                                   uint64_t weight) {
   EdgeProperties props;
   props.extents.resize(1);
   props.extents[0].set_num_blocks(weight);
@@ -104,7 +104,6 @@
 }
 }  // namespace
 
-
 // This creates a bunch of cycles like this:
 //
 //               root <------.
@@ -168,7 +167,9 @@
   set<Edge> expected_cuts;
 
   for (Vertex::EdgeMap::const_iterator it = graph[n_root].out_edges.begin(),
-       e = graph[n_root].out_edges.end(); it != e; ++it) {
+                                       e = graph[n_root].out_edges.end();
+       it != e;
+       ++it) {
     expected_cuts.insert(make_pair(n_root, it->first));
   }
 
diff --git a/payload_generator/deflate_utils.cc b/payload_generator/deflate_utils.cc
index 1bc3b36..a7a0503 100644
--- a/payload_generator/deflate_utils.cc
+++ b/payload_generator/deflate_utils.cc
@@ -31,10 +31,10 @@
 #include "update_engine/payload_generator/squashfs_filesystem.h"
 #include "update_engine/update_metadata.pb.h"
 
-using std::string;
-using std::vector;
 using puffin::BitExtent;
 using puffin::ByteExtent;
+using std::string;
+using std::vector;
 
 namespace chromeos_update_engine {
 namespace deflate_utils {
diff --git a/payload_generator/deflate_utils_unittest.cc b/payload_generator/deflate_utils_unittest.cc
index cb9476a..f2c4dba 100644
--- a/payload_generator/deflate_utils_unittest.cc
+++ b/payload_generator/deflate_utils_unittest.cc
@@ -29,9 +29,9 @@
 #include "update_engine/payload_generator/extent_ranges.h"
 #include "update_engine/payload_generator/extent_utils.h"
 
-using std::vector;
 using puffin::BitExtent;
 using puffin::ByteExtent;
+using std::vector;
 
 namespace chromeos_update_engine {
 namespace deflate_utils {
diff --git a/payload_generator/delta_diff_generator.cc b/payload_generator/delta_diff_generator.cc
index 1db2144..d484d32 100644
--- a/payload_generator/delta_diff_generator.cc
+++ b/payload_generator/delta_diff_generator.cc
@@ -50,11 +50,10 @@
 const size_t kRootFSPartitionSize = static_cast<size_t>(2) * 1024 * 1024 * 1024;
 const size_t kBlockSize = 4096;  // bytes
 
-bool GenerateUpdatePayloadFile(
-    const PayloadGenerationConfig& config,
-    const string& output_path,
-    const string& private_key_path,
-    uint64_t* metadata_size) {
+bool GenerateUpdatePayloadFile(const PayloadGenerationConfig& config,
+                               const string& output_path,
+                               const string& private_key_path,
+                               uint64_t* metadata_size) {
   if (!config.version.Validate()) {
     LOG(ERROR) << "Unsupported major.minor version: " << config.version.major
                << "." << config.version.minor;
@@ -108,11 +107,8 @@
 
       vector<AnnotatedOperation> aops;
       // Generate the operations using the strategy we selected above.
-      TEST_AND_RETURN_FALSE(strategy->GenerateOperations(config,
-                                                         old_part,
-                                                         new_part,
-                                                         &blob_file,
-                                                         &aops));
+      TEST_AND_RETURN_FALSE(strategy->GenerateOperations(
+          config, old_part, new_part, &blob_file, &aops));
 
       // Filter the no-operations. OperationsGenerators should not output this
       // kind of operations normally, but this is an extra step to fix that if
@@ -125,8 +121,8 @@
 
   LOG(INFO) << "Writing payload file...";
   // Write payload file to disk.
-  TEST_AND_RETURN_FALSE(payload.WritePayload(output_path, temp_file_path,
-                                             private_key_path, metadata_size));
+  TEST_AND_RETURN_FALSE(payload.WritePayload(
+      output_path, temp_file_path, private_key_path, metadata_size));
 
   LOG(INFO) << "All done. Successfully created delta file with "
             << "metadata size = " << *metadata_size;
diff --git a/payload_generator/delta_diff_generator.h b/payload_generator/delta_diff_generator.h
index d8bdae2..8323f47 100644
--- a/payload_generator/delta_diff_generator.h
+++ b/payload_generator/delta_diff_generator.h
@@ -41,7 +41,6 @@
                                const std::string& private_key_path,
                                uint64_t* metadata_size);
 
-
 };  // namespace chromeos_update_engine
 
 #endif  // UPDATE_ENGINE_PAYLOAD_GENERATOR_DELTA_DIFF_GENERATOR_H_
diff --git a/payload_generator/delta_diff_utils.cc b/payload_generator/delta_diff_utils.cc
index dc38c33..1bad4d7 100644
--- a/payload_generator/delta_diff_utils.cc
+++ b/payload_generator/delta_diff_utils.cc
@@ -88,8 +88,10 @@
 // removed, which may cause the extent to be trimmed, split or removed entirely.
 // The value of |*idx_p| is updated to point to the next extent to be processed.
 // Returns true iff the next extent to process is a new or updated one.
-bool ProcessExtentBlockRange(vector<Extent>* extents, size_t* idx_p,
-                             const bool do_remove, uint64_t range_start,
+bool ProcessExtentBlockRange(vector<Extent>* extents,
+                             size_t* idx_p,
+                             const bool do_remove,
+                             uint64_t range_start,
                              uint64_t range_end) {
   size_t idx = *idx_p;
   uint64_t start_block = (*extents)[idx].start_block();
@@ -148,17 +150,17 @@
 
     uint64_t src_num_blocks = (*src_extents)[src_idx].num_blocks();
     uint64_t dst_num_blocks = (*dst_extents)[dst_idx].num_blocks();
-    uint64_t min_num_blocks = std::min(src_num_blocks - src_offset,
-                                       dst_num_blocks - dst_offset);
+    uint64_t min_num_blocks =
+        std::min(src_num_blocks - src_offset, dst_num_blocks - dst_offset);
     uint64_t prev_src_offset = src_offset;
     uint64_t prev_dst_offset = dst_offset;
     src_offset += min_num_blocks;
     dst_offset += min_num_blocks;
 
-    bool new_src = ProcessExtentBlockRange(src_extents, &src_idx, do_remove,
-                                           prev_src_offset, src_offset);
-    bool new_dst = ProcessExtentBlockRange(dst_extents, &dst_idx, do_remove,
-                                           prev_dst_offset, dst_offset);
+    bool new_src = ProcessExtentBlockRange(
+        src_extents, &src_idx, do_remove, prev_src_offset, src_offset);
+    bool new_dst = ProcessExtentBlockRange(
+        dst_extents, &dst_idx, do_remove, prev_dst_offset, dst_offset);
     if (new_src) {
       src_offset = 0;
     }
@@ -428,8 +430,8 @@
     // data blocks (for example, symlinks bigger than 60 bytes in ext2) are
     // handled as normal files. We also ignore blocks that were already
     // processed by a previous file.
-    vector<Extent> new_file_extents = FilterExtentRanges(
-        new_file.extents, new_visited_blocks);
+    vector<Extent> new_file_extents =
+        FilterExtentRanges(new_file.extents, new_visited_blocks);
     new_visited_blocks.AddExtents(new_file_extents);
 
     if (new_file_extents.empty())
@@ -559,7 +561,7 @@
   // is a block from the new partition.
   map<BlockMapping::BlockId, vector<uint64_t>> old_blocks_map;
 
-  for (uint64_t block = old_num_blocks; block-- > 0; ) {
+  for (uint64_t block = old_num_blocks; block-- > 0;) {
     if (old_block_ids[block] != 0 && !old_visited_blocks->ContainsBlock(block))
       old_blocks_map[old_block_ids[block]].push_back(block);
 
@@ -706,15 +708,15 @@
     chunk_blocks = total_blocks;
 
   for (uint64_t block_offset = 0; block_offset < total_blocks;
-      block_offset += chunk_blocks) {
+       block_offset += chunk_blocks) {
     // Split the old/new file in the same chunks. Note that this could drop
     // some information from the old file used for the new chunk. If the old
     // file is smaller (or even empty when there's no old file) the chunk will
     // also be empty.
-    vector<Extent> old_extents_chunk = ExtentsSublist(
-        old_extents, block_offset, chunk_blocks);
-    vector<Extent> new_extents_chunk = ExtentsSublist(
-        new_extents, block_offset, chunk_blocks);
+    vector<Extent> old_extents_chunk =
+        ExtentsSublist(old_extents, block_offset, chunk_blocks);
+    vector<Extent> new_extents_chunk =
+        ExtentsSublist(new_extents, block_offset, chunk_blocks);
     NormalizeExtents(&old_extents_chunk);
     NormalizeExtents(&new_extents_chunk);
 
@@ -731,8 +733,7 @@
     // Check if the operation writes nothing.
     if (operation.dst_extents_size() == 0) {
       if (operation.type() == InstallOperation::MOVE) {
-        LOG(INFO) << "Empty MOVE operation ("
-                  << name << "), skipping";
+        LOG(INFO) << "Empty MOVE operation (" << name << "), skipping";
         continue;
       } else {
         LOG(ERROR) << "Empty non-MOVE operation";
@@ -744,8 +745,8 @@
     AnnotatedOperation aop;
     aop.name = name;
     if (static_cast<uint64_t>(chunk_blocks) < total_blocks) {
-      aop.name = base::StringPrintf("%s:%" PRIu64,
-                                    name.c_str(), block_offset / chunk_blocks);
+      aop.name = base::StringPrintf(
+          "%s:%" PRIu64, name.c_str(), block_offset / chunk_blocks);
     }
     aop.op = operation;
 
@@ -870,9 +871,11 @@
   brillo::Blob old_data;
   if (blocks_to_read > 0) {
     // Read old data.
-    TEST_AND_RETURN_FALSE(
-        utils::ReadExtents(old_part, src_extents, &old_data,
-                           kBlockSize * blocks_to_read, kBlockSize));
+    TEST_AND_RETURN_FALSE(utils::ReadExtents(old_part,
+                                             src_extents,
+                                             &old_data,
+                                             kBlockSize * blocks_to_read,
+                                             kBlockSize));
     if (old_data == new_data) {
       // No change in data.
       operation.set_type(version.OperationAllowed(InstallOperation::SOURCE_COPY)
@@ -975,8 +978,8 @@
 
   // Remove identical src/dst block ranges in MOVE operations.
   if (operation.type() == InstallOperation::MOVE) {
-    auto removed_bytes = RemoveIdenticalBlockRanges(
-        &src_extents, &dst_extents, new_data.size());
+    auto removed_bytes =
+        RemoveIdenticalBlockRanges(&src_extents, &dst_extents, new_data.size());
     operation.set_src_length(old_data.size() - removed_bytes);
     operation.set_dst_length(new_data.size() - removed_bytes);
   }
@@ -1014,8 +1017,7 @@
 }
 
 bool IsNoSourceOperation(InstallOperation_Type op_type) {
-  return (IsAReplaceOperation(op_type) ||
-          op_type == InstallOperation::ZERO ||
+  return (IsAReplaceOperation(op_type) || op_type == InstallOperation::ZERO ||
           op_type == InstallOperation::DISCARD);
 }
 
@@ -1027,11 +1029,12 @@
 }
 
 void FilterNoopOperations(vector<AnnotatedOperation>* ops) {
-  ops->erase(
-      std::remove_if(
-          ops->begin(), ops->end(),
-          [](const AnnotatedOperation& aop){return IsNoopOperation(aop.op);}),
-      ops->end());
+  ops->erase(std::remove_if(ops->begin(),
+                            ops->end(),
+                            [](const AnnotatedOperation& aop) {
+                              return IsNoopOperation(aop.op);
+                            }),
+             ops->end());
 }
 
 bool InitializePartitionInfo(const PartitionConfig& part, PartitionInfo* info) {
diff --git a/payload_generator/delta_diff_utils_unittest.cc b/payload_generator/delta_diff_utils_unittest.cc
index 63e7506..f730cc9 100644
--- a/payload_generator/delta_diff_utils_unittest.cc
+++ b/payload_generator/delta_diff_utils_unittest.cc
@@ -59,8 +59,8 @@
     uint64_t to_write =
         std::min(static_cast<uint64_t>(extent.num_blocks()) * block_size,
                  static_cast<uint64_t>(data.size()) - offset);
-    TEST_AND_RETURN_FALSE(
-        fwrite(data.data() + offset, 1, to_write, fp.get()) == to_write);
+    TEST_AND_RETURN_FALSE(fwrite(data.data() + offset, 1, to_write, fp.get()) ==
+                          to_write);
     offset += extent.num_blocks() * block_size;
   }
   return true;
@@ -68,8 +68,10 @@
 
 // Create a fake filesystem of the given |size| and initialize the partition
 // holding it in the PartitionConfig |part|.
-void CreatePartition(PartitionConfig* part, const string& pattern,
-                     uint64_t block_size, off_t size) {
+void CreatePartition(PartitionConfig* part,
+                     const string& pattern,
+                     uint64_t block_size,
+                     off_t size) {
   int fd = -1;
   ASSERT_TRUE(utils::MakeTempFile(pattern.c_str(), &part->path, &fd));
   ASSERT_EQ(0, ftruncate(fd, size));
@@ -95,7 +97,8 @@
     brillo::Blob block_data(prefix.begin(), prefix.end());
     TEST_AND_RETURN_FALSE(prefix.size() <= block_size);
     block_data.resize(block_size, 'X');
-    std::copy(block_data.begin(), block_data.end(),
+    std::copy(block_data.begin(),
+              block_data.end(),
               file_data.begin() + i * block_size);
   }
   return test_utils::WriteFileVector(part.path, file_data);
@@ -108,13 +111,16 @@
   const uint64_t kDefaultBlockCount = 128;
 
   void SetUp() override {
-    CreatePartition(&old_part_, "DeltaDiffUtilsTest-old_part-XXXXXX",
-                    block_size_, block_size_ * kDefaultBlockCount);
-    CreatePartition(&new_part_, "DeltaDiffUtilsTest-old_part-XXXXXX",
-                    block_size_, block_size_ * kDefaultBlockCount);
-    ASSERT_TRUE(utils::MakeTempFile("DeltaDiffUtilsTest-blob-XXXXXX",
-                                    &blob_path_,
-                                    &blob_fd_));
+    CreatePartition(&old_part_,
+                    "DeltaDiffUtilsTest-old_part-XXXXXX",
+                    block_size_,
+                    block_size_ * kDefaultBlockCount);
+    CreatePartition(&new_part_,
+                    "DeltaDiffUtilsTest-old_part-XXXXXX",
+                    block_size_,
+                    block_size_ * kDefaultBlockCount);
+    ASSERT_TRUE(utils::MakeTempFile(
+        "DeltaDiffUtilsTest-blob-XXXXXX", &blob_path_, &blob_fd_));
   }
 
   void TearDown() override {
@@ -193,8 +199,8 @@
   test_utils::FillWithData(&data_blob);
 
   // The old file is on a different block than the new one.
-  vector<Extent> old_extents = { ExtentForRange(11, 1) };
-  vector<Extent> new_extents = { ExtentForRange(1, 1) };
+  vector<Extent> old_extents = {ExtentForRange(11, 1)};
+  vector<Extent> new_extents = {ExtentForRange(1, 1)};
 
   EXPECT_TRUE(WriteExtents(old_part_.path, old_extents, kBlockSize, data_blob));
   EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
@@ -237,15 +243,12 @@
   // Old:  [ 20     21 22     23     24 25 ] [ 28     29 ]
   // New:  [ 18 ] [ 21 22 ] [ 20 ] [ 24 25     26 ] [ 29 ]
   // Same:          ^^ ^^            ^^ ^^            ^^
-  vector<Extent> old_extents = {
-      ExtentForRange(20, 6),
-      ExtentForRange(28, 2) };
-  vector<Extent> new_extents = {
-      ExtentForRange(18, 1),
-      ExtentForRange(21, 2),
-      ExtentForRange(20, 1),
-      ExtentForRange(24, 3),
-      ExtentForRange(29, 1) };
+  vector<Extent> old_extents = {ExtentForRange(20, 6), ExtentForRange(28, 2)};
+  vector<Extent> new_extents = {ExtentForRange(18, 1),
+                                ExtentForRange(21, 2),
+                                ExtentForRange(20, 1),
+                                ExtentForRange(24, 3),
+                                ExtentForRange(29, 1)};
 
   uint64_t num_blocks = utils::BlocksInExtents(old_extents);
   EXPECT_EQ(num_blocks, utils::BlocksInExtents(new_extents));
@@ -282,13 +285,9 @@
 
   // The expected old and new extents that actually moved. See comment above.
   old_extents = {
-      ExtentForRange(20, 1),
-      ExtentForRange(23, 1),
-      ExtentForRange(28, 1) };
+      ExtentForRange(20, 1), ExtentForRange(23, 1), ExtentForRange(28, 1)};
   new_extents = {
-      ExtentForRange(18, 1),
-      ExtentForRange(20, 1),
-      ExtentForRange(26, 1) };
+      ExtentForRange(18, 1), ExtentForRange(20, 1), ExtentForRange(26, 1)};
   num_blocks = utils::BlocksInExtents(old_extents);
 
   EXPECT_EQ(num_blocks * kBlockSize, op.src_length());
@@ -317,8 +316,8 @@
   test_utils::FillWithData(&data_blob);
 
   // The old file is on a different block than the new one.
-  vector<Extent> old_extents = { ExtentForRange(1, 1) };
-  vector<Extent> new_extents = { ExtentForRange(2, 1) };
+  vector<Extent> old_extents = {ExtentForRange(1, 1)};
+  vector<Extent> new_extents = {ExtentForRange(2, 1)};
 
   EXPECT_TRUE(WriteExtents(old_part_.path, old_extents, kBlockSize, data_blob));
   // Modify one byte in the new file.
@@ -355,8 +354,8 @@
 
 TEST_F(DeltaDiffUtilsTest, ReplaceSmallTest) {
   // The old file is on a different block than the new one.
-  vector<Extent> old_extents = { ExtentForRange(1, 1) };
-  vector<Extent> new_extents = { ExtentForRange(2, 1) };
+  vector<Extent> old_extents = {ExtentForRange(1, 1)};
+  vector<Extent> new_extents = {ExtentForRange(2, 1)};
 
   // Make a blob that's just 1's that will compress well.
   brillo::Blob ones(kBlockSize, 1);
@@ -372,8 +371,8 @@
   for (int i = 0; i < 2; i++) {
     brillo::Blob data_to_test = i == 0 ? random_data : ones;
     // The old_extents will be initialized with 0.
-    EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize,
-                             data_to_test));
+    EXPECT_TRUE(
+        WriteExtents(new_part_.path, new_extents, kBlockSize, data_to_test));
 
     brillo::Blob data;
     InstallOperation op;
@@ -412,8 +411,8 @@
   test_utils::FillWithData(&data_blob);
 
   // The old file is on a different block than the new one.
-  vector<Extent> old_extents = { ExtentForRange(11, 1) };
-  vector<Extent> new_extents = { ExtentForRange(1, 1) };
+  vector<Extent> old_extents = {ExtentForRange(11, 1)};
+  vector<Extent> new_extents = {ExtentForRange(1, 1)};
 
   EXPECT_TRUE(WriteExtents(old_part_.path, old_extents, kBlockSize, data_blob));
   EXPECT_TRUE(WriteExtents(new_part_.path, new_extents, kBlockSize, data_blob));
@@ -444,8 +443,8 @@
   test_utils::FillWithData(&data_blob);
 
   // The old file is on a different block than the new one.
-  vector<Extent> old_extents = { ExtentForRange(1, 1) };
-  vector<Extent> new_extents = { ExtentForRange(2, 1) };
+  vector<Extent> old_extents = {ExtentForRange(1, 1)};
+  vector<Extent> new_extents = {ExtentForRange(2, 1)};
 
   EXPECT_TRUE(WriteExtents(old_part_.path, old_extents, kBlockSize, data_blob));
   // Modify one byte in the new file.
@@ -600,7 +599,9 @@
 
   // Override some of the old blocks with different data.
   vector<Extent> different_blocks = {ExtentForRange(40, 5)};
-  EXPECT_TRUE(WriteExtents(old_part_.path, different_blocks, kBlockSize,
+  EXPECT_TRUE(WriteExtents(old_part_.path,
+                           different_blocks,
+                           kBlockSize,
                            brillo::Blob(5 * kBlockSize, 'a')));
 
   EXPECT_TRUE(RunDeltaMovedAndZeroBlocks(10,  // chunk_blocks
@@ -650,8 +651,8 @@
   brillo::Blob partition_data(old_part_.size);
   for (size_t offset = 0; offset < partition_data.size();
        offset += file_data.size()) {
-    std::copy(file_data.begin(), file_data.end(),
-              partition_data.begin() + offset);
+    std::copy(
+        file_data.begin(), file_data.end(), partition_data.begin() + offset);
   }
   EXPECT_TRUE(test_utils::WriteFileVector(old_part_.path, partition_data));
   EXPECT_TRUE(test_utils::WriteFileVector(new_part_.path, partition_data));
@@ -751,8 +752,8 @@
   // as block permutation[i] in the new_part_.
   brillo::Blob new_contents;
   EXPECT_TRUE(utils::ReadFile(new_part_.path, &new_contents));
-  EXPECT_TRUE(WriteExtents(old_part_.path, perm_extents, block_size_,
-                           new_contents));
+  EXPECT_TRUE(
+      WriteExtents(old_part_.path, perm_extents, block_size_, new_contents));
 
   EXPECT_TRUE(RunDeltaMovedAndZeroBlocks(-1,  // chunk_blocks
                                          kSourceMinorPayloadVersion));
diff --git a/payload_generator/ext2_filesystem.cc b/payload_generator/ext2_filesystem.cc
index 07ec371..06304f4 100644
--- a/payload_generator/ext2_filesystem.cc
+++ b/payload_generator/ext2_filesystem.cc
@@ -92,11 +92,11 @@
 
 int UpdateFileAndAppend(ext2_ino_t dir,
                         int entry,
-                        struct ext2_dir_entry *dirent,
+                        struct ext2_dir_entry* dirent,
                         int offset,
                         int blocksize,
-                        char *buf,
-                        void *priv_data) {
+                        char* buf,
+                        void* priv_data) {
   UpdateFileAndAppendState* state =
       static_cast<UpdateFileAndAppendState*>(priv_data);
   uint32_t file_type = dirent->name_len >> 8;
@@ -224,20 +224,21 @@
     // and triple indirect blocks (no data blocks). For directories and
     // the journal, all blocks are considered metadata blocks.
     int flags = it_ino < EXT2_GOOD_OLD_FIRST_INO ? 0 : BLOCK_FLAG_DATA_ONLY;
-    error = ext2fs_block_iterate2(filsys_, it_ino, flags,
+    error = ext2fs_block_iterate2(filsys_,
+                                  it_ino,
+                                  flags,
                                   nullptr,  // block_buf
                                   ProcessInodeAllBlocks,
                                   &file.extents);
 
     if (error) {
-      LOG(ERROR) << "Failed to enumerate inode " << it_ino
-                << " blocks (" << error << ")";
+      LOG(ERROR) << "Failed to enumerate inode " << it_ino << " blocks ("
+                 << error << ")";
       continue;
     }
     if (it_ino >= EXT2_GOOD_OLD_FIRST_INO) {
-      ext2fs_block_iterate2(filsys_, it_ino, 0, nullptr,
-                            AddMetadataBlocks,
-                            &inode_blocks);
+      ext2fs_block_iterate2(
+          filsys_, it_ino, 0, nullptr, AddMetadataBlocks, &inode_blocks);
     }
   }
   ext2fs_close_inode_scan(iscan);
@@ -273,9 +274,12 @@
     }
     ext2fs_free_mem(&dir_name);
 
-    error = ext2fs_dir_iterate2(
-        filsys_, dir_ino, 0, nullptr /* block_buf */,
-        UpdateFileAndAppend, &priv_data);
+    error = ext2fs_dir_iterate2(filsys_,
+                                dir_ino,
+                                0,
+                                nullptr /* block_buf */,
+                                UpdateFileAndAppend,
+                                &priv_data);
     if (error) {
       LOG(WARNING) << "Failed to enumerate files in directory "
                    << inodes[dir_ino].name << " (error " << error << ")";
@@ -328,9 +332,11 @@
 bool Ext2Filesystem::LoadSettings(brillo::KeyValueStore* store) const {
   // First search for the settings inode following symlinks if we find some.
   ext2_ino_t ino_num = 0;
-  errcode_t err = ext2fs_namei_follow(
-      filsys_, EXT2_ROOT_INO /* root */, EXT2_ROOT_INO /* cwd */,
-      "/etc/update_engine.conf", &ino_num);
+  errcode_t err = ext2fs_namei_follow(filsys_,
+                                      EXT2_ROOT_INO /* root */,
+                                      EXT2_ROOT_INO /* cwd */,
+                                      "/etc/update_engine.conf",
+                                      &ino_num);
   if (err != 0)
     return false;
 
@@ -340,7 +346,9 @@
 
   // Load the list of blocks and then the contents of the inodes.
   vector<Extent> extents;
-  err = ext2fs_block_iterate2(filsys_, ino_num, BLOCK_FLAG_DATA_ONLY,
+  err = ext2fs_block_iterate2(filsys_,
+                              ino_num,
+                              BLOCK_FLAG_DATA_ONLY,
                               nullptr,  // block_buf
                               ProcessInodeAllBlocks,
                               &extents);
@@ -352,8 +360,8 @@
   // Sparse holes in the settings file are not supported.
   if (EXT2_I_SIZE(&ino_data) > physical_size)
     return false;
-  if (!utils::ReadExtents(filename_, extents, &blob, physical_size,
-                          filsys_->blocksize))
+  if (!utils::ReadExtents(
+          filename_, extents, &blob, physical_size, filsys_->blocksize))
     return false;
 
   string text(blob.begin(), blob.begin() + EXT2_I_SIZE(&ino_data));
diff --git a/payload_generator/ext2_filesystem_unittest.cc b/payload_generator/ext2_filesystem_unittest.cc
index 5360e6c..54600e9 100644
--- a/payload_generator/ext2_filesystem_unittest.cc
+++ b/payload_generator/ext2_filesystem_unittest.cc
@@ -98,14 +98,13 @@
 // "generate_image.sh" script. The expected conditions of each file in these
 // images is encoded in the file name, as defined in the mentioned script.
 TEST_F(Ext2FilesystemTest, ParseGeneratedImages) {
-  const vector<string> kGeneratedImages = {
-      "disk_ext2_1k.img",
-      "disk_ext2_4k.img" };
+  const vector<string> kGeneratedImages = {"disk_ext2_1k.img",
+                                           "disk_ext2_4k.img"};
   base::FilePath build_path = GetBuildArtifactsPath().Append("gen");
   for (const string& fs_name : kGeneratedImages) {
     LOG(INFO) << "Testing " << fs_name;
-    unique_ptr<Ext2Filesystem> fs = Ext2Filesystem::CreateFromFile(
-        build_path.Append(fs_name).value());
+    unique_ptr<Ext2Filesystem> fs =
+        Ext2Filesystem::CreateFromFile(build_path.Append(fs_name).value());
     ASSERT_NE(nullptr, fs.get());
 
     vector<FilesystemInterface::File> files;
diff --git a/payload_generator/extent_ranges.cc b/payload_generator/extent_ranges.cc
index 41e8f76..0e3f087 100644
--- a/payload_generator/extent_ranges.cc
+++ b/payload_generator/extent_ranges.cc
@@ -85,7 +85,8 @@
   ExtentSet::iterator end_del = extent_set_.end();
   uint64_t del_blocks = 0;
   for (ExtentSet::iterator it = extent_set_.begin(), e = extent_set_.end();
-       it != e; ++it) {
+       it != e;
+       ++it) {
     if (ExtentsOverlapOrTouch(*it, extent)) {
       end_del = it;
       ++end_del;
@@ -129,7 +130,8 @@
   uint64_t del_blocks = 0;
   ExtentSet new_extents;
   for (ExtentSet::iterator it = extent_set_.begin(), e = extent_set_.end();
-       it != e; ++it) {
+       it != e;
+       ++it) {
     if (!ExtentsOverlap(*it, extent))
       continue;
 
@@ -142,7 +144,8 @@
 
     ExtentSet subtraction = SubtractOverlappingExtents(*it, extent);
     for (ExtentSet::iterator jt = subtraction.begin(), je = subtraction.end();
-         jt != je; ++jt) {
+         jt != je;
+         ++jt) {
       new_extents.insert(*jt);
       del_blocks -= jt->num_blocks();
     }
@@ -154,41 +157,47 @@
 
 void ExtentRanges::AddRanges(const ExtentRanges& ranges) {
   for (ExtentSet::const_iterator it = ranges.extent_set_.begin(),
-           e = ranges.extent_set_.end(); it != e; ++it) {
+                                 e = ranges.extent_set_.end();
+       it != e;
+       ++it) {
     AddExtent(*it);
   }
 }
 
 void ExtentRanges::SubtractRanges(const ExtentRanges& ranges) {
   for (ExtentSet::const_iterator it = ranges.extent_set_.begin(),
-           e = ranges.extent_set_.end(); it != e; ++it) {
+                                 e = ranges.extent_set_.end();
+       it != e;
+       ++it) {
     SubtractExtent(*it);
   }
 }
 
 void ExtentRanges::AddExtents(const vector<Extent>& extents) {
   for (vector<Extent>::const_iterator it = extents.begin(), e = extents.end();
-       it != e; ++it) {
+       it != e;
+       ++it) {
     AddExtent(*it);
   }
 }
 
 void ExtentRanges::SubtractExtents(const vector<Extent>& extents) {
   for (vector<Extent>::const_iterator it = extents.begin(), e = extents.end();
-       it != e; ++it) {
+       it != e;
+       ++it) {
     SubtractExtent(*it);
   }
 }
 
 void ExtentRanges::AddRepeatedExtents(
-    const ::google::protobuf::RepeatedPtrField<Extent> &exts) {
+    const ::google::protobuf::RepeatedPtrField<Extent>& exts) {
   for (int i = 0, e = exts.size(); i != e; ++i) {
     AddExtent(exts.Get(i));
   }
 }
 
 void ExtentRanges::SubtractRepeatedExtents(
-    const ::google::protobuf::RepeatedPtrField<Extent> &exts) {
+    const ::google::protobuf::RepeatedPtrField<Extent>& exts) {
   for (int i = 0, e = exts.size(); i != e; ++i) {
     SubtractExtent(exts.Get(i));
   }
@@ -214,8 +223,9 @@
 void ExtentRanges::Dump() const {
   LOG(INFO) << "ExtentRanges Dump. blocks: " << blocks_;
   for (ExtentSet::const_iterator it = extent_set_.begin(),
-           e = extent_set_.end();
-       it != e; ++it) {
+                                 e = extent_set_.end();
+       it != e;
+       ++it) {
     LOG(INFO) << "{" << it->start_block() << ", " << it->num_blocks() << "}";
   }
 }
@@ -235,16 +245,16 @@
   return ExtentForRange(start_block, end_block - start_block);
 }
 
-vector<Extent> ExtentRanges::GetExtentsForBlockCount(
-    uint64_t count) const {
+vector<Extent> ExtentRanges::GetExtentsForBlockCount(uint64_t count) const {
   vector<Extent> out;
   if (count == 0)
     return out;
   uint64_t out_blocks = 0;
   CHECK(count <= blocks_);
   for (ExtentSet::const_iterator it = extent_set_.begin(),
-           e = extent_set_.end();
-       it != e; ++it) {
+                                 e = extent_set_.end();
+       it != e;
+       ++it) {
     const uint64_t blocks_needed = count - out_blocks;
     const Extent& extent = *it;
     out.push_back(extent);
@@ -285,8 +295,8 @@
         continue;
       if (iter->start_block() <= extent.start_block()) {
         // We need to cut blocks from the beginning of the |extent|.
-        uint64_t cut_blocks = iter->start_block() + iter->num_blocks() -
-            extent.start_block();
+        uint64_t cut_blocks =
+            iter->start_block() + iter->num_blocks() - extent.start_block();
         if (cut_blocks >= extent.num_blocks()) {
           extent.set_num_blocks(0);
           break;
@@ -296,9 +306,8 @@
       } else {
         // We need to cut blocks on the middle of the extent, possible up to the
         // end of it.
-        result.push_back(
-            ExtentForRange(extent.start_block(),
-                           iter->start_block() - extent.start_block()));
+        result.push_back(ExtentForRange(
+            extent.start_block(), iter->start_block() - extent.start_block()));
         uint64_t new_start = iter->start_block() + iter->num_blocks();
         uint64_t old_end = extent.start_block() + extent.num_blocks();
         if (new_start >= old_end) {
diff --git a/payload_generator/extent_ranges.h b/payload_generator/extent_ranges.h
index 02cf8fc..62ffff4 100644
--- a/payload_generator/extent_ranges.h
+++ b/payload_generator/extent_ranges.h
@@ -57,9 +57,9 @@
   void AddExtents(const std::vector<Extent>& extents);
   void SubtractExtents(const std::vector<Extent>& extents);
   void AddRepeatedExtents(
-      const ::google::protobuf::RepeatedPtrField<Extent> &exts);
+      const ::google::protobuf::RepeatedPtrField<Extent>& exts);
   void SubtractRepeatedExtents(
-      const ::google::protobuf::RepeatedPtrField<Extent> &exts);
+      const ::google::protobuf::RepeatedPtrField<Extent>& exts);
   void AddRanges(const ExtentRanges& ranges);
   void SubtractRanges(const ExtentRanges& ranges);
 
diff --git a/payload_generator/extent_ranges_unittest.cc b/payload_generator/extent_ranges_unittest.cc
index d9dd467..2bcffed 100644
--- a/payload_generator/extent_ranges_unittest.cc
+++ b/payload_generator/extent_ranges_unittest.cc
@@ -51,73 +51,57 @@
   }
 }
 
-#define EXPECT_RANGE_EQ(ranges, var)                            \
-  do {                                                          \
-    ExpectRangeEq(ranges, var, arraysize(var), __LINE__);       \
+#define EXPECT_RANGE_EQ(ranges, var)                      \
+  do {                                                    \
+    ExpectRangeEq(ranges, var, arraysize(var), __LINE__); \
   } while (0)
 
-void ExpectRangesOverlapOrTouch(uint64_t a_start, uint64_t a_num,
-                                uint64_t b_start, uint64_t b_num) {
-  EXPECT_TRUE(ExtentRanges::ExtentsOverlapOrTouch(ExtentForRange(a_start,
-                                                                 a_num),
-                                                  ExtentForRange(b_start,
-                                                                 b_num)));
-  EXPECT_TRUE(ExtentRanges::ExtentsOverlapOrTouch(ExtentForRange(b_start,
-                                                                 b_num),
-                                                  ExtentForRange(a_start,
-                                                                 a_num)));
+void ExpectRangesOverlapOrTouch(uint64_t a_start,
+                                uint64_t a_num,
+                                uint64_t b_start,
+                                uint64_t b_num) {
+  EXPECT_TRUE(ExtentRanges::ExtentsOverlapOrTouch(
+      ExtentForRange(a_start, a_num), ExtentForRange(b_start, b_num)));
+  EXPECT_TRUE(ExtentRanges::ExtentsOverlapOrTouch(
+      ExtentForRange(b_start, b_num), ExtentForRange(a_start, a_num)));
 }
 
-void ExpectFalseRangesOverlapOrTouch(uint64_t a_start, uint64_t a_num,
-                                     uint64_t b_start, uint64_t b_num) {
-  EXPECT_FALSE(ExtentRanges::ExtentsOverlapOrTouch(ExtentForRange(a_start,
-                                                                  a_num),
-                                                   ExtentForRange(b_start,
-                                                                  b_num)));
-  EXPECT_FALSE(ExtentRanges::ExtentsOverlapOrTouch(ExtentForRange(b_start,
-                                                                  b_num),
-                                                   ExtentForRange(a_start,
-                                                                  a_num)));
-  EXPECT_FALSE(ExtentRanges::ExtentsOverlap(ExtentForRange(a_start,
-                                                           a_num),
-                                            ExtentForRange(b_start,
-                                                           b_num)));
-  EXPECT_FALSE(ExtentRanges::ExtentsOverlap(ExtentForRange(b_start,
-                                                           b_num),
-                                            ExtentForRange(a_start,
-                                                           a_num)));
+void ExpectFalseRangesOverlapOrTouch(uint64_t a_start,
+                                     uint64_t a_num,
+                                     uint64_t b_start,
+                                     uint64_t b_num) {
+  EXPECT_FALSE(ExtentRanges::ExtentsOverlapOrTouch(
+      ExtentForRange(a_start, a_num), ExtentForRange(b_start, b_num)));
+  EXPECT_FALSE(ExtentRanges::ExtentsOverlapOrTouch(
+      ExtentForRange(b_start, b_num), ExtentForRange(a_start, a_num)));
+  EXPECT_FALSE(ExtentRanges::ExtentsOverlap(ExtentForRange(a_start, a_num),
+                                            ExtentForRange(b_start, b_num)));
+  EXPECT_FALSE(ExtentRanges::ExtentsOverlap(ExtentForRange(b_start, b_num),
+                                            ExtentForRange(a_start, a_num)));
 }
 
-void ExpectRangesOverlap(uint64_t a_start, uint64_t a_num,
-                         uint64_t b_start, uint64_t b_num) {
-  EXPECT_TRUE(ExtentRanges::ExtentsOverlap(ExtentForRange(a_start,
-                                                          a_num),
-                                           ExtentForRange(b_start,
-                                                          b_num)));
-  EXPECT_TRUE(ExtentRanges::ExtentsOverlap(ExtentForRange(b_start,
-                                                          b_num),
-                                           ExtentForRange(a_start,
-                                                          a_num)));
-  EXPECT_TRUE(ExtentRanges::ExtentsOverlapOrTouch(ExtentForRange(a_start,
-                                                                 a_num),
-                                                  ExtentForRange(b_start,
-                                                                 b_num)));
-  EXPECT_TRUE(ExtentRanges::ExtentsOverlapOrTouch(ExtentForRange(b_start,
-                                                                 b_num),
-                                                  ExtentForRange(a_start,
-                                                                 a_num)));
+void ExpectRangesOverlap(uint64_t a_start,
+                         uint64_t a_num,
+                         uint64_t b_start,
+                         uint64_t b_num) {
+  EXPECT_TRUE(ExtentRanges::ExtentsOverlap(ExtentForRange(a_start, a_num),
+                                           ExtentForRange(b_start, b_num)));
+  EXPECT_TRUE(ExtentRanges::ExtentsOverlap(ExtentForRange(b_start, b_num),
+                                           ExtentForRange(a_start, a_num)));
+  EXPECT_TRUE(ExtentRanges::ExtentsOverlapOrTouch(
+      ExtentForRange(a_start, a_num), ExtentForRange(b_start, b_num)));
+  EXPECT_TRUE(ExtentRanges::ExtentsOverlapOrTouch(
+      ExtentForRange(b_start, b_num), ExtentForRange(a_start, a_num)));
 }
 
-void ExpectFalseRangesOverlap(uint64_t a_start, uint64_t a_num,
-                              uint64_t b_start, uint64_t b_num) {
-  EXPECT_FALSE(ExtentRanges::ExtentsOverlap(ExtentForRange(a_start,
-                                                           a_num),
-                                            ExtentForRange(b_start,
-                                                           b_num)));
-  EXPECT_FALSE(ExtentRanges::ExtentsOverlap(ExtentForRange(b_start,
-                                                           b_num),
-                                            ExtentForRange(a_start,
-                                                           a_num)));
+void ExpectFalseRangesOverlap(uint64_t a_start,
+                              uint64_t a_num,
+                              uint64_t b_start,
+                              uint64_t b_num) {
+  EXPECT_FALSE(ExtentRanges::ExtentsOverlap(ExtentForRange(a_start, a_num),
+                                            ExtentForRange(b_start, b_num)));
+  EXPECT_FALSE(ExtentRanges::ExtentsOverlap(ExtentForRange(b_start, b_num),
+                                            ExtentForRange(a_start, a_num)));
 }
 
 }  // namespace
@@ -179,35 +163,31 @@
     ranges.AddExtent(ExtentForRange(i, 50));
   }
   {
-    static const uint64_t expected[] = {
-      0, 2, 3, 1, 100, 50, 200, 50, 300, 50, 400, 50,
-      500, 50, 600, 50, 700, 50, 800, 50, 900, 50
-    };
+    static const uint64_t expected[] = {0,   2,  3,   1,  100, 50, 200, 50,
+                                        300, 50, 400, 50, 500, 50, 600, 50,
+                                        700, 50, 800, 50, 900, 50};
     EXPECT_RANGE_EQ(ranges, expected);
   }
 
   ranges.SubtractExtent(ExtentForRange(210, 410 - 210));
   {
-    static const uint64_t expected[] = {
-      0, 2, 3, 1, 100, 50, 200, 10, 410, 40, 500, 50,
-      600, 50, 700, 50, 800, 50, 900, 50
-    };
+    static const uint64_t expected[] = {0,   2,   3,   1,   100, 50,  200,
+                                        10,  410, 40,  500, 50,  600, 50,
+                                        700, 50,  800, 50,  900, 50};
     EXPECT_RANGE_EQ(ranges, expected);
   }
   ranges.AddExtent(ExtentForRange(100000, 0));
   {
-    static const uint64_t expected[] = {
-      0, 2, 3, 1, 100, 50, 200, 10, 410, 40, 500, 50,
-      600, 50, 700, 50, 800, 50, 900, 50
-    };
+    static const uint64_t expected[] = {0,   2,   3,   1,   100, 50,  200,
+                                        10,  410, 40,  500, 50,  600, 50,
+                                        700, 50,  800, 50,  900, 50};
     EXPECT_RANGE_EQ(ranges, expected);
   }
   ranges.SubtractExtent(ExtentForRange(3, 0));
   {
-    static const uint64_t expected[] = {
-      0, 2, 3, 1, 100, 50, 200, 10, 410, 40, 500, 50,
-      600, 50, 700, 50, 800, 50, 900, 50
-    };
+    static const uint64_t expected[] = {0,   2,   3,   1,   100, 50,  200,
+                                        10,  410, 40,  500, 50,  600, 50,
+                                        700, 50,  800, 50,  900, 50};
     EXPECT_RANGE_EQ(ranges, expected);
   }
 }
@@ -289,25 +269,20 @@
 
 TEST(ExtentRangesTest, FilterExtentRangesEmptyRanges) {
   ExtentRanges ranges;
-  EXPECT_EQ(vector<Extent>(),
-            FilterExtentRanges(vector<Extent>(), ranges));
-  EXPECT_EQ(
-      vector<Extent>{ ExtentForRange(50, 10) },
-      FilterExtentRanges(vector<Extent>{ ExtentForRange(50, 10) }, ranges));
+  EXPECT_EQ(vector<Extent>(), FilterExtentRanges(vector<Extent>(), ranges));
+  EXPECT_EQ(vector<Extent>{ExtentForRange(50, 10)},
+            FilterExtentRanges(vector<Extent>{ExtentForRange(50, 10)}, ranges));
   // Check that the empty Extents are ignored.
-  EXPECT_EQ(
-      (vector<Extent>{ ExtentForRange(10, 10), ExtentForRange(20, 10) }),
-      FilterExtentRanges(vector<Extent>{
-           ExtentForRange(10, 10),
-           ExtentForRange(3, 0),
-           ExtentForRange(20, 10) }, ranges));
+  EXPECT_EQ((vector<Extent>{ExtentForRange(10, 10), ExtentForRange(20, 10)}),
+            FilterExtentRanges(vector<Extent>{ExtentForRange(10, 10),
+                                              ExtentForRange(3, 0),
+                                              ExtentForRange(20, 10)},
+                               ranges));
 }
 
 TEST(ExtentRangesTest, FilterExtentRangesMultipleRanges) {
   // Two overlapping extents, with three ranges to remove.
-  vector<Extent> extents {
-      ExtentForRange(10, 100),
-      ExtentForRange(30, 100) };
+  vector<Extent> extents{ExtentForRange(10, 100), ExtentForRange(30, 100)};
   ExtentRanges ranges;
   // This overlaps the beginning of the second extent.
   ranges.AddExtent(ExtentForRange(28, 3));
@@ -315,19 +290,17 @@
   ranges.AddExtent(ExtentForRange(70, 10));
   // This overlaps the end of the second extent.
   ranges.AddExtent(ExtentForRange(108, 6));
-  EXPECT_EQ(
-      (vector<Extent>{
-           // For the first extent:
-           ExtentForRange(10, 18),
-           ExtentForRange(31, 19),
-           ExtentForRange(60, 10),
-           ExtentForRange(80, 28),
-           // For the second extent:
-           ExtentForRange(31, 19),
-           ExtentForRange(60, 10),
-           ExtentForRange(80, 28),
-           ExtentForRange(114, 16)}),
-      FilterExtentRanges(extents, ranges));
+  EXPECT_EQ((vector<Extent>{// For the first extent:
+                            ExtentForRange(10, 18),
+                            ExtentForRange(31, 19),
+                            ExtentForRange(60, 10),
+                            ExtentForRange(80, 28),
+                            // For the second extent:
+                            ExtentForRange(31, 19),
+                            ExtentForRange(60, 10),
+                            ExtentForRange(80, 28),
+                            ExtentForRange(114, 16)}),
+            FilterExtentRanges(extents, ranges));
 }
 
 TEST(ExtentRangesTest, FilterExtentRangesOvelapping) {
@@ -336,10 +309,9 @@
   ranges.AddExtent(ExtentForRange(20, 5));
   // Requested extent overlaps with one of the ranges.
   EXPECT_EQ(vector<Extent>(),
-            FilterExtentRanges(vector<Extent>{
-                                   ExtentForRange(10, 1),
-                                   ExtentForRange(22, 1) },
-                               ranges));
+            FilterExtentRanges(
+                vector<Extent>{ExtentForRange(10, 1), ExtentForRange(22, 1)},
+                ranges));
 }
 
 }  // namespace chromeos_update_engine
diff --git a/payload_generator/extent_utils.cc b/payload_generator/extent_utils.cc
index 47073f9..c0c7643 100644
--- a/payload_generator/extent_utils.cc
+++ b/payload_generator/extent_utils.cc
@@ -39,8 +39,9 @@
   // First try to extend the last extent in |extents|, if any.
   if (!extents->empty()) {
     Extent& extent = extents->back();
-    uint64_t next_block = extent.start_block() == kSparseHole ?
-        kSparseHole : extent.start_block() + extent.num_blocks();
+    uint64_t next_block = extent.start_block() == kSparseHole
+                              ? kSparseHole
+                              : extent.start_block() + extent.num_blocks();
     if (next_block == block) {
       extent.set_num_blocks(extent.num_blocks() + 1);
       return;
@@ -116,7 +117,8 @@
 }
 
 vector<Extent> ExtentsSublist(const vector<Extent>& extents,
-                              uint64_t block_offset, uint64_t block_count) {
+                              uint64_t block_offset,
+                              uint64_t block_count) {
   vector<Extent> result;
   uint64_t scanned_blocks = 0;
   if (block_count == 0)
diff --git a/payload_generator/extent_utils.h b/payload_generator/extent_utils.h
index f5fbb0e..9763b1f 100644
--- a/payload_generator/extent_utils.h
+++ b/payload_generator/extent_utils.h
@@ -34,7 +34,7 @@
 
 // Takes a collection (vector or RepeatedPtrField) of Extent and
 // returns a vector of the blocks referenced, in order.
-template<typename T>
+template <typename T>
 std::vector<uint64_t> ExpandExtents(const T& extents) {
   std::vector<uint64_t> ret;
   for (const auto& extent : extents) {
@@ -42,7 +42,8 @@
       ret.resize(ret.size() + extent.num_blocks(), kSparseHole);
     } else {
       for (uint64_t block = extent.start_block();
-           block < (extent.start_block() + extent.num_blocks()); block++) {
+           block < (extent.start_block() + extent.num_blocks());
+           block++) {
         ret.push_back(block);
       }
     }
@@ -64,8 +65,8 @@
 // Takes a pointer to extents |extents| and extents |extents_to_add|, and
 // merges them by adding |extents_to_add| to |extents| and normalizing.
 void ExtendExtents(
-  google::protobuf::RepeatedPtrField<Extent>* extents,
-  const google::protobuf::RepeatedPtrField<Extent>& extents_to_add);
+    google::protobuf::RepeatedPtrField<Extent>* extents,
+    const google::protobuf::RepeatedPtrField<Extent>& extents_to_add);
 
 // Takes a vector of extents and normalizes those extents. Expects the extents
 // to be sorted by start block. E.g. if |extents| is [(1, 2), (3, 5), (10, 2)]
@@ -77,7 +78,8 @@
 // blocks. The returned list skips the first |block_offset| blocks from the
 // |extents| and cotains |block_count| blocks (or less if |extents| is shorter).
 std::vector<Extent> ExtentsSublist(const std::vector<Extent>& extents,
-                                   uint64_t block_offset, uint64_t block_count);
+                                   uint64_t block_offset,
+                                   uint64_t block_count);
 
 bool operator==(const Extent& a, const Extent& b);
 
diff --git a/payload_generator/extent_utils_unittest.cc b/payload_generator/extent_utils_unittest.cc
index eef4385..5467aa5 100644
--- a/payload_generator/extent_utils_unittest.cc
+++ b/payload_generator/extent_utils_unittest.cc
@@ -86,10 +86,10 @@
   ExtendExtents(first_op.mutable_src_extents(), second_op.src_extents());
   vector<Extent> first_op_vec;
   ExtentsToVector(first_op.src_extents(), &first_op_vec);
-  EXPECT_EQ((vector<Extent>{
-      ExtentForRange(1, 1),
-      ExtentForRange(3, 3),
-      ExtentForRange(8, 2)}), first_op_vec);
+  EXPECT_EQ(
+      (vector<Extent>{
+          ExtentForRange(1, 1), ExtentForRange(3, 3), ExtentForRange(8, 2)}),
+      first_op_vec);
 }
 
 TEST(ExtentUtilsTest, NormalizeExtentsSimpleList) {
@@ -98,21 +98,19 @@
   NormalizeExtents(&extents);
   EXPECT_EQ(0U, extents.size());
 
-  extents = { ExtentForRange(0, 3) };
+  extents = {ExtentForRange(0, 3)};
   NormalizeExtents(&extents);
   EXPECT_EQ(1U, extents.size());
   EXPECT_EQ(ExtentForRange(0, 3), extents[0]);
 }
 
 TEST(ExtentUtilsTest, NormalizeExtentsTest) {
-  vector<Extent> extents = {
-      ExtentForRange(0, 3),
-      ExtentForRange(3, 2),
-      ExtentForRange(5, 1),
-      ExtentForRange(8, 4),
-      ExtentForRange(13, 1),
-      ExtentForRange(14, 2)
-  };
+  vector<Extent> extents = {ExtentForRange(0, 3),
+                            ExtentForRange(3, 2),
+                            ExtentForRange(5, 1),
+                            ExtentForRange(8, 4),
+                            ExtentForRange(13, 1),
+                            ExtentForRange(14, 2)};
   NormalizeExtents(&extents);
   EXPECT_EQ(3U, extents.size());
   EXPECT_EQ(ExtentForRange(0, 6), extents[0]);
@@ -122,42 +120,37 @@
 
 TEST(ExtentUtilsTest, ExtentsSublistTest) {
   vector<Extent> extents = {
-      ExtentForRange(10, 10),
-      ExtentForRange(30, 10),
-      ExtentForRange(50, 10)
-  };
+      ExtentForRange(10, 10), ExtentForRange(30, 10), ExtentForRange(50, 10)};
 
   // Simple empty result cases.
-  EXPECT_EQ(vector<Extent>(),
-            ExtentsSublist(extents, 1000, 20));
-  EXPECT_EQ(vector<Extent>(),
-            ExtentsSublist(extents, 5, 0));
-  EXPECT_EQ(vector<Extent>(),
-            ExtentsSublist(extents, 30, 1));
+  EXPECT_EQ(vector<Extent>(), ExtentsSublist(extents, 1000, 20));
+  EXPECT_EQ(vector<Extent>(), ExtentsSublist(extents, 5, 0));
+  EXPECT_EQ(vector<Extent>(), ExtentsSublist(extents, 30, 1));
 
   // Normal test cases.
-  EXPECT_EQ(vector<Extent>{ ExtentForRange(13, 2) },
+  EXPECT_EQ(vector<Extent>{ExtentForRange(13, 2)},
             ExtentsSublist(extents, 3, 2));
-  EXPECT_EQ(vector<Extent>{ ExtentForRange(15, 5) },
+  EXPECT_EQ(vector<Extent>{ExtentForRange(15, 5)},
             ExtentsSublist(extents, 5, 5));
-  EXPECT_EQ((vector<Extent>{ ExtentForRange(15, 5), ExtentForRange(30, 5) }),
+  EXPECT_EQ((vector<Extent>{ExtentForRange(15, 5), ExtentForRange(30, 5)}),
             ExtentsSublist(extents, 5, 10));
   EXPECT_EQ((vector<Extent>{
-                 ExtentForRange(13, 7),
-                 ExtentForRange(30, 10),
-                 ExtentForRange(50, 3), }),
+                ExtentForRange(13, 7),
+                ExtentForRange(30, 10),
+                ExtentForRange(50, 3),
+            }),
             ExtentsSublist(extents, 3, 20));
 
   // Extact match case.
-  EXPECT_EQ(vector<Extent>{ ExtentForRange(30, 10) },
+  EXPECT_EQ(vector<Extent>{ExtentForRange(30, 10)},
             ExtentsSublist(extents, 10, 10));
-  EXPECT_EQ(vector<Extent>{ ExtentForRange(50, 10) },
+  EXPECT_EQ(vector<Extent>{ExtentForRange(50, 10)},
             ExtentsSublist(extents, 20, 10));
 
   // Cases where the requested num_blocks is too big.
-  EXPECT_EQ(vector<Extent>{ ExtentForRange(53, 7) },
+  EXPECT_EQ(vector<Extent>{ExtentForRange(53, 7)},
             ExtentsSublist(extents, 23, 100));
-  EXPECT_EQ((vector<Extent>{ ExtentForRange(34, 6), ExtentForRange(50, 10) }),
+  EXPECT_EQ((vector<Extent>{ExtentForRange(34, 6), ExtentForRange(50, 10)}),
             ExtentsSublist(extents, 14, 100));
 }
 
diff --git a/payload_generator/fake_filesystem.cc b/payload_generator/fake_filesystem.cc
index 234e2f6..7448286 100644
--- a/payload_generator/fake_filesystem.cc
+++ b/payload_generator/fake_filesystem.cc
@@ -20,10 +20,8 @@
 
 namespace chromeos_update_engine {
 
-FakeFilesystem::FakeFilesystem(uint64_t block_size, uint64_t block_count) :
-    block_size_(block_size),
-    block_count_(block_count) {
-}
+FakeFilesystem::FakeFilesystem(uint64_t block_size, uint64_t block_count)
+    : block_size_(block_size), block_count_(block_count) {}
 
 size_t FakeFilesystem::GetBlockSize() const {
   return block_size_;
diff --git a/payload_generator/fake_filesystem.h b/payload_generator/fake_filesystem.h
index 1b13920..e41a7a2 100644
--- a/payload_generator/fake_filesystem.h
+++ b/payload_generator/fake_filesystem.h
@@ -47,9 +47,7 @@
 
   // Sets the PAYLOAD_MINOR_VERSION key stored by LoadSettings(). Use a negative
   // value to produce an error in LoadSettings().
-  void SetMinorVersion(int minor_version) {
-    minor_version_ = minor_version;
-  }
+  void SetMinorVersion(int minor_version) { minor_version_ = minor_version; }
 
  private:
   FakeFilesystem() = default;
diff --git a/payload_generator/filesystem_interface.h b/payload_generator/filesystem_interface.h
index 08dfd19..d04295c 100644
--- a/payload_generator/filesystem_interface.h
+++ b/payload_generator/filesystem_interface.h
@@ -45,9 +45,7 @@
   // all sort of files, like symlinks, hardlinks, directories and even a file
   // entry representing the metadata, free space, journaling data, etc.
   struct File {
-    File() {
-      memset(&file_stat, 0, sizeof(file_stat));
-    }
+    File() { memset(&file_stat, 0, sizeof(file_stat)); }
 
     // The stat struct for the file. This is invalid (inode 0) for some
     // pseudo-files.
diff --git a/payload_generator/full_update_generator.cc b/payload_generator/full_update_generator.cc
index 98bb0f3..4d8b2f9 100644
--- a/payload_generator/full_update_generator.cc
+++ b/payload_generator/full_update_generator.cc
@@ -95,11 +95,8 @@
   brillo::Blob buffer_in_(size_);
   brillo::Blob op_blob;
   ssize_t bytes_read = -1;
-  TEST_AND_RETURN_FALSE(utils::PReadAll(fd_,
-                                        buffer_in_.data(),
-                                        buffer_in_.size(),
-                                        offset_,
-                                        &bytes_read));
+  TEST_AND_RETURN_FALSE(utils::PReadAll(
+      fd_, buffer_in_.data(), buffer_in_.size(), offset_, &bytes_read));
   TEST_AND_RETURN_FALSE(bytes_read == static_cast<ssize_t>(size_));
 
   InstallOperation_Type op_type;
@@ -140,10 +137,10 @@
 
   size_t chunk_blocks = full_chunk_size / config.block_size;
   size_t max_threads = diff_utils::GetMaxThreads();
-  LOG(INFO) << "Compressing partition " << new_part.name
-            << " from " << new_part.path << " splitting in chunks of "
-            << chunk_blocks << " blocks (" << config.block_size
-            << " bytes each) using " << max_threads << " threads";
+  LOG(INFO) << "Compressing partition " << new_part.name << " from "
+            << new_part.path << " splitting in chunks of " << chunk_blocks
+            << " blocks (" << config.block_size << " bytes each) using "
+            << max_threads << " threads";
 
   int in_fd = open(new_part.path.c_str(), O_RDONLY, 0);
   TEST_AND_RETURN_FALSE(in_fd >= 0);
@@ -161,14 +158,14 @@
   for (size_t i = 0; i < num_chunks; ++i) {
     size_t start_block = i * chunk_blocks;
     // The last chunk could be smaller.
-    size_t num_blocks = std::min(chunk_blocks,
-                                 partition_blocks - i * chunk_blocks);
+    size_t num_blocks =
+        std::min(chunk_blocks, partition_blocks - i * chunk_blocks);
 
     // Preset all the static information about the operations. The
     // ChunkProcessor will set the rest.
     AnnotatedOperation* aop = aops->data() + i;
-    aop->name = base::StringPrintf("<%s-operation-%" PRIuS ">",
-                                   new_part.name.c_str(), i);
+    aop->name = base::StringPrintf(
+        "<%s-operation-%" PRIuS ">", new_part.name.c_str(), i);
     Extent* dst_extent = aop->op.add_dst_extents();
     dst_extent->set_start_block(start_block);
     dst_extent->set_num_blocks(num_blocks);
diff --git a/payload_generator/full_update_generator.h b/payload_generator/full_update_generator.h
index d722028..e17dd37 100644
--- a/payload_generator/full_update_generator.h
+++ b/payload_generator/full_update_generator.h
@@ -37,12 +37,11 @@
   // must be a valid payload generation configuration for a full payload.
   // Populates |aops|, with data about the update operations, and writes
   // relevant data to |blob_file|.
-  bool GenerateOperations(
-      const PayloadGenerationConfig& config,
-      const PartitionConfig& old_part,
-      const PartitionConfig& new_part,
-      BlobFileWriter* blob_file,
-      std::vector<AnnotatedOperation>* aops) override;
+  bool GenerateOperations(const PayloadGenerationConfig& config,
+                          const PartitionConfig& old_part,
+                          const PartitionConfig& new_part,
+                          BlobFileWriter* blob_file,
+                          std::vector<AnnotatedOperation>* aops) override;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(FullUpdateGenerator);
diff --git a/payload_generator/generate_delta_main.cc b/payload_generator/generate_delta_main.cc
index 05486c5..de0a091 100644
--- a/payload_generator/generate_delta_main.cc
+++ b/payload_generator/generate_delta_main.cc
@@ -56,17 +56,15 @@
 void ParseSignatureSizes(const string& signature_sizes_flag,
                          vector<int>* signature_sizes) {
   signature_sizes->clear();
-  vector<string> split_strings =
-      base::SplitString(signature_sizes_flag, ":", base::TRIM_WHITESPACE,
-                        base::SPLIT_WANT_ALL);
+  vector<string> split_strings = base::SplitString(
+      signature_sizes_flag, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
   for (const string& str : split_strings) {
     int size = 0;
     bool parsing_successful = base::StringToInt(str, &size);
-    LOG_IF(FATAL, !parsing_successful)
-        << "Invalid signature size: " << str;
+    LOG_IF(FATAL, !parsing_successful) << "Invalid signature size: " << str;
 
-    LOG_IF(FATAL, size != (2048 / 8)) <<
-        "Only signature sizes of 256 bytes are supported.";
+    LOG_IF(FATAL, size != (2048 / 8))
+        << "Only signature sizes of 256 bytes are supported.";
 
     signature_sizes->push_back(size);
   }
@@ -95,16 +93,16 @@
   image_info->set_version(version);
   image_info->set_key(key);
 
-  image_info->set_build_channel(
-      build_channel.empty() ? channel : build_channel);
+  image_info->set_build_channel(build_channel.empty() ? channel
+                                                      : build_channel);
 
-  image_info->set_build_version(
-      build_version.empty() ? version : build_version);
+  image_info->set_build_version(build_version.empty() ? version
+                                                      : build_version);
 
   return true;
 }
 
-void CalculateHashForSigning(const vector<int> &sizes,
+void CalculateHashForSigning(const vector<int>& sizes,
                              const string& out_hash_file,
                              const string& out_metadata_hash_file,
                              const string& in_file) {
@@ -115,12 +113,13 @@
       << "Must pass --out_hash_file to calculate hash for signing.";
 
   brillo::Blob payload_hash, metadata_hash;
-  CHECK(PayloadSigner::HashPayloadForSigning(in_file, sizes, &payload_hash,
-                                             &metadata_hash));
-  CHECK(utils::WriteFile(out_hash_file.c_str(), payload_hash.data(),
-                         payload_hash.size()));
+  CHECK(PayloadSigner::HashPayloadForSigning(
+      in_file, sizes, &payload_hash, &metadata_hash));
+  CHECK(utils::WriteFile(
+      out_hash_file.c_str(), payload_hash.data(), payload_hash.size()));
   if (!out_metadata_hash_file.empty())
-    CHECK(utils::WriteFile(out_metadata_hash_file.c_str(), metadata_hash.data(),
+    CHECK(utils::WriteFile(out_metadata_hash_file.c_str(),
+                           metadata_hash.data(),
                            metadata_hash.size()));
 
   LOG(INFO) << "Done calculating hash for signing.";
@@ -128,9 +127,8 @@
 
 void SignatureFileFlagToBlobs(const string& signature_file_flag,
                               vector<brillo::Blob>* signatures) {
-  vector<string> signature_files =
-      base::SplitString(signature_file_flag, ":", base::TRIM_WHITESPACE,
-                        base::SPLIT_WANT_ALL);
+  vector<string> signature_files = base::SplitString(
+      signature_file_flag, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
   for (const string& signature_file : signature_files) {
     brillo::Blob signature;
     CHECK(utils::ReadFile(signature_file, &signature));
@@ -144,10 +142,8 @@
                  const string& metadata_signature_file,
                  const string& out_metadata_size_file) {
   LOG(INFO) << "Signing payload.";
-  LOG_IF(FATAL, in_file.empty())
-      << "Must pass --in_file to sign payload.";
-  LOG_IF(FATAL, out_file.empty())
-      << "Must pass --out_file to sign payload.";
+  LOG_IF(FATAL, in_file.empty()) << "Must pass --in_file to sign payload.";
+  LOG_IF(FATAL, out_file.empty()) << "Must pass --out_file to sign payload.";
   LOG_IF(FATAL, payload_signature_file.empty())
       << "Must pass --payload_signature_file to sign payload.";
   vector<brillo::Blob> payload_signatures, metadata_signatures;
@@ -290,12 +286,14 @@
   DEFINE_string(new_image, "", "Path to the new rootfs");
   DEFINE_string(old_kernel, "", "Path to the old kernel partition image");
   DEFINE_string(new_kernel, "", "Path to the new kernel partition image");
-  DEFINE_string(old_partitions, "",
+  DEFINE_string(old_partitions,
+                "",
                 "Path to the old partitions. To pass multiple partitions, use "
                 "a single argument with a colon between paths, e.g. "
                 "/path/to/part:/path/to/part2::/path/to/last_part . Path can "
                 "be empty, but it has to match the order of partition_names.");
-  DEFINE_string(new_partitions, "",
+  DEFINE_string(new_partitions,
+                "",
                 "Path to the new partitions. To pass multiple partitions, use "
                 "a single argument with a colon between paths, e.g. "
                 "/path/to/part:/path/to/part2:/path/to/last_part . Path has "
@@ -312,26 +310,27 @@
                 "Path to the .map files associated with the partition files "
                 "in the new partition, similar to the -old_mapfiles flag.");
   DEFINE_string(partition_names,
-                string(kPartitionNameRoot) + ":" +
-                kPartitionNameKernel,
+                string(kPartitionNameRoot) + ":" + kPartitionNameKernel,
                 "Names of the partitions. To pass multiple names, use a single "
                 "argument with a colon between names, e.g. "
                 "name:name2:name3:last_name . Name can not be empty, and it "
                 "has to match the order of partitions.");
-  DEFINE_string(in_file, "",
+  DEFINE_string(in_file,
+                "",
                 "Path to input delta payload file used to hash/sign payloads "
                 "and apply delta over old_image (for debugging)");
   DEFINE_string(out_file, "", "Path to output delta payload file");
   DEFINE_string(out_hash_file, "", "Path to output hash file");
-  DEFINE_string(out_metadata_hash_file, "",
-                "Path to output metadata hash file");
-  DEFINE_string(out_metadata_size_file, "",
-                "Path to output metadata size file");
+  DEFINE_string(
+      out_metadata_hash_file, "", "Path to output metadata hash file");
+  DEFINE_string(
+      out_metadata_size_file, "", "Path to output metadata size file");
   DEFINE_string(private_key, "", "Path to private key in .pem format");
   DEFINE_string(public_key, "", "Path to public key in .pem format");
-  DEFINE_int32(public_key_version, -1,
-               "DEPRECATED. Key-check version # of client");
-  DEFINE_string(signature_size, "",
+  DEFINE_int32(
+      public_key_version, -1, "DEPRECATED. Key-check version # of client");
+  DEFINE_string(signature_size,
+                "",
                 "Raw signature size used for hash calculation. "
                 "You may pass in multiple sizes by colon separating them. E.g. "
                 "2048:2048:4096 will assume 3 signatures, the first two with "
@@ -343,22 +342,25 @@
                 "e.g. /path/to/sig:/path/to/next:/path/to/last_sig . Each "
                 "signature will be assigned a client version, starting from "
                 "kSignatureOriginalVersion.");
-  DEFINE_string(metadata_signature_file, "",
+  DEFINE_string(metadata_signature_file,
+                "",
                 "Raw signature file with the signature of the metadata hash. "
                 "To pass multiple signatures, use a single argument with a "
                 "colon between paths, "
                 "e.g. /path/to/sig:/path/to/next:/path/to/last_sig .");
-  DEFINE_int32(chunk_size, 200 * 1024 * 1024,
-               "Payload chunk size (-1 for whole files)");
+  DEFINE_int32(
+      chunk_size, 200 * 1024 * 1024, "Payload chunk size (-1 for whole files)");
   DEFINE_uint64(rootfs_partition_size,
-               chromeos_update_engine::kRootFSPartitionSize,
-               "RootFS partition size for the image once installed");
-  DEFINE_uint64(major_version, 2,
-               "The major version of the payload being generated.");
-  DEFINE_int32(minor_version, -1,
+                chromeos_update_engine::kRootFSPartitionSize,
+                "RootFS partition size for the image once installed");
+  DEFINE_uint64(
+      major_version, 2, "The major version of the payload being generated.");
+  DEFINE_int32(minor_version,
+               -1,
                "The minor version of the payload being generated "
                "(-1 means autodetect).");
-  DEFINE_string(properties_file, "",
+  DEFINE_string(properties_file,
+                "",
                 "If passed, dumps the payload properties of the payload passed "
                 "in --in_file and exits.");
   DEFINE_int64(max_timestamp,
@@ -366,42 +368,53 @@
                "The maximum timestamp of the OS allowed to apply this "
                "payload.");
 
-  DEFINE_string(old_channel, "",
+  DEFINE_string(old_channel,
+                "",
                 "The channel for the old image. 'dev-channel', 'npo-channel', "
                 "etc. Ignored, except during delta generation.");
-  DEFINE_string(old_board, "",
+  DEFINE_string(old_board,
+                "",
                 "The board for the old image. 'x86-mario', 'lumpy', "
                 "etc. Ignored, except during delta generation.");
-  DEFINE_string(old_version, "",
-                "The build version of the old image. 1.2.3, etc.");
-  DEFINE_string(old_key, "",
+  DEFINE_string(
+      old_version, "", "The build version of the old image. 1.2.3, etc.");
+  DEFINE_string(old_key,
+                "",
                 "The key used to sign the old image. 'premp', 'mp', 'mp-v3',"
                 " etc");
-  DEFINE_string(old_build_channel, "",
+  DEFINE_string(old_build_channel,
+                "",
                 "The channel for the build of the old image. 'dev-channel', "
                 "etc, but will never contain special channels such as "
                 "'npo-channel'. Ignored, except during delta generation.");
-  DEFINE_string(old_build_version, "",
+  DEFINE_string(old_build_version,
+                "",
                 "The version of the build containing the old image.");
 
-  DEFINE_string(new_channel, "",
+  DEFINE_string(new_channel,
+                "",
                 "The channel for the new image. 'dev-channel', 'npo-channel', "
                 "etc. Ignored, except during delta generation.");
-  DEFINE_string(new_board, "",
+  DEFINE_string(new_board,
+                "",
                 "The board for the new image. 'x86-mario', 'lumpy', "
                 "etc. Ignored, except during delta generation.");
-  DEFINE_string(new_version, "",
-                "The build version of the new image. 1.2.3, etc.");
-  DEFINE_string(new_key, "",
+  DEFINE_string(
+      new_version, "", "The build version of the new image. 1.2.3, etc.");
+  DEFINE_string(new_key,
+                "",
                 "The key used to sign the new image. 'premp', 'mp', 'mp-v3',"
                 " etc");
-  DEFINE_string(new_build_channel, "",
+  DEFINE_string(new_build_channel,
+                "",
                 "The channel for the build of the new image. 'dev-channel', "
                 "etc, but will never contain special channels such as "
                 "'npo-channel'. Ignored, except during delta generation.");
-  DEFINE_string(new_build_version, "",
+  DEFINE_string(new_build_version,
+                "",
                 "The version of the build containing the new image.");
-  DEFINE_string(new_postinstall_config_file, "",
+  DEFINE_string(new_postinstall_config_file,
+                "",
                 "A config file specifying postinstall related metadata. "
                 "Only allowed in major version 2 or newer.");
   DEFINE_string(dynamic_partition_info_file,
@@ -409,7 +422,9 @@
                 "An info file specifying dynamic partition metadata. "
                 "Only allowed in major version 2 or newer.");
 
-  brillo::FlagHelper::Init(argc, argv,
+  brillo::FlagHelper::Init(
+      argc,
+      argv,
       "Generates a payload to provide to ChromeOS' update_engine.\n\n"
       "This tool can create full payloads and also delta payloads if the src\n"
       "image is provided. It also provides debugging options to apply, sign\n"
@@ -417,10 +432,10 @@
   Terminator::Init();
 
   logging::LoggingSettings log_settings;
-  log_settings.log_file     = "delta_generator.log";
+  log_settings.log_file = "delta_generator.log";
   log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
-  log_settings.lock_log     = logging::LOCK_LOG_FILE;
-  log_settings.delete_old   = logging::APPEND_TO_OLD_LOG_FILE;
+  log_settings.lock_log = logging::LOCK_LOG_FILE;
+  log_settings.delete_old = logging::APPEND_TO_OLD_LOG_FILE;
 
   logging::InitLogging(log_settings);
 
@@ -432,8 +447,10 @@
 
   if (!FLAGS_out_hash_file.empty() || !FLAGS_out_metadata_hash_file.empty()) {
     CHECK(FLAGS_out_metadata_size_file.empty());
-    CalculateHashForSigning(signature_sizes, FLAGS_out_hash_file,
-                            FLAGS_out_metadata_hash_file, FLAGS_in_file);
+    CalculateHashForSigning(signature_sizes,
+                            FLAGS_out_hash_file,
+                            FLAGS_out_metadata_hash_file,
+                            FLAGS_in_file);
     return 0;
   }
   if (!FLAGS_payload_signature_file.empty()) {
@@ -468,17 +485,17 @@
         FLAGS_new_mapfiles, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
   }
 
-  partition_names =
-      base::SplitString(FLAGS_partition_names, ":", base::TRIM_WHITESPACE,
-                        base::SPLIT_WANT_ALL);
+  partition_names = base::SplitString(
+      FLAGS_partition_names, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
   CHECK(!partition_names.empty());
   if (FLAGS_major_version == kChromeOSMajorPayloadVersion ||
       FLAGS_new_partitions.empty()) {
     LOG_IF(FATAL, partition_names.size() != 2)
         << "To support more than 2 partitions, please use the "
         << "--new_partitions flag and major version 2.";
-    LOG_IF(FATAL, partition_names[0] != kPartitionNameRoot ||
-                  partition_names[1] != kPartitionNameKernel)
+    LOG_IF(FATAL,
+           partition_names[0] != kPartitionNameRoot ||
+               partition_names[1] != kPartitionNameKernel)
         << "To support non-default partition name, please use the "
         << "--new_partitions flag and major version 2.";
   }
@@ -487,9 +504,8 @@
     LOG_IF(FATAL, !FLAGS_new_image.empty() || !FLAGS_new_kernel.empty())
         << "--new_image and --new_kernel are deprecated, please use "
         << "--new_partitions for all partitions.";
-    new_partitions =
-        base::SplitString(FLAGS_new_partitions, ":", base::TRIM_WHITESPACE,
-                          base::SPLIT_WANT_ALL);
+    new_partitions = base::SplitString(
+        FLAGS_new_partitions, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
     CHECK(partition_names.size() == new_partitions.size());
 
     payload_config.is_delta = !FLAGS_old_partitions.empty();
@@ -501,8 +517,8 @@
     LOG(WARNING) << "--new_partitions is empty, using deprecated --new_image "
                  << "and --new_kernel flags.";
 
-    payload_config.is_delta = !FLAGS_old_image.empty() ||
-                              !FLAGS_old_kernel.empty();
+    payload_config.is_delta =
+        !FLAGS_old_image.empty() || !FLAGS_old_kernel.empty();
     LOG_IF(FATAL, !FLAGS_old_partitions.empty())
         << "Please use --new_partitions if you are using --old_partitions.";
   }
@@ -517,9 +533,10 @@
 
   if (payload_config.is_delta) {
     if (!FLAGS_old_partitions.empty()) {
-      old_partitions =
-          base::SplitString(FLAGS_old_partitions, ":", base::TRIM_WHITESPACE,
-                            base::SPLIT_WANT_ALL);
+      old_partitions = base::SplitString(FLAGS_old_partitions,
+                                         ":",
+                                         base::TRIM_WHITESPACE,
+                                         base::SPLIT_WANT_ALL);
       CHECK(old_partitions.size() == new_partitions.size());
     } else {
       old_partitions = {FLAGS_old_image, FLAGS_old_kernel};
@@ -638,10 +655,8 @@
   }
 
   uint64_t metadata_size;
-  if (!GenerateUpdatePayloadFile(payload_config,
-                                 FLAGS_out_file,
-                                 FLAGS_private_key,
-                                 &metadata_size)) {
+  if (!GenerateUpdatePayloadFile(
+          payload_config, FLAGS_out_file, FLAGS_private_key, &metadata_size)) {
     return 1;
   }
   if (!FLAGS_out_metadata_size_file.empty()) {
diff --git a/payload_generator/graph_types.cc b/payload_generator/graph_types.cc
index 7da76f7..c03766d 100644
--- a/payload_generator/graph_types.cc
+++ b/payload_generator/graph_types.cc
@@ -20,4 +20,4 @@
 
 const Vertex::Index Vertex::kInvalidIndex = static_cast<Vertex::Index>(-1);
 
-}  // chromeos_update_engine
+}  // namespace chromeos_update_engine
diff --git a/payload_generator/graph_types.h b/payload_generator/graph_types.h
index fee8575..f96b0f3 100644
--- a/payload_generator/graph_types.h
+++ b/payload_generator/graph_types.h
@@ -51,10 +51,7 @@
 };
 
 struct Vertex {
-  Vertex() :
-      valid(true),
-      index(-1),
-      lowlink(-1) {}
+  Vertex() : valid(true), index(-1), lowlink(-1) {}
   bool valid;
 
   typedef std::map<std::vector<Vertex>::size_type, EdgeProperties> EdgeMap;
diff --git a/payload_generator/graph_utils.cc b/payload_generator/graph_utils.cc
index 4829b21..7f5cf8f 100644
--- a/payload_generator/graph_utils.cc
+++ b/payload_generator/graph_utils.cc
@@ -39,17 +39,15 @@
   uint64_t weight = 0;
   const vector<Extent>& extents =
       graph[edge.first].out_edges.find(edge.second)->second.extents;
-  for (vector<Extent>::const_iterator it = extents.begin();
-       it != extents.end(); ++it) {
+  for (vector<Extent>::const_iterator it = extents.begin(); it != extents.end();
+       ++it) {
     if (it->start_block() != kSparseHole)
       weight += it->num_blocks();
   }
   return weight;
 }
 
-void AddReadBeforeDep(Vertex* src,
-                      Vertex::Index dst,
-                      uint64_t block) {
+void AddReadBeforeDep(Vertex* src, Vertex::Index dst, uint64_t block) {
   Vertex::EdgeMap::iterator edge_it = src->out_edges.find(dst);
   if (edge_it == src->out_edges.end()) {
     // Must create new edge
@@ -66,11 +64,13 @@
                              const vector<Extent>& extents) {
   // TODO(adlr): Be more efficient than adding each block individually.
   for (vector<Extent>::const_iterator it = extents.begin(), e = extents.end();
-       it != e; ++it) {
+       it != e;
+       ++it) {
     const Extent& extent = *it;
     for (uint64_t block = extent.start_block(),
-             block_end = extent.start_block() + extent.num_blocks();
-         block != block_end; ++block) {
+                  block_end = extent.start_block() + extent.num_blocks();
+         block != block_end;
+         ++block) {
       AddReadBeforeDep(src, dst, block);
     }
   }
@@ -79,7 +79,7 @@
 void DropWriteBeforeDeps(Vertex::EdgeMap* edge_map) {
   // Specially crafted for-loop for the map-iterate-delete dance.
   for (Vertex::EdgeMap::iterator it = edge_map->begin();
-       it != edge_map->end(); ) {
+       it != edge_map->end();) {
     if (!it->second.write_extents.empty())
       it->second.write_extents.clear();
     if (it->second.extents.empty()) {
@@ -101,7 +101,7 @@
 }
 
 namespace {
-template<typename T>
+template <typename T>
 void DumpExtents(const T& field, int prepend_space_count) {
   string header(prepend_space_count, ' ');
   for (const auto& extent : field) {
@@ -112,7 +112,9 @@
 
 void DumpOutEdges(const Vertex::EdgeMap& out_edges) {
   for (Vertex::EdgeMap::const_iterator it = out_edges.begin(),
-           e = out_edges.end(); it != e; ++it) {
+                                       e = out_edges.end();
+       it != e;
+       ++it) {
     LOG(INFO) << "    " << it->first << " read-before:";
     DumpExtents(it->second.extents, 6);
     LOG(INFO) << "      write-before:";
@@ -124,10 +126,9 @@
 void DumpGraph(const Graph& graph) {
   LOG(INFO) << "Graph length: " << graph.size();
   for (Graph::size_type i = 0, e = graph.size(); i != e; ++i) {
-    LOG(INFO) << i
-              << (graph[i].valid ? "" : "-INV")
-              << ": " << graph[i].aop.name
-              << ": " << InstallOperationTypeName(graph[i].aop.op.type());
+    LOG(INFO) << i << (graph[i].valid ? "" : "-INV") << ": "
+              << graph[i].aop.name << ": "
+              << InstallOperationTypeName(graph[i].aop.op.type());
     LOG(INFO) << "  src_extents:";
     DumpExtents(graph[i].aop.op.src_extents(), 4);
     LOG(INFO) << "  dst_extents:";
diff --git a/payload_generator/graph_utils.h b/payload_generator/graph_utils.h
index b32e666..7024215 100644
--- a/payload_generator/graph_utils.h
+++ b/payload_generator/graph_utils.h
@@ -35,9 +35,7 @@
 
 // These add a read-before dependency from graph[src] -> graph[dst]. If the dep
 // already exists, the block/s is/are added to the existing edge.
-void AddReadBeforeDep(Vertex* src,
-                      Vertex::Index dst,
-                      uint64_t block);
+void AddReadBeforeDep(Vertex* src, Vertex::Index dst, uint64_t block);
 void AddReadBeforeDepExtents(Vertex* src,
                              Vertex::Index dst,
                              const std::vector<Extent>& extents);
diff --git a/payload_generator/graph_utils_unittest.cc b/payload_generator/graph_utils_unittest.cc
index dddf815..07e7664 100644
--- a/payload_generator/graph_utils_unittest.cc
+++ b/payload_generator/graph_utils_unittest.cc
@@ -56,7 +56,6 @@
   EXPECT_EQ(4U, graph_utils::EdgeWeight(graph, make_pair(0, 1)));
 }
 
-
 TEST(GraphUtilsTest, DepsTest) {
   Graph graph(3);
 
@@ -74,8 +73,8 @@
     EXPECT_EQ(3U, extent.start_block());
     EXPECT_EQ(2U, extent.num_blocks());
   }
-  graph_utils::AddReadBeforeDepExtents(&graph[2], 1,
-    vector<Extent>(1, ExtentForRange(5, 2)));
+  graph_utils::AddReadBeforeDepExtents(
+      &graph[2], 1, vector<Extent>(1, ExtentForRange(5, 2)));
   EXPECT_EQ(1U, graph[2].out_edges.size());
   {
     Extent& extent = graph[2].out_edges[1].extents[0];
diff --git a/payload_generator/inplace_generator.cc b/payload_generator/inplace_generator.cc
index 62608e5..ee19b62 100644
--- a/payload_generator/inplace_generator.cc
+++ b/payload_generator/inplace_generator.cc
@@ -86,7 +86,7 @@
 class IndexedInstallOperationsDstComparator {
  public:
   explicit IndexedInstallOperationsDstComparator(Graph* graph)
-    : graph_(graph) {}
+      : graph_(graph) {}
 
   // Compares the operations in the vertex a and b of graph_.
   bool operator()(size_t a, size_t b) const {
@@ -106,27 +106,25 @@
   }
 }
 
-void InplaceGenerator::SubstituteBlocks(
-    Vertex* vertex,
-    const vector<Extent>& remove_extents,
-    const vector<Extent>& replace_extents) {
+void InplaceGenerator::SubstituteBlocks(Vertex* vertex,
+                                        const vector<Extent>& remove_extents,
+                                        const vector<Extent>& replace_extents) {
   // First, expand out the blocks that op reads from
-  vector<uint64_t> read_blocks =
-      ExpandExtents(vertex->aop.op.src_extents());
+  vector<uint64_t> read_blocks = ExpandExtents(vertex->aop.op.src_extents());
   {
     // Expand remove_extents and replace_extents
     vector<uint64_t> remove_extents_expanded = ExpandExtents(remove_extents);
     vector<uint64_t> replace_extents_expanded = ExpandExtents(replace_extents);
     CHECK_EQ(remove_extents_expanded.size(), replace_extents_expanded.size());
     map<uint64_t, uint64_t> conversion;
-    for (vector<uint64_t>::size_type i = 0;
-         i < replace_extents_expanded.size(); i++) {
+    for (vector<uint64_t>::size_type i = 0; i < replace_extents_expanded.size();
+         i++) {
       conversion[remove_extents_expanded[i]] = replace_extents_expanded[i];
     }
     ApplyMap(&read_blocks, conversion);
     for (auto& edge_prop_pair : vertex->out_edges) {
-      vector<uint64_t> write_before_deps_expanded = ExpandExtents(
-          edge_prop_pair.second.write_extents);
+      vector<uint64_t> write_before_deps_expanded =
+          ExpandExtents(edge_prop_pair.second.write_extents);
       ApplyMap(&write_before_deps_expanded, conversion);
       edge_prop_pair.second.write_extents =
           CompressExtents(write_before_deps_expanded);
@@ -170,8 +168,8 @@
         << "Can't cut edge that has write-before relationship.";
 
     // make node depend on the copy operation
-    (*graph)[edge.first].out_edges.insert(make_pair(graph->size() - 1,
-                                                    cut_edge_properties));
+    (*graph)[edge.first].out_edges.insert(
+        make_pair(graph->size() - 1, cut_edge_properties));
 
     // Set src/dst extents and other proto variables for copy operation
     graph->back().aop.op.set_type(InstallOperation::MOVE);
@@ -179,15 +177,14 @@
                  graph->back().aop.op.mutable_src_extents());
     StoreExtents(cuts.back().tmp_extents,
                  graph->back().aop.op.mutable_dst_extents());
-    graph->back().aop.op.set_src_length(
-        graph_utils::EdgeWeight(*graph, edge) * kBlockSize);
+    graph->back().aop.op.set_src_length(graph_utils::EdgeWeight(*graph, edge) *
+                                        kBlockSize);
     graph->back().aop.op.set_dst_length(graph->back().aop.op.src_length());
 
     // make the dest node read from the scratch space
-    SubstituteBlocks(
-        &((*graph)[edge.second]),
-        (*graph)[edge.first].out_edges[edge.second].extents,
-        cuts.back().tmp_extents);
+    SubstituteBlocks(&((*graph)[edge.second]),
+                     (*graph)[edge.first].out_edges[edge.second].extents,
+                     cuts.back().tmp_extents);
 
     // delete the old edge
     CHECK_EQ(static_cast<Graph::size_type>(1),
@@ -206,11 +203,8 @@
 // Creates all the edges for the graph. Writers of a block point to
 // readers of the same block. This is because for an edge A->B, B
 // must complete before A executes.
-void InplaceGenerator::CreateEdges(
-    Graph* graph,
-    const vector<Block>& blocks) {
-  for (vector<Block>::size_type i = 0;
-       i < blocks.size(); i++) {
+void InplaceGenerator::CreateEdges(Graph* graph, const vector<Block>& blocks) {
+  for (vector<Block>::size_type i = 0; i < blocks.size(); i++) {
     // Blocks with both a reader and writer get an edge
     if (blocks[i].reader == Vertex::kInvalidIndex ||
         blocks[i].writer == Vertex::kInvalidIndex)
@@ -242,6 +236,7 @@
   bool operator()(const CutEdgeVertexes& a, const CutEdgeVertexes& b) {
     return table_[a.old_dst] < table_[b.old_dst];
   }
+
  private:
   const vector<vector<Vertex::Index>::size_type>& table_;
 };
@@ -252,8 +247,8 @@
     const vector<Vertex::Index>& op_indexes,
     vector<vector<Vertex::Index>::size_type>* reverse_op_indexes) {
   vector<vector<Vertex::Index>::size_type> table(op_indexes.size());
-  for (vector<Vertex::Index>::size_type i = 0, e = op_indexes.size();
-       i != e; ++i) {
+  for (vector<Vertex::Index>::size_type i = 0, e = op_indexes.size(); i != e;
+       ++i) {
     Vertex::Index node = op_indexes[i];
     if (table.size() < (node + 1)) {
       table.resize(node + 1);
@@ -264,8 +259,7 @@
 }
 
 void InplaceGenerator::SortCutsByTopoOrder(
-    const vector<Vertex::Index>& op_indexes,
-    vector<CutEdgeVertexes>* cuts) {
+    const vector<Vertex::Index>& op_indexes, vector<CutEdgeVertexes>* cuts) {
   // first, make a reverse lookup table.
   vector<vector<Vertex::Index>::size_type> table;
   GenerateReverseTopoOrderMap(op_indexes, &table);
@@ -274,8 +268,7 @@
 }
 
 void InplaceGenerator::MoveAndSortFullOpsToBack(
-    Graph* graph,
-    vector<Vertex::Index>* op_indexes) {
+    Graph* graph, vector<Vertex::Index>* op_indexes) {
   vector<Vertex::Index> ret;
   vector<Vertex::Index> full_ops;
   ret.reserve(op_indexes->size());
@@ -291,7 +284,8 @@
   LOG(INFO) << "Stats: " << full_ops.size() << " full ops out of "
             << (full_ops.size() + ret.size()) << " total ops.";
   // Sort full ops according to their dst_extents.
-  sort(full_ops.begin(), full_ops.end(),
+  sort(full_ops.begin(),
+       full_ops.end(),
        IndexedInstallOperationsDstComparator(graph));
   ret.insert(ret.end(), full_ops.begin(), full_ops.end());
   op_indexes->swap(ret);
@@ -299,7 +293,7 @@
 
 namespace {
 
-template<typename T>
+template <typename T>
 bool TempBlocksExistInExtents(const T& extents) {
   for (const auto& extent : extents) {
     uint64_t start = extent.start_block();
@@ -331,11 +325,8 @@
   CHECK(!cuts.empty());
   set<Vertex::Index> deleted_nodes;
   for (const CutEdgeVertexes& cut : cuts) {
-    TEST_AND_RETURN_FALSE(InplaceGenerator::ConvertCutToFullOp(
-        graph,
-        cut,
-        new_part,
-        blob_file));
+    TEST_AND_RETURN_FALSE(
+        InplaceGenerator::ConvertCutToFullOp(graph, cut, new_part, blob_file));
     deleted_nodes.insert(cut.new_vertex);
   }
   deleted_nodes.insert(cuts[0].old_dst);
@@ -387,22 +378,25 @@
   SupplierVector block_suppliers;
   uint64_t scratch_blocks_found = 0;
   for (vector<Vertex::Index>::size_type i = (*reverse_op_indexes)[old_dst] + 1,
-           e = op_indexes->size(); i < e; ++i) {
+                                        e = op_indexes->size();
+       i < e;
+       ++i) {
     Vertex::Index test_node = (*op_indexes)[i];
     if (!(*graph)[test_node].valid)
       continue;
     // See if this node has sufficient blocks
     ExtentRanges ranges;
     ranges.AddRepeatedExtents((*graph)[test_node].aop.op.dst_extents());
-    ranges.SubtractExtent(ExtentForRange(
-        kTempBlockStart, kSparseHole - kTempBlockStart));
+    ranges.SubtractExtent(
+        ExtentForRange(kTempBlockStart, kSparseHole - kTempBlockStart));
     ranges.SubtractRepeatedExtents((*graph)[test_node].aop.op.src_extents());
     // For now, for simplicity, subtract out all blocks in read-before
     // dependencies.
-    for (Vertex::EdgeMap::const_iterator edge_i =
-             (*graph)[test_node].out_edges.begin(),
+    for (Vertex::EdgeMap::const_iterator
+             edge_i = (*graph)[test_node].out_edges.begin(),
              edge_e = (*graph)[test_node].out_edges.end();
-         edge_i != edge_e; ++edge_i) {
+         edge_i != edge_e;
+         ++edge_i) {
       ranges.SubtractExtents(edge_i->second.extents);
     }
 
@@ -418,8 +412,8 @@
 
     if (ranges.blocks() + scratch_blocks_found > blocks_needed) {
       // trim down ranges
-      vector<Extent> new_ranges = ranges.GetExtentsForBlockCount(
-          blocks_needed - scratch_blocks_found);
+      vector<Extent> new_ranges =
+          ranges.GetExtentsForBlockCount(blocks_needed - scratch_blocks_found);
       ranges = ExtentRanges();
       ranges.AddExtents(new_ranges);
     }
@@ -431,12 +425,8 @@
   }
   if (scratch_ranges.blocks() < blocks_needed) {
     LOG(INFO) << "Unable to find sufficient scratch";
-    TEST_AND_RETURN_FALSE(ConvertCutsToFull(graph,
-                                            new_part,
-                                            blob_file,
-                                            op_indexes,
-                                            reverse_op_indexes,
-                                            cuts));
+    TEST_AND_RETURN_FALSE(ConvertCutsToFull(
+        graph, new_part, blob_file, op_indexes, reverse_op_indexes, cuts));
     return true;
   }
   // Use the scratch we found
@@ -459,9 +449,8 @@
     scratch_ranges.SubtractExtents(real_extents);
 
     // Fix the old dest node w/ the real blocks
-    InplaceGenerator::SubstituteBlocks(&(*graph)[old_dst],
-                                         cut.tmp_extents,
-                                         real_extents);
+    InplaceGenerator::SubstituteBlocks(
+        &(*graph)[old_dst], cut.tmp_extents, real_extents);
 
     // Fix the new node w/ the real blocks. Since the new node is just a
     // copy operation, we can replace all the dest extents w/ the real
@@ -487,12 +476,12 @@
   // group of cuts w/ the same old_dst:
   vector<CutEdgeVertexes> cuts_group;
 
-  for (vector<CutEdgeVertexes>::size_type i = cuts.size() - 1, e = 0;
-       true ; --i) {
+  for (vector<CutEdgeVertexes>::size_type i = cuts.size() - 1, e = 0; true;
+       --i) {
     LOG(INFO) << "Fixing temp blocks in cut " << i
-              << ": old dst: " << cuts[i].old_dst << " new vertex: "
-              << cuts[i].new_vertex << " path: "
-              << (*graph)[cuts[i].old_dst].aop.name;
+              << ": old dst: " << cuts[i].old_dst
+              << " new vertex: " << cuts[i].new_vertex
+              << " path: " << (*graph)[cuts[i].old_dst].aop.name;
 
     if (cuts_group.empty() || (cuts_group[0].old_dst == cuts[i].old_dst)) {
       cuts_group.push_back(cuts[i]);
@@ -514,12 +503,8 @@
     }
   }
   CHECK(!cuts_group.empty());
-  TEST_AND_RETURN_FALSE(AssignBlockForAdjoiningCuts(graph,
-                                                    new_part,
-                                                    blob_file,
-                                                    op_indexes,
-                                                    reverse_op_indexes,
-                                                    cuts_group));
+  TEST_AND_RETURN_FALSE(AssignBlockForAdjoiningCuts(
+      graph, new_part, blob_file, op_indexes, reverse_op_indexes, cuts_group));
   return true;
 }
 
@@ -566,8 +551,7 @@
     // |new_extents| list of blocks and update the graph.
     vector<AnnotatedOperation> new_aop;
     vector<Extent> new_extents;
-    ExtentsToVector((*graph)[cut.old_dst].aop.op.dst_extents(),
-                    &new_extents);
+    ExtentsToVector((*graph)[cut.old_dst].aop.op.dst_extents(), &new_extents);
     TEST_AND_RETURN_FALSE(diff_utils::DeltaReadFile(
         &new_aop,
         "",  // old_part
@@ -582,7 +566,7 @@
         blob_file));
     TEST_AND_RETURN_FALSE(new_aop.size() == 1);
     TEST_AND_RETURN_FALSE(AddInstallOpToGraph(
-      graph, cut.old_dst, nullptr, new_aop.front().op, new_aop.front().name));
+        graph, cut.old_dst, nullptr, new_aop.front().op, new_aop.front().name));
 
     (*graph)[cut.old_dst].out_edges = out_edges;
 
@@ -636,12 +620,8 @@
   SortCutsByTopoOrder(*final_order, &cuts);
 
   if (!cuts.empty())
-    TEST_AND_RETURN_FALSE(AssignTempBlocks(graph,
-                                           new_part,
-                                           blob_file,
-                                           final_order,
-                                           &inverse_final_order,
-                                           cuts));
+    TEST_AND_RETURN_FALSE(AssignTempBlocks(
+        graph, new_part, blob_file, final_order, &inverse_final_order, cuts));
   LOG(INFO) << "Making sure all temp blocks have been allocated";
 
   // Remove the scratch node, if any
@@ -683,19 +663,19 @@
     const char* past_participle = (field == READER) ? "read" : "written";
     const google::protobuf::RepeatedPtrField<Extent>& extents =
         (field == READER) ? operation.src_extents() : operation.dst_extents();
-    Vertex::Index Block::*access_type = (field == READER) ?
-        &Block::reader : &Block::writer;
+    Vertex::Index Block::*access_type =
+        (field == READER) ? &Block::reader : &Block::writer;
 
     for (const Extent& extent : extents) {
       for (uint64_t block = extent.start_block();
-           block < (extent.start_block() + extent.num_blocks()); block++) {
+           block < (extent.start_block() + extent.num_blocks());
+           block++) {
         if ((*blocks)[block].*access_type != Vertex::kInvalidIndex) {
-          LOG(FATAL) << "Block " << block << " is already "
-                     << past_participle << " by "
-                     << (*blocks)[block].*access_type << "("
+          LOG(FATAL) << "Block " << block << " is already " << past_participle
+                     << " by " << (*blocks)[block].*access_type << "("
                      << graph[(*blocks)[block].*access_type].aop.name
-                     << ") and also " << vertex << "("
-                     << graph[vertex].aop.name << ")";
+                     << ") and also " << vertex << "(" << graph[vertex].aop.name
+                     << ")";
         }
         (*blocks)[block].*access_type = vertex;
       }
@@ -720,10 +700,7 @@
 
   if (blocks)
     TEST_AND_RETURN_FALSE(InplaceGenerator::AddInstallOpToBlocksVector(
-        (*graph)[vertex].aop.op,
-        *graph,
-        vertex,
-        blocks));
+        (*graph)[vertex].aop.op, *graph, vertex, blocks));
   return true;
 }
 
@@ -771,11 +748,7 @@
 
   vector<Vertex::Index> final_order;
   TEST_AND_RETURN_FALSE(ConvertGraphToDag(
-      &graph,
-      new_part.path,
-      blob_file,
-      &final_order,
-      scratch_vertex));
+      &graph, new_part.path, blob_file, &final_order, scratch_vertex));
 
   // Copy operations over to the |aops| vector in the final_order generated by
   // the topological sort.
@@ -788,18 +761,19 @@
   return true;
 }
 
-bool InplaceGenerator::GenerateOperations(
-    const PayloadGenerationConfig& config,
-    const PartitionConfig& old_part,
-    const PartitionConfig& new_part,
-    BlobFileWriter* blob_file,
-    vector<AnnotatedOperation>* aops) {
+bool InplaceGenerator::GenerateOperations(const PayloadGenerationConfig& config,
+                                          const PartitionConfig& old_part,
+                                          const PartitionConfig& new_part,
+                                          BlobFileWriter* blob_file,
+                                          vector<AnnotatedOperation>* aops) {
   TEST_AND_RETURN_FALSE(old_part.name == new_part.name);
   TEST_AND_RETURN_FALSE(config.version.major == kInPlacePayloadVersion.major);
   TEST_AND_RETURN_FALSE(config.version.minor == kInPlacePayloadVersion.minor);
 
-  ssize_t hard_chunk_blocks = (config.hard_chunk_size == -1 ? -1 :
-                               config.hard_chunk_size / config.block_size);
+  ssize_t hard_chunk_blocks =
+      (config.hard_chunk_size == -1
+           ? -1
+           : config.hard_chunk_size / config.block_size);
   size_t soft_chunk_blocks = config.soft_chunk_size / config.block_size;
   uint64_t partition_size = new_part.size;
   if (new_part.name == kPartitionNameRoot)
diff --git a/payload_generator/inplace_generator.h b/payload_generator/inplace_generator.h
index f108639..e7298d2 100644
--- a/payload_generator/inplace_generator.h
+++ b/payload_generator/inplace_generator.h
@@ -97,8 +97,7 @@
   // Creates all the edges for the graph. Writers of a block point to
   // readers of the same block. This is because for an edge A->B, B
   // must complete before A executes.
-  static void CreateEdges(Graph* graph,
-                          const std::vector<Block>& blocks);
+  static void CreateEdges(Graph* graph, const std::vector<Block>& blocks);
 
   // Takes |op_indexes|, which is effectively a mapping from order in
   // which the op is performed -> graph vertex index, and produces the
@@ -109,15 +108,14 @@
 
   // Sorts the vector |cuts| by its |cuts[].old_dest| member. Order is
   // determined by the order of elements in op_indexes.
-  static void SortCutsByTopoOrder(
-      const std::vector<Vertex::Index>& op_indexes,
-      std::vector<CutEdgeVertexes>* cuts);
+  static void SortCutsByTopoOrder(const std::vector<Vertex::Index>& op_indexes,
+                                  std::vector<CutEdgeVertexes>* cuts);
 
   // Given a topologically sorted graph |op_indexes| and |graph|, alters
   // |op_indexes| to move all the full operations to the end of the vector.
   // Full operations should not be depended on, so this is safe.
   static void MoveAndSortFullOpsToBack(Graph* graph,
-                                std::vector<Vertex::Index>* op_indexes);
+                                       std::vector<Vertex::Index>* op_indexes);
 
   // Returns true iff there are no extents in the graph that refer to temp
   // blocks. Temp blocks are in the range [kTempBlockStart, kSparseHole).
@@ -227,12 +225,11 @@
   // a delta update with the minor version kInPlaceMinorPayloadVersion.
   // The operations are stored in |aops|. All the offsets in the operations
   // reference the data written to |blob_file|.
-  bool GenerateOperations(
-      const PayloadGenerationConfig& config,
-      const PartitionConfig& old_part,
-      const PartitionConfig& new_part,
-      BlobFileWriter* blob_file,
-      std::vector<AnnotatedOperation>* aops) override;
+  bool GenerateOperations(const PayloadGenerationConfig& config,
+                          const PartitionConfig& old_part,
+                          const PartitionConfig& new_part,
+                          BlobFileWriter* blob_file,
+                          std::vector<AnnotatedOperation>* aops) override;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(InplaceGenerator);
diff --git a/payload_generator/inplace_generator_unittest.cc b/payload_generator/inplace_generator_unittest.cc
index 20ac50b..ab3b867 100644
--- a/payload_generator/inplace_generator_unittest.cc
+++ b/payload_generator/inplace_generator_unittest.cc
@@ -17,6 +17,7 @@
 #include "update_engine/payload_generator/inplace_generator.h"
 
 #include <map>
+#include <memory>
 #include <set>
 #include <sstream>
 #include <string>
@@ -77,11 +78,12 @@
   return ret;
 }
 
-template<typename T>
+template <typename T>
 void DumpVect(const vector<T>& vect) {
   stringstream ss(stringstream::out);
   for (typename vector<T>::const_iterator it = vect.begin(), e = vect.end();
-       it != e; ++it) {
+       it != e;
+       ++it) {
     ss << *it << ", ";
   }
   LOG(INFO) << "{" << ss.str() << "}";
@@ -241,8 +243,8 @@
   cycle_breaker.BreakCycles(graph, &cut_edges);
 
   EXPECT_EQ(1U, cut_edges.size());
-  EXPECT_TRUE(cut_edges.end() != cut_edges.find(
-      std::pair<Vertex::Index, Vertex::Index>(1, 0)));
+  EXPECT_TRUE(cut_edges.end() !=
+              cut_edges.find(std::pair<Vertex::Index, Vertex::Index>(1, 0)));
 
   vector<CutEdgeVertexes> cuts;
   EXPECT_TRUE(InplaceGenerator::CutEdges(&graph, cut_edges, &cuts));
@@ -274,8 +276,8 @@
   // Ensure it only depends on the next node and the new temp node
   EXPECT_EQ(2U, graph[0].out_edges.size());
   EXPECT_TRUE(graph[0].out_edges.end() != graph[0].out_edges.find(1));
-  EXPECT_TRUE(graph[0].out_edges.end() != graph[0].out_edges.find(graph.size() -
-                                                                  1));
+  EXPECT_TRUE(graph[0].out_edges.end() !=
+              graph[0].out_edges.find(graph.size() - 1));
 
   // Check second node has unchanged extents
   EXPECT_EQ(2, graph[1].aop.op.src_extents_size());
@@ -737,8 +739,8 @@
     if (aop.op.type() == InstallOperation::MOVE) {
       move_ops++;
       for (const Extent& extent : aop.op.dst_extents()) {
-        EXPECT_LE(7U, extent.start_block()) << "On dst extents for aop: "
-                                            << aop;
+        EXPECT_LE(7U, extent.start_block())
+            << "On dst extents for aop: " << aop;
       }
     }
   }
diff --git a/payload_generator/operations_generator.h b/payload_generator/operations_generator.h
index 9127d7b..4d7322b 100644
--- a/payload_generator/operations_generator.h
+++ b/payload_generator/operations_generator.h
@@ -40,12 +40,11 @@
   // The operations generated will refer to offsets in the file |blob_file|,
   // where this function stores the output, but not necessarily in the same
   // order as they appear in the |aops|.
-  virtual bool GenerateOperations(
-      const PayloadGenerationConfig& config,
-      const PartitionConfig& old_part,
-      const PartitionConfig& new_part,
-      BlobFileWriter* blob_file,
-      std::vector<AnnotatedOperation>* aops) = 0;
+  virtual bool GenerateOperations(const PayloadGenerationConfig& config,
+                                  const PartitionConfig& old_part,
+                                  const PartitionConfig& new_part,
+                                  BlobFileWriter* blob_file,
+                                  std::vector<AnnotatedOperation>* aops) = 0;
 
  protected:
   OperationsGenerator() = default;
diff --git a/payload_generator/payload_file.cc b/payload_generator/payload_file.cc
index d0aa71e..775a509 100644
--- a/payload_generator/payload_file.cc
+++ b/payload_generator/payload_file.cc
@@ -41,10 +41,8 @@
 
 struct DeltaObject {
   DeltaObject(const string& in_name, const int in_type, const off_t in_size)
-      : name(in_name),
-        type(in_type),
-        size(in_size) {}
-  bool operator <(const DeltaObject& object) const {
+      : name(in_name), type(in_type), size(in_size) {}
+  bool operator<(const DeltaObject& object) const {
     return (size != object.size) ? (size < object.size) : (name < object.name);
   }
   string name;
@@ -90,8 +88,8 @@
                                const vector<AnnotatedOperation>& aops) {
   // Check partitions order for Chrome OS
   if (major_version_ == kChromeOSMajorPayloadVersion) {
-    const vector<const char*> part_order = { kPartitionNameRoot,
-                                             kPartitionNameKernel };
+    const vector<const char*> part_order = {kPartitionNameRoot,
+                                            kPartitionNameKernel};
     TEST_AND_RETURN_FALSE(part_vec_.size() < part_order.size());
     TEST_AND_RETURN_FALSE(new_conf.name == part_order[part_vec_.size()]);
   }
@@ -102,10 +100,10 @@
   part.verity = new_conf.verity;
   // Initialize the PartitionInfo objects if present.
   if (!old_conf.path.empty())
-    TEST_AND_RETURN_FALSE(diff_utils::InitializePartitionInfo(old_conf,
-                                                              &part.old_info));
-  TEST_AND_RETURN_FALSE(diff_utils::InitializePartitionInfo(new_conf,
-                                                            &part.new_info));
+    TEST_AND_RETURN_FALSE(
+        diff_utils::InitializePartitionInfo(old_conf, &part.old_info));
+  TEST_AND_RETURN_FALSE(
+      diff_utils::InitializePartitionInfo(new_conf, &part.new_info));
   part_vec_.push_back(std::move(part));
   return true;
 }
@@ -117,9 +115,7 @@
   // Reorder the data blobs with the manifest_.
   string ordered_blobs_path;
   TEST_AND_RETURN_FALSE(utils::MakeTempFile(
-      "CrAU_temp_data.ordered.XXXXXX",
-      &ordered_blobs_path,
-      nullptr));
+      "CrAU_temp_data.ordered.XXXXXX", &ordered_blobs_path, nullptr));
   ScopedPathUnlinker ordered_blobs_unlinker(ordered_blobs_path);
   TEST_AND_RETURN_FALSE(ReorderDataBlobs(data_blobs_path, ordered_blobs_path));
 
@@ -130,8 +126,8 @@
       if (!aop.op.has_data_offset())
         continue;
       if (aop.op.data_offset() != next_blob_offset) {
-        LOG(FATAL) << "bad blob offset! " << aop.op.data_offset() << " != "
-                   << next_blob_offset;
+        LOG(FATAL) << "bad blob offset! " << aop.op.data_offset()
+                   << " != " << next_blob_offset;
       }
       next_blob_offset += aop.op.data_length();
     }
@@ -200,12 +196,13 @@
   // manifest_.
   uint64_t signature_blob_length = 0;
   if (!private_key_path.empty()) {
-    TEST_AND_RETURN_FALSE(
-        PayloadSigner::SignatureBlobLength(vector<string>(1, private_key_path),
-                                           &signature_blob_length));
+    TEST_AND_RETURN_FALSE(PayloadSigner::SignatureBlobLength(
+        vector<string>(1, private_key_path), &signature_blob_length));
     PayloadSigner::AddSignatureToManifest(
-        next_blob_offset, signature_blob_length,
-        major_version_ == kChromeOSMajorPayloadVersion, &manifest_);
+        next_blob_offset,
+        signature_blob_length,
+        major_version_ == kChromeOSMajorPayloadVersion,
+        &manifest_);
   }
 
   // Serialize protobuf
@@ -229,8 +226,8 @@
   TEST_AND_RETURN_FALSE(WriteUint64AsBigEndian(&writer, major_version_));
 
   // Write protobuf length
-  TEST_AND_RETURN_FALSE(WriteUint64AsBigEndian(&writer,
-                                               serialized_manifest.size()));
+  TEST_AND_RETURN_FALSE(
+      WriteUint64AsBigEndian(&writer, serialized_manifest.size()));
 
   // Write metadata signature size.
   uint32_t metadata_signature_size = 0;
@@ -255,9 +252,8 @@
   if (major_version_ == kBrilloMajorPayloadVersion &&
       !private_key_path.empty()) {
     brillo::Blob metadata_hash, metadata_signature;
-    TEST_AND_RETURN_FALSE(HashCalculator::RawHashOfFile(payload_file,
-                                                             metadata_size,
-                                                             &metadata_hash));
+    TEST_AND_RETURN_FALSE(HashCalculator::RawHashOfFile(
+        payload_file, metadata_size, &metadata_hash));
     TEST_AND_RETURN_FALSE(
         PayloadSigner::SignHashWithKeys(metadata_hash,
                                         vector<string>(1, private_key_path),
@@ -302,9 +298,8 @@
   return true;
 }
 
-bool PayloadFile::ReorderDataBlobs(
-    const string& data_blobs_path,
-    const string& new_data_blobs_path) {
+bool PayloadFile::ReorderDataBlobs(const string& data_blobs_path,
+                                   const string& new_data_blobs_path) {
   int in_fd = open(data_blobs_path.c_str(), O_RDONLY, 0);
   TEST_AND_RETURN_FALSE_ERRNO(in_fd >= 0);
   ScopedFdCloser in_fd_closer(&in_fd);
diff --git a/payload_generator/payload_generation_config.cc b/payload_generator/payload_generation_config.cc
index e7d8ae5..694c71f 100644
--- a/payload_generator/payload_generation_config.cc
+++ b/payload_generator/payload_generation_config.cc
@@ -198,12 +198,10 @@
 }
 
 bool ImageConfig::ImageInfoIsEmpty() const {
-  return image_info.board().empty()
-    && image_info.key().empty()
-    && image_info.channel().empty()
-    && image_info.version().empty()
-    && image_info.build_channel().empty()
-    && image_info.build_version().empty();
+  return image_info.board().empty() && image_info.key().empty() &&
+         image_info.channel().empty() && image_info.version().empty() &&
+         image_info.build_channel().empty() &&
+         image_info.build_version().empty();
 }
 
 PayloadVersion::PayloadVersion(uint64_t major_version, uint32_t minor_version) {
diff --git a/payload_generator/payload_signer.cc b/payload_generator/payload_signer.cc
index 35a0c3f..2d0489a 100644
--- a/payload_generator/payload_signer.cc
+++ b/payload_generator/payload_signer.cc
@@ -67,9 +67,8 @@
   // Serialize protobuf
   string serialized;
   TEST_AND_RETURN_FALSE(out_message.AppendToString(&serialized));
-  out_signature_blob->insert(out_signature_blob->end(),
-                             serialized.begin(),
-                             serialized.end());
+  out_signature_blob->insert(
+      out_signature_blob->end(), serialized.begin(), serialized.end());
   LOG(INFO) << "Signature blob size: " << out_signature_blob->size();
   return true;
 }
@@ -103,7 +102,8 @@
     // Write metadata signature size in header.
     uint32_t metadata_signature_size_be =
         htobe32(metadata_signature_blob.size());
-    memcpy(payload.data() + manifest_offset, &metadata_signature_size_be,
+    memcpy(payload.data() + manifest_offset,
+           &metadata_signature_size_be,
            sizeof(metadata_signature_size_be));
     manifest_offset += sizeof(metadata_signature_size_be);
     // Replace metadata signature.
@@ -159,8 +159,8 @@
     LOG(INFO) << "Updated payload size: " << payload.size();
     LOG(INFO) << "Updated metadata size: " << metadata_size;
   }
-  uint64_t signatures_offset = metadata_size + metadata_signature_size +
-                               manifest.signatures_offset();
+  uint64_t signatures_offset =
+      metadata_size + metadata_signature_size + manifest.signatures_offset();
   LOG(INFO) << "Signature Blob Offset: " << signatures_offset;
   payload.resize(signatures_offset);
   payload.insert(payload.begin() + signatures_offset,
@@ -186,9 +186,8 @@
                               brillo::Blob* out_metadata_hash) {
   if (out_metadata_hash) {
     // Calculates the hash on the manifest.
-    TEST_AND_RETURN_FALSE(
-        HashCalculator::RawHashOfBytes(payload.data(), metadata_size,
-                                       out_metadata_hash));
+    TEST_AND_RETURN_FALSE(HashCalculator::RawHashOfBytes(
+        payload.data(), metadata_size, out_metadata_hash));
   }
   if (out_hash_data) {
     // Calculates the hash on the updated payload. Note that we skip metadata
@@ -319,8 +318,8 @@
     TEST_AND_RETURN_FALSE(SignHash(hash_data, path, &signature));
     signatures.push_back(signature);
   }
-  TEST_AND_RETURN_FALSE(ConvertSignatureToProtobufBlob(signatures,
-                                                       out_signature_blob));
+  TEST_AND_RETURN_FALSE(
+      ConvertSignatureToProtobufBlob(signatures, out_signature_blob));
   return true;
 }
 
@@ -339,9 +338,8 @@
                                                  signatures_offset,
                                                  &hash_data,
                                                  nullptr));
-  TEST_AND_RETURN_FALSE(SignHashWithKeys(hash_data,
-                                         private_key_paths,
-                                         out_signature_blob));
+  TEST_AND_RETURN_FALSE(
+      SignHashWithKeys(hash_data, private_key_paths, out_signature_blob));
   return true;
 }
 
@@ -349,9 +347,8 @@
                                         uint64_t* out_length) {
   DCHECK(out_length);
   brillo::Blob x_blob(1, 'x'), hash_blob, sig_blob;
-  TEST_AND_RETURN_FALSE(HashCalculator::RawHashOfBytes(x_blob.data(),
-                                                       x_blob.size(),
-                                                       &hash_blob));
+  TEST_AND_RETURN_FALSE(
+      HashCalculator::RawHashOfBytes(x_blob.data(), x_blob.size(), &hash_blob));
   TEST_AND_RETURN_FALSE(
       SignHashWithKeys(hash_blob, private_key_paths, &sig_blob));
   *out_length = sig_blob.size();
@@ -369,8 +366,8 @@
     signatures.emplace_back(signature_size, 0);
   }
   brillo::Blob signature_blob;
-  TEST_AND_RETURN_FALSE(ConvertSignatureToProtobufBlob(signatures,
-                                                       &signature_blob));
+  TEST_AND_RETURN_FALSE(
+      ConvertSignatureToProtobufBlob(signatures, &signature_blob));
 
   brillo::Blob payload;
   uint64_t metadata_size, signatures_offset;
@@ -397,17 +394,16 @@
     const vector<brillo::Blob>& payload_signatures,
     const vector<brillo::Blob>& metadata_signatures,
     const string& signed_payload_path,
-    uint64_t *out_metadata_size) {
+    uint64_t* out_metadata_size) {
   // TODO(petkov): Reduce memory usage -- the payload is manipulated in memory.
 
   // Loads the payload and adds the signature op to it.
   brillo::Blob signature_blob, metadata_signature_blob;
-  TEST_AND_RETURN_FALSE(ConvertSignatureToProtobufBlob(payload_signatures,
-                                                       &signature_blob));
+  TEST_AND_RETURN_FALSE(
+      ConvertSignatureToProtobufBlob(payload_signatures, &signature_blob));
   if (!metadata_signatures.empty()) {
-    TEST_AND_RETURN_FALSE(
-        ConvertSignatureToProtobufBlob(metadata_signatures,
-                                       &metadata_signature_blob));
+    TEST_AND_RETURN_FALSE(ConvertSignatureToProtobufBlob(
+        metadata_signatures, &metadata_signature_blob));
   }
   brillo::Blob payload;
   uint64_t signatures_offset;
@@ -421,9 +417,8 @@
                                                   &signatures_offset));
 
   LOG(INFO) << "Signed payload size: " << payload.size();
-  TEST_AND_RETURN_FALSE(utils::WriteFile(signed_payload_path.c_str(),
-                                         payload.data(),
-                                         payload.size()));
+  TEST_AND_RETURN_FALSE(utils::WriteFile(
+      signed_payload_path.c_str(), payload.data(), payload.size()));
   return true;
 }
 
@@ -434,14 +429,11 @@
   // Calculates the hash on the updated payload. Note that the payload includes
   // the signature op but doesn't include the signature blob at the end.
   brillo::Blob metadata_hash;
-  TEST_AND_RETURN_FALSE(HashCalculator::RawHashOfBytes(metadata,
-                                                       metadata_size,
-                                                       &metadata_hash));
+  TEST_AND_RETURN_FALSE(
+      HashCalculator::RawHashOfBytes(metadata, metadata_size, &metadata_hash));
 
   brillo::Blob signature;
-  TEST_AND_RETURN_FALSE(SignHash(metadata_hash,
-                                 private_key_path,
-                                 &signature));
+  TEST_AND_RETURN_FALSE(SignHash(metadata_hash, private_key_path, &signature));
 
   *out_signature = brillo::data_encoding::Base64Encode(signature);
   return true;
diff --git a/payload_generator/payload_signer.h b/payload_generator/payload_signer.h
index 38c673c..b2d6606 100644
--- a/payload_generator/payload_signer.h
+++ b/payload_generator/payload_signer.h
@@ -77,8 +77,7 @@
   // Returns the length of out_signature_blob that will result in a call
   // to SignPayload with the given private keys. Returns true on success.
   static bool SignatureBlobLength(
-      const std::vector<std::string>& private_key_paths,
-      uint64_t* out_length);
+      const std::vector<std::string>& private_key_paths, uint64_t* out_length);
 
   // Given an unsigned payload in |payload_path|,
   // this method does two things:
diff --git a/payload_generator/payload_signer_unittest.cc b/payload_generator/payload_signer_unittest.cc
index a6ef38d..52d51bc 100644
--- a/payload_generator/payload_signer_unittest.cc
+++ b/payload_generator/payload_signer_unittest.cc
@@ -51,12 +51,10 @@
 // Generated by:
 // echo -n 'This is some data to sign.' | openssl dgst -sha256 -binary |
 //   hexdump -v -e '" " 8/1 "0x%02x, " "\n"'
-const uint8_t kDataHash[] = {
-  0x7a, 0x07, 0xa6, 0x44, 0x08, 0x86, 0x20, 0xa6,
-  0xc1, 0xf8, 0xd9, 0x02, 0x05, 0x63, 0x0d, 0xb7,
-  0xfc, 0x2b, 0xa0, 0xa9, 0x7c, 0x9d, 0x1d, 0x8c,
-  0x01, 0xf5, 0x78, 0x6d, 0xc5, 0x11, 0xb4, 0x06
-};
+const uint8_t kDataHash[] = {0x7a, 0x07, 0xa6, 0x44, 0x08, 0x86, 0x20, 0xa6,
+                             0xc1, 0xf8, 0xd9, 0x02, 0x05, 0x63, 0x0d, 0xb7,
+                             0xfc, 0x2b, 0xa0, 0xa9, 0x7c, 0x9d, 0x1d, 0x8c,
+                             0x01, 0xf5, 0x78, 0x6d, 0xc5, 0x11, 0xb4, 0x06};
 
 // Generated with openssl 1.0, which at the time of this writing, you need
 // to download and install yourself. Here's my command:
@@ -64,39 +62,28 @@
 //    ~/local/bin/openssl pkeyutl -sign -inkey unittest_key.pem -pkeyopt
 //    digest:sha256 | hexdump -v -e '" " 8/1 "0x%02x, " "\n"'
 const uint8_t kDataSignature[] = {
-  0x9f, 0x86, 0x25, 0x8b, 0xf3, 0xcc, 0xe3, 0x95,
-  0x5f, 0x45, 0x83, 0xb2, 0x66, 0xf0, 0x2a, 0xcf,
-  0xb7, 0xaa, 0x52, 0x25, 0x7a, 0xdd, 0x9d, 0x65,
-  0xe5, 0xd6, 0x02, 0x4b, 0x37, 0x99, 0x53, 0x06,
-  0xc2, 0xc9, 0x37, 0x36, 0x25, 0x62, 0x09, 0x4f,
-  0x6b, 0x22, 0xf8, 0xb3, 0x89, 0x14, 0x98, 0x1a,
-  0xbc, 0x30, 0x90, 0x4a, 0x43, 0xf5, 0xea, 0x2e,
-  0xf0, 0xa4, 0xba, 0xc3, 0xa7, 0xa3, 0x44, 0x70,
-  0xd6, 0xc4, 0x89, 0xd8, 0x45, 0x71, 0xbb, 0xee,
-  0x59, 0x87, 0x3d, 0xd5, 0xe5, 0x40, 0x22, 0x3d,
-  0x73, 0x7e, 0x2a, 0x58, 0x93, 0x8e, 0xcb, 0x9c,
-  0xf2, 0xbb, 0x4a, 0xc9, 0xd2, 0x2c, 0x52, 0x42,
-  0xb0, 0xd1, 0x13, 0x22, 0xa4, 0x78, 0xc7, 0xc6,
-  0x3e, 0xf1, 0xdc, 0x4c, 0x7b, 0x2d, 0x40, 0xda,
-  0x58, 0xac, 0x4a, 0x11, 0x96, 0x3d, 0xa0, 0x01,
-  0xf6, 0x96, 0x74, 0xf6, 0x6c, 0x0c, 0x49, 0x69,
-  0x4e, 0xc1, 0x7e, 0x9f, 0x2a, 0x42, 0xdd, 0x15,
-  0x6b, 0x37, 0x2e, 0x3a, 0xa7, 0xa7, 0x6d, 0x91,
-  0x13, 0xe8, 0x59, 0xde, 0xfe, 0x99, 0x07, 0xd9,
-  0x34, 0x0f, 0x17, 0xb3, 0x05, 0x4c, 0xd2, 0xc6,
-  0x82, 0xb7, 0x38, 0x36, 0x63, 0x1d, 0x9e, 0x21,
-  0xa6, 0x32, 0xef, 0xf1, 0x65, 0xe6, 0xed, 0x95,
-  0x25, 0x9b, 0x61, 0xe0, 0xba, 0x86, 0xa1, 0x7f,
-  0xf8, 0xa5, 0x4a, 0x32, 0x1f, 0x15, 0x20, 0x8a,
-  0x41, 0xc5, 0xb0, 0xd9, 0x4a, 0xda, 0x85, 0xf3,
-  0xdc, 0xa0, 0x98, 0x5d, 0x1d, 0x18, 0x9d, 0x2e,
-  0x42, 0xea, 0x69, 0x13, 0x74, 0x3c, 0x74, 0xf7,
-  0x6d, 0x43, 0xb0, 0x63, 0x90, 0xdb, 0x04, 0xd5,
-  0x05, 0xc9, 0x73, 0x1f, 0x6c, 0xd6, 0xfa, 0x46,
-  0x4e, 0x0f, 0x33, 0x58, 0x5b, 0x0d, 0x1b, 0x55,
-  0x39, 0xb9, 0x0f, 0x43, 0x37, 0xc0, 0x06, 0x0c,
-  0x29, 0x93, 0x43, 0xc7, 0x43, 0xb9, 0xab, 0x7d
-};
+    0x9f, 0x86, 0x25, 0x8b, 0xf3, 0xcc, 0xe3, 0x95, 0x5f, 0x45, 0x83, 0xb2,
+    0x66, 0xf0, 0x2a, 0xcf, 0xb7, 0xaa, 0x52, 0x25, 0x7a, 0xdd, 0x9d, 0x65,
+    0xe5, 0xd6, 0x02, 0x4b, 0x37, 0x99, 0x53, 0x06, 0xc2, 0xc9, 0x37, 0x36,
+    0x25, 0x62, 0x09, 0x4f, 0x6b, 0x22, 0xf8, 0xb3, 0x89, 0x14, 0x98, 0x1a,
+    0xbc, 0x30, 0x90, 0x4a, 0x43, 0xf5, 0xea, 0x2e, 0xf0, 0xa4, 0xba, 0xc3,
+    0xa7, 0xa3, 0x44, 0x70, 0xd6, 0xc4, 0x89, 0xd8, 0x45, 0x71, 0xbb, 0xee,
+    0x59, 0x87, 0x3d, 0xd5, 0xe5, 0x40, 0x22, 0x3d, 0x73, 0x7e, 0x2a, 0x58,
+    0x93, 0x8e, 0xcb, 0x9c, 0xf2, 0xbb, 0x4a, 0xc9, 0xd2, 0x2c, 0x52, 0x42,
+    0xb0, 0xd1, 0x13, 0x22, 0xa4, 0x78, 0xc7, 0xc6, 0x3e, 0xf1, 0xdc, 0x4c,
+    0x7b, 0x2d, 0x40, 0xda, 0x58, 0xac, 0x4a, 0x11, 0x96, 0x3d, 0xa0, 0x01,
+    0xf6, 0x96, 0x74, 0xf6, 0x6c, 0x0c, 0x49, 0x69, 0x4e, 0xc1, 0x7e, 0x9f,
+    0x2a, 0x42, 0xdd, 0x15, 0x6b, 0x37, 0x2e, 0x3a, 0xa7, 0xa7, 0x6d, 0x91,
+    0x13, 0xe8, 0x59, 0xde, 0xfe, 0x99, 0x07, 0xd9, 0x34, 0x0f, 0x17, 0xb3,
+    0x05, 0x4c, 0xd2, 0xc6, 0x82, 0xb7, 0x38, 0x36, 0x63, 0x1d, 0x9e, 0x21,
+    0xa6, 0x32, 0xef, 0xf1, 0x65, 0xe6, 0xed, 0x95, 0x25, 0x9b, 0x61, 0xe0,
+    0xba, 0x86, 0xa1, 0x7f, 0xf8, 0xa5, 0x4a, 0x32, 0x1f, 0x15, 0x20, 0x8a,
+    0x41, 0xc5, 0xb0, 0xd9, 0x4a, 0xda, 0x85, 0xf3, 0xdc, 0xa0, 0x98, 0x5d,
+    0x1d, 0x18, 0x9d, 0x2e, 0x42, 0xea, 0x69, 0x13, 0x74, 0x3c, 0x74, 0xf7,
+    0x6d, 0x43, 0xb0, 0x63, 0x90, 0xdb, 0x04, 0xd5, 0x05, 0xc9, 0x73, 0x1f,
+    0x6c, 0xd6, 0xfa, 0x46, 0x4e, 0x0f, 0x33, 0x58, 0x5b, 0x0d, 0x1b, 0x55,
+    0x39, 0xb9, 0x0f, 0x43, 0x37, 0xc0, 0x06, 0x0c, 0x29, 0x93, 0x43, 0xc7,
+    0x43, 0xb9, 0xab, 0x7d};
 
 namespace {
 void SignSampleData(brillo::Blob* out_signature_blob,
@@ -107,13 +94,10 @@
   EXPECT_TRUE(PayloadSigner::SignatureBlobLength(private_keys, &length));
   EXPECT_GT(length, 0U);
   brillo::Blob hash_blob;
-  EXPECT_TRUE(HashCalculator::RawHashOfBytes(data_blob.data(),
-                                             data_blob.size(),
-                                             &hash_blob));
+  EXPECT_TRUE(HashCalculator::RawHashOfBytes(
+      data_blob.data(), data_blob.size(), &hash_blob));
   EXPECT_TRUE(PayloadSigner::SignHashWithKeys(
-      hash_blob,
-      private_keys,
-      out_signature_blob));
+      hash_blob, private_keys, out_signature_blob));
   EXPECT_EQ(length, out_signature_blob->size());
 }
 }  // namespace
@@ -134,8 +118,8 @@
 
   // Check the signature itself
   Signatures signatures;
-  EXPECT_TRUE(signatures.ParseFromArray(signature_blob.data(),
-                                        signature_blob.size()));
+  EXPECT_TRUE(
+      signatures.ParseFromArray(signature_blob.data(), signature_blob.size()));
   EXPECT_EQ(1, signatures.signatures_size());
   const Signatures_Signature& signature = signatures.signatures(0);
   EXPECT_EQ(1U, signature.version());
diff --git a/payload_generator/raw_filesystem.cc b/payload_generator/raw_filesystem.cc
index 2fb1400..f1f0890 100644
--- a/payload_generator/raw_filesystem.cc
+++ b/payload_generator/raw_filesystem.cc
@@ -16,6 +16,8 @@
 
 #include "update_engine/payload_generator/raw_filesystem.h"
 
+#include <memory>
+
 #include "update_engine/common/utils.h"
 #include "update_engine/payload_generator/extent_ranges.h"
 #include "update_engine/update_metadata.pb.h"
@@ -24,8 +26,9 @@
 
 namespace chromeos_update_engine {
 
-unique_ptr<RawFilesystem> RawFilesystem::Create(
-      const std::string& filename, uint64_t block_size, uint64_t block_count) {
+unique_ptr<RawFilesystem> RawFilesystem::Create(const std::string& filename,
+                                                uint64_t block_size,
+                                                uint64_t block_count) {
   unique_ptr<RawFilesystem> result(new RawFilesystem());
   result->filename_ = filename;
   result->block_size_ = block_size;
@@ -45,7 +48,7 @@
   files->clear();
   File file;
   file.name = filename_;
-  file.extents = { ExtentForRange(0, block_count_) };
+  file.extents = {ExtentForRange(0, block_count_)};
   files->push_back(file);
   return true;
 }
diff --git a/payload_generator/raw_filesystem.h b/payload_generator/raw_filesystem.h
index 0aecd81..0ecbc9c 100644
--- a/payload_generator/raw_filesystem.h
+++ b/payload_generator/raw_filesystem.h
@@ -22,6 +22,7 @@
 
 #include "update_engine/payload_generator/filesystem_interface.h"
 
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -29,8 +30,9 @@
 
 class RawFilesystem : public FilesystemInterface {
  public:
-  static std::unique_ptr<RawFilesystem> Create(
-      const std::string& filename, uint64_t block_size, uint64_t block_count);
+  static std::unique_ptr<RawFilesystem> Create(const std::string& filename,
+                                               uint64_t block_size,
+                                               uint64_t block_count);
   virtual ~RawFilesystem() = default;
 
   // FilesystemInterface overrides.
diff --git a/payload_generator/tarjan.cc b/payload_generator/tarjan.cc
index d99ae12..2d4ca31 100644
--- a/payload_generator/tarjan.cc
+++ b/payload_generator/tarjan.cc
@@ -52,15 +52,16 @@
   index_++;
   stack_.push_back(vertex);
   for (Vertex::EdgeMap::iterator it = (*graph)[vertex].out_edges.begin();
-       it != (*graph)[vertex].out_edges.end(); ++it) {
+       it != (*graph)[vertex].out_edges.end();
+       ++it) {
     Vertex::Index vertex_next = it->first;
     if ((*graph)[vertex_next].index == kInvalidIndex) {
       Tarjan(vertex_next, graph);
-      (*graph)[vertex].lowlink = min((*graph)[vertex].lowlink,
-                                     (*graph)[vertex_next].lowlink);
+      (*graph)[vertex].lowlink =
+          min((*graph)[vertex].lowlink, (*graph)[vertex_next].lowlink);
     } else if (base::ContainsValue(stack_, vertex_next)) {
-      (*graph)[vertex].lowlink = min((*graph)[vertex].lowlink,
-                                     (*graph)[vertex_next].index);
+      (*graph)[vertex].lowlink =
+          min((*graph)[vertex].lowlink, (*graph)[vertex_next].index);
     }
   }
   if ((*graph)[vertex].lowlink == (*graph)[vertex].index) {
diff --git a/payload_generator/tarjan.h b/payload_generator/tarjan.h
index 50cf563..39ac4e4 100644
--- a/payload_generator/tarjan.h
+++ b/payload_generator/tarjan.h
@@ -38,6 +38,7 @@
   void Execute(Vertex::Index vertex,
                Graph* graph,
                std::vector<Vertex::Index>* out);
+
  private:
   void Tarjan(Vertex::Index vertex, Graph* graph);
 
diff --git a/payload_generator/topological_sort.cc b/payload_generator/topological_sort.cc
index f164336..0abd708 100644
--- a/payload_generator/topological_sort.cc
+++ b/payload_generator/topological_sort.cc
@@ -37,7 +37,8 @@
   visited_nodes->insert(node);
   // Visit all children.
   for (Vertex::EdgeMap::const_iterator it = graph[node].out_edges.begin();
-       it != graph[node].out_edges.end(); ++it) {
+       it != graph[node].out_edges.end();
+       ++it) {
     TopologicalSortVisit(graph, visited_nodes, nodes, it->first);
   }
   // Visit this node.
diff --git a/payload_generator/topological_sort_unittest.cc b/payload_generator/topological_sort_unittest.cc
index 1d866a7..aa296d8 100644
--- a/payload_generator/topological_sort_unittest.cc
+++ b/payload_generator/topological_sort_unittest.cc
@@ -33,7 +33,7 @@
 namespace {
 // Returns true if the value is found in vect. If found, the index is stored
 // in out_index if out_index is not null.
-template<typename T>
+template <typename T>
 bool IndexOf(const vector<T>& vect,
              const T& value,
              typename vector<T>::size_type* out_index) {
@@ -84,7 +84,8 @@
     vector<Vertex::Index>::size_type src_index = 0;
     EXPECT_TRUE(IndexOf(sorted, i, &src_index));
     for (Vertex::EdgeMap::const_iterator it = graph[i].out_edges.begin();
-         it != graph[i].out_edges.end(); ++it) {
+         it != graph[i].out_edges.end();
+         ++it) {
       vector<Vertex::Index>::size_type dst_index = 0;
       EXPECT_TRUE(IndexOf(sorted, it->first, &dst_index));
       EXPECT_LT(dst_index, src_index);
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 f576c6c..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,21 +169,37 @@
     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.";
     return false;
   }
 
+  // For devices that are not rollback enabled (ie. consumer devices),
+  // initialize max kernel key version to 0xfffffffe, which is logically
+  // infinity.
+  if (policy_provider_.IsConsumerDevice()) {
+    if (!hardware()->SetMaxKernelKeyRollforward(
+            chromeos_update_manager::kRollforwardInfinity)) {
+      LOG(ERROR) << "Failed to set kernel_max_rollforward to infinity for"
+                 << " consumer devices";
+    }
+  }
+
   // All is well. Initialization successful.
   return true;
 }
@@ -204,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/scripts/update_payload/applier.py b/scripts/update_payload/applier.py
index c63e156..21d8e87 100644
--- a/scripts/update_payload/applier.py
+++ b/scripts/update_payload/applier.py
@@ -586,10 +586,7 @@
       if self.minor_version == common.INPLACE_MINOR_PAYLOAD_VERSION:
         # Copy the src partition to the dst one; make sure we don't truncate it.
         shutil.copyfile(old_part_file_name, new_part_file_name)
-      elif (self.minor_version == common.SOURCE_MINOR_PAYLOAD_VERSION or
-            self.minor_version == common.OPSRCHASH_MINOR_PAYLOAD_VERSION or
-            self.minor_version == common.BROTLI_BSDIFF_MINOR_PAYLOAD_VERSION or
-            self.minor_version == common.PUFFDIFF_MINOR_PAYLOAD_VERSION):
+      elif self.minor_version >= common.SOURCE_MINOR_PAYLOAD_VERSION:
         # In minor version >= 2, we don't want to copy the partitions, so
         # instead just make the new partition file.
         open(new_part_file_name, 'w').close()
@@ -682,4 +679,3 @@
       self._ApplyToPartition(
           operations, name, '%s_install_operations' % name, new_parts[name],
           new_part_info[name], old_parts.get(name, None), old_part_info[name])
-
diff --git a/scripts/update_payload/checker.py b/scripts/update_payload/checker.py
index 15f11ae..6d17fbe 100644
--- a/scripts/update_payload/checker.py
+++ b/scripts/update_payload/checker.py
@@ -71,6 +71,7 @@
     3: (_TYPE_DELTA,),
     4: (_TYPE_DELTA,),
     5: (_TYPE_DELTA,),
+    6: (_TYPE_DELTA,),
 }
 
 _OLD_DELTA_USABLE_PART_SIZE = 2 * 1024 * 1024 * 1024
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("fake.mail@fake.com")),
-        Return(true)));
+    EXPECT_CALL(*device_policy, GetOwner(_))
+        .WillRepeatedly(DoAll(SetArgPointee<0>(string("fake.mail@fake.com")),
+                              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.gyp b/update_engine.gyp
index 2d81bed..754b314 100644
--- a/update_engine.gyp
+++ b/update_engine.gyp
@@ -404,6 +404,7 @@
         },
       },
       'sources': [
+        'common/file_fetcher.cc',
         'payload_generator/ab_generator.cc',
         'payload_generator/annotated_operation.cc',
         'payload_generator/blob_file_writer.cc',
@@ -466,7 +467,6 @@
       ],
       'sources': [
         'common/fake_prefs.cc',
-        'common/file_fetcher.cc',  # Only required for tests.
         'common/mock_http_fetcher.cc',
         'common/test_utils.cc',
         'fake_shill_proxy.cc',
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_manager/boxed_value.cc b/update_manager/boxed_value.cc
index ffbd00b..cee1ece 100644
--- a/update_manager/boxed_value.cc
+++ b/update_manager/boxed_value.cc
@@ -42,68 +42,87 @@
 // Template instantiation for common types; used in BoxedValue::ToString().
 // Keep in sync with boxed_value_unitttest.cc.
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<string>(const void* value) {
   const string* val = reinterpret_cast<const string*>(value);
   return *val;
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<int>(const void* value) {
   const int* val = reinterpret_cast<const int*>(value);
+#if BASE_VER < 576279
+  return base::IntToString(*val);
+#else
   return base::NumberToString(*val);
+#endif
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<unsigned int>(const void* value) {
   const unsigned int* val = reinterpret_cast<const unsigned int*>(value);
+#if BASE_VER < 576279
+  return base::UintToString(*val);
+#else
   return base::NumberToString(*val);
+#endif
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<int64_t>(const void* value) {
   const int64_t* val = reinterpret_cast<const int64_t*>(value);
+#if BASE_VER < 576279
+  return base::Int64ToString(*val);
+#else
   return base::NumberToString(*val);
+#endif
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<uint64_t>(const void* value) {
-  const uint64_t* val =
-    reinterpret_cast<const uint64_t*>(value);
-  return base::NumberToString(static_cast<uint64_t>(*val));
+  const uint64_t* val = reinterpret_cast<const uint64_t*>(value);
+#if BASE_VER < 576279
+  return base::Uint64ToString(*val);
+#else
+  return base::NumberToString(*val);
+#endif
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<bool>(const void* value) {
   const bool* val = reinterpret_cast<const bool*>(value);
   return *val ? "true" : "false";
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<double>(const void* value) {
   const double* val = reinterpret_cast<const double*>(value);
+#if BASE_VER < 576279
+  return base::DoubleToString(*val);
+#else
   return base::NumberToString(*val);
+#endif
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<base::Time>(const void* value) {
   const base::Time* val = reinterpret_cast<const base::Time*>(value);
   return chromeos_update_engine::utils::ToString(*val);
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<base::TimeDelta>(const void* value) {
   const base::TimeDelta* val = reinterpret_cast<const base::TimeDelta*>(value);
   return chromeos_update_engine::utils::FormatTimeDelta(*val);
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<ConnectionType>(const void* value) {
   const ConnectionType* val = reinterpret_cast<const ConnectionType*>(value);
   return StringForConnectionType(*val);
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<set<ConnectionType>>(const void* value) {
   string ret = "";
   const set<ConnectionType>* val =
@@ -117,7 +136,7 @@
   return ret;
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<ConnectionTethering>(const void* value) {
   const ConnectionTethering* val =
       reinterpret_cast<const ConnectionTethering*>(value);
@@ -158,7 +177,7 @@
   return "Unknown";
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<Stage>(const void* value) {
   const Stage* val = reinterpret_cast<const Stage*>(value);
   switch (*val) {
@@ -185,7 +204,7 @@
   return "Unknown";
 }
 
-template<>
+template <>
 string BoxedValue::ValuePrinter<UpdateRequestStatus>(const void* value) {
   const UpdateRequestStatus* val =
       reinterpret_cast<const UpdateRequestStatus*>(value);
diff --git a/update_manager/boxed_value.h b/update_manager/boxed_value.h
index c40215e..62b4b9d 100644
--- a/update_manager/boxed_value.h
+++ b/update_manager/boxed_value.h
@@ -60,10 +60,11 @@
 
   // Creates a BoxedValue for the passed pointer |value|. The BoxedValue keeps
   // the ownership of this pointer and can't be released.
-  template<typename T>
+  template <typename T>
   explicit BoxedValue(const T* value)
-    : value_(static_cast<const void*>(value)), deleter_(ValueDeleter<T>),
-      printer_(ValuePrinter<T>) {}
+      : value_(static_cast<const void*>(value)),
+        deleter_(ValueDeleter<T>),
+        printer_(ValuePrinter<T>) {}
 
   // The move constructor takes ownership of the pointer since the semantics of
   // it allows to render the passed BoxedValue undefined. You need to use the
@@ -97,14 +98,14 @@
   }
 
   // Static method to call the destructor of the right type.
-  template<typename T>
+  template <typename T>
   static void ValueDeleter(const void* value) {
     delete reinterpret_cast<const T*>(value);
   }
 
   // Static method to print a type. See boxed_value.cc for common
   // instantiations.
-  template<typename T>
+  template <typename T>
   static std::string ValuePrinter(const void* value);
 
  private:
diff --git a/update_manager/boxed_value_unittest.cc b/update_manager/boxed_value_unittest.cc
index 212db36..2fa94ec 100644
--- a/update_manager/boxed_value_unittest.cc
+++ b/update_manager/boxed_value_unittest.cc
@@ -51,14 +51,14 @@
   ~DeleterMarker() { *marker_ = true; }
 
  private:
-  friend string BoxedValue::ValuePrinter<DeleterMarker>(const void *);
+  friend string BoxedValue::ValuePrinter<DeleterMarker>(const void*);
 
   // Pointer to the bool marker.
   bool* marker_;
 };
 
-template<>
-string BoxedValue::ValuePrinter<DeleterMarker>(const void *value) {
+template <>
+string BoxedValue::ValuePrinter<DeleterMarker>(const void* value) {
   const DeleterMarker* val = reinterpret_cast<const DeleterMarker*>(value);
   return base::StringPrintf("DeleterMarker:%s",
                             *val->marker_ ? "true" : "false");
@@ -112,8 +112,7 @@
 }
 
 TEST(UmBoxedValueTest, StringToString) {
-  EXPECT_EQ("Hej Verden!",
-            BoxedValue(new string("Hej Verden!")).ToString());
+  EXPECT_EQ("Hej Verden!", BoxedValue(new string("Hej Verden!")).ToString());
 }
 
 TEST(UmBoxedValueTest, IntToString) {
@@ -122,8 +121,8 @@
 
 TEST(UmBoxedValueTest, Int64ToString) {
   // -123456789012345 doesn't fit in 32-bit integers.
-  EXPECT_EQ("-123456789012345", BoxedValue(
-      new int64_t(-123456789012345LL)).ToString());
+  EXPECT_EQ("-123456789012345",
+            BoxedValue(new int64_t(-123456789012345LL)).ToString());
 }
 
 TEST(UmBoxedValueTest, UnsignedIntToString) {
@@ -134,8 +133,8 @@
 
 TEST(UmBoxedValueTest, UnsignedInt64ToString) {
   // 18446744073709551615 is the biggest possible 64-bit unsigned integer.
-  EXPECT_EQ("18446744073709551615", BoxedValue(
-      new uint64_t(18446744073709551615ULL)).ToString());
+  EXPECT_EQ("18446744073709551615",
+            BoxedValue(new uint64_t(18446744073709551615ULL)).ToString());
 }
 
 TEST(UmBoxedValueTest, BoolToString) {
@@ -155,46 +154,47 @@
 
 TEST(UmBoxedValueTest, TimeDeltaToString) {
   // 12345 seconds is 3 hours, 25 minutes and 45 seconds.
-  EXPECT_EQ("3h25m45s",
-            BoxedValue(new TimeDelta(TimeDelta::FromSeconds(12345)))
-            .ToString());
+  EXPECT_EQ(
+      "3h25m45s",
+      BoxedValue(new TimeDelta(TimeDelta::FromSeconds(12345))).ToString());
 }
 
 TEST(UmBoxedValueTest, ConnectionTypeToString) {
   EXPECT_EQ(
       "Disconnected",
       BoxedValue(new ConnectionType(ConnectionType::kDisconnected)).ToString());
-  EXPECT_EQ("ethernet",
-            BoxedValue(new ConnectionType(ConnectionType::kEthernet))
-            .ToString());
+  EXPECT_EQ(
+      "ethernet",
+      BoxedValue(new ConnectionType(ConnectionType::kEthernet)).ToString());
   EXPECT_EQ("wifi",
             BoxedValue(new ConnectionType(ConnectionType::kWifi)).ToString());
   EXPECT_EQ("wimax",
             BoxedValue(new ConnectionType(ConnectionType::kWimax)).ToString());
-  EXPECT_EQ("bluetooth",
-            BoxedValue(new ConnectionType(ConnectionType::kBluetooth))
-            .ToString());
-  EXPECT_EQ("cellular",
-            BoxedValue(new ConnectionType(ConnectionType::kCellular))
-            .ToString());
-  EXPECT_EQ("Unknown",
-            BoxedValue(new ConnectionType(ConnectionType::kUnknown))
-            .ToString());
+  EXPECT_EQ(
+      "bluetooth",
+      BoxedValue(new ConnectionType(ConnectionType::kBluetooth)).ToString());
+  EXPECT_EQ(
+      "cellular",
+      BoxedValue(new ConnectionType(ConnectionType::kCellular)).ToString());
+  EXPECT_EQ(
+      "Unknown",
+      BoxedValue(new ConnectionType(ConnectionType::kUnknown)).ToString());
 }
 
 TEST(UmBoxedValueTest, ConnectionTetheringToString) {
-  EXPECT_EQ("Not Detected",
-            BoxedValue(new ConnectionTethering(
-                ConnectionTethering::kNotDetected)).ToString());
+  EXPECT_EQ(
+      "Not Detected",
+      BoxedValue(new ConnectionTethering(ConnectionTethering::kNotDetected))
+          .ToString());
   EXPECT_EQ("Suspected",
             BoxedValue(new ConnectionTethering(ConnectionTethering::kSuspected))
-            .ToString());
+                .ToString());
   EXPECT_EQ("Confirmed",
             BoxedValue(new ConnectionTethering(ConnectionTethering::kConfirmed))
-            .ToString());
+                .ToString());
   EXPECT_EQ("Unknown",
             BoxedValue(new ConnectionTethering(ConnectionTethering::kUnknown))
-            .ToString());
+                .ToString());
 }
 
 TEST(UmBoxedValueTest, RollbackToTargetVersionToString) {
@@ -234,18 +234,15 @@
 }
 
 TEST(UmBoxedValueTest, StageToString) {
-  EXPECT_EQ("Idle",
-            BoxedValue(new Stage(Stage::kIdle)).ToString());
+  EXPECT_EQ("Idle", BoxedValue(new Stage(Stage::kIdle)).ToString());
   EXPECT_EQ("Checking For Update",
             BoxedValue(new Stage(Stage::kCheckingForUpdate)).ToString());
   EXPECT_EQ("Update Available",
             BoxedValue(new Stage(Stage::kUpdateAvailable)).ToString());
   EXPECT_EQ("Downloading",
             BoxedValue(new Stage(Stage::kDownloading)).ToString());
-  EXPECT_EQ("Verifying",
-            BoxedValue(new Stage(Stage::kVerifying)).ToString());
-  EXPECT_EQ("Finalizing",
-            BoxedValue(new Stage(Stage::kFinalizing)).ToString());
+  EXPECT_EQ("Verifying", BoxedValue(new Stage(Stage::kVerifying)).ToString());
+  EXPECT_EQ("Finalizing", BoxedValue(new Stage(Stage::kFinalizing)).ToString());
   EXPECT_EQ("Updated, Need Reboot",
             BoxedValue(new Stage(Stage::kUpdatedNeedReboot)).ToString());
   EXPECT_EQ("Reporting Error Event",
diff --git a/update_manager/chromeos_policy.cc b/update_manager/chromeos_policy.cc
index 587ac67..bdb88f8 100644
--- a/update_manager/chromeos_policy.cc
+++ b/update_manager/chromeos_policy.cc
@@ -154,22 +154,22 @@
                 << " (" << static_cast<int>(err_code) << ")";
       return false;
 
-    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 "
                    << chromeos_update_engine::utils::ErrorCodeToString(err_code)
                    << " (" << static_cast<int>(err_code) << ")";
-    // 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.
   }
   return false;
 }
@@ -177,8 +177,8 @@
 // Checks whether |url| can be used under given download restrictions.
 bool IsUrlUsable(const string& url, bool http_allowed) {
   return http_allowed ||
-         !base::StartsWith(url, "http://",
-                           base::CompareCase::INSENSITIVE_ASCII);
+         !base::StartsWith(
+             url, "http://", base::CompareCase::INSENSITIVE_ASCII);
 }
 
 }  // namespace
@@ -198,9 +198,10 @@
 const int ChromeOSPolicy::kMaxP2PAttempts = 10;
 const int ChromeOSPolicy::kMaxP2PAttemptsPeriodInSeconds = 5 * 24 * 60 * 60;
 
-EvalStatus ChromeOSPolicy::UpdateCheckAllowed(
-    EvaluationContext* ec, State* state, string* error,
-    UpdateCheckParams* result) const {
+EvalStatus ChromeOSPolicy::UpdateCheckAllowed(EvaluationContext* ec,
+                                              State* state,
+                                              string* error,
+                                              UpdateCheckParams* result) const {
   // Set the default return values.
   result->updates_enabled = true;
   result->target_channel.clear();
@@ -343,8 +344,8 @@
   bool is_scattering_active = false;
   EvalStatus scattering_status = EvalStatus::kSucceeded;
 
-  const bool* device_policy_is_loaded_p = ec->GetValue(
-      dp_provider->var_device_policy_is_loaded());
+  const bool* device_policy_is_loaded_p =
+      ec->GetValue(dp_provider->var_device_policy_is_loaded());
   if (device_policy_is_loaded_p && *device_policy_is_loaded_p) {
     // Check whether scattering applies to this update attempt. We should not be
     // scattering if this is an interactive update check, or if OOBE is enabled
@@ -358,13 +359,13 @@
     result->scatter_wait_period = kZeroInterval;
     result->scatter_check_threshold = 0;
     if (!update_state.interactive) {
-      const bool* is_oobe_enabled_p = ec->GetValue(
-          state->config_provider()->var_is_oobe_enabled());
+      const bool* is_oobe_enabled_p =
+          ec->GetValue(state->config_provider()->var_is_oobe_enabled());
       if (is_oobe_enabled_p && !(*is_oobe_enabled_p)) {
         is_scattering_applicable = true;
       } else {
-        const bool* is_oobe_complete_p = ec->GetValue(
-            state->system_provider()->var_is_oobe_complete());
+        const bool* is_oobe_complete_p =
+            ec->GetValue(state->system_provider()->var_is_oobe_complete());
         is_scattering_applicable = (is_oobe_complete_p && *is_oobe_complete_p);
       }
     }
@@ -372,8 +373,8 @@
     // Compute scattering values.
     if (is_scattering_applicable) {
       UpdateScatteringResult scatter_result;
-      scattering_status = UpdateScattering(ec, state, error, &scatter_result,
-                                           update_state);
+      scattering_status =
+          UpdateScattering(ec, state, error, &scatter_result, update_state);
       if (scattering_status == EvalStatus::kFailed) {
         return EvalStatus::kFailed;
       } else {
@@ -461,22 +462,21 @@
 // updates over a cellular network (disabled by default). We may want to
 // revisit this semantics, allowing greater flexibility in defining specific
 // permissions over all types of networks.
-EvalStatus ChromeOSPolicy::UpdateDownloadAllowed(
-    EvaluationContext* ec,
-    State* state,
-    string* error,
-    bool* result) const {
+EvalStatus ChromeOSPolicy::UpdateDownloadAllowed(EvaluationContext* ec,
+                                                 State* state,
+                                                 string* error,
+                                                 bool* result) const {
   // Get the current connection type.
   ShillProvider* const shill_provider = state->shill_provider();
-  const ConnectionType* conn_type_p = ec->GetValue(
-      shill_provider->var_conn_type());
+  const ConnectionType* conn_type_p =
+      ec->GetValue(shill_provider->var_conn_type());
   POLICY_CHECK_VALUE_AND_FAIL(conn_type_p, error);
   ConnectionType conn_type = *conn_type_p;
 
   // If we're tethering, treat it as a cellular connection.
   if (conn_type != ConnectionType::kCellular) {
-    const ConnectionTethering* conn_tethering_p = ec->GetValue(
-        shill_provider->var_conn_tethering());
+    const ConnectionTethering* conn_tethering_p =
+        ec->GetValue(shill_provider->var_conn_tethering());
     POLICY_CHECK_VALUE_AND_FAIL(conn_tethering_p, error);
     if (*conn_tethering_p == ConnectionTethering::kConfirmed)
       conn_type = ConnectionType::kCellular;
@@ -513,11 +513,11 @@
   // Check whether the device policy specifically allows this connection.
   if (device_policy_can_override) {
     DevicePolicyProvider* const dp_provider = state->device_policy_provider();
-    const bool* device_policy_is_loaded_p = ec->GetValue(
-        dp_provider->var_device_policy_is_loaded());
+    const bool* device_policy_is_loaded_p =
+        ec->GetValue(dp_provider->var_device_policy_is_loaded());
     if (device_policy_is_loaded_p && *device_policy_is_loaded_p) {
-      const set<ConnectionType>* allowed_conn_types_p = ec->GetValue(
-          dp_provider->var_allowed_connection_types_for_update());
+      const set<ConnectionType>* allowed_conn_types_p =
+          ec->GetValue(dp_provider->var_allowed_connection_types_for_update());
       if (allowed_conn_types_p) {
         if (allowed_conn_types_p->count(conn_type)) {
           *result = true;
@@ -526,8 +526,8 @@
       } else if (conn_type == ConnectionType::kCellular) {
         // Local user settings can allow updates over cellular iff a policy was
         // loaded but no allowed connections were specified in it.
-        const bool* update_over_cellular_allowed_p = ec->GetValue(
-            state->updater_provider()->var_cellular_enabled());
+        const bool* update_over_cellular_allowed_p =
+            ec->GetValue(state->updater_provider()->var_cellular_enabled());
         if (update_over_cellular_allowed_p && *update_over_cellular_allowed_p)
           *result = true;
       }
@@ -547,11 +547,11 @@
   // explicitly allowed, we allow it if the device is enterprise enrolled (that
   // is, missing or empty owner string).
   DevicePolicyProvider* const dp_provider = state->device_policy_provider();
-  const bool* device_policy_is_loaded_p = ec->GetValue(
-      dp_provider->var_device_policy_is_loaded());
+  const bool* device_policy_is_loaded_p =
+      ec->GetValue(dp_provider->var_device_policy_is_loaded());
   if (device_policy_is_loaded_p && *device_policy_is_loaded_p) {
-    const bool* policy_au_p2p_enabled_p = ec->GetValue(
-        dp_provider->var_au_p2p_enabled());
+    const bool* policy_au_p2p_enabled_p =
+        ec->GetValue(dp_provider->var_au_p2p_enabled());
     if (policy_au_p2p_enabled_p) {
       enabled = *policy_au_p2p_enabled_p;
     } else {
@@ -564,8 +564,8 @@
   // Enable P2P, if so mandated by the updater configuration. This is additive
   // to whether or not P2P is enabled by device policy.
   if (!enabled) {
-    const bool* updater_p2p_enabled_p = ec->GetValue(
-        state->updater_provider()->var_p2p_enabled());
+    const bool* updater_p2p_enabled_p =
+        ec->GetValue(state->updater_provider()->var_p2p_enabled());
     enabled = updater_p2p_enabled_p && *updater_p2p_enabled_p;
   }
 
@@ -585,7 +585,9 @@
 }
 
 EvalStatus ChromeOSPolicy::UpdateBackoffAndDownloadUrl(
-    EvaluationContext* ec, State* state, string* error,
+    EvaluationContext* ec,
+    State* state,
+    string* error,
     UpdateBackoffAndDownloadUrlResult* result,
     const UpdateState& update_state) const {
   // Sanity checks.
@@ -597,8 +599,8 @@
   result->url_idx = -1;
   result->url_num_errors = 0;
 
-  const bool* is_official_build_p = ec->GetValue(
-      state->system_provider()->var_is_official_build());
+  const bool* is_official_build_p =
+      ec->GetValue(state->system_provider()->var_is_official_build());
   bool is_official_build = (is_official_build_p ? *is_official_build_p : true);
 
   // Check whether backoff is enabled.
@@ -627,11 +629,11 @@
   bool http_allowed = true;
   if (is_official_build) {
     DevicePolicyProvider* const dp_provider = state->device_policy_provider();
-    const bool* device_policy_is_loaded_p = ec->GetValue(
-        dp_provider->var_device_policy_is_loaded());
+    const bool* device_policy_is_loaded_p =
+        ec->GetValue(dp_provider->var_device_policy_is_loaded());
     if (device_policy_is_loaded_p && *device_policy_is_loaded_p) {
-      const bool* policy_http_downloads_enabled_p = ec->GetValue(
-          dp_provider->var_http_downloads_enabled());
+      const bool* policy_http_downloads_enabled_p =
+          ec->GetValue(dp_provider->var_http_downloads_enabled());
       http_allowed = (!policy_http_downloads_enabled_p ||
                       *policy_http_downloads_enabled_p);
     }
@@ -753,8 +755,8 @@
     const uint64_t* seed = ec->GetValue(state->random_provider()->var_seed());
     POLICY_CHECK_VALUE_AND_FAIL(seed, error);
     PRNG prng(*seed);
-    int exp = min(update_state.num_failures,
-                       static_cast<int>(sizeof(int)) * 8 - 2);
+    int exp =
+        min(update_state.num_failures, static_cast<int>(sizeof(int)) * 8 - 2);
     TimeDelta backoff_interval = TimeDelta::FromDays(min(
         1 << exp,
         kNextUpdateCheckPolicyConstants.attempt_backoff_max_interval_in_days));
@@ -794,14 +796,14 @@
   DevicePolicyProvider* const dp_provider = state->device_policy_provider();
 
   // Ensure that a device policy is loaded.
-  const bool* device_policy_is_loaded_p = ec->GetValue(
-      dp_provider->var_device_policy_is_loaded());
+  const bool* device_policy_is_loaded_p =
+      ec->GetValue(dp_provider->var_device_policy_is_loaded());
   if (!(device_policy_is_loaded_p && *device_policy_is_loaded_p))
     return EvalStatus::kSucceeded;
 
   // Is scattering enabled by policy?
-  const TimeDelta* scatter_factor_p = ec->GetValue(
-      dp_provider->var_scatter_factor());
+  const TimeDelta* scatter_factor_p =
+      ec->GetValue(dp_provider->var_scatter_factor());
   if (!scatter_factor_p || *scatter_factor_p == kZeroInterval)
     return EvalStatus::kSucceeded;
 
@@ -833,9 +835,8 @@
   // one.
   int check_threshold = update_state.scatter_check_threshold;
   if (check_threshold == 0) {
-    check_threshold = prng.RandMinMax(
-        update_state.scatter_check_threshold_min,
-        update_state.scatter_check_threshold_max);
+    check_threshold = prng.RandMinMax(update_state.scatter_check_threshold_min,
+                                      update_state.scatter_check_threshold_max);
   }
 
   // If the update check threshold is not within allowed range then nullify it.
diff --git a/update_manager/chromeos_policy.h b/update_manager/chromeos_policy.h
index d4ce4a6..ded5164 100644
--- a/update_manager/chromeos_policy.h
+++ b/update_manager/chromeos_policy.h
@@ -54,9 +54,10 @@
   ~ChromeOSPolicy() override {}
 
   // Policy overrides.
-  EvalStatus UpdateCheckAllowed(
-      EvaluationContext* ec, State* state, std::string* error,
-      UpdateCheckParams* result) const override;
+  EvalStatus UpdateCheckAllowed(EvaluationContext* ec,
+                                State* state,
+                                std::string* error,
+                                UpdateCheckParams* result) const override;
 
   EvalStatus UpdateCanBeApplied(
       EvaluationContext* ec,
@@ -65,31 +66,27 @@
       chromeos_update_engine::ErrorCode* result,
       chromeos_update_engine::InstallPlan* install_plan) const override;
 
-  EvalStatus UpdateCanStart(
-      EvaluationContext* ec,
-      State* state,
-      std::string* error,
-      UpdateDownloadParams* result,
-      UpdateState update_state) const override;
+  EvalStatus UpdateCanStart(EvaluationContext* ec,
+                            State* state,
+                            std::string* error,
+                            UpdateDownloadParams* result,
+                            UpdateState update_state) const override;
 
-  EvalStatus UpdateDownloadAllowed(
-      EvaluationContext* ec,
-      State* state,
-      std::string* error,
-      bool* result) const override;
+  EvalStatus UpdateDownloadAllowed(EvaluationContext* ec,
+                                   State* state,
+                                   std::string* error,
+                                   bool* result) const override;
 
-  EvalStatus P2PEnabled(
-      EvaluationContext* ec,
-      State* state,
-      std::string* error,
-      bool* result) const override;
+  EvalStatus P2PEnabled(EvaluationContext* ec,
+                        State* state,
+                        std::string* error,
+                        bool* result) const override;
 
-  EvalStatus P2PEnabledChanged(
-      EvaluationContext* ec,
-      State* state,
-      std::string* error,
-      bool* result,
-      bool prev_result) const override;
+  EvalStatus P2PEnabledChanged(EvaluationContext* ec,
+                               State* state,
+                               std::string* error,
+                               bool* result,
+                               bool prev_result) const override;
 
  protected:
   // Policy override.
@@ -151,7 +148,9 @@
   // In any of these cases, returns |EvalStatus::kSucceeded|. If an error
   // occurred, returns |EvalStatus::kFailed|.
   EvalStatus UpdateBackoffAndDownloadUrl(
-      EvaluationContext* ec, State* state, std::string* error,
+      EvaluationContext* ec,
+      State* state,
+      std::string* error,
       UpdateBackoffAndDownloadUrlResult* result,
       const UpdateState& update_state) const;
 
@@ -167,7 +166,8 @@
   // threshold, or zero if no such threshold is known. If not scattering, or if
   // any of the scattering values has changed, returns |EvalStatus::kSucceeded|;
   // otherwise, |EvalStatus::kAskMeAgainLater|.
-  EvalStatus UpdateScattering(EvaluationContext* ec, State* state,
+  EvalStatus UpdateScattering(EvaluationContext* ec,
+                              State* state,
                               std::string* error,
                               UpdateScatteringResult* result,
                               const UpdateState& update_state) const;
diff --git a/update_manager/chromeos_policy_unittest.cc b/update_manager/chromeos_policy_unittest.cc
index 15bb09f..5341ebb 100644
--- a/update_manager/chromeos_policy_unittest.cc
+++ b/update_manager/chromeos_policy_unittest.cc
@@ -49,8 +49,7 @@
     UmPolicyTestBase::SetUpDefaultState();
 
     // OOBE is enabled by default.
-    fake_state_.config_provider()->var_is_oobe_enabled()->reset(
-        new bool(true));
+    fake_state_.config_provider()->var_is_oobe_enabled()->reset(new bool(true));
 
     // For the purpose of the tests, this is an official build and OOBE was
     // completed.
@@ -62,10 +61,10 @@
     fake_state_.system_provider()->var_num_slots()->reset(new unsigned int(2));
 
     // Connection is wifi, untethered.
-    fake_state_.shill_provider()->var_conn_type()->
-        reset(new ConnectionType(ConnectionType::kWifi));
-    fake_state_.shill_provider()->var_conn_tethering()->
-        reset(new ConnectionTethering(ConnectionTethering::kNotDetected));
+    fake_state_.shill_provider()->var_conn_type()->reset(
+        new ConnectionType(ConnectionType::kWifi));
+    fake_state_.shill_provider()->var_conn_tethering()->reset(
+        new ConnectionTethering(ConnectionTethering::kNotDetected));
   }
 
   // Sets up a default device policy that does not impose any restrictions
@@ -75,16 +74,18 @@
         new bool(true));
     fake_state_.device_policy_provider()->var_update_disabled()->reset(
         new bool(false));
-    fake_state_.device_policy_provider()->
-        var_allowed_connection_types_for_update()->reset(nullptr);
+    fake_state_.device_policy_provider()
+        ->var_allowed_connection_types_for_update()
+        ->reset(nullptr);
     fake_state_.device_policy_provider()->var_scatter_factor()->reset(
         new TimeDelta());
     fake_state_.device_policy_provider()->var_http_downloads_enabled()->reset(
         new bool(true));
     fake_state_.device_policy_provider()->var_au_p2p_enabled()->reset(
         new bool(false));
-    fake_state_.device_policy_provider()->var_release_channel_delegated()->
-        reset(new bool(true));
+    fake_state_.device_policy_provider()
+        ->var_release_channel_delegated()
+        ->reset(new bool(true));
     fake_state_.device_policy_provider()
         ->var_disallowed_time_intervals()
         ->reset(new WeeklyTimeIntervalVector());
@@ -195,16 +196,16 @@
   fake_state_.updater_provider()->var_last_checked_time()->reset(
       new Time(last_checked_time));
   fake_clock_.SetWallclockTime(next_update_check - TimeDelta::FromSeconds(1));
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kAskMeAgainLater, &Policy::UpdateCheckAllowed, &result);
 
   SetUpDefaultClock();
   SetUpDefaultState();
   fake_state_.updater_provider()->var_last_checked_time()->reset(
       new Time(last_checked_time));
   fake_clock_.SetWallclockTime(next_update_check + TimeDelta::FromSeconds(1));
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCheckAllowed, &result);
   EXPECT_TRUE(result.updates_enabled);
   EXPECT_FALSE(result.interactive);
 }
@@ -228,12 +229,11 @@
   fake_state_.updater_provider()->var_last_checked_time()->reset(
       new Time(last_checked_time));
   fake_clock_.SetWallclockTime(next_update_check + TimeDelta::FromSeconds(1));
-  fake_state_.system_provider()->var_is_oobe_complete()->reset(
-      new bool(false));
+  fake_state_.system_provider()->var_is_oobe_complete()->reset(new bool(false));
 
   UpdateCheckParams result;
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kAskMeAgainLater, &Policy::UpdateCheckAllowed, &result);
 
   // Now check that it is allowed if OOBE is completed.
   SetUpDefaultClock();
@@ -241,8 +241,8 @@
   fake_state_.updater_provider()->var_last_checked_time()->reset(
       new Time(last_checked_time));
   fake_clock_.SetWallclockTime(next_update_check + TimeDelta::FromSeconds(1));
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCheckAllowed, &result);
   EXPECT_TRUE(result.updates_enabled);
   EXPECT_FALSE(result.interactive);
 }
@@ -253,19 +253,19 @@
   SetUpdateCheckAllowed(true);
 
   // Override specific device policy attributes.
-  fake_state_.device_policy_provider()->var_target_version_prefix()->
-      reset(new string("1.2"));
+  fake_state_.device_policy_provider()->var_target_version_prefix()->reset(
+      new string("1.2"));
   fake_state_.device_policy_provider()
       ->var_rollback_allowed_milestones()
       ->reset(new int(5));
   fake_state_.device_policy_provider()->var_release_channel_delegated()->reset(
       new bool(false));
-  fake_state_.device_policy_provider()->var_release_channel()->
-      reset(new string("foo-channel"));
+  fake_state_.device_policy_provider()->var_release_channel()->reset(
+      new string("foo-channel"));
 
   UpdateCheckParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCheckAllowed, &result);
   EXPECT_TRUE(result.updates_enabled);
   EXPECT_EQ("1.2", result.target_version_prefix);
   EXPECT_EQ(5, result.rollback_allowed_milestones);
@@ -340,8 +340,8 @@
       new bool(false));
 
   UpdateCheckParams result;
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kAskMeAgainLater, &Policy::UpdateCheckAllowed, &result);
 }
 
 TEST_F(UmChromeOSPolicyTest,
@@ -353,8 +353,8 @@
   fake_state_.system_provider()->var_num_slots()->reset(new unsigned int(1));
 
   UpdateCheckParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCheckAllowed, &result);
   EXPECT_FALSE(result.updates_enabled);
 }
 
@@ -367,8 +367,8 @@
       new bool(true));
 
   UpdateCheckParams result;
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kAskMeAgainLater, &Policy::UpdateCheckAllowed, &result);
 }
 
 TEST_F(UmChromeOSPolicyTest,
@@ -381,8 +381,8 @@
       new UpdateRequestStatus(UpdateRequestStatus::kInteractive));
 
   UpdateCheckParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCheckAllowed, &result);
   EXPECT_TRUE(result.updates_enabled);
   EXPECT_TRUE(result.interactive);
 }
@@ -396,8 +396,8 @@
       new UpdateRequestStatus(UpdateRequestStatus::kPeriodic));
 
   UpdateCheckParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCheckAllowed, &result);
   EXPECT_TRUE(result.updates_enabled);
   EXPECT_FALSE(result.interactive);
 }
@@ -409,8 +409,8 @@
   SetKioskAppControlsChromeOsVersion();
 
   UpdateCheckParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCheckAllowed, &result);
   EXPECT_TRUE(result.updates_enabled);
   EXPECT_EQ("1234.", result.target_version_prefix);
   EXPECT_FALSE(result.interactive);
@@ -429,8 +429,8 @@
       ->reset(new bool(false));
 
   UpdateCheckParams result;
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kAskMeAgainLater, &Policy::UpdateCheckAllowed, &result);
 }
 
 TEST_F(UmChromeOSPolicyTest, UpdateCheckAllowedKioskPinWithNoRequiredVersion) {
@@ -449,8 +449,8 @@
       new string());
 
   UpdateCheckParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCheckAllowed, &result);
   EXPECT_TRUE(result.updates_enabled);
   EXPECT_TRUE(result.target_version_prefix.empty());
   EXPECT_FALSE(result.interactive);
@@ -469,8 +469,8 @@
       nullptr);
 
   UpdateCheckParams result;
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater,
-                     &Policy::UpdateCheckAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kAskMeAgainLater, &Policy::UpdateCheckAllowed, &result);
 }
 
 TEST_F(UmChromeOSPolicyTest, UpdateCanStartFailsCheckAllowedError) {
@@ -483,8 +483,8 @@
   // Check that the UpdateCanStart fails.
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kFailed,
-                     &Policy::UpdateCanStart, &result, update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kFailed, &Policy::UpdateCanStart, &result, update_state);
 }
 
 TEST_F(UmChromeOSPolicyTest, UpdateCanStartNotAllowedCheckDue) {
@@ -496,8 +496,8 @@
   // Check that the UpdateCanStart returns false.
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCanStart, &result, update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_FALSE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kCheckDue, result.cannot_start_reason);
   EXPECT_EQ(0, result.download_url_idx);
@@ -514,8 +514,8 @@
   // Check that the UpdateCanStart returns true with no further attributes.
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCanStart, &result, update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_FALSE(result.p2p_downloading_allowed);
   EXPECT_FALSE(result.p2p_sharing_allowed);
@@ -534,8 +534,8 @@
   // Check that the UpdateCanStart returns true.
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCanStart, &result, update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_FALSE(result.p2p_downloading_allowed);
   EXPECT_FALSE(result.p2p_sharing_allowed);
@@ -556,17 +556,19 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(8));
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(2));
 
   // Check that UpdateCanStart returns false and a new backoff expiry is
   // generated.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_FALSE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kBackoff, result.cannot_start_reason);
   EXPECT_TRUE(result.do_increment_failures);
@@ -584,10 +586,12 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(8));
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(2));
   update_state.failures_last_updated = curr_time;
   update_state.backoff_expiry = curr_time + TimeDelta::FromMinutes(3);
@@ -595,8 +599,10 @@
   // Check that UpdateCanStart returns false and a new backoff expiry is
   // generated.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater, &Policy::UpdateCanStart,
-                     &result, update_state);
+  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater,
+                     &Policy::UpdateCanStart,
+                     &result,
+                     update_state);
   EXPECT_FALSE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kBackoff, result.cannot_start_reason);
   EXPECT_FALSE(result.do_increment_failures);
@@ -613,10 +619,12 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(8));
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(2));
   update_state.failures_last_updated = curr_time - TimeDelta::FromSeconds(1);
   update_state.backoff_expiry = curr_time - TimeDelta::FromSeconds(1);
@@ -624,8 +632,8 @@
   // Check that UpdateCanStart returns false and a new backoff expiry is
   // generated.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart,
-                     &result, update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kUndefined, result.cannot_start_reason);
   EXPECT_EQ(0, result.download_url_idx);
@@ -645,18 +653,20 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(8));
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(2));
   update_state.is_backoff_disabled = true;
 
   // Check that UpdateCanStart returns false and a new backoff expiry is
   // generated.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kUndefined, result.cannot_start_reason);
   EXPECT_EQ(0, result.download_url_idx);
@@ -676,18 +686,20 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(8));
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(2));
   update_state.interactive = true;
 
   // Check that UpdateCanStart returns false and a new backoff expiry is
   // generated.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kUndefined, result.cannot_start_reason);
   EXPECT_EQ(0, result.download_url_idx);
@@ -707,18 +719,20 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(8));
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(2));
   update_state.is_delta_payload = true;
 
   // Check that UpdateCanStart returns false and a new backoff expiry is
   // generated.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kUndefined, result.cannot_start_reason);
   EXPECT_EQ(0, result.download_url_idx);
@@ -738,20 +752,22 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(8));
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(2));
 
-  fake_state_.system_provider()->var_is_official_build()->
-      reset(new bool(false));
+  fake_state_.system_provider()->var_is_official_build()->reset(
+      new bool(false));
 
   // Check that UpdateCanStart returns false and a new backoff expiry is
   // generated.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kUndefined, result.cannot_start_reason);
   EXPECT_EQ(0, result.download_url_idx);
@@ -777,8 +793,8 @@
   // Check that the UpdateCanStart fails.
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(1));
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kFailed,
-                     &Policy::UpdateCanStart, &result, update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kFailed, &Policy::UpdateCanStart, &result, update_state);
 }
 
 TEST_F(UmChromeOSPolicyTest,
@@ -791,14 +807,13 @@
   fake_state_.device_policy_provider()->var_scatter_factor()->reset(
       new TimeDelta(TimeDelta::FromMinutes(2)));
 
-
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(1));
 
   // Check that the UpdateCanStart returns false and a new wait period
   // generated.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_FALSE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kScattering, result.cannot_start_reason);
   EXPECT_LT(TimeDelta(), result.scatter_wait_period);
@@ -821,8 +836,10 @@
   // Check that the UpdateCanStart returns false and a new wait period
   // generated.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater, &Policy::UpdateCanStart,
-                     &result, update_state);
+  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater,
+                     &Policy::UpdateCanStart,
+                     &result,
+                     update_state);
   EXPECT_FALSE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kScattering, result.cannot_start_reason);
   EXPECT_EQ(TimeDelta::FromSeconds(35), result.scatter_wait_period);
@@ -847,8 +864,8 @@
 
   // Check that the UpdateCanStart returns false.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_FALSE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kScattering, result.cannot_start_reason);
   EXPECT_LE(2, result.scatter_check_threshold);
@@ -871,8 +888,8 @@
 
   // Check that the UpdateCanStart returns false.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_FALSE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kScattering, result.cannot_start_reason);
   EXPECT_EQ(3, result.scatter_check_threshold);
@@ -896,8 +913,8 @@
 
   // Check that the UpdateCanStart returns true.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(TimeDelta(), result.scatter_wait_period);
   EXPECT_EQ(0, result.scatter_check_threshold);
@@ -925,8 +942,8 @@
 
   // Check that the UpdateCanStart returns true.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(TimeDelta(), result.scatter_wait_period);
   EXPECT_EQ(0, result.scatter_check_threshold);
@@ -936,8 +953,7 @@
   EXPECT_FALSE(result.do_increment_failures);
 }
 
-TEST_F(UmChromeOSPolicyTest,
-       UpdateCanStartAllowedOobePreventsScattering) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartAllowedOobePreventsScattering) {
   // The UpdateCanStart policy returns true; device policy is loaded and
   // scattering would have applied, except that OOBE was not completed and so it
   // is suppressed.
@@ -955,8 +971,8 @@
 
   // Check that the UpdateCanStart returns true.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(TimeDelta(), result.scatter_wait_period);
   EXPECT_EQ(0, result.scatter_check_threshold);
@@ -981,8 +997,8 @@
   // Check that the UpdateCanStart returns true.
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_TRUE(result.p2p_downloading_allowed);
   EXPECT_TRUE(result.p2p_sharing_allowed);
@@ -1005,8 +1021,8 @@
   // Check that the UpdateCanStart returns true.
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_TRUE(result.p2p_downloading_allowed);
   EXPECT_TRUE(result.p2p_sharing_allowed);
@@ -1034,15 +1050,14 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   update_state.p2p_downloading_disabled = true;
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_FALSE(result.p2p_downloading_allowed);
   EXPECT_TRUE(result.p2p_sharing_allowed);
 }
 
-TEST_F(UmChromeOSPolicyTest,
-       UpdateCanStartAllowedP2PSharingBlockedDueToOmaha) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartAllowedP2PSharingBlockedDueToOmaha) {
   // The UpdateCanStart policy returns true; device policy permits HTTP, but
   // policy blocks P2P sharing because Omaha forbids it.  P2P downloading is
   // still permitted.
@@ -1059,8 +1074,8 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   update_state.p2p_sharing_disabled = true;
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_TRUE(result.p2p_downloading_allowed);
   EXPECT_FALSE(result.p2p_sharing_allowed);
@@ -1084,8 +1099,8 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   update_state.p2p_num_attempts = ChromeOSPolicy::kMaxP2PAttempts;
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_FALSE(result.p2p_downloading_allowed);
   EXPECT_TRUE(result.p2p_sharing_allowed);
@@ -1110,11 +1125,11 @@
   update_state.p2p_num_attempts = 1;
   update_state.p2p_first_attempted =
       fake_clock_.GetWallclockTime() -
-      TimeDelta::FromSeconds(
-          ChromeOSPolicy::kMaxP2PAttemptsPeriodInSeconds + 1);
+      TimeDelta::FromSeconds(ChromeOSPolicy::kMaxP2PAttemptsPeriodInSeconds +
+                             1);
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_FALSE(result.p2p_downloading_allowed);
   EXPECT_TRUE(result.p2p_sharing_allowed);
@@ -1131,14 +1146,14 @@
   // Override specific device policy attributes.
   fake_state_.device_policy_provider()->var_http_downloads_enabled()->reset(
       new bool(false));
-  fake_state_.system_provider()->var_is_official_build()->
-      reset(new bool(false));
+  fake_state_.system_provider()->var_is_official_build()->reset(
+      new bool(false));
 
   // Check that the UpdateCanStart returns true.
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(0, result.download_url_idx);
   EXPECT_TRUE(result.download_url_allowed);
@@ -1162,8 +1177,8 @@
 
   // Check that the UpdateCanStart returns true.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(1, result.download_url_idx);
   EXPECT_TRUE(result.download_url_allowed);
@@ -1192,8 +1207,8 @@
 
   // Check that the UpdateCanStart returns true.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(0, result.download_url_idx);
   EXPECT_TRUE(result.download_url_allowed);
@@ -1221,8 +1236,8 @@
 
   // Check that the UpdateCanStart returns true.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(1, result.download_url_idx);
   EXPECT_TRUE(result.download_url_allowed);
@@ -1242,13 +1257,14 @@
   update_state.num_checks = 10;
   update_state.download_urls.emplace_back("http://another/fake/url/");
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kPayloadHashMismatchError,
+      0,
+      ErrorCode::kPayloadHashMismatchError,
       fake_clock_.GetWallclockTime() - TimeDelta::FromSeconds(1));
 
   // Check that the UpdateCanStart returns true.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(1, result.download_url_idx);
   EXPECT_TRUE(result.download_url_allowed);
@@ -1270,13 +1286,14 @@
   update_state.is_backoff_disabled = true;
   update_state.download_urls.emplace_back("http://another/fake/url/");
   update_state.download_errors.emplace_back(
-      1, ErrorCode::kPayloadHashMismatchError,
+      1,
+      ErrorCode::kPayloadHashMismatchError,
       fake_clock_.GetWallclockTime() - TimeDelta::FromSeconds(1));
 
   // Check that the UpdateCanStart returns true.
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(0, result.download_url_idx);
   EXPECT_TRUE(result.download_url_allowed);
@@ -1302,8 +1319,8 @@
   // Check that the UpdateCanStart returns false.
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_FALSE(result.update_can_start);
   EXPECT_EQ(UpdateCannotStartReason::kCannotDownload,
             result.cannot_start_reason);
@@ -1329,8 +1346,8 @@
   // Check that the UpdateCanStart returns true.
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_TRUE(result.p2p_downloading_allowed);
   EXPECT_TRUE(result.p2p_sharing_allowed);
@@ -1361,8 +1378,8 @@
   // Check that the UpdateCanStart returns true.
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_TRUE(result.p2p_downloading_allowed);
   EXPECT_TRUE(result.p2p_sharing_allowed);
@@ -1375,24 +1392,24 @@
 TEST_F(UmChromeOSPolicyTest, UpdateDownloadAllowedEthernetDefault) {
   // Ethernet is always allowed.
 
-  fake_state_.shill_provider()->var_conn_type()->
-      reset(new ConnectionType(ConnectionType::kEthernet));
+  fake_state_.shill_provider()->var_conn_type()->reset(
+      new ConnectionType(ConnectionType::kEthernet));
 
   bool result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateDownloadAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateDownloadAllowed, &result);
   EXPECT_TRUE(result);
 }
 
 TEST_F(UmChromeOSPolicyTest, UpdateDownloadAllowedWifiDefault) {
   // Wifi is allowed if not tethered.
 
-  fake_state_.shill_provider()->var_conn_type()->
-      reset(new ConnectionType(ConnectionType::kWifi));
+  fake_state_.shill_provider()->var_conn_type()->reset(
+      new ConnectionType(ConnectionType::kWifi));
 
   bool result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateDownloadAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateDownloadAllowed, &result);
   EXPECT_TRUE(result);
 }
 
@@ -1400,45 +1417,44 @@
        UpdateCurrentConnectionNotAllowedWifiTetheredDefault) {
   // Tethered wifi is not allowed by default.
 
-  fake_state_.shill_provider()->var_conn_type()->
-      reset(new ConnectionType(ConnectionType::kWifi));
-  fake_state_.shill_provider()->var_conn_tethering()->
-      reset(new ConnectionTethering(ConnectionTethering::kConfirmed));
+  fake_state_.shill_provider()->var_conn_type()->reset(
+      new ConnectionType(ConnectionType::kWifi));
+  fake_state_.shill_provider()->var_conn_tethering()->reset(
+      new ConnectionTethering(ConnectionTethering::kConfirmed));
 
   bool result;
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater,
-                     &Policy::UpdateDownloadAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kAskMeAgainLater, &Policy::UpdateDownloadAllowed, &result);
 }
 
-TEST_F(UmChromeOSPolicyTest,
-       UpdateDownloadAllowedWifiTetheredPolicyOverride) {
+TEST_F(UmChromeOSPolicyTest, UpdateDownloadAllowedWifiTetheredPolicyOverride) {
   // Tethered wifi can be allowed by policy.
 
-  fake_state_.shill_provider()->var_conn_type()->
-      reset(new ConnectionType(ConnectionType::kWifi));
-  fake_state_.shill_provider()->var_conn_tethering()->
-      reset(new ConnectionTethering(ConnectionTethering::kConfirmed));
+  fake_state_.shill_provider()->var_conn_type()->reset(
+      new ConnectionType(ConnectionType::kWifi));
+  fake_state_.shill_provider()->var_conn_tethering()->reset(
+      new ConnectionTethering(ConnectionTethering::kConfirmed));
   set<ConnectionType> allowed_connections;
   allowed_connections.insert(ConnectionType::kCellular);
-  fake_state_.device_policy_provider()->
-      var_allowed_connection_types_for_update()->
-      reset(new set<ConnectionType>(allowed_connections));
+  fake_state_.device_policy_provider()
+      ->var_allowed_connection_types_for_update()
+      ->reset(new set<ConnectionType>(allowed_connections));
 
   bool result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateDownloadAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateDownloadAllowed, &result);
   EXPECT_TRUE(result);
 }
 
 TEST_F(UmChromeOSPolicyTest, UpdateDownloadAllowedWimaxDefault) {
   // Wimax is always allowed.
 
-  fake_state_.shill_provider()->var_conn_type()->
-      reset(new ConnectionType(ConnectionType::kWifi));
+  fake_state_.shill_provider()->var_conn_type()->reset(
+      new ConnectionType(ConnectionType::kWifi));
 
   bool result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateDownloadAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateDownloadAllowed, &result);
   EXPECT_TRUE(result);
 }
 
@@ -1446,80 +1462,76 @@
        UpdateCurrentConnectionNotAllowedBluetoothDefault) {
   // Bluetooth is never allowed.
 
-  fake_state_.shill_provider()->var_conn_type()->
-      reset(new ConnectionType(ConnectionType::kBluetooth));
+  fake_state_.shill_provider()->var_conn_type()->reset(
+      new ConnectionType(ConnectionType::kBluetooth));
 
   bool result;
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater,
-                     &Policy::UpdateDownloadAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kAskMeAgainLater, &Policy::UpdateDownloadAllowed, &result);
 }
 
 TEST_F(UmChromeOSPolicyTest,
        UpdateCurrentConnectionNotAllowedBluetoothPolicyCannotOverride) {
   // Bluetooth cannot be allowed even by policy.
 
-  fake_state_.shill_provider()->var_conn_type()->
-      reset(new ConnectionType(ConnectionType::kBluetooth));
+  fake_state_.shill_provider()->var_conn_type()->reset(
+      new ConnectionType(ConnectionType::kBluetooth));
   set<ConnectionType> allowed_connections;
   allowed_connections.insert(ConnectionType::kBluetooth);
-  fake_state_.device_policy_provider()->
-      var_allowed_connection_types_for_update()->
-      reset(new set<ConnectionType>(allowed_connections));
+  fake_state_.device_policy_provider()
+      ->var_allowed_connection_types_for_update()
+      ->reset(new set<ConnectionType>(allowed_connections));
 
   bool result;
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater,
-                     &Policy::UpdateDownloadAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kAskMeAgainLater, &Policy::UpdateDownloadAllowed, &result);
 }
 
 TEST_F(UmChromeOSPolicyTest, UpdateCurrentConnectionNotAllowedCellularDefault) {
   // Cellular is not allowed by default.
 
-  fake_state_.shill_provider()->var_conn_type()->
-      reset(new ConnectionType(ConnectionType::kCellular));
+  fake_state_.shill_provider()->var_conn_type()->reset(
+      new ConnectionType(ConnectionType::kCellular));
 
   bool result;
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater,
-                     &Policy::UpdateDownloadAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kAskMeAgainLater, &Policy::UpdateDownloadAllowed, &result);
 }
 
-TEST_F(UmChromeOSPolicyTest,
-       UpdateDownloadAllowedCellularPolicyOverride) {
+TEST_F(UmChromeOSPolicyTest, UpdateDownloadAllowedCellularPolicyOverride) {
   // Update over cellular can be enabled by policy.
 
-  fake_state_.shill_provider()->var_conn_type()->
-      reset(new ConnectionType(ConnectionType::kCellular));
+  fake_state_.shill_provider()->var_conn_type()->reset(
+      new ConnectionType(ConnectionType::kCellular));
   set<ConnectionType> allowed_connections;
   allowed_connections.insert(ConnectionType::kCellular);
-  fake_state_.device_policy_provider()->
-      var_allowed_connection_types_for_update()->
-      reset(new set<ConnectionType>(allowed_connections));
+  fake_state_.device_policy_provider()
+      ->var_allowed_connection_types_for_update()
+      ->reset(new set<ConnectionType>(allowed_connections));
 
   bool result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateDownloadAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateDownloadAllowed, &result);
   EXPECT_TRUE(result);
 }
 
-TEST_F(UmChromeOSPolicyTest,
-       UpdateDownloadAllowedCellularUserOverride) {
+TEST_F(UmChromeOSPolicyTest, UpdateDownloadAllowedCellularUserOverride) {
   // Update over cellular can be enabled by user settings, but only if policy
   // is present and does not determine allowed connections.
 
-  fake_state_.shill_provider()->var_conn_type()->
-      reset(new ConnectionType(ConnectionType::kCellular));
+  fake_state_.shill_provider()->var_conn_type()->reset(
+      new ConnectionType(ConnectionType::kCellular));
   set<ConnectionType> allowed_connections;
   allowed_connections.insert(ConnectionType::kCellular);
-  fake_state_.updater_provider()->var_cellular_enabled()->
-      reset(new bool(true));
+  fake_state_.updater_provider()->var_cellular_enabled()->reset(new bool(true));
 
   bool result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateDownloadAllowed, &result);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateDownloadAllowed, &result);
   EXPECT_TRUE(result);
 }
 
-TEST_F(UmChromeOSPolicyTest,
-       UpdateCanStartAllowedScatteringSupressedDueToP2P) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartAllowedScatteringSupressedDueToP2P) {
   // The UpdateCanStart policy returns true; scattering should have applied, but
   // P2P download is allowed. Scattering values are nonetheless returned, and so
   // are download URL values, albeit the latter are not allowed to be used.
@@ -1533,8 +1545,8 @@
   update_state.scatter_wait_period = TimeDelta::FromSeconds(35);
 
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart,
-                     &result, update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(0, result.download_url_idx);
   EXPECT_FALSE(result.download_url_allowed);
@@ -1546,8 +1558,7 @@
   EXPECT_EQ(0, result.scatter_check_threshold);
 }
 
-TEST_F(UmChromeOSPolicyTest,
-       UpdateCanStartAllowedBackoffSupressedDueToP2P) {
+TEST_F(UmChromeOSPolicyTest, UpdateCanStartAllowedBackoffSupressedDueToP2P) {
   // The UpdateCanStart policy returns true; backoff should have applied, but
   // P2P download is allowed. Backoff values are nonetheless returned, and so
   // are download URL values, albeit the latter are not allowed to be used.
@@ -1558,16 +1569,18 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(8));
   update_state.download_errors.emplace_back(
-      0, ErrorCode::kDownloadTransferError,
+      0,
+      ErrorCode::kDownloadTransferError,
       curr_time - TimeDelta::FromSeconds(2));
   fake_state_.updater_provider()->var_p2p_enabled()->reset(new bool(true));
 
   UpdateDownloadParams result;
-  ExpectPolicyStatus(EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result,
-                     update_state);
+  ExpectPolicyStatus(
+      EvalStatus::kSucceeded, &Policy::UpdateCanStart, &result, update_state);
   EXPECT_TRUE(result.update_can_start);
   EXPECT_EQ(0, result.download_url_idx);
   EXPECT_FALSE(result.download_url_allowed);
@@ -1612,8 +1625,8 @@
 
 TEST_F(UmChromeOSPolicyTest, P2PEnabledChangedBlocks) {
   bool result;
-  ExpectPolicyStatus(EvalStatus::kAskMeAgainLater, &Policy::P2PEnabledChanged,
-                     &result, false);
+  ExpectPolicyStatus(
+      EvalStatus::kAskMeAgainLater, &Policy::P2PEnabledChanged, &result, false);
 }
 
 TEST_F(UmChromeOSPolicyTest,
diff --git a/update_manager/default_policy.cc b/update_manager/default_policy.cc
index 5509abc..81ab795 100644
--- a/update_manager/default_policy.cc
+++ b/update_manager/default_policy.cc
@@ -34,9 +34,10 @@
 DefaultPolicy::DefaultPolicy(chromeos_update_engine::ClockInterface* clock)
     : clock_(clock), aux_state_(new DefaultPolicyState()) {}
 
-EvalStatus DefaultPolicy::UpdateCheckAllowed(
-    EvaluationContext* ec, State* state, std::string* error,
-    UpdateCheckParams* result) const {
+EvalStatus DefaultPolicy::UpdateCheckAllowed(EvaluationContext* ec,
+                                             State* state,
+                                             std::string* error,
+                                             UpdateCheckParams* result) const {
   result->updates_enabled = true;
   result->target_channel.clear();
   result->target_version_prefix.clear();
@@ -67,12 +68,11 @@
   return EvalStatus::kSucceeded;
 }
 
-EvalStatus DefaultPolicy::UpdateCanStart(
-    EvaluationContext* ec,
-    State* state,
-    std::string* error,
-    UpdateDownloadParams* result,
-    const UpdateState update_state) const {
+EvalStatus DefaultPolicy::UpdateCanStart(EvaluationContext* ec,
+                                         State* state,
+                                         std::string* error,
+                                         UpdateDownloadParams* result,
+                                         const UpdateState update_state) const {
   result->update_can_start = true;
   result->cannot_start_reason = UpdateCannotStartReason::kUndefined;
   result->download_url_idx = 0;
@@ -87,30 +87,27 @@
   return EvalStatus::kSucceeded;
 }
 
-EvalStatus DefaultPolicy::UpdateDownloadAllowed(
-    EvaluationContext* ec,
-    State* state,
-    std::string* error,
-    bool* result) const {
+EvalStatus DefaultPolicy::UpdateDownloadAllowed(EvaluationContext* ec,
+                                                State* state,
+                                                std::string* error,
+                                                bool* result) const {
   *result = true;
   return EvalStatus::kSucceeded;
 }
 
-EvalStatus DefaultPolicy::P2PEnabled(
-    EvaluationContext* ec,
-    State* state,
-    std::string* error,
-    bool* result) const {
+EvalStatus DefaultPolicy::P2PEnabled(EvaluationContext* ec,
+                                     State* state,
+                                     std::string* error,
+                                     bool* result) const {
   *result = false;
   return EvalStatus::kSucceeded;
 }
 
-EvalStatus DefaultPolicy::P2PEnabledChanged(
-    EvaluationContext* ec,
-    State* state,
-    std::string* error,
-    bool* result,
-    bool prev_result) const {
+EvalStatus DefaultPolicy::P2PEnabledChanged(EvaluationContext* ec,
+                                            State* state,
+                                            std::string* error,
+                                            bool* result,
+                                            bool prev_result) const {
   // This policy will always prohibit P2P, so this is signaling to the caller
   // that the decision is final (because the current value is the same as the
   // previous one) and there's no need to issue another call.
diff --git a/update_manager/default_policy.h b/update_manager/default_policy.h
index 136ca35..1b284f4 100644
--- a/update_manager/default_policy.h
+++ b/update_manager/default_policy.h
@@ -65,9 +65,10 @@
   ~DefaultPolicy() override {}
 
   // Policy overrides.
-  EvalStatus UpdateCheckAllowed(
-      EvaluationContext* ec, State* state, std::string* error,
-      UpdateCheckParams* result) const override;
+  EvalStatus UpdateCheckAllowed(EvaluationContext* ec,
+                                State* state,
+                                std::string* error,
+                                UpdateCheckParams* result) const override;
 
   EvalStatus UpdateCanBeApplied(
       EvaluationContext* ec,
@@ -76,22 +77,27 @@
       chromeos_update_engine::ErrorCode* result,
       chromeos_update_engine::InstallPlan* install_plan) const override;
 
-  EvalStatus UpdateCanStart(
-      EvaluationContext* ec, State* state, std::string* error,
-      UpdateDownloadParams* result,
-      UpdateState update_state) const override;
+  EvalStatus UpdateCanStart(EvaluationContext* ec,
+                            State* state,
+                            std::string* error,
+                            UpdateDownloadParams* result,
+                            UpdateState update_state) const override;
 
-  EvalStatus UpdateDownloadAllowed(
-      EvaluationContext* ec, State* state, std::string* error,
-      bool* result) const override;
+  EvalStatus UpdateDownloadAllowed(EvaluationContext* ec,
+                                   State* state,
+                                   std::string* error,
+                                   bool* result) const override;
 
-  EvalStatus P2PEnabled(
-      EvaluationContext* ec, State* state, std::string* error,
-      bool* result) const override;
+  EvalStatus P2PEnabled(EvaluationContext* ec,
+                        State* state,
+                        std::string* error,
+                        bool* result) const override;
 
-  EvalStatus P2PEnabledChanged(
-      EvaluationContext* ec, State* state, std::string* error,
-      bool* result, bool prev_result) const override;
+  EvalStatus P2PEnabledChanged(EvaluationContext* ec,
+                               State* state,
+                               std::string* error,
+                               bool* result,
+                               bool prev_result) const override;
 
  protected:
   // Policy override.
diff --git a/update_manager/device_policy_provider.h b/update_manager/device_policy_provider.h
index 80dcfa2..873282e 100644
--- a/update_manager/device_policy_provider.h
+++ b/update_manager/device_policy_provider.h
@@ -51,7 +51,7 @@
   // Variable returning what should happen if the target_version_prefix is
   // earlier than the current Chrome OS version.
   virtual Variable<RollbackToTargetVersion>*
-      var_rollback_to_target_version() = 0;
+  var_rollback_to_target_version() = 0;
 
   // Variable returning the number of Chrome milestones rollback should be
   // possible. Rollback protection will be postponed by this many versions.
@@ -64,7 +64,7 @@
   // identifiers returned are consistent with the ones returned by the
   // ShillProvider.
   virtual Variable<std::set<chromeos_update_engine::ConnectionType>>*
-      var_allowed_connection_types_for_update() = 0;
+  var_allowed_connection_types_for_update() = 0;
 
   // Variable stating the name of the device owner. For enterprise enrolled
   // devices, this will be an empty string.
diff --git a/update_manager/evaluation_context-inl.h b/update_manager/evaluation_context-inl.h
index 937adf4..59d85da 100644
--- a/update_manager/evaluation_context-inl.h
+++ b/update_manager/evaluation_context-inl.h
@@ -23,7 +23,7 @@
 
 namespace chromeos_update_manager {
 
-template<typename T>
+template <typename T>
 const T* EvaluationContext::GetValue(Variable<T>* var) {
   if (var == nullptr) {
     LOG(ERROR) << "GetValue received an uninitialized variable.";
@@ -37,16 +37,15 @@
 
   // Get the value from the variable if not found on the cache.
   std::string errmsg;
-  const T* result = var->GetValue(RemainingTime(evaluation_monotonic_deadline_),
-                                  &errmsg);
+  const T* result =
+      var->GetValue(RemainingTime(evaluation_monotonic_deadline_), &errmsg);
   if (result == nullptr) {
     LOG(WARNING) << "Error reading Variable " << var->GetName() << ": \""
-        << errmsg << "\"";
+                 << errmsg << "\"";
   }
   // Cache the value for the next time. The map of CachedValues keeps the
   // ownership of the pointer until the map is destroyed.
-  value_cache_.emplace(
-    static_cast<BaseVariable*>(var), BoxedValue(result));
+  value_cache_.emplace(static_cast<BaseVariable*>(var), BoxedValue(result));
   return result;
 }
 
diff --git a/update_manager/evaluation_context.cc b/update_manager/evaluation_context.cc
index b6c7b91..e796fec 100644
--- a/update_manager/evaluation_context.cc
+++ b/update_manager/evaluation_context.cc
@@ -43,8 +43,7 @@
 // Returns whether |curr_time| surpassed |ref_time|; if not, also checks whether
 // |ref_time| is sooner than the current value of |*reeval_time|, in which case
 // the latter is updated to the former.
-bool IsTimeGreaterThanHelper(Time ref_time, Time curr_time,
-                             Time* reeval_time) {
+bool IsTimeGreaterThanHelper(Time ref_time, Time curr_time, Time* reeval_time) {
   if (curr_time > ref_time)
     return true;
   // Remember the nearest reference we've checked against in this evaluation.
@@ -104,8 +103,8 @@
 }
 
 Time EvaluationContext::MonotonicDeadline(TimeDelta timeout) {
-  return (timeout.is_max() ? Time::Max() :
-          clock_->GetMonotonicTime() + timeout);
+  return (timeout.is_max() ? Time::Max()
+                           : clock_->GetMonotonicTime() + timeout);
 }
 
 void EvaluationContext::ValueChanged(BaseVariable* var) {
@@ -130,13 +129,13 @@
 }
 
 bool EvaluationContext::IsWallclockTimeGreaterThan(Time timestamp) {
-  return IsTimeGreaterThanHelper(timestamp, evaluation_start_wallclock_,
-                                 &reevaluation_time_wallclock_);
+  return IsTimeGreaterThanHelper(
+      timestamp, evaluation_start_wallclock_, &reevaluation_time_wallclock_);
 }
 
 bool EvaluationContext::IsMonotonicTimeGreaterThan(Time timestamp) {
-  return IsTimeGreaterThanHelper(timestamp, evaluation_start_monotonic_,
-                                 &reevaluation_time_monotonic_);
+  return IsTimeGreaterThanHelper(
+      timestamp, evaluation_start_monotonic_, &reevaluation_time_monotonic_);
 }
 
 void EvaluationContext::ResetEvaluation() {
@@ -147,7 +146,7 @@
   evaluation_monotonic_deadline_ = MonotonicDeadline(evaluation_timeout_);
 
   // Remove the cached values of non-const variables
-  for (auto it = value_cache_.begin(); it != value_cache_.end(); ) {
+  for (auto it = value_cache_.begin(); it != value_cache_.end();) {
     if (it->first->GetMode() == kVariableModeConst) {
       ++it;
     } else {
diff --git a/update_manager/evaluation_context.h b/update_manager/evaluation_context.h
index 0bdbaec..c68c430 100644
--- a/update_manager/evaluation_context.h
+++ b/update_manager/evaluation_context.h
@@ -73,8 +73,10 @@
   EvaluationContext(chromeos_update_engine::ClockInterface* clock,
                     base::TimeDelta evaluation_timeout)
       : EvaluationContext(
-          clock, evaluation_timeout, base::TimeDelta::Max(),
-          std::unique_ptr<base::Callback<void(EvaluationContext*)>>()) {}
+            clock,
+            evaluation_timeout,
+            base::TimeDelta::Max(),
+            std::unique_ptr<base::Callback<void(EvaluationContext*)>>()) {}
   ~EvaluationContext();
 
   // Returns a pointer to the value returned by the passed variable |var|. The
@@ -83,7 +85,7 @@
   // passed Variable changes it.
   //
   // In case of error, a null value is returned.
-  template<typename T>
+  template <typename T>
   const T* GetValue(Variable<T>* var);
 
   // Returns whether the evaluation time has surpassed |timestamp|, on either
@@ -163,8 +165,7 @@
 
   // The TaskId returned by the message loop identifying the timeout callback.
   // Used for canceling the timeout callback.
-  brillo::MessageLoop::TaskId timeout_event_ =
-      brillo::MessageLoop::kTaskIdNull;
+  brillo::MessageLoop::TaskId timeout_event_ = brillo::MessageLoop::kTaskIdNull;
 
   // Whether a timeout event firing marks the expiration of the evaluation
   // context.
diff --git a/update_manager/evaluation_context_unittest.cc b/update_manager/evaluation_context_unittest.cc
index 6a8475b..eb42eb7 100644
--- a/update_manager/evaluation_context_unittest.cc
+++ b/update_manager/evaluation_context_unittest.cc
@@ -41,9 +41,9 @@
 using chromeos_update_engine::FakeClock;
 using std::string;
 using std::unique_ptr;
+using testing::_;
 using testing::Return;
 using testing::StrictMock;
-using testing::_;
 
 namespace chromeos_update_manager {
 
@@ -58,15 +58,17 @@
   return *value;
 }
 
-template<typename T>
+template <typename T>
 void ReadVar(scoped_refptr<EvaluationContext> ec, Variable<T>* var) {
   ec->GetValue(var);
 }
 
 // Runs |evaluation|; if the value pointed by |count_p| is greater than zero,
 // decrement it and schedule a reevaluation; otherwise, writes true to |done_p|.
-void EvaluateRepeatedly(Closure evaluation, scoped_refptr<EvaluationContext> ec,
-                        int* count_p, bool* done_p) {
+void EvaluateRepeatedly(Closure evaluation,
+                        scoped_refptr<EvaluationContext> ec,
+                        int* count_p,
+                        bool* done_p) {
   evaluation.Run();
 
   // Schedule reevaluation if needed.
@@ -91,7 +93,9 @@
     // Mar 2, 2006 1:23:45 UTC.
     fake_clock_.SetWallclockTime(Time::FromTimeT(1141262625));
     eval_ctx_ = new EvaluationContext(
-        &fake_clock_, default_timeout_, default_timeout_,
+        &fake_clock_,
+        default_timeout_,
+        default_timeout_,
         unique_ptr<base::Callback<void(EvaluationContext*)>>(nullptr));
   }
 
@@ -133,10 +137,10 @@
   FakeVariable<string> fake_const_var_ = {"fake_const", kVariableModeConst};
   FakeVariable<string> fake_poll_var_ = {"fake_poll",
                                          TimeDelta::FromSeconds(1)};
-  StrictMock<MockVariable<string>> mock_var_async_ {
-    "mock_var_async", kVariableModeAsync};
-  StrictMock<MockVariable<string>> mock_var_poll_ {
-    "mock_var_poll", kVariableModePoll};
+  StrictMock<MockVariable<string>> mock_var_async_{"mock_var_async",
+                                                   kVariableModeAsync};
+  StrictMock<MockVariable<string>> mock_var_poll_{"mock_var_poll",
+                                                  kVariableModePoll};
 };
 
 TEST_F(UmEvaluationContextTest, GetValueFails) {
@@ -206,7 +210,13 @@
   fake_const_var_.reset(new string("Hello world!"));
   EXPECT_EQ(*eval_ctx_->GetValue(&fake_const_var_), "Hello world!");
 
-  EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(base::DoNothing()));
+  EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+      Bind(&base::DoNothing)
+#else
+      base::DoNothing()
+#endif
+          ));
 }
 
 // Test that reevaluation occurs when an async variable it depends on changes.
@@ -276,11 +286,23 @@
   EXPECT_TRUE(value);
 
   // Ensure that we cannot reschedule an evaluation.
-  EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(base::DoNothing()));
+  EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+      Bind(&base::DoNothing)
+#else
+      base::DoNothing()
+#endif
+          ));
 
   // Ensure that we can reschedule an evaluation after resetting expiration.
   eval_ctx_->ResetExpiration();
-  EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(base::DoNothing()));
+  EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+      Bind(&base::DoNothing)
+#else
+      base::DoNothing()
+#endif
+          ));
 }
 
 // Test that we clear the events when destroying the EvaluationContext.
@@ -311,8 +333,8 @@
   evaluation.Run();
 
   // Schedule repeated reevaluations.
-  Closure closure = Bind(EvaluateRepeatedly, evaluation, eval_ctx_,
-                         &num_reevaluations, &done);
+  Closure closure = Bind(
+      EvaluateRepeatedly, evaluation, eval_ctx_, &num_reevaluations, &done);
   ASSERT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(closure));
   MessageLoopRunUntil(MessageLoop::current(),
                       TimeDelta::FromSeconds(10),
@@ -326,7 +348,13 @@
   fake_poll_var_.reset(new string("Polled value"));
   eval_ctx_->GetValue(&fake_async_var_);
   eval_ctx_->GetValue(&fake_poll_var_);
-  EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(base::DoNothing()));
+  EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+      Bind(&base::DoNothing)
+#else
+      base::DoNothing()
+#endif
+          ));
   // TearDown() checks for leaked observers on this async_variable, which means
   // that our object is still alive after removing its reference.
 }
@@ -360,13 +388,12 @@
 }
 
 TEST_F(UmEvaluationContextTest, TimeoutUpdatesWithMonotonicTime) {
-  fake_clock_.SetMonotonicTime(
-      fake_clock_.GetMonotonicTime() + TimeDelta::FromSeconds(1));
+  fake_clock_.SetMonotonicTime(fake_clock_.GetMonotonicTime() +
+                               TimeDelta::FromSeconds(1));
 
   TimeDelta timeout = default_timeout_ - TimeDelta::FromSeconds(1);
 
-  EXPECT_CALL(mock_var_async_, GetValue(timeout, _))
-      .WillOnce(Return(nullptr));
+  EXPECT_CALL(mock_var_async_, GetValue(timeout, _)).WillOnce(Return(nullptr));
   EXPECT_EQ(nullptr, eval_ctx_->GetValue(&mock_var_async_));
 }
 
@@ -375,20 +402,20 @@
   // Advance the time on the clock but don't call ResetEvaluation yet.
   fake_clock_.SetWallclockTime(cur_time + TimeDelta::FromSeconds(4));
 
-  EXPECT_TRUE(eval_ctx_->IsWallclockTimeGreaterThan(
-          cur_time - TimeDelta::FromSeconds(1)));
+  EXPECT_TRUE(eval_ctx_->IsWallclockTimeGreaterThan(cur_time -
+                                                    TimeDelta::FromSeconds(1)));
   EXPECT_FALSE(eval_ctx_->IsWallclockTimeGreaterThan(cur_time));
   EXPECT_FALSE(eval_ctx_->IsWallclockTimeGreaterThan(
-          cur_time + TimeDelta::FromSeconds(1)));
+      cur_time + TimeDelta::FromSeconds(1)));
   // Call ResetEvaluation now, which should use the new evaluation time.
   eval_ctx_->ResetEvaluation();
 
   cur_time = fake_clock_.GetWallclockTime();
-  EXPECT_TRUE(eval_ctx_->IsWallclockTimeGreaterThan(
-          cur_time - TimeDelta::FromSeconds(1)));
+  EXPECT_TRUE(eval_ctx_->IsWallclockTimeGreaterThan(cur_time -
+                                                    TimeDelta::FromSeconds(1)));
   EXPECT_FALSE(eval_ctx_->IsWallclockTimeGreaterThan(cur_time));
   EXPECT_FALSE(eval_ctx_->IsWallclockTimeGreaterThan(
-          cur_time + TimeDelta::FromSeconds(1)));
+      cur_time + TimeDelta::FromSeconds(1)));
 }
 
 TEST_F(UmEvaluationContextTest, ResetEvaluationResetsTimesMonotonic) {
@@ -396,20 +423,20 @@
   // Advance the time on the clock but don't call ResetEvaluation yet.
   fake_clock_.SetMonotonicTime(cur_time + TimeDelta::FromSeconds(4));
 
-  EXPECT_TRUE(eval_ctx_->IsMonotonicTimeGreaterThan(
-          cur_time - TimeDelta::FromSeconds(1)));
+  EXPECT_TRUE(eval_ctx_->IsMonotonicTimeGreaterThan(cur_time -
+                                                    TimeDelta::FromSeconds(1)));
   EXPECT_FALSE(eval_ctx_->IsMonotonicTimeGreaterThan(cur_time));
   EXPECT_FALSE(eval_ctx_->IsMonotonicTimeGreaterThan(
-          cur_time + TimeDelta::FromSeconds(1)));
+      cur_time + TimeDelta::FromSeconds(1)));
   // Call ResetEvaluation now, which should use the new evaluation time.
   eval_ctx_->ResetEvaluation();
 
   cur_time = fake_clock_.GetMonotonicTime();
-  EXPECT_TRUE(eval_ctx_->IsMonotonicTimeGreaterThan(
-          cur_time - TimeDelta::FromSeconds(1)));
+  EXPECT_TRUE(eval_ctx_->IsMonotonicTimeGreaterThan(cur_time -
+                                                    TimeDelta::FromSeconds(1)));
   EXPECT_FALSE(eval_ctx_->IsMonotonicTimeGreaterThan(cur_time));
   EXPECT_FALSE(eval_ctx_->IsMonotonicTimeGreaterThan(
-          cur_time + TimeDelta::FromSeconds(1)));
+      cur_time + TimeDelta::FromSeconds(1)));
 }
 
 TEST_F(UmEvaluationContextTest,
@@ -419,7 +446,13 @@
 
   // The "false" from IsWallclockTimeGreaterThan means that's not that timestamp
   // yet, so this should schedule a callback for when that happens.
-  EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(base::DoNothing()));
+  EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+      Bind(&base::DoNothing)
+#else
+      base::DoNothing()
+#endif
+          ));
 }
 
 TEST_F(UmEvaluationContextTest,
@@ -429,7 +462,13 @@
 
   // The "false" from IsMonotonicTimeGreaterThan means that's not that timestamp
   // yet, so this should schedule a callback for when that happens.
-  EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(base::DoNothing()));
+  EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+      Bind(&base::DoNothing)
+#else
+      base::DoNothing()
+#endif
+          ));
 }
 
 TEST_F(UmEvaluationContextTest,
@@ -442,7 +481,13 @@
       fake_clock_.GetWallclockTime() - TimeDelta::FromSeconds(1)));
 
   // Callback should not be scheduled.
-  EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(base::DoNothing()));
+  EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+      Bind(&base::DoNothing)
+#else
+      base::DoNothing()
+#endif
+          ));
 }
 
 TEST_F(UmEvaluationContextTest,
@@ -455,7 +500,13 @@
       fake_clock_.GetMonotonicTime() - TimeDelta::FromSeconds(1)));
 
   // Callback should not be scheduled.
-  EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(base::DoNothing()));
+  EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+      Bind(&base::DoNothing)
+#else
+      base::DoNothing()
+#endif
+          ));
 }
 
 TEST_F(UmEvaluationContextTest, DumpContext) {
@@ -473,16 +524,17 @@
   // Note that the variables are printed in alphabetical order. Also
   // see UmEvaluationContextText::SetUp() where the values used for
   // |evaluation_start_{monotonic,wallclock| are set.
-  EXPECT_EQ("{\n"
-            "   \"evaluation_start_monotonic\": \"4/22/2009 19:25:00 GMT\",\n"
-            "   \"evaluation_start_wallclock\": \"3/2/2006 1:23:45 GMT\",\n"
-            "   \"variables\": {\n"
-            "      \"fail_var\": \"(no value)\",\n"
-            "      \"fake_int\": \"42\",\n"
-            "      \"fake_poll\": \"Hello \\\"world\\\"!\"\n"
-            "   }\n"
-            "}",
-            eval_ctx_->DumpContext());
+  EXPECT_EQ(
+      "{\n"
+      "   \"evaluation_start_monotonic\": \"4/22/2009 19:25:00 GMT\",\n"
+      "   \"evaluation_start_wallclock\": \"3/2/2006 1:23:45 GMT\",\n"
+      "   \"variables\": {\n"
+      "      \"fail_var\": \"(no value)\",\n"
+      "      \"fake_int\": \"42\",\n"
+      "      \"fake_poll\": \"Hello \\\"world\\\"!\"\n"
+      "   }\n"
+      "}",
+      eval_ctx_->DumpContext());
 }
 
 }  // namespace chromeos_update_manager
diff --git a/update_manager/fake_config_provider.h b/update_manager/fake_config_provider.h
index 6a324df..7e6c35b 100644
--- a/update_manager/fake_config_provider.h
+++ b/update_manager/fake_config_provider.h
@@ -32,8 +32,8 @@
   }
 
  private:
-  FakeVariable<bool> var_is_oobe_enabled_{  // NOLINT(whitespace/braces)
-      "is_oobe_enabled", kVariableModeConst};
+  FakeVariable<bool> var_is_oobe_enabled_{"is_oobe_enabled",
+                                          kVariableModeConst};
 
   DISALLOW_COPY_AND_ASSIGN(FakeConfigProvider);
 };
diff --git a/update_manager/fake_device_policy_provider.h b/update_manager/fake_device_policy_provider.h
index d70e0c3..7cd4d7b 100644
--- a/update_manager/fake_device_policy_provider.h
+++ b/update_manager/fake_device_policy_provider.h
@@ -64,13 +64,11 @@
   }
 
   FakeVariable<std::set<chromeos_update_engine::ConnectionType>>*
-      var_allowed_connection_types_for_update() override {
+  var_allowed_connection_types_for_update() override {
     return &var_allowed_connection_types_for_update_;
   }
 
-  FakeVariable<std::string>* var_owner() override {
-    return &var_owner_;
-  }
+  FakeVariable<std::string>* var_owner() override { return &var_owner_; }
 
   FakeVariable<bool>* var_http_downloads_enabled() override {
     return &var_http_downloads_enabled_;
@@ -94,28 +92,27 @@
   }
 
  private:
-  FakeVariable<bool> var_device_policy_is_loaded_{
-      "policy_is_loaded", kVariableModePoll};
-  FakeVariable<std::string> var_release_channel_{
-      "release_channel", kVariableModePoll};
-  FakeVariable<bool> var_release_channel_delegated_{
-      "release_channel_delegated", kVariableModePoll};
-  FakeVariable<bool> var_update_disabled_{
-      "update_disabled", kVariableModePoll};
-  FakeVariable<std::string> var_target_version_prefix_{
-      "target_version_prefix", kVariableModePoll};
+  FakeVariable<bool> var_device_policy_is_loaded_{"policy_is_loaded",
+                                                  kVariableModePoll};
+  FakeVariable<std::string> var_release_channel_{"release_channel",
+                                                 kVariableModePoll};
+  FakeVariable<bool> var_release_channel_delegated_{"release_channel_delegated",
+                                                    kVariableModePoll};
+  FakeVariable<bool> var_update_disabled_{"update_disabled", kVariableModePoll};
+  FakeVariable<std::string> var_target_version_prefix_{"target_version_prefix",
+                                                       kVariableModePoll};
   FakeVariable<RollbackToTargetVersion> var_rollback_to_target_version_{
       "rollback_to_target_version", kVariableModePoll};
   FakeVariable<int> var_rollback_allowed_milestones_{
       "rollback_allowed_milestones", kVariableModePoll};
-  FakeVariable<base::TimeDelta> var_scatter_factor_{
-      "scatter_factor", kVariableModePoll};
+  FakeVariable<base::TimeDelta> var_scatter_factor_{"scatter_factor",
+                                                    kVariableModePoll};
   FakeVariable<std::set<chromeos_update_engine::ConnectionType>>
       var_allowed_connection_types_for_update_{
           "allowed_connection_types_for_update", kVariableModePoll};
   FakeVariable<std::string> var_owner_{"owner", kVariableModePoll};
-  FakeVariable<bool> var_http_downloads_enabled_{
-      "http_downloads_enabled", kVariableModePoll};
+  FakeVariable<bool> var_http_downloads_enabled_{"http_downloads_enabled",
+                                                 kVariableModePoll};
   FakeVariable<bool> var_au_p2p_enabled_{"au_p2p_enabled", kVariableModePoll};
   FakeVariable<bool> var_allow_kiosk_app_control_chrome_version_{
       "allow_kiosk_app_control_chrome_version", kVariableModePoll};
diff --git a/update_manager/fake_shill_provider.h b/update_manager/fake_shill_provider.h
index 7f1c8f5..7a23507 100644
--- a/update_manager/fake_shill_provider.h
+++ b/update_manager/fake_shill_provider.h
@@ -27,9 +27,7 @@
  public:
   FakeShillProvider() {}
 
-  FakeVariable<bool>* var_is_connected() override {
-    return &var_is_connected_;
-  }
+  FakeVariable<bool>* var_is_connected() override { return &var_is_connected_; }
 
   FakeVariable<chromeos_update_engine::ConnectionType>* var_conn_type()
       override {
@@ -37,7 +35,7 @@
   }
 
   FakeVariable<chromeos_update_engine::ConnectionTethering>*
-      var_conn_tethering() override {
+  var_conn_tethering() override {
     return &var_conn_tethering_;
   }
 
@@ -51,8 +49,8 @@
       "conn_type", kVariableModePoll};
   FakeVariable<chromeos_update_engine::ConnectionTethering> var_conn_tethering_{
       "conn_tethering", kVariableModePoll};
-  FakeVariable<base::Time> var_conn_last_changed_{
-      "conn_last_changed", kVariableModePoll};
+  FakeVariable<base::Time> var_conn_last_changed_{"conn_last_changed",
+                                                  kVariableModePoll};
 
   DISALLOW_COPY_AND_ASSIGN(FakeShillProvider);
 };
diff --git a/update_manager/fake_state.h b/update_manager/fake_state.h
index fd7a88c..0fd584f 100644
--- a/update_manager/fake_state.h
+++ b/update_manager/fake_state.h
@@ -46,29 +46,19 @@
   ~FakeState() override {}
 
   // Downcasted getters to access the fake instances during testing.
-  FakeConfigProvider* config_provider() override {
-    return &config_provider_;
-  }
+  FakeConfigProvider* config_provider() override { return &config_provider_; }
 
   FakeDevicePolicyProvider* device_policy_provider() override {
     return &device_policy_provider_;
   }
 
-  FakeRandomProvider* random_provider() override {
-    return &random_provider_;
-  }
+  FakeRandomProvider* random_provider() override { return &random_provider_; }
 
-  FakeShillProvider* shill_provider() override {
-    return &shill_provider_;
-  }
+  FakeShillProvider* shill_provider() override { return &shill_provider_; }
 
-  FakeSystemProvider* system_provider() override {
-    return &system_provider_;
-  }
+  FakeSystemProvider* system_provider() override { return &system_provider_; }
 
-  FakeTimeProvider* time_provider() override {
-    return &time_provider_;
-  }
+  FakeTimeProvider* time_provider() override { return &time_provider_; }
 
   FakeUpdaterProvider* updater_provider() override {
     return &updater_provider_;
diff --git a/update_manager/fake_system_provider.h b/update_manager/fake_system_provider.h
index 0f4dff4..f54951b 100644
--- a/update_manager/fake_system_provider.h
+++ b/update_manager/fake_system_provider.h
@@ -17,9 +17,12 @@
 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_FAKE_SYSTEM_PROVIDER_H_
 #define UPDATE_ENGINE_UPDATE_MANAGER_FAKE_SYSTEM_PROVIDER_H_
 
-#include "update_engine/update_manager/fake_variable.h"
 #include "update_engine/update_manager/system_provider.h"
 
+#include <string>
+
+#include "update_engine/update_manager/fake_variable.h"
+
 namespace chromeos_update_manager {
 
 // Fake implementation of the SystemProvider base class.
@@ -48,12 +51,12 @@
   }
 
  private:
-  FakeVariable<bool> var_is_normal_boot_mode_{  // NOLINT(whitespace/braces)
-    "is_normal_boot_mode", kVariableModeConst};
-  FakeVariable<bool> var_is_official_build_{  // NOLINT(whitespace/braces)
-    "is_official_build", kVariableModeConst};
-  FakeVariable<bool> var_is_oobe_complete_{  // NOLINT(whitespace/braces)
-    "is_oobe_complete", kVariableModePoll};
+  FakeVariable<bool> var_is_normal_boot_mode_{"is_normal_boot_mode",
+                                              kVariableModeConst};
+  FakeVariable<bool> var_is_official_build_{"is_official_build",
+                                            kVariableModeConst};
+  FakeVariable<bool> var_is_oobe_complete_{"is_oobe_complete",
+                                           kVariableModePoll};
   FakeVariable<unsigned int> var_num_slots_{"num_slots", kVariableModePoll};
   FakeVariable<std::string> var_kiosk_required_platform_version_{
       "kiosk_required_platform_version", kVariableModePoll};
diff --git a/update_manager/fake_update_manager.h b/update_manager/fake_update_manager.h
index 2ea00b6..173b1a9 100644
--- a/update_manager/fake_update_manager.h
+++ b/update_manager/fake_update_manager.h
@@ -27,8 +27,10 @@
 class FakeUpdateManager : public UpdateManager {
  public:
   explicit FakeUpdateManager(chromeos_update_engine::ClockInterface* clock)
-      : UpdateManager(clock, base::TimeDelta::FromSeconds(5),
-                      base::TimeDelta::FromHours(1), new FakeState()) {
+      : UpdateManager(clock,
+                      base::TimeDelta::FromSeconds(5),
+                      base::TimeDelta::FromHours(1),
+                      new FakeState()) {
     // The FakeUpdateManager uses a DefaultPolicy.
     set_policy(new DefaultPolicy(clock));
   }
diff --git a/update_manager/fake_variable.h b/update_manager/fake_variable.h
index 2f8e079..ef5b4f3 100644
--- a/update_manager/fake_variable.h
+++ b/update_manager/fake_variable.h
@@ -26,7 +26,7 @@
 
 // A fake typed variable to use while testing policy implementations. The
 // variable can be instructed to return any object of its type.
-template<typename T>
+template <typename T>
 class FakeVariable : public Variable<T> {
  public:
   FakeVariable(const std::string& name, VariableMode mode)
@@ -39,14 +39,10 @@
   // returned by GetValue(), the pointer is released and has to be set again.
   // A value of null means that the GetValue() call will fail and return
   // null.
-  void reset(const T* p_value) {
-    ptr_.reset(p_value);
-  }
+  void reset(const T* p_value) { ptr_.reset(p_value); }
 
   // Make the NotifyValueChanged() public for FakeVariables.
-  void NotifyValueChanged() {
-    Variable<T>::NotifyValueChanged();
-  }
+  void NotifyValueChanged() { Variable<T>::NotifyValueChanged(); }
 
  protected:
   // Variable<T> overrides.
diff --git a/update_manager/generic_variables.h b/update_manager/generic_variables.h
index f87a05e..afbdcbe 100644
--- a/update_manager/generic_variables.h
+++ b/update_manager/generic_variables.h
@@ -47,7 +47,7 @@
 //    private:
 //     MyType foo_;
 //   };
-template<typename T>
+template <typename T>
 class PollCopyVariable : public Variable<T> {
  public:
   // Creates the variable returning copies of the passed |ref|. The reference to
@@ -55,24 +55,35 @@
   // method is called. If |is_set_p| is not null, then this flag will be
   // consulted prior to returning the value, and an |errmsg| will be returned if
   // it is not set.
-  PollCopyVariable(const std::string& name, const T& ref, const bool* is_set_p,
+  PollCopyVariable(const std::string& name,
+                   const T& ref,
+                   const bool* is_set_p,
                    const std::string& errmsg)
-      : Variable<T>(name, kVariableModePoll), ref_(ref), is_set_p_(is_set_p),
+      : Variable<T>(name, kVariableModePoll),
+        ref_(ref),
+        is_set_p_(is_set_p),
         errmsg_(errmsg) {}
   PollCopyVariable(const std::string& name, const T& ref, const bool* is_set_p)
       : PollCopyVariable(name, ref, is_set_p, std::string()) {}
   PollCopyVariable(const std::string& name, const T& ref)
       : PollCopyVariable(name, ref, nullptr) {}
 
-  PollCopyVariable(const std::string& name, const base::TimeDelta poll_interval,
-                   const T& ref, const bool* is_set_p,
+  PollCopyVariable(const std::string& name,
+                   const base::TimeDelta poll_interval,
+                   const T& ref,
+                   const bool* is_set_p,
                    const std::string& errmsg)
-      : Variable<T>(name, poll_interval), ref_(ref), is_set_p_(is_set_p),
+      : Variable<T>(name, poll_interval),
+        ref_(ref),
+        is_set_p_(is_set_p),
         errmsg_(errmsg) {}
-  PollCopyVariable(const std::string& name, const base::TimeDelta poll_interval,
-                   const T& ref, const bool* is_set_p)
+  PollCopyVariable(const std::string& name,
+                   const base::TimeDelta poll_interval,
+                   const T& ref,
+                   const bool* is_set_p)
       : PollCopyVariable(name, poll_interval, ref, is_set_p, std::string()) {}
-  PollCopyVariable(const std::string& name, const base::TimeDelta poll_interval,
+  PollCopyVariable(const std::string& name,
+                   const base::TimeDelta poll_interval,
                    const T& ref)
       : PollCopyVariable(name, poll_interval, ref, nullptr) {}
 
@@ -109,7 +120,7 @@
 
 // Variable class returning a constant value that is cached on the variable when
 // it is created.
-template<typename T>
+template <typename T>
 class ConstCopyVariable : public Variable<T> {
  public:
   // Creates the variable returning copies of the passed |obj|. The value passed
@@ -132,7 +143,7 @@
 
 // Variable class returning a copy of a value returned by a given function. The
 // function is called every time the variable is being polled.
-template<typename T>
+template <typename T>
 class CallCopyVariable : public Variable<T> {
  public:
   CallCopyVariable(const std::string& name, base::Callback<T(void)> func)
@@ -160,7 +171,6 @@
   DISALLOW_COPY_AND_ASSIGN(CallCopyVariable);
 };
 
-
 // A Variable class to implement simple Async variables. It provides two methods
 // SetValue and UnsetValue to modify the current value of the variable and
 // notify the registered observers whenever the value changed.
@@ -168,7 +178,7 @@
 // The type T needs to be copy-constructible, default-constructible and have an
 // operator== (to determine if the value changed), which makes this class
 // suitable for basic types.
-template<typename T>
+template <typename T>
 class AsyncCopyVariable : public Variable<T> {
  public:
   explicit AsyncCopyVariable(const std::string& name)
@@ -176,7 +186,8 @@
 
   AsyncCopyVariable(const std::string& name, const T value)
       : Variable<T>(name, kVariableModeAsync),
-        has_value_(true), value_(value) {}
+        has_value_(true),
+        value_(value) {}
 
   void SetValue(const T& new_value) {
     bool should_notify = !(has_value_ && new_value == value_);
diff --git a/update_manager/generic_variables_unittest.cc b/update_manager/generic_variables_unittest.cc
index cb0c48f..0ff97e3 100644
--- a/update_manager/generic_variables_unittest.cc
+++ b/update_manager/generic_variables_unittest.cc
@@ -34,15 +34,14 @@
 
 class UmPollCopyVariableTest : public ::testing::Test {};
 
-
 TEST_F(UmPollCopyVariableTest, SimpleTest) {
   // Tests that copies are generated as intended.
   int source = 5;
   PollCopyVariable<int> var("var", source);
 
   // Generate and validate a copy.
-  unique_ptr<const int> copy_1(var.GetValue(
-          UmTestUtils::DefaultTimeout(), nullptr));
+  unique_ptr<const int> copy_1(
+      var.GetValue(UmTestUtils::DefaultTimeout(), nullptr));
   ASSERT_NE(nullptr, copy_1.get());
   EXPECT_EQ(5, *copy_1);
 
@@ -70,7 +69,6 @@
   UmTestUtils::ExpectVariableHasValue(5, &var);
 }
 
-
 class CopyConstructorTestClass {
  public:
   CopyConstructorTestClass(void) : copied_(false) {}
@@ -84,7 +82,6 @@
   int val_ = 0;
 };
 
-
 TEST_F(UmPollCopyVariableTest, UseCopyConstructorTest) {
   // Ensures that CopyVariables indeed uses the copy constructor.
   const CopyConstructorTestClass source;
@@ -97,7 +94,6 @@
   EXPECT_TRUE(copy->copied_);
 }
 
-
 class UmConstCopyVariableTest : public ::testing::Test {};
 
 TEST_F(UmConstCopyVariableTest, SimpleTest) {
@@ -110,7 +106,6 @@
   UmTestUtils::ExpectVariableHasValue(5, &var);
 }
 
-
 class UmCallCopyVariableTest : public ::testing::Test {};
 
 CopyConstructorTestClass test_func(CopyConstructorTestClass* obj) {
@@ -126,8 +121,8 @@
   ASSERT_FALSE(test_obj.copied_);
   test_obj.val_ = 5;
 
-  base::Callback<CopyConstructorTestClass(void)> cb = base::Bind(
-      test_func, &test_obj);
+  base::Callback<CopyConstructorTestClass(void)> cb =
+      base::Bind(test_func, &test_obj);
   CallCopyVariable<CopyConstructorTestClass> var("var", cb);
 
   unique_ptr<const CopyConstructorTestClass> copy(
@@ -148,16 +143,13 @@
 
 class UmAsyncCopyVariableTest : public ::testing::Test {
  protected:
-  void SetUp() override {
-    loop_.SetAsCurrent();
-  }
+  void SetUp() override { loop_.SetAsCurrent(); }
 
   void TearDown() override {
     // No remaining event on the main loop.
     EXPECT_FALSE(loop_.PendingTasks());
   }
 
-
   brillo::FakeMessageLoop loop_{nullptr};
 };
 
@@ -185,9 +177,7 @@
 
 class CallCounterObserver : public BaseVariable::ObserverInterface {
  public:
-  void ValueChanged(BaseVariable* variable) {
-    calls_count_++;
-  }
+  void ValueChanged(BaseVariable* variable) { calls_count_++; }
 
   int calls_count_ = 0;
 };
diff --git a/update_manager/mock_policy.h b/update_manager/mock_policy.h
index 8060bf8..46b6c78 100644
--- a/update_manager/mock_policy.h
+++ b/update_manager/mock_policy.h
@@ -32,39 +32,42 @@
   explicit MockPolicy(chromeos_update_engine::ClockInterface* clock)
       : default_policy_(clock) {
     // We defer to the corresponding DefaultPolicy methods, by default.
-    ON_CALL(*this, UpdateCheckAllowed(testing::_, testing::_, testing::_,
-                                      testing::_))
-        .WillByDefault(testing::Invoke(
-                &default_policy_, &DefaultPolicy::UpdateCheckAllowed));
+    ON_CALL(*this,
+            UpdateCheckAllowed(testing::_, testing::_, testing::_, testing::_))
+        .WillByDefault(testing::Invoke(&default_policy_,
+                                       &DefaultPolicy::UpdateCheckAllowed));
     ON_CALL(*this,
             UpdateCanBeApplied(
                 testing::_, testing::_, testing::_, testing::_, testing::_))
         .WillByDefault(testing::Invoke(&default_policy_,
                                        &DefaultPolicy::UpdateCanBeApplied));
-    ON_CALL(*this, UpdateCanStart(testing::_, testing::_, testing::_,
-                                  testing::_, testing::_))
-        .WillByDefault(testing::Invoke(
-                &default_policy_, &DefaultPolicy::UpdateCanStart));
-    ON_CALL(*this, UpdateDownloadAllowed(testing::_, testing::_, testing::_,
-                                         testing::_))
-        .WillByDefault(testing::Invoke(
-                &default_policy_, &DefaultPolicy::UpdateDownloadAllowed));
+    ON_CALL(*this,
+            UpdateCanStart(
+                testing::_, testing::_, testing::_, testing::_, testing::_))
+        .WillByDefault(
+            testing::Invoke(&default_policy_, &DefaultPolicy::UpdateCanStart));
+    ON_CALL(
+        *this,
+        UpdateDownloadAllowed(testing::_, testing::_, testing::_, testing::_))
+        .WillByDefault(testing::Invoke(&default_policy_,
+                                       &DefaultPolicy::UpdateDownloadAllowed));
     ON_CALL(*this, P2PEnabled(testing::_, testing::_, testing::_, testing::_))
-        .WillByDefault(testing::Invoke(
-                &default_policy_, &DefaultPolicy::P2PEnabled));
-    ON_CALL(*this, P2PEnabledChanged(testing::_, testing::_, testing::_,
-                                     testing::_, testing::_))
-        .WillByDefault(testing::Invoke(
-                &default_policy_, &DefaultPolicy::P2PEnabledChanged));
+        .WillByDefault(
+            testing::Invoke(&default_policy_, &DefaultPolicy::P2PEnabled));
+    ON_CALL(*this,
+            P2PEnabledChanged(
+                testing::_, testing::_, testing::_, testing::_, testing::_))
+        .WillByDefault(testing::Invoke(&default_policy_,
+                                       &DefaultPolicy::P2PEnabledChanged));
   }
 
   MockPolicy() : MockPolicy(nullptr) {}
   ~MockPolicy() override {}
 
   // Policy overrides.
-  MOCK_CONST_METHOD4(UpdateCheckAllowed,
-                     EvalStatus(EvaluationContext*, State*, std::string*,
-                                UpdateCheckParams*));
+  MOCK_CONST_METHOD4(
+      UpdateCheckAllowed,
+      EvalStatus(EvaluationContext*, State*, std::string*, UpdateCheckParams*));
 
   MOCK_CONST_METHOD5(UpdateCanBeApplied,
                      EvalStatus(EvaluationContext*,
@@ -74,20 +77,22 @@
                                 chromeos_update_engine::InstallPlan*));
 
   MOCK_CONST_METHOD5(UpdateCanStart,
-                     EvalStatus(EvaluationContext*, State*, std::string*,
-                                UpdateDownloadParams*, UpdateState));
+                     EvalStatus(EvaluationContext*,
+                                State*,
+                                std::string*,
+                                UpdateDownloadParams*,
+                                UpdateState));
 
-  MOCK_CONST_METHOD4(UpdateDownloadAllowed,
-                     EvalStatus(EvaluationContext*, State*, std::string*,
-                                bool*));
+  MOCK_CONST_METHOD4(
+      UpdateDownloadAllowed,
+      EvalStatus(EvaluationContext*, State*, std::string*, bool*));
 
-  MOCK_CONST_METHOD4(P2PEnabled,
-                     EvalStatus(EvaluationContext*, State*, std::string*,
-                                bool*));
+  MOCK_CONST_METHOD4(
+      P2PEnabled, EvalStatus(EvaluationContext*, State*, std::string*, bool*));
 
-  MOCK_CONST_METHOD5(P2PEnabledChanged,
-                     EvalStatus(EvaluationContext*, State*, std::string*,
-                                bool*, bool));
+  MOCK_CONST_METHOD5(
+      P2PEnabledChanged,
+      EvalStatus(EvaluationContext*, State*, std::string*, bool*, bool));
 
  protected:
   // Policy override.
diff --git a/update_manager/mock_variable.h b/update_manager/mock_variable.h
index 1493491..8b6c276 100644
--- a/update_manager/mock_variable.h
+++ b/update_manager/mock_variable.h
@@ -26,7 +26,7 @@
 namespace chromeos_update_manager {
 
 // This is a generic mock of the Variable class.
-template<typename T>
+template <typename T>
 class MockVariable : public Variable<T> {
  public:
   using Variable<T>::Variable;
diff --git a/update_manager/policy.h b/update_manager/policy.h
index ee163b3..5d65d9a 100644
--- a/update_manager/policy.h
+++ b/update_manager/policy.h
@@ -204,37 +204,34 @@
   // Returns the name of a public policy request.
   // IMPORTANT: Be sure to add a conditional for each new public policy that is
   // being added to this class in the future.
-  template<typename R, typename... Args>
-  std::string PolicyRequestName(
-      EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
-                                          std::string*, R*,
-                                          Args...) const) const {
+  template <typename R, typename... Args>
+  std::string PolicyRequestName(EvalStatus (Policy::*policy_method)(
+      EvaluationContext*, State*, std::string*, R*, Args...) const) const {
     std::string class_name = PolicyName() + "::";
 
-    if (reinterpret_cast<typeof(&Policy::UpdateCheckAllowed)>(
-            policy_method) == &Policy::UpdateCheckAllowed)
+    if (reinterpret_cast<typeof(&Policy::UpdateCheckAllowed)>(policy_method) ==
+        &Policy::UpdateCheckAllowed)
       return class_name + "UpdateCheckAllowed";
     if (reinterpret_cast<typeof(&Policy::UpdateCanBeApplied)>(policy_method) ==
         &Policy::UpdateCanBeApplied)
       return class_name + "UpdateCanBeApplied";
-    if (reinterpret_cast<typeof(&Policy::UpdateCanStart)>(
-            policy_method) == &Policy::UpdateCanStart)
+    if (reinterpret_cast<typeof(&Policy::UpdateCanStart)>(policy_method) ==
+        &Policy::UpdateCanStart)
       return class_name + "UpdateCanStart";
     if (reinterpret_cast<typeof(&Policy::UpdateDownloadAllowed)>(
             policy_method) == &Policy::UpdateDownloadAllowed)
       return class_name + "UpdateDownloadAllowed";
-    if (reinterpret_cast<typeof(&Policy::P2PEnabled)>(
-            policy_method) == &Policy::P2PEnabled)
+    if (reinterpret_cast<typeof(&Policy::P2PEnabled)>(policy_method) ==
+        &Policy::P2PEnabled)
       return class_name + "P2PEnabled";
-    if (reinterpret_cast<typeof(&Policy::P2PEnabledChanged)>(
-            policy_method) == &Policy::P2PEnabledChanged)
+    if (reinterpret_cast<typeof(&Policy::P2PEnabledChanged)>(policy_method) ==
+        &Policy::P2PEnabledChanged)
       return class_name + "P2PEnabledChanged";
 
     NOTREACHED();
     return class_name + "(unknown)";
   }
 
-
   // List of policy requests. A policy request takes an EvaluationContext as the
   // first argument, a State instance, a returned error message, a returned
   // value and optionally followed by one or more arbitrary constant arguments.
@@ -244,9 +241,10 @@
 
   // UpdateCheckAllowed returns whether it is allowed to request an update check
   // to Omaha.
-  virtual EvalStatus UpdateCheckAllowed(
-      EvaluationContext* ec, State* state, std::string* error,
-      UpdateCheckParams* result) const = 0;
+  virtual EvalStatus UpdateCheckAllowed(EvaluationContext* ec,
+                                        State* state,
+                                        std::string* error,
+                                        UpdateCheckParams* result) const = 0;
 
   // UpdateCanBeApplied returns whether the given |install_plan| can be acted
   // on at this time.  The reason for not applying is returned in |result|.
@@ -265,12 +263,11 @@
   // that need to be persisted has changed, returns
   // EvalStatus::kAskMeAgainLater. Arguments include an |update_state| that
   // encapsulates data pertaining to the current ongoing update process.
-  virtual EvalStatus UpdateCanStart(
-      EvaluationContext* ec,
-      State* state,
-      std::string* error,
-      UpdateDownloadParams* result,
-      UpdateState update_state) const = 0;
+  virtual EvalStatus UpdateCanStart(EvaluationContext* ec,
+                                    State* state,
+                                    std::string* error,
+                                    UpdateDownloadParams* result,
+                                    UpdateState update_state) const = 0;
 
   // Checks whether downloading of an update is allowed; currently, this checks
   // whether the network connection type is suitable for updating over.  May
@@ -278,26 +275,28 @@
   // Returns |EvalStatus::kSucceeded|, setting |result| according to whether or
   // not the current connection can be used; on error, returns
   // |EvalStatus::kFailed| and sets |error| accordingly.
-  virtual EvalStatus UpdateDownloadAllowed(
-      EvaluationContext* ec,
-      State* state,
-      std::string* error,
-      bool* result) const = 0;
+  virtual EvalStatus UpdateDownloadAllowed(EvaluationContext* ec,
+                                           State* state,
+                                           std::string* error,
+                                           bool* result) const = 0;
 
   // Checks whether P2P is enabled. This may consult device policy and other
   // global settings.
-  virtual EvalStatus P2PEnabled(
-      EvaluationContext* ec, State* state, std::string* error,
-      bool* result) const = 0;
+  virtual EvalStatus P2PEnabled(EvaluationContext* ec,
+                                State* state,
+                                std::string* error,
+                                bool* result) const = 0;
 
   // Checks whether P2P is enabled, but blocks (returns
   // |EvalStatus::kAskMeAgainLater|) until it is different from |prev_result|.
   // If the P2P enabled status is not expected to change, will return
   // immediately with |EvalStatus::kSucceeded|. This internally uses the
   // P2PEnabled() policy above.
-  virtual EvalStatus P2PEnabledChanged(
-      EvaluationContext* ec, State* state, std::string* error,
-      bool* result, bool prev_result) const = 0;
+  virtual EvalStatus P2PEnabledChanged(EvaluationContext* ec,
+                                       State* state,
+                                       std::string* error,
+                                       bool* result,
+                                       bool prev_result) const = 0;
 
  protected:
   Policy() {}
diff --git a/update_manager/policy_utils.h b/update_manager/policy_utils.h
index eaf9ee9..3204780 100644
--- a/update_manager/policy_utils.h
+++ b/update_manager/policy_utils.h
@@ -30,13 +30,13 @@
 //   const int* my_value = ec->GetValue(state->my_provider()->var_my_value());
 //   POLICY_CHECK_VALUE_AND_FAIL(my_value, error);
 //
-#define POLICY_CHECK_VALUE_AND_FAIL(ptr, error) \
-    do { \
-      if ((ptr) == nullptr) { \
-        *(error) = #ptr " is required but is null."; \
-        return EvalStatus::kFailed; \
-      } \
-    } while (false)
+#define POLICY_CHECK_VALUE_AND_FAIL(ptr, error)    \
+  do {                                             \
+    if ((ptr) == nullptr) {                        \
+      *(error) = #ptr " is required but is null."; \
+      return EvalStatus::kFailed;                  \
+    }                                              \
+  } while (false)
 
 namespace chromeos_update_manager {
 
diff --git a/update_manager/prng_unittest.cc b/update_manager/prng_unittest.cc
index 2a3f689..cb35f0a 100644
--- a/update_manager/prng_unittest.cc
+++ b/update_manager/prng_unittest.cc
@@ -63,7 +63,7 @@
 
 TEST(UmPRNGTest, RandCoversRange) {
   PRNG a(42);
-  int hits[11] = { 0 };
+  int hits[11] = {0};
 
   for (int i = 0; i < 1000; i++) {
     int r = a.RandMinMax(0, 10);
diff --git a/update_manager/real_device_policy_provider.cc b/update_manager/real_device_policy_provider.cc
index e0872bb..586ee3e 100644
--- a/update_manager/real_device_policy_provider.cc
+++ b/update_manager/real_device_policy_provider.cc
@@ -103,10 +103,9 @@
       TimeDelta::FromMinutes(kDevicePolicyRefreshRateInMinutes));
 }
 
-template<typename T>
+template <typename T>
 void RealDevicePolicyProvider::UpdateVariable(
-    AsyncCopyVariable<T>* var,
-    bool (DevicePolicy::*getter_method)(T*) const) {
+    AsyncCopyVariable<T>* var, bool (DevicePolicy::*getter_method)(T*) const) {
   T new_value;
   if (policy_provider_->device_policy_is_loaded() &&
       (policy_provider_->GetDevicePolicy().*getter_method)(&new_value)) {
@@ -116,7 +115,7 @@
   }
 }
 
-template<typename T>
+template <typename T>
 void RealDevicePolicyProvider::UpdateVariable(
     AsyncCopyVariable<T>* var,
     bool (RealDevicePolicyProvider::*getter_method)(T*) const) {
@@ -147,10 +146,10 @@
 }
 
 bool RealDevicePolicyProvider::ConvertAllowedConnectionTypesForUpdate(
-      set<ConnectionType>* allowed_types) const {
+    set<ConnectionType>* allowed_types) const {
   set<string> allowed_types_str;
-  if (!policy_provider_->GetDevicePolicy()
-      .GetAllowedConnectionTypesForUpdate(&allowed_types_str)) {
+  if (!policy_provider_->GetDevicePolicy().GetAllowedConnectionTypesForUpdate(
+          &allowed_types_str)) {
     return false;
   }
   allowed_types->clear();
@@ -170,7 +169,7 @@
     TimeDelta* scatter_factor) const {
   int64_t scatter_factor_in_seconds;
   if (!policy_provider_->GetDevicePolicy().GetScatterFactorInSeconds(
-      &scatter_factor_in_seconds)) {
+          &scatter_factor_in_seconds)) {
     return false;
   }
   if (scatter_factor_in_seconds < 0) {
diff --git a/update_manager/real_device_policy_provider.h b/update_manager/real_device_policy_provider.h
index d999d81..bda4cff 100644
--- a/update_manager/real_device_policy_provider.h
+++ b/update_manager/real_device_policy_provider.h
@@ -85,21 +85,17 @@
   }
 
   Variable<std::set<chromeos_update_engine::ConnectionType>>*
-      var_allowed_connection_types_for_update() override {
+  var_allowed_connection_types_for_update() override {
     return &var_allowed_connection_types_for_update_;
   }
 
-  Variable<std::string>* var_owner() override {
-    return &var_owner_;
-  }
+  Variable<std::string>* var_owner() override { return &var_owner_; }
 
   Variable<bool>* var_http_downloads_enabled() override {
     return &var_http_downloads_enabled_;
   }
 
-  Variable<bool>* var_au_p2p_enabled() override {
-    return &var_au_p2p_enabled_;
-  }
+  Variable<bool>* var_au_p2p_enabled() override { return &var_au_p2p_enabled_; }
 
   Variable<bool>* var_allow_kiosk_app_control_chrome_version() override {
     return &var_allow_kiosk_app_control_chrome_version_;
@@ -136,16 +132,16 @@
 
   // Updates the async variable |var| based on the result value of the method
   // passed, which is a DevicePolicy getter method.
-  template<typename T>
+  template <typename T>
   void UpdateVariable(AsyncCopyVariable<T>* var,
                       bool (policy::DevicePolicy::*getter_method)(T*) const);
 
   // Updates the async variable |var| based on the result value of the getter
   // method passed, which is a wrapper getter on this class.
-  template<typename T>
-  void UpdateVariable(
-      AsyncCopyVariable<T>* var,
-      bool (RealDevicePolicyProvider::*getter_method)(T*) const);
+  template <typename T>
+  void UpdateVariable(AsyncCopyVariable<T>* var,
+                      bool (RealDevicePolicyProvider::*getter_method)(T*)
+                          const);
 
   // Wrapper for DevicePolicy::GetRollbackToTargetVersion() that converts the
   // result to RollbackToTargetVersion.
@@ -182,8 +178,8 @@
 #endif  // USE_DBUS
 
   // Variable exposing whether the policy is loaded.
-  AsyncCopyVariable<bool> var_device_policy_is_loaded_{
-      "policy_is_loaded", false};
+  AsyncCopyVariable<bool> var_device_policy_is_loaded_{"policy_is_loaded",
+                                                       false};
 
   // Variables mapping the exposed methods from the policy::DevicePolicy.
   AsyncCopyVariable<std::string> var_release_channel_{"release_channel"};
diff --git a/update_manager/real_device_policy_provider_unittest.cc b/update_manager/real_device_policy_provider_unittest.cc
index e9c7b25..0d7b0d0 100644
--- a/update_manager/real_device_policy_provider_unittest.cc
+++ b/update_manager/real_device_policy_provider_unittest.cc
@@ -49,12 +49,12 @@
 using std::string;
 using std::unique_ptr;
 using std::vector;
+using testing::_;
 using testing::DoAll;
 using testing::Mock;
 using testing::Return;
 using testing::ReturnRef;
 using testing::SetArgPointee;
-using testing::_;
 
 namespace chromeos_update_manager {
 
@@ -90,8 +90,7 @@
   }
 
   void SetUpNonExistentDevicePolicy() {
-    ON_CALL(mock_policy_provider_, Reload())
-        .WillByDefault(Return(false));
+    ON_CALL(mock_policy_provider_, Reload()).WillByDefault(Return(false));
     ON_CALL(mock_policy_provider_, device_policy_is_loaded())
         .WillByDefault(Return(false));
     EXPECT_CALL(mock_policy_provider_, GetDevicePolicy()).Times(0);
@@ -99,8 +98,7 @@
 
   void SetUpExistentDevicePolicy() {
     // Setup the default behavior of the mocked PolicyProvider.
-    ON_CALL(mock_policy_provider_, Reload())
-        .WillByDefault(Return(true));
+    ON_CALL(mock_policy_provider_, Reload()).WillByDefault(Return(true));
     ON_CALL(mock_policy_provider_, device_policy_is_loaded())
         .WillByDefault(Return(true));
     ON_CALL(mock_policy_provider_, GetDevicePolicy())
diff --git a/update_manager/real_random_provider_unittest.cc b/update_manager/real_random_provider_unittest.cc
index ca67da6..1b22063 100644
--- a/update_manager/real_random_provider_unittest.cc
+++ b/update_manager/real_random_provider_unittest.cc
@@ -55,9 +55,8 @@
   // by design, once every 2^320 runs.
   bool is_same_value = true;
   for (int i = 0; i < 5; i++) {
-    unique_ptr<const uint64_t> other_value(
-        provider_->var_seed()->GetValue(UmTestUtils::DefaultTimeout(),
-                                        nullptr));
+    unique_ptr<const uint64_t> other_value(provider_->var_seed()->GetValue(
+        UmTestUtils::DefaultTimeout(), nullptr));
     ASSERT_NE(nullptr, other_value.get());
     is_same_value = is_same_value && *other_value == *value;
   }
diff --git a/update_manager/real_shill_provider.cc b/update_manager/real_shill_provider.cc
index 2c58a7e..0144603 100644
--- a/update_manager/real_shill_provider.cc
+++ b/update_manager/real_shill_provider.cc
@@ -94,8 +94,8 @@
 
   // Update the connection status.
   default_service_path_ = default_service_path;
-  bool is_connected = (default_service_path_.IsValid() &&
-                       default_service_path_.value() != "/");
+  bool is_connected =
+      (default_service_path_.IsValid() && default_service_path_.value() != "/");
   var_is_connected_.SetValue(is_connected);
   var_conn_last_changed_.SetValue(clock_->GetWallclockTime());
 
diff --git a/update_manager/real_shill_provider.h b/update_manager/real_shill_provider.h
index e7708c8..ec5c570 100644
--- a/update_manager/real_shill_provider.h
+++ b/update_manager/real_shill_provider.h
@@ -46,15 +46,14 @@
   // Initializes the provider and returns whether it succeeded.
   bool Init();
 
-  Variable<bool>* var_is_connected() override {
-    return &var_is_connected_;
-  }
+  Variable<bool>* var_is_connected() override { return &var_is_connected_; }
 
   Variable<chromeos_update_engine::ConnectionType>* var_conn_type() override {
     return &var_conn_type_;
   }
 
-  Variable<chromeos_update_engine::ConnectionTethering>* var_conn_tethering() override {
+  Variable<chromeos_update_engine::ConnectionTethering>* var_conn_tethering()
+      override {
     return &var_conn_tethering_;
   }
 
diff --git a/update_manager/real_shill_provider_unittest.cc b/update_manager/real_shill_provider_unittest.cc
index 6506923..dcc729a 100644
--- a/update_manager/real_shill_provider_unittest.cc
+++ b/update_manager/real_shill_provider_unittest.cc
@@ -41,10 +41,10 @@
 using org::chromium::flimflam::ManagerProxyMock;
 using org::chromium::flimflam::ServiceProxyMock;
 using std::unique_ptr;
+using testing::_;
 using testing::Mock;
 using testing::Return;
 using testing::SetArgPointee;
-using testing::_;
 
 namespace {
 
@@ -99,9 +99,7 @@
     return time;
   }
 
-  Time ConnChangedTime() {
-    return InitTime() + TimeDelta::FromSeconds(10);
-  }
+  Time ConnChangedTime() { return InitTime() + TimeDelta::FromSeconds(10); }
 
   // Sets the default_service object path in the response from the
   // ManagerProxyMock instance.
@@ -210,8 +208,9 @@
   chromeos_update_engine::FakeShillProxy* fake_shill_proxy_;
 
   // The registered signal handler for the signal Manager.PropertyChanged.
-  chromeos_update_engine::dbus_test_utils::MockSignalHandler<
-      void(const std::string&, const brillo::Any&)> manager_property_changed_;
+  chromeos_update_engine::dbus_test_utils::MockSignalHandler<void(
+      const std::string&, const brillo::Any&)>
+      manager_property_changed_;
 
   unique_ptr<RealShillProvider> provider_;
 };
@@ -269,7 +268,6 @@
   return service_proxy_mock;
 }
 
-
 // Query the connection status, type and time last changed, as they were set
 // during initialization (no signals).
 TEST_F(UmRealShillProviderTest, ReadBaseValues) {
@@ -315,17 +313,15 @@
 // Test that Wifi connection is identified correctly.
 TEST_F(UmRealShillProviderTest, ReadConnTypeWifi) {
   InitWithDefaultService("/");
-  SetupConnectionAndTestType(kFakeWifiServicePath,
-                             shill::kTypeWifi,
-                             ConnectionType::kWifi);
+  SetupConnectionAndTestType(
+      kFakeWifiServicePath, shill::kTypeWifi, ConnectionType::kWifi);
 }
 
 // Test that Wimax connection is identified correctly.
 TEST_F(UmRealShillProviderTest, ReadConnTypeWimax) {
   InitWithDefaultService("/");
-  SetupConnectionAndTestType(kFakeWimaxServicePath,
-                             shill::kTypeWimax,
-                             ConnectionType::kWimax);
+  SetupConnectionAndTestType(
+      kFakeWimaxServicePath, shill::kTypeWimax, ConnectionType::kWimax);
 }
 
 // Test that Bluetooth connection is identified correctly.
@@ -347,9 +343,8 @@
 // Test that an unknown connection is identified as such.
 TEST_F(UmRealShillProviderTest, ReadConnTypeUnknown) {
   InitWithDefaultService("/");
-  SetupConnectionAndTestType(kFakeUnknownServicePath,
-                             "FooConnectionType",
-                             ConnectionType::kUnknown);
+  SetupConnectionAndTestType(
+      kFakeUnknownServicePath, "FooConnectionType", ConnectionType::kUnknown);
 }
 
 // Tests that VPN connection is identified correctly.
@@ -406,9 +401,8 @@
                              shill::kTypeEthernet,
                              ConnectionType::kEthernet);
 
-  SetupConnectionAndTestType(kFakeWifiServicePath,
-                             shill::kTypeWifi,
-                             ConnectionType::kWifi);
+  SetupConnectionAndTestType(
+      kFakeWifiServicePath, shill::kTypeWifi, ConnectionType::kWifi);
 }
 
 // Test that a non-tethering mode is identified correctly.
@@ -438,9 +432,8 @@
 // Test that an unknown tethering mode is identified as such.
 TEST_F(UmRealShillProviderTest, ReadConnTetheringUnknown) {
   InitWithDefaultService("/");
-  SetupConnectionAndTestTethering(kFakeWifiServicePath,
-                                  "FooConnTethering",
-                                  ConnectionTethering::kUnknown);
+  SetupConnectionAndTestTethering(
+      kFakeWifiServicePath, "FooConnTethering", ConnectionTethering::kUnknown);
 }
 
 // Ensure that the connection tethering mode is properly cached in the provider.
diff --git a/update_manager/real_state.h b/update_manager/real_state.h
index e83c49d..056d46d 100644
--- a/update_manager/real_state.h
+++ b/update_manager/real_state.h
@@ -34,34 +34,24 @@
             ShillProvider* shill_provider,
             SystemProvider* system_provider,
             TimeProvider* time_provider,
-            UpdaterProvider* updater_provider) :
-      config_provider_(config_provider),
-      device_policy_provider_(device_policy_provider),
-      random_provider_(random_provider),
-      shill_provider_(shill_provider),
-      system_provider_(system_provider),
-      time_provider_(time_provider),
-      updater_provider_(updater_provider) {}
+            UpdaterProvider* updater_provider)
+      : config_provider_(config_provider),
+        device_policy_provider_(device_policy_provider),
+        random_provider_(random_provider),
+        shill_provider_(shill_provider),
+        system_provider_(system_provider),
+        time_provider_(time_provider),
+        updater_provider_(updater_provider) {}
 
   // These methods return the given provider.
-  ConfigProvider* config_provider() override {
-    return config_provider_.get();
-  }
+  ConfigProvider* config_provider() override { return config_provider_.get(); }
   DevicePolicyProvider* device_policy_provider() override {
     return device_policy_provider_.get();
   }
-  RandomProvider* random_provider() override {
-    return random_provider_.get();
-  }
-  ShillProvider* shill_provider() override {
-    return shill_provider_.get();
-  }
-  SystemProvider* system_provider() override {
-    return system_provider_.get();
-  }
-  TimeProvider* time_provider() override {
-    return time_provider_.get();
-  }
+  RandomProvider* random_provider() override { return random_provider_.get(); }
+  ShillProvider* shill_provider() override { return shill_provider_.get(); }
+  SystemProvider* system_provider() override { return system_provider_.get(); }
+  TimeProvider* time_provider() override { return time_provider_.get(); }
   UpdaterProvider* updater_provider() override {
     return updater_provider_.get();
   }
diff --git a/update_manager/real_system_provider.cc b/update_manager/real_system_provider.cc
index 53e9ab3..a900071 100644
--- a/update_manager/real_system_provider.cc
+++ b/update_manager/real_system_provider.cc
@@ -95,23 +95,20 @@
 }  // namespace
 
 bool RealSystemProvider::Init() {
-  var_is_normal_boot_mode_.reset(
-      new ConstCopyVariable<bool>("is_normal_boot_mode",
-                                  hardware_->IsNormalBootMode()));
+  var_is_normal_boot_mode_.reset(new ConstCopyVariable<bool>(
+      "is_normal_boot_mode", hardware_->IsNormalBootMode()));
 
-  var_is_official_build_.reset(
-      new ConstCopyVariable<bool>("is_official_build",
-                                  hardware_->IsOfficialBuild()));
+  var_is_official_build_.reset(new ConstCopyVariable<bool>(
+      "is_official_build", hardware_->IsOfficialBuild()));
 
-  var_is_oobe_complete_.reset(
-      new CallCopyVariable<bool>(
-          "is_oobe_complete",
-          base::Bind(&chromeos_update_engine::HardwareInterface::IsOOBEComplete,
-                     base::Unretained(hardware_), nullptr)));
+  var_is_oobe_complete_.reset(new CallCopyVariable<bool>(
+      "is_oobe_complete",
+      base::Bind(&chromeos_update_engine::HardwareInterface::IsOOBEComplete,
+                 base::Unretained(hardware_),
+                 nullptr)));
 
-  var_num_slots_.reset(
-      new ConstCopyVariable<unsigned int>(
-          "num_slots", boot_control_->GetNumSlots()));
+  var_num_slots_.reset(new ConstCopyVariable<unsigned int>(
+      "num_slots", boot_control_->GetNumSlots()));
 
   var_kiosk_required_platform_version_.reset(new RetryPollVariable<string>(
       "kiosk_required_platform_version",
diff --git a/update_manager/real_system_provider.h b/update_manager/real_system_provider.h
index 9d71d0d..114c6ea 100644
--- a/update_manager/real_system_provider.h
+++ b/update_manager/real_system_provider.h
@@ -45,7 +45,8 @@
         kiosk_app_proxy_(kiosk_app_proxy) {
   }
 #else
-        boot_control_(boot_control) {}
+        boot_control_(boot_control) {
+  }
 #endif  // USE_CHROME_KIOSK_APP
 
   // Initializes the provider and returns whether it succeeded.
diff --git a/update_manager/real_system_provider_unittest.cc b/update_manager/real_system_provider_unittest.cc
index 4e4da67..f654f7a 100644
--- a/update_manager/real_system_provider_unittest.cc
+++ b/update_manager/real_system_provider_unittest.cc
@@ -39,7 +39,7 @@
 
 #if USE_CHROME_KIOSK_APP
 namespace {
-const char kRequiredPlatformVersion[] ="1234.0.0";
+const char kRequiredPlatformVersion[] = "1234.0.0";
 }  // namespace
 #endif  // USE_CHROME_KIOSK_APP
 
diff --git a/update_manager/real_time_provider.cc b/update_manager/real_time_provider.cc
index baa8ae3..efd1747 100644
--- a/update_manager/real_time_provider.cc
+++ b/update_manager/real_time_provider.cc
@@ -38,8 +38,7 @@
       : Variable<Time>(name, TimeDelta::FromHours(1)), clock_(clock) {}
 
  protected:
-  virtual const Time* GetValue(TimeDelta /* timeout */,
-                               string* /* errmsg */) {
+  virtual const Time* GetValue(TimeDelta /* timeout */, string* /* errmsg */) {
     Time::Exploded now_exp;
     clock_->GetWallclockTime().LocalExplode(&now_exp);
     now_exp.hour = now_exp.minute = now_exp.second = now_exp.millisecond = 0;
@@ -64,8 +63,7 @@
       : Variable<int>(name, TimeDelta::FromMinutes(5)), clock_(clock) {}
 
  protected:
-  virtual const int* GetValue(TimeDelta /* timeout */,
-                              string* /* errmsg */) {
+  virtual const int* GetValue(TimeDelta /* timeout */, string* /* errmsg */) {
     Time::Exploded exploded;
     clock_->GetWallclockTime().LocalExplode(&exploded);
     return new int(exploded.hour);
diff --git a/update_manager/real_time_provider.h b/update_manager/real_time_provider.h
index 989cefb..40dab36 100644
--- a/update_manager/real_time_provider.h
+++ b/update_manager/real_time_provider.h
@@ -39,9 +39,7 @@
     return var_curr_date_.get();
   }
 
-  Variable<int>* var_curr_hour() override {
-    return var_curr_hour_.get();
-  }
+  Variable<int>* var_curr_hour() override { return var_curr_hour_.get(); }
 
   Variable<int>* var_curr_minute() override { return var_curr_minute_.get(); }
 
diff --git a/update_manager/real_updater_provider.cc b/update_manager/real_updater_provider.cc
index 094e79c..134db69 100644
--- a/update_manager/real_updater_provider.cc
+++ b/update_manager/real_updater_provider.cc
@@ -45,10 +45,11 @@
 
 // A templated base class for all update related variables. Provides uniform
 // construction and a system state handle.
-template<typename T>
+template <typename T>
 class UpdaterVariableBase : public Variable<T> {
  public:
-  UpdaterVariableBase(const string& name, VariableMode mode,
+  UpdaterVariableBase(const string& name,
+                      VariableMode mode,
                       SystemState* system_state)
       : Variable<T>(name, mode), system_state_(system_state) {}
 
@@ -125,8 +126,8 @@
 
     if (raw.progress() < 0.0 || raw.progress() > 1.0) {
       if (errmsg) {
-        *errmsg = StringPrintf("Invalid progress value received: %f",
-                               raw.progress());
+        *errmsg =
+            StringPrintf("Invalid progress value received: %f", raw.progress());
       }
       return nullptr;
     }
@@ -157,22 +158,20 @@
 };
 
 const StageVariable::CurrOpStrToStage StageVariable::curr_op_str_to_stage[] = {
-  {update_engine::kUpdateStatusIdle, Stage::kIdle},
-  {update_engine::kUpdateStatusCheckingForUpdate, Stage::kCheckingForUpdate},
-  {update_engine::kUpdateStatusUpdateAvailable, Stage::kUpdateAvailable},
-  {update_engine::kUpdateStatusDownloading, Stage::kDownloading},
-  {update_engine::kUpdateStatusVerifying, Stage::kVerifying},
-  {update_engine::kUpdateStatusFinalizing, Stage::kFinalizing},
-  {update_engine::kUpdateStatusUpdatedNeedReboot, Stage::kUpdatedNeedReboot},
-  {  // NOLINT(whitespace/braces)
-    update_engine::kUpdateStatusReportingErrorEvent,
-    Stage::kReportingErrorEvent
-  },
-  {update_engine::kUpdateStatusAttemptingRollback, Stage::kAttemptingRollback},
+    {update_engine::kUpdateStatusIdle, Stage::kIdle},
+    {update_engine::kUpdateStatusCheckingForUpdate, Stage::kCheckingForUpdate},
+    {update_engine::kUpdateStatusUpdateAvailable, Stage::kUpdateAvailable},
+    {update_engine::kUpdateStatusDownloading, Stage::kDownloading},
+    {update_engine::kUpdateStatusVerifying, Stage::kVerifying},
+    {update_engine::kUpdateStatusFinalizing, Stage::kFinalizing},
+    {update_engine::kUpdateStatusUpdatedNeedReboot, Stage::kUpdatedNeedReboot},
+    {update_engine::kUpdateStatusReportingErrorEvent,
+     Stage::kReportingErrorEvent},
+    {update_engine::kUpdateStatusAttemptingRollback,
+     Stage::kAttemptingRollback},
 };
 
-const Stage* StageVariable::GetValue(TimeDelta /* timeout */,
-                                     string* errmsg) {
+const Stage* StageVariable::GetValue(TimeDelta /* timeout */, string* errmsg) {
   GetStatusHelper raw(system_state(), errmsg);
   if (!raw.is_success())
     return nullptr;
@@ -316,9 +315,7 @@
     prefs->AddObserver(key, this);
     OnPrefSet(key);
   }
-  ~BooleanPrefVariable() {
-    prefs_->RemoveObserver(key_, this);
-  }
+  ~BooleanPrefVariable() { prefs_->RemoveObserver(key_, this); }
 
  private:
   // Reads the actual value from the Prefs instance and updates the Variable
@@ -331,9 +328,7 @@
     SetValue(result);
   }
 
-  void OnPrefDeleted(const string& key) override {
-    SetValue(default_val_);
-  }
+  void OnPrefDeleted(const string& key) override { SetValue(default_val_); }
 
   chromeos_update_engine::PrefsInterface* prefs_;
 
@@ -350,8 +345,8 @@
  public:
   ConsecutiveFailedUpdateChecksVariable(const string& name,
                                         SystemState* system_state)
-      : UpdaterVariableBase<unsigned int>(name, kVariableModePoll,
-                                          system_state) {}
+      : UpdaterVariableBase<unsigned int>(
+            name, kVariableModePoll, system_state) {}
 
  private:
   const unsigned int* GetValue(TimeDelta /* timeout */,
@@ -369,8 +364,8 @@
  public:
   ServerDictatedPollIntervalVariable(const string& name,
                                      SystemState* system_state)
-      : UpdaterVariableBase<unsigned int>(name, kVariableModePoll,
-                                          system_state) {}
+      : UpdaterVariableBase<unsigned int>(
+            name, kVariableModePoll, system_state) {}
 
  private:
   const unsigned int* GetValue(TimeDelta /* timeout */,
@@ -388,7 +383,7 @@
  public:
   ForcedUpdateRequestedVariable(const string& name, SystemState* system_state)
       : UpdaterVariableBase<UpdateRequestStatus>::UpdaterVariableBase(
-          name, kVariableModeAsync, system_state) {
+            name, kVariableModeAsync, system_state) {
     system_state->update_attempter()->set_forced_update_pending_callback(
         new base::Callback<void(bool, bool)>(  // NOLINT(readability/function)
             base::Bind(&ForcedUpdateRequestedVariable::Reset,
diff --git a/update_manager/real_updater_provider.h b/update_manager/real_updater_provider.h
index 5e3e27b..1b46895 100644
--- a/update_manager/real_updater_provider.h
+++ b/update_manager/real_updater_provider.h
@@ -52,13 +52,9 @@
     return var_update_completed_time_.get();
   }
 
-  Variable<double>* var_progress() override {
-    return var_progress_.get();
-  }
+  Variable<double>* var_progress() override { return var_progress_.get(); }
 
-  Variable<Stage>* var_stage() override {
-    return var_stage_.get();
-  }
+  Variable<Stage>* var_stage() override { return var_stage_.get(); }
 
   Variable<std::string>* var_new_version() override {
     return var_new_version_.get();
@@ -76,9 +72,7 @@
     return var_new_channel_.get();
   }
 
-  Variable<bool>* var_p2p_enabled() override {
-    return var_p2p_enabled_.get();
-  }
+  Variable<bool>* var_p2p_enabled() override { return var_p2p_enabled_.get(); }
 
   Variable<bool>* var_cellular_enabled() override {
     return var_cellular_enabled_.get();
diff --git a/update_manager/real_updater_provider_unittest.cc b/update_manager/real_updater_provider_unittest.cc
index b653885..fb7a763 100644
--- a/update_manager/real_updater_provider_unittest.cc
+++ b/update_manager/real_updater_provider_unittest.cc
@@ -114,9 +114,8 @@
   Time SetupUpdateCompletedTime(bool valid) {
     const TimeDelta kDurationSinceUpdate = TimeDelta::FromMinutes(7);
     const Time kUpdateBootTime = Time() + kDurationSinceUpdate * 2;
-    const Time kCurrBootTime = (valid ?
-                                kUpdateBootTime + kDurationSinceUpdate :
-                                kUpdateBootTime - kDurationSinceUpdate);
+    const Time kCurrBootTime = (valid ? kUpdateBootTime + kDurationSinceUpdate
+                                      : kUpdateBootTime - kDurationSinceUpdate);
     const Time kCurrWallclockTime = FixedTime();
     EXPECT_CALL(*fake_sys_state_.mock_update_attempter(),
                 GetBootTimeAtUpdate(_))
diff --git a/update_manager/shill_provider.h b/update_manager/shill_provider.h
index e6f4628..c7bb2e2 100644
--- a/update_manager/shill_provider.h
+++ b/update_manager/shill_provider.h
@@ -40,7 +40,7 @@
   // A variable returning the tethering mode of a network connection. Unknown if
   // not connected.
   virtual Variable<chromeos_update_engine::ConnectionTethering>*
-      var_conn_tethering() = 0;
+  var_conn_tethering() = 0;
 
   // A variable returning the time when network connection last changed.
   // Initialized to current time.
diff --git a/update_manager/state_factory.cc b/update_manager/state_factory.cc
index 7293692..78cec6a 100644
--- a/update_manager/state_factory.cc
+++ b/update_manager/state_factory.cc
@@ -76,14 +76,12 @@
   unique_ptr<RealUpdaterProvider> updater_provider(
       new RealUpdaterProvider(system_state));
 
-  if (!(config_provider->Init() &&
-        device_policy_provider->Init() &&
+  if (!(config_provider->Init() && device_policy_provider->Init() &&
         random_provider->Init() &&
 #if USE_SHILL
         shill_provider->Init() &&
 #endif  // USE_SHILL
-        system_provider->Init() &&
-        time_provider->Init() &&
+        system_provider->Init() && time_provider->Init() &&
         updater_provider->Init())) {
     LOG(ERROR) << "Error initializing providers";
     return nullptr;
diff --git a/update_manager/umtest_utils.h b/update_manager/umtest_utils.h
index 80693db..576f53c 100644
--- a/update_manager/umtest_utils.h
+++ b/update_manager/umtest_utils.h
@@ -37,7 +37,7 @@
   }
 
   // Calls GetValue on |variable| and expects its result to be |expected|.
-  template<typename T>
+  template <typename T>
   static void ExpectVariableHasValue(const T& expected, Variable<T>* variable) {
     ASSERT_NE(nullptr, variable);
     std::unique_ptr<const T> value(
@@ -47,7 +47,7 @@
   }
 
   // Calls GetValue on |variable| and expects its result to be null.
-  template<typename T>
+  template <typename T>
   static void ExpectVariableNotSet(Variable<T>* variable) {
     ASSERT_NE(nullptr, variable);
     std::unique_ptr<const T> value(
diff --git a/update_manager/update_manager-inl.h b/update_manager/update_manager-inl.h
index 77224cf..e9dee3f 100644
--- a/update_manager/update_manager-inl.h
+++ b/update_manager/update_manager-inl.h
@@ -28,13 +28,13 @@
 
 namespace chromeos_update_manager {
 
-template<typename R, typename... Args>
+template <typename R, typename... Args>
 EvalStatus UpdateManager::EvaluatePolicy(
     EvaluationContext* ec,
-    EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
-                                        std::string*, R*,
-                                        Args...) const,
-    R* result, Args... args) {
+    EvalStatus (Policy::*policy_method)(
+        EvaluationContext*, State*, std::string*, R*, Args...) const,
+    R* result,
+    Args... args) {
   // If expiration timeout fired, dump the context and reset expiration.
   // IMPORTANT: We must still proceed with evaluation of the policy in this
   // case, so that the evaluation time (and corresponding reevaluation timeouts)
@@ -53,15 +53,15 @@
 
   // First try calling the actual policy.
   std::string error;
-  EvalStatus status = (policy_.get()->*policy_method)(ec, state_.get(), &error,
-                                                      result, args...);
+  EvalStatus status = (policy_.get()->*policy_method)(
+      ec, state_.get(), &error, result, args...);
   // If evaluating the main policy failed, defer to the default policy.
   if (status == EvalStatus::kFailed) {
     LOG(WARNING) << "Evaluating policy failed: " << error
                  << "\nEvaluation context: " << ec->DumpContext();
     error.clear();
-    status = (default_policy_.*policy_method)(ec, state_.get(), &error, result,
-                                              args...);
+    status = (default_policy_.*policy_method)(
+        ec, state_.get(), &error, result, args...);
     if (status == EvalStatus::kFailed) {
       LOG(WARNING) << "Evaluating default policy failed: " << error;
     } else if (status == EvalStatus::kAskMeAgainLater) {
@@ -76,13 +76,12 @@
   return status;
 }
 
-template<typename R, typename... Args>
+template <typename R, typename... Args>
 void UpdateManager::OnPolicyReadyToEvaluate(
     scoped_refptr<EvaluationContext> ec,
     base::Callback<void(EvalStatus status, const R& result)> callback,
-    EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
-                                        std::string*, R*,
-                                        Args...) const,
+    EvalStatus (Policy::*policy_method)(
+        EvaluationContext*, State*, std::string*, R*, Args...) const,
     Args... args) {
   // Evaluate the policy.
   R result;
@@ -95,10 +94,13 @@
   }
 
   // Re-schedule the policy request based on used variables.
-  base::Closure reeval_callback = base::Bind(
-      &UpdateManager::OnPolicyReadyToEvaluate<R, Args...>,
-      base::Unretained(this), ec, callback,
-      policy_method, args...);
+  base::Closure reeval_callback =
+      base::Bind(&UpdateManager::OnPolicyReadyToEvaluate<R, Args...>,
+                 base::Unretained(this),
+                 ec,
+                 callback,
+                 policy_method,
+                 args...);
   if (ec->RunOnValueChangeOrTimeout(reeval_callback))
     return;  // Reevaluation scheduled successfully.
 
@@ -111,12 +113,12 @@
   callback.Run(status, result);
 }
 
-template<typename R, typename... ActualArgs, typename... ExpectedArgs>
+template <typename R, typename... ActualArgs, typename... ExpectedArgs>
 EvalStatus UpdateManager::PolicyRequest(
-    EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
-                                        std::string*, R*,
-                                        ExpectedArgs...) const,
-    R* result, ActualArgs... args) {
+    EvalStatus (Policy::*policy_method)(
+        EvaluationContext*, State*, std::string*, R*, ExpectedArgs...) const,
+    R* result,
+    ActualArgs... args) {
   scoped_refptr<EvaluationContext> ec(
       new EvaluationContext(clock_, evaluation_timeout_));
   // A PolicyRequest always consists on a single evaluation on a new
@@ -124,8 +126,8 @@
   // IMPORTANT: To ensure that ActualArgs can be converted to ExpectedArgs, we
   // explicitly instantiate EvaluatePolicy with the latter in lieu of the
   // former.
-  EvalStatus ret = EvaluatePolicy<R, ExpectedArgs...>(ec.get(), policy_method,
-                                                      result, args...);
+  EvalStatus ret = EvaluatePolicy<R, ExpectedArgs...>(
+      ec.get(), policy_method, result, args...);
   // Sync policy requests must not block, if they do then this is an error.
   DCHECK(EvalStatus::kAskMeAgainLater != ret);
   LOG_IF(WARNING, EvalStatus::kAskMeAgainLater == ret)
@@ -133,20 +135,20 @@
   return ret;
 }
 
-template<typename R, typename... ActualArgs, typename... ExpectedArgs>
+template <typename R, typename... ActualArgs, typename... ExpectedArgs>
 void UpdateManager::AsyncPolicyRequest(
     base::Callback<void(EvalStatus, const R& result)> callback,
-    EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
-                                        std::string*, R*,
-                                        ExpectedArgs...) const,
+    EvalStatus (Policy::*policy_method)(
+        EvaluationContext*, State*, std::string*, R*, ExpectedArgs...) const,
     ActualArgs... args) {
-  scoped_refptr<EvaluationContext> ec =
-      new EvaluationContext(
-          clock_, evaluation_timeout_, expiration_timeout_,
-          std::unique_ptr<base::Callback<void(EvaluationContext*)>>(
-              new base::Callback<void(EvaluationContext*)>(
-                  base::Bind(&UpdateManager::UnregisterEvalContext,
-                             weak_ptr_factory_.GetWeakPtr()))));
+  scoped_refptr<EvaluationContext> ec = new EvaluationContext(
+      clock_,
+      evaluation_timeout_,
+      expiration_timeout_,
+      std::unique_ptr<base::Callback<void(EvaluationContext*)>>(
+          new base::Callback<void(EvaluationContext*)>(
+              base::Bind(&UpdateManager::UnregisterEvalContext,
+                         weak_ptr_factory_.GetWeakPtr()))));
   if (!ec_repo_.insert(ec.get()).second) {
     LOG(ERROR) << "Failed to register evaluation context; this is a bug.";
   }
@@ -154,9 +156,13 @@
   // IMPORTANT: To ensure that ActualArgs can be converted to ExpectedArgs, we
   // explicitly instantiate UpdateManager::OnPolicyReadyToEvaluate with the
   // latter in lieu of the former.
-  base::Closure eval_callback = base::Bind(
-      &UpdateManager::OnPolicyReadyToEvaluate<R, ExpectedArgs...>,
-      base::Unretained(this), ec, callback, policy_method, args...);
+  base::Closure eval_callback =
+      base::Bind(&UpdateManager::OnPolicyReadyToEvaluate<R, ExpectedArgs...>,
+                 base::Unretained(this),
+                 ec,
+                 callback,
+                 policy_method,
+                 args...);
   brillo::MessageLoop::current()->PostTask(FROM_HERE, eval_callback);
 }
 
diff --git a/update_manager/update_manager.cc b/update_manager/update_manager.cc
index 25f3216..5dfc09c 100644
--- a/update_manager/update_manager.cc
+++ b/update_manager/update_manager.cc
@@ -27,11 +27,14 @@
 
 UpdateManager::UpdateManager(chromeos_update_engine::ClockInterface* clock,
                              base::TimeDelta evaluation_timeout,
-                             base::TimeDelta expiration_timeout, State* state)
-      : default_policy_(clock), state_(state), clock_(clock),
-        evaluation_timeout_(evaluation_timeout),
-        expiration_timeout_(expiration_timeout),
-        weak_ptr_factory_(this) {
+                             base::TimeDelta expiration_timeout,
+                             State* state)
+    : default_policy_(clock),
+      state_(state),
+      clock_(clock),
+      evaluation_timeout_(evaluation_timeout),
+      expiration_timeout_(expiration_timeout),
+      weak_ptr_factory_(this) {
 #ifdef __ANDROID__
   policy_.reset(new AndroidThingsPolicy());
 #else
diff --git a/update_manager/update_manager.h b/update_manager/update_manager.h
index a2f35df..b0fd97f 100644
--- a/update_manager/update_manager.h
+++ b/update_manager/update_manager.h
@@ -34,7 +34,7 @@
 namespace chromeos_update_manager {
 
 // Comparator for scoped_refptr objects.
-template<typename T>
+template <typename T>
 struct ScopedRefPtrLess {
   bool operator()(const scoped_refptr<T>& first,
                   const scoped_refptr<T>& second) const {
@@ -49,7 +49,8 @@
   // |state|.
   UpdateManager(chromeos_update_engine::ClockInterface* clock,
                 base::TimeDelta evaluation_timeout,
-                base::TimeDelta expiration_timeout, State* state);
+                base::TimeDelta expiration_timeout,
+                State* state);
 
   virtual ~UpdateManager();
 
@@ -68,12 +69,12 @@
   //
   // An example call to this method is:
   //   um.PolicyRequest(&Policy::SomePolicyMethod, &bool_result, arg1, arg2);
-  template<typename R, typename... ActualArgs, typename... ExpectedArgs>
+  template <typename R, typename... ActualArgs, typename... ExpectedArgs>
   EvalStatus PolicyRequest(
-      EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
-                                          std::string*, R*,
-                                          ExpectedArgs...) const,
-      R* result, ActualArgs...);
+      EvalStatus (Policy::*policy_method)(
+          EvaluationContext*, State*, std::string*, R*, ExpectedArgs...) const,
+      R* result,
+      ActualArgs...);
 
   // Evaluates the given |policy_method| policy with the provided |args|
   // arguments and calls the |callback| callback with the result when done.
@@ -83,19 +84,16 @@
   // policy until another status is returned. If the policy implementation based
   // its return value solely on const variables, the callback will be called
   // with the EvalStatus::kAskMeAgainLater status (which indicates an error).
-  template<typename R, typename... ActualArgs, typename... ExpectedArgs>
+  template <typename R, typename... ActualArgs, typename... ExpectedArgs>
   void AsyncPolicyRequest(
       base::Callback<void(EvalStatus, const R& result)> callback,
-      EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
-                                          std::string*, R*,
-                                          ExpectedArgs...) const,
+      EvalStatus (Policy::*policy_method)(
+          EvaluationContext*, State*, std::string*, R*, ExpectedArgs...) const,
       ActualArgs... args);
 
  protected:
   // The UpdateManager receives ownership of the passed Policy instance.
-  void set_policy(const Policy* policy) {
-    policy_.reset(policy);
-  }
+  void set_policy(const Policy* policy) { policy_.reset(policy); }
 
   // State getter used for testing.
   State* state() { return state_.get(); }
@@ -111,13 +109,13 @@
   // EvaluatePolicy() evaluates the passed |policy_method| method on the current
   // policy with the given |args| arguments. If the method fails, the default
   // policy is used instead.
-  template<typename R, typename... Args>
+  template <typename R, typename... Args>
   EvalStatus EvaluatePolicy(
       EvaluationContext* ec,
-      EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
-                                          std::string*, R*,
-                                          Args...) const,
-      R* result, Args... args);
+      EvalStatus (Policy::*policy_method)(
+          EvaluationContext*, State*, std::string*, R*, Args...) const,
+      R* result,
+      Args... args);
 
   // OnPolicyReadyToEvaluate() is called by the main loop when the evaluation
   // of the given |policy_method| should be executed. If the evaluation finishes
@@ -125,13 +123,12 @@
   // returned by the policy. If the evaluation returns an
   // EvalStatus::kAskMeAgainLater state, the |callback| will NOT be called and
   // the evaluation will be re-scheduled to be called later.
-  template<typename R, typename... Args>
+  template <typename R, typename... Args>
   void OnPolicyReadyToEvaluate(
       scoped_refptr<EvaluationContext> ec,
       base::Callback<void(EvalStatus status, const R& result)> callback,
-      EvalStatus (Policy::*policy_method)(EvaluationContext*, State*,
-                                          std::string*, R*,
-                                          Args...) const,
+      EvalStatus (Policy::*policy_method)(
+          EvaluationContext*, State*, std::string*, R*, Args...) const,
       Args... args);
 
   // Unregisters (removes from repo) a previously created EvaluationContext.
@@ -163,7 +160,8 @@
   // will remove all pending events associated with all outstanding contexts
   // (which should, in turn, trigger their destruction).
   std::set<scoped_refptr<EvaluationContext>,
-           ScopedRefPtrLess<EvaluationContext>> ec_repo_;
+           ScopedRefPtrLess<EvaluationContext>>
+      ec_repo_;
 
   base::WeakPtrFactory<UpdateManager> weak_ptr_factory_;
 
diff --git a/update_manager/update_manager_unittest.cc b/update_manager/update_manager_unittest.cc
index 125a60c..f1a8d17 100644
--- a/update_manager/update_manager_unittest.cc
+++ b/update_manager/update_manager_unittest.cc
@@ -81,13 +81,13 @@
   void SetUp() override {
     loop_.SetAsCurrent();
     fake_state_ = new FakeState();
-    umut_.reset(new UpdateManager(&fake_clock_, TimeDelta::FromSeconds(5),
-                                  TimeDelta::FromSeconds(1), fake_state_));
+    umut_.reset(new UpdateManager(&fake_clock_,
+                                  TimeDelta::FromSeconds(5),
+                                  TimeDelta::FromSeconds(1),
+                                  fake_state_));
   }
 
-  void TearDown() override {
-    EXPECT_FALSE(loop_.PendingTasks());
-  }
+  void TearDown() override { EXPECT_FALSE(loop_.PendingTasks()); }
 
   base::SimpleTestClock test_clock_;
   brillo::FakeMessageLoop loop_{&test_clock_};
@@ -103,7 +103,8 @@
  public:
   explicit FailingPolicy(int* num_called_p) : num_called_p_(num_called_p) {}
   FailingPolicy() : FailingPolicy(nullptr) {}
-  EvalStatus UpdateCheckAllowed(EvaluationContext* ec, State* state,
+  EvalStatus UpdateCheckAllowed(EvaluationContext* ec,
+                                State* state,
                                 string* error,
                                 UpdateCheckParams* result) const override {
     if (num_called_p_)
@@ -121,7 +122,8 @@
 
 // The LazyPolicy always returns EvalStatus::kAskMeAgainLater.
 class LazyPolicy : public DefaultPolicy {
-  EvalStatus UpdateCheckAllowed(EvaluationContext* ec, State* state,
+  EvalStatus UpdateCheckAllowed(EvaluationContext* ec,
+                                State* state,
                                 string* error,
                                 UpdateCheckParams* result) const override {
     return EvalStatus::kAskMeAgainLater;
@@ -139,9 +141,11 @@
 class DelayPolicy : public DefaultPolicy {
  public:
   DelayPolicy(int sleep_secs, Time time_threshold, int* num_called_p)
-      : sleep_secs_(sleep_secs), time_threshold_(time_threshold),
+      : sleep_secs_(sleep_secs),
+        time_threshold_(time_threshold),
         num_called_p_(num_called_p) {}
-  EvalStatus UpdateCheckAllowed(EvaluationContext* ec, State* state,
+  EvalStatus UpdateCheckAllowed(EvaluationContext* ec,
+                                State* state,
                                 string* error,
                                 UpdateCheckParams* result) const override {
     if (num_called_p_)
@@ -173,9 +177,10 @@
 // of EvalStatus and T instances. This allows to create a callback that keeps
 // track of when it is called and the arguments passed to it, to be used with
 // the UpdateManager::AsyncPolicyRequest().
-template<typename T>
+template <typename T>
 static void AccumulateCallsCallback(vector<pair<EvalStatus, T>>* acc,
-                                    EvalStatus status, const T& result) {
+                                    EvalStatus status,
+                                    const T& result) {
   acc->push_back(std::make_pair(status, result));
 }
 
@@ -183,8 +188,8 @@
 // this tests cover all policy requests as defined in Policy.
 TEST_F(UmUpdateManagerTest, PolicyRequestCallUpdateCheckAllowed) {
   UpdateCheckParams result;
-  EXPECT_EQ(EvalStatus::kSucceeded, umut_->PolicyRequest(
-      &Policy::UpdateCheckAllowed, &result));
+  EXPECT_EQ(EvalStatus::kSucceeded,
+            umut_->PolicyRequest(&Policy::UpdateCheckAllowed, &result));
 }
 
 TEST_F(UmUpdateManagerTest, PolicyRequestCallUpdateCanStart) {
@@ -213,9 +218,9 @@
   update_state.scatter_check_threshold_max = 8;
 
   UpdateDownloadParams result;
-  EXPECT_EQ(EvalStatus::kSucceeded,
-            umut_->PolicyRequest(&Policy::UpdateCanStart, &result,
-                                 update_state));
+  EXPECT_EQ(
+      EvalStatus::kSucceeded,
+      umut_->PolicyRequest(&Policy::UpdateCanStart, &result, update_state));
 }
 
 TEST_F(UmUpdateManagerTest, PolicyRequestCallsDefaultOnError) {
@@ -225,8 +230,8 @@
   // which will set this as true.
   UpdateCheckParams result;
   result.updates_enabled = false;
-  EvalStatus status = umut_->PolicyRequest(
-      &Policy::UpdateCheckAllowed, &result);
+  EvalStatus status =
+      umut_->PolicyRequest(&Policy::UpdateCheckAllowed, &result);
   EXPECT_EQ(EvalStatus::kSucceeded, status);
   EXPECT_TRUE(result.updates_enabled);
 }
@@ -250,8 +255,8 @@
   umut_->set_policy(new FailingPolicy());
 
   vector<pair<EvalStatus, UpdateCheckParams>> calls;
-  Callback<void(EvalStatus, const UpdateCheckParams&)> callback = Bind(
-      AccumulateCallsCallback<UpdateCheckParams>, &calls);
+  Callback<void(EvalStatus, const UpdateCheckParams&)> callback =
+      Bind(AccumulateCallsCallback<UpdateCheckParams>, &calls);
 
   umut_->AsyncPolicyRequest(callback, &Policy::UpdateCheckAllowed);
   // The callback should wait until we run the main loop for it to be executed.
@@ -291,8 +296,9 @@
   // reattempted.
   int num_called = 0;
   umut_->set_policy(new DelayPolicy(
-          0, fake_clock_.GetWallclockTime() + TimeDelta::FromSeconds(3),
-          &num_called));
+      0,
+      fake_clock_.GetWallclockTime() + TimeDelta::FromSeconds(3),
+      &num_called));
 
   vector<pair<EvalStatus, UpdateCheckParams>> calls;
   Callback<void(EvalStatus, const UpdateCheckParams&)> callback =
diff --git a/update_manager/variable.h b/update_manager/variable.h
index 7109692..6c7d350 100644
--- a/update_manager/variable.h
+++ b/update_manager/variable.h
@@ -74,20 +74,14 @@
   }
 
   // Returns the variable name as a string.
-  const std::string& GetName() const {
-    return name_;
-  }
+  const std::string& GetName() const { return name_; }
 
   // Returns the variable mode.
-  VariableMode GetMode() const {
-    return mode_;
-  }
+  VariableMode GetMode() const { return mode_; }
 
   // For VariableModePoll variables, it returns the polling interval of this
   // variable. In other case, it returns 0.
-  base::TimeDelta GetPollInterval() const {
-    return poll_interval_;
-  }
+  base::TimeDelta GetPollInterval() const { return poll_interval_; }
 
   // Adds and removes observers for value changes on the variable. This only
   // works for kVariableAsync variables since the other modes don't track value
@@ -106,8 +100,8 @@
  protected:
   // Creates a BaseVariable using the default polling interval (5 minutes).
   BaseVariable(const std::string& name, VariableMode mode)
-      : BaseVariable(name, mode,
-                     base::TimeDelta::FromMinutes(kDefaultPollMinutes)) {}
+      : BaseVariable(
+            name, mode, base::TimeDelta::FromMinutes(kDefaultPollMinutes)) {}
 
   // Creates a BaseVariable with mode kVariableModePoll and the provided
   // polling interval.
@@ -116,8 +110,8 @@
 
   // Reset the poll interval on a polling variable to the given one.
   void SetPollInterval(base::TimeDelta poll_interval) {
-    DCHECK_EQ(kVariableModePoll, mode_) << "Can't set the poll_interval on a "
-                                        << mode_ << " variable";
+    DCHECK_EQ(kVariableModePoll, mode_)
+        << "Can't set the poll_interval on a " << mode_ << " variable";
     poll_interval_ = poll_interval;
   }
 
@@ -140,11 +134,13 @@
   FRIEND_TEST(UmBaseVariableTest, NotifyValueChangedTest);
   FRIEND_TEST(UmBaseVariableTest, NotifyValueRemovesObserversTest);
 
-  BaseVariable(const std::string& name, VariableMode mode,
+  BaseVariable(const std::string& name,
+               VariableMode mode,
                base::TimeDelta poll_interval)
-    : name_(name), mode_(mode),
-      poll_interval_(mode == kVariableModePoll ?
-                     poll_interval : base::TimeDelta()) {}
+      : name_(name),
+        mode_(mode),
+        poll_interval_(mode == kVariableModePoll ? poll_interval
+                                                 : base::TimeDelta()) {}
 
   void OnValueChangedNotification() {
     // A ValueChanged() method can change the list of observers, for example
@@ -184,7 +180,7 @@
 // Interface to an Update Manager variable of a given type. Implementation
 // internals are hidden as protected members, since policies should not be
 // using them directly.
-template<typename T>
+template <typename T>
 class Variable : public BaseVariable {
  public:
   ~Variable() override {}
diff --git a/update_manager/variable_unittest.cc b/update_manager/variable_unittest.cc
index 144002a..fe40ce5 100644
--- a/update_manager/variable_unittest.cc
+++ b/update_manager/variable_unittest.cc
@@ -42,8 +42,7 @@
   ~DefaultVariable() override {}
 
  protected:
-  const T* GetValue(TimeDelta /* timeout */,
-                    string* /* errmsg */) override {
+  const T* GetValue(TimeDelta /* timeout */, string* /* errmsg */) override {
     return new T();
   }
 
@@ -53,9 +52,7 @@
 
 class UmBaseVariableTest : public ::testing::Test {
  protected:
-  void SetUp() override {
-    loop_.SetAsCurrent();
-  }
+  void SetUp() override { loop_.SetAsCurrent(); }
 
   brillo::FakeMessageLoop loop_{nullptr};
 };
@@ -87,9 +84,7 @@
 
 class BaseVariableObserver : public BaseVariable::ObserverInterface {
  public:
-  void ValueChanged(BaseVariable* variable) {
-    calls_.push_back(variable);
-  }
+  void ValueChanged(BaseVariable* variable) { calls_.push_back(variable); }
 
   // List of called functions.
   vector<BaseVariable*> calls_;
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;