Partially Revert 2b9d241

2b9d2417722cd4052b0e22494886f93c5b4ef042 update_engine: Update libchrome APIS to r456626.

The above commit changes the libchrome API used in update_engine to r456626. But
the libchrome has not been upreved fully in the CrOS yet with the exception of
some changes represented in UE like CL:882543. So, now we need to revert the
changes partially untill the libchrome is updated.

BUG=chromium:815356
TEST=unittests, precq

Change-Id: If2207f0672c7b9f6dab84e676d9fb8423a047372
Reviewed-on: https://chromium-review.googlesource.com/965266
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
diff --git a/common/http_fetcher_unittest.cc b/common/http_fetcher_unittest.cc
index 867216e..73110e9 100644
--- a/common/http_fetcher_unittest.cc
+++ b/common/http_fetcher_unittest.cc
@@ -32,6 +32,7 @@
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
 #include <base/time/time.h>
+#include <brillo/bind_lambda.h>
 #include <brillo/message_loops/base_message_loop.h>
 #include <brillo/message_loops/message_loop.h>
 #include <brillo/message_loops/message_loop_utils.h>
diff --git a/common/subprocess_unittest.cc b/common/subprocess_unittest.cc
index c8996db..10710e8 100644
--- a/common/subprocess_unittest.cc
+++ b/common/subprocess_unittest.cc
@@ -32,6 +32,7 @@
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
 #include <base/time/time.h>
+#include <brillo/bind_lambda.h>
 #include <brillo/message_loops/base_message_loop.h>
 #include <brillo/message_loops/message_loop.h>
 #include <brillo/message_loops/message_loop_utils.h>
diff --git a/common/utils_unittest.cc b/common/utils_unittest.cc
index 62f9f6c..033702b 100644
--- a/common/utils_unittest.cc
+++ b/common/utils_unittest.cc
@@ -303,9 +303,8 @@
   base::Time::Exploded exploded = (base::Time::Exploded) {
     .year = 2001, .month = 9, .day_of_week = 0, .day_of_month = 9,
     .hour = 1, .minute = 46, .second = 40, .millisecond = 42};
-  base::Time time;
-  EXPECT_TRUE(base::Time::FromUTCExploded(exploded, &time));
-  EXPECT_EQ(time, utils::TimeFromStructTimespec(&ts));
+  EXPECT_EQ(base::Time::FromUTCExploded(exploded),
+            utils::TimeFromStructTimespec(&ts));
 }
 
 TEST(UtilsTest, DecodeAndStoreBase64String) {
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index 6bc5ba2..e9d0504 100644
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -2109,7 +2109,7 @@
   params.set_update_check_count_wait_enabled(false);
 
   Time arbitrary_date;
-  ASSERT_TRUE(Time::FromString("6/4/1989", &arbitrary_date));
+  Time::FromString("6/4/1989", &arbitrary_date);
   fake_system_state_.fake_clock()->SetWallclockTime(arbitrary_date);
   ASSERT_FALSE(TestUpdateCheck(&params,
                                fake_update_response_.GetUpdateResponse(),
@@ -2150,8 +2150,8 @@
   params.set_update_check_count_wait_enabled(false);
 
   Time t1, t2;
-  ASSERT_TRUE(Time::FromString("1/1/2012", &t1));
-  ASSERT_TRUE(Time::FromString("1/3/2012", &t2));
+  Time::FromString("1/1/2012", &t1);
+  Time::FromString("1/3/2012", &t2);
   ASSERT_TRUE(
       fake_prefs_.SetInt64(kPrefsUpdateFirstSeenAt, t1.ToInternalValue()));
   fake_system_state_.fake_clock()->SetWallclockTime(t2);
diff --git a/payload_consumer/download_action_unittest.cc b/payload_consumer/download_action_unittest.cc
index 7ec7e0e..726972d 100644
--- a/payload_consumer/download_action_unittest.cc
+++ b/payload_consumer/download_action_unittest.cc
@@ -29,6 +29,7 @@
 #include <base/files/file_util.h>
 #include <base/location.h>
 #include <base/strings/stringprintf.h>
+#include <brillo/bind_lambda.h>
 #include <brillo/message_loops/fake_message_loop.h>
 #include <brillo/message_loops/message_loop.h>
 
diff --git a/payload_consumer/filesystem_verifier_action_unittest.cc b/payload_consumer/filesystem_verifier_action_unittest.cc
index b4f7f7f..2e1d95d 100644
--- a/payload_consumer/filesystem_verifier_action_unittest.cc
+++ b/payload_consumer/filesystem_verifier_action_unittest.cc
@@ -26,6 +26,7 @@
 #include <base/posix/eintr_wrapper.h>
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
+#include <brillo/bind_lambda.h>
 #include <brillo/message_loops/fake_message_loop.h>
 #include <brillo/message_loops/message_loop_utils.h>
 #include <gmock/gmock.h>
diff --git a/payload_consumer/postinstall_runner_action_unittest.cc b/payload_consumer/postinstall_runner_action_unittest.cc
index f15171b..a319299 100644
--- a/payload_consumer/postinstall_runner_action_unittest.cc
+++ b/payload_consumer/postinstall_runner_action_unittest.cc
@@ -28,6 +28,7 @@
 #include <base/message_loop/message_loop.h>
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
+#include <brillo/bind_lambda.h>
 #include <brillo/message_loops/base_message_loop.h>
 #include <brillo/message_loops/message_loop_utils.h>
 #include <gmock/gmock.h>
diff --git a/proxy_resolver_unittest.cc b/proxy_resolver_unittest.cc
index 484aae1..070b361 100644
--- a/proxy_resolver_unittest.cc
+++ b/proxy_resolver_unittest.cc
@@ -22,6 +22,7 @@
 #include <gtest/gtest.h>
 
 #include <base/bind.h>
+#include <brillo/bind_lambda.h>
 #include <brillo/message_loops/fake_message_loop.h>
 
 using std::deque;
diff --git a/test_http_server.cc b/test_http_server.cc
index cf15672..39a12ed 100644
--- a/test_http_server.cc
+++ b/test_http_server.cc
@@ -98,11 +98,9 @@
   request->raw_headers = headers;
 
   // Break header into lines.
-  vector<string> lines = base::SplitStringUsingSubstr(
-      headers.substr(0, headers.length() - strlen(EOL EOL)),
-      EOL,
-      base::TRIM_WHITESPACE,
-      base::SPLIT_WANT_ALL);
+  vector<string> lines;
+  base::SplitStringUsingSubstr(
+      headers.substr(0, headers.length() - strlen(EOL EOL)), EOL, &lines);
 
   // Decode URL line.
   vector<string> terms = base::SplitString(lines[0], base::kWhitespaceASCII,
diff --git a/update_attempter.cc b/update_attempter.cc
index b289b1e..7152d8f 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -31,6 +31,7 @@
 #include <base/rand_util.h>
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
+#include <brillo/bind_lambda.h>
 #include <brillo/data_encoding.h>
 #include <brillo/errors/error_codes.h>
 #include <brillo/message_loops/message_loop.h>
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index 240e4ec..dd61fa5 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -22,6 +22,7 @@
 
 #include <base/files/file_util.h>
 #include <base/message_loop/message_loop.h>
+#include <brillo/bind_lambda.h>
 #include <brillo/message_loops/base_message_loop.h>
 #include <brillo/message_loops/message_loop.h>
 #include <brillo/message_loops/message_loop_utils.h>
diff --git a/update_manager/real_shill_provider_unittest.cc b/update_manager/real_shill_provider_unittest.cc
index 6506923..af674d0 100644
--- a/update_manager/real_shill_provider_unittest.cc
+++ b/update_manager/real_shill_provider_unittest.cc
@@ -94,9 +94,7 @@
     now_exp.minute = 5;
     now_exp.second = 33;
     now_exp.millisecond = 675;
-    Time time;
-    ignore_result(Time::FromLocalExploded(now_exp, &time));
-    return time;
+    return Time::FromLocalExploded(now_exp);
   }
 
   Time ConnChangedTime() {
diff --git a/update_manager/real_time_provider.cc b/update_manager/real_time_provider.cc
index db26816..ca3acad 100644
--- a/update_manager/real_time_provider.cc
+++ b/update_manager/real_time_provider.cc
@@ -43,10 +43,7 @@
     Time::Exploded now_exp;
     clock_->GetWallclockTime().LocalExplode(&now_exp);
     now_exp.hour = now_exp.minute = now_exp.second = now_exp.millisecond = 0;
-    Time* now = new Time();
-    bool success = Time::FromLocalExploded(now_exp, now);
-    DCHECK(success);
-    return now;
+    return new Time(Time::FromLocalExploded(now_exp));
   }
 
  private:
diff --git a/update_manager/real_time_provider_unittest.cc b/update_manager/real_time_provider_unittest.cc
index f8db30b..0e1ef34 100644
--- a/update_manager/real_time_provider_unittest.cc
+++ b/update_manager/real_time_provider_unittest.cc
@@ -51,9 +51,7 @@
     now_exp.minute = 5;
     now_exp.second = 33;
     now_exp.millisecond = 675;
-    Time time;
-    ignore_result(Time::FromLocalExploded(now_exp, &time));
-    return time;
+    return Time::FromLocalExploded(now_exp);
   }
 
   FakeClock fake_clock_;
@@ -68,8 +66,7 @@
   exploded.minute = 0;
   exploded.second = 0;
   exploded.millisecond = 0;
-  Time expected;
-  ignore_result(Time::FromLocalExploded(exploded, &expected));
+  const Time expected = Time::FromLocalExploded(exploded);
 
   fake_clock_.SetWallclockTime(now);
   UmTestUtils::ExpectVariableHasValue(expected, provider_->var_curr_date());
diff --git a/update_manager/real_updater_provider_unittest.cc b/update_manager/real_updater_provider_unittest.cc
index b653885..efe042c 100644
--- a/update_manager/real_updater_provider_unittest.cc
+++ b/update_manager/real_updater_provider_unittest.cc
@@ -57,9 +57,7 @@
   now_exp.minute = 5;
   now_exp.second = 33;
   now_exp.millisecond = 675;
-  Time time;
-  ignore_result(Time::FromLocalExploded(now_exp, &time));
-  return time;
+  return Time::FromLocalExploded(now_exp);
 }
 
 // Rounds down a timestamp to the nearest second. This is useful when faking
@@ -68,9 +66,7 @@
   Time::Exploded exp;
   time.LocalExplode(&exp);
   exp.millisecond = 0;
-  Time rounded_time;
-  ignore_result(Time::FromLocalExploded(exp, &rounded_time));
-  return rounded_time;
+  return Time::FromLocalExploded(exp);
 }
 
 ACTION_P(ActionSetUpdateEngineStatusLastCheckedTime, time) {
diff --git a/update_manager/update_manager_unittest.cc b/update_manager/update_manager_unittest.cc
index c2766ea..03f1610 100644
--- a/update_manager/update_manager_unittest.cc
+++ b/update_manager/update_manager_unittest.cc
@@ -67,9 +67,7 @@
   now_exp.minute = 5;
   now_exp.second = 33;
   now_exp.millisecond = 675;
-  Time time;
-  ignore_result(Time::FromLocalExploded(now_exp, &time));
-  return time;
+  return Time::FromLocalExploded(now_exp);
 }
 
 }  // namespace