diff options
28 files changed, 123 insertions, 106 deletions
diff --git a/common/http_fetcher_unittest.cc b/common/http_fetcher_unittest.cc index dcc15736..eb85f688 100644 --- a/common/http_fetcher_unittest.cc +++ b/common/http_fetcher_unittest.cc @@ -32,7 +32,6 @@ #include <base/strings/string_util.h> #include <base/strings/stringprintf.h> #include <base/time/time.h> -#include <brillo/bind_lambda.h> #include <brillo/message_loops/base_message_loop.h> #include <brillo/message_loops/message_loop.h> #include <brillo/message_loops/message_loop_utils.h> diff --git a/common/hwid_override_unittest.cc b/common/hwid_override_unittest.cc index 26ef30a9..35e64382 100644 --- a/common/hwid_override_unittest.cc +++ b/common/hwid_override_unittest.cc @@ -32,7 +32,7 @@ class HwidOverrideTest : public ::testing::Test { void SetUp() override { ASSERT_TRUE(tempdir_.CreateUniqueTempDir()); - ASSERT_TRUE(base::CreateDirectory(tempdir_.path().Append("etc"))); + ASSERT_TRUE(base::CreateDirectory(tempdir_.GetPath().Append("etc"))); } protected: @@ -46,22 +46,24 @@ TEST_F(HwidOverrideTest, ReadGood) { std::string expected_hwid("expected"); std::string keyval(HwidOverride::kHwidOverrideKey); keyval += ("=" + expected_hwid); - ASSERT_EQ(base::WriteFile(tempdir_.path().Append("etc/lsb-release"), - keyval.c_str(), keyval.length()), + ASSERT_EQ(base::WriteFile(tempdir_.GetPath().Append("etc/lsb-release"), + keyval.c_str(), + keyval.length()), static_cast<int>(keyval.length())); - EXPECT_EQ(expected_hwid, HwidOverride::Read(tempdir_.path())); + EXPECT_EQ(expected_hwid, HwidOverride::Read(tempdir_.GetPath())); } TEST_F(HwidOverrideTest, ReadNothing) { std::string keyval("SOMETHING_ELSE=UNINTERESTING"); - ASSERT_EQ(base::WriteFile(tempdir_.path().Append("etc/lsb-release"), - keyval.c_str(), keyval.length()), + ASSERT_EQ(base::WriteFile(tempdir_.GetPath().Append("etc/lsb-release"), + keyval.c_str(), + keyval.length()), static_cast<int>(keyval.length())); - EXPECT_EQ(std::string(), HwidOverride::Read(tempdir_.path())); + EXPECT_EQ(std::string(), HwidOverride::Read(tempdir_.GetPath())); } TEST_F(HwidOverrideTest, ReadFailure) { - EXPECT_EQ(std::string(), HwidOverride::Read(tempdir_.path())); + EXPECT_EQ(std::string(), HwidOverride::Read(tempdir_.GetPath())); } } // namespace chromeos_update_engine diff --git a/common/prefs_unittest.cc b/common/prefs_unittest.cc index 73ceb000..aa2eb043 100644 --- a/common/prefs_unittest.cc +++ b/common/prefs_unittest.cc @@ -44,7 +44,7 @@ class PrefsTest : public ::testing::Test { protected: void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - prefs_dir_ = temp_dir_.path(); + prefs_dir_ = temp_dir_.GetPath(); ASSERT_TRUE(prefs_.Init(prefs_dir_)); } diff --git a/common/subprocess_unittest.cc b/common/subprocess_unittest.cc index cbc9a85f..c8996db5 100644 --- a/common/subprocess_unittest.cc +++ b/common/subprocess_unittest.cc @@ -32,7 +32,6 @@ #include <base/strings/string_util.h> #include <base/strings/stringprintf.h> #include <base/time/time.h> -#include <brillo/bind_lambda.h> #include <brillo/message_loops/base_message_loop.h> #include <brillo/message_loops/message_loop.h> #include <brillo/message_loops/message_loop_utils.h> @@ -225,7 +224,7 @@ void CallbackBad(int return_code, const string& output) { TEST_F(SubprocessTest, CancelTest) { base::ScopedTempDir tempdir; ASSERT_TRUE(tempdir.CreateUniqueTempDir()); - string fifo_path = tempdir.path().Append("fifo").value(); + string fifo_path = tempdir.GetPath().Append("fifo").value(); EXPECT_EQ(0, mkfifo(fifo_path.c_str(), 0666)); // Start a process, make sure it is running and try to cancel it. We write diff --git a/common/test_utils.cc b/common/test_utils.cc index e4102830..85f78f90 100644 --- a/common/test_utils.cc +++ b/common/test_utils.cc @@ -256,7 +256,7 @@ ScopedLoopMounter::ScopedLoopMounter(const string& file_path, string* mnt_path, unsigned long flags) { // NOLINT - long EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); - *mnt_path = temp_dir_.path().value(); + *mnt_path = temp_dir_.GetPath().value(); string loop_dev; loop_binder_.reset( diff --git a/common/utils_unittest.cc b/common/utils_unittest.cc index 6e9a9114..62f9f6cb 100644 --- a/common/utils_unittest.cc +++ b/common/utils_unittest.cc @@ -100,11 +100,11 @@ TEST(UtilsTest, ErrnoNumberAsStringTest) { TEST(UtilsTest, IsSymlinkTest) { base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - string temp_file = temp_dir.path().Append("temp-file").value(); + string temp_file = temp_dir.GetPath().Append("temp-file").value(); EXPECT_TRUE(utils::WriteFile(temp_file.c_str(), "", 0)); - string temp_symlink = temp_dir.path().Append("temp-symlink").value(); + string temp_symlink = temp_dir.GetPath().Append("temp-symlink").value(); EXPECT_EQ(0, symlink(temp_file.c_str(), temp_symlink.c_str())); - EXPECT_FALSE(utils::IsSymlink(temp_dir.path().value().c_str())); + EXPECT_FALSE(utils::IsSymlink(temp_dir.GetPath().value().c_str())); EXPECT_FALSE(utils::IsSymlink(temp_file.c_str())); EXPECT_TRUE(utils::IsSymlink(temp_symlink.c_str())); EXPECT_FALSE(utils::IsSymlink("/non/existent/path")); @@ -303,8 +303,9 @@ TEST(UtilsTest, TimeFromStructTimespecTest) { base::Time::Exploded exploded = (base::Time::Exploded) { .year = 2001, .month = 9, .day_of_week = 0, .day_of_month = 9, .hour = 1, .minute = 46, .second = 40, .millisecond = 42}; - EXPECT_EQ(base::Time::FromUTCExploded(exploded), - utils::TimeFromStructTimespec(&ts)); + base::Time time; + EXPECT_TRUE(base::Time::FromUTCExploded(exploded, &time)); + EXPECT_EQ(time, utils::TimeFromStructTimespec(&ts)); } TEST(UtilsTest, DecodeAndStoreBase64String) { @@ -478,23 +479,23 @@ TEST(UtilsTest, RunAsRootUnmountFilesystemBusyFailureTest) { test_utils::ScopedLoopbackDeviceBinder loop_binder( tmp_image, true, &loop_dev); - EXPECT_FALSE(utils::IsMountpoint(mnt_dir.path().value())); + EXPECT_FALSE(utils::IsMountpoint(mnt_dir.GetPath().value())); // This is the actual test part. While we hold a file descriptor open for the // mounted filesystem, umount should still succeed. EXPECT_TRUE(utils::MountFilesystem( - loop_dev, mnt_dir.path().value(), MS_RDONLY, "ext4", "")); + loop_dev, mnt_dir.GetPath().value(), MS_RDONLY, "ext4", "")); // Verify the directory is a mount point now. - EXPECT_TRUE(utils::IsMountpoint(mnt_dir.path().value())); + EXPECT_TRUE(utils::IsMountpoint(mnt_dir.GetPath().value())); - string target_file = mnt_dir.path().Append("empty-file").value(); + string target_file = mnt_dir.GetPath().Append("empty-file").value(); int fd = HANDLE_EINTR(open(target_file.c_str(), O_RDONLY)); EXPECT_GE(fd, 0); - EXPECT_TRUE(utils::UnmountFilesystem(mnt_dir.path().value())); + EXPECT_TRUE(utils::UnmountFilesystem(mnt_dir.GetPath().value())); // The filesystem should be already unmounted at this point. - EXPECT_FALSE(utils::IsMountpoint(mnt_dir.path().value())); + EXPECT_FALSE(utils::IsMountpoint(mnt_dir.GetPath().value())); IGNORE_EINTR(close(fd)); // The filesystem was already unmounted so this call should fail. - EXPECT_FALSE(utils::UnmountFilesystem(mnt_dir.path().value())); + EXPECT_FALSE(utils::UnmountFilesystem(mnt_dir.GetPath().value())); } TEST(UtilsTest, IsMountpointTest) { @@ -503,7 +504,7 @@ TEST(UtilsTest, IsMountpointTest) { base::ScopedTempDir mnt_dir; EXPECT_TRUE(mnt_dir.CreateUniqueTempDir()); - EXPECT_FALSE(utils::IsMountpoint(mnt_dir.path().value())); + EXPECT_FALSE(utils::IsMountpoint(mnt_dir.GetPath().value())); base::FilePath file; EXPECT_TRUE(base::CreateTemporaryFile(&file)); diff --git a/common_service.cc b/common_service.cc index 370587b2..9f3b862a 100644 --- a/common_service.cc +++ b/common_service.cc @@ -19,10 +19,10 @@ #include <set> #include <string> +#include <base/bind.h> #include <base/location.h> #include <base/logging.h> #include <base/strings/stringprintf.h> -#include <brillo/bind_lambda.h> #include <brillo/message_loops/message_loop.h> #include <brillo/strings/string_utils.h> #include <policy/device_policy.h> diff --git a/connection_manager.cc b/connection_manager.cc index f72d9e84..d15faf07 100644 --- a/connection_manager.cc +++ b/connection_manager.cc @@ -73,7 +73,7 @@ bool ConnectionManager::IsUpdateAllowedOver( if (device_policy->GetAllowedConnectionTypesForUpdate(&allowed_types)) { // The update setting is enforced by the device policy. - if (!ContainsKey(allowed_types, shill::kTypeCellular)) { + if (!base::ContainsKey(allowed_types, shill::kTypeCellular)) { LOG(INFO) << "Disabling updates over cellular connection as it's not " "allowed in the device policy."; return false; diff --git a/fake_p2p_manager_configuration.h b/fake_p2p_manager_configuration.h index 1bc1dc82..c1cf4f2d 100644 --- a/fake_p2p_manager_configuration.h +++ b/fake_p2p_manager_configuration.h @@ -37,9 +37,7 @@ class FakeP2PManagerConfiguration : public P2PManager::Configuration { } // P2PManager::Configuration override - base::FilePath GetP2PDir() override { - return p2p_dir_.path(); - } + base::FilePath GetP2PDir() override { return p2p_dir_.GetPath(); } // P2PManager::Configuration override std::vector<std::string> GetInitctlArgs(bool is_start) override { diff --git a/hardware_chromeos_unittest.cc b/hardware_chromeos_unittest.cc index a6bad54c..162dec4b 100644 --- a/hardware_chromeos_unittest.cc +++ b/hardware_chromeos_unittest.cc @@ -37,21 +37,22 @@ class HardwareChromeOSTest : public ::testing::Test { void SetUp() override { ASSERT_TRUE(root_dir_.CreateUniqueTempDir()); } void WriteStatefulConfig(const string& config) { - base::FilePath kFile(root_dir_.path().value() + kStatefulPartition + + base::FilePath kFile(root_dir_.GetPath().value() + kStatefulPartition + "/etc/update_manager.conf"); ASSERT_TRUE(base::CreateDirectory(kFile.DirName())); ASSERT_TRUE(WriteFileString(kFile.value(), config)); } void WriteRootfsConfig(const string& config) { - base::FilePath kFile(root_dir_.path().value() + "/etc/update_manager.conf"); + base::FilePath kFile(root_dir_.GetPath().value() + + "/etc/update_manager.conf"); ASSERT_TRUE(base::CreateDirectory(kFile.DirName())); ASSERT_TRUE(WriteFileString(kFile.value(), config)); } // Helper method to call HardwareChromeOS::LoadConfig with the test directory. void CallLoadConfig(bool normal_mode) { - hardware_.LoadConfig(root_dir_.path().value(), normal_mode); + hardware_.LoadConfig(root_dir_.GetPath().value(), normal_mode); } HardwareChromeOS hardware_; diff --git a/image_properties_chromeos_unittest.cc b/image_properties_chromeos_unittest.cc index 12c20396..d9ed6883 100644 --- a/image_properties_chromeos_unittest.cc +++ b/image_properties_chromeos_unittest.cc @@ -36,10 +36,10 @@ class ImagePropertiesTest : public ::testing::Test { void SetUp() override { // Create a uniquely named test directory. ASSERT_TRUE(tempdir_.CreateUniqueTempDir()); - EXPECT_TRUE(base::CreateDirectory(tempdir_.path().Append("etc"))); - EXPECT_TRUE(base::CreateDirectory( - base::FilePath(tempdir_.path().value() + kStatefulPartition + "/etc"))); - test::SetImagePropertiesRootPrefix(tempdir_.path().value().c_str()); + EXPECT_TRUE(base::CreateDirectory(tempdir_.GetPath().Append("etc"))); + EXPECT_TRUE(base::CreateDirectory(base::FilePath( + tempdir_.GetPath().value() + kStatefulPartition + "/etc"))); + test::SetImagePropertiesRootPrefix(tempdir_.GetPath().value().c_str()); SetLockDown(false); } @@ -54,12 +54,13 @@ class ImagePropertiesTest : public ::testing::Test { }; TEST_F(ImagePropertiesTest, SimpleTest) { - ASSERT_TRUE(WriteFileString(tempdir_.path().Append("etc/lsb-release").value(), - "CHROMEOS_RELEASE_BOARD=arm-generic\n" - "CHROMEOS_RELEASE_FOO=bar\n" - "CHROMEOS_RELEASE_VERSION=0.2.2.3\n" - "CHROMEOS_RELEASE_TRACK=dev-channel\n" - "CHROMEOS_AUSERVER=http://www.google.com")); + ASSERT_TRUE( + WriteFileString(tempdir_.GetPath().Append("etc/lsb-release").value(), + "CHROMEOS_RELEASE_BOARD=arm-generic\n" + "CHROMEOS_RELEASE_FOO=bar\n" + "CHROMEOS_RELEASE_VERSION=0.2.2.3\n" + "CHROMEOS_RELEASE_TRACK=dev-channel\n" + "CHROMEOS_AUSERVER=http://www.google.com")); ImageProperties props = LoadImageProperties(&fake_system_state_); EXPECT_EQ("arm-generic", props.board); EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", props.product_id); @@ -70,7 +71,7 @@ TEST_F(ImagePropertiesTest, SimpleTest) { TEST_F(ImagePropertiesTest, AppIDTest) { ASSERT_TRUE(WriteFileString( - tempdir_.path().Append("etc/lsb-release").value(), + tempdir_.GetPath().Append("etc/lsb-release").value(), "CHROMEOS_RELEASE_APPID={58c35cef-9d30-476e-9098-ce20377d535d}")); ImageProperties props = LoadImageProperties(&fake_system_state_); EXPECT_EQ("{58c35cef-9d30-476e-9098-ce20377d535d}", props.product_id); @@ -78,7 +79,7 @@ TEST_F(ImagePropertiesTest, AppIDTest) { TEST_F(ImagePropertiesTest, ConfusingReleaseTest) { ASSERT_TRUE( - WriteFileString(tempdir_.path().Append("etc/lsb-release").value(), + WriteFileString(tempdir_.GetPath().Append("etc/lsb-release").value(), "CHROMEOS_RELEASE_FOO=CHROMEOS_RELEASE_VERSION=1.2.3.4\n" "CHROMEOS_RELEASE_VERSION=0.2.2.3")); ImageProperties props = LoadImageProperties(&fake_system_state_); @@ -91,13 +92,14 @@ TEST_F(ImagePropertiesTest, MissingVersionTest) { } TEST_F(ImagePropertiesTest, OverrideTest) { - ASSERT_TRUE(WriteFileString(tempdir_.path().Append("etc/lsb-release").value(), - "CHROMEOS_RELEASE_BOARD=arm-generic\n" - "CHROMEOS_RELEASE_FOO=bar\n" - "CHROMEOS_RELEASE_TRACK=dev-channel\n" - "CHROMEOS_AUSERVER=http://www.google.com")); + ASSERT_TRUE( + WriteFileString(tempdir_.GetPath().Append("etc/lsb-release").value(), + "CHROMEOS_RELEASE_BOARD=arm-generic\n" + "CHROMEOS_RELEASE_FOO=bar\n" + "CHROMEOS_RELEASE_TRACK=dev-channel\n" + "CHROMEOS_AUSERVER=http://www.google.com")); ASSERT_TRUE(WriteFileString( - tempdir_.path().value() + kStatefulPartition + "/etc/lsb-release", + tempdir_.GetPath().value() + kStatefulPartition + "/etc/lsb-release", "CHROMEOS_RELEASE_BOARD=x86-generic\n" "CHROMEOS_RELEASE_TRACK=beta-channel\n" "CHROMEOS_AUSERVER=https://www.google.com")); @@ -111,13 +113,14 @@ TEST_F(ImagePropertiesTest, OverrideTest) { } TEST_F(ImagePropertiesTest, OverrideLockDownTest) { - ASSERT_TRUE(WriteFileString(tempdir_.path().Append("etc/lsb-release").value(), - "CHROMEOS_RELEASE_BOARD=arm-generic\n" - "CHROMEOS_RELEASE_FOO=bar\n" - "CHROMEOS_RELEASE_TRACK=dev-channel\n" - "CHROMEOS_AUSERVER=https://www.google.com")); + ASSERT_TRUE( + WriteFileString(tempdir_.GetPath().Append("etc/lsb-release").value(), + "CHROMEOS_RELEASE_BOARD=arm-generic\n" + "CHROMEOS_RELEASE_FOO=bar\n" + "CHROMEOS_RELEASE_TRACK=dev-channel\n" + "CHROMEOS_AUSERVER=https://www.google.com")); ASSERT_TRUE(WriteFileString( - tempdir_.path().value() + kStatefulPartition + "/etc/lsb-release", + tempdir_.GetPath().value() + kStatefulPartition + "/etc/lsb-release", "CHROMEOS_RELEASE_BOARD=x86-generic\n" "CHROMEOS_RELEASE_TRACK=stable-channel\n" "CHROMEOS_AUSERVER=http://www.google.com")); @@ -132,32 +135,35 @@ TEST_F(ImagePropertiesTest, OverrideLockDownTest) { } TEST_F(ImagePropertiesTest, BoardAppIdUsedForNonCanaryChannelTest) { - ASSERT_TRUE(WriteFileString(tempdir_.path().Append("etc/lsb-release").value(), - "CHROMEOS_RELEASE_APPID=r\n" - "CHROMEOS_BOARD_APPID=b\n" - "CHROMEOS_CANARY_APPID=c\n" - "CHROMEOS_RELEASE_TRACK=stable-channel\n")); + ASSERT_TRUE( + WriteFileString(tempdir_.GetPath().Append("etc/lsb-release").value(), + "CHROMEOS_RELEASE_APPID=r\n" + "CHROMEOS_BOARD_APPID=b\n" + "CHROMEOS_CANARY_APPID=c\n" + "CHROMEOS_RELEASE_TRACK=stable-channel\n")); ImageProperties props = LoadImageProperties(&fake_system_state_); EXPECT_EQ("stable-channel", props.current_channel); EXPECT_EQ("b", props.product_id); } TEST_F(ImagePropertiesTest, CanaryAppIdUsedForCanaryChannelTest) { - ASSERT_TRUE(WriteFileString(tempdir_.path().Append("etc/lsb-release").value(), - "CHROMEOS_RELEASE_APPID=r\n" - "CHROMEOS_BOARD_APPID=b\n" - "CHROMEOS_CANARY_APPID=c\n" - "CHROMEOS_RELEASE_TRACK=canary-channel\n")); + ASSERT_TRUE( + WriteFileString(tempdir_.GetPath().Append("etc/lsb-release").value(), + "CHROMEOS_RELEASE_APPID=r\n" + "CHROMEOS_BOARD_APPID=b\n" + "CHROMEOS_CANARY_APPID=c\n" + "CHROMEOS_RELEASE_TRACK=canary-channel\n")); ImageProperties props = LoadImageProperties(&fake_system_state_); EXPECT_EQ("canary-channel", props.current_channel); EXPECT_EQ("c", props.canary_product_id); } TEST_F(ImagePropertiesTest, ReleaseAppIdUsedAsDefaultTest) { - ASSERT_TRUE(WriteFileString(tempdir_.path().Append("etc/lsb-release").value(), - "CHROMEOS_RELEASE_APPID=r\n" - "CHROMEOS_CANARY_APPID=c\n" - "CHROMEOS_RELEASE_TRACK=stable-channel\n")); + ASSERT_TRUE( + WriteFileString(tempdir_.GetPath().Append("etc/lsb-release").value(), + "CHROMEOS_RELEASE_APPID=r\n" + "CHROMEOS_CANARY_APPID=c\n" + "CHROMEOS_RELEASE_TRACK=stable-channel\n")); ImageProperties props = LoadImageProperties(&fake_system_state_); EXPECT_EQ("stable-channel", props.current_channel); EXPECT_EQ("r", props.product_id); diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc index 03982813..a189b52a 100644 --- a/omaha_request_action_unittest.cc +++ b/omaha_request_action_unittest.cc @@ -2108,7 +2108,7 @@ TEST_F(OmahaRequestActionTest, TestUpdateFirstSeenAtGetsPersistedFirstTime) { params.set_update_check_count_wait_enabled(false); Time arbitrary_date; - Time::FromString("6/4/1989", &arbitrary_date); + ASSERT_TRUE(Time::FromString("6/4/1989", &arbitrary_date)); fake_system_state_.fake_clock()->SetWallclockTime(arbitrary_date); ASSERT_FALSE(TestUpdateCheck(¶ms, fake_update_response_.GetUpdateResponse(), @@ -2149,8 +2149,8 @@ TEST_F(OmahaRequestActionTest, TestUpdateFirstSeenAtGetsUsedIfAlreadyPresent) { params.set_update_check_count_wait_enabled(false); Time t1, t2; - Time::FromString("1/1/2012", &t1); - Time::FromString("1/3/2012", &t2); + ASSERT_TRUE(Time::FromString("1/1/2012", &t1)); + ASSERT_TRUE(Time::FromString("1/3/2012", &t2)); ASSERT_TRUE( fake_prefs_.SetInt64(kPrefsUpdateFirstSeenAt, t1.ToInternalValue())); fake_system_state_.fake_clock()->SetWallclockTime(t2); @@ -2180,7 +2180,7 @@ TEST_F(OmahaRequestActionTest, TestChangingToMoreStableChannel) { brillo::Blob post_data; OmahaRequestParams params(&fake_system_state_); - params.set_root(tempdir.path().value()); + params.set_root(tempdir.GetPath().value()); params.set_app_id("{22222222-2222-2222-2222-222222222222}"); params.set_app_version("1.2.3.4"); params.set_current_channel("canary-channel"); @@ -2213,7 +2213,7 @@ TEST_F(OmahaRequestActionTest, TestChangingToLessStableChannel) { brillo::Blob post_data; OmahaRequestParams params(&fake_system_state_); - params.set_root(tempdir.path().value()); + params.set_root(tempdir.GetPath().value()); params.set_app_id("{11111111-1111-1111-1111-111111111111}"); params.set_app_version("5.6.7.8"); params.set_current_channel("stable-channel"); diff --git a/omaha_request_params_unittest.cc b/omaha_request_params_unittest.cc index 7d4dc2dd..57ecf24f 100644 --- a/omaha_request_params_unittest.cc +++ b/omaha_request_params_unittest.cc @@ -47,7 +47,7 @@ class OmahaRequestParamsTest : public ::testing::Test { // Create a fresh copy of the params for each test, so there's no // unintended reuse of state across tests. params_ = OmahaRequestParams(&fake_system_state_); - params_.set_root(tempdir_.path().value()); + params_.set_root(tempdir_.GetPath().value()); SetLockDown(false); fake_system_state_.set_prefs(&fake_prefs_); } @@ -105,7 +105,8 @@ TEST_F(OmahaRequestParamsTest, DeltaOKTest) { } TEST_F(OmahaRequestParamsTest, NoDeltasTest) { - ASSERT_TRUE(WriteFileString(tempdir_.path().Append(".nodelta").value(), "")); + ASSERT_TRUE( + WriteFileString(tempdir_.GetPath().Append(".nodelta").value(), "")); EXPECT_TRUE(params_.Init("", "", false)); EXPECT_FALSE(params_.delta_okay()); } @@ -113,12 +114,12 @@ TEST_F(OmahaRequestParamsTest, NoDeltasTest) { TEST_F(OmahaRequestParamsTest, SetTargetChannelTest) { { OmahaRequestParams params(&fake_system_state_); - params.set_root(tempdir_.path().value()); + params.set_root(tempdir_.GetPath().value()); EXPECT_TRUE(params.Init("", "", false)); EXPECT_TRUE(params.SetTargetChannel("canary-channel", false, nullptr)); EXPECT_FALSE(params.is_powerwash_allowed()); } - params_.set_root(tempdir_.path().value()); + params_.set_root(tempdir_.GetPath().value()); EXPECT_TRUE(params_.Init("", "", false)); EXPECT_EQ("canary-channel", params_.target_channel()); EXPECT_FALSE(params_.is_powerwash_allowed()); @@ -127,12 +128,12 @@ TEST_F(OmahaRequestParamsTest, SetTargetChannelTest) { TEST_F(OmahaRequestParamsTest, SetIsPowerwashAllowedTest) { { OmahaRequestParams params(&fake_system_state_); - params.set_root(tempdir_.path().value()); + params.set_root(tempdir_.GetPath().value()); EXPECT_TRUE(params.Init("", "", false)); EXPECT_TRUE(params.SetTargetChannel("canary-channel", true, nullptr)); EXPECT_TRUE(params.is_powerwash_allowed()); } - params_.set_root(tempdir_.path().value()); + params_.set_root(tempdir_.GetPath().value()); EXPECT_TRUE(params_.Init("", "", false)); EXPECT_EQ("canary-channel", params_.target_channel()); EXPECT_TRUE(params_.is_powerwash_allowed()); @@ -141,7 +142,7 @@ TEST_F(OmahaRequestParamsTest, SetIsPowerwashAllowedTest) { TEST_F(OmahaRequestParamsTest, SetTargetChannelInvalidTest) { { OmahaRequestParams params(&fake_system_state_); - params.set_root(tempdir_.path().value()); + params.set_root(tempdir_.GetPath().value()); SetLockDown(true); EXPECT_TRUE(params.Init("", "", false)); string error_message; @@ -151,7 +152,7 @@ TEST_F(OmahaRequestParamsTest, SetTargetChannelInvalidTest) { EXPECT_NE(string::npos, error_message.find("stable-channel")); EXPECT_FALSE(params.is_powerwash_allowed()); } - params_.set_root(tempdir_.path().value()); + params_.set_root(tempdir_.GetPath().value()); EXPECT_TRUE(params_.Init("", "", false)); EXPECT_EQ("stable-channel", params_.target_channel()); EXPECT_FALSE(params_.is_powerwash_allowed()); diff --git a/omaha_response_handler_action_unittest.cc b/omaha_response_handler_action_unittest.cc index 0887e1fd..de508ecb 100644 --- a/omaha_response_handler_action_unittest.cc +++ b/omaha_response_handler_action_unittest.cc @@ -385,7 +385,7 @@ TEST_F(OmahaResponseHandlerActionTest, ChangeToMoreStableChannelTest) { OmahaRequestParams params(&fake_system_state_); fake_system_state_.fake_hardware()->SetIsOfficialBuild(false); - params.set_root(tempdir.path().value()); + params.set_root(tempdir.GetPath().value()); params.set_current_channel("canary-channel"); // The ImageProperties in Android uses prefs to store MutableImageProperties. #ifdef __ANDROID__ @@ -420,7 +420,7 @@ TEST_F(OmahaResponseHandlerActionTest, ChangeToLessStableChannelTest) { OmahaRequestParams params(&fake_system_state_); fake_system_state_.fake_hardware()->SetIsOfficialBuild(false); - params.set_root(tempdir.path().value()); + params.set_root(tempdir.GetPath().value()); params.set_current_channel("stable-channel"); // The ImageProperties in Android uses prefs to store MutableImageProperties. #ifdef __ANDROID__ diff --git a/payload_consumer/delta_performer_unittest.cc b/payload_consumer/delta_performer_unittest.cc index 7ece7ddf..4a86ac8f 100644 --- a/payload_consumer/delta_performer_unittest.cc +++ b/payload_consumer/delta_performer_unittest.cc @@ -766,8 +766,8 @@ TEST_F(DeltaPerformerTest, UsePublicKeyFromResponse) { base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - string non_existing_file = temp_dir.path().Append("non-existing").value(); - string existing_file = temp_dir.path().Append("existing").value(); + string non_existing_file = temp_dir.GetPath().Append("non-existing").value(); + string existing_file = temp_dir.GetPath().Append("existing").value(); EXPECT_EQ(0, System(base::StringPrintf("touch %s", existing_file.c_str()))); // Non-official build, non-existing public-key, key in response -> true diff --git a/payload_consumer/download_action_unittest.cc b/payload_consumer/download_action_unittest.cc index f42b1d8e..b04db493 100644 --- a/payload_consumer/download_action_unittest.cc +++ b/payload_consumer/download_action_unittest.cc @@ -29,7 +29,6 @@ #include <base/files/file_util.h> #include <base/location.h> #include <base/strings/stringprintf.h> -#include <brillo/bind_lambda.h> #include <brillo/message_loops/fake_message_loop.h> #include <brillo/message_loops/message_loop.h> diff --git a/payload_consumer/filesystem_verifier_action_unittest.cc b/payload_consumer/filesystem_verifier_action_unittest.cc index 2e1d95de..b4f7f7fd 100644 --- a/payload_consumer/filesystem_verifier_action_unittest.cc +++ b/payload_consumer/filesystem_verifier_action_unittest.cc @@ -26,7 +26,6 @@ #include <base/posix/eintr_wrapper.h> #include <base/strings/string_util.h> #include <base/strings/stringprintf.h> -#include <brillo/bind_lambda.h> #include <brillo/message_loops/fake_message_loop.h> #include <brillo/message_loops/message_loop_utils.h> #include <gmock/gmock.h> diff --git a/payload_consumer/postinstall_runner_action_unittest.cc b/payload_consumer/postinstall_runner_action_unittest.cc index e82a8662..772270cc 100644 --- a/payload_consumer/postinstall_runner_action_unittest.cc +++ b/payload_consumer/postinstall_runner_action_unittest.cc @@ -29,7 +29,6 @@ #include <base/message_loop/message_loop.h> #include <base/strings/string_util.h> #include <base/strings/stringprintf.h> -#include <brillo/bind_lambda.h> #include <brillo/message_loops/base_message_loop.h> #include <brillo/message_loops/message_loop_utils.h> #include <gmock/gmock.h> diff --git a/proxy_resolver_unittest.cc b/proxy_resolver_unittest.cc index 070b3617..484aae12 100644 --- a/proxy_resolver_unittest.cc +++ b/proxy_resolver_unittest.cc @@ -22,7 +22,6 @@ #include <gtest/gtest.h> #include <base/bind.h> -#include <brillo/bind_lambda.h> #include <brillo/message_loops/fake_message_loop.h> using std::deque; diff --git a/test_http_server.cc b/test_http_server.cc index 2955e79f..93aa11ca 100644 --- a/test_http_server.cc +++ b/test_http_server.cc @@ -98,9 +98,11 @@ bool ParseRequest(int fd, HttpRequest* request) { request->raw_headers = headers; // Break header into lines. - vector<string> lines; - base::SplitStringUsingSubstr( - headers.substr(0, headers.length() - strlen(EOL EOL)), EOL, &lines); + vector<string> lines = base::SplitStringUsingSubstr( + headers.substr(0, headers.length() - strlen(EOL EOL)), + EOL, + base::TRIM_WHITESPACE, + base::SPLIT_WANT_ALL); // Decode URL line. vector<string> terms = base::SplitString(lines[0], base::kWhitespaceASCII, diff --git a/update_attempter.cc b/update_attempter.cc index a6f9fa57..2ca51eed 100644 --- a/update_attempter.cc +++ b/update_attempter.cc @@ -31,7 +31,6 @@ #include <base/rand_util.h> #include <base/strings/string_util.h> #include <base/strings/stringprintf.h> -#include <brillo/bind_lambda.h> #include <brillo/data_encoding.h> #include <brillo/errors/error_codes.h> #include <brillo/make_unique_ptr.h> diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc index bdc01967..b612811a 100644 --- a/update_attempter_unittest.cc +++ b/update_attempter_unittest.cc @@ -22,7 +22,6 @@ #include <base/files/file_util.h> #include <base/message_loop/message_loop.h> -#include <brillo/bind_lambda.h> #include <brillo/make_unique_ptr.h> #include <brillo/message_loops/base_message_loop.h> #include <brillo/message_loops/message_loop.h> diff --git a/update_engine_client.cc b/update_engine_client.cc index 44897e03..dbfc66ba 100644 --- a/update_engine_client.cc +++ b/update_engine_client.cc @@ -73,7 +73,7 @@ class UpdateEngineClient : public brillo::Daemon { // We can't call QuitWithExitCode from OnInit(), so we delay the execution // of the ProcessFlags method after the Daemon initialization is done. - base::MessageLoop::current()->PostTask( + base::MessageLoop::current()->task_runner()->PostTask( FROM_HERE, base::Bind(&UpdateEngineClient::ProcessFlagsAndExit, base::Unretained(this))); diff --git a/update_manager/real_shill_provider_unittest.cc b/update_manager/real_shill_provider_unittest.cc index e821dc74..dc22e547 100644 --- a/update_manager/real_shill_provider_unittest.cc +++ b/update_manager/real_shill_provider_unittest.cc @@ -94,7 +94,9 @@ class UmRealShillProviderTest : public ::testing::Test { now_exp.minute = 5; now_exp.second = 33; now_exp.millisecond = 675; - return Time::FromLocalExploded(now_exp); + Time time; + ignore_result(Time::FromLocalExploded(now_exp, &time)); + return time; } Time ConnChangedTime() { diff --git a/update_manager/real_time_provider.cc b/update_manager/real_time_provider.cc index ca3acad5..db26816f 100644 --- a/update_manager/real_time_provider.cc +++ b/update_manager/real_time_provider.cc @@ -43,7 +43,10 @@ class CurrDateVariable : public Variable<Time> { Time::Exploded now_exp; clock_->GetWallclockTime().LocalExplode(&now_exp); now_exp.hour = now_exp.minute = now_exp.second = now_exp.millisecond = 0; - return new Time(Time::FromLocalExploded(now_exp)); + Time* now = new Time(); + bool success = Time::FromLocalExploded(now_exp, now); + DCHECK(success); + return now; } private: diff --git a/update_manager/real_time_provider_unittest.cc b/update_manager/real_time_provider_unittest.cc index 0e1ef346..f8db30b5 100644 --- a/update_manager/real_time_provider_unittest.cc +++ b/update_manager/real_time_provider_unittest.cc @@ -51,7 +51,9 @@ class UmRealTimeProviderTest : public ::testing::Test { now_exp.minute = 5; now_exp.second = 33; now_exp.millisecond = 675; - return Time::FromLocalExploded(now_exp); + Time time; + ignore_result(Time::FromLocalExploded(now_exp, &time)); + return time; } FakeClock fake_clock_; @@ -66,7 +68,8 @@ TEST_F(UmRealTimeProviderTest, CurrDateValid) { exploded.minute = 0; exploded.second = 0; exploded.millisecond = 0; - const Time expected = Time::FromLocalExploded(exploded); + Time expected; + ignore_result(Time::FromLocalExploded(exploded, &expected)); fake_clock_.SetWallclockTime(now); UmTestUtils::ExpectVariableHasValue(expected, provider_->var_curr_date()); diff --git a/update_manager/real_updater_provider_unittest.cc b/update_manager/real_updater_provider_unittest.cc index 72e664ba..c25cf5a3 100644 --- a/update_manager/real_updater_provider_unittest.cc +++ b/update_manager/real_updater_provider_unittest.cc @@ -57,7 +57,9 @@ Time FixedTime() { now_exp.minute = 5; now_exp.second = 33; now_exp.millisecond = 675; - return Time::FromLocalExploded(now_exp); + Time time; + ignore_result(Time::FromLocalExploded(now_exp, &time)); + return time; } // Rounds down a timestamp to the nearest second. This is useful when faking @@ -66,7 +68,9 @@ Time RoundedToSecond(Time time) { Time::Exploded exp; time.LocalExplode(&exp); exp.millisecond = 0; - return Time::FromLocalExploded(exp); + Time rounded_time; + ignore_result(Time::FromLocalExploded(exp, &rounded_time)); + return rounded_time; } ACTION_P(ActionSetUpdateEngineStatusLastCheckedTime, time_ms) { diff --git a/update_manager/update_manager_unittest.cc b/update_manager/update_manager_unittest.cc index 03f16108..c2766ea3 100644 --- a/update_manager/update_manager_unittest.cc +++ b/update_manager/update_manager_unittest.cc @@ -67,7 +67,9 @@ Time FixedTime() { now_exp.minute = 5; now_exp.second = 33; now_exp.millisecond = 675; - return Time::FromLocalExploded(now_exp); + Time time; + ignore_result(Time::FromLocalExploded(now_exp, &time)); + return time; } } // namespace |