diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/WebCryptoAPI/tools/generate.py | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/WebCryptoAPI/tools/generate.py')
-rw-r--r-- | testing/web-platform/tests/WebCryptoAPI/tools/generate.py | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/testing/web-platform/tests/WebCryptoAPI/tools/generate.py b/testing/web-platform/tests/WebCryptoAPI/tools/generate.py new file mode 100644 index 0000000000..35ba0f0031 --- /dev/null +++ b/testing/web-platform/tests/WebCryptoAPI/tools/generate.py @@ -0,0 +1,77 @@ +# script to generate the generateKey tests + +import os + +here = os.path.dirname(__file__) + +successes_html = """<!DOCTYPE html> +<meta charset=utf-8> +<meta name="timeout" content="long"> +<title>WebCryptoAPI: generateKey() Successful Calls</title> +<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com"> +<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<script src="/WebCryptoAPI/util/helpers.js"></script> +<script src="successes.js"></script> + +<h1>generateKey Tests for Good Parameters</h1> +<p> + <strong>Warning!</strong> RSA key generation is intrinsically + very slow, so the related tests can take up to + several minutes to complete, depending on browser! +</p> + +<div id="log"></div> +<script> +run_test([%s]); +</script>""" + +failures_html = """<!DOCTYPE html> +<meta charset=utf-8> +<meta name="timeout" content="long"> +<title>WebCryptoAPI: generateKey() for Failures</title> +<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com"> +<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<script src="/WebCryptoAPI/util/helpers.js"></script> +<script src="failures.js"></script> + +<h1>generateKey Tests for Bad Parameters</h1> + +<div id="log"></div> +<script> +run_test([%s]); +</script> +""" + +successes_worker = """// META: timeout=long +importScripts("/resources/testharness.js"); +importScripts("../util/helpers.js"); +importScripts("successes.js"); + +run_test([%s]); +done();""" + +failures_worker = """// META: timeout=long +importScripts("/resources/testharness.js"); +importScripts("../util/helpers.js"); +importScripts("failures.js"); +run_test([%s]); +done();""" + +names = ["AES-CTR", "AES-CBC", "AES-GCM", "AES-KW", "HMAC", "RSASSA-PKCS1-v1_5", + "RSA-PSS", "RSA-OAEP", "ECDSA", "ECDH", "Ed25519", "Ed448", "X25519", + "X448"] + +for filename_pattern, template in [("test_successes_%s.https.html", successes_html), + ("test_failures_%s.https.html", failures_html), + ("successes_%s.https.worker.js", successes_worker), + ("failures_%s.https.worker.js", failures_worker)]: + for name in names: + path = os.path.join(here, os.pardir, "generateKey", filename_pattern % name) + with open(path, "w") as f: + f.write(template % '"%s"' % name) |