Author: jruchaud Date: 2015-05-13 16:04:27 +0000 (Wed, 13 May 2015) New Revision: 1341 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1341 Log: Some basics corrections Modified: oipf/js/configuration/TestConfig.js oipf/view/test.html Modified: oipf/js/configuration/TestConfig.js =================================================================== --- oipf/js/configuration/TestConfig.js 2015-05-13 15:36:40 UTC (rev 1340) +++ oipf/js/configuration/TestConfig.js 2015-05-13 16:04:27 UTC (rev 1341) @@ -1,4 +1,4 @@ -/* +/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. @@ -13,7 +13,7 @@ var userAgent = navigator.userAgent; if (userAgent.includes("HbbTV") || userAgent.includes("SmartTv")) { - + console.log("OIPF TESTS ON TV PLATFORM"); var hbbTv = ApplicationManager.getWindows[2]; hbbTv && hbbTv.deactivate(); @@ -21,9 +21,9 @@ ui && ui.keySet.setValue(0x10, []); !ui.visible && ui.show(); ui.activate(); - + var VideoBroadcastManager = VideoBroadcastTest.extend({ - + init: function() { // this.superBeforeTest = VideoBroadcastTest.prototype.super.beforeTest; this.vidBroadObj = oipfObjectFactory.createVideoBroadcastObject(); @@ -31,22 +31,13 @@ this.superBeforeTest = this.super.beforeTest; this.superOnChangeState = this.super.onChangeState; }, - + onChangeState: function(resolve, reject, event) { - this.superOnChangeState.call(this, - resolve, reject, event.state, event.error); + this.superOnChangeState.call(this, + resolve, reject, event.state, event.error); }, - -// beforeTest: function(resolve, reject) { -// this.reject = reject.bind(null); -// this.resolve = resolve.bind(null); -// this.superBeforeTest.call(this, this.resolve, this.reject); -// this.cancel = true; -// }, - + beforeTest: function(resolve, reject) { - this.reject = reject.bind(null); - this.resolve = resolve.bind(null); this.onPlayStateChange = this.onChangeState.bind(this, resolve, reject); this.vidBroadObj.addEventListener("PlayStateChange", this.onPlayStateChange, false); this.transitions = []; @@ -58,17 +49,17 @@ logTest("State: Pending"); this.cancel = true; }, - + 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 + * More extend super method beforeTest in order to reset * 'startEndStates' property. */ if (this.cancel) { @@ -78,28 +69,28 @@ this.pushTransition(begin, end, callback, null); } }, - + unrealizedToUnrealized: function(begin, end, callback) { this.reject("Untestable Case."); }, - + stopToStop: function(begin, end, callback) { this.reject("Untestable Case."); }, - + noStatesDefined: function(begin, end, callback) { this.reject("Untestable Case."); }, - + startEndStates: { - + "00": "unrealizedToUnrealized", "01": "unrealizedToConnecting", "12": "connectingToPresenting", "33": "stopToStop", - "nullnull": "noStatesDefined" + "nullnull": "noStatesDefined" }, - + pushTransition: function(begin, end, callback, error) { this.transitions.push({ begin: begin, @@ -108,7 +99,7 @@ callback: callback }); }, - + pushTransitionWithError: function(begin, end, callback, error) { var method = this.startEndStates[""+begin+end]; if (method) { @@ -117,26 +108,26 @@ 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 VideoBroadcastTest = VideoBroadcastManager.extend({ - + init: function() { this.super.init(); } - + }); - + var RecordingSchedulerTest = RecordingSchedulerTest.extend({ - + init: function() { this.super.init(); this.blocked = function() {}; @@ -148,17 +139,17 @@ } } }, - + onPVREvent: function(resolve, reject, event) { console.log("beforeTest"); this.super.onPVREvent(resolve, reject, event.state, event.recording); }, - + beforeTest: function(resolve, reject) { console.log("beforeTest"); this.super.beforeTest(resolve, reject); } - + }); - + } Modified: oipf/view/test.html =================================================================== --- oipf/view/test.html 2015-05-13 15:36:40 UTC (rev 1340) +++ oipf/view/test.html 2015-05-13 16:04:27 UTC (rev 1341) @@ -24,13 +24,13 @@ <script src="../js/utils/Timeout.js" type="text/javascript"></script> <script src="../js/utils/Calculation.js" type="text/javascript"></script> <script src="../js/utils/ChannelUtils.js" type="text/javascript"></script> - <script src="../js/utils/Utils.js" type="text/javascript"></script> - <script src="../js/utils/EventManager.js" type="text/javascript"></script> - <script src="../js/utils/TimerManager.js" type="text/javascript"></script> - <script src="../js/utils/TimerRecordingManager.js" type="text/javascript"></script> - <script src="../js/utils/MetadataManager.js" type="text/javascript"></script> - <script src="../js/utils/DateUtils.js" type="text/javascript"></script> - <script src="../js/utils/XmlParser.js" type="text/javascript"></script> + <script src="../js/utils/Utils.js" type="text/javascript"></script> + <script src="../js/utils/EventManager.js" type="text/javascript"></script> + <script src="../js/utils/TimerManager.js" type="text/javascript"></script> + <script src="../js/utils/TimerRecordingManager.js" type="text/javascript"></script> + <script src="../js/utils/MetadataManager.js" type="text/javascript"></script> + <script src="../js/utils/DateUtils.js" type="text/javascript"></script> + <script src="../js/utils/XmlParser.js" type="text/javascript"></script> <script src="../js/configuration/ConfigDefaultProperties.js" type="text/javascript"></script> <script src="../js/configuration/CapabilitiesProperties.js" type="text/javascript"></script> <script src="../js/impl/model/Collection.js" type="text/javascript"></script> @@ -83,27 +83,27 @@ var displayConfig = { show: true }; - + function showOrHideAll() { console.log("Method showOrHideAll called."); - + for (var j = 0, l = tests.sectionsID.length; j < l; j++) { - + var style = document.getElementById(tests.sectionsID[j]).style; - + if (displayConfig.show) { style.display = "none"; } else { style.display = "block"; } } - + displayConfig.show = !displayConfig.show; - + document.getElementById("displayConfigBtn").content = - (displayConfig.show == true) ? "Hide" : "Show"; + displayConfig.show ? "Hide" : "Show"; } - + function start() { tests.displayInLineArray(); addListenerForButton(tests); @@ -119,8 +119,11 @@ function runAndShow(i, testClass) { testClass.runSectionTest(i, 0); - var style = document.getElementById((/runAll(\w+)Btn/g - .exec(document.activeElement.id))[1] + "Section").style; + + var id = (/runAll(\w+)Btn/g.exec(document.activeElement.id))[1] + "Section"; + var node = document.getElementById(id); + + var style = node.style; if (style.display == "none") { style.display = "block"; } @@ -130,17 +133,19 @@ for (var i = 0, l0 = testClass.testsObjects.length; i < l0; i++) { var currentElement = testClass.testsObjects[i]; + document.getElementById(currentElement.name + "HideShowBtn").onclick = - hideOrShowTestSection.bind(this, currentElement.name + "Section"); + hideOrShowTestSection.bind(this, currentElement.name + "Section"); + document.getElementById("runAll" + currentElement.name + "Btn").onclick = - runAndShow.bind(this, i, testClass); + runAndShow.bind(this, i, testClass); - var currentTests = currentElement["tests"]; + var currentTests = currentElement.tests; for (var j = 0, l1 = currentTests.length; j < l1; j++) { var testCase = currentTests[j]; - document.getElementById(testCase["method"] + "Btn").onclick = - testClass.updateTestResult.bind(testClass, testCase, currentElement["object"]); + document.getElementById(testCase.method + "Btn").onclick = + testClass.updateTestResult.bind(testClass, testCase, currentElement.object); } } }