Bug 931903 - Add mochitest for forwarding a stream from one PC to another. r=jesup,drno

This commit is contained in:
Andreas Pehrson 2015-02-22 22:45:00 +01:00
parent d64f30be42
commit 202ee444c6
3 changed files with 47 additions and 0 deletions

View File

@ -105,6 +105,8 @@ skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabl
skip-if = toolkit == 'gonk' # b2g (Bug 1059867)
[test_peerConnection_errorCallbacks.html]
skip-if = toolkit == 'gonk' # b2g (Bug 1059867)
[test_peerConnection_forwarding_basicAudioVideoCombined.html]
skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_peerConnection_noTrickleAnswer.html]
skip-if = toolkit == 'gonk' # b2g (Bug 1059867)
[test_peerConnection_noTrickleOffer.html]

View File

@ -731,6 +731,9 @@ DataChannelWrapper.prototype = {
*/
function PeerConnectionWrapper(label, configuration, h264) {
this.configuration = configuration;
if (configuration && configuration.label_suffix) {
label = label + "_" + configuration.label_suffix;
}
this.label = label;
this.whenCreated = Date.now();

View File

@ -0,0 +1,42 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript;version=1.8">
createHTML({
bug: "931903",
title: "Forwarding a stream from a combined audio/video peerconnection to another"
});
runNetworkTest(function() {
var gumTest = new PeerConnectionTest();
var forwardingOptions = { config_local: { label_suffix: "forwarded" },
config_remote: { label_suffix: "forwarded" } };
var forwardingTest = new PeerConnectionTest(forwardingOptions);
gumTest.setMediaConstraints([{audio: true, video: true}], []);
forwardingTest.setMediaConstraints([{audio: true, video: true}], []);
forwardingTest.chain.replace("PC_LOCAL_GUM", [
function PC_FORWARDING_CAPTUREVIDEO(test) {
var streams = gumTest.pcRemote._pc.getRemoteStreams();
is(streams.length, 1, "One stream to forward");
is(streams[0].getTracks().length, 2, "Forwarded stream has 2 tracks");
forwardingTest.pcLocal.attachMedia(streams[0], 'audiovideo', 'local');
return Promise.resolve();
}
]);
gumTest.chain.removeAfter("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT");
gumTest.chain.execute()
.then(() => forwardingTest.chain.execute())
.then(() => gumTest.close())
.then(() => forwardingTest.close())
.then(() => networkTestFinished());
});
</script>
</pre>
</body>
</html>