From ef2b4d6c80ea51eee5232f11d1fc813299874026 Mon Sep 17 00:00:00 2001 From: "Adam Roach [:abr]" Date: Tue, 4 Jun 2013 16:54:29 -0500 Subject: [PATCH] Backed out changeset 8ec73e6aa7d3 (bug 784519) r=bustage --- dom/media/tests/mochitest/Makefile.in | 7 - dom/media/tests/mochitest/head.js | 16 +- dom/media/tests/mochitest/pc.js | 179 ++---------------- ...nnection_addCandidateInHaveLocalOffer.html | 43 ----- ...ection_setLocalAnswerInHaveLocalOffer.html | 41 ---- ...peerConnection_setLocalAnswerInStable.html | 41 ---- ...ection_setLocalOfferInHaveRemoteOffer.html | 40 ---- ...tion_setRemoteAnswerInHaveRemoteOffer.html | 41 ---- ...eerConnection_setRemoteAnswerInStable.html | 41 ---- ...ection_setRemoteOfferInHaveLocalOffer.html | 40 ---- 10 files changed, 14 insertions(+), 475 deletions(-) delete mode 100644 dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html delete mode 100644 dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html delete mode 100644 dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html delete mode 100644 dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html delete mode 100644 dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html delete mode 100644 dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html delete mode 100644 dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html diff --git a/dom/media/tests/mochitest/Makefile.in b/dom/media/tests/mochitest/Makefile.in index 9b9c102ca73f..2720ee9ccf2c 100644 --- a/dom/media/tests/mochitest/Makefile.in +++ b/dom/media/tests/mochitest/Makefile.in @@ -35,13 +35,6 @@ MOCHITEST_FILES = \ test_peerConnection_offerRequiresReceiveVideo.html \ test_peerConnection_offerRequiresReceiveVideoAudio.html \ test_peerConnection_throwInCallbacks.html \ - test_peerConnection_setLocalAnswerInStable.html \ - test_peerConnection_setRemoteAnswerInStable.html \ - test_peerConnection_setLocalAnswerInHaveLocalOffer.html \ - test_peerConnection_setRemoteOfferInHaveLocalOffer.html \ - test_peerConnection_setLocalOfferInHaveRemoteOffer.html \ - test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html \ - test_peerConnection_addCandidateInHaveLocalOffer.html \ test_peerConnection_bug822674.html \ test_peerConnection_bug825703.html \ test_peerConnection_bug827843.html \ diff --git a/dom/media/tests/mochitest/head.js b/dom/media/tests/mochitest/head.js index 2099790644be..0a9a5d307728 100644 --- a/dom/media/tests/mochitest/head.js +++ b/dom/media/tests/mochitest/head.js @@ -182,23 +182,11 @@ function unexpectedCallbackAndFinish(error) { return function(aObj) { var where = error.fileName + ":" + error.lineNumber; if (aObj && aObj.name && aObj.message) { - ok(false, "Unexpected callback/event from " + where + " with name = '" + + ok(false, "Unexpected error callback from " + where + " with name = '" + aObj.name + "', message = '" + aObj.message + "'"); } else { - ok(false, "Unexpected callback/event from " + where + " with " + aObj); + ok(false, "Unexpected error callback from " + where + " with " + aObj); } SimpleTest.finish(); } } - -/** - * Generates a callback function suitable for putting int a success - * callback in circumstances where success is unexpected. The callback, - * if activated, will kill off the test gracefully. - */ - -function unexpectedSuccessCallbackAndFinish(error, reason) { - return function() { - unexpectedCallbackAndFinish(error)(message); - } -} diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index 78d17471812d..dc6c747cf1ff 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -246,19 +246,10 @@ var commandsPeerConnection = [ }); } ], - [ - 'PC_CHECK_INITIAL_SIGNALINGSTATE', - function (test) { - is(test.pcLocal.signalingState,"stable", "Initial local signalingState is stable"); - is(test.pcRemote.signalingState,"stable", "Initial remote signalingState is stable"); - test.next(); - } - ], [ 'PC_LOCAL_CREATE_OFFER', function (test) { test.pcLocal.createOffer(function () { - is(test.pcLocal.signalingState, "stable", "Local create offer does not change signaling state"); test.next(); }); } @@ -266,24 +257,23 @@ var commandsPeerConnection = [ [ 'PC_LOCAL_SET_LOCAL_DESCRIPTION', function (test) { - test.expectStateChange(test.pcLocal, "have-local-offer", test); - test.pcLocal.setLocalDescription(test.pcLocal._last_offer, - test.checkStateInCallback(test.pcLocal, "have-local-offer", test)); + test.pcLocal.setLocalDescription(test.pcLocal._last_offer, function () { + test.next(); + }); } ], [ 'PC_REMOTE_SET_REMOTE_DESCRIPTION', function (test) { - test.expectStateChange(test.pcRemote, "have-remote-offer", test); - test.pcRemote.setRemoteDescription(test.pcLocal._last_offer, - test.checkStateInCallback(test.pcRemote, "have-remote-offer", test)); + test.pcRemote.setRemoteDescription(test.pcLocal._last_offer, function () { + test.next(); + }); } ], [ 'PC_REMOTE_CREATE_ANSWER', function (test) { test.pcRemote.createAnswer(function () { - is(test.pcRemote.signalingState, "have-remote-offer", "Remote create offer does not change signaling state"); test.next(); }); } @@ -291,17 +281,17 @@ var commandsPeerConnection = [ [ 'PC_LOCAL_SET_REMOTE_DESCRIPTION', function (test) { - test.expectStateChange(test.pcLocal, "stable", test); - test.pcLocal.setRemoteDescription(test.pcRemote._last_answer, - test.checkStateInCallback(test.pcLocal, "stable", test)); + test.pcLocal.setRemoteDescription(test.pcRemote._last_answer, function () { + test.next(); + }); } ], [ 'PC_REMOTE_SET_LOCAL_DESCRIPTION', function (test) { - test.expectStateChange(test.pcRemote, "stable", test); - test.pcRemote.setLocalDescription(test.pcRemote._last_answer, - test.checkStateInCallback(test.pcRemote, "stable", test)); + test.pcRemote.setLocalDescription(test.pcRemote._last_answer, function () { + test.next(); + }); } ], [ @@ -404,64 +394,6 @@ PeerConnectionTest.prototype.teardown = function PCT_teardown() { SimpleTest.finish(); }; -/** - * Sets up the "onsignalingstatechange" handler for the indicated peerconnection - * as a one-shot test. If the test.commandSuccess flag is set when the event - * happens, then the next test in the command chain is triggered. After - * running, this sets the event handler so that it will fail the test if - * it fires again before we expect it. This is intended to be used in - * conjunction with checkStateInCallback, below. - * - * @param {pcw} PeerConnectionWrapper - * The peer connection to expect a state change on - * @param {state} string - * The state that we expect to change to - * @param {test} PeerConnectionTest - * The test strucure currently in use. - */ -PeerConnectionTest.prototype.expectStateChange = -function PCT_expectStateChange(pcw, state, test) { - pcw.signalingChangeEvent = false; - pcw._pc.onsignalingstatechange = function() { - pcw._pc.onsignalingstatechange = unexpectedCallbackAndFinish(new Error); - is(pcw._pc.signalingState, state, pcw.label + ": State is " + state + " in onsignalingstatechange"); - pcw.signalingChangeEvent = true; - if (pcw.commandSuccess) { - test.next(); - } else { - info("Waiting for success callback..."); - } - }; -} - -/** - * Returns a function, suitable for use as a success callback, that - * checks the signaling state of the PC; and, if the signalingstatechange - * event has already fired, moves on to the next test case. This is - * intended to be used in conjunction with expectStateChange, above. - * - * @param {pcw} PeerConnectionWrapper - * The peer connection to expect a state change on - * @param {state} string - * The state that we expect to change to - * @param {test} PeerConnectionTest - * The test strucure currently in use. - */ - -PeerConnectionTest.prototype.checkStateInCallback = -function PCT_checkStateInCallback(pcw, state, test) { - pcw.commandSuccess = false; - return function() { - pcw.commandSuccess = true; - is(pcw.signalingState, state, pcw.label + ": State is " + state + " in success callback"); - if (pcw.signalingChangeEvent) { - test.next(); - } else { - info("Waiting for signalingstatechange event..."); - } - }; -} - /** * This class handles acts as a wrapper around a PeerConnection instance. @@ -488,9 +420,6 @@ function PeerConnectionWrapper(label, configuration) { // Bug 834835: Assume type is video until we get get{Audio,Video}Tracks. self.attachMedia(event.stream, 'video', 'remote'); }; - - // Make sure no signaling state changes are fired until we expect them to - this._pc.onsignalingstatechange = unexpectedCallbackAndFinish(new Error); } PeerConnectionWrapper.prototype = { @@ -533,15 +462,6 @@ PeerConnectionWrapper.prototype = { this._pc.remoteDescription = desc; }, - /** - * Returns the remote signaling state. - * - * @returns {object} The local description - */ - get signalingState() { - return this._pc.signalingState; - }, - /** * Callback when we get media from either side. Also an appropriate * HTML media element will be created. @@ -651,25 +571,6 @@ PeerConnectionWrapper.prototype = { }, unexpectedCallbackAndFinish(new Error)); }, - /** - * Tries to set the local description and expect failure. Automatically - * causes the test case to fail if the call succeeds. - * - * @param {object} desc - * mozRTCSessionDescription for the local description request - * @param {function} onFailure - * Callback to execute if the call fails. - */ - setLocalDescriptionAndFail : function PCW_setLocalDescriptionAndFail(desc, onFailure) { - var self = this; - this._pc.setLocalDescription(desc, - unexpectedSuccessCallbackAndFinish(new Error, "setLocalDescription should have failed."), - function (err) { - info("As expected, failed to set the local description for " + self.label); - onFailure(err); - }); - }, - /** * Sets the remote description and automatically handles the failure case. * @@ -686,62 +587,6 @@ PeerConnectionWrapper.prototype = { }, unexpectedCallbackAndFinish(new Error)); }, - /** - * Tries to set the remote description and expect failure. Automatically - * causes the test case to fail if the call succeeds. - * - * @param {object} desc - * mozRTCSessionDescription for the remote description request - * @param {function} onFailure - * Callback to execute if the call fails. - */ - setRemoteDescriptionAndFail : function PCW_setRemoteDescriptionAndFail(desc, onFailure) { - var self = this; - this._pc.setRemoteDescription(desc, - unexpectedSuccessCallbackAndFinish(new Error, "setRemoteDescription should have failed."), - function (err) { - info("As expected, failed to set the remote description for " + self.label); - onFailure(err); - }); - }, - - /** - * Adds an ICE candidate and automatically handles the failure case. - * - * @param {object} candidate - * SDP candidate - * @param {function} onSuccess - * Callback to execute if the local description was set successfully - */ - addIceCandidate : function PCW_addIceCandidate(candidate, onSuccess) { - var self = this; - - this._pc.addIceCandidate(candidate, function () { - info("Successfully added an ICE candidate to " + self.label); - onSuccess(); - }, unexpectedCallbackAndFinish(new Error)); - }, - - /** - * Tries to add an ICE candidate and expects failure. Automatically - * causes the test case to fail if the call succeeds. - * - * @param {object} candidate - * SDP candidate - * @param {function} onFailure - * Callback to execute if the call fails. - */ - addIceCandidateAndFail : function PCW_addIceCandidateAndFail(candidate, onFailure) { - var self = this; - - this._pc.addIceCandidate(candidate, - unexpectedSuccessCallbackAndFinish(new Error, "addIceCandidate should have failed."), - function (err) { - info("As expected, failed to add an ICE candidate to " + self.label); - onFailure(err); - }) ; - }, - /** * Checks that we are getting the media we expect. * diff --git a/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html deleted file mode 100644 index 21a1fe65b1f8..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - -
-
-
- - diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html deleted file mode 100644 index 1873d52eaf22..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - -
-
-
- - diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html deleted file mode 100644 index c92b3b686a97..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - -
-
-
- - diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html b/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html deleted file mode 100644 index 41052d403708..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - -
-
-
- - diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html deleted file mode 100644 index 6864c7695fe4..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - -
-
-
- - diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html deleted file mode 100644 index 33505a9d0a43..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - -
-
-
- - diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html deleted file mode 100644 index fb1987e66746..000000000000 --- a/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - -
-
-
- -