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: I82fa9004cf76f3f47cfcfa9781717fb4da24cf6d
Reviewed-on: https://chromium-review.googlesource.com/734216
Commit-Ready: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
diff --git a/attestation/server/attestation_service_test.cc b/attestation/server/attestation_service_test.cc
index ab82ced..9fe5d48 100644
--- a/attestation/server/attestation_service_test.cc
+++ b/attestation/server/attestation_service_test.cc
@@ -41,7 +41,7 @@
using testing::NiceMock;
using testing::Return;
using testing::ReturnRef;
-using testing::SetArgumentPointee;
+using testing::SetArgPointee;
namespace attestation {
@@ -636,7 +636,7 @@
std::string key_bytes;
key.SerializeToString(&key_bytes);
EXPECT_CALL(mock_key_store_, Read("user", "label", _))
- .WillOnce(DoAll(SetArgumentPointee<2>(key_bytes), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<2>(key_bytes), Return(true)));
// Set expectations on the outputs.
auto callback = [this](const GetKeyInfoReply& reply) {
@@ -832,13 +832,13 @@
if (kTpmVersionUnderTest == TPM_1_2) {
EXPECT_CALL(mock_tpm_utility_,
ActivateIdentity(_, _, _, "encrypted1", "encrypted2", _))
- .WillOnce(DoAll(SetArgumentPointee<5>(std::string("certificate")),
+ .WillOnce(DoAll(SetArgPointee<5>(std::string("certificate")),
Return(true)));
} else {
EXPECT_CALL(
mock_tpm_utility_,
ActivateIdentityForTpm2(KEY_TYPE_RSA, _, "seed", "mac", "wrapped", _))
- .WillOnce(DoAll(SetArgumentPointee<5>(std::string("certificate")),
+ .WillOnce(DoAll(SetArgPointee<5>(std::string("certificate")),
Return(true)));
}
// Set expectations on the outputs.
@@ -869,13 +869,13 @@
if (kTpmVersionUnderTest == TPM_1_2) {
EXPECT_CALL(mock_tpm_utility_,
ActivateIdentity(_, _, _, "encrypted1", "encrypted2", _))
- .WillOnce(DoAll(SetArgumentPointee<5>(std::string("certificate")),
+ .WillOnce(DoAll(SetArgPointee<5>(std::string("certificate")),
Return(true)));
} else {
EXPECT_CALL(
mock_tpm_utility_,
ActivateIdentityForTpm2(KEY_TYPE_RSA, _, "seed", "mac", "wrapped", _))
- .WillOnce(DoAll(SetArgumentPointee<5>(std::string("certificate")),
+ .WillOnce(DoAll(SetArgPointee<5>(std::string("certificate")),
Return(true)));
}
// Set expectations on the outputs.
@@ -958,9 +958,9 @@
mock_tpm_utility_,
CreateCertifiedKey(KEY_TYPE_RSA, KEY_USAGE_SIGN, _, _, _, _, _, _, _))
.WillOnce(
- DoAll(SetArgumentPointee<5>(std::string("public_key")),
- SetArgumentPointee<7>(std::string("certify_info")),
- SetArgumentPointee<8>(std::string("certify_info_signature")),
+ DoAll(SetArgPointee<5>(std::string("public_key")),
+ SetArgPointee<7>(std::string("certify_info")),
+ SetArgPointee<8>(std::string("certify_info_signature")),
Return(true)));
// Expect the key to be written exactly once.
EXPECT_CALL(mock_key_store_, Write("user", "label", _)).Times(1);
@@ -987,9 +987,9 @@
mock_tpm_utility_,
CreateCertifiedKey(KEY_TYPE_RSA, KEY_USAGE_SIGN, _, _, _, _, _, _, _))
.WillOnce(
- DoAll(SetArgumentPointee<5>(std::string("public_key")),
- SetArgumentPointee<7>(std::string("certify_info")),
- SetArgumentPointee<8>(std::string("certify_info_signature")),
+ DoAll(SetArgPointee<5>(std::string("public_key")),
+ SetArgPointee<7>(std::string("certify_info")),
+ SetArgPointee<8>(std::string("certify_info_signature")),
Return(true)));
// Expect the key to be written exactly once.
EXPECT_CALL(mock_database_, SaveChanges()).Times(1);
@@ -1254,7 +1254,7 @@
std::string key_bytes;
key.SerializeToString(&key_bytes);
EXPECT_CALL(mock_key_store_, Read("user", "label", _))
- .WillOnce(DoAll(SetArgumentPointee<2>(key_bytes), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<2>(key_bytes), Return(true)));
// Cardinality is verified here to verify various steps are performed and to
// catch performance regressions.
EXPECT_CALL(mock_key_store_,
@@ -1321,7 +1321,7 @@
std::string key_bytes;
key.SerializeToString(&key_bytes);
EXPECT_CALL(mock_key_store_, Read("user", "label", _))
- .WillOnce(DoAll(SetArgumentPointee<2>(key_bytes), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<2>(key_bytes), Return(true)));
// Cardinality is verified here to verify various steps are performed and to
// catch performance regressions.
EXPECT_CALL(mock_key_store_,
@@ -1414,7 +1414,7 @@
std::string key_bytes;
key.SerializeToString(&key_bytes);
EXPECT_CALL(mock_key_store_, Read("user", "label", _))
- .WillOnce(DoAll(SetArgumentPointee<2>(key_bytes), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<2>(key_bytes), Return(true)));
EXPECT_CALL(mock_key_store_, Register(_, _, _, _, _, _, _))
.WillRepeatedly(Return(false));
// Set expectations on the outputs.
@@ -1437,7 +1437,7 @@
std::string key_bytes;
key.SerializeToString(&key_bytes);
EXPECT_CALL(mock_key_store_, Read("user", "label", _))
- .WillOnce(DoAll(SetArgumentPointee<2>(key_bytes), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<2>(key_bytes), Return(true)));
EXPECT_CALL(mock_key_store_, RegisterCertificate(_, _))
.WillRepeatedly(Return(false));
// Set expectations on the outputs.
@@ -1461,7 +1461,7 @@
std::string key_bytes;
key.SerializeToString(&key_bytes);
EXPECT_CALL(mock_key_store_, Read("user", "label", _))
- .WillOnce(DoAll(SetArgumentPointee<2>(key_bytes), Return(true)));
+ .WillOnce(DoAll(SetArgPointee<2>(key_bytes), Return(true)));
EXPECT_CALL(mock_key_store_, RegisterCertificate(_, _))
.WillRepeatedly(Return(false));
// Set expectations on the outputs.
@@ -1750,7 +1750,7 @@
TEST_F(AttestationServiceTest, SignSimpleChallengeSuccess) {
EXPECT_CALL(mock_tpm_utility_, Sign(_, _, _))
- .WillRepeatedly(DoAll(SetArgumentPointee<2>(std::string("signature")),
+ .WillRepeatedly(DoAll(SetArgPointee<2>(std::string("signature")),
Return(true)));
auto callback = [this](const SignSimpleChallengeReply& reply) {
EXPECT_EQ(STATUS_SUCCESS, reply.status());
@@ -1795,10 +1795,10 @@
EXPECT_CALL(mock_crypto_utility_,
EncryptDataForGoogle(key_info_str, _, _, _))
.WillRepeatedly(
- DoAll(SetArgumentPointee<3>(MockEncryptedData(key_info_str)),
+ DoAll(SetArgPointee<3>(MockEncryptedData(key_info_str)),
Return(true)));
EXPECT_CALL(mock_tpm_utility_, Sign(_, _, _))
- .WillRepeatedly(DoAll(SetArgumentPointee<2>(std::string("signature")),
+ .WillRepeatedly(DoAll(SetArgPointee<2>(std::string("signature")),
Return(true)));
auto callback = [this](const SignEnterpriseChallengeReply& reply) {
EXPECT_EQ(STATUS_SUCCESS, reply.status());
diff --git a/attestation/server/pkcs11_key_store_test.cc b/attestation/server/pkcs11_key_store_test.cc
index 4bafce7..030697a 100644
--- a/attestation/server/pkcs11_key_store_test.cc
+++ b/attestation/server/pkcs11_key_store_test.cc
@@ -35,7 +35,7 @@
using ::testing::Invoke;
using ::testing::NiceMock;
using ::testing::Return;
-using ::testing::SetArgumentPointee;
+using ::testing::SetArgPointee;
namespace {
@@ -144,9 +144,9 @@
void SetUp() override {
std::vector<uint64_t> slot_list = {0, 1};
ON_CALL(pkcs11_, GetSlotList(_, _, _))
- .WillByDefault(DoAll(SetArgumentPointee<2>(slot_list), Return(0)));
+ .WillByDefault(DoAll(SetArgPointee<2>(slot_list), Return(0)));
ON_CALL(pkcs11_, OpenSession(_, _, _, _))
- .WillByDefault(DoAll(SetArgumentPointee<3>(kSession), Return(0)));
+ .WillByDefault(DoAll(SetArgPointee<3>(kSession), Return(0)));
ON_CALL(pkcs11_, CloseSession(_, _)).WillByDefault(Return(0));
ON_CALL(pkcs11_, CreateObject(_, _, _, _))
.WillByDefault(Invoke(this, &KeyStoreTest::CreateObject));
@@ -163,11 +163,11 @@
ON_CALL(pkcs11_, FindObjectsFinal(_, _)).WillByDefault(Return(0));
base::FilePath system_path("/var/lib/chaps");
ON_CALL(token_manager_, GetTokenPath(_, 0, _))
- .WillByDefault(DoAll(SetArgumentPointee<2>(system_path), Return(true)));
+ .WillByDefault(DoAll(SetArgPointee<2>(system_path), Return(true)));
base::FilePath user_path(
brillo::cryptohome::home::GetDaemonPath(kDefaultUser, "chaps"));
ON_CALL(token_manager_, GetTokenPath(_, 1, _))
- .WillByDefault(DoAll(SetArgumentPointee<2>(user_path), Return(true)));
+ .WillByDefault(DoAll(SetArgPointee<2>(user_path), Return(true)));
}
// Stores a new labeled object, only CKA_LABEL and CKA_VALUE are relevant.
@@ -446,7 +446,7 @@
TEST_F(KeyStoreTest, FindNoObjects) {
std::vector<uint64_t> empty;
EXPECT_CALL(pkcs11_, FindObjects(_, _, _, _))
- .WillRepeatedly(DoAll(SetArgumentPointee<3>(empty), Return(CKR_OK)));
+ .WillRepeatedly(DoAll(SetArgPointee<3>(empty), Return(CKR_OK)));
Pkcs11KeyStore key_store(&token_manager_);
std::string blob;
EXPECT_TRUE(key_store.Write(kDefaultUser, "test", "test_data"));
diff --git a/trunks/resource_manager_test.cc b/trunks/resource_manager_test.cc
index a5736cd..59617cd 100644
--- a/trunks/resource_manager_test.cc
+++ b/trunks/resource_manager_test.cc
@@ -35,7 +35,7 @@
using testing::InSequence;
using testing::Return;
using testing::ReturnPointee;
-using testing::SetArgumentPointee;
+using testing::SetArgPointee;
using testing::StrictMock;
namespace {
@@ -699,7 +699,7 @@
ContextLoadSync(Field(&TPMS_CONTEXT::sequence, Eq(1u)), _, _))
.WillOnce(Return(TPM_RC_SUCCESS));
EXPECT_CALL(tpm_, ContextSaveSync(kArbitrarySessionHandle, _, _, _))
- .WillOnce(DoAll(SetArgumentPointee<2>(CreateContext(2)),
+ .WillOnce(DoAll(SetArgPointee<2>(CreateContext(2)),
Return(TPM_RC_SUCCESS)));
std::string command = CreateCommand(TPM_CC_Startup, kNoHandles,
kNoAuthorization, kNoParameters);