Merge "trunks: Add ptr() method to ScopedKeyHandle"
diff --git a/trunks.gyp b/trunks.gyp
index 591a265..4203bc5 100644
--- a/trunks.gyp
+++ b/trunks.gyp
@@ -85,6 +85,7 @@
     {
       'target_name': 'trunks_test',
       'type': 'static_library',
+      'standalone_static_library': 1,
       'sources': [
         'mock_authorization_delegate.cc',
         'mock_blob_parser.cc',
diff --git a/trunks_client.cc b/trunks_client.cc
index 02c841d..2202107 100644
--- a/trunks_client.cc
+++ b/trunks_client.cc
@@ -22,7 +22,7 @@
 
 #include <base/command_line.h>
 #include <base/logging.h>
-#include <chromeos/syslog_logging.h>
+#include <brillo/syslog_logging.h>
 
 #include "trunks/error_codes.h"
 #include "trunks/hmac_session.h"
@@ -135,7 +135,7 @@
 
 int main(int argc, char **argv) {
   base::CommandLine::Init(argc, argv);
-  chromeos::InitLog(chromeos::kLogToSyslog | chromeos::kLogToStderr);
+  brillo::InitLog(brillo::kLogToSyslog | brillo::kLogToStderr);
   base::CommandLine *cl = base::CommandLine::ForCurrentProcess();
   if (cl->HasSwitch("help")) {
     puts("Trunks Client: A command line tool to access the TPM.");
diff --git a/trunks_proxy.cc b/trunks_proxy.cc
index 774efd9..a37e006 100644
--- a/trunks_proxy.cc
+++ b/trunks_proxy.cc
@@ -17,8 +17,8 @@
 #include "trunks/trunks_proxy.h"
 
 #include <base/bind.h>
-#include <chromeos/bind_lambda.h>
-#include <chromeos/dbus/dbus_method_invoker.h>
+#include <brillo/bind_lambda.h>
+#include <brillo/dbus/dbus_method_invoker.h>
 
 #include "trunks/dbus_interface.h"
 #include "trunks/dbus_interface.pb.h"
@@ -64,12 +64,12 @@
   }
   SendCommandRequest tpm_command_proto;
   tpm_command_proto.set_command(command);
-  auto on_error = [callback](chromeos::Error* error) {
+  auto on_error = [callback](brillo::Error* error) {
     SendCommandResponse response;
     response.set_response(CreateErrorResponse(SAPI_RC_NO_RESPONSE_RECEIVED));
     callback.Run(response.response());
   };
-  chromeos::dbus_utils::CallMethodWithTimeout(
+  brillo::dbus_utils::CallMethodWithTimeout(
       kDBusMaxTimeout,
       object_proxy_,
       trunks::kTrunksInterface,
@@ -87,9 +87,9 @@
   }
   SendCommandRequest tpm_command_proto;
   tpm_command_proto.set_command(command);
-  chromeos::ErrorPtr error;
+  brillo::ErrorPtr error;
   std::unique_ptr<dbus::Response> dbus_response =
-      chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
+      brillo::dbus_utils::CallMethodAndBlockWithTimeout(
           kDBusMaxTimeout,
           object_proxy_,
           trunks::kTrunksInterface,
@@ -97,7 +97,7 @@
           &error,
           tpm_command_proto);
   SendCommandResponse tpm_response_proto;
-  if (dbus_response.get() && chromeos::dbus_utils::ExtractMethodCallResults(
+  if (dbus_response.get() && brillo::dbus_utils::ExtractMethodCallResults(
       dbus_response.get(), &error, &tpm_response_proto)) {
     return tpm_response_proto.response();
   } else {
diff --git a/trunks_service.cc b/trunks_service.cc
index f034ea6..f1aa34e 100644
--- a/trunks_service.cc
+++ b/trunks_service.cc
@@ -17,7 +17,7 @@
 #include "trunks/trunks_service.h"
 
 #include <base/bind.h>
-#include <chromeos/bind_lambda.h>
+#include <brillo/bind_lambda.h>
 
 #include "trunks/dbus_interface.h"
 #include "trunks/dbus_interface.pb.h"
@@ -25,7 +25,7 @@
 
 namespace trunks {
 
-using chromeos::dbus_utils::DBusMethodResponse;
+using brillo::dbus_utils::DBusMethodResponse;
 
 TrunksService::TrunksService(const scoped_refptr<dbus::Bus>& bus,
                              CommandTransceiver* transceiver)
@@ -34,7 +34,7 @@
       weak_factory_(this) {}
 
 void TrunksService::Register(const CompletionAction& callback) {
-  chromeos::dbus_utils::DBusInterface* dbus_interface =
+  brillo::dbus_utils::DBusInterface* dbus_interface =
       trunks_dbus_object_.AddOrGetInterface(kTrunksInterface);
   dbus_interface->AddMethodHandler(kSendCommand,
                                    base::Unretained(this),
diff --git a/trunks_service.h b/trunks_service.h
index e15ac4e..94ea16f 100644
--- a/trunks_service.h
+++ b/trunks_service.h
@@ -20,8 +20,8 @@
 #include <string>
 
 #include <base/memory/weak_ptr.h>
-#include <chromeos/dbus/dbus_method_response.h>
-#include <chromeos/dbus/dbus_object.h>
+#include <brillo/dbus/dbus_method_response.h>
+#include <brillo/dbus/dbus_object.h>
 
 #include "trunks/dbus_interface.pb.h"
 #include "trunks/tpm_handle.h"
@@ -29,7 +29,7 @@
 namespace trunks {
 
 using CompletionAction =
-    chromeos::dbus_utils::AsyncEventSequencer::CompletionAction;
+    brillo::dbus_utils::AsyncEventSequencer::CompletionAction;
 
 // TrunksService registers for and handles all incoming D-Bus messages for the
 // trunksd system daemon.
@@ -46,7 +46,7 @@
  private:
   // Handles calls to the 'SendCommand' method.
   void HandleSendCommand(
-      std::unique_ptr<chromeos::dbus_utils::DBusMethodResponse<
+      std::unique_ptr<brillo::dbus_utils::DBusMethodResponse<
           const SendCommandResponse&>> response_sender,
       const SendCommandRequest& request);
 
@@ -54,7 +54,7 @@
     return weak_factory_.GetWeakPtr();
   }
 
-  chromeos::dbus_utils::DBusObject trunks_dbus_object_;
+  brillo::dbus_utils::DBusObject trunks_dbus_object_;
   CommandTransceiver* transceiver_;
 
   // Declared last so weak pointers are invalidated first on destruction.
diff --git a/trunks_testrunner.cc b/trunks_testrunner.cc
index 8535724..9cbc9f9 100644
--- a/trunks_testrunner.cc
+++ b/trunks_testrunner.cc
@@ -17,12 +17,12 @@
 #include <base/at_exit.h>
 #include <base/command_line.h>
 #include <base/logging.h>
-#include <chromeos/syslog_logging.h>
+#include <brillo/syslog_logging.h>
 #include <gtest/gtest.h>
 
 int main(int argc, char **argv) {
   base::CommandLine::Init(argc, argv);
-  chromeos::InitLog(chromeos::kLogToStderr);
+  brillo::InitLog(brillo::kLogToStderr);
   // Enable verbose logging while running unit tests.
   logging::SetMinLogLevel(logging::LOG_VERBOSE);
   base::AtExitManager exit_manager;
diff --git a/trunksd.cc b/trunksd.cc
index 3b078d2..4c7b05f 100644
--- a/trunksd.cc
+++ b/trunksd.cc
@@ -20,11 +20,10 @@
 #include <base/bind.h>
 #include <base/command_line.h>
 #include <base/threading/thread.h>
-#include <chromeos/daemons/dbus_daemon.h>
-#include <chromeos/libminijail.h>
-#include <chromeos/minijail/minijail.h>
-#include <chromeos/syslog_logging.h>
-#include <chromeos/userdb_utils.h>
+#include <brillo/daemons/dbus_daemon.h>
+#include <brillo/minijail/minijail.h>
+#include <brillo/syslog_logging.h>
+#include <brillo/userdb_utils.h>
 
 #include "trunks/background_command_transceiver.h"
 #include "trunks/dbus_interface.h"
@@ -35,7 +34,7 @@
 #include "trunks/trunks_ftdi_spi.h"
 #include "trunks/trunks_service.h"
 
-using chromeos::dbus_utils::AsyncEventSequencer;
+using brillo::dbus_utils::AsyncEventSequencer;
 
 namespace {
 
@@ -48,12 +47,10 @@
 void InitMinijailSandbox() {
   uid_t trunks_uid;
   gid_t trunks_gid;
-  CHECK(chromeos::userdb::GetUserInfo(kTrunksUser,
-                                      &trunks_uid,
-                                      &trunks_gid))
+  CHECK(brillo::userdb::GetUserInfo(kTrunksUser, &trunks_uid, &trunks_gid))
       << "Error getting trunks uid and gid.";
   CHECK_EQ(getuid(), kRootUID) << "Trunks Daemon not initialized as root.";
-  chromeos::Minijail* minijail = chromeos::Minijail::GetInstance();
+  brillo::Minijail* minijail = brillo::Minijail::GetInstance();
   struct minijail* jail = minijail->New();
   minijail->DropRoot(jail, kTrunksUser, kTrunksGroup);
   minijail->UseSeccompFilter(jail, kTrunksSeccompPath);
@@ -67,10 +64,10 @@
 
 }  // namespace
 
-class TrunksDaemon : public chromeos::DBusServiceDaemon {
+class TrunksDaemon : public brillo::DBusServiceDaemon {
  public:
   explicit TrunksDaemon(trunks::CommandTransceiver* transceiver) :
-      chromeos::DBusServiceDaemon(trunks::kTrunksServiceName) {
+      brillo::DBusServiceDaemon(trunks::kTrunksServiceName) {
     transceiver_.reset(transceiver);
     background_thread_.reset(new base::Thread(kBackgroundThreadName));
     CHECK(background_thread_->Start());
@@ -115,7 +112,7 @@
 
 int main(int argc, char **argv) {
   base::CommandLine::Init(argc, argv);
-  chromeos::InitLog(chromeos::kLogToSyslog | chromeos::kLogToStderr);
+  brillo::InitLog(brillo::kLogToSyslog | brillo::kLogToStderr);
   base::CommandLine *cl = base::CommandLine::ForCurrentProcess();
   trunks::CommandTransceiver *transceiver;
   if (cl->HasSwitch("ftdi")) {