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

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

Issue 670773003: Cleanup: rename usage_mask --> usages. (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_cbc_unittest.cc ('k') | content/child/webcrypto/test/rsa_ssa_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 3ec123b56f95eabec631ab635751a643341da93d..d57116c01bd83d5cc454d7fae96995b43a0614db 100644
--- a/content/child/webcrypto/test/hmac_unittest.cc
+++ b/content/child/webcrypto/test/hmac_unittest.cc
@@ -260,7 +260,7 @@ TEST(WebCryptoHmacTest, ImportJwkInputConsistency) {
bool extractable = false;
blink::WebCryptoAlgorithm algorithm =
CreateHmacImportAlgorithm(blink::WebCryptoAlgorithmIdSha256);
- blink::WebCryptoKeyUsageMask usage_mask = blink::WebCryptoKeyUsageVerify;
+ blink::WebCryptoKeyUsageMask usages = blink::WebCryptoKeyUsageVerify;
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "l3nZEgZCeX8XRwJdWyK3rGB8qwjhdY8vOkbIvh4lxTuMao9Y_--hdg");
@@ -270,7 +270,7 @@ TEST(WebCryptoHmacTest, ImportJwkInputConsistency) {
CryptoData(json_vec),
algorithm,
extractable,
- usage_mask,
+ usages,
&key));
EXPECT_TRUE(key.handle());
EXPECT_EQ(blink::WebCryptoKeyTypeSecret, key.type());
@@ -297,7 +297,7 @@ TEST(WebCryptoHmacTest, ImportJwkInputConsistency) {
CryptoData(json_vec),
algorithm,
extractable,
- usage_mask,
+ usages,
&key));
// Extractable cases:
@@ -310,22 +310,22 @@ TEST(WebCryptoHmacTest, ImportJwkInputConsistency) {
CryptoData(json_vec),
algorithm,
true,
- usage_mask,
+ usages,
&key));
EXPECT_EQ(Status::Success(),
ImportKey(blink::WebCryptoKeyFormatJwk,
CryptoData(json_vec),
algorithm,
false,
- usage_mask,
+ usages,
&key));
EXPECT_FALSE(key.extractable());
dict.SetBoolean("ext", true);
EXPECT_EQ(Status::Success(),
- ImportKeyJwkFromDict(dict, algorithm, true, usage_mask, &key));
+ ImportKeyJwkFromDict(dict, algorithm, true, usages, &key));
EXPECT_TRUE(key.extractable());
EXPECT_EQ(Status::Success(),
- ImportKeyJwkFromDict(dict, algorithm, false, usage_mask, &key));
+ ImportKeyJwkFromDict(dict, algorithm, false, usages, &key));
EXPECT_FALSE(key.extractable());
dict.SetBoolean("ext", true); // restore previous value
@@ -359,7 +359,7 @@ TEST(WebCryptoHmacTest, ImportJwkInputConsistency) {
CryptoData(json_vec),
CreateHmacImportAlgorithm(blink::WebCryptoAlgorithmIdSha1),
extractable,
- usage_mask,
+ usages,
&key));
// Pass: JWK alg missing but input algorithm specified: use input value
@@ -369,12 +369,12 @@ TEST(WebCryptoHmacTest, ImportJwkInputConsistency) {
dict,
CreateHmacImportAlgorithm(blink::WebCryptoAlgorithmIdSha256),
extractable,
- usage_mask,
+ usages,
&key));
EXPECT_EQ(blink::WebCryptoAlgorithmIdHmac, algorithm.id());
dict.SetString("alg", "HS256");
- // Fail: Input usage_mask (encrypt) is not a subset of the JWK value
+ // Fail: Input usages (encrypt) is not a subset of the JWK value
// (sign|verify). Moreover "encrypt" is not a valid usage for HMAC.
EXPECT_EQ(Status::ErrorCreateKeyBadUsages(),
ImportKey(blink::WebCryptoKeyFormatJwk,
@@ -384,16 +384,16 @@ TEST(WebCryptoHmacTest, ImportJwkInputConsistency) {
blink::WebCryptoKeyUsageEncrypt,
&key));
- // Fail: Input usage_mask (encrypt|sign|verify) is not a subset of the JWK
+ // Fail: Input usages (encrypt|sign|verify) is not a subset of the JWK
// value (sign|verify). Moreover "encrypt" is not a valid usage for HMAC.
- usage_mask = blink::WebCryptoKeyUsageEncrypt | blink::WebCryptoKeyUsageSign |
- blink::WebCryptoKeyUsageVerify;
+ usages = blink::WebCryptoKeyUsageEncrypt | blink::WebCryptoKeyUsageSign |
+ blink::WebCryptoKeyUsageVerify;
EXPECT_EQ(Status::ErrorCreateKeyBadUsages(),
ImportKey(blink::WebCryptoKeyFormatJwk,
CryptoData(json_vec),
algorithm,
extractable,
- usage_mask,
+ usages,
&key));
// TODO(padolph): kty vs alg consistency tests: Depending on the kty value,
@@ -412,7 +412,7 @@ TEST(WebCryptoHmacTest, ImportJwkHappy) {
bool extractable = false;
blink::WebCryptoAlgorithm algorithm =
CreateHmacImportAlgorithm(blink::WebCryptoAlgorithmIdSha256);
- blink::WebCryptoKeyUsageMask usage_mask = blink::WebCryptoKeyUsageSign;
+ blink::WebCryptoKeyUsageMask usages = blink::WebCryptoKeyUsageSign;
// Import a symmetric key JWK and HMAC-SHA256 sign()
// Uses the first SHA256 test vector from the HMAC sample set above.
@@ -424,9 +424,8 @@ TEST(WebCryptoHmacTest, ImportJwkHappy) {
dict.SetBoolean("ext", false);
dict.SetString("k", "l3nZEgZCeX8XRwJdWyK3rGB8qwjhdY8vOkbIvh4lxTuMao9Y_--hdg");
- ASSERT_EQ(
- Status::Success(),
- ImportKeyJwkFromDict(dict, algorithm, extractable, usage_mask, &key));
+ ASSERT_EQ(Status::Success(),
+ ImportKeyJwkFromDict(dict, algorithm, extractable, usages, &key));
EXPECT_EQ(blink::WebCryptoAlgorithmIdSha256,
key.algorithm().hmacParams()->hash().id());
« no previous file with comments | « content/child/webcrypto/test/aes_cbc_unittest.cc ('k') | content/child/webcrypto/test/rsa_ssa_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698