Add audionode-iframe.window.js to
third_party/blink/web_tests/external/wpt/webaudio/the-audio-api/the-audionode-interface/
When AudioNode is constructed from iframe, we expect the associated
AudioContext should be put into closed state after iframe is destroyed
SPEC: https://www.w3.org/TR/webaudio/#lifetime-AudioContext
Change-Id: Ia8cf6c3877bf5024fa1ce3b5f2934c79e2bc8d6f
Bug: 679784
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3646185
Reviewed-by: Michael Wilson <mjwilson@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Alvin Ji <alvinji@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1004477}
diff --git a/webaudio/the-audio-api/the-audionode-interface/audionode-iframe.window.js b/webaudio/the-audio-api/the-audionode-interface/audionode-iframe.window.js
new file mode 100644
index 0000000..89bdf2a
--- /dev/null
+++ b/webaudio/the-audio-api/the-audionode-interface/audionode-iframe.window.js
@@ -0,0 +1,14 @@
+test(function() {
+ const iframe =
+ document.createElementNS('http://www.w3.org/1999/xhtml', 'iframe');
+ document.body.appendChild(iframe);
+
+ // Create AudioContext and AudioNode from iframe
+ const context = new iframe.contentWindow.AudioContext();
+ const source = context.createOscillator();
+ source.connect(context.destination);
+
+ // AudioContext should be put closed state after iframe destroyed
+ document.body.removeChild(iframe);
+ assert_equals(context.state, 'closed');
+}, 'Call a constructor from iframe page and then destroy the iframe');