| Index: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-thread-smoke-test.html
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-thread-smoke-test.html b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-thread-smoke-test.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..88342271a2299a1e5341318ac4e67f19def4025f
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-thread-smoke-test.html
|
| @@ -0,0 +1,76 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| + <head>
|
| + <title>
|
| + OfflineAudioContext - Thread Smoke Test
|
| + </title>
|
| + <script src="../../resources/testharness.js"></script>
|
| + <script src="../../resources/testharnessreport.js"></script>
|
| + <script src="../resources/audit.js"></script>
|
| + </head>
|
| + <body>
|
| + <script id="layout-test-code">
|
| + const audit = Audit.createTaskRunner();
|
| +
|
| + // The common sample rate.
|
| + const sampleRate = 48000;
|
| +
|
| + // To make channel count and buffer length irrelevant to this test.
|
| + const numberOfChannels = 1;
|
| + const renderLength = 1;
|
| +
|
| + // Create 2500 contexts in total. 58.0.3029 on OSX crashes around 2030.
|
| + const maxNumberOfContexts = 2500;
|
| +
|
| + let contexts = [];
|
| +
|
| + // For recursive and sequential rendering of multiple context.
|
| + function recurseContextRendering(index, oncomplete) {
|
| + if (index < maxNumberOfContexts) {
|
| + contexts[index].startRendering().then(() => {
|
| + recurseContextRendering(index + 1, oncomplete);
|
| + });
|
| + } else {
|
| + oncomplete(index);
|
| + }
|
| + }
|
| +
|
| + // Create contexts up front, but do not start rendering. Based on
|
| + // crbug.com/716800, this caused a crash with out-of-threads error.
|
| + audit.define(
|
| + {
|
| + label: 'context-creation-smoketest',
|
| + description:
|
| + 'Creating ' + maxNumberOfContexts + ' contexts up front.'
|
| + },
|
| + (task, should) => {
|
| + let i;
|
| + for (i = 0; i < maxNumberOfContexts; ++i) {
|
| + contexts.push(new OfflineAudioContext(
|
| + numberOfChannels, renderLength, sampleRate));
|
| + }
|
| + should(i, 'The number of created contexts without a crash')
|
| + .beEqualTo(maxNumberOfContexts);
|
| + task.done();
|
| + });
|
| +
|
| + // Create contexts, render and drop them sequentially. This should not
|
| + // crash the browser with out-of-threads error.
|
| + audit.define(
|
| + {
|
| + label: 'rendering-thread-smoketest',
|
| + description:
|
| + 'Rendering ' + maxNumberOfContexts + ' contexts sequentially.'
|
| + },
|
| + (task, should) => {
|
| + recurseContextRendering(0, (counter) => {
|
| + should(counter, 'The number of contexts rendered without a crash')
|
| + .beEqualTo(maxNumberOfContexts);
|
| + task.done();
|
| + });
|
| + });
|
| +
|
| + audit.run();
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|