Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / crypto / subtle / abandon-crypto-operation2.html
blob156a57b0212340f8c512f70e6f2e662d4a20d7c5
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script src="resources/common.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
11 <script>
12 description("Tests cancelling of crypto operations when the context is destroyed.");
14 // Start a worker thread which starts a LOT of expensive
15 // webcrypto operations (generating RSA keys).
17 // Now from the main page try to generate an AES key.
19 // Lastly, the web worker closes itself. This should have the
20 // effect of aborting all of the web crypto operations it had
21 // started, and now the AES key generation will be able to complete.
23 // If the crypto tasks started by the web worker are NOT
24 // cancelled (and are merely orphaned), then the test is going to
25 // timeout.
26 jsTestIsAsync = true;
28 function startWorker() {
29 return new Promise(function(resolve, reject) {
30 var worker = new Worker("resources/worker-start-slow-operations.js");
31 worker.onmessage = function(event)
33 debug(event.data);
34 resolve();
36 worker.onerror = function(error)
38 debug(error.filename + ':' + error.lineno + ': ' + error.message);
39 reject('worker failed');
41 });
44 function generateTestKey() {
45 var algorithm = {name: "AES-CBC", length: 128};
46 return crypto.subtle.generateKey(algorithm, true, ['encrypt']).then(function() {
47 debug('Successfully generated AES-CBC key');
48 });
51 startWorker().then(generateTestKey).then(finishJSTest, failAndFinishJSTest);
52 </script>
53 </body>
54 </html>