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

Unified Diff: content/child/webcrypto/shared_crypto_unittest.cc

Issue 205583003: [webcrypto] Remove ifdefs for whether hmac key algorithm has length. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indentation Created 6 years, 9 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 | « no previous file | content/child/webcrypto/webcrypto_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/shared_crypto_unittest.cc
diff --git a/content/child/webcrypto/shared_crypto_unittest.cc b/content/child/webcrypto/shared_crypto_unittest.cc
index 814a26fb45ff31d140754e9e2ac4a3504cf9fdab..bb6eb64b6843f3e5533a705d83b7f71c7de56fe6 100644
--- a/content/child/webcrypto/shared_crypto_unittest.cc
+++ b/content/child/webcrypto/shared_crypto_unittest.cc
@@ -675,9 +675,7 @@ TEST_F(SharedCryptoTest, HMACSampleSets) {
blink::WebCryptoKeyUsageSign | blink::WebCryptoKeyUsageVerify);
EXPECT_EQ(test_hash.id(), key.algorithm().hmacParams()->hash().id());
-#if defined(WEBCRYPTO_HMAC_KEY_HAS_LENGTH)
EXPECT_EQ(test_key.size() * 8, key.algorithm().hmacParams()->lengthBits());
-#endif
// Verify exported raw key is identical to the imported data
blink::WebArrayBuffer raw_key;
@@ -958,9 +956,7 @@ TEST_F(SharedCryptoTest, MAYBE(GenerateKeyHmac)) {
EXPECT_EQ(blink::WebCryptoAlgorithmIdHmac, key.algorithm().id());
EXPECT_EQ(blink::WebCryptoAlgorithmIdSha1,
key.algorithm().hmacParams()->hash().id());
-#if defined(WEBCRYPTO_HMAC_KEY_HAS_LENGTH)
EXPECT_EQ(512u, key.algorithm().hmacParams()->lengthBits());
-#endif
blink::WebArrayBuffer raw_key;
ASSERT_STATUS_SUCCESS(
@@ -984,9 +980,7 @@ TEST_F(SharedCryptoTest, MAYBE(GenerateKeyHmacNoLength)) {
EXPECT_EQ(blink::WebCryptoAlgorithmIdHmac, key.algorithm().id());
EXPECT_EQ(blink::WebCryptoAlgorithmIdSha1,
key.algorithm().hmacParams()->hash().id());
-#if defined(WEBCRYPTO_HMAC_KEY_HAS_LENGTH)
- EXPECT_EQ(512u, key.algorithm().hmacParams()->lengthBits());
-#endif
+ EXPECT_EQ(512u, key.algorithm().hmacParams()->lengthBits());
blink::WebArrayBuffer raw_key;
ASSERT_STATUS_SUCCESS(ExportKey(blink::WebCryptoKeyFormatRaw, key, &raw_key));
EXPECT_EQ(64U, raw_key.byteLength());
@@ -997,9 +991,7 @@ TEST_F(SharedCryptoTest, MAYBE(GenerateKeyHmacNoLength)) {
EXPECT_EQ(blink::WebCryptoAlgorithmIdHmac, key.algorithm().id());
EXPECT_EQ(blink::WebCryptoAlgorithmIdSha512,
key.algorithm().hmacParams()->hash().id());
-#if defined(WEBCRYPTO_HMAC_KEY_HAS_LENGTH)
- EXPECT_EQ(1024u, key.algorithm().hmacParams()->lengthBits());
-#endif
+ EXPECT_EQ(1024u, key.algorithm().hmacParams()->lengthBits());
ASSERT_STATUS_SUCCESS(ExportKey(blink::WebCryptoKeyFormatRaw, key, &raw_key));
EXPECT_EQ(128U, raw_key.byteLength());
}
@@ -1376,9 +1368,7 @@ TEST_F(SharedCryptoTest, MAYBE(ImportJwkInputConsistency)) {
EXPECT_EQ(blink::WebCryptoAlgorithmIdHmac, key.algorithm().id());
EXPECT_EQ(blink::WebCryptoAlgorithmIdSha256,
key.algorithm().hmacParams()->hash().id());
-#if defined(WEBCRYPTO_HMAC_KEY_HAS_LENGTH)
- EXPECT_EQ(320u, key.algorithm().hmacParams()->lengthBits());
-#endif
+ EXPECT_EQ(320u, key.algorithm().hmacParams()->lengthBits());
EXPECT_EQ(blink::WebCryptoKeyUsageVerify, key.usages());
key = blink::WebCryptoKey::createNull();
@@ -2637,9 +2627,7 @@ TEST_F(SharedCryptoTest, MAYBE(AesKwJwkSymkeyUnwrapKnownData)) {
EXPECT_EQ(blink::WebCryptoAlgorithmIdHmac, unwrapped_key.algorithm().id());
EXPECT_EQ(blink::WebCryptoAlgorithmIdSha256,
unwrapped_key.algorithm().hmacParams()->hash().id());
-#if defined(WEBCRYPTO_HMAC_KEY_HAS_LENGTH)
EXPECT_EQ(256u, unwrapped_key.algorithm().hmacParams()->lengthBits());
-#endif
EXPECT_EQ(true, unwrapped_key.extractable());
EXPECT_EQ(blink::WebCryptoKeyUsageVerify, unwrapped_key.usages());
« no previous file with comments | « no previous file | content/child/webcrypto/webcrypto_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698