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

Unified Diff: content/child/webcrypto/test/hmac_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: Updated issues in ecdh tests and other review comments. 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/hmac_unittest.cc
diff --git a/content/child/webcrypto/test/hmac_unittest.cc b/content/child/webcrypto/test/hmac_unittest.cc
index ff2bbe16a1ebf2aa3a602ff5040469d60ebe428e..bc0a8c41aa4bf5420c9f5d9954c691befab48fe1 100644
--- a/content/child/webcrypto/test/hmac_unittest.cc
+++ b/content/child/webcrypto/test/hmac_unittest.cc
@@ -208,6 +208,18 @@ TEST(WebCryptoHmacTest, Generate1BitKey) {
EXPECT_FALSE(raw_key[0] & 0x7F);
}
+TEST(WebCryptoHmacTest, ImportKeyEmptyUsage) {
+ blink::WebCryptoKey key;
+ std::string key_raw_hex_in = "025a8cf3f08b4f6c5f33bbc76a471939";
+ EXPECT_EQ(
+ Status::ErrorCreateKeyEmptyUsages(),
+ ImportKey(blink::WebCryptoKeyFormatRaw,
+ CryptoData(HexStringToBytes(key_raw_hex_in)),
+ CreateHmacImportAlgorithmNoLength(
+ blink::WebCryptoAlgorithmIdSha1),
+ true, 0, &key));
+}
+
TEST(WebCryptoHmacTest, ImportKeyJwkKeyOpsSignVerify) {
blink::WebCryptoKey key;
base::DictionaryValue dict;
@@ -457,11 +469,6 @@ TEST(WebCryptoHmacTest, ImportExportJwk) {
ImportExportJwkSymmetricKey(
512, CreateHmacImportAlgorithmNoLength(blink::WebCryptoAlgorithmIdSha512),
blink::WebCryptoKeyUsageVerify, "HS512");
-
- // Zero usage value
- ImportExportJwkSymmetricKey(
- 512, CreateHmacImportAlgorithmNoLength(blink::WebCryptoAlgorithmIdSha512),
- 0, "HS512");
}
TEST(WebCryptoHmacTest, ExportJwkEmptyKey) {

Powered by Google App Engine
This is Rietveld 408576698