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

Unified Diff: LayoutTests/webaudio/offlineaudiocontext-detached-no-crash.html

Issue 1111213002: Treat a stopped AudioContext as closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: startRendering() doesn't (directly) raise an exception Created 5 years, 8 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: LayoutTests/webaudio/offlineaudiocontext-detached-no-crash.html
diff --git a/LayoutTests/webaudio/scriptprocessornode-detached-no-crash.html b/LayoutTests/webaudio/offlineaudiocontext-detached-no-crash.html
similarity index 54%
copy from LayoutTests/webaudio/scriptprocessornode-detached-no-crash.html
copy to LayoutTests/webaudio/offlineaudiocontext-detached-no-crash.html
index 9ab6745d7d42b5d0f9052e8bc66e56bd1fd6aae9..378de48ed496fbb1b6bf5fd27234c36a756403b2 100644
--- a/LayoutTests/webaudio/scriptprocessornode-detached-no-crash.html
+++ b/LayoutTests/webaudio/offlineaudiocontext-detached-no-crash.html
@@ -7,44 +7,51 @@
</head>
<body>
<script>
-description("Tests that ScriptProcessorNode event dispatch doesn't fail when detached from document.");
+description("Tests document-detached use of OfflineAudioContext, pass if no crash.");
window.jsTestIsAsync = true;
-var sampleRate = 44100.0;
-var renderLengthInFrames = 512;
-var bufferSize = 512;
+function errorCallback(error)
+{
+ testPassed("OfflineAudioContext.startRendering() on a closed context threw an exception.");
+ finishJSTest();
+}
+
+function successCallback()
+{
+ testFailed("OfflineAudioContext.startRendering() on a closed context did not throw an exception.");
+ finishJSTest();
+}
+
var context;
function runTest()
{
- var node;
+ context.startRendering().then(successCallback, errorCallback);
+}
- try {
- node = context.createScriptProcessor(bufferSize, 0, 1);
- testPassed("Successfully created ScriptProcessorNode.");
- } catch (e) {
- testFailed("Failed to create ScriptProcessorNode.");
- }
+function createOfflineContext()
+{
+ var sampleRate = 44100.0;
+ var renderLengthInFrames = 512;
+ var bufferSize = 512;
+ context = new w.OfflineAudioContext(1, renderLengthInFrames, sampleRate);
+ var node = context.createScriptProcessor(bufferSize, 0, 1);
var source = context.createBufferSource();
source.buffer = createImpulseBuffer(context, bufferSize);
-
node.onaudioprocess = function(e) { };
source.connect(node);
node.connect(context.destination);
source.start(0);
-
- context.startRendering();
}
var w;
function processMessage(event) {
if (event.data == "opened") {
- context = new w.OfflineAudioContext(1, renderLengthInFrames, sampleRate);
+ createOfflineContext();
w.close();
} else if (event.data == "closed") {
- runTest();
- finishJSTest();
+ setTimeout(runTest, 100);
}
}
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/webaudio/offlineaudiocontext-detached-no-crash-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698