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

Unified Diff: content/child/webcrypto/test/hmac_unittest.cc

Issue 670433005: Cleanup: Use default constructor for WebCryptoKey rather than createNull() factory method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « content/child/webcrypto/test/aes_kw_unittest.cc ('k') | content/child/webcrypto/test/rsa_oaep_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/test/hmac_unittest.cc
diff --git a/content/child/webcrypto/test/hmac_unittest.cc b/content/child/webcrypto/test/hmac_unittest.cc
index fe5d082c44c6191045ddd53140d5e27913974ae8..3ec123b56f95eabec631ab635751a643341da93d 100644
--- a/content/child/webcrypto/test/hmac_unittest.cc
+++ b/content/child/webcrypto/test/hmac_unittest.cc
@@ -118,7 +118,7 @@ TEST(WebCryptoHmacTest, GenerateKeyIsRandom) {
std::vector<std::vector<uint8_t> > keys;
for (int i = 0; i < 16; ++i) {
std::vector<uint8_t> key_bytes;
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
blink::WebCryptoAlgorithm algorithm =
CreateHmacKeyGenAlgorithm(blink::WebCryptoAlgorithmIdSha1, 512);
ASSERT_EQ(Status::Success(), GenerateSecretKey(algorithm, true, 0, &key));
@@ -143,7 +143,7 @@ TEST(WebCryptoHmacTest, GenerateKeyIsRandom) {
// If the key length is not provided, then the block size is used.
TEST(WebCryptoHmacTest, GenerateKeyNoLengthSha1) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
blink::WebCryptoAlgorithm algorithm =
CreateHmacKeyGenAlgorithm(blink::WebCryptoAlgorithmIdSha1, 0);
ASSERT_EQ(Status::Success(), GenerateSecretKey(algorithm, true, 0, &key));
@@ -161,7 +161,7 @@ TEST(WebCryptoHmacTest, GenerateKeyNoLengthSha1) {
// If the key length is not provided, then the block size is used.
TEST(WebCryptoHmacTest, GenerateKeyNoLengthSha512) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
blink::WebCryptoAlgorithm algorithm =
CreateHmacKeyGenAlgorithm(blink::WebCryptoAlgorithmIdSha512, 0);
ASSERT_EQ(Status::Success(), GenerateSecretKey(algorithm, true, 0, &key));
@@ -176,7 +176,7 @@ TEST(WebCryptoHmacTest, GenerateKeyNoLengthSha512) {
}
TEST(WebCryptoHmacTest, ImportKeyJwkKeyOpsSignVerify) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg==");
@@ -210,7 +210,7 @@ TEST(WebCryptoHmacTest, ImportKeyJwkKeyOpsSignVerify) {
// Test 'use' inconsistent with 'key_ops'.
TEST(WebCryptoHmacTest, ImportKeyJwkUseInconsisteWithKeyOps) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg==");
@@ -233,7 +233,7 @@ TEST(WebCryptoHmacTest, ImportKeyJwkUseInconsisteWithKeyOps) {
// Test JWK composite 'sig' use
TEST(WebCryptoHmacTest, ImportKeyJwkUseSig) {
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg==");
@@ -256,7 +256,7 @@ TEST(WebCryptoHmacTest, ImportJwkInputConsistency) {
// inconsistent with the input value, the operation must fail.
// Consistency rules when JWK value is not present: Inputs should be used.
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
bool extractable = false;
blink::WebCryptoAlgorithm algorithm =
CreateHmacImportAlgorithm(blink::WebCryptoAlgorithmIdSha256);
@@ -408,7 +408,7 @@ TEST(WebCryptoHmacTest, ImportJwkHappy) {
// This test verifies the happy path of JWK import, including the application
// of the imported key material.
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
bool extractable = false;
blink::WebCryptoAlgorithm algorithm =
CreateHmacImportAlgorithm(blink::WebCryptoAlgorithmIdSha256);
@@ -488,7 +488,7 @@ TEST(WebCryptoHmacTest, ExportJwkEmptyKey) {
CreateHmacImportAlgorithm(blink::WebCryptoAlgorithmIdSha1);
blink::WebCryptoKeyUsageMask usages = blink::WebCryptoKeyUsageSign;
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
// Import a zero-byte HMAC key.
const char key_data_hex[] = "";
@@ -527,7 +527,7 @@ TEST(WebCryptoHmacTest, ExportJwkEmptyKey) {
TEST(WebCryptoHmacTest, ImportRawKeyTooLarge) {
CryptoData big_data(NULL, UINT_MAX); // Invalid data of big length.
- blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
+ blink::WebCryptoKey key;
EXPECT_EQ(
Status::ErrorDataTooLarge(),
ImportKey(blink::WebCryptoKeyFormatRaw,
« no previous file with comments | « content/child/webcrypto/test/aes_kw_unittest.cc ('k') | content/child/webcrypto/test/rsa_oaep_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698