Author: ygrego Date: 2015-04-07 21:27:59 +0000 (Tue, 07 Apr 2015) New Revision: 1095 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1095 Log: Addition of method "onChangeState" and "addTransition". Modified: oipf/js/test/SearchManagerTest.js Modified: oipf/js/test/SearchManagerTest.js =================================================================== --- oipf/js/test/SearchManagerTest.js 2015-04-07 21:22:54 UTC (rev 1094) +++ oipf/js/test/SearchManagerTest.js 2015-04-07 21:27:59 UTC (rev 1095) @@ -24,6 +24,42 @@ logTest("State: Pending"); }, + /* + * + * @param {type} resolve + * @param {type} reject + * @param {type} newState + * @param {type} errorCode + * @returns {undefined} + * FIX-ME: Yannis - 01/04/2015 - The verification done in else clause + * could be reviewed. + */ + onChangeState: function(resolve, reject, newState, errorCode) { + var currentTransition = this.transitions[this.currentIndex]; + var begin = currentTransition.begin; + var end = currentTransition.end; + var error = currentTransition.error; + console.log(this.vidBroadObj.playState); + if (begin == this.previousState && end == newState && error == errorCode) { + currentTransition.callback && currentTransition.callback(); + this.previousState = newState; + this.currentIndex++; + } else { + // + if (begin == this.CONNECTING + && this.transitions.length == this.currentIndex + 1) { + reject("Untestable case for the moment."); + } else { + reject("Invalid state"); + } + + } + }, + + addTransition: function(begin, end, callback) { + this.addTransitionWithError(begin, end, null, callback); + }, + afterTest: function(resolve, reject) { },
participants (1)
-
ygregoï¼ users.nuiton.org