Author: ygrego Date: 2015-02-20 14:00:43 +0000 (Fri, 20 Feb 2015) New Revision: 841 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/841 Log: Errors management in method "onPlayStateChange" (about play state changement) defined into method "testBindToCurrentChannel". Modified: oipf/js/test/VideoBroadcastTest.js Modified: oipf/js/test/VideoBroadcastTest.js =================================================================== --- oipf/js/test/VideoBroadcastTest.js 2015-02-20 11:38:34 UTC (rev 840) +++ oipf/js/test/VideoBroadcastTest.js 2015-02-20 14:00:43 UTC (rev 841) @@ -54,12 +54,14 @@ 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) { - + + var wantedPlayState; + var VerifWantedPlayStateRes; switch (self.videoBroadcastObject.playstate) { case 0: - var wantedPlayState = 2; - self.verifWantedPlayState(self, state, wantedPlayState, reject); + wantedPlayState = 2; + VerifWantedPlayStateRes = self.verifWantedPlayState(self, state, wantedPlayState, reject); //TODO Verfication of binding to the necesssary ressources have achieved with success. break; @@ -72,19 +74,36 @@ break; case 3: - var wantedPlayState = 1; - self.verifWantedPlayState(self, state, wantedPlayState, reject); + wantedPlayState = 1; + VerifWantedPlayStateRes = self.verifWantedPlayState(self, state, wantedPlayState, reject); //TODO Verify that video and audio presentation is enabled break; } + + var success; + success = VerifWantedPlayStateRes[0]; + var errorPlayState = ""; + if (!success) { + errorPlayState = VerifWantedPlayStateRes[1]; + } + + var errorBind = ""; 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"); + success = true; } 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"); + success = false; + errorBind = " In binding to current channel."; } + + if (error || (!success)) { + var errorText = self.error[error]; + reject(errorBind + " " + errorText + " " + errorPlayState); + } else { + resolve("Successfull"); + } console.log("***************************************************************************************************************************"); }; @@ -95,9 +114,10 @@ verifWantedPlayState: function (object, receivedPlayState, wantedPlayState, reject) { if (object.assertEquals(receivedPlayState, wantedPlayState)) { object.videoBroadcastObject.playstate = receivedPlayState; + return true; } 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"); + return [false, "Wrong play state changement."]; } }