system/core: Rename "chromeos" -> "brillo" in include paths and namespaces

libchromeos is transitioning to libbrillo and chromeos namespaces
and include directory is changing to brillo.

Bug: 24872993
Change-Id: I797613a38c7444a113f12e38366a424388477276
This commit is contained in:
Alex Vakulenko 2015-10-13 09:23:34 -07:00
parent cee44732e6
commit 74dc62460b
17 changed files with 77 additions and 77 deletions

View File

@ -35,8 +35,8 @@
#include <base/strings/string_split.h>
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
#include <chromeos/key_value_store.h>
#include <chromeos/process.h>
#include <brillo/key_value_store.h>
#include <brillo/process.h>
namespace {
@ -340,7 +340,7 @@ bool CrashCollector::CheckHasCapacity(const FilePath &crash_directory) {
bool CrashCollector::GetLogContents(const FilePath &config_path,
const std::string &exec_name,
const FilePath &output_file) {
chromeos::KeyValueStore store;
brillo::KeyValueStore store;
if (!store.Load(config_path)) {
LOG(INFO) << "Unable to read log configuration file "
<< config_path.value();
@ -351,7 +351,7 @@ bool CrashCollector::GetLogContents(const FilePath &config_path,
if (!store.GetString(exec_name, &command))
return false;
chromeos::ProcessImpl diag_process;
brillo::ProcessImpl diag_process;
diag_process.AddArg(kShellPath);
diag_process.AddStringOption("-c", command);
diag_process.RedirectOutput(output_file.value());

View File

@ -22,14 +22,14 @@
#include <base/files/file_util.h>
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
#include <chromeos/syslog_logging.h>
#include <brillo/syslog_logging.h>
#include <gtest/gtest.h>
#include "crash_collector.h"
using base::FilePath;
using base::StringPrintf;
using chromeos::FindLog;
using brillo::FindLog;
using ::testing::Invoke;
using ::testing::Return;
@ -54,7 +54,7 @@ class CrashCollectorTest : public ::testing::Test {
collector_.Initialize(CountCrash, IsMetrics);
test_dir_ = FilePath("test");
base::CreateDirectory(test_dir_);
chromeos::ClearLog();
brillo::ClearLog();
}
void TearDown() {
@ -208,7 +208,7 @@ TEST_F(CrashCollectorTest, MetaData) {
symlink(kMetaFileBasename,
meta_symlink_path.value().c_str()));
ASSERT_TRUE(base::PathExists(meta_symlink_path));
chromeos::ClearLog();
brillo::ClearLog();
collector_.WriteCrashMetaData(meta_symlink_path,
"kernel",
payload_file.value());
@ -221,7 +221,7 @@ TEST_F(CrashCollectorTest, MetaData) {
// Test target of dangling symlink is not created.
base::DeleteFile(meta_file, false);
ASSERT_FALSE(base::PathExists(meta_file));
chromeos::ClearLog();
brillo::ClearLog();
collector_.WriteCrashMetaData(meta_symlink_path, "kernel",
payload_file.value());
EXPECT_FALSE(base::PathExists(meta_file));

View File

@ -25,9 +25,9 @@
#include <base/strings/string_split.h>
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
#include <chromeos/flag_helper.h>
#include <chromeos/process.h>
#include <chromeos/syslog_logging.h>
#include <brillo/flag_helper.h>
#include <brillo/process.h>
#include <brillo/syslog_logging.h>
#include <metrics/metrics_library.h>
#include "kernel_collector.h"
@ -102,7 +102,7 @@ static void CountUserCrash() {
// Note: This will mean that the dbus-send process will become a zombie and
// reparent to init for reaping, but that's OK -- see above.
chromeos::ProcessImpl dbus_send;
brillo::ProcessImpl dbus_send;
dbus_send.AddArg("/system/bin/dbus-send");
dbus_send.AddArg("--type=signal");
dbus_send.AddArg("--system");
@ -183,10 +183,10 @@ static int HandleUserCrash(UserCollector *user_collector,
}
// Accumulate logs to help in diagnosing failures during user collection.
chromeos::LogToString(true);
brillo::LogToString(true);
// Handle the crash, get the name of the process from procfs.
bool handled = user_collector->HandleCrash(user, nullptr);
chromeos::LogToString(false);
brillo::LogToString(false);
if (!handled)
return 1;
return 0;
@ -198,9 +198,9 @@ static int HandleUdevCrash(UdevCollector *udev_collector,
CHECK(!udev_event.empty()) << "--udev= must be set";
// Accumulate logs to help in diagnosing failures during user collection.
chromeos::LogToString(true);
brillo::LogToString(true);
bool handled = udev_collector->HandleCrash(udev_event);
chromeos::LogToString(false);
brillo::LogToString(false);
if (!handled)
return 1;
return 0;
@ -209,9 +209,9 @@ static int HandleUdevCrash(UdevCollector *udev_collector,
static int HandleKernelWarning(KernelWarningCollector
*kernel_warning_collector) {
// Accumulate logs to help in diagnosing failures during collection.
chromeos::LogToString(true);
brillo::LogToString(true);
bool handled = kernel_warning_collector->Collect();
chromeos::LogToString(false);
brillo::LogToString(false);
if (!handled)
return 1;
return 0;
@ -278,9 +278,9 @@ int main(int argc, char *argv[]) {
OpenStandardFileDescriptors();
FilePath my_path = base::MakeAbsoluteFilePath(FilePath(argv[0]));
s_metrics_lib.Init();
chromeos::FlagHelper::Init(argc, argv, "Chromium OS Crash Reporter");
chromeos::OpenLog(my_path.BaseName().value().c_str(), true);
chromeos::InitLog(chromeos::kLogToSyslog);
brillo::FlagHelper::Init(argc, argv, "Chromium OS Crash Reporter");
brillo::OpenLog(my_path.BaseName().value().c_str(), true);
brillo::InitLog(brillo::kLogToSyslog);
KernelCollector kernel_collector;
kernel_collector.Initialize(CountKernelCrash, IsFeedbackAllowed);

View File

@ -17,7 +17,7 @@
#include <string>
#include <base/files/file_path.h>
#include <chromeos/key_value_store.h>
#include <brillo/key_value_store.h>
#include <gtest/gtest.h>
namespace {
@ -32,7 +32,7 @@ const char kChromeExecName[] = "chrome";
// Tests that the config file is parsable and that Chrome is listed.
TEST(CrashReporterLogsTest, ReadConfig) {
chromeos::KeyValueStore store;
brillo::KeyValueStore store;
ASSERT_TRUE(store.Load(base::FilePath(kConfigFile)));
std::string command;
EXPECT_TRUE(store.GetString(kChromeExecName, &command));

View File

@ -22,13 +22,13 @@
#include <base/files/scoped_temp_dir.h>
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
#include <chromeos/syslog_logging.h>
#include <brillo/syslog_logging.h>
#include <gtest/gtest.h>
using base::FilePath;
using base::StringPrintf;
using chromeos::FindLog;
using chromeos::GetLog;
using brillo::FindLog;
using brillo::GetLog;
namespace {
@ -78,7 +78,7 @@ class KernelCollectorTest : public ::testing::Test {
test_crash_directory_ = scoped_temp_dir_.path().Append("crash_directory");
ASSERT_TRUE(base::CreateDirectory(test_crash_directory_));
chromeos::ClearLog();
brillo::ClearLog();
}
FilePath test_kcrash_;
@ -282,7 +282,7 @@ TEST_F(KernelCollectorTest, CollectOK) {
ASSERT_EQ(1, s_crashes);
ASSERT_TRUE(FindLog("(handling)"));
static const char kNamePrefix[] = "Stored kcrash to ";
std::string log = chromeos::GetLog();
std::string log = brillo::GetLog();
size_t pos = log.find(kNamePrefix);
ASSERT_NE(std::string::npos, pos)
<< "Did not find string \"" << kNamePrefix << "\" in log: {\n"

View File

@ -28,8 +28,8 @@
#include <base/strings/string_tokenizer.h>
#include <base/strings/string_util.h>
#include <base/values.h>
#include <chromeos/daemons/dbus_daemon.h>
#include <chromeos/syslog_logging.h>
#include <brillo/daemons/dbus_daemon.h>
#include <brillo/syslog_logging.h>
#include "libcrosservice/dbus-proxies.h"
@ -111,7 +111,7 @@ std::vector<std::string> ParseProxyString(const std::string& input) {
// must be called, which blocks on the D-Bus call to Chrome. The call returns
// after either the timeout or the proxy has been resolved. The resolved
// proxies can then be accessed through the proxies() function.
class ProxyResolver : public chromeos::DBusDaemon {
class ProxyResolver : public brillo::DBusDaemon {
public:
ProxyResolver(const std::string& source_url,
const std::string& signal_interface,
@ -138,7 +138,7 @@ class ProxyResolver : public chromeos::DBusDaemon {
timeout_callback_.callback(),
timeout_);
return chromeos::DBusDaemon::Run();
return brillo::DBusDaemon::Run();
}
protected:
@ -162,7 +162,7 @@ class ProxyResolver : public chromeos::DBusDaemon {
return;
}
chromeos::ErrorPtr error;
brillo::ErrorPtr error;
call_proxy_->ResolveNetworkProxy(source_url_,
signal_interface_,
signal_name_,
@ -189,7 +189,7 @@ class ProxyResolver : public chromeos::DBusDaemon {
}
int OnInit() override {
int return_code = chromeos::DBusDaemon::OnInit();
int return_code = brillo::DBusDaemon::OnInit();
if (return_code != EX_OK)
return return_code;
@ -276,13 +276,13 @@ int main(int argc, char *argv[]) {
}
// Default to logging to syslog.
int init_flags = chromeos::kLogToSyslog;
int init_flags = brillo::kLogToSyslog;
// Log to stderr if a TTY (and "-quiet" wasn't passed), or if "-verbose"
// was passed.
if ((!quiet && isatty(STDERR_FILENO)) || verbose)
init_flags |= chromeos::kLogToStderr;
chromeos::InitLog(init_flags);
init_flags |= brillo::kLogToStderr;
brillo::InitLog(init_flags);
std::string url;
base::CommandLine::StringVector urls = cl->GetArgs();

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include <chromeos/test_helpers.h>
#include <brillo/test_helpers.h>
#include <gtest/gtest.h>
int main(int argc, char** argv) {

View File

@ -27,7 +27,7 @@
#include <base/strings/string_split.h>
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
#include <chromeos/process.h>
#include <brillo/process.h>
using base::FilePath;
@ -120,7 +120,7 @@ bool UdevCollector::ProcessUdevCrashLogs(const FilePath& crash_directory,
}
// Compress the output using gzip.
chromeos::ProcessImpl gzip_process;
brillo::ProcessImpl gzip_process;
gzip_process.AddArg(kGzipPath);
gzip_process.AddArg(crash_path.value());
int process_result = gzip_process.Run();

View File

@ -18,7 +18,7 @@
#include <base/files/file_util.h>
#include <base/files/scoped_temp_dir.h>
#include <base/strings/stringprintf.h>
#include <chromeos/syslog_logging.h>
#include <brillo/syslog_logging.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@ -141,7 +141,7 @@ class UdevCollectorTest : public ::testing::Test {
kLogConfigFileContents,
strlen(kLogConfigFileContents)));
chromeos::ClearLog();
brillo::ClearLog();
}
UdevCollectorMock collector_;

View File

@ -20,12 +20,12 @@
#include <base/files/file_util.h>
#include <base/strings/string_util.h>
#include <chromeos/syslog_logging.h>
#include <brillo/syslog_logging.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
using base::FilePath;
using ::chromeos::FindLog;
using ::brillo::FindLog;
namespace {
@ -65,7 +65,7 @@ class UncleanShutdownCollectorTest : public ::testing::Test {
base::DeleteFile(test_unclean_, true);
// Set up an alternate power manager state file as well
collector_.powerd_suspended_file_ = FilePath(kTestSuspended);
chromeos::ClearLog();
brillo::ClearLog();
}
protected:

View File

@ -37,9 +37,9 @@
#include <base/strings/string_split.h>
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
#include "chromeos/osrelease_reader.h"
#include <chromeos/process.h>
#include <chromeos/syslog_logging.h>
#include <brillo/osrelease_reader.h>
#include <brillo/process.h>
#include <brillo/syslog_logging.h>
#include <cutils/properties.h>
#include <private/android_filesystem_config.h>
@ -190,7 +190,7 @@ void UserCollector::EnqueueCollectionErrorLog(pid_t pid,
AddCrashMetaData("sig", kCollectionErrorSignature);
AddCrashMetaData("error_type", GetErrorTypeSignature(error_type));
std::string dump_basename = FormatDumpBasename(exec, time(nullptr), pid);
std::string error_log = chromeos::GetLog();
std::string error_log = brillo::GetLog();
FilePath diag_log_path = GetCrashPath(crash_path, dump_basename, "diaglog");
if (GetLogContents(FilePath(log_config_path_), kCollectionErrorSignature,
diag_log_path)) {
@ -370,7 +370,7 @@ bool UserCollector::RunCoreToMinidump(const FilePath &core_path,
const FilePath &minidump_path,
const FilePath &temp_directory) {
FilePath output_path = temp_directory.Append("output");
chromeos::ProcessImpl core2md;
brillo::ProcessImpl core2md;
core2md.RedirectOutput(output_path.value());
core2md.AddArg(kCoreToMinidumpConverterPath);
core2md.AddArg(core_path.value());
@ -514,7 +514,7 @@ UserCollector::ErrorType UserCollector::ConvertAndEnqueueCrash(
property_get(kProductIDProperty, value, "undefined");
AddCrashMetaUploadData("prod", value);
chromeos::OsReleaseReader reader;
brillo::OsReleaseReader reader;
reader.Load();
std::string bdk_version = "undefined";
if (!reader.GetString(kBdkVersionKey, &bdk_version)) {

View File

@ -23,12 +23,12 @@
#include <base/files/file_util.h>
#include <base/files/scoped_temp_dir.h>
#include <base/strings/string_split.h>
#include <chromeos/syslog_logging.h>
#include <brillo/syslog_logging.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
using base::FilePath;
using chromeos::FindLog;
using brillo::FindLog;
namespace {
@ -73,7 +73,7 @@ class UserCollectorTest : public ::testing::Test {
base::DeleteFile(FilePath("test"), true);
mkdir("test", 0777);
pid_ = getpid();
chromeos::ClearLog();
brillo::ClearLog();
}
protected:
@ -222,7 +222,7 @@ TEST_F(UserCollectorTest, GetExecutableBaseNameFromPid) {
"GetSymlinkTarget failed - Path /proc/0 DirectoryExists: 0"));
EXPECT_TRUE(FindLog("stat /proc/0/exe failed: -1 2"));
chromeos::ClearLog();
brillo::ClearLog();
pid_t my_pid = getpid();
EXPECT_TRUE(collector_.GetExecutableBaseNameFromPid(my_pid, &base_name));
EXPECT_FALSE(FindLog("Readlink failed"));

View File

@ -140,7 +140,7 @@ int MetricsDaemon::Run() {
version_cumulative_cpu_use_->Set(0);
}
return chromeos::DBusDaemon::Run();
return brillo::DBusDaemon::Run();
}
void MetricsDaemon::RunUploaderTest() {
@ -242,8 +242,8 @@ void MetricsDaemon::Init(bool testing,
}
int MetricsDaemon::OnInit() {
int return_code = dbus_enabled_ ? chromeos::DBusDaemon::OnInit() :
chromeos::Daemon::OnInit();
int return_code = dbus_enabled_ ? brillo::DBusDaemon::OnInit() :
brillo::Daemon::OnInit();
if (return_code != EX_OK)
return return_code;
@ -326,7 +326,7 @@ void MetricsDaemon::OnShutdown(int* return_code) {
<< error.name << ": " << error.message;
}
}
chromeos::DBusDaemon::OnShutdown(return_code);
brillo::DBusDaemon::OnShutdown(return_code);
}
void MetricsDaemon::OnEnableMetrics(const std::weak_ptr<weaved::Command>& cmd) {
@ -368,7 +368,7 @@ void MetricsDaemon::UpdateWeaveState() {
if (!device_)
return;
chromeos::VariantDictionary state_change{
brillo::VariantDictionary state_change{
{ "_metrics._AnalyticsReportingState",
metrics_lib_->AreMetricsEnabled() ? "enabled" : "disabled" }
};

View File

@ -26,7 +26,7 @@
#include <base/files/file_path.h>
#include <base/memory/scoped_ptr.h>
#include <base/time/time.h>
#include <chromeos/daemons/dbus_daemon.h>
#include <brillo/daemons/dbus_daemon.h>
#include <libweaved/command.h>
#include <libweaved/device.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
@ -39,7 +39,7 @@
using chromeos_metrics::PersistentInteger;
class MetricsDaemon : public chromeos::DBusDaemon {
class MetricsDaemon : public brillo::DBusDaemon {
public:
MetricsDaemon();
~MetricsDaemon();

View File

@ -18,8 +18,8 @@
#include <base/command_line.h>
#include <base/logging.h>
#include <base/strings/string_util.h>
#include <chromeos/flag_helper.h>
#include <chromeos/syslog_logging.h>
#include <brillo/flag_helper.h>
#include <brillo/syslog_logging.h>
#include <rootdev.h>
#include "constants.h"
@ -79,11 +79,11 @@ int main(int argc, char** argv) {
metrics::kMetricsDirectory,
"Root of the configuration files (testing only)");
chromeos::FlagHelper::Init(argc, argv, "Chromium OS Metrics Daemon");
brillo::FlagHelper::Init(argc, argv, "Chromium OS Metrics Daemon");
// Also log to stderr when not running as daemon.
chromeos::InitLog(chromeos::kLogToSyslog | chromeos::kLogHeader |
(FLAGS_daemon ? 0 : chromeos::kLogToStderr));
brillo::InitLog(brillo::kLogToSyslog | brillo::kLogHeader |
(FLAGS_daemon ? 0 : brillo::kLogToStderr));
if (FLAGS_daemon && daemon(0, 0) != 0) {
return errno;

View File

@ -20,7 +20,7 @@
#include <base/files/file_util.h>
#include <base/files/scoped_temp_dir.h>
#include <base/strings/string_number_conversions.h>
#include <chromeos/flag_helper.h>
#include <brillo/flag_helper.h>
#include <gtest/gtest.h>
#include "constants.h"
@ -43,7 +43,7 @@ using chromeos_metrics::PersistentIntegerMock;
class MetricsDaemonTest : public testing::Test {
protected:
virtual void SetUp() {
chromeos::FlagHelper::Init(0, nullptr, "");
brillo::FlagHelper::Init(0, nullptr, "");
EXPECT_TRUE(temp_dir_.CreateUniqueTempDir());
scaling_max_freq_path_ = temp_dir_.path().Append("scaling_max");
cpu_max_freq_path_ = temp_dir_.path().Append("cpu_freq_max");

View File

@ -20,8 +20,8 @@
#include <base/logging.h>
#include <base/strings/string_number_conversions.h>
#include <chromeos/http/http_utils.h>
#include <chromeos/mime_utils.h>
#include <brillo/http/http_utils.h>
#include <brillo/mime_utils.h>
HttpSender::HttpSender(const std::string server_url)
: server_url_(server_url) {}
@ -31,14 +31,14 @@ bool HttpSender::Send(const std::string& content,
const std::string hash =
base::HexEncode(content_hash.data(), content_hash.size());
chromeos::http::HeaderList headers = {{"X-Chrome-UMA-Log-SHA1", hash}};
chromeos::ErrorPtr error;
auto response = chromeos::http::PostTextAndBlock(
brillo::http::HeaderList headers = {{"X-Chrome-UMA-Log-SHA1", hash}};
brillo::ErrorPtr error;
auto response = brillo::http::PostTextAndBlock(
server_url_,
content,
chromeos::mime::application::kWwwFormUrlEncoded,
brillo::mime::application::kWwwFormUrlEncoded,
headers,
chromeos::http::Transport::CreateDefault(),
brillo::http::Transport::CreateDefault(),
&error);
if (!response || response->ExtractDataAsString() != "OK") {
if (error) {