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

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

Issue 777403004: [WebCrypto] Throw syntaxError if keyUsage is empty in ImportKey (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
Index: content/child/webcrypto/test/rsa_ssa_unittest.cc
diff --git a/content/child/webcrypto/test/rsa_ssa_unittest.cc b/content/child/webcrypto/test/rsa_ssa_unittest.cc
index 0f3725356cb6e6dc3b6bd3bd938027125dcd0c0f..50c6cb095804c20e30e254d5467186b524369644 100644
--- a/content/child/webcrypto/test/rsa_ssa_unittest.cc
+++ b/content/child/webcrypto/test/rsa_ssa_unittest.cc
@@ -355,7 +355,7 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyPairRsa) {
CreateRsaHashedImportAlgorithm(
blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5,
blink::WebCryptoAlgorithmIdSha256),
- true, usages, &public_key));
+ true, blink::WebCryptoKeyUsageVerify, &public_key));
eroman 2014/12/05 20:45:51 sync the code, this has already changed: https://
Habib Virji 2014/12/08 15:05:21 Done.
EXPECT_EQ(modulus_length,
public_key.algorithm().rsaHashedParams()->modulusLengthBits());
@@ -369,7 +369,7 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyPairRsa) {
CreateRsaHashedImportAlgorithm(
blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5,
blink::WebCryptoAlgorithmIdSha256),
- true, usages, &private_key));
+ true, blink::WebCryptoKeyUsageSign, &private_key));
EXPECT_EQ(modulus_length,
private_key.algorithm().rsaHashedParams()->modulusLengthBits());
}
@@ -949,12 +949,17 @@ TEST(WebCryptoRsaSsaTest, ImportInvalidKeyData) {
std::string test_error;
ASSERT_TRUE(test->GetString("error", &test_error));
+ blink::WebCryptoKeyUsage keyUsage = blink::WebCryptoKeyUsageSign;
+ if (key_format == blink::WebCryptoKeyFormatSpki)
+ keyUsage = blink::WebCryptoKeyUsageVerify;
+
blink::WebCryptoKey key;
Status status = ImportKey(key_format, CryptoData(key_data),
CreateRsaHashedImportAlgorithm(
blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5,
blink::WebCryptoAlgorithmIdSha256),
- true, 0, &key);
+ true, keyUsage, &key);
+
EXPECT_EQ(test_error, StatusToString(status));
}
}

Powered by Google App Engine
This is Rietveld 408576698