mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1026766 - Support Media AudioNodes in the web audio editor. r=vp
From fe7f1f72bdb00e0ad2d687d40548138de506a4d6 Mon Sep 17 00:00:00 2001 --- browser/devtools/webaudioeditor/test/browser.ini | 2 + .../test/browser_wa_properties-view-media-nodes.js | 45 ++++++++++++++++++++++ .../test/doc_media-node-creation.html | 29 ++++++++++++++ browser/devtools/webaudioeditor/test/head.js | 16 ++++++++ toolkit/devtools/server/actors/webaudio.js | 7 +++- 5 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 browser/devtools/webaudioeditor/test/browser_wa_properties-view-media-nodes.js create mode 100644 browser/devtools/webaudioeditor/test/doc_media-node-creation.html
This commit is contained in:
parent
26b8c91615
commit
34256306a2
@ -6,6 +6,7 @@ support-files =
|
||||
doc_complex-context.html
|
||||
doc_simple-node-creation.html
|
||||
doc_buffer-and-array.html
|
||||
doc_media-node-creation.html
|
||||
440hz_sine.ogg
|
||||
head.js
|
||||
|
||||
@ -32,6 +33,7 @@ support-files =
|
||||
[browser_wa_inspector-toggle.js]
|
||||
|
||||
[browser_wa_properties-view.js]
|
||||
[browser_wa_properties-view-media-nodes.js]
|
||||
# [browser_wa_properties-view-edit.js]
|
||||
# Disabled for too many intermittents bug 1010423
|
||||
[browser_wa_properties-view-params.js]
|
||||
|
@ -0,0 +1,45 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Tests that params view correctly displays all properties for nodes
|
||||
* correctly, with default values and correct types.
|
||||
*/
|
||||
|
||||
let MEDIA_PERMISSION = "media.navigator.permission.disabled";
|
||||
|
||||
function spawnTest() {
|
||||
let [target, debuggee, panel] = yield initWebAudioEditor(MEDIA_NODES_URL);
|
||||
let { panelWin } = panel;
|
||||
let { gFront, $, $$, EVENTS, WebAudioInspectorView } = panelWin;
|
||||
let gVars = WebAudioInspectorView._propsView;
|
||||
|
||||
// Auto enable getUserMedia
|
||||
let mediaPermissionPref = Services.prefs.getBoolPref(MEDIA_PERMISSION);
|
||||
Services.prefs.setBoolPref(MEDIA_PERMISSION, true);
|
||||
|
||||
reload(target);
|
||||
|
||||
let [actors] = yield Promise.all([
|
||||
getN(gFront, "create-node", 4),
|
||||
waitForGraphRendered(panelWin, 4, 0)
|
||||
]);
|
||||
|
||||
let nodeIds = actors.map(actor => actor.actorID);
|
||||
let types = [
|
||||
"AudioDestinationNode", "MediaElementAudioSourceNode",
|
||||
"MediaStreamAudioSourceNode", "MediaStreamAudioDestinationNode"
|
||||
];
|
||||
|
||||
for (let i = 0; i < types.length; i++) {
|
||||
click(panelWin, findGraphNode(panelWin, nodeIds[i]));
|
||||
yield once(panelWin, EVENTS.UI_INSPECTOR_NODE_SET);
|
||||
checkVariableView(gVars, 0, NODE_DEFAULT_VALUES[types[i]], types[i]);
|
||||
}
|
||||
|
||||
// Reset permissions on getUserMedia
|
||||
Services.prefs.setBoolPref(MEDIA_PERMISSION, mediaPermissionPref);
|
||||
|
||||
yield teardown(panel);
|
||||
finish();
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<!doctype html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Web Audio Editor test page</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<script type="text/javascript;version=1.8">
|
||||
"use strict";
|
||||
|
||||
let ctx = new AudioContext();
|
||||
let audio = new Audio();
|
||||
let meNode, msNode, mdNode;
|
||||
navigator.getUserMedia = navigator.getUserMedia || navigator.mozGetUserMedia;
|
||||
|
||||
navigator.getUserMedia({ audio: true }, stream => {
|
||||
meNode = ctx.createMediaElementSource(audio);
|
||||
msNode = ctx.createMediaStreamSource(stream);
|
||||
mdNode = ctx.createMediaStreamDestination();
|
||||
}, () => {});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -24,6 +24,7 @@ const EXAMPLE_URL = "http://example.com/browser/browser/devtools/webaudioeditor/
|
||||
const SIMPLE_CONTEXT_URL = EXAMPLE_URL + "doc_simple-context.html";
|
||||
const COMPLEX_CONTEXT_URL = EXAMPLE_URL + "doc_complex-context.html";
|
||||
const SIMPLE_NODES_URL = EXAMPLE_URL + "doc_simple-node-creation.html";
|
||||
const MEDIA_NODES_URL = EXAMPLE_URL + "doc_media-node-creation.html";
|
||||
const BUFFER_AND_ARRAY_URL = EXAMPLE_URL + "doc_buffer-and-array.html";
|
||||
|
||||
// All tests are asynchronous.
|
||||
@ -216,6 +217,16 @@ function checkVariableView (view, index, hash, description = "") {
|
||||
info("Checking Variable View");
|
||||
let scope = view.getScopeAtIndex(index);
|
||||
let variables = Object.keys(hash);
|
||||
|
||||
// If node shouldn't display any properties, ensure that the 'empty' message is
|
||||
// visible
|
||||
if (!variables.length) {
|
||||
ok(isVisible(scope.window.$("#properties-tabpanel-content-empty")),
|
||||
description + " should show the empty properties tab.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, iterate over expected properties
|
||||
variables.forEach(variable => {
|
||||
let aVar = scope.get(variable);
|
||||
is(aVar.target.querySelector(".name").getAttribute("value"), variable,
|
||||
@ -367,6 +378,11 @@ function countGraphObjects (win) {
|
||||
|
||||
const NODE_DEFAULT_VALUES = {
|
||||
"AudioDestinationNode": {},
|
||||
"MediaElementAudioSourceNode": {},
|
||||
"MediaStreamAudioSourceNode": {},
|
||||
"MediaStreamAudioDestinationNode": {
|
||||
"stream": "MediaStream"
|
||||
},
|
||||
"AudioBufferSourceNode": {
|
||||
"playbackRate": 1,
|
||||
"loop": false,
|
||||
|
@ -104,7 +104,12 @@ const NODE_PROPERTIES = {
|
||||
},
|
||||
"AudioDestinationNode": {},
|
||||
"ChannelSplitterNode": {},
|
||||
"ChannelMergerNode": {}
|
||||
"ChannelMergerNode": {},
|
||||
"MediaElementAudioSourceNode": {},
|
||||
"MediaStreamAudioSourceNode": {},
|
||||
"MediaStreamAudioDestinationNode": {
|
||||
"stream": { "MediaStream": true }
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user