| Index: LayoutTests/crypto/digest.html
|
| diff --git a/LayoutTests/crypto/digest.html b/LayoutTests/crypto/digest.html
|
| deleted file mode 100644
|
| index 2a32db3d504daef060e848209e6aa217f674185d..0000000000000000000000000000000000000000
|
| --- a/LayoutTests/crypto/digest.html
|
| +++ /dev/null
|
| @@ -1,192 +0,0 @@
|
| -<!DOCTYPE html>
|
| -<html>
|
| -<head>
|
| -<script src="../fast/js/resources/js-test-pre.js"></script>
|
| -</head>
|
| -<body>
|
| -<p id="description"></p>
|
| -<div id="console"></div>
|
| -
|
| -<script>
|
| -description("Tests cypto.subtle.digest.");
|
| -
|
| -jsTestIsAsync = true;
|
| -
|
| -// Builds a hex string representation of any array-like input (array or
|
| -// ArrayBufferView). The output looks like this:
|
| -// [ab 03 4c 99]
|
| -function byteArrayToHexString(bytes)
|
| -{
|
| - var hexBytes = [];
|
| -
|
| - for (var i = 0; i < bytes.length; ++i) {
|
| - var byteString = bytes[i].toString(16);
|
| - if (byteString.length < 2)
|
| - byteString = "0" + byteString;
|
| - hexBytes.push(byteString);
|
| - }
|
| -
|
| - return "[" + hexBytes.join(" ") + "]";
|
| -}
|
| -
|
| -// Each sub-test run in this file is asynchronous. Chaining them together
|
| -// manually leads to very unreadable code, due to having closures within
|
| -// closures within closures. Instead of doing that, each subtest calls
|
| -// "startNextTest()" once it has completed.
|
| -
|
| -currentTestIndex = 0;
|
| -
|
| -function startNextTest()
|
| -{
|
| - var currentTest = allTests[currentTestIndex++];
|
| -
|
| - if (!currentTest) {
|
| - finishJSTest();
|
| - return;
|
| - }
|
| -
|
| - currentTest();
|
| -}
|
| -
|
| -function rejectHandler(value)
|
| -{
|
| - debug(" rejected with value of " + value);
|
| - startNextTest();
|
| -}
|
| -
|
| -function resultHandler(buffer)
|
| -{
|
| - debug(" = " + byteArrayToHexString(new Uint8Array(buffer)));
|
| - startNextTest();
|
| -}
|
| -
|
| -allTests = [
|
| - function()
|
| - {
|
| - debug("SHA1 of [] -- with empty process()")
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.process(new Uint8Array([]));
|
| - op.finish().then(resultHandler, rejectHandler);
|
| - },
|
| -
|
| - function()
|
| - {
|
| - debug("SHA1 of [] -- without calling process()")
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.finish().then(resultHandler, rejectHandler);
|
| - },
|
| -
|
| - function()
|
| - {
|
| - debug("SHA1 of [0x0]")
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.process(new Uint8Array([0]));
|
| - op.finish().then(resultHandler, rejectHandler);
|
| - },
|
| -
|
| - function()
|
| - {
|
| - debug("SHA1 of [0x0] -- as an ArrayBuffer")
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.process(new Uint8Array([0]).buffer);
|
| - op.finish().then(resultHandler, rejectHandler);
|
| - },
|
| -
|
| - function()
|
| - {
|
| - debug("SHA1 of [0, 1, 2, 3, 4, 5] -- multipart")
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.process(new Uint8Array([0]));
|
| - op.process(new Uint8Array([1]));
|
| - op.process(new Uint8Array([2]));
|
| - op.process(new Uint8Array([3]));
|
| - op.process(new Uint8Array([4]));
|
| - op.process(new Uint8Array([5]));
|
| - op.finish().then(resultHandler, rejectHandler);
|
| - },
|
| -
|
| - function()
|
| - {
|
| - debug("Call process() after finish()");
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.finish().then(resultHandler, rejectHandler);
|
| - // These should all be no-ops, since has already finished.
|
| - op.process(new Uint8Array([0]));
|
| - op.process(new Uint8Array([1]));
|
| - op.process(new Uint8Array([2]));
|
| - op.process(new Uint8Array([3]));
|
| - },
|
| -
|
| - function()
|
| - {
|
| - debug("abort()");
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.abort().then(resultHandler, rejectHandler);
|
| - },
|
| -
|
| - function()
|
| - {
|
| - debug("abort() and then abort()");
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.abort().then(resultHandler, rejectHandler);
|
| - op.abort();
|
| - },
|
| -
|
| - function()
|
| - {
|
| - debug("process() and then abort()");
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.process(new Uint8Array([0]));
|
| - op.abort().then(resultHandler, rejectHandler);
|
| - },
|
| -
|
| - function()
|
| - {
|
| - debug("finish() and then abort()");
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.finish().then(resultHandler, rejectHandler);
|
| - op.abort();
|
| - },
|
| -
|
| - function()
|
| - {
|
| - debug("finish() and then process()");
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.finish().then(resultHandler, rejectHandler);
|
| - op.process(new Uint8Array([0]));
|
| - },
|
| -
|
| - function()
|
| - {
|
| - debug("finish() and then abort()");
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.finish().then(resultHandler, rejectHandler);
|
| - op.abort();
|
| - },
|
| -
|
| - function()
|
| - {
|
| - debug("finish() and then finish()");
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - op.finish().then(resultHandler, rejectHandler);
|
| - op.finish();
|
| - },
|
| -
|
| - function()
|
| - {
|
| - op = crypto.subtle.digest({name: 'sha-1'});
|
| - shouldThrow("op.process(null)");
|
| - shouldThrow("op.process()");
|
| - shouldThrow("op.process(-1)");
|
| - startNextTest();
|
| - },
|
| -];
|
| -
|
| -// Begin!
|
| -startNextTest();
|
| -
|
| -</script>
|
| -
|
| -<script src="../fast/js/resources/js-test-post.js"></script>
|
| -</body>
|
| -</html>
|
|
|