Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Unified Diff: crypto/symmetric_key_unittest.cc

Issue 1870233002: Convert crypto to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/symmetric_key_openssl.cc ('k') | crypto/symmetric_key_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/symmetric_key_unittest.cc
diff --git a/crypto/symmetric_key_unittest.cc b/crypto/symmetric_key_unittest.cc
index ef8e7e1852acd81633eadc1898754213f0d73029..7cd47cd73c196a717e9c7709e7f2dda5e60da882 100644
--- a/crypto/symmetric_key_unittest.cc
+++ b/crypto/symmetric_key_unittest.cc
@@ -4,15 +4,15 @@
#include "crypto/symmetric_key.h"
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(SymmetricKeyTest, GenerateRandomKey) {
- scoped_ptr<crypto::SymmetricKey> key(
+ std::unique_ptr<crypto::SymmetricKey> key(
crypto::SymmetricKey::GenerateRandomKey(crypto::SymmetricKey::AES, 256));
ASSERT_TRUE(NULL != key.get());
std::string raw_key;
@@ -21,7 +21,7 @@ TEST(SymmetricKeyTest, GenerateRandomKey) {
// Do it again and check that the keys are different.
// (Note: this has a one-in-10^77 chance of failure!)
- scoped_ptr<crypto::SymmetricKey> key2(
+ std::unique_ptr<crypto::SymmetricKey> key2(
crypto::SymmetricKey::GenerateRandomKey(crypto::SymmetricKey::AES, 256));
ASSERT_TRUE(NULL != key2.get());
std::string raw_key2;
@@ -31,13 +31,13 @@ TEST(SymmetricKeyTest, GenerateRandomKey) {
}
TEST(SymmetricKeyTest, ImportGeneratedKey) {
- scoped_ptr<crypto::SymmetricKey> key1(
+ std::unique_ptr<crypto::SymmetricKey> key1(
crypto::SymmetricKey::GenerateRandomKey(crypto::SymmetricKey::AES, 256));
ASSERT_TRUE(NULL != key1.get());
std::string raw_key1;
EXPECT_TRUE(key1->GetRawKey(&raw_key1));
- scoped_ptr<crypto::SymmetricKey> key2(
+ std::unique_ptr<crypto::SymmetricKey> key2(
crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, raw_key1));
ASSERT_TRUE(NULL != key2.get());
@@ -48,14 +48,14 @@ TEST(SymmetricKeyTest, ImportGeneratedKey) {
}
TEST(SymmetricKeyTest, ImportDerivedKey) {
- scoped_ptr<crypto::SymmetricKey> key1(
+ std::unique_ptr<crypto::SymmetricKey> key1(
crypto::SymmetricKey::DeriveKeyFromPassword(
crypto::SymmetricKey::HMAC_SHA1, "password", "somesalt", 1024, 160));
ASSERT_TRUE(NULL != key1.get());
std::string raw_key1;
EXPECT_TRUE(key1->GetRawKey(&raw_key1));
- scoped_ptr<crypto::SymmetricKey> key2(
+ std::unique_ptr<crypto::SymmetricKey> key2(
crypto::SymmetricKey::Import(crypto::SymmetricKey::HMAC_SHA1, raw_key1));
ASSERT_TRUE(NULL != key2.get());
@@ -89,10 +89,9 @@ TEST_P(SymmetricKeyDeriveKeyFromPasswordTest, DeriveKeyFromPassword) {
}
#endif // OS_MACOSX
- scoped_ptr<crypto::SymmetricKey> key(
+ std::unique_ptr<crypto::SymmetricKey> key(
crypto::SymmetricKey::DeriveKeyFromPassword(
- test_data.algorithm,
- test_data.password, test_data.salt,
+ test_data.algorithm, test_data.password, test_data.salt,
test_data.rounds, test_data.key_size_in_bits));
ASSERT_TRUE(NULL != key.get());
« no previous file with comments | « crypto/symmetric_key_openssl.cc ('k') | crypto/symmetric_key_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698