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..9f7738ee52bbbdc4880de716464b8f60c2059c79 |
| --- /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 bad inputs to HKDF deriveBits()"); |
| + |
| +jsTestIsAsync = true; |
| + |
| +var extractable = true; |
| +raw_bytes = new Uint8Array([1, 2]); |
| + |
| +var p = Promise.resolve(null); |
| +p.then(function() { |
| + debug("\nimportKey() with bad usages..."); |
| + return crypto.subtle.importKey("raw", raw_bytes, "HKDF", extractable, ['encrypt']); |
| +}).then(failAndFinishJSTest, function(result) { |
| + logError(result); |
| + |
| + debug("\nimportKey() with null key..."); |
| + return crypto.subtle.importKey("raw", null, "HKDF", extractable, ['deriveKey']); |
| +}).then(failAndFinishJSTest, function(result) { |
| + logError(result); |
| + |
| + debug("\nimportKey() with jwk type..."); |
| + return crypto.subtle.importKey("jwk", raw_bytes, "HKDF", extractable, ['deriveKey']); |
|
eroman
2014/12/23 23:29:39
This is a fine test to have, but I don't think it
nharper
2015/01/06 23:51:59
Changed the test to have valid JWK input. It is ex
|
| +}).then(failAndFinishJSTest, function(result) { |
| + logError(result); |
| + |
| + debug("\nimportKey() with spki type..."); |
| + 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']); |
| +}).then(finishJSTest, failAndFinishJSTest); |
| + |
| +</script> |
| + |
| +</body> |
| +</html> |