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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-thread-smoke-test.html

Issue 2889393003: Lazy initialization of the rendering thread in OfflineAudioContext (Closed)
Patch Set: Rewrite layout test Created 3 years, 6 months 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>
5 OfflineAudioContext - Thread Smoke Test
6 </title>
7 <script src="../../resources/testharness.js"></script>
8 <script src="../../resources/testharnessreport.js"></script>
9 <script src="../resources/audit.js"></script>
10 </head>
11 <body>
12 <script id="layout-test-code">
13 const audit = Audit.createTaskRunner();
14
15 // The common sample rate.
16 const sampleRate = 48000;
17
18 // To make channel count and buffer length irrelevant to this test.
19 const numberOfChannels = 1;
20 const renderLength = 1;
21
22 // Create 3000 contexts in total. 58.0.3029 on OSX crashes around 2030.
23 const maxNumberOfContexts = 2500;
hongchan 2017/05/23 20:30:19 I've tested up to 5000 with this patch. No crash.
Raymond Toy 2017/05/23 20:37:34 Comment (3000) doesn't match code (2500)
hongchan 2017/05/23 20:55:45 I am cranking this up to 5000.
24
25 // For recursive and sequential rendering of multiple context.
26 function recurseContextRendering(contexts, index, oncomplete) {
27 if (index < maxNumberOfContexts) {
28 contexts[index].startRendering().then(() => {
29 recurseContextRendering(contexts, index + 1, oncomplete);
30 });
31 } else {
32 oncomplete(index);
33 }
34 }
35
36 // Create contexts, render and drop them sequentially. This should not
37 // crash the browser with out-of-threads error. See crbug.com/716800.
38 audit.define(
39 {
40 label: 'thread-creation',
41 description:
42 'Creating ' + maxNumberOfContexts + ' contexts without a crash.'
43 },
44 (task, should) => {
45 let contexts = [];
46 for (let i = 0; i < maxNumberOfContexts; ++i) {
47 contexts.push(new OfflineAudioContext(
48 numberOfChannels, renderLength, sampleRate));
49 }
Raymond Toy 2017/05/23 20:37:34 I think the creation of the contexts should be its
hongchan 2017/05/23 20:55:45 Hmm. I think that's overkill. They're quite trivia
50
51 recurseContextRendering(contexts, 0, (counter) => {
52 should(counter, 'The number of created contexts without a crash')
53 .beEqualTo(maxNumberOfContexts);
54 task.done();
55 });
56 });
57
58 audit.run();
59 </script>
60 </body>
61 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698