update_engine: update to libbase 242728

Made update_engine link with libchrome-242728 and fixed compile
issues due to changes in namespaces and include file layout.

Also removed some of suppressed compiler warnings and fixed the
issues masked by them (e.g. mismatched printf-like specifiers).

Added -Wextra compiler option to enable additional useful warnings
to ensure more strict checking... Had to disable "unused-parameter"
though since we have a lot of functions (mainly in fakes) that do
not use all of their parameters.

BUG=chromium:351593
TEST=Unit tests passed.
CQ-DEPEND=CL:191721

Change-Id: I1aa63a48d5f1f4ea75ba6b00aec7aa5f3bad15c4
Reviewed-on: https://chromium-review.googlesource.com/191510
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/prefs_unittest.cc b/prefs_unittest.cc
index d2a07ee..a3595a3 100644
--- a/prefs_unittest.cc
+++ b/prefs_unittest.cc
@@ -8,8 +8,8 @@
 
 #include "base/basictypes.h"
 #include "base/file_util.h"
-#include "base/string_util.h"
-#include "base/stringprintf.h"
+#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
 #include "gtest/gtest.h"
 #include "update_engine/prefs.h"
 
@@ -20,12 +20,12 @@
 class PrefsTest : public ::testing::Test {
  protected:
   virtual void SetUp() {
-    ASSERT_TRUE(file_util::CreateNewTempDirectory("auprefs", &prefs_dir_));
+    ASSERT_TRUE(base::CreateNewTempDirectory("auprefs", &prefs_dir_));
     ASSERT_TRUE(prefs_.Init(prefs_dir_));
   }
 
   virtual void TearDown() {
-    file_util::Delete(prefs_dir_, true);  // recursive
+    base::DeleteFile(prefs_dir_, true);  // recursive
   }
 
   bool SetValue(const string& key, const string& value) {
@@ -34,24 +34,24 @@
         static_cast<int>(value.length());
   }
 
-  FilePath prefs_dir_;
+  base::FilePath prefs_dir_;
   Prefs prefs_;
 };
 
 TEST_F(PrefsTest, GetFileNameForKey) {
   const char kKey[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-";
-  FilePath path;
+  base::FilePath path;
   EXPECT_TRUE(prefs_.GetFileNameForKey(kKey, &path));
   EXPECT_EQ(prefs_dir_.Append(kKey).value(), path.value());
 }
 
 TEST_F(PrefsTest, GetFileNameForKeyBadCharacter) {
-  FilePath path;
+  base::FilePath path;
   EXPECT_FALSE(prefs_.GetFileNameForKey("ABC abc", &path));
 }
 
 TEST_F(PrefsTest, GetFileNameForKeyEmpty) {
-  FilePath path;
+  base::FilePath path;
   EXPECT_FALSE(prefs_.GetFileNameForKey("", &path));
 }
 
@@ -79,38 +79,38 @@
   const char kValue[] = "some test value\non 2 lines";
   EXPECT_TRUE(prefs_.SetString(kKey, kValue));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(prefs_dir_.Append(kKey), &value));
+  EXPECT_TRUE(base::ReadFileToString(prefs_dir_.Append(kKey), &value));
   EXPECT_EQ(kValue, value);
 }
 
 TEST_F(PrefsTest, SetStringBadKey) {
   const char kKey[] = ".no-dots";
   EXPECT_FALSE(prefs_.SetString(kKey, "some value"));
-  EXPECT_FALSE(file_util::PathExists(prefs_dir_.Append(kKey)));
+  EXPECT_FALSE(base::PathExists(prefs_dir_.Append(kKey)));
 }
 
 TEST_F(PrefsTest, SetStringCreateDir) {
   const char kKey[] = "a-test-key";
   const char kValue[] = "test value";
-  FilePath subdir = prefs_dir_.Append("subdir1").Append("subdir2");
+  base::FilePath subdir = prefs_dir_.Append("subdir1").Append("subdir2");
   EXPECT_TRUE(prefs_.Init(subdir));
   EXPECT_TRUE(prefs_.SetString(kKey, kValue));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(subdir.Append(kKey), &value));
+  EXPECT_TRUE(base::ReadFileToString(subdir.Append(kKey), &value));
   EXPECT_EQ(kValue, value);
 }
 
 TEST_F(PrefsTest, SetStringDirCreationFailure) {
-  EXPECT_TRUE(prefs_.Init(FilePath("/dev/null")));
+  EXPECT_TRUE(prefs_.Init(base::FilePath("/dev/null")));
   const char kKey[] = "test-key";
   EXPECT_FALSE(prefs_.SetString(kKey, "test value"));
 }
 
 TEST_F(PrefsTest, SetStringFileCreationFailure) {
   const char kKey[] = "a-test-key";
-  file_util::CreateDirectory(prefs_dir_.Append(kKey));
+  base::CreateDirectory(prefs_dir_.Append(kKey));
   EXPECT_FALSE(prefs_.SetString(kKey, "test value"));
-  EXPECT_TRUE(file_util::DirectoryExists(prefs_dir_.Append(kKey)));
+  EXPECT_TRUE(base::DirectoryExists(prefs_dir_.Append(kKey)));
 }
 
 TEST_F(PrefsTest, GetInt64) {
@@ -130,7 +130,7 @@
 
 TEST_F(PrefsTest, GetInt64Max) {
   const char kKey[] = "test-key";
-  ASSERT_TRUE(SetValue(kKey, StringPrintf("%" PRIi64, kint64max)));
+  ASSERT_TRUE(SetValue(kKey, base::StringPrintf("%" PRIi64, kint64max)));
   int64_t value;
   EXPECT_TRUE(prefs_.GetInt64(kKey, &value));
   EXPECT_EQ(kint64max, value);
@@ -138,7 +138,7 @@
 
 TEST_F(PrefsTest, GetInt64Min) {
   const char kKey[] = "test-key";
-  ASSERT_TRUE(SetValue(kKey, StringPrintf("%" PRIi64, kint64min)));
+  ASSERT_TRUE(SetValue(kKey, base::StringPrintf("%" PRIi64, kint64min)));
   int64_t value;
   EXPECT_TRUE(prefs_.GetInt64(kKey, &value));
   EXPECT_EQ(kint64min, value);
@@ -161,30 +161,30 @@
   const char kKey[] = "test_int";
   EXPECT_TRUE(prefs_.SetInt64(kKey, -123));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(prefs_dir_.Append(kKey), &value));
+  EXPECT_TRUE(base::ReadFileToString(prefs_dir_.Append(kKey), &value));
   EXPECT_EQ("-123", value);
 }
 
 TEST_F(PrefsTest, SetInt64BadKey) {
   const char kKey[] = "s p a c e s";
   EXPECT_FALSE(prefs_.SetInt64(kKey, 20));
-  EXPECT_FALSE(file_util::PathExists(prefs_dir_.Append(kKey)));
+  EXPECT_FALSE(base::PathExists(prefs_dir_.Append(kKey)));
 }
 
 TEST_F(PrefsTest, SetInt64Max) {
   const char kKey[] = "test-max-int";
   EXPECT_TRUE(prefs_.SetInt64(kKey, kint64max));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(prefs_dir_.Append(kKey), &value));
-  EXPECT_EQ(StringPrintf("%" PRIi64, kint64max), value);
+  EXPECT_TRUE(base::ReadFileToString(prefs_dir_.Append(kKey), &value));
+  EXPECT_EQ(base::StringPrintf("%" PRIi64, kint64max), value);
 }
 
 TEST_F(PrefsTest, SetInt64Min) {
   const char kKey[] = "test-min-int";
   EXPECT_TRUE(prefs_.SetInt64(kKey, kint64min));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(prefs_dir_.Append(kKey), &value));
-  EXPECT_EQ(StringPrintf("%" PRIi64, kint64min), value);
+  EXPECT_TRUE(base::ReadFileToString(prefs_dir_.Append(kKey), &value));
+  EXPECT_EQ(base::StringPrintf("%" PRIi64, kint64min), value);
 }
 
 TEST_F(PrefsTest, GetBooleanFalse) {
@@ -226,7 +226,7 @@
   const char kKey[] = "test-bool";
   EXPECT_TRUE(prefs_.SetBoolean(kKey, true));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(prefs_dir_.Append(kKey), &value));
+  EXPECT_TRUE(base::ReadFileToString(prefs_dir_.Append(kKey), &value));
   EXPECT_EQ("true", value);
 }
 
@@ -234,14 +234,14 @@
   const char kKey[] = "test-bool";
   EXPECT_TRUE(prefs_.SetBoolean(kKey, false));
   string value;
-  EXPECT_TRUE(file_util::ReadFileToString(prefs_dir_.Append(kKey), &value));
+  EXPECT_TRUE(base::ReadFileToString(prefs_dir_.Append(kKey), &value));
   EXPECT_EQ("false", value);
 }
 
 TEST_F(PrefsTest, SetBooleanBadKey) {
   const char kKey[] = "s p a c e s";
   EXPECT_FALSE(prefs_.SetBoolean(kKey, true));
-  EXPECT_FALSE(file_util::PathExists(prefs_dir_.Append(kKey)));
+  EXPECT_FALSE(base::PathExists(prefs_dir_.Append(kKey)));
 }
 
 TEST_F(PrefsTest, ExistsWorks) {