| 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 2461065d78ee09e2d5e44b4b52104e430345aa46..61fc5dc2fad0c45cecedb15d49b7b4537f226536 100644
|
| --- a/content/child/webcrypto/test/hmac_unittest.cc
|
| +++ b/content/child/webcrypto/test/hmac_unittest.cc
|
| @@ -110,7 +110,9 @@ TEST(WebCryptoHmacTest, GenerateKeyIsRandom) {
|
| blink::WebCryptoKey key;
|
| blink::WebCryptoAlgorithm algorithm =
|
| CreateHmacKeyGenAlgorithm(blink::WebCryptoAlgorithmIdSha1, 512);
|
| - ASSERT_EQ(Status::Success(), GenerateSecretKey(algorithm, true, 0, &key));
|
| + ASSERT_EQ(
|
| + Status::Success(),
|
| + GenerateSecretKey(algorithm, true, blink::WebCryptoKeyUsageSign, &key));
|
| EXPECT_FALSE(key.isNull());
|
| EXPECT_TRUE(key.handle());
|
| EXPECT_EQ(blink::WebCryptoKeyTypeSecret, key.type());
|
| @@ -135,7 +137,9 @@ TEST(WebCryptoHmacTest, GenerateKeyNoLengthSha1) {
|
| blink::WebCryptoKey key;
|
| blink::WebCryptoAlgorithm algorithm =
|
| CreateHmacKeyGenAlgorithm(blink::WebCryptoAlgorithmIdSha1, 0);
|
| - ASSERT_EQ(Status::Success(), GenerateSecretKey(algorithm, true, 0, &key));
|
| + ASSERT_EQ(
|
| + Status::Success(),
|
| + GenerateSecretKey(algorithm, true, blink::WebCryptoKeyUsageSign, &key));
|
| EXPECT_TRUE(key.handle());
|
| EXPECT_EQ(blink::WebCryptoKeyTypeSecret, key.type());
|
| EXPECT_EQ(blink::WebCryptoAlgorithmIdHmac, key.algorithm().id());
|
| @@ -153,7 +157,9 @@ TEST(WebCryptoHmacTest, GenerateKeyNoLengthSha512) {
|
| blink::WebCryptoKey key;
|
| blink::WebCryptoAlgorithm algorithm =
|
| CreateHmacKeyGenAlgorithm(blink::WebCryptoAlgorithmIdSha512, 0);
|
| - ASSERT_EQ(Status::Success(), GenerateSecretKey(algorithm, true, 0, &key));
|
| + ASSERT_EQ(
|
| + Status::Success(),
|
| + GenerateSecretKey(algorithm, true, blink::WebCryptoKeyUsageSign, &key));
|
| EXPECT_EQ(blink::WebCryptoAlgorithmIdHmac, key.algorithm().id());
|
| EXPECT_EQ(blink::WebCryptoAlgorithmIdSha512,
|
| key.algorithm().hmacParams()->hash().id());
|
| @@ -164,6 +170,14 @@ TEST(WebCryptoHmacTest, GenerateKeyNoLengthSha512) {
|
| EXPECT_EQ(128U, raw_key.size());
|
| }
|
|
|
| +TEST(WebCryptoHmacTest, GenerateKeyEmptyUsage) {
|
| + blink::WebCryptoKey key;
|
| + blink::WebCryptoAlgorithm algorithm =
|
| + CreateHmacKeyGenAlgorithm(blink::WebCryptoAlgorithmIdSha512, 0);
|
| + ASSERT_EQ(Status::ErrorCreateKeyEmptyUsages(),
|
| + GenerateSecretKey(algorithm, true, 0, &key));
|
| +}
|
| +
|
| TEST(WebCryptoHmacTest, ImportKeyJwkKeyOpsSignVerify) {
|
| blink::WebCryptoKey key;
|
| base::DictionaryValue dict;
|
|
|