Update to build against libchrome-242728.
BUG=chromium:341521
CQ-DEPEND=CL:185787
TEST=`FEATURES=test emerge-{x86,amd64,arm}-generic cros_boot_mode`
Change-Id: I77b9638d6827aa4ecd85b24d3073774a4d1f9ea5
Reviewed-on: https://chromium-review.googlesource.com/185801
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
diff --git a/Makefile b/Makefile
index 0fd2676..3a50c8d 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@
# Pull in chromium os defaults
include common.mk
-BASE_VER ?= 180609
+BASE_VER ?= 242728
PC_DEPS = libchrome-$(BASE_VER)
PC_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PC_DEPS))
PC_LIBS := $(shell $(PKG_CONFIG) --libs $(PC_DEPS))
diff --git a/boot_mode_unittest.cc b/boot_mode_unittest.cc
index 922cc24..b852a22 100644
--- a/boot_mode_unittest.cc
+++ b/boot_mode_unittest.cc
@@ -8,14 +8,14 @@
#include <base/basictypes.h>
#include <base/file_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/stringprintf.h>
#include <gtest/gtest.h>
#include <string>
class BootModeTest : public ::testing::Test {
public:
void SetUp() {
- EXPECT_TRUE(file_util::CreateNewTempDirectory("", &temp_dir_));
+ EXPECT_TRUE(base::CreateNewTempDirectory("", &temp_dir_));
developer_switch_path_ = temp_dir_.value();
developer_switch_path_.append("/CHSW");
@@ -38,7 +38,7 @@
}
void TearDown() {
if (!temp_dir_.empty())
- file_util::Delete(temp_dir_, true);
+ base::DeleteFile(temp_dir_, true);
temp_dir_.clear();
}
@@ -48,24 +48,23 @@
// the active firmware number, and the |cmdline| is the /proc/cmdline
// that the "system" booted in.
void UpdateFiles(int chsw, int fw, const char *cmdline) {
- std::string data = StringPrintf("%d", chsw);
- EXPECT_EQ(
- file_util::WriteFile(FilePath(developer_switch_.platform_file_path()),
- data.c_str(),
- data.length()), data.length());
+ std::string data = base::StringPrintf("%d", chsw);
+ EXPECT_EQ(file_util::WriteFile(
+ base::FilePath(developer_switch_.platform_file_path()),
+ data.c_str(), data.length()),
+ data.length());
- data = StringPrintf("%d", fw);
- EXPECT_EQ(
- file_util::WriteFile(FilePath(active_main_firmware_.platform_file_path()),
- data.c_str(),
- data.length()), data.length());
+ data = base::StringPrintf("%d", fw);
+ EXPECT_EQ(file_util::WriteFile(
+ base::FilePath(active_main_firmware_.platform_file_path()),
+ data.c_str(), data.length()),
+ data.length());
data.assign(cmdline);
- EXPECT_EQ(
- file_util::WriteFile(FilePath(bootloader_type_.platform_file_path()),
- data.c_str(),
- data.length()), data.length());
-
+ EXPECT_EQ(file_util::WriteFile(
+ base::FilePath(bootloader_type_.platform_file_path()),
+ data.c_str(), data.length()),
+ data.length());
}
static const char *kUnsupportedText;
@@ -83,7 +82,7 @@
static const char *kCrosLegacy;
static const char *kCrosSecure;
protected:
- FilePath temp_dir_;
+ base::FilePath temp_dir_;
cros_boot_mode::BootMode boot_mode_;
cros_boot_mode::DeveloperSwitch developer_switch_;
std::string developer_switch_path_;
diff --git a/bootloader_type_unittest.cc b/bootloader_type_unittest.cc
index 39cfe29..fb64c2f 100644
--- a/bootloader_type_unittest.cc
+++ b/bootloader_type_unittest.cc
@@ -7,20 +7,20 @@
#include <base/basictypes.h>
#include <base/file_util.h>
-#include <base/stringprintf.h>
+#include <base/strings/stringprintf.h>
#include <gtest/gtest.h>
#include <string>
class BootloaderTypeTest : public ::testing::Test {
public:
void SetUp() {
- EXPECT_TRUE(file_util::CreateNewTempDirectory("", &temp_dir_));
+ EXPECT_TRUE(base::CreateNewTempDirectory("", &temp_dir_));
type_file_path_ = temp_dir_.value();
type_file_path_.append("cmdline");
type_.set_platform_file_path(type_file_path_.c_str());
}
void TearDown() {
- file_util::Delete(temp_dir_, true);
+ base::DeleteFile(temp_dir_, true);
}
void ExpectType(int type) {
@@ -35,16 +35,16 @@
}
protected:
std::string type_file_path_;
- FilePath temp_dir_;
+ base::FilePath temp_dir_;
cros_boot_mode::BootloaderType type_;
};
TEST_F(BootloaderTypeTest, ChromeOSBare) {
- std::string contents = StringPrintf("%s",
+ std::string contents = base::StringPrintf("%s",
cros_boot_mode::BootloaderType::kSupportedBootloaders[
cros_boot_mode::BootloaderType::kChromeOS]);
- EXPECT_EQ(file_util::WriteFile(FilePath(type_file_path_),
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(type_file_path_),
contents.c_str(), contents.length()),
contents.length());
type_.Initialize();
@@ -52,11 +52,11 @@
}
TEST_F(BootloaderTypeTest, ChromeOSSpaces) {
- std::string contents = StringPrintf(" %s ",
+ std::string contents = base::StringPrintf(" %s ",
cros_boot_mode::BootloaderType::kSupportedBootloaders[
cros_boot_mode::BootloaderType::kChromeOS]);
- EXPECT_EQ(file_util::WriteFile(FilePath(type_file_path_),
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(type_file_path_),
contents.c_str(), contents.length()),
contents.length());
type_.Initialize();
@@ -64,11 +64,11 @@
}
TEST_F(BootloaderTypeTest, NoBoundaries) {
- std::string contents = StringPrintf("x%sx",
+ std::string contents = base::StringPrintf("x%sx",
cros_boot_mode::BootloaderType::kSupportedBootloaders[
cros_boot_mode::BootloaderType::kChromeOS]);
- EXPECT_EQ(file_util::WriteFile(FilePath(type_file_path_),
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(type_file_path_),
contents.c_str(), contents.length()),
contents.length());
type_.Initialize();
@@ -76,11 +76,11 @@
}
TEST_F(BootloaderTypeTest, NoStartingBoundary) {
- std::string contents = StringPrintf("x%s",
+ std::string contents = base::StringPrintf("x%s",
cros_boot_mode::BootloaderType::kSupportedBootloaders[
cros_boot_mode::BootloaderType::kChromeOS]);
- EXPECT_EQ(file_util::WriteFile(FilePath(type_file_path_),
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(type_file_path_),
contents.c_str(), contents.length()),
contents.length());
type_.Initialize();
@@ -88,11 +88,11 @@
}
TEST_F(BootloaderTypeTest, NoTrailingBoundary) {
- std::string contents = StringPrintf("%sx",
+ std::string contents = base::StringPrintf("%sx",
cros_boot_mode::BootloaderType::kSupportedBootloaders[
cros_boot_mode::BootloaderType::kChromeOS]);
- EXPECT_EQ(file_util::WriteFile(FilePath(type_file_path_),
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(type_file_path_),
contents.c_str(), contents.length()),
contents.length());
type_.Initialize();
@@ -100,13 +100,13 @@
}
TEST_F(BootloaderTypeTest, FirstMatchInEnumOrderIsUsed) {
- std::string contents = StringPrintf(" %s %s ",
+ std::string contents = base::StringPrintf(" %s %s ",
cros_boot_mode::BootloaderType::kSupportedBootloaders[
cros_boot_mode::BootloaderType::kChromeOS],
cros_boot_mode::BootloaderType::kSupportedBootloaders[
cros_boot_mode::BootloaderType::kDebug]);
- EXPECT_EQ(file_util::WriteFile(FilePath(type_file_path_),
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(type_file_path_),
contents.c_str(), contents.length()),
contents.length());
type_.Initialize();
diff --git a/developer_switch_unittest.cc b/developer_switch_unittest.cc
index bb30fd2..eee37cd 100644
--- a/developer_switch_unittest.cc
+++ b/developer_switch_unittest.cc
@@ -15,14 +15,14 @@
class DeveloperSwitchTest : public ::testing::Test {
public:
void SetUp() {
- EXPECT_TRUE(file_util::CreateNewTempDirectory("", &temp_dir_));
+ EXPECT_TRUE(base::CreateNewTempDirectory("", &temp_dir_));
switch_file_path_ = temp_dir_.value();
switch_file_path_.append("chsw");
switch_.set_platform_file_path(switch_file_path_.c_str());
}
void TearDown() {
- file_util::Delete(temp_dir_, true);
+ base::DeleteFile(temp_dir_, true);
}
void ExpectPosition(int pos) {
@@ -36,49 +36,55 @@
}
protected:
std::string switch_file_path_;
- FilePath temp_dir_;
+ base::FilePath temp_dir_;
cros_boot_mode::DeveloperSwitch switch_;
};
TEST_F(DeveloperSwitchTest, Disabled) {
- EXPECT_EQ(file_util::WriteFile(FilePath(switch_file_path_), "0", 2), 2);
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(switch_file_path_), "0", 2), 2);
switch_.Initialize();
ExpectPosition(cros_boot_mode::PlatformSwitch::kDisabled);
}
TEST_F(DeveloperSwitchTest, DisabledWithOtherSwitches) {
- EXPECT_EQ(file_util::WriteFile(FilePath(switch_file_path_), "528", 4), 4);
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(switch_file_path_), "528", 4),
+ 4);
switch_.Initialize();
ExpectPosition(cros_boot_mode::PlatformSwitch::kDisabled);
}
TEST_F(DeveloperSwitchTest, Enabled) {
- EXPECT_EQ(file_util::WriteFile(FilePath(switch_file_path_), "32", 3), 3);
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(switch_file_path_), "32", 3),
+ 3);
switch_.Initialize();
ExpectPosition(cros_boot_mode::PlatformSwitch::kEnabled);
}
TEST_F(DeveloperSwitchTest, EnabledWithOtherSwitches) {
- EXPECT_EQ(file_util::WriteFile(FilePath(switch_file_path_), "544", 4), 4);
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(switch_file_path_), "544", 4),
+ 4);
switch_.Initialize();
ExpectPosition(cros_boot_mode::PlatformSwitch::kEnabled);
}
TEST_F(DeveloperSwitchTest, EnabledWithOtherSwitches2) {
- EXPECT_EQ(file_util::WriteFile(FilePath(switch_file_path_), "4128", 5), 5);
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(switch_file_path_), "4128", 5),
+ 5);
switch_.Initialize();
ExpectPosition(cros_boot_mode::PlatformSwitch::kEnabled);
}
TEST_F(DeveloperSwitchTest, EnabledWithOtherSwitches3) {
- EXPECT_EQ(file_util::WriteFile(FilePath(switch_file_path_), "65535", 6), 6);
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(switch_file_path_), "65535", 6),
+ 6);
switch_.Initialize();
ExpectPosition(cros_boot_mode::PlatformSwitch::kEnabled);
}
TEST_F(DeveloperSwitchTest, BadTruncationMakesUnsupported) {
- EXPECT_EQ(file_util::WriteFile(FilePath(switch_file_path_), "100000", 7), 7);
+ EXPECT_EQ(
+ file_util::WriteFile(base::FilePath(switch_file_path_), "100000", 7), 7);
switch_.Initialize();
ExpectPosition(cros_boot_mode::PlatformSwitch::kUnsupported);
}
@@ -89,13 +95,14 @@
}
TEST_F(DeveloperSwitchTest, UnsupportedPlatform) {
- EXPECT_EQ(file_util::WriteFile(FilePath(switch_file_path_), "-1", 3), 3);
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(switch_file_path_), "-1", 3),
+ 3);
switch_.Initialize();
ExpectPosition(cros_boot_mode::PlatformSwitch::kUnsupported);
}
TEST_F(DeveloperSwitchTest, EmptyFile) {
- EXPECT_EQ(file_util::WriteFile(FilePath(switch_file_path_), "", 0), 0);
+ EXPECT_EQ(file_util::WriteFile(base::FilePath(switch_file_path_), "", 0), 0);
switch_.Initialize();
ExpectPosition(cros_boot_mode::PlatformSwitch::kUnsupported);
}