blob: cebc4eda27baef045083689e1aad57c52d70135b [file] [log] [blame]
<!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("Tests cypto.subtle.exportKey.");
jsTestIsAsync = true;
addTask(importTestKeys().then(function(result) {
keys = result;
// Invalid export formats.
shouldThrow("crypto.subtle.exportKey(3, keys.aesCbcJustDecrypt)");
shouldThrow("crypto.subtle.exportKey(null, keys.aesCbcJustDecrypt)");
shouldThrow("crypto.subtle.exportKey('invalid', keys.aesCbcJustDecrypt)");
// Invalid keys
shouldThrow("crypto.subtle.exportKey('raw', null)");
shouldThrow("crypto.subtle.exportKey('raw', 3)");
shouldBe("keys.aesCbcJustDecrypt.extractable", "false")
shouldRejectPromiseWithNull("crypto.subtle.exportKey('raw', keys.aesCbcJustDecrypt)");
// TODO(eroman): exportKey() is not implemented.
}));
completeTestWhenAllTasksDone();
</script>
</body>
</html>