# script to generate the generateKey tests import os here = os.path.dirname(__file__) successes_html = """ WebCryptoAPI: generateKey() Successful Calls

generateKey Tests for Good Parameters

Warning! RSA key generation is intrinsically very slow, so the related tests can take up to several minutes to complete, depending on browser!

""" failures_html = """ WebCryptoAPI: generateKey() for Failures

generateKey Tests for Bad Parameters

""" successes_worker = """// timeout=long importScripts("/resources/testharness.js"); importScripts("../util/helpers.js"); importScripts("successes.js"); run_test([%s]); done();""" failures_worker = """// 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"] for filename_pattern, template in [("test_successes_%s.html", successes_html), ("test_failures_%s.html", failures_html), ("successes_%s.worker.js", successes_worker), ("failures_%s.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)