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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
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..c6133d15a70db6242e7754e3fdd7735daf404613
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-thread-smoke-test.html
@@ -0,0 +1,61 @@
+<!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 3000 contexts in total. 58.0.3029 on OSX crashes around 2030.
+ 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.
+
+ // For recursive and sequential rendering of multiple context.
+ function recurseContextRendering(contexts, index, oncomplete) {
+ if (index < maxNumberOfContexts) {
+ contexts[index].startRendering().then(() => {
+ recurseContextRendering(contexts, index + 1, oncomplete);
+ });
+ } else {
+ oncomplete(index);
+ }
+ }
+
+ // Create contexts, render and drop them sequentially. This should not
+ // crash the browser with out-of-threads error. See crbug.com/716800.
+ audit.define(
+ {
+ label: 'thread-creation',
+ description:
+ 'Creating ' + maxNumberOfContexts + ' contexts without a crash.'
+ },
+ (task, should) => {
+ let contexts = [];
+ for (let i = 0; i < maxNumberOfContexts; ++i) {
+ contexts.push(new OfflineAudioContext(
+ numberOfChannels, renderLength, sampleRate));
+ }
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
+
+ recurseContextRendering(contexts, 0, (counter) => {
+ should(counter, 'The number of created contexts without a crash')
+ .beEqualTo(maxNumberOfContexts);
+ task.done();
+ });
+ });
+
+ audit.run();
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698