Author: ygrego Date: 2015-05-20 09:10:43 +0000 (Wed, 20 May 2015) New Revision: 1410 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1410 Log: Redefinition of the class SearchManagerTest. Modified: oipf/js/configuration/TestConfig.js Modified: oipf/js/configuration/TestConfig.js =================================================================== --- oipf/js/configuration/TestConfig.js 2015-05-20 07:47:36 UTC (rev 1409) +++ oipf/js/configuration/TestConfig.js 2015-05-20 09:10:43 UTC (rev 1410) @@ -125,7 +125,78 @@ } }); + + var SearchManagerTest = SearchManagerTest.extend({ + init: function() { + this.searchManagerObj = oipfObjectFactory.createSearchManagerObject(); + this.super.init(); + }, + + beforeTest: function(resolve, reject) { + this.super.beforeTest(resolve, reject); + this.cancel = true; + }, + + noStatesDefined: function(begin, end, callback) { + this.reject("Untestable Case."); + }, + + unrealizedToConnecting: function(begin, end, callback) { + if (callback) { + throw ("Untestable Case."); + } + }, + connectingToPresenting: function(begin, end, callback) { + /** + * Avoid that the future transition C->P be canceled. + * More extend super method beforeTest in order to reset + * 'startEndStates' property. + */ + if (this.cancel) { + callback && this.timeout().then(callback).then(console.log.bind(console, "TOTO")); + this.cancel = false; + } else { + this.pushTransition(begin, end, callback, null); + } + }, + + startEndStates: { + + "00": "unrealizedToUnrealized", + "01": "unrealizedToConnecting", + "12": "connectingToPresenting", + "33": "stopToStop", + "nullnull": "noStatesDefined" + }, + + pushTransition: function(begin, end, callback, error) { + this.transitions.push({ + begin: begin, + end: end, + error: error, + callback: callback + }); + }, + + pushTransitionWithError: function(begin, end, callback, error) { + var method = this.startEndStates[""+begin+end]; + if (method) { + this[method].call(this, begin, end, callback); + } else { + this.pushTransition(begin, end, callback, error); + } + }, + + addTransition: function(begin, end, callback) { + this.addTransitionWithError(begin, end, callback, null); + }, + + addTransitionWithError: function(begin, end, callback, error) { + this.pushTransitionWithError(begin, end, callback, error); + } + }); + var RecordingSchedulerTest = RecordingSchedulerTest.extend({ init: function() {