Author: ygrego Date: 2015-02-27 17:05:01 +0000 (Fri, 27 Feb 2015) New Revision: 891 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/891 Log: Deletion of test dependance between tests. For each test a "videoBroadcastObject" are created. Modified: oipf/js/test/VideoBroadcastTest.js Modified: oipf/js/test/VideoBroadcastTest.js =================================================================== --- oipf/js/test/VideoBroadcastTest.js 2015-02-27 17:01:19 UTC (rev 890) +++ oipf/js/test/VideoBroadcastTest.js 2015-02-27 17:05:01 UTC (rev 891) @@ -4,8 +4,8 @@ * */ var VideoBroadcastTest = TestCase.extend({ - error: [ - { + error: { + 0: "channel not supported by tuner", 1: "cannot tune to given transport stream (e.g. no signal)", 2: "tuner locked by other object.", @@ -20,9 +20,8 @@ 11: "insufficient resources are available to present the given channel (e.g. a lack of available codec resources).", 12: "specified channel not found in transport stream.", 100: "unidentified error." - } - ], - videoBroadcastObject: null, + + }, init: function () { }, /* @@ -33,9 +32,9 @@ console.log("***************************************************************************************************************************"); console.log("[TEST-RUNNING][Info] Id: vbTestInstanceCreation, Label: Object creation, State: Pending"); - this.videoBroadcastObject = oipfObjectFactory.createVideoBroadcastObject(); + var videoBroadcastObject = oipfObjectFactory.createVideoBroadcastObject(); - if (this.assertNotNull(this.videoBroadcastObject) && this.assertNotUndefined(this.videoBroadcastObject)) { + if (this.assertNotNull(videoBroadcastObject) && this.assertNotUndefined(videoBroadcastObject)) { console.log("[TEST-RUNNING][Info] Id: vbTestInstanceCreation, Label: Object creation, State: Successfull"); resolve("Successfull"); } else { @@ -54,15 +53,16 @@ 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 videoBroadcastObject = oipfObjectFactory.createVideoBroadcastObject(); + videoBroadcastObject.onPlayStateChange = function (state, error) { var wantedPlayState; var VerifWantedPlayStateRes; - switch (self.videoBroadcastObject.playstate) { + switch (videoBroadcastObject.playstate) { case 0: wantedPlayState = 2; - VerifWantedPlayStateRes = self.verifWantedPlayState(self, state, wantedPlayState, reject); + VerifWantedPlayStateRes = self.verifWantedPlayState(self, videoBroadcastObject, state, wantedPlayState); //TODO Verfication of binding to the necesssary ressources have achieved with success. break; @@ -76,7 +76,7 @@ case 3: wantedPlayState = 1; - VerifWantedPlayStateRes = self.verifWantedPlayState(self, state, wantedPlayState, reject); + VerifWantedPlayStateRes = self.verifWantedPlayState(self, videoBroadcastObject, state, wantedPlayState); //TODO Verify that video and audio presentation is enabled break; @@ -84,13 +84,15 @@ var success; success = VerifWantedPlayStateRes[0]; - var errorPlayState = ""; + var errorPlayState = " "; if (!success) { errorPlayState = VerifWantedPlayStateRes[1]; + } else { + videoBroadcastObject.playstate = 2; } - var errorBind = ""; - if (self.assertEquals(self.videoBroadcastObject.currentChannel, currentChann)) { + var errorBind = " "; + if (self.assertEquals(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"); success = true; } else { @@ -109,12 +111,58 @@ }; - var currentChann = this.videoBroadcastObject.bindToCurrentChannel(); + var currentChann = videoBroadcastObject.bindToCurrentChannel(); }, - verifWantedPlayState: function (object, receivedPlayState, wantedPlayState, reject) { - if (object.assertEquals(receivedPlayState, wantedPlayState)) { - object.videoBroadcastObject.playstate = receivedPlayState; + + testPrevChannel: function(resolve, reject) { + console.log("***************************************************************************************************************************"); + + console.log("[TEST-RUNNING][Info] Id: vbTestPrevChannel, Label: Switch to precedent channel in channel list, State: Pending"); + var videoBroadcastObject = oipfObjectFactory.createVideoBroadcastObject(); + videoBroadcastObject.playstate = 2; + videoBroadcastObject.currentChannel = videoBroadcastObject.getChannelConfig().currentChannel; + videoBroadcastObject.prevChannel(); + + var self = this; + videoBroadcastObject.onPlayStateChange = function(state, error) { + + videoBroadcastObject.playstate = state; + + if (error) { + var errorText = self.error[error]; + console.log("[TEST-RUNNING][Info] Id: vbTestPrevChannel, Label: Switch to precedent channel in channel list, State: Failure"); + + reject("Failure:" + errorText); + } + + }; + + videoBroadcastObject.onChannelChangeError = function(channel, error) { + var errorText = self.error[error]; + console.log("[TEST-RUNNING][Info] Id: vbTestPrevChannel, Label: Switch to precedent channel in channel list, State: Failure"); + + reject("Failure:" + errorText); + }; + + videoBroadcastObject.onChannelChangeSucceeded = function(channel) { + if (self.assertNotNull(channel)) { + console.log("[TEST-RUNNING][Info] Id: vbTestPrevChannel, Label: Switch to precedent channel in channel list, State: Successful"); + resolve("Successfull"); + } else { + console.log("[TEST-RUNNING][Info] Id: vbTestPrevChannel, Label: Switch to precedent channel in channel list, State: Failure"); + reject("Failure : The channel is null because a unknown reason."); + } + + }; + console.log("***************************************************************************************************************************"); + + + }, + + verifWantedPlayState: function (currentObject, object,receivedPlayState, wantedPlayState) { + if (currentObject.assertEquals(receivedPlayState, wantedPlayState)) { + object.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");
participants (1)
-
ygregoï¼ users.nuiton.org