Chromium Code Reviews| Index: LayoutTests/crypto/subtle/hkdf-importKey.html |
| diff --git a/LayoutTests/crypto/subtle/hkdf-importKey.html b/LayoutTests/crypto/subtle/hkdf-importKey.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..47adb35f486468f547f236375f9e3808696dad3a |
| --- /dev/null |
| +++ b/LayoutTests/crypto/subtle/hkdf-importKey.html |
| @@ -0,0 +1,53 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<script src="../../resources/js-test.js"></script> |
| +<script src="resources/common.js"></script> |
| +</head> |
| +<body> |
| +<p id="description"></p> |
| +<div id="console"></div> |
| + |
| +<script> |
| +description("Test inputs to HKDF importKey()"); |
| + |
| +jsTestIsAsync = true; |
| + |
| +var extractable = true; |
| +raw_bytes = new Uint8Array([1, 2]); |
|
eroman
2015/01/07 01:18:44
rawBytes
nharper
2015/01/09 22:41:47
Done.
|
| + |
| +var p = Promise.resolve(null); |
| +p.then(function() { |
| + debug("\nimportKey() should fail with 'encrypt' usage..."); |
|
eroman
2015/01/07 01:18:43
I find these comments more useful when it says wha
nharper
2015/01/09 22:41:47
Done.
|
| + return crypto.subtle.importKey("raw", raw_bytes, "HKDF", extractable, ['encrypt']); |
|
eroman
2015/01/07 01:18:44
indent by 4
nharper
2015/01/09 22:41:47
Done.
|
| +}).then(failAndFinishJSTest, function(result) { |
| + logError(result); |
| + |
| + debug("\nimportKey() with null key..."); |
|
eroman
2015/01/07 01:18:44
null key --> null data (or null key data)
nharper
2015/01/09 22:41:47
Done.
|
| + return crypto.subtle.importKey("raw", null, "HKDF", extractable, ['deriveKey']); |
| +}).then(failAndFinishJSTest, function(result) { |
| + logError(result); |
| + |
| + debug("\nimportKey() with jwk type..."); |
|
eroman
2015/01/07 01:18:44
type --> format
nharper
2015/01/09 22:41:47
Done.
|
| + return crypto.subtle.importKey("jwk", {kty: "HKDF"}, "HKDF", extractable, ['deriveKey']); |
| +}).then(failAndFinishJSTest, function(result) { |
| + logError(result); |
| + |
| + debug("\nimportKey() with spki type..."); |
|
eroman
2015/01/07 01:18:44
type -> format
nharper
2015/01/09 22:41:47
Done.
|
| + return crypto.subtle.importKey("spki", raw_bytes, "HKDF", extractable, ['deriveKey']); |
| +}).then(failAndFinishJSTest, function(result) { |
| + logError(result); |
| + |
| + debug("\nimportKey() with empty usages..."); |
| + return crypto.subtle.importKey("raw", raw_bytes, "HKDF", extractable, []); |
| +}).then(failAndFinishJSTest, function(result) { |
| + logError(result); |
| + |
| + debug("\nimportKey() correctly"); |
| + return crypto.subtle.importKey("raw", raw_bytes, "HKDF", extractable, ['deriveKey']); |
|
eroman
2015/01/07 01:18:44
Consider naming this import-failures? (and removin
nharper
2015/01/09 22:41:47
Done.
|
| +}).then(finishJSTest, failAndFinishJSTest); |
| + |
| +</script> |
| + |
| +</body> |
| +</html> |