Bug 850275 - Adds some basic mochitests for offer media constriants. r=jesup

This commit is contained in:
Jason Smith 2013-04-02 08:06:59 -07:00
parent 1ae52b18d9
commit be5f1d1d63
5 changed files with 93 additions and 1 deletions

View File

@ -30,6 +30,9 @@ MOCHITEST_FILES = \
test_peerConnection_basicAudioVideoCombined.html \
test_peerConnection_basicVideo.html \
test_peerConnection_errorCallbacks.html \
test_peerConnection_offerRequiresReceiveAudio.html \
test_peerConnection_offerRequiresReceiveVideo.html \
test_peerConnection_offerRequiresReceiveVideoAudio.html \
test_peerConnection_bug822674.html \
test_peerConnection_bug825703.html \
test_peerConnection_bug827843.html \

View File

@ -359,6 +359,16 @@ function PCT_setMediaConstraints(constraintsLocal, constraintsRemote) {
this.pcRemote.constraints = constraintsRemote;
};
/**
* Sets the media constraints used on a createOffer call in the test.
*
* @param {object} constraints the media constraints to use on createOffer
*/
PeerConnectionTest.prototype.setOfferConstraints =
function PCT_setOfferConstraints(constraints) {
this.pcLocal.offerConstraints = constraints;
};
/**
* Start running the tests as assigned to the command chain.
*/
@ -399,6 +409,7 @@ function PeerConnectionWrapper(label, configuration) {
this.label = label;
this.constraints = [ ];
this.offerConstraints = {};
this.streams = [ ];
info("Creating new PeerConnectionWrapper: " + this.label);
@ -525,7 +536,7 @@ PeerConnectionWrapper.prototype = {
info("Got offer: " + JSON.stringify(offer));
self._last_offer = offer;
onSuccess(offer);
}, unexpectedCallbackAndFinish);
}, unexpectedCallbackAndFinish, this.offerConstraints);
},
/**

View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "850275",
title: "Simple offer media constraint test with audio"
});
runTest(function() {
var test = new PeerConnectionTest();
test.setOfferConstraints({ mandatory: { OfferToReceiveAudio: true } });
test.run();
}, true);
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "850275",
title: "Simple offer media constraint test with video"
});
runTest(function() {
var test = new PeerConnectionTest();
test.setOfferConstraints({ mandatory: { OfferToReceiveVideo: true } });
test.run();
}, true);
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "850275",
title: "Simple offer media constraint test with video/audio"
});
runTest(function() {
var test = new PeerConnectionTest();
test.setOfferConstraints({ mandatory: {
OfferToReceiveVideo: true,
OfferToReceiveAudio: true
}});
test.run();
}, true);
</script>
</pre>
</body>
</html>