Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-thread-creation.html |
| diff --git a/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-thread-creation.html b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-thread-creation.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8c26aa6e217d6cb3995b920286084bf049b23a77 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-thread-creation.html |
| @@ -0,0 +1,54 @@ |
| +<!DOCTYPE html> |
| +<html> |
| + <head> |
| + <title> |
| + OfflineAudioContext - Thread Creation |
| + </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(); |
|
Raymond Toy
2017/05/23 17:05:01
Ah, we should do this in the rest of the code. Fo
hongchan
2017/05/23 18:10:38
Yeap. I am testing more ideas from ES6 pattern. Th
|
| + |
| + // 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, 1 context per 5ms. |
|
Raymond Toy
2017/05/23 17:05:01
Why 2500? And why every 5 ms? Doesn't this mean
hongchan
2017/05/23 18:10:38
I was simply using the repro code from the bug. I
Raymond Toy
2017/05/23 18:13:28
12.5 sec for the test seems really bad.
I think i
|
| + const maxNumberOfContexts = 2500; |
| + const contextCreationIntervalInMS = 5; |
| + |
| + // Create multiple contexts and drop them rapidly. This should not crash |
| + // the browser with out-of-threads error. The repro code is from |
| + // crbug.com/716800. |
| + audit.define( |
| + { |
| + label: 'thread-creation', |
| + description: 'Creating ' + maxNumberOfContexts + |
| + ' contexts without a crash.' |
| + }, |
| + (task, should) => { |
| + let numberOfContexts = 0; |
| + let timerId = setInterval(() => { |
| + let context = new OfflineAudioContext( |
| + numberOfChannels, renderLength, sampleRate); |
| + delete context; |
| + if (++numberOfContexts === maxNumberOfContexts) { |
| + clearInterval(timerId); |
| + should(numberOfContexts, |
| + 'The number of created contexts without a crash') |
| + .beEqualTo(maxNumberOfContexts); |
| + task.done(); |
| + } |
| + }, contextCreationIntervalInMS); |
| + }); |
| + |
| + audit.run(); |
| + </script> |
| + </body> |
| +</html> |