Index: content/child/webcrypto/test/aes_cbc_unittest.cc |
diff --git a/content/child/webcrypto/test/aes_cbc_unittest.cc b/content/child/webcrypto/test/aes_cbc_unittest.cc |
index 59d4882466246c862579a2d40827a8606dfeaef7..9d1fa6ac012e7715a87cd546b6f407d8180f9328 100644 |
--- a/content/child/webcrypto/test/aes_cbc_unittest.cc |
+++ b/content/child/webcrypto/test/aes_cbc_unittest.cc |
@@ -195,10 +195,19 @@ TEST(WebCryptoAesCbcTest, GenerateKeyBadLength) { |
SCOPED_TRACE(i); |
EXPECT_EQ(Status::ErrorGenerateAesKeyLength(), |
GenerateSecretKey(CreateAesCbcKeyGenAlgorithm(kKeyLen[i]), true, |
- 0, &key)); |
+ blink::WebCryptoKeyUsageEncrypt, &key)); |
} |
} |
+TEST(WebCryptoAesCbcTest, ImportKeyEmptyUsage) { |
+ blink::WebCryptoKey key; |
+ ASSERT_EQ(Status::ErrorCreateKeyEmptyUsages(), |
+ ImportKey(blink::WebCryptoKeyFormatRaw, |
+ CryptoData(std::vector<uint8_t>(16)), |
+ CreateAlgorithm(blink::WebCryptoAlgorithmIdAesCbc), |
+ true, 0, &key)); |
+} |
+ |
// If key_ops is specified but empty, no key usages are allowed for the key. |
TEST(WebCryptoAesCbcTest, ImportKeyJwkEmptyKeyOps) { |
blink::WebCryptoKey key; |
@@ -208,13 +217,6 @@ TEST(WebCryptoAesCbcTest, ImportKeyJwkEmptyKeyOps) { |
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg"); |
dict.Set("key_ops", new base::ListValue); // Takes ownership. |
- EXPECT_EQ(Status::Success(), |
- ImportKeyJwkFromDict( |
- dict, CreateAlgorithm(blink::WebCryptoAlgorithmIdAesCbc), false, |
- 0, &key)); |
- |
- EXPECT_EQ(0, key.usages()); |
- |
// The JWK does not contain encrypt usages. |
EXPECT_EQ(Status::ErrorJwkKeyopsInconsistent(), |
ImportKeyJwkFromDict( |
@@ -533,8 +535,8 @@ TEST(WebCryptoAesCbcTest, WrapUnwrapRoundtripSpkiPkcs8) { |
ASSERT_EQ( |
Status::Success(), |
UnwrapKey(blink::WebCryptoKeyFormatSpki, CryptoData(wrapped_public_key), |
- wrapping_key, wrap_algorithm, rsa_import_algorithm, true, 0, |
- &unwrapped_public_key)); |
+ wrapping_key, wrap_algorithm, rsa_import_algorithm, true, |
+ blink::WebCryptoKeyUsageVerify, &unwrapped_public_key)); |
blink::WebCryptoKey unwrapped_private_key; |