platform2: Fix issues with new version of libchrome

libchrome r334380 has the following breaking changes that need to be fixed:
- base::JSONWriter::Write() and base::JSONWriter::WriteWithOptions() take
  "const base::Value&" instead of "const base::Value*"
- base::JSONReader::Read() and base::JSONReader::ReadAndReturnError()
  return a scoped_ptr<base::Value> instead of base::Value*
- base/safe_strerror_posix.h is moved to base/posix/safe_strerror.h
- safe_strerror() is now in "base" namespace
- StartsWithASCII(), EndsWith(), StringToUpperASCII(), LowerCaseEqualsASCII()
  are now in "base" namespace
- ObserverList<T> is now in "base" namespace
- base::PrintTo(base::FilePath) used in gtest is now moved to libchrome-test
  library and as such, unit test runners need to link to this library now.
- crypto::RSAPrivateKey::CreateSensitive() is now removed from //crypto, so
  some of tests in chromeos-login that used that function had to be changed
  to use crypto::GenerateRSAKeyPairNSS() directly.
- UnixDomanSocket class is now in "base" namespace
- Pickle class is now in "base" namespace

BUG=chromium:496469
TEST=`./build_packages`
CQ-DEPEND=CL:277662

Change-Id: I36e5fbf2e36a92068873ffbd44020c862a3ed9e3
Reviewed-on: https://chromium-review.googlesource.com/277671
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/commands/command_manager_unittest.cc b/buffet/commands/command_manager_unittest.cc
index f270655..81c2a5b 100644
--- a/buffet/commands/command_manager_unittest.cc
+++ b/buffet/commands/command_manager_unittest.cc
@@ -56,7 +56,7 @@
 static void SaveJsonToFile(const base::DictionaryValue& dict,
                            const base::FilePath& file_path) {
   std::string json;
-  base::JSONWriter::Write(&dict, &json);
+  base::JSONWriter::Write(dict, &json);
   const int bytes_to_write = static_cast<int>(json.size());
   CHECK_EQ(bytes_to_write, WriteFile(file_path, json.data(), bytes_to_write));
 }
diff --git a/buffet/commands/prop_constraints.cc b/buffet/commands/prop_constraints.cc
index f773290..1fd43e6 100644
--- a/buffet/commands/prop_constraints.cc
+++ b/buffet/commands/prop_constraints.cc
@@ -19,7 +19,7 @@
   std::string result;
   auto json = value.ToJson(nullptr);
   if (json)
-    base::JSONWriter::Write(json.get(), &result);
+    base::JSONWriter::Write(*json, &result);
   return result;
 }
 
diff --git a/buffet/commands/schema_utils.cc b/buffet/commands/schema_utils.cc
index 47b757f..efb758e 100644
--- a/buffet/commands/schema_utils.cc
+++ b/buffet/commands/schema_utils.cc
@@ -21,7 +21,7 @@
                             const std::string& expected_type,
                             chromeos::ErrorPtr* error) {
   std::string value_as_string;
-  base::JSONWriter::Write(value_in, &value_as_string);
+  base::JSONWriter::Write(*value_in, &value_as_string);
   chromeos::Error::AddToPrintf(error, FROM_HERE, errors::commands::kDomain,
                                errors::commands::kTypeMismatch,
                                "Unable to convert value %s into %s",
@@ -255,14 +255,14 @@
 std::string ToString(const native_types::Object& obj) {
   auto val = TypedValueToJson(obj, nullptr);
   std::string str;
-  base::JSONWriter::Write(val.get(), &str);
+  base::JSONWriter::Write(*val, &str);
   return str;
 }
 
 std::string ToString(const native_types::Array& arr) {
   auto val = TypedValueToJson(arr, nullptr);
   std::string str;
-  base::JSONWriter::Write(val.get(), &str);
+  base::JSONWriter::Write(*val, &str);
   return str;
 }
 
diff --git a/buffet/commands/unittest_utils.cc b/buffet/commands/unittest_utils.cc
index be4d4e7..df07289 100644
--- a/buffet/commands/unittest_utils.cc
+++ b/buffet/commands/unittest_utils.cc
@@ -16,8 +16,10 @@
   std::replace(json2.begin(), json2.end(), '\'', '"');
   int error = 0;
   std::string message;
-  std::unique_ptr<base::Value> value{base::JSONReader::ReadAndReturnError(
-      json2, base::JSON_PARSE_RFC, &error, &message)};
+  std::unique_ptr<base::Value> value{
+      base::JSONReader::ReadAndReturnError(json2, base::JSON_PARSE_RFC, &error,
+                                           &message)
+          .release()};
   CHECK(value) << "Failed to load JSON: " << message << ", " << json;
   return value;
 }