update_engine: replace testing::SetArgumentPointee with testing::SetArgPointee
testing::SetArgumentPointee defined in gmock has been deprecated and
superseded by an equivalent testing::SetArgPointee.
BUG=chromium:777011
TEST=Run unit tests.
Change-Id: Ifc48897148d721e6f65159a54586e1fb456d75b9
Reviewed-on: https://chromium-review.googlesource.com/735213
Commit-Ready: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/certificate_checker_unittest.cc b/certificate_checker_unittest.cc
index 20efce9..66b92d6 100644
--- a/certificate_checker_unittest.cc
+++ b/certificate_checker_unittest.cc
@@ -29,7 +29,7 @@
using ::testing::DoAll;
using ::testing::Return;
-using ::testing::SetArgumentPointee;
+using ::testing::SetArgPointee;
using ::testing::SetArrayArgument;
using ::testing::_;
using std::string;
@@ -78,8 +78,8 @@
TEST_F(CertificateCheckerTest, NewCertificate) {
EXPECT_CALL(openssl_wrapper_, GetCertificateDigest(nullptr, _, _, _))
.WillOnce(DoAll(
- SetArgumentPointee<1>(depth_),
- SetArgumentPointee<2>(length_),
+ SetArgPointee<1>(depth_),
+ SetArgPointee<2>(length_),
SetArrayArgument<3>(digest_, digest_ + 4),
Return(true)));
EXPECT_CALL(prefs_, GetString(cert_key_, _)).WillOnce(Return(false));
@@ -95,12 +95,12 @@
TEST_F(CertificateCheckerTest, SameCertificate) {
EXPECT_CALL(openssl_wrapper_, GetCertificateDigest(nullptr, _, _, _))
.WillOnce(DoAll(
- SetArgumentPointee<1>(depth_),
- SetArgumentPointee<2>(length_),
+ SetArgPointee<1>(depth_),
+ SetArgPointee<2>(length_),
SetArrayArgument<3>(digest_, digest_ + 4),
Return(true)));
EXPECT_CALL(prefs_, GetString(cert_key_, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(digest_hex_), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(digest_hex_), Return(true)));
EXPECT_CALL(prefs_, SetString(_, _)).Times(0);
EXPECT_CALL(observer_,
CertificateChecked(server_to_check_,
@@ -113,12 +113,12 @@
TEST_F(CertificateCheckerTest, ChangedCertificate) {
EXPECT_CALL(openssl_wrapper_, GetCertificateDigest(nullptr, _, _, _))
.WillOnce(DoAll(
- SetArgumentPointee<1>(depth_),
- SetArgumentPointee<2>(length_),
+ SetArgPointee<1>(depth_),
+ SetArgPointee<2>(length_),
SetArrayArgument<3>(digest_, digest_ + 4),
Return(true)));
EXPECT_CALL(prefs_, GetString(cert_key_, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(diff_digest_hex_), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(diff_digest_hex_), Return(true)));
EXPECT_CALL(observer_,
CertificateChecked(server_to_check_,
CertificateCheckResult::kValidChanged));
diff --git a/common_service_unittest.cc b/common_service_unittest.cc
index 0a7bfc3..17265b9 100644
--- a/common_service_unittest.cc
+++ b/common_service_unittest.cc
@@ -29,7 +29,7 @@
using std::string;
using testing::Return;
-using testing::SetArgumentPointee;
+using testing::SetArgPointee;
using testing::_;
namespace chromeos_update_engine {
@@ -82,7 +82,7 @@
policy::MockDevicePolicy mock_device_policy;
fake_system_state_.set_device_policy(&mock_device_policy);
EXPECT_CALL(mock_device_policy, GetReleaseChannelDelegated(_))
- .WillOnce(DoAll(SetArgumentPointee<0>(true), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<0>(true), Return(true)));
EXPECT_CALL(*fake_system_state_.mock_request_params(),
SetTargetChannel("beta-channel", true, _))
.WillOnce(Return(true));
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index b1cf31c..c310e72 100644
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -63,7 +63,7 @@
using testing::Return;
using testing::ReturnPointee;
using testing::SaveArg;
-using testing::SetArgumentPointee;
+using testing::SetArgPointee;
using testing::_;
namespace {
@@ -499,8 +499,8 @@
EXPECT_CALL(mock_cm, GetConnectionProperties(_, _))
.WillRepeatedly(
- DoAll(SetArgumentPointee<0>(ConnectionType::kEthernet),
- SetArgumentPointee<1>(ConnectionTethering::kUnknown),
+ DoAll(SetArgPointee<0>(ConnectionType::kEthernet),
+ SetArgPointee<1>(ConnectionTethering::kUnknown),
Return(true)));
EXPECT_CALL(mock_cm, IsUpdateAllowedOver(ConnectionType::kEthernet, _))
.WillRepeatedly(Return(false));
@@ -529,8 +529,8 @@
EXPECT_CALL(mock_cm, GetConnectionProperties(_, _))
.WillRepeatedly(
- DoAll(SetArgumentPointee<0>(ConnectionType::kCellular),
- SetArgumentPointee<1>(ConnectionTethering::kUnknown),
+ DoAll(SetArgPointee<0>(ConnectionType::kCellular),
+ SetArgPointee<1>(ConnectionTethering::kUnknown),
Return(true)));
EXPECT_CALL(mock_cm, IsAllowedConnectionTypesForUpdateSet())
.WillRepeatedly(Return(true));
@@ -561,8 +561,8 @@
EXPECT_CALL(mock_cm, GetConnectionProperties(_, _))
.WillRepeatedly(
- DoAll(SetArgumentPointee<0>(ConnectionType::kCellular),
- SetArgumentPointee<1>(ConnectionTethering::kUnknown),
+ DoAll(SetArgPointee<0>(ConnectionType::kCellular),
+ SetArgPointee<1>(ConnectionTethering::kUnknown),
Return(true)));
EXPECT_CALL(mock_cm, IsAllowedConnectionTypesForUpdateSet())
.WillRepeatedly(Return(true));
@@ -595,8 +595,8 @@
EXPECT_CALL(mock_cm, GetConnectionProperties(_, _))
.WillRepeatedly(
- DoAll(SetArgumentPointee<0>(ConnectionType::kCellular),
- SetArgumentPointee<1>(ConnectionTethering::kUnknown),
+ DoAll(SetArgPointee<0>(ConnectionType::kCellular),
+ SetArgPointee<1>(ConnectionTethering::kUnknown),
Return(true)));
EXPECT_CALL(mock_cm, IsAllowedConnectionTypesForUpdateSet())
.WillRepeatedly(Return(false));
@@ -636,8 +636,8 @@
EXPECT_CALL(mock_cm, GetConnectionProperties(_, _))
.WillRepeatedly(
- DoAll(SetArgumentPointee<0>(ConnectionType::kCellular),
- SetArgumentPointee<1>(ConnectionTethering::kUnknown),
+ DoAll(SetArgPointee<0>(ConnectionType::kCellular),
+ SetArgPointee<1>(ConnectionTethering::kUnknown),
Return(true)));
EXPECT_CALL(mock_cm, IsAllowedConnectionTypesForUpdateSet())
.WillRepeatedly(Return(false));
@@ -676,8 +676,8 @@
EXPECT_CALL(mock_cm, GetConnectionProperties(_, _))
.WillRepeatedly(
- DoAll(SetArgumentPointee<0>(ConnectionType::kCellular),
- SetArgumentPointee<1>(ConnectionTethering::kUnknown),
+ DoAll(SetArgPointee<0>(ConnectionType::kCellular),
+ SetArgPointee<1>(ConnectionTethering::kUnknown),
Return(true)));
EXPECT_CALL(mock_cm, IsAllowedConnectionTypesForUpdateSet())
.WillRepeatedly(Return(false));
@@ -1414,7 +1414,7 @@
fake_system_state_.set_prefs(&prefs);
EXPECT_CALL(prefs, GetString(kPrefsPreviousVersion, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(string("")), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(string("")), Return(true)));
// An existing but empty previous version means that we didn't reboot to a new
// update, therefore, no need to update the previous version.
EXPECT_CALL(prefs, SetString(kPrefsPreviousVersion, _)).Times(0);
@@ -1620,11 +1620,11 @@
int64_t six_days_ago =
(Time::Now() - TimeDelta::FromHours(6 * 24 + 11)).ToInternalValue();
EXPECT_CALL(prefs, GetInt64(kPrefsInstallDateDays, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(0), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(0), Return(true)));
EXPECT_CALL(prefs, GetInt64(kPrefsLastActivePingDay, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(six_days_ago), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(six_days_ago), Return(true)));
EXPECT_CALL(prefs, GetInt64(kPrefsLastRollCallPingDay, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(five_days_ago), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(five_days_ago), Return(true)));
brillo::Blob post_data;
ASSERT_TRUE(
TestUpdateCheck(nullptr, // request_params
@@ -1667,11 +1667,11 @@
(Time::Now() - TimeDelta::FromHours(3 * 24 + 12)).ToInternalValue();
int64_t now = Time::Now().ToInternalValue();
EXPECT_CALL(prefs, GetInt64(kPrefsInstallDateDays, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(0), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(0), Return(true)));
EXPECT_CALL(prefs, GetInt64(kPrefsLastActivePingDay, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(three_days_ago), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(three_days_ago), Return(true)));
EXPECT_CALL(prefs, GetInt64(kPrefsLastRollCallPingDay, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(now), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(now), Return(true)));
brillo::Blob post_data;
ASSERT_TRUE(
TestUpdateCheck(nullptr, // request_params
@@ -1699,11 +1699,11 @@
(Time::Now() - TimeDelta::FromHours(4 * 24)).ToInternalValue();
int64_t now = Time::Now().ToInternalValue();
EXPECT_CALL(prefs, GetInt64(kPrefsInstallDateDays, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(0), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(0), Return(true)));
EXPECT_CALL(prefs, GetInt64(kPrefsLastActivePingDay, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(now), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(now), Return(true)));
EXPECT_CALL(prefs, GetInt64(kPrefsLastRollCallPingDay, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(four_days_ago), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(four_days_ago), Return(true)));
brillo::Blob post_data;
ASSERT_TRUE(
TestUpdateCheck(nullptr, // request_params
@@ -1730,11 +1730,11 @@
int64_t one_hour_ago =
(Time::Now() - TimeDelta::FromHours(1)).ToInternalValue();
EXPECT_CALL(prefs, GetInt64(kPrefsInstallDateDays, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(0), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(0), Return(true)));
EXPECT_CALL(prefs, GetInt64(kPrefsLastActivePingDay, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(one_hour_ago), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(one_hour_ago), Return(true)));
EXPECT_CALL(prefs, GetInt64(kPrefsLastRollCallPingDay, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(one_hour_ago), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(one_hour_ago), Return(true)));
// LastActivePingDay and PrefsLastRollCallPingDay are set even if we didn't
// send a ping.
EXPECT_CALL(prefs, SetInt64(kPrefsLastActivePingDay, _))
@@ -1763,9 +1763,9 @@
fake_system_state_.set_prefs(&prefs);
int64_t now = Time::Now().ToInternalValue();
EXPECT_CALL(prefs, GetInt64(kPrefsLastActivePingDay, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(now), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(now), Return(true)));
EXPECT_CALL(prefs, GetInt64(kPrefsLastRollCallPingDay, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(now), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(now), Return(true)));
EXPECT_CALL(prefs, SetInt64(kPrefsLastActivePingDay, _)).Times(0);
EXPECT_CALL(prefs, SetInt64(kPrefsLastRollCallPingDay, _)).Times(0);
brillo::Blob post_data;
@@ -1792,11 +1792,11 @@
int64_t future =
(Time::Now() + TimeDelta::FromHours(3 * 24 + 4)).ToInternalValue();
EXPECT_CALL(prefs, GetInt64(kPrefsInstallDateDays, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(0), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(0), Return(true)));
EXPECT_CALL(prefs, GetInt64(kPrefsLastActivePingDay, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(future), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(future), Return(true)));
EXPECT_CALL(prefs, GetInt64(kPrefsLastRollCallPingDay, _))
- .WillOnce(DoAll(SetArgumentPointee<1>(future), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<1>(future), Return(true)));
EXPECT_CALL(prefs, SetInt64(kPrefsLastActivePingDay, _))
.WillOnce(Return(true));
EXPECT_CALL(prefs, SetInt64(kPrefsLastRollCallPingDay, _))
diff --git a/payload_consumer/delta_performer_unittest.cc b/payload_consumer/delta_performer_unittest.cc
index a326ae4..fc6a4b5 100644
--- a/payload_consumer/delta_performer_unittest.cc
+++ b/payload_consumer/delta_performer_unittest.cc
@@ -374,7 +374,7 @@
testing::Mock::VerifyAndClearExpectations(&mock_delegate_);
EXPECT_CALL(mock_delegate_, ShouldCancel(_))
.WillOnce(
- testing::DoAll(testing::SetArgumentPointee<0>(ErrorCode::kError),
+ testing::DoAll(testing::SetArgPointee<0>(ErrorCode::kError),
testing::Return(true)));
ApplyPayload(payload_data, "/dev/null", false);
diff --git a/payload_state_unittest.cc b/payload_state_unittest.cc
index b671722..1fa45c2 100644
--- a/payload_state_unittest.cc
+++ b/payload_state_unittest.cc
@@ -41,7 +41,7 @@
using testing::Mock;
using testing::NiceMock;
using testing::Return;
-using testing::SetArgumentPointee;
+using testing::SetArgPointee;
using testing::_;
namespace chromeos_update_engine {
@@ -607,7 +607,7 @@
EXPECT_CALL(*prefs2, GetInt64(kPrefsFullPayloadAttemptNumber, _))
.Times(AtLeast(1));
EXPECT_CALL(*prefs2, GetInt64(kPrefsCurrentUrlIndex, _))
- .WillRepeatedly(DoAll(SetArgumentPointee<1>(2), Return(true)));
+ .WillRepeatedly(DoAll(SetArgPointee<1>(2), Return(true)));
EXPECT_CALL(*prefs2, GetInt64(kPrefsCurrentUrlFailureCount, _))
.Times(AtLeast(1));
EXPECT_CALL(*prefs2, GetInt64(kPrefsUrlSwitchCount, _))
@@ -1011,7 +1011,7 @@
// Let's verify we can reload it correctly.
EXPECT_CALL(*mock_powerwash_safe_prefs, GetString(
kPrefsRollbackVersion, _)).WillOnce(DoAll(
- SetArgumentPointee<1>(rollback_version), Return(true)));
+ SetArgPointee<1>(rollback_version), Return(true)));
EXPECT_CALL(*mock_powerwash_safe_prefs, SetString(kPrefsRollbackVersion,
rollback_version));
payload_state.LoadRollbackVersion();
@@ -1253,7 +1253,7 @@
// Test with device policy not allowing http updates.
EXPECT_CALL(disable_http_policy, GetHttpDownloadsEnabled(_))
- .WillRepeatedly(DoAll(SetArgumentPointee<0>(false), Return(true)));
+ .WillRepeatedly(DoAll(SetArgPointee<0>(false), Return(true)));
// Reset state and set again.
SetupPayloadStateWith2Urls("Hash8433", false, &payload_state, &response);
@@ -1280,7 +1280,7 @@
policy::MockDevicePolicy enable_http_policy;
fake_system_state.set_device_policy(&enable_http_policy);
EXPECT_CALL(enable_http_policy, GetHttpDownloadsEnabled(_))
- .WillRepeatedly(DoAll(SetArgumentPointee<0>(true), Return(true)));
+ .WillRepeatedly(DoAll(SetArgPointee<0>(true), Return(true)));
// Now, set the same response using the same hash
// so that we can test that the state is reset not because of the
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index fed21ca..ef84c1b 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -60,7 +60,7 @@
using testing::Return;
using testing::ReturnPointee;
using testing::SaveArg;
-using testing::SetArgumentPointee;
+using testing::SetArgPointee;
using testing::_;
using update_engine::UpdateStatus;
@@ -283,13 +283,13 @@
EXPECT_TRUE(attempter_.omaha_request_params_->delta_okay());
EXPECT_CALL(*prefs_, GetInt64(kPrefsDeltaUpdateFailures, _))
.WillOnce(DoAll(
- SetArgumentPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures - 1),
+ SetArgPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures - 1),
Return(true)));
attempter_.DisableDeltaUpdateIfNeeded();
EXPECT_TRUE(attempter_.omaha_request_params_->delta_okay());
EXPECT_CALL(*prefs_, GetInt64(kPrefsDeltaUpdateFailures, _))
.WillOnce(DoAll(
- SetArgumentPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures),
+ SetArgPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures),
Return(true)));
attempter_.DisableDeltaUpdateIfNeeded();
EXPECT_FALSE(attempter_.omaha_request_params_->delta_okay());
@@ -301,10 +301,10 @@
TEST_F(UpdateAttempterTest, MarkDeltaUpdateFailureTest) {
EXPECT_CALL(*prefs_, GetInt64(kPrefsDeltaUpdateFailures, _))
.WillOnce(Return(false))
- .WillOnce(DoAll(SetArgumentPointee<1>(-1), Return(true)))
- .WillOnce(DoAll(SetArgumentPointee<1>(1), Return(true)))
+ .WillOnce(DoAll(SetArgPointee<1>(-1), Return(true)))
+ .WillOnce(DoAll(SetArgPointee<1>(1), Return(true)))
.WillOnce(DoAll(
- SetArgumentPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures),
+ SetArgPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures),
Return(true)));
EXPECT_CALL(*prefs_, SetInt64(Ne(kPrefsDeltaUpdateFailures), _))
.WillRepeatedly(Return(true));
@@ -439,12 +439,12 @@
if (enterprise_rollback) {
// We return an empty owner as this is an enterprise.
EXPECT_CALL(*device_policy, GetOwner(_)).WillRepeatedly(
- DoAll(SetArgumentPointee<0>(string("")),
+ DoAll(SetArgPointee<0>(string("")),
Return(true)));
} else {
// We return a fake owner as this is an owned consumer device.
EXPECT_CALL(*device_policy, GetOwner(_)).WillRepeatedly(
- DoAll(SetArgumentPointee<0>(string("fake.mail@fake.com")),
+ DoAll(SetArgPointee<0>(string("fake.mail@fake.com")),
Return(true)));
}
@@ -726,7 +726,7 @@
EXPECT_CALL(*device_policy, GetScatterFactorInSeconds(_))
.WillRepeatedly(DoAll(
- SetArgumentPointee<0>(scatter_factor_in_seconds),
+ SetArgPointee<0>(scatter_factor_in_seconds),
Return(true)));
attempter_.Update("", "", "", "", false, false);
@@ -764,7 +764,7 @@
EXPECT_CALL(*device_policy, GetScatterFactorInSeconds(_))
.WillRepeatedly(DoAll(
- SetArgumentPointee<0>(scatter_factor_in_seconds),
+ SetArgPointee<0>(scatter_factor_in_seconds),
Return(true)));
attempter_.Update("", "", "", "", false, false);
@@ -823,7 +823,7 @@
EXPECT_CALL(*device_policy, GetScatterFactorInSeconds(_))
.WillRepeatedly(DoAll(
- SetArgumentPointee<0>(scatter_factor_in_seconds),
+ SetArgPointee<0>(scatter_factor_in_seconds),
Return(true)));
// Trigger an interactive check so we can test that scattering is disabled.