Chromium Code Reviews| Index: device/u2f/u2f_apdu_unittest.cc |
| diff --git a/device/u2f/u2f_apdu_unittest.cc b/device/u2f/u2f_apdu_unittest.cc |
| index 366031965af20071aa9d2a5f2b83c3e6bce56e86..bd7009dda5fa1fc8afa6235d5e75e26efa550baf 100644 |
| --- a/device/u2f/u2f_apdu_unittest.cc |
| +++ b/device/u2f/u2f_apdu_unittest.cc |
| @@ -17,7 +17,7 @@ TEST_F(U2fApduTest, TestDeserializeBasic) { |
| uint8_t p1 = 0xAC; |
| uint8_t p2 = 0xAD; |
| std::vector<uint8_t> message = {cla, ins, p1, p2}; |
| - scoped_refptr<U2fApduCommand> cmd = |
| + std::unique_ptr<U2fApduCommand> cmd = |
| U2fApduCommand::CreateFromMessage(message); |
| EXPECT_EQ(static_cast<size_t>(0), cmd->response_length_); |
| @@ -57,7 +57,7 @@ TEST_F(U2fApduTest, TestDeserializeComplex) { |
| message.insert(message.end(), data.begin(), data.end()); |
| // Create a message with no response expected |
| - scoped_refptr<U2fApduCommand> cmd_no_response = |
| + std::unique_ptr<U2fApduCommand> cmd_no_response = |
| U2fApduCommand::CreateFromMessage(message); |
| EXPECT_EQ(static_cast<size_t>(0), cmd_no_response->response_length_); |
| EXPECT_THAT(data, testing::ContainerEq(cmd_no_response->data_)); |
| @@ -69,7 +69,7 @@ TEST_F(U2fApduTest, TestDeserializeComplex) { |
| // Add response length to message |
| message.push_back(0xF1); |
| message.push_back(0xD0); |
| - scoped_refptr<U2fApduCommand> cmd = |
| + std::unique_ptr<U2fApduCommand> cmd = |
| U2fApduCommand::CreateFromMessage(message); |
| EXPECT_THAT(data, testing::ContainerEq(cmd->data_)); |
| EXPECT_EQ(cmd->cla_, cla); |
| @@ -81,7 +81,7 @@ TEST_F(U2fApduTest, TestDeserializeComplex) { |
| TEST_F(U2fApduTest, TestDeserializeResponse) { |
| U2fApduResponse::Status status; |
| - scoped_refptr<U2fApduResponse> response; |
| + std::unique_ptr<U2fApduResponse> response; |
| std::vector<uint8_t> test_vector; |
| // Invalid length |
| @@ -111,7 +111,7 @@ TEST_F(U2fApduTest, TestDeserializeResponse) { |
| } |
| TEST_F(U2fApduTest, TestSerializeCommand) { |
| - scoped_refptr<U2fApduCommand> cmd = U2fApduCommand::Create(); |
| + std::unique_ptr<U2fApduCommand> cmd(new U2fApduCommand()); |
|
Reilly Grant (use Gerrit)
2017/03/20 17:44:37
Use base::MakeUnique here and below.
|
| cmd->set_cla(0xA); |
| cmd->set_ins(0xB); |
| @@ -157,7 +157,7 @@ TEST_F(U2fApduTest, TestSerializeCommand) { |
| } |
| TEST_F(U2fApduTest, TestSerializeEdgeCases) { |
| - scoped_refptr<U2fApduCommand> cmd = U2fApduCommand::Create(); |
| + std::unique_ptr<U2fApduCommand> cmd(new U2fApduCommand()); |
| cmd->set_cla(0xA); |
| cmd->set_ins(0xB); |
| @@ -187,7 +187,7 @@ TEST_F(U2fApduTest, TestCreateSign) { |
| std::vector<uint8_t> challenge(U2fApduCommand::kChallengeDigestLen, 0xff); |
| std::vector<uint8_t> key_handle(U2fApduCommand::kMaxKeyHandleLength); |
| - scoped_refptr<U2fApduCommand> cmd = |
| + std::unique_ptr<U2fApduCommand> cmd = |
| U2fApduCommand::CreateSign(appid, challenge, key_handle); |
| ASSERT_NE(nullptr, cmd); |
| EXPECT_THAT(U2fApduCommand::CreateFromMessage(cmd->GetEncodedCommand()) |
| @@ -212,7 +212,7 @@ TEST_F(U2fApduTest, TestCreateSign) { |
| TEST_F(U2fApduTest, TestCreateRegister) { |
| std::vector<uint8_t> appid(U2fApduCommand::kAppIdDigestLen, 0x01); |
| std::vector<uint8_t> challenge(U2fApduCommand::kChallengeDigestLen, 0xff); |
| - scoped_refptr<U2fApduCommand> cmd = |
| + std::unique_ptr<U2fApduCommand> cmd = |
| U2fApduCommand::CreateRegister(appid, challenge); |
| ASSERT_NE(nullptr, cmd); |
| EXPECT_THAT(U2fApduCommand::CreateFromMessage(cmd->GetEncodedCommand()) |
| @@ -230,7 +230,7 @@ TEST_F(U2fApduTest, TestCreateRegister) { |
| } |
| TEST_F(U2fApduTest, TestCreateVersion) { |
| - scoped_refptr<U2fApduCommand> cmd = U2fApduCommand::CreateVersion(); |
| + std::unique_ptr<U2fApduCommand> cmd = U2fApduCommand::CreateVersion(); |
| std::vector<uint8_t> expected = { |
| 0x0, U2fApduCommand::kInsU2fVersion, 0x0, 0x0, 0x0, 0x0, 0x0}; |
| @@ -241,7 +241,7 @@ TEST_F(U2fApduTest, TestCreateVersion) { |
| } |
| TEST_F(U2fApduTest, TestCreateLegacyVersion) { |
| - scoped_refptr<U2fApduCommand> cmd = U2fApduCommand::CreateLegacyVersion(); |
| + std::unique_ptr<U2fApduCommand> cmd = U2fApduCommand::CreateLegacyVersion(); |
| // Legacy version command contains 2 extra null bytes compared to ISO 7816-4 |
| // format |
| std::vector<uint8_t> expected = { |