Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/audiocontext-close-basic.html

Issue 2581463002: Refactor WebAudio test directory (Closed)
Patch Set: Use correct path for wav result files Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <title>Test AudioContext.close() closes many contexts</title>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/compatibility.js"></script>
7 <script src="resources/audit-util.js"></script>
8 <script src="resources/audio-testing.js"></script>
9 </head>
10
11 <body>
12 <script>
13 description("Test that closing a context releases the audio HW context");
14
15 var context = null;
16
17 // The number of contexts we want to create and close.
18 var MAX_ITERATION = 100;
19 var counter = 0;
20
21 function createContextAndClose() {
22 // Bypass the first iteration.
23 if (context) {
24 if (context.state != "closed") {
25 testFailed("Context " + counter + " was closed but state is not clos ed: " + context.state);
26 }
27 context = null;
28 }
29 // Create new context and close.
30 context = new AudioContext();
31 if (counter++ < MAX_ITERATION) {
32 // Recursive promise resolution.
33 context.close().then(createContextAndClose, onFailure);
34 } else {
35 context.close()
36 .then(function () {
37 testPassed("Successfully created and closed " + MAX_ITE RATION + " contexts");
38 finishJSTest();
39 });
40 }
41 }
42
43 function onFailure(message) {
44 testFailed("Context " + counter + " failed to close");
45 finishJSTest();
46 }
47
48 // Initiate iteration.
49 function runTest() {
50 window.jsTestIsAsync = true;
51 createContextAndClose();
52 }
53
54 runTest();
55 </script>
56 </body>
57 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698