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

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

Issue 398573005: Gracefully handle ScriptProcessorNode event processing when detached. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tidy test Created 6 years, 5 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/scriptprocessornode-detached-no-crash.html
diff --git a/LayoutTests/webaudio/scriptprocessornode-detached-no-crash.html b/LayoutTests/webaudio/scriptprocessornode-detached-no-crash.html
new file mode 100644
index 0000000000000000000000000000000000000000..816304a4457aa07085ca33eb7950b29ce2d46a54
--- /dev/null
+++ b/LayoutTests/webaudio/scriptprocessornode-detached-no-crash.html
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="resources/compatibility.js"></script>
+<script src="resources/audio-testing.js"></script>
+<script src="../resources/js-test.js"></script>
+</head>
+<body>
+<script>
+description("Tests that ScriptProcessorNode event dispatch doesn't fail when detached from document.");
+
+window.jsTestIsAsync = true;
+
+var sampleRate = 44100.0;
+var renderLengthInFrames = 512;
+var bufferSize = 512;
+var context;
+function runTest()
+{
+ var node;
+
+ try {
+ node = context.createScriptProcessor(bufferSize, 0, 1);
+ testPassed("Successfully created ScriptProcessorNode.");
+ } catch (e) {
+ testFailed("Failed to create ScriptProcessorNode.");
+ }
+
+ 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);
+ w.close();
+ } else if (event.data == "closed") {
+ runTest();
+ finishJSTest();
+ }
+}
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ testRunner.setCanOpenWindows();
+}
+
+w = window.open('resources/scriptprocessornode-detached-no-crash-new-window.html');
+window.addEventListener("message", processMessage, false);
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698