fork-openpgpjs/test/index.html
2011-12-09 20:16:38 +01:00

153 lines
6.2 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="../resources/jquery.min.js"></script>
<script type="text/javascript" src="../src/ciphers/hash/sha.js"></script>
<script type="text/javascript" src="../src/ciphers/hash/md5.js"></script>
<script type="text/javascript" src="../src/ciphers/hash/ripe-md.js"></script>
<!-- crypto libs -->
<script type="text/javascript" src="../src/ciphers/symmetric/aes.js"></script>
<script type="text/javascript" src="../src/ciphers/symmetric/cast5.js"></script>
<script type="text/javascript" src="../src/ciphers/symmetric/dessrc.js"></script>
<script type="text/javascript" src="../src/ciphers/symmetric/twofish.js"></script>
<script type="text/javascript" src="../src/ciphers/symmetric/blowfish.js"></script>
<script type="text/javascript" src="../src/ciphers/asymmetric/jsbn.js"></script>
<script type="text/javascript" src="../src/ciphers/asymmetric/jsbn2.js"></script>
<script type="text/javascript" src="../src/ciphers/asymmetric/dsa.js"></script>
<script type="text/javascript" src="../src/ciphers/asymmetric/elgamal.js"></script>
<script type="text/javascript" src="../src/ciphers/asymmetric/rsa.js"></script>
<script type="text/javascript" src="../src/ciphers/openpgp.crypto.js"></script>
<script type="text/javascript" src="../src/ciphers/openpgp.cfb.js"></script>
<!-- compression -->
<!-- encoding -->
<script type="text/javascript" src="../src/encoding/base64.js"></script>
<script type="text/javascript" src="../src/encoding/openpgp.encoding.asciiarmor.js"></script>
<script type="text/javascript" src="../src/encoding/openpgp.encoding.js"></script>
<!-- openpgp types -->
<script type="text/javascript" src="../src/type/openpgp.type.keyid.js"></script>
<script type="text/javascript" src="../src/type/openpgp.type.mpi.js"></script>
<script type="text/javascript" src="../src/type/openpgp.type.s2k.js"></script>
<!-- openpgp packets -->
<script type="text/javascript" src="../src/packet/openpgp.packet.compressed.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.encrypteddata.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.encryptedintegrityprotecteddata.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.encryptedsessionkey.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.keymaterial.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.literaldata.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.marker.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.modificationdetectioncode.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.onepasssignature.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.signature.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.userattribute.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.userid.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.js"></script>
<!-- openpgp impl. -->
<script type="text/javascript" src="../src/openpgp.js"></script>
<script type="text/javascript" src="../src/config/openpgp.config.js"></script>
<script type="text/javascript" src="../src/openpgp.keyring.js"></script>
<script type="text/javascript" src="../src/openpgp.msg.message.js"></script>
<script type="text/javascript" src="../src/openpgp.msg.privatekey.js"></script>
<script type="text/javascript" src="../src/openpgp.msg.publickey.js"></script>
<script type="text/javascript" src="../src/util/util.js"></script>
<!-- unit test -->
<script type="text/javascript" src="unittest.js"></script>
<script type="text/javascript" src="example-test.js"></script>
<script type="text/javascript" src="ciphers/hash/md5.js"></script>
<script type="text/javascript" src="ciphers/hash/sha.js"></script>
<script type="text/javascript" src="ciphers/hash/ripe-md.js"></script>
<script type="text/javascript" src="ciphers/symmetric/blowfish.js"></script>
<title>OpenPGP.js testpage</title>
</head>
<body>
<style>
* {
font-family: monospace;
}
#debug, #testoutput {
border: 1px dotted #aaa;
background-color: #eee;
margin: 5px;
padding: 5px;
}
.successful {
background-color: #afa;
}
.failed {
background-color: #faa;
}
#unittests tbody tr th {
background-color: #eee;
border: 1px dotted #aaa;
}
#unittests tbody tr td {
padding: 2px;
border: 1px solid #ccc;
}
.unittesttitle {
font-weight: bold;
vertical-align: top;
}
.unittestrow {
border-top: 1px solid #aaa;
}
</style>
<script type="text/javascript">
openpgp.init();
// message function required by util.print_message, util.print_debug, util.print_warning
function showMessages(str) {
$('#debug').append(str);
}
function unit_tests() {
$('#unittests').empty();
$('#unittests').append("<tr><th>Unit</th><th>Description</th><th>Result</th></tr>");
var result = unittests.runAll();
var html = "";
for (var i = 0; i < result.length; i++) {
html += "<tr class=\"unittestrow\"><td rowspan=\""+result[i].tests.length+"\" class=\"unittesttitle\">"+result[i].title+"</td>";
if (result[i].tests.length > 0) {
html += "<td>"+result[i].tests[0].description+"</td><td "+(result[i].tests[0].result ? "class=\"successful\">ok</td>" : "class=\"failed\">FAILED</td>" )+"</tr>";
}
for (var j = 1; j < result[i].tests.length; j++) {
html +="<tr><td>"+result[i].tests[j].description+"</td><td "+(result[i].tests[j].result ? "class=\"successful\">ok</td>" : "class=\"failed\">FAILED</td>")+"</tr>";
}
}
$('#unittests').append(html);
}
</script>
<a href="index.html">Unit Tests</a> | <a href="parser.html">Parser</a> | <a href="encryption.html">Encryption / Decryption</a>
<p><input id="enabledebug" type="checkbox" onclick="($('#enabledebug').is(':checked') ? openpgp.config.debug = true : openpgp.config.debug = false)"> Print Debug Messages </p>
<h1>Unit tests</h1>
<table id="unittests"></table><br>
<button type="submit" onmousedown="unit_tests();">Run unit tests</button>
<!-- src/util/util.js print_debug() writes to -->
<h2>Messages</h2>
<div id="debug"></div>
</body>
</html>