Author: ygrego Date: 2015-02-20 11:14:45 +0000 (Fri, 20 Feb 2015) New Revision: 838 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/838 Log: New method "verifWantedPlaySate" in order to not duplicate the code which it contains into method "TestBindToCurrentChannel". Modified: oipf/js/test/VideoBroadcastTest.js Modified: oipf/js/test/VideoBroadcastTest.js =================================================================== --- oipf/js/test/VideoBroadcastTest.js 2015-02-20 09:37:23 UTC (rev 837) +++ oipf/js/test/VideoBroadcastTest.js 2015-02-20 11:14:45 UTC (rev 838) @@ -1,26 +1,23 @@ -/* +/* * Description: * This class gather a set of method necessary to test a video broadcast object. - * + * */ var VideoBroadcastTest = TestCase.extend({ - - videoBroadcastObject: null, - - init: function() { - }, - - /* - * Descrtiption: - * This method test the initialization of video broadcast object. - */ - testInstanceCreation: function(resolve, reject) { - console.log("***************************************************************************************************************************"); + videoBroadcastObject: null, + init: function () { + }, + /* + * Descrtiption: + * This method test the initialization of video broadcast object. + */ + testInstanceCreation: function (resolve, reject) { + console.log("***************************************************************************************************************************"); - console.log("[TEST-RUNNING][Info] Id: vbTestInstanceCreation, Label: Object creation, State: Pending"); - this.videoBroadcastObject = oipfObjectFactory.createVideoBroadcastObject(); - - if (this.assertNotNull(this.videoBroadcastObject) && this.assertNotUndefined(this.videoBroadcastObject)) { + console.log("[TEST-RUNNING][Info] Id: vbTestInstanceCreation, Label: Object creation, State: Pending"); + this.videoBroadcastObject = oipfObjectFactory.createVideoBroadcastObject(); + + if (this.assertNotNull(this.videoBroadcastObject) && this.assertNotUndefined(this.videoBroadcastObject)) { console.log("[TEST-RUNNING][Info] Id: vbTestInstanceCreation, Label: Object creation, State: Successfull"); resolve("Successfull"); } else { @@ -28,27 +25,63 @@ reject("Failure"); } console.log("***************************************************************************************************************************"); - }, - - /* - * Descrtiption: - * This method test the binding between the video broadcast object and the current program stream. - */ - testBindToCurrentChannel: function(resolve, reject) { - console.log("***************************************************************************************************************************"); + }, + /* + * Descrtiption: + * This method test the binding between the video broadcast object and the current program stream. + */ + testBindToCurrentChannel: function (resolve, reject) { + console.log("***************************************************************************************************************************"); - console.log("[TEST-RUNNING][Info] Id: vbTestBindToCurrentChannel, Label: Bind the current channel stream with a video broadcast objectBind the current channel stream with a video broadcast object, State: Pending"); - var currentChann = this.videoBroadcastObject.bindToCurrentChannel(); + console.log("[TEST-RUNNING][Info] Id: vbTestBindToCurrentChannel, Label: Bind the current channel stream with a video broadcast objectBind the current channel stream with a video broadcast object, State: Pending"); + var self = this; + this.videoBroadcastObject.onPlayStateChange = function (state, error) { - if (this.assertEquals(this.videoBroadcastObject.currentChannel, currentChann)) { - console.log("[TEST-RUNNING][Info] Id: vbTestBindToCurrentChannel, Label: Bind the current channel stream with a video broadcast objectBind the current channel stream with a video broadcast object, State: Successfull"); - resolve("Successfull"); + switch (self.videoBroadcastObject.playstate) { + + case 0: + var wantedPlayState = 2; + self.verifWantedPlayState(self, state, wantedPlayState, reject); + //TODO Verfication of binding to the necesssary ressources have achieved with success. + break; + + case 1: + + break; + + case 2: + + break; + + case 3: + var wantedPlayState = 1; + self.verifWantedPlayState(self, state, wantedPlayState, reject); + //TODO Verify that video and audio presentation is enabled + break; + + } + if (self.assertEquals(self.videoBroadcastObject.currentChannel, currentChann)) { + console.log("[TEST-RUNNING][Info] Id: vbTestBindToCurrentChannel, Label: Bind the current channel stream with a video broadcast objectBind the current channel stream with a video broadcast object, State: Successfull"); + resolve("Successfull"); + } else { + console.log("[TEST-RUNNING][Info] Id: vbTestBindToCurrentChannel, Label: Bind the current channel stream with a video broadcast objectBind the current channel stream with a video broadcast object, State: Failure"); + reject("Failure"); + } + console.log("***************************************************************************************************************************"); + + }; + + var currentChann = this.videoBroadcastObject.bindToCurrentChannel(); + + }, + verifWantedPlayState: function (object, receivedPlayState, wantedPlayState, reject) { + if (object.assertEquals(receivedPlayState, wantedPlayState)) { + object.videoBroadcastObject.playstate = receivedPlayState; } else { console.log("[TEST-RUNNING][Info] Id: vbTestBindToCurrentChannel, Label: Bind the current channel stream with a video broadcast objectBind the current channel stream with a video broadcast object, State: Failure"); reject("Failure"); } - console.log("***************************************************************************************************************************"); + } - } - -}); \ No newline at end of file +}); +
participants (1)
-
ygregoï¼ users.nuiton.org