From 7cc1aac3229bb1035a3abc58e5a0f85df070016a Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 2 Apr 2013 08:06:59 -0700 Subject: [PATCH] Bug 850275 - Adds some basic mochitests for offer media constriants. r=jesup --- dom/media/tests/mochitest/Makefile.in | 3 ++ dom/media/tests/mochitest/pc.js | 13 ++++++++- ...rConnection_offerRequiresReceiveAudio.html | 25 +++++++++++++++++ ...rConnection_offerRequiresReceiveVideo.html | 25 +++++++++++++++++ ...ection_offerRequiresReceiveVideoAudio.html | 28 +++++++++++++++++++ 5 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html create mode 100644 dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html diff --git a/dom/media/tests/mochitest/Makefile.in b/dom/media/tests/mochitest/Makefile.in index e13971ed1ac3..76ab887273d1 100644 --- a/dom/media/tests/mochitest/Makefile.in +++ b/dom/media/tests/mochitest/Makefile.in @@ -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 \ diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index 73611e7e3c85..254362500e29 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -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); }, /** diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html new file mode 100644 index 000000000000..f9cda2fbbff0 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html @@ -0,0 +1,25 @@ + + + + + + + + + +
+
+
+ + diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html new file mode 100644 index 000000000000..f734b318d011 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html @@ -0,0 +1,25 @@ + + + + + + + + + +
+
+
+ + diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html new file mode 100644 index 000000000000..6b50c27d50c1 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html @@ -0,0 +1,28 @@ + + + + + + + + + +
+
+
+ +