Sandbox-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- 1825 discussions
Author: ygrego
Date: 2015-06-09 12:29:01 +0000 (Tue, 09 Jun 2015)
New Revision: 1644
Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1644
Log:
Transformation of the class CapabilitiesObject in an ES6 class.
Modified:
oipf/lib/js/impl/CapabilitiesObject.js
Modified: oipf/lib/js/impl/CapabilitiesObject.js
===================================================================
--- oipf/lib/js/impl/CapabilitiesObject.js 2015-06-09 12:19:40 UTC (rev 1643)
+++ oipf/lib/js/impl/CapabilitiesObject.js 2015-06-09 12:29:01 UTC (rev 1644)
@@ -1,82 +1,81 @@
/*
- * The OITF SHALL support following non-visual embedded object with
+ * The OITF SHALL support following non-visual embedded object with
* the mime type 'application/oipfCapabilities'.
*/
-var CapabilitiesObject = Class.extend({
-
- /*
- * Description:
- * Returns the OITF’s capability description as an XML Document object using
- * the syntax as defined in Annex F without using any namespace
- * definitions.
- *
- * Visibility Type: readonly Document
- */
- xmlCapabilities: null,
-
- /*
- * Description:
- * This property holds the number of possible additional decodes for
- * SD video. Depending on the current usage of system resources this value
- * may vary. The value of this property is likely to change if an HD video
- * is started.
- *
- * Adding an A/V Control object or video/broadcast object may still fail,
- * even if extraSDVideoDecodes is larger than 0. For A/V Control objects,
- * in case of failure the play state for the A/V Control object shall be set
- * to 6 ('error') with a detailed error code of 3
- * ('insufficient resources'). For video/broadcast objects, in case of
- * failure the play state of the video/broadcast object shall be set to 0
- * ('unrealized') with a detailed error code of 11
- * ('insufficient resources').
- *
- * Visibility Type: readonly Number
- */
- extraSDVideoDecodes: null,
-
- /*
- * Description:
- * This property holds the number of possible additional decodes for
- * HD video. Depending on the current usage of system resources this value
- * may vary. The value of this property is likely to change if an SD video
- * is started.
- *
- * Adding an A/V Control object or video/broadcast object may still fail,
- * even if extraSDVideoDecodes is larger than 0. For A/V Control objects,
- * in case of failure the play state for the A/V Control object shall be set
- * to 6 ('error') with a detailed error code of 3
- * ('insufficient resources'). For video/broadcast objects, in case of
- * failure the play state of the video/broadcast object shall be set to 0
- * ('unrealized') with a detailed error code of 11
- * ('insufficient resources').
- *
- * Visibility Type: readonly Number
- */
- extraHDVideoDecodes: null,
-
-
- init: function(modelFactory) {
+class CapabilitiesObject {
+
+ constructor(modelFactory) {
+ /*
+ * Description:
+ * Returns the OITF’s capability description as an XML Document object using
+ * the syntax as defined in Annex F without using any namespace
+ * definitions.
+ *
+ * Visibility Type: readonly Document
+ */
+ this.xmlCapabilities = null;
+
+ /*
+ * Description:
+ * This property holds the number of possible additional decodes for
+ * SD video. Depending on the current usage of system resources this value
+ * may vary. The value of this property is likely to change if an HD video
+ * is started.
+ *
+ * Adding an A/V Control object or video/broadcast object may still fail,
+ * even if extraSDVideoDecodes is larger than 0. For A/V Control objects,
+ * in case of failure the play state for the A/V Control object shall be set
+ * to 6 ('error') with a detailed error code of 3
+ * ('insufficient resources'). For video/broadcast objects, in case of
+ * failure the play state of the video/broadcast object shall be set to 0
+ * ('unrealized') with a detailed error code of 11
+ * ('insufficient resources').
+ *
+ * Visibility Type: readonly Number
+ */
+ this.extraSDVideoDecodes = null;
+
+ /*
+ * Description:
+ * This property holds the number of possible additional decodes for
+ * HD video. Depending on the current usage of system resources this value
+ * may vary. The value of this property is likely to change if an SD video
+ * is started.
+ *
+ * Adding an A/V Control object or video/broadcast object may still fail,
+ * even if extraSDVideoDecodes is larger than 0. For A/V Control objects,
+ * in case of failure the play state for the A/V Control object shall be set
+ * to 6 ('error') with a detailed error code of 3
+ * ('insufficient resources'). For video/broadcast objects, in case of
+ * failure the play state of the video/broadcast object shall be set to 0
+ * ('unrealized') with a detailed error code of 11
+ * ('insufficient resources').
+ *
+ * Visibility Type: readonly Number
+ */
+ this.extraHDVideoDecodes = null;
+
this.xmlParser = modelFactory.getXmlParser();
this._defaultCapabilities = modelFactory.getCapabilitiesProperties();
this.xmlCapabilities = this.xmlParser
.getXmlDocument(this._defaultCapabilities);
- },
-
+ }
+
/*
* Description:
* Check if the OITF supports the passed capability.
* Returns true if the OITF supports the passed capability, false otherwise.
- *
+ *
* Arguments:
- * - profileName:
+ * - profileName:
* An OIPF base UI profile string or a UI Profile name fragment string as
* defined in section 9.2.
* Examples of valid profileName: “ OITF_HD_UIPROF ” or “ +PVR ”.
- *
+ *
* Return: Boolean
*/
- hasCapability: function(profileName) {
+ hasCapability(profileName) {
return this._defaultCapabilities.hasCapablity(profileName);
}
-});
\ No newline at end of file
+}
1
0
Author: ygrego
Date: 2015-06-09 12:19:40 +0000 (Tue, 09 Jun 2015)
New Revision: 1643
Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1643
Log:
Transformation of the class "ApplicationManagerObject" in an ES6 class.
Modified:
oipf/lib/js/impl/ApplicationManagerObject.js
Modified: oipf/lib/js/impl/ApplicationManagerObject.js
===================================================================
--- oipf/lib/js/impl/ApplicationManagerObject.js 2015-06-09 12:17:18 UTC (rev 1642)
+++ oipf/lib/js/impl/ApplicationManagerObject.js 2015-06-09 12:19:40 UTC (rev 1643)
@@ -4,194 +4,193 @@
* and management that is provided by the application model defined in this section.
* If one of the methods on the application/oipfApplicationManager is called by a webpage that is not a
* privileged DAE application, the OITF SHALL throw an error as defined in section 10.1.1.
- */
-var ApplicationManagerObject = Class.extend({
+ */
+class ApplicationManagerObject {
- _currentApplication: null,
-
- _rootApplication: null,
-
- _hiddenSystemRootNode: null,
-
- _activeApplicationsList: null,
-
- _visibleApplicationsList: null,
-
- addEventListener: function(type, listener) {
+ addEventListener(type, listener) {
this._eventManager.addEventListener(type, listener, this);
- },
-
- removeEventListener: function(type, listener) {
+ }
+
+ removeEventListener(type, listener) {
this._eventManager.removeEventListener(type, listener, this);
- },
-
- _getCallback : function(type) {
- if(this._callbacks) {
+ }
+
+ _getCallback(type) {
+ if (this._callbacks) {
return this._callbacks[type];
}
- },
-
- _setCallback: function(type, callback) {
- if(this._callbacks) {
+ }
+
+ _setCallback(type, callback) {
+ if (this._callbacks) {
this._callbacks[type] = callback;
}
- },
-
+ }
+
/*
* Description:
- * The function that is called when the OITF is running low on available
+ * The function that is called when the OITF is running low on available
* memory for running DAE applications.
- * The exact criteria determining when to generate such an event is
+ * The exact criteria determining when to generate such an event is
* implementation specific.
*/
get onLowMemory() {
return this._getCallback("LowMemory");
- },
+ }
set onLowMemory(callback) {
this._setCallback("LowMemory", callback);
- },
-
+ }
+
/*
* Description:
- * The function that is called immediately prior to a load event being
- * generated in the affected application. The specified function is called
- * with one argument appl , which provides a reference to the affected
+ * The function that is called immediately prior to a load event being
+ * generated in the affected application. The specified function is called
+ * with one argument appl , which provides a reference to the affected
* application.
*/
get onApplicationLoaded() {
return this._getCallback("ApplicationLoaded");
- },
+ }
set onApplicationLoaded(callback) {
this._setCallback("ApplicationLoaded", callback);
- },
-
+ }
+
/*
* Description:
- * The function that is called immediately prior to an unload event being
- * generated in the affected application. The specified function is called
- * with one argument appl , which provides a reference to the affected
+ * The function that is called immediately prior to an unload event being
+ * generated in the affected application. The specified function is called
+ * with one argument appl , which provides a reference to the affected
* application.
*/
get onApplicationUnloaded() {
return this._getCallback("ApplicationUnloaded");
- },
+ }
set onApplicationUnloaded(callback) {
this._setCallback("ApplicationUnloaded", callback);
- },
-
+ }
+
/*
* Description:
- * The function that is called when the OITF fails to load either the file
+ * The function that is called when the OITF fails to load either the file
* containing the initial HTML document of an application or an XML AIT file
* (e.g. due to an HTTP 404 error, an HTTP timeout, being unable to load the
* file from a DSM-CC object carousel or due to the file not being either an
- * HTML file or a XML AIT file as appropriate), All properties of
+ * HTML file or a XML AIT file as appropriate), All properties of
* the Application object referred to by appl SHALL have the value undefined
* and calling any methods on that object SHALL fail.
*/
get onApplicationLoadError() {
return this._getCallback("ApplicationLoadError");
- },
+ }
set onApplicationLoadError(callback) {
this._setCallback("ApplicationLoadError", callback);
- },
-
+ }
+
/*
* Description:
- * The callback function that is called during the installation process of
+ * The callback function that is called during the installation process of
* a Widget. The function is called with three arguments:
- *
- * WidgetDescriptor wd - the WidgetDescriptor for the installed Widget.
+ *
+ * WidgetDescriptor wd - the WidgetDescriptor for the installed Widget.
* Some attributes of this argument may not have been initialised and may be
- * null when the function is called until the Widget is successfully
- * installed.
- *
- * Integer state - the state of the installation; valid values are:
- * WIDGET_INSTALLATION_STARTED
- * WIDGET_INSTALLATION_COMPLETED
- * WIDGET_INSTALLATION_FAILED
+ * null when the function is called until the Widget is successfully
+ * installed.
+ *
+ * Integer state - the state of the installation; valid values are:
+ * WIDGET_INSTALLATION_STARTED
+ * WIDGET_INSTALLATION_COMPLETED
+ * WIDGET_INSTALLATION_FAILED
* as defined in section 7.2.1.1.
- *
- * Integer reason: indicates the reason for installation failure.
- * This is only valid if the value of the state argument is
- * WIDGET_INSTALLATION_FAILED otherwise this argument SHALL be null.
- * Valid values for this field are:
- * WIDGET_ERROR_STORAGE_AREA_FULL
- * WIDGET_ERROR_DOWNLOAD
- * WIDGET_ERROR_INVALID_ZIP_ARCHIVE
- * WIDGET_ERROR_INVALID_SIGNATURE
- * WIDGET_ERROR_GENERIC
- * WIDGET_ERROR_SIZE_EXCEEDED
- * WIDGET_ERROR_PERMISSION_DENIED
+ *
+ * Integer reason: indicates the reason for installation failure.
+ * This is only valid if the value of the state argument is
+ * WIDGET_INSTALLATION_FAILED otherwise this argument SHALL be null.
+ * Valid values for this field are:
+ * WIDGET_ERROR_STORAGE_AREA_FULL
+ * WIDGET_ERROR_DOWNLOAD
+ * WIDGET_ERROR_INVALID_ZIP_ARCHIVE
+ * WIDGET_ERROR_INVALID_SIGNATURE
+ * WIDGET_ERROR_GENERIC
+ * WIDGET_ERROR_SIZE_EXCEEDED
+ * WIDGET_ERROR_PERMISSION_DENIED
* as defined in section 7.2.1.1.
*/
get onWidgetInstallation() {
return this._getCallback("WidgetInstallation");
- },
+ }
set onWidgetInstallation(callback) {
this._setCallback("WidgetInstallation", callback);
- },
-
+ }
+
/*
* Description:
- * The function that is called during the uninstallation process of
- * a Widget. The function is called with two arguments, defined below:
- *
- * WidgetDescriptor wd - the WidgetDescriptor of the Widget
- * to be uninstalled.
- *
- * Integer state - the state of the installation; valid values are:
- * WIDGET_UNINSTALLATION_STARTED
- * WIDGET_UNINSTALLATION_COMPLETED
+ * The function that is called during the uninstallation process of
+ * a Widget. The function is called with two arguments, defined below:
+ *
+ * WidgetDescriptor wd - the WidgetDescriptor of the Widget
+ * to be uninstalled.
+ *
+ * Integer state - the state of the installation; valid values are:
+ * WIDGET_UNINSTALLATION_STARTED
+ * WIDGET_UNINSTALLATION_COMPLETED
* WIDGET_UNINSTALLATION_FAILED
* as defined in section 7.2.1.1.
*/
get onWidgetUninstallation() {
return this._getCallback("WidgetUninstallation");
- },
+ }
set onWidgetUninstallation(callback) {
this._setCallback("WidgetUninstallation", callback);
- },
-
- /*
- * Description:
- * A collection of WidgetDescriptor objects for the Widgets currently
- * installed on the OITF.
- *
- * Visibilité Type: readonly WidgetDescriptorCollection
- */
- widgets: null,
-
- init : function(applicationVisualizationMode) {
+ }
+
+ constructor(applicationVisualizationMode) {
+ /*
+ * Description:
+ * A collection of WidgetDescriptor objects for the Widgets
+ * currently installed on the OITF.
+ *
+ * Visibility type: readonly WidgetDescriptorCollection
+ */
+ this.widgets = null;
+
+ this._currentApplication = null;
+
+ this._rootApplication = null;
+
+ this._hiddenSystemRootNode = null;
+
+ this._activeApplicationsList = null;
+
+ this._visibleApplicationsList = null;
this._applicationVisualizationMode = applicationVisualizationMode;
this._listeners = {};
this._callbacks = {};
this._eventManager = new EventManager();
-
+
this._timerManager = new TimerManager();
this._timeout = this._timerManager.createTimer.bind(this._timerManager, 0);
this._hiddenSystemRootNode = [];
this._activeApplicationsList = new ApplicationCollection();
this._createRootApplication();
- },
-
- _createRootApplication: function() {
+ }
+
+ _createRootApplication() {
this._rootApplication = new Application(window, this);
- },
-
- _fireEvent: function(type, params) {
- var event = createCustomEvent(type, params);
+ }
+
+ _fireEvent(type, params) {
+ var event = this._eventManager.createCustomEvent(type, params);
this._eventManager.fireEvent(event, this);
- },
-
- getApplicationVisualizationMode: function() {
+ }
+
+ getApplicationVisualizationMode() {
return this._applicationVisualizationMode;
- },
+ }
-});
\ No newline at end of file
+}
1
0
Author: ygrego
Date: 2015-06-09 12:17:18 +0000 (Tue, 09 Jun 2015)
New Revision: 1642
Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1642
Log:
Transformation of the class "IMSObject" in an ES6 class.
Modified:
oipf/lib/js/impl/IMSObject.js
Modified: oipf/lib/js/impl/IMSObject.js
===================================================================
--- oipf/lib/js/impl/IMSObject.js 2015-06-09 12:16:27 UTC (rev 1641)
+++ oipf/lib/js/impl/IMSObject.js 2015-06-09 12:17:18 UTC (rev 1642)
@@ -1,7 +1,6 @@
-var IMSObject = Class.extend({
+class IMSObject {
- init : function(){
-
+ constructor() {
}
-});
\ No newline at end of file
+}
1
0
09 Jun '15
Author: jruchaud
Date: 2015-06-09 12:16:27 +0000 (Tue, 09 Jun 2015)
New Revision: 1641
Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1641
Log:
Fix dependency for test
Added:
oipf/test/js/TestConfig.js
Removed:
oipf/lib/configuration/TestConfig.js
Modified:
oipf/test/server.js
oipf/test/view/test.html
Deleted: oipf/lib/configuration/TestConfig.js
===================================================================
--- oipf/lib/configuration/TestConfig.js 2015-06-09 12:09:46 UTC (rev 1640)
+++ oipf/lib/configuration/TestConfig.js 2015-06-09 12:16:27 UTC (rev 1641)
@@ -1,226 +0,0 @@
-/*
- * 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.
- */
-
-if (!String.prototype.includes) {
- String.prototype.includes = function() {'use strict';
- return String.prototype.indexOf.apply(this, arguments) !== -1;
- };
-}
-
-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();
- var ui = ApplicationManager.getWindows()[0]; //or getWindowsByName
- 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();
-
- 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);
- },
-
- beforeTest: function(resolve, reject) {
- this.onPlayStateChange = this.onChangeState.bind(this, resolve, reject);
- this.vidBroadObj.addEventListener("PlayStateChange", this.onPlayStateChange, false);
- this.transitions = [];
- this.previousState = this.vidBroadObj.playState;
- this.currentIndex = 0;
- this.channel = null;
- this.timerManager = new TimerManager();
- this.timeout = this.timerManager.createTimer.bind(this.timerManager);
- 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
- * '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);
- }
- },
-
- 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"
- },
-
- 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 VideoBroadcastTest = VideoBroadcastManager.extend({
-
- init: function() {
- this.super.init();
- }
-
- });
-
- 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() {
- this.super.init();
- this.blocked = function() {};
- this.bindToCurrentChannel = this.blocked;
- this.onChangeState = this.blocked;
- this.createVideoBroadcast = function() {
- if (!this.vidBroadObj) {
- this.vidBroadObj = oipfObjectFactory.createVideoBroadcastObject();
- }
- }
- },
-
- 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);
- }
-
- });
-
-}
Copied: oipf/test/js/TestConfig.js (from rev 1634, oipf/lib/configuration/TestConfig.js)
===================================================================
--- oipf/test/js/TestConfig.js (rev 0)
+++ oipf/test/js/TestConfig.js 2015-06-09 12:16:27 UTC (rev 1641)
@@ -0,0 +1,226 @@
+/*
+ * 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.
+ */
+
+if (!String.prototype.includes) {
+ String.prototype.includes = function() {'use strict';
+ return String.prototype.indexOf.apply(this, arguments) !== -1;
+ };
+}
+
+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();
+ var ui = ApplicationManager.getWindows()[0]; //or getWindowsByName
+ 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();
+
+ 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);
+ },
+
+ beforeTest: function(resolve, reject) {
+ this.onPlayStateChange = this.onChangeState.bind(this, resolve, reject);
+ this.vidBroadObj.addEventListener("PlayStateChange", this.onPlayStateChange, false);
+ this.transitions = [];
+ this.previousState = this.vidBroadObj.playState;
+ this.currentIndex = 0;
+ this.channel = null;
+ this.timerManager = new TimerManager();
+ this.timeout = this.timerManager.createTimer.bind(this.timerManager);
+ 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
+ * '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);
+ }
+ },
+
+ 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"
+ },
+
+ 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 VideoBroadcastTest = VideoBroadcastManager.extend({
+
+ init: function() {
+ this.super.init();
+ }
+
+ });
+
+ 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() {
+ this.super.init();
+ this.blocked = function() {};
+ this.bindToCurrentChannel = this.blocked;
+ this.onChangeState = this.blocked;
+ this.createVideoBroadcast = function() {
+ if (!this.vidBroadObj) {
+ this.vidBroadObj = oipfObjectFactory.createVideoBroadcastObject();
+ }
+ }
+ },
+
+ 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/test/server.js
===================================================================
--- oipf/test/server.js 2015-06-09 12:09:46 UTC (rev 1640)
+++ oipf/test/server.js 2015-06-09 12:16:27 UTC (rev 1641)
@@ -8,4 +8,4 @@
});
app.listen(3000);
-console.log("Server running at http://192.168.99.190:3000/");
+console.log("Server running at http://localhost:3000/");
Modified: oipf/test/view/test.html
===================================================================
--- oipf/test/view/test.html 2015-06-09 12:09:46 UTC (rev 1640)
+++ oipf/test/view/test.html 2015-06-09 12:16:27 UTC (rev 1641)
@@ -8,91 +8,24 @@
<head>
<title>OIPF Tests</title>
<meta charset="UTF-8">
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="../css/test.css"/>
- <script src="../js/utils/es6-promises.js" type="text/javascript"></script>
- <script>
- var Promise = Promise || ES6Promise.Promise;
- </script>
- <script src="../js/impl/model/constants/VideoBroadcastConstants.js" type="text/javascript"></script>
- <script src="../js/impl/model/constants/ParentalControlManagerConstants.js" type="text/javascript"></script>
- <script src="../js/impl/model/constants/RecordingSchedulerConstants.js" type="text/javascript"></script>
- <script src="../js/impl/model/constants/ConfigurationConstants.js" type="text/javascript"></script>
- <script src="../js/impl/model/constants/MetadataSearchConstants.js" type="text/javascript"></script>
- <script src="../js/impl/model/constants/DaeMimeType.js" type="text/javascript"></script>
- <script src="../js/impl/model/constants/IdType.js" type="text/javascript"></script>
-
- <script src="../js/lib/Class.js" type="text/javascript"></script>
- <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/ProgrammeService.js" type="text/javascript"></script>
- <script src="../js/utils/XmlToJson.js" type="text/javascript"></script>
- <script src="../js/utils/ProgrammeHelper.js" type="text/javascript"></script>
-
- <script src="../configuration/ConfigDefaultProperties.js" type="text/javascript"></script>
- <script src="../configuration/CapabilitiesProperties.js" type="text/javascript"></script>
- <script src="../configuration/OipfConfiguration.js" type="text/javascript"></script>
-
- <script src="../js/impl/model/Collection.js" type="text/javascript"></script>
- <script src="../js/impl/model/SignalInfo.js" type="text/javascript"></script>
- <script src="../js/impl/model/LNBInfo.js" type="text/javascript"></script>
- <script src="../js/impl/model/NetworkInterface.js" type="text/javascript"></script>
- <script src="../js/impl/model/FavouriteList.js" type="text/javascript"></script>
- <script src="../js/impl/model/Programme.js" type="text/javascript"></script>
- <script src="../js/impl/model/AVOutput.js" type="text/javascript"></script>
- <script src="../js/impl/model/Tuner.js" type="text/javascript"></script>
- <script src="../js/impl/model/IntegerCollection.js" type="text/javascript"></script>
- <script src="../js/impl/model/AVOutputCollection.js" type="text/javascript"></script>
- <script src="../js/impl/model/TunerCollection.js" type="text/javascript"></script>
- <script src="../js/impl/model/NetworkInterfaceCollection.js" type="text/javascript"></script>
- <script src="../js/impl/model/FavouriteListCollection.js" type="text/javascript"></script>
- <script src="../js/impl/model/ScheduledRecordingCollection.js" type="text/javascript"></script>
- <script src="../js/impl/model/Query.js" type="text/javascript"></script>
- <script src="../js/impl/model/Configuration.js" type="text/javascript"></script>
- <script src="../js/impl/model/LocalSystem.js" type="text/javascript"></script>
- <script src="../js/impl/model/Channel.js" type="text/javascript"></script>
- <script src="../js/impl/model/ChannelList.js" type="text/javascript"></script>
- <script src="../js/impl/model/MetadataSearch.js" type="text/javascript"></script>
- <script src="../js/impl/model/SearchResults.js" type="text/javascript"></script>
- <script src="../js/impl/model/ScheduledRecording.js" type="text/javascript"></script>
- <script src="../js/impl/model/Recording.js" type="text/javascript"></script>
- <script src="../js/impl/model/Application.js" type="text/javascript"></script>
- <script src="../js/impl/model/ApplicationCollection.js" type="text/javascript"></script>
-
- <script src="../js/impl/OipfObjectFactory.js" type="text/javascript"></script>
- <script src="../js/impl/ConfigurationObject.js" type="text/javascript"></script>
- <script src="../js/impl/ChannelConfig.js" type="text/javascript"></script>
- <script src="../js/impl/VideoBroadcastObject.js" type="text/javascript"></script>
- <script src="../js/impl/SearchManagerObject.js" type="text/javascript"></script>
- <script src="../js/impl/RecordingSchedulerObject.js" type="text/javascript"></script>
- <script src="../js/impl/CapabilitiesObject.js" type="text/javascript"></script>
- <script src="../js/impl/ParentalControlManagerObject.js" type="text/javascript"></script>
- <script src="../js/impl/ApplicationManagerObject.js" type="text/javascript"></script>
-
- <script src="../js/utils/ChannelService.js" type="text/javascript"></script>
- <script src="../js/impl/model/ModelFactory.js" type="text/javascript"></script>
- <script src="../init/init.js" type="text/javascript"></script>
-
- <script src="../js/test/TestCase.js" type="text/javascript"></script>
- <script src="../js/test/ApplicationManagerTest.js" type="text/javascript"></script>
- <script src="../js/test/CapabilitiesTest.js" type="text/javascript"></script>
- <script src="../js/test/ParentalControlManagerTest.js" type="text/javascript"></script>
- <script src="../js/test/RecordingSchedulerTest.js" type="text/javascript"></script>
- <script src="../js/test/ConfigurationTest.js" type="text/javascript"></script>
- <script src="../js/test/SearchManagerTest.js" type="text/javascript"></script>
- <script src="../js/test/VideoBroadcastTest.js" type="text/javascript"></script>
- <script src="../js/test/OipfFactoryTest.js" type="text/javascript"></script>
- <script src="../configuration/TestConfig.js" type="text/javascript"></script>
- <script src="../js/test/Test.js" type="text/javascript"></script>
+ <script src="../../lib/build/oipf-lib.js" type="text/javascript"></script>
+
+ <script src="../js/TestCase.js" type="text/javascript"></script>
+ <script src="../js/ApplicationManagerTest.js" type="text/javascript"></script>
+ <script src="../js/CapabilitiesTest.js" type="text/javascript"></script>
+ <script src="../js/ParentalControlManagerTest.js" type="text/javascript"></script>
+ <script src="../js/RecordingSchedulerTest.js" type="text/javascript"></script>
+ <script src="../js/ConfigurationTest.js" type="text/javascript"></script>
+ <script src="../js/SearchManagerTest.js" type="text/javascript"></script>
+ <script src="../js/VideoBroadcastTest.js" type="text/javascript"></script>
+ <script src="../js/OipfFactoryTest.js" type="text/javascript"></script>
+ <script src="../js/TestConfig.js" type="text/javascript"></script>
+ <script src="../js/Test.js" type="text/javascript"></script>
+
<script>
var tests = new Test();
var displayConfig = {
1
0
Author: smaisonneuve
Date: 2015-06-09 12:09:46 +0000 (Tue, 09 Jun 2015)
New Revision: 1640
Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1640
Log:
[Build] - Adding data and configuration directory into the build
Modified:
oipf/lib/gulpfile.js
Modified: oipf/lib/gulpfile.js
===================================================================
--- oipf/lib/gulpfile.js 2015-06-09 12:06:14 UTC (rev 1639)
+++ oipf/lib/gulpfile.js 2015-06-09 12:09:46 UTC (rev 1640)
@@ -9,6 +9,7 @@
var util = require("gulp-util");
var conf = {
+ src: ["js/**/*.js", "data/*.js", "configuration/*.js"],
buildFile: "oipf-lib.js",
buildDir: "build"
};
@@ -24,7 +25,7 @@
});
gulp.task("javascript", function() {
- return gulp.src("js/**/*.js")
+ return gulp.src(conf.src)
.pipe(sourcemaps.init())
.pipe(babel({
blacklist: [
1
0
Author: jruchaud
Date: 2015-06-09 12:06:14 +0000 (Tue, 09 Jun 2015)
New Revision: 1639
Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1639
Log:
Useless file
Removed:
oipf/lib/js/utils/es6-promises.js
Deleted: oipf/lib/js/utils/es6-promises.js
===================================================================
--- oipf/lib/js/utils/es6-promises.js 2015-06-09 12:05:51 UTC (rev 1638)
+++ oipf/lib/js/utils/es6-promises.js 2015-06-09 12:06:14 UTC (rev 1639)
@@ -1,18 +0,0 @@
-/*!
- * @overview es6-promise - a tiny implementation of Promises/A+.
- * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
- * @license Licensed under MIT license
- * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
- * @version 2.0.0
- */
-
-(function(){function r(a,b){n[l]=a;n[l+1]=b;l+=2;2===l&&A()}function s(a){return"function"===typeof a}function F(){return function(){process.nextTick(t)}}function G(){var a=0,b=new B(t),c=document.createTextNode("");b.observe(c,{characterData:!0});return function(){c.data=a=++a%2}}function H(){var a=new MessageChannel;a.port1.onmessage=t;return function(){a.port2.postMessage(0)}}function I(){return function(){setTimeout(t,1)}}function t(){for(var a=0;a<l;a+=2)(0,n[a])(n[a+1]),n[a]=void 0,n[a+1]=void 0;
-l=0}function p(){}function J(a,b,c,d){try{a.call(b,c,d)}catch(e){return e}}function K(a,b,c){r(function(a){var e=!1,f=J(c,b,function(c){e||(e=!0,b!==c?q(a,c):m(a,c))},function(b){e||(e=!0,g(a,b))});!e&&f&&(e=!0,g(a,f))},a)}function L(a,b){1===b.a?m(a,b.b):2===a.a?g(a,b.b):u(b,void 0,function(b){q(a,b)},function(b){g(a,b)})}function q(a,b){if(a===b)g(a,new TypeError("You cannot resolve a promise with itself"));else if("function"===typeof b||"object"===typeof b&&null!==b)if(b.constructor===a.constructor)L(a,
-b);else{var c;try{c=b.then}catch(d){v.error=d,c=v}c===v?g(a,v.error):void 0===c?m(a,b):s(c)?K(a,b,c):m(a,b)}else m(a,b)}function M(a){a.f&&a.f(a.b);x(a)}function m(a,b){void 0===a.a&&(a.b=b,a.a=1,0!==a.e.length&&r(x,a))}function g(a,b){void 0===a.a&&(a.a=2,a.b=b,r(M,a))}function u(a,b,c,d){var e=a.e,f=e.length;a.f=null;e[f]=b;e[f+1]=c;e[f+2]=d;0===f&&a.a&&r(x,a)}function x(a){var b=a.e,c=a.a;if(0!==b.length){for(var d,e,f=a.b,g=0;g<b.length;g+=3)d=b[g],e=b[g+c],d?C(c,d,e,f):e(f);a.e.length=0}}function D(){this.error=
-null}function C(a,b,c,d){var e=s(c),f,k,h,l;if(e){try{f=c(d)}catch(n){y.error=n,f=y}f===y?(l=!0,k=f.error,f=null):h=!0;if(b===f){g(b,new TypeError("A promises callback cannot return that same promise."));return}}else f=d,h=!0;void 0===b.a&&(e&&h?q(b,f):l?g(b,k):1===a?m(b,f):2===a&&g(b,f))}function N(a,b){try{b(function(b){q(a,b)},function(b){g(a,b)})}catch(c){g(a,c)}}function k(a,b,c,d){this.n=a;this.c=new a(p,d);this.i=c;this.o(b)?(this.m=b,this.d=this.length=b.length,this.l(),0===this.length?m(this.c,
-this.b):(this.length=this.length||0,this.k(),0===this.d&&m(this.c,this.b))):g(this.c,this.p())}function h(a){O++;this.b=this.a=void 0;this.e=[];if(p!==a){if(!s(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof h))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");N(this,a)}}var E=Array.isArray?Array.isArray:function(a){return"[object Array]"===
-Object.prototype.toString.call(a)},l=0,w="undefined"!==typeof window?window:{},B=w.MutationObserver||w.WebKitMutationObserver,w="undefined"!==typeof Uint8ClampedArray&&"undefined"!==typeof importScripts&&"undefined"!==typeof MessageChannel,n=Array(1E3),A;A="undefined"!==typeof process&&"[object process]"==={}.toString.call(process)?F():B?G():w?H():I();var v=new D,y=new D;k.prototype.o=function(a){return E(a)};k.prototype.p=function(){return Error("Array Methods must be provided an Array")};k.prototype.l=
-function(){this.b=Array(this.length)};k.prototype.k=function(){for(var a=this.length,b=this.c,c=this.m,d=0;void 0===b.a&&d<a;d++)this.j(c[d],d)};k.prototype.j=function(a,b){var c=this.n;"object"===typeof a&&null!==a?a.constructor===c&&void 0!==a.a?(a.f=null,this.g(a.a,b,a.b)):this.q(c.resolve(a),b):(this.d--,this.b[b]=this.h(a))};k.prototype.g=function(a,b,c){var d=this.c;void 0===d.a&&(this.d--,this.i&&2===a?g(d,c):this.b[b]=this.h(c));0===this.d&&m(d,this.b)};k.prototype.h=function(a){return a};
-k.prototype.q=function(a,b){var c=this;u(a,void 0,function(a){c.g(1,b,a)},function(a){c.g(2,b,a)})};var O=0;h.all=function(a,b){return(new k(this,a,!0,b)).c};h.race=function(a,b){function c(a){q(e,a)}function d(a){g(e,a)}var e=new this(p,b);if(!E(a))return (g(e,new TypeError("You must pass an array to race.")), e);for(var f=a.length,h=0;void 0===e.a&&h<f;h++)u(this.resolve(a[h]),void 0,c,d);return e};h.resolve=function(a,b){if(a&&"object"===typeof a&&a.constructor===this)return a;var c=new this(p,b);
-q(c,a);return c};h.reject=function(a,b){var c=new this(p,b);g(c,a);return c};h.prototype={constructor:h,then:function(a,b){var c=this.a;if(1===c&&!a||2===c&&!b)return this;var d=new this.constructor(p),e=this.b;if(c){var f=arguments[c-1];r(function(){C(c,d,f,e)})}else u(this,d,a,b);return d},"catch":function(a){return this.then(null,a)}};var z={Promise:h,polyfill:function(){var a;a="undefined"!==typeof global?global:"undefined"!==typeof window&&window.document?window:self;"Promise"in a&&"resolve"in
-a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;new a.Promise(function(a){b=a});return s(b)}()||(a.Promise=h)}};"function"===typeof define&&define.amd?define(function(){return z}):"undefined"!==typeof module&&module.exports?module.exports=z:"undefined"!==typeof this&&(this.ES6Promise=z)}).call(this);
\ No newline at end of file
1
0
Author: jruchaud
Date: 2015-06-09 12:05:51 +0000 (Tue, 09 Jun 2015)
New Revision: 1638
Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1638
Log:
Format
Modified:
oipf/test/server.js
Modified: oipf/test/server.js
===================================================================
--- oipf/test/server.js 2015-06-09 12:05:29 UTC (rev 1637)
+++ oipf/test/server.js 2015-06-09 12:05:51 UTC (rev 1638)
@@ -1,12 +1,11 @@
-var express = require('express');
+var express = require("express");
var app = express();
-app.use(express.static('.'));
+app.use(express.static("."));
-app.get('/', function(req, res){
- res.sendFile('view/test.html', {root: "."});
+app.get("/", function(req, res) {
+ res.sendFile("view/test.html", {root: "."});
});
app.listen(3000);
-console.log('Server running at http://192.168.99.190:3000/');
-
+console.log("Server running at http://192.168.99.190:3000/");
1
0
Author: jruchaud
Date: 2015-06-09 12:05:29 +0000 (Tue, 09 Jun 2015)
New Revision: 1637
Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1637
Log:
Useless file
Removed:
oipf/lib/js/utils/myTest.js
Deleted: oipf/lib/js/utils/myTest.js
===================================================================
--- oipf/lib/js/utils/myTest.js 2015-06-09 12:04:48 UTC (rev 1636)
+++ oipf/lib/js/utils/myTest.js 2015-06-09 12:05:29 UTC (rev 1637)
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-var myTest = (function () {
-
- var b = 1;
- var m1 =function() {
- return this.c1;
- };
- this.c1 = 99;
-
- return function() {
- this.logB = function() {
- console.log(m1());
- };
-
- /*
- * c2 vaudrait c1 car this correspond à window, ce n'est pas l'effet
- * attendu.
- */
- this.c2 = c1;
-
-// this.b = function() {
-// return b;
-// };
-
- this.b = b;
- };
-
-})();
-
1
0
Author: smaisonneuve
Date: 2015-06-09 12:04:48 +0000 (Tue, 09 Jun 2015)
New Revision: 1636
Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1636
Log:
[Test] - moving js files
Added:
oipf/test/js/ApplicationManagerTest.js
oipf/test/js/CapabilitiesTest.js
oipf/test/js/ConfigurationTest.js
oipf/test/js/OipfFactoryTest.js
oipf/test/js/ParentalControlManagerTest.js
oipf/test/js/RecordingSchedulerTest.js
oipf/test/js/SearchManagerTest.js
oipf/test/js/Test.js
oipf/test/js/TestCase.js
oipf/test/js/VideoBroadcastTest.js
Removed:
oipf/test/js/test/
Added: oipf/test/js/ApplicationManagerTest.js
===================================================================
--- oipf/test/js/ApplicationManagerTest.js (rev 0)
+++ oipf/test/js/ApplicationManagerTest.js 2015-06-09 12:04:48 UTC (rev 1636)
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+var ApplicationManagerTest = TestCase.extend({
+
+ init: function() {
+ this.super.init();
+ this.applicationManagerObject = oipfObjectFactory.createApplicationManagerObject();
+ this.applicationManagerObject.onApplicationLoaded = this.onApplicationLoaded;
+ },
+
+ beforeTest: function(resolve, reject) {
+
+ },
+
+ afterTest: function(resolve, reject) {
+
+ },
+
+ onApplicationLoaded: function(application) {
+ console.log(application);
+ },
+
+ testGetOwnerApplicationOfDocumentOfGlobalPropertyWindow: function(resolve, reject) {
+ var application = this.applicationManagerObject
+ .getOwnerApplication(window.document);
+
+ if (!this.assertEquals(application, null)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testGetOwnerApplicationWithNull: function(resolve, reject) {
+ var application = this.applicationManagerObject
+ .getOwnerApplication(null);
+
+ if (this.assertEquals(application, null)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+});
+
Added: oipf/test/js/CapabilitiesTest.js
===================================================================
--- oipf/test/js/CapabilitiesTest.js (rev 0)
+++ oipf/test/js/CapabilitiesTest.js 2015-06-09 12:04:48 UTC (rev 1636)
@@ -0,0 +1,250 @@
+/*
+ * 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.
+ */
+var CapabilitiesTest = TestCase.extend({
+ init: function() {
+ this.super.init();
+ },
+
+ beforeTest: function() {
+ this.capabilitiesObject = oipfObjectFactory.createCapabilitiesObject();
+ },
+
+ afterTest: function() {
+
+ },
+
+ /*
+ * FIXME:
+ * Yannis - 12/05/2015 - Instanciation of variable everyProperties.
+ */
+ testOIFPNormConformityOfObject: function(resolve, reject) {
+ var everyProperties;
+
+ for (var i = 0, l = everyProperties.length; i < l; i++) {
+ var currentProperty = everyProperties[i];
+ if (!this.capabilitiesObject[currentProperty]) {
+ reject();
+ return;
+ }
+ }
+ resolve();
+ },
+
+ testHasCapabilityWithAnInvalidProfileName: function(resolve, reject) {
+ var profileName = "Toto";
+ var result = this.capabilitiesObject.hasCapability(profileName);
+
+ if (result) {
+ reject();
+ } else {
+ resolve();
+ }
+ },
+
+ testHasCapabilityForAtLeastOneBaseProfileName: function(resolve, reject) {
+ var baseProfileNameList = this.modelFactory
+ .getCapabilitiesProperties().baseUIProfileName;
+ var supportedProfileNumber = 0;
+
+ for (var i = 0, l = baseProfileNameList.length; i < l; i++) {
+ var baseProfileName = baseProfileNameList[i];
+ var result = this.capabilitiesObject.hasCapability(baseProfileName);
+ result && supportedProfileNumber++;
+ }
+
+ if (supportedProfileNumber > 0) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testHasCapabilityForAllUIFragmentProfile: function(resolve, reject) {
+ var UIProfileNameFragmentList = this.modelFactory
+ .getCapabilitiesProperties().UIProfileNameFragment;
+ var supportedProfileNumber = 0;
+
+ for (var i = 0, l = UIProfileNameFragmentList.length; i < l; i++) {
+ var UIProfileNameFragment = UIProfileNameFragmentList[i];
+ var result = this.capabilitiesObject
+ .hasCapability(UIProfileNameFragment);
+ result && supportedProfileNumber++;
+ }
+
+ if (supportedProfileNumber == UIProfileNameFragmentList.length) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ getCapabilityAndNotifyResult: function(resolve, reject, profileName) {
+ var result = this.capabilitiesObject.hasCapability(profileName);
+
+ if (result) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testHasCapabilityTRICKMODE: function(resolve, reject) {
+ var profileName = "+TRICKMODE";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityAVCAD: function(resolve, reject) {
+ var profileName = "+AVCAD";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityDL: function(resolve, reject) {
+ var profileName = "+DL";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityIPTV_SDS: function(resolve, reject) {
+ var profileName = "+IPTV_SDS";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityIPTV_URI: function(resolve, reject) {
+ var profileName = "+IPTV_URI";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityANA: function(resolve, reject) {
+ var profileName = "+ANA";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityDVB_C: function(resolve, reject) {
+ var profileName = "+DVB_C";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityDVB_T: function(resolve, reject) {
+ var profileName = "+DVB_T";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityDVB_S: function(resolve, reject) {
+ var profileName = "+DVB_S";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityDVB_C2: function(resolve, reject) {
+ var profileName = "+DVB_C2";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityDVB_T2: function(resolve, reject) {
+ var profileName = "+DVB_T2";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityDVB_S2: function(resolve, reject) {
+ var profileName = "+DVB_S2";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityISDB_C: function(resolve, reject) {
+ var profileName = "+ISDB_C";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityISDB_T: function(resolve, reject) {
+ var profileName = "+ISDB_T";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityISDB_S: function(resolve, reject) {
+ var profileName = "+ISDB_S";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityMETA_BCG: function(resolve, reject) {
+ var profileName = "+META_BCG";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityMETA_EIT: function(resolve, reject) {
+ var profileName = "+META_EIT";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityMETA_SI: function(resolve, reject) {
+ var profileName = "+META_SI";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityITV_KEYS: function(resolve, reject) {
+ var profileName = "+ITV_KEYS";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityCONTROLLED: function(resolve, reject) {
+ var profileName = "+CONTROLLED";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityPVR: function(resolve, reject) {
+ var profileName = "+PVR";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityDRM: function(resolve, reject) {
+ var profileName = "+DRM";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityCommunicationServices: function(resolve, reject) {
+ var profileName = "+CommunicationServices";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilitySVG: function(resolve, reject) {
+ var profileName = "+SVG";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityPOINTER: function(resolve, reject) {
+ var profileName = "+POINTER";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityPOLLNOTIF: function(resolve, reject) {
+ var profileName = "+POLLNOTIF";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityHtml5Media: function(resolve, reject) {
+ var profileName = "+HTML5_MEDIA";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityWIDGETS: function(resolve, reject) {
+ var profileName = "+WIDGETS";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityRCF: function(resolve, reject) {
+ var profileName = "+RCF";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityTELEPHONY: function(resolve, reject) {
+ var profileName = "+TELEPHONY";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ },
+
+ testHasCapabilityVIDEOTELEPHONY: function(resolve, reject) {
+ var profileName = "+VIDEOTELEPHONY";
+ this.getCapabilityAndNotifyResult(resolve, reject, profileName);
+ }
+
+});
+
Added: oipf/test/js/ConfigurationTest.js
===================================================================
--- oipf/test/js/ConfigurationTest.js (rev 0)
+++ oipf/test/js/ConfigurationTest.js 2015-06-09 12:04:48 UTC (rev 1636)
@@ -0,0 +1,315 @@
+/*
+ * 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.
+ */
+
+var ConfigurationTest = TestCase.extend({
+
+ init: function() {
+ this.super.init();
+ },
+
+ beforeTest: function(resolve, reject) {
+ this.configurationObject = oipfObjectFactory.createConfigurationObject();
+ this.localSystem = this.configurationObject.localSystem;
+ logTest("State: Pending");
+ },
+
+ testSetScreenSize : function(resolve, reject){
+
+ if (this.localSystem) {
+ var result = this.localSystem.setScreenSize(1280, 720);
+
+ if (result) {
+ resolve();
+ } else {
+ throw new Error("Unexpected error");
+ }
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetScreenSizeWithoutParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.waitForError(this.localSystem.setScreenSize, resolve);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetScreenSizeWithUnexpectedTypeParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+
+ this.waitForError(
+ this.localSystem.setScreenSize.bind(this.localSystem, "", ""),
+ resolve);
+
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetScreenSizeWithExcessiveParametersNumber: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.waitForError(
+ this.localSystem.setScreenSize.bind(this.localSystem, 640, 480, 854),
+ resolve);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetTvStandard: function(resolve, reject) {
+
+ if (this.localSystem) {
+ var result = this.localSystem.setTVStandard(4);
+ if (result) {
+ resolve();
+ } else {
+ throw new Error("Unexpected error");
+ }
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetTvStandardWihtoutParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.waitForError(this.localSystem.setTVStandard, resolve);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetTvStandardWithUnexpectedTypeParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.waitForError(
+ this.localSystem.setTVStandard.bind(this.localSystem, ""),
+ resolve);
+
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetTvStandardWithExcessiveParametersNumber: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.waitForError(
+ this.localSystem.setTVStandard.bind(this.localSystem, 4, 4),
+ resolve);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetPvrSupport: function(resolve, reject) {
+
+ if (this.localSystem) {
+ var result = this.localSystem.setPvrSupport(1);
+ if (result) {
+ resolve();
+ } else {
+ throw new Error("Unexpected error");
+ }
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetPvrSupportWithoutParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.waitForError(this.localSystem.setPvrSupport, resolve);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetPvrSupportWithUnexpectedTypeParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.waitForError(
+ this.localSystem.setPvrSupport.bind(this.localSystem, {}),
+ resolve);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetPvrSupportWithExcessiveParametersNumber: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.waitForError(
+ this.localSystem.setPvrSupport.bind(this.localSystem, 0, 0, 0),
+ resolve);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetPowerState: function(resolve, reject) {
+
+ if (this.localSystem) {
+ var result = this.localSystem.setPowerState();
+ if (result) {
+ resolve();
+ } else {
+ throw new Error("Unexpected error");
+ }
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetPowerStateWithoutParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.waitForError(this.localSystem.setPowerState, resolve);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetPowerStateWithUnexpectedTypeParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.waitForError(
+ this.localSystem.setPowerState.bind(this.localSystem, {}),
+ resolve);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetPowerStateWithExcessiveParametersNumber: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.waitForError(
+ this.localSystem.setPowerState.bind(this.localSystem, 0, 0, 0),
+ resolve);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetDigestCredentials: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.localSystem.setDigestCredentials(640, 480, 854);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetDigestCredentialsWithoutParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.localSystem.setDigestCredentials(640, 480, 854);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetDigestCredentialsWithUnexpectedTypeParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.localSystem.setDigestCredentials(640, 480, 854);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testSetDigestCredentialsWithExcessiveParametersNumber: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.localSystem.setDigestCredentials(640, 480, 854);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testClearDigestCredentials: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.localSystem.clearDigestCredentials(640, 480, 854);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testClearDigestCredentialsWithoutParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.localSystem.clearDigestCredentials(640, 480, 854);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testClearDigestCredentialsWithUnexpectedTypeParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.localSystem.clearDigestCredentials(640, 480, 854);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testClearDigestCredentialsWithExcessiveParametersNumber: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.localSystem.clearDigestCredentials(640, 480, 854);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testHasDigestCredentials: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.localSystem.hasDigestCredentials(640, 480, 854);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testHasDigestCredentialsWithoutParameters: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.localSystem.hasDigestCredentials(640, 480, 854);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testHasDigestCredentials: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.localSystem.hasDigestCredentials(640, 480, 854);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ testHasDigestCredentialsWithExcessiveParametersNumber: function(resolve, reject) {
+
+ if (this.localSystem) {
+ this.localSystem.hasDigestCredentials(640, 480, 854);
+ } else {
+ throw new Error("Unexpected error");
+ }
+ },
+
+ afterTest: function() {
+ }
+
+});
+
Added: oipf/test/js/OipfFactoryTest.js
===================================================================
--- oipf/test/js/OipfFactoryTest.js (rev 0)
+++ oipf/test/js/OipfFactoryTest.js 2015-06-09 12:04:48 UTC (rev 1636)
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+var OipfFactoryTest = TestCase.extend({
+ init: function() {
+ this.testIsApplicationManagerObjectSupported = this.testObjectSupported.bind(this, APPLICATION_MANAGER_DAE_MIME_TYPE);
+ this.testIsCapabilitiesObjectSupported = this.testObjectSupported.bind(this, CAPABILITIES_DAE_MIME_TYPE);
+ this.testIsChannelConfigSupported = this.testObjectSupported.bind(this, CHANNEL_CONFIG_TYPE);
+ this.testIsCodManagerObjectSupported = this.testObjectSupported.bind(this, COD_MANAGER_DAE_MIME_TYPE);
+ this.testIsIMSObjectSupported = this.testObjectSupported.bind(this, COMMUNICATION_SERVICES_DAE_MIME_TYPE);
+ this.testIsConfigurationObjectSupported = this.testObjectSupported.bind(this, CONFIGURATION_DAE_MIME_TYPE);
+ this.testIsDownloadManagerObjectSupported = this.testObjectSupported.bind(this, DOWNLOAD_MANAGER_DAE_MIME_TYPE);
+ this.testIsDownloadTriggerObjectSupported = this.testObjectSupported.bind(this, DOWNLOAD_TRIGGER_DAE_MIME_TYPE);
+ this.testIsDrmAgentObjectSupported = this.testObjectSupported.bind(this, DRM_AGENT_DAE_MIME_TYPE);
+ this.testIsGatewayInfoObjectSupported = this.testObjectSupported.bind(this, GATEWAY_INFO_DAE_MIME_TYPE);
+ this.testIsMDTFObjectSupported = this.testObjectSupported.bind(this, MDTF_DAE_MIME_TYPE);
+ this.testIsNotifSocketObjectSupported = this.testObjectSupported.bind(this, NOTIF_SOCKET_DAE_MIME_TYPE);
+ this.testIsParentalControlManagerObjectSupported = this.testObjectSupported.bind(this, PARENTAL_CONTROL_MANAGER_DAE_MIME_TYPE);
+ this.testIsRecordingSchedulerObjectSupported = this.testObjectSupported.bind(this, RECORDING_SCHEDULER_DAE_MIME_TYPE);
+ this.testIsRemoteControlFunctionObjectSupported = this.testObjectSupported.bind(this, REMOTE_CONTROL_FUNCTION_DAE_MIME_TYPE);
+ this.testIsRemoteManagementObjectSupported = this.testObjectSupported.bind(this, REMOTE_MANAGEMENT_DAE_MIME_TYPE);
+ this.testIsSearchManagerObjectSupported = this.testObjectSupported.bind(this, SEARCH_MANAGER_DAE_MIME_TYPE);
+ this.testIsStatusViewObjectSupported = this.testObjectSupported.bind(this, STATUS_VIEW_DAE_MIME_TYPE);
+ this.testIsVideoBroadcastObjectSupported = this.testObjectSupported.bind(this, VIDEO_BROADCAST_DAE_MIME_TYPE);
+ this.testIsVideoMpegObjectSupported = this.testObjectSupported.bind(this, VIDEO_MPEG_DAE_MIME_TYPE);
+
+ this.testCreateApplicationManagerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createApplicationManagerObject);
+ this.testCreateCapabilitiesObject = this.testObjectCreated.bind(this, oipfObjectFactory.createCapabilitiesObject);
+ this.testCreateChannelConfig = this.testObjectCreated.bind(this, oipfObjectFactory.createChannelConfig);
+ this.testCreateCodManagerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createCodManagerObject);
+ this.testCreateConfigurationObject = this.testObjectCreated.bind(this, oipfObjectFactory.createConfigurationObject);
+ this.testCreateDownloadManagerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createDownloadManagerObject);
+ this.testCreateDownloadTriggerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createDownloadTriggerObject);
+ this.testCreateDrmAgentObject = this.testObjectCreated.bind(this, oipfObjectFactory.createDrmAgentObject);
+ this.testCreateGatewayInfoObject = this.testObjectCreated.bind(this, oipfObjectFactory.createGatewayInfoObject);
+ this.testCreateIMSObject = this.testObjectCreated.bind(this, oipfObjectFactory.createIMSObject);
+ this.testCreateMDTFObject = this.testObjectCreated.bind(this, oipfObjectFactory.createMDTFObject);
+ this.testCreateNotifSocketObject = this.testObjectCreated.bind(this, oipfObjectFactory.createNotifSocketObject);
+ this.testCreateParentalControlManagerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createParentalControlManagerObject);
+ this.testCreateRecordingSchedulerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createRecordingSchedulerObject);
+ this.testCreateRemoteControlFunctionObject = this.testObjectCreated.bind(this, oipfObjectFactory.createRemoteControlFunctionObject);
+ this.testCreateRemoteManagementObject = this.testObjectCreated.bind(this, oipfObjectFactory.createRemoteManagementObject);
+ this.testCreateSearchManagerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createSearchManagerObject);
+ this.testCreateStatusViewObject = this.testObjectCreated.bind(this, oipfObjectFactory.createStatusViewObject);
+ this.testCreateVideoBroadcastObject = this.testObjectCreated.bind(this, oipfObjectFactory.createVideoBroadcastObject);
+ this.testCreateVideoMpegObject = this.testObjectCreated.bind(this, oipfObjectFactory.createVideoMpegObject);
+ },
+
+ testObjectCreated: function(method, resolve, reject) {
+ var object = method.call(oipfObjectFactory);
+
+ if (this.assertNotNull(object)) {
+ resolve();
+ } else {
+ reject("The object is null.");
+ }
+ },
+
+ testObjectSupported: function(mimeType, resolve, reject) {
+ if (oipfObjectFactory.isObjectSupported(mimeType)) {
+ resolve();
+ } else {
+ reject();
+ }
+ }
+});
Added: oipf/test/js/ParentalControlManagerTest.js
===================================================================
--- oipf/test/js/ParentalControlManagerTest.js (rev 0)
+++ oipf/test/js/ParentalControlManagerTest.js 2015-06-09 12:04:48 UTC (rev 1636)
@@ -0,0 +1,279 @@
+/*
+ * 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.
+ */
+
+var ParentalControlManagerTest = TestCase.extend({
+
+ init: function() {
+ this.super.init();
+ this.PIN_CORRECT = 0;
+ this.PIN_INCORRECT = 1;
+ this.PIN_LOCKED = 2;
+ this.PIN = "1234";
+ },
+
+ beforeTest: function(resolve, reject) {
+ this.parentalControlManagerObject =
+ oipfObjectFactory.createParentalControlManagerObject();
+
+ },
+
+ afterTest: function() {
+ this.parentalControlManagerObject.setParentalControlStatus(this.PIN, false);
+ this.parentalControlManagerObject.setBlockUnrated(this.PIN, false);
+ this.parentalControlManagerObject._setCurrentInvalidPINAttempts &&
+ this.parentalControlManagerObject._setCurrentInvalidPINAttempts(0);
+
+ this.newPIN && this.resetOldPIN();
+ },
+
+ resetOldPIN: function() {
+ this.parentalControlManagerObject
+ .setParentalControlPIN(this.newPIN, this.PIN);
+ },
+
+ renderResultIfTrue: function(resolve, reject, condition) {
+ if (condition) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testSetParentalControlStatusWithValidPINAndTrue: function(resolve, reject) {
+ var result = this.parentalControlManagerObject
+ .setParentalControlStatus(this.PIN, true);
+
+ console.log(result);
+
+ if (this.assertEquals(result, 0)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testSetParentalControlStatusWithValidPINAndFalse: function(resolve, reject) {
+ var result = this.parentalControlManagerObject
+ .setParentalControlStatus(this.PIN, false);
+
+ console.log(result);
+
+ if (this.assertEquals(result, 0)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testSetParentalControlStatusWithInvalidPINAndTrue: function(resolve, reject) {
+ var result = this.parentalControlManagerObject
+ .setParentalControlStatus("5555", true);
+
+ console.log(result);
+
+ this.renderResultIfTrue(resolve, reject, this.assertEquals(result, 1));
+ },
+
+ testSetParentalControlStatusWithInvalidPINAndFalse: function(resolve, reject) {
+ var result = this.parentalControlManagerObject
+ .setParentalControlStatus("5555", false);
+
+ console.log(result);
+
+ this.renderResultIfTrue(resolve, reject, this.assertEquals(result, 1));
+ },
+
+ testSetParentalControlStatusWithInvalidOldPINAndValidNewPIN10Times: function(resolve, reject) {
+ for(var i = 0, li = 10; i < li; i++) {
+ var result = this.parentalControlManagerObject
+ .setParentalControlStatus("PIN", false);
+
+ console.log(i+1, ":", result);
+ }
+
+ this.renderResultIfTrue(resolve, reject,
+ this.assertEquals(result, this.PIN_LOCKED));
+ },
+
+ testVerifyParentalControlPINWithInvalidPIN10Times: function(resolve, reject) {
+ for(var i = 0, li = 10; i < li; i++) {
+ var result = this.parentalControlManagerObject
+ .verifyParentalControlPIN("0000");
+
+ console.log(i+1, ":", result);
+ }
+
+ if (this.assertEquals(result, 2)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testVerifyParentalControlPINWithValidPIN: function(resolve, reject) {
+ var result = this.parentalControlManagerObject
+ .verifyParentalControlPIN("1234");
+
+ console.log(result);
+
+ this.renderResultIfTrue(resolve, reject,
+ this.assertEquals(result, this.PIN_CORRECT));
+ },
+
+ testVerifyParentalControlPINWithInvalidPIN: function(resolve, reject) {
+ var result = this.parentalControlManagerObject
+ .verifyParentalControlPIN("68465");
+
+ console.log(result);
+
+ this.renderResultIfTrue(resolve, reject,
+ this.assertEquals(result, this.PIN_INCORRECT));
+ },
+
+ testSetBlockUnratedWithInvalidPIN10Times: function(resolve, reject) {
+ for(var i = 0, li = 10; i < li; i++) {
+ var result = this.parentalControlManagerObject
+ .setBlockUnrated("toto", true);
+
+ console.log(i+1, ":", result);
+ }
+
+ if (this.assertEquals(result, 2)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testSetBlockUnratedWithValidPINAndTrue: function(resolve, reject) {
+ var result = this.parentalControlManagerObject
+ .setBlockUnrated(this.PIN, true);
+
+ console.log(result);
+
+ if (this.assertEquals(result, 0)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testSetBlockUnratedWithValidPINAndFalse: function(resolve, reject) {
+ var result = this.parentalControlManagerObject
+ .setBlockUnrated(this.PIN, false);
+
+ console.log(result);
+
+ if (this.assertEquals(result, 0)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testSetBlockUnratedWithInvalidPINAndTrue: function(resolve, reject) {
+ var result = this.parentalControlManagerObject
+ .setBlockUnrated("5555", true);
+
+ console.log(result);
+
+ this.renderResultIfTrue(resolve, reject, this.assertEquals(result, 1));
+ },
+
+ testSetBlockUnratedWithInvalidPINAndFalse: function(resolve, reject) {
+ var result = this.parentalControlManagerObject
+ .setBlockUnrated("5555", false);
+
+ console.log(result);
+
+ this.renderResultIfTrue(resolve, reject, this.assertEquals(result, 1));
+ },
+
+ testGetBlockUnratedWhenUnratedContentsAreNotBlocked: function(resolve, reject) {
+ if (!this.parentalControlManagerObject.getBlockUnrated()) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testGetBlockUnratedWhenUnratedContentsAreBlocked: function(resolve, reject) {
+ this.parentalControlManagerObject.setBlockUnrated("1234", true);
+
+ if (this.parentalControlManagerObject.getBlockUnrated()) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testSetParentalControlPINWithInvalidOldPINAndValidNewPIN10Times: function(resolve, reject) {
+ for(var i = 0, li = 10; i < li; i++) {
+ var resultSetPIN = this.parentalControlManagerObject
+ .setParentalControlPIN("PIN", "1212");
+
+ console.log(i+1, ":", resultSetPIN);
+ }
+
+ this.renderResultIfTrue(resolve, reject,
+ this.assertEquals(resultSetPIN, this.PIN_LOCKED));
+ },
+
+ testSetParentalControlPINWithValidOldPINAndNewPIN: function(resolve, reject) {
+ this.newPIN = "1212";
+ var resultSetPIN = this.parentalControlManagerObject
+ .setParentalControlPIN(this.PIN, this.newPIN);
+
+ var resultVerifyPIN = this.parentalControlManagerObject
+ .verifyParentalControlPIN(this.newPIN);
+
+ if (this.assertEquals(resultSetPIN, this.PIN_CORRECT) &&
+ this.assertEquals(resultVerifyPIN, this.PIN_CORRECT)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testSetParentalControlPINWithInvalidOldPINAndValidNewPIN: function(resolve, reject) {
+ this.newPIN = "1212";
+ var resultSetPIN = this.parentalControlManagerObject
+ .setParentalControlPIN("PIN", this.newPIN);
+
+ console.log(resultSetPIN);
+
+ var resultVerifyPIN = this.parentalControlManagerObject
+ .verifyParentalControlPIN(this.newPIN);
+
+ console.log(resultVerifyPIN);
+
+ if (this.assertEquals(resultSetPIN, this.PIN_INCORRECT) &&
+ this.assertEquals(resultVerifyPIN, this.PIN_INCORRECT)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testGetParentalControlStatusWhenParentalControlStatusDeactivated: function(resolve, reject) {
+ if (!this.parentalControlManagerObject.getParentalControlStatus()) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testGetParentalControlStatusWhenParentalControlStatusActivated: function(resolve, reject) {
+ this.parentalControlManagerObject
+ .setParentalControlStatus(this.PIN, true);
+
+ if (this.parentalControlManagerObject.getParentalControlStatus()) {
+ resolve();
+ } else {
+ reject();
+ }
+ }
+});
\ No newline at end of file
Added: oipf/test/js/RecordingSchedulerTest.js
===================================================================
--- oipf/test/js/RecordingSchedulerTest.js (rev 0)
+++ oipf/test/js/RecordingSchedulerTest.js 2015-06-09 12:04:48 UTC (rev 1636)
@@ -0,0 +1,537 @@
+/*
+ * 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.
+ */
+
+var RecordingSchedulerTest = TestCase.extend({
+
+ init: function() {
+ this.super.init();
+ this.timer = 3*60*1000; //3minutes, we had increased timer for unresolved tests.
+ },
+
+ createVideoBroadcast: function() {
+ this.vidBroadObj = oipfObjectFactory.createVideoBroadcastObject();
+ },
+
+ deleteAndStopStartedRecording: function() {
+ var recordings = this.recordingSchedulerObject.recordings;
+
+ for (var i = 0, l = recordings.length; i < l; i++) {
+ var recording = recordings[i];
+ if (recording.state == this.STARTED) {
+ this.recordingSchedulerObject.stop(recording);
+ this.recordingSchedulerObject.remove(recording);
+ }
+ }
+ },
+
+ beforeTest: function(resolve, reject) {
+ var self = this;
+ this.getPromise = function () {
+ return new Promise(function(resolve, reject) {
+ self.resolve = resolve;
+ resolve();
+ });
+ };
+ this.onPVREventCopy = this.onPVREvent.bind(this, resolve, reject);
+ this.recordingSchedulerObject =
+ oipfObjectFactory.createRecordingSchedulerObject();
+
+ this.recordingSchedulerObject
+ .addEventListener("PVREvent", this.onPVREventCopy, false);
+
+ this.createVideoBroadcast();
+ this.onPlayStateChange = this.onChangeState.bind(this, resolve, reject);
+ this.vidBroadObj
+ .addEventListener("PlayStateChange", this.onPlayStateChange, false);
+
+ this.deleteAndStopStartedRecording();
+
+ this.searchManagerObj = oipfObjectFactory.createSearchManagerObject();
+
+ this.transitions = [];
+ this.previousState = null;
+ this.currentIndex = 0;
+ },
+
+ afterTest: function(resolve, reject) {
+ this.recordingSchedulerObject
+ .removeEventListener("PVREvent", this.onPVREventCopy);
+ this.recordingSchedulerObject.stop(this.recording);
+ this.recordingSchedulerObject.remove(this.recording);
+ },
+
+ onPVREvent: function(resolve, reject, newState, recordings) {
+ if (this.currentIndex < this.transitions.length) {
+ console.log("PVREvent received: State:", newState);
+ var currentTransition = this.transitions[this.currentIndex];
+ var begin = currentTransition.begin;
+ var end = currentTransition.end;
+
+ if (begin == this.previousState && end == newState) {
+ currentTransition.callback && currentTransition.callback();
+ this.previousState = newState;
+ this.currentIndex++;
+ } else {
+ reject("Invalid state.");
+ }
+ } else {
+ console.log("Any others transitions have been set.");
+ }
+ },
+
+ testRecordAFinishedProgramme: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findAFinishedProgramme.bind(this))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.recording = self.recordingSchedulerObject.record(self.programme);
+ if (self.assertEquals(self.recording, null)) {
+ resolve();
+ } else {
+ reject();
+ }
+ });
+ },
+
+ testRecordCurrentProgramme: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ console.log("Addtion of transition.");
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED);
+ self.addTransition(self.SCHEDULED, self.BEFORE_STARTED);
+ self.addTransition(self.BEFORE_STARTED, self.STARTED);
+ self.addTransition(self.STARTED, self.COMPLETED, resolve);
+
+ self.recording = self.recordingSchedulerObject.record(self.programme);
+ console.log("Recording State after scheduling:", self.recording.state);
+// console.log("Recording:", self.recording);
+ });
+ },
+
+ testRecordAtCurrentProgramme: function(resolve, reject) {
+ this.addTransition(null, this.SCHEDULED);
+ this.addTransition(this.SCHEDULED, this.BEFORE_STARTED);
+ this.addTransition(this.BEFORE_STARTED, this.STARTED);
+ this.addTransition(this.STARTED, this.COMPLETED, resolve);
+ var channelConfig = this.vidBroadObj.getChannelConfig();
+ var randomIndex = oipf.utils
+ .getRandomNumberBetweenMinMax(0, channelConfig.channelList.length);
+ var channel = channelConfig.channelList[randomIndex];
+ var currentTime = Math.round(this.dateUtils.nowInSeconds());
+ this.recording = this.recordingSchedulerObject.recordAt(currentTime,
+ 1*60, 0x00, channel.ccid);
+ console.log(this.recording);
+ },
+
+ testStopAScheduledRecording: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED, function() {
+ self.recordingSchedulerObject.stop(self.recording);
+ self.timeout(2000).then(resolve);
+ });
+
+ self.recording = self.recordingSchedulerObject.record(self.programme);
+ });
+ },
+
+ testStopAnOngoingRecording: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED);
+ self.addTransition(self.SCHEDULED, self.BEFORE_STARTED);
+ self.addTransition(self.BEFORE_STARTED, self.STARTED, function() {
+ self.recordingSchedulerObject.stop(self.recording);
+ self.timeout(2000).then(resolve);
+ });
+
+ self.recording = self.recordingSchedulerObject.record(self.programme);
+ });
+ },
+
+ testStopACompletedRecording: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED);
+ self.addTransition(self.SCHEDULED, self.BEFORE_STARTED);
+ self.addTransition(self.BEFORE_STARTED, self.STARTED);
+ self.addTransition(self.STARTED, self.COMPLETED, function() {
+ self.recordingSchedulerObject.stop(self.recording);
+ self.timeout(3000).then(resolve);
+ });
+
+ self.recording = self.recordingSchedulerObject.record(self.programme);
+ });
+ },
+
+ testRemoveAScheduledRecording: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED, function () {
+ self.recordingSchedulerObject.remove(self.recording);
+ });
+ self.addTransition(self.SCHEDULED, self.REMOVED, resolve);
+
+ self.recording = self.recordingSchedulerObject
+ .record(self.programme);
+ });
+ },
+
+ testRemoveAnOngoingRecording: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED);
+ self.addTransition(self.SCHEDULED, self.BEFORE_STARTED);
+ self.addTransition(self.BEFORE_STARTED, self.STARTED, function() {
+ self.recordingSchedulerObject.remove(self.recording);
+ });
+ self.addTransition(self.STARTED, self.REMOVED, resolve);
+
+ self.recording = self.recordingSchedulerObject
+ .record(self.programme);
+ });
+ },
+
+ testRemoveACompletedRecording: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED);
+ self.addTransition(self.SCHEDULED, self.BEFORE_STARTED);
+ self.addTransition(self.BEFORE_STARTED, self.STARTED);
+ self.addTransition(self.STARTED, self.COMPLETED, function () {
+ self.recordingSchedulerObject.remove(self.recording);
+ });
+ self.addTransition(self.COMPLETED, self.REMOVED, resolve);
+ self.recording = self.recordingSchedulerObject.record(self.programme);
+ });
+ },
+
+ testUpdateAScheduledRecordingOnStartTime: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED, function () {
+ var twentyMinutes = 20 * 60;
+ self.recordingSchedulerObject.update(self.recording.id,
+ self.recording.startTime + twentyMinutes, undefined,
+ undefined);
+ });
+ self.addTransition(self.SCHEDULED, self.BEFORE_STARTED);
+ self.addTransition(self.BEFORE_STARTED, self.STARTED);
+ self.addTransition(self.STARTED, self.COMPLETED);
+ self.recording = self.recordingSchedulerObject.record(self.programme);
+ });
+ },
+
+ testUpdateAScheduledRecordingOnDuration: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED, function () {
+ var twentyMinutes = 20 * 60;
+ self.recordingSchedulerObject.update(self.recording.id,
+ undefined, self.recording.duration + twentyMinutes,
+ undefined);
+ });
+ self.addTransition(self.SCHEDULED, self.BEFORE_STARTED);
+ self.addTransition(self.BEFORE_STARTED, self.STARTED);
+ self.addTransition(self.STARTED, self.COMPLETED);
+ self.recording = self.recordingSchedulerObject.record(self.programme);
+ });
+ },
+
+ testUpdateAnOngoingRecordingWithAValidDuration: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED);
+ self.addTransition(self.SCHEDULED, self.BEFORE_STARTED);
+ self.addTransition(self.BEFORE_STARTED, self.STARTED, function () {
+ var oneMinute = 1 * 60;
+ var result = self.recordingSchedulerObject.update(self.recording.id,
+ undefined, self.recording.duration + oneMinute,
+ undefined);
+ if (self.assertEquals(result, true)) {
+ resolve();
+ } else {
+ reject();
+ }
+ });
+ self.recording = self.recordingSchedulerObject
+ .record(self.programme);
+ });
+ },
+
+ testUpdateAnOngoingRecordingWithATooShortDuration: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED);
+ self.addTransition(self.SCHEDULED, self.BEFORE_STARTED);
+ self.addTransition(self.BEFORE_STARTED, self.STARTED, function () {
+ var oneMinute = 1 * 60;
+ var result = self.recordingSchedulerObject.update(
+ self.recording.id, undefined, oneMinute, undefined);
+ if (self.assertEquals(result, false)) {
+ resolve();
+ } else {
+ reject();
+ }
+ });
+ self.recording = self.recordingSchedulerObject
+ .record(self.programme);
+ });
+ },
+
+ testUpdateAnOngoingRecordingOnStartTime: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED);
+ self.addTransition(self.SCHEDULED, self.BEFORE_STARTED);
+ self.addTransition(self.BEFORE_STARTED, self.STARTED, function () {
+
+ var result = self.recordingSchedulerObject.update(self.recording.id,
+ 564, undefined, undefined);
+ if (self.assertEquals(result, false)) {
+ resolve();
+ } else {
+ reject();
+ }
+ });
+ self.recording = self.recordingSchedulerObject
+ .record(self.programme);
+ });
+ },
+
+
+ testUpdateAnOngoingRecordingOnRepeatDays: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED);
+ self.addTransition(self.SCHEDULED, self.BEFORE_STARTED);
+ self.addTransition(self.BEFORE_STARTED, self.STARTED, function () {
+ var result = self.recordingSchedulerObject.update(
+ self.recording.id, undefined, undefined, 0x00);
+
+ if (self.assertEquals(result, false)) {
+ resolve();
+ } else {
+ reject();
+ }
+ });
+ self.recording = self.recordingSchedulerObject
+ .record(self.programme);
+ });
+ },
+
+ testUpdateACompletedRecordingOnDuration: function(resolve, reject) {
+ var self = this;
+
+ this.getPromise()
+ .then(this.bindToCurrentChannel.bind(this))
+ .then(this.timeout.bind(this))
+ .then(this.findProgrammeFromStream.bind(this, resolve, reject))
+ .then(this.timeout.bind(this))
+ .then(function() {
+ self.resetTransitionVariables();
+ self.addTransition(null, self.SCHEDULED);
+ self.addTransition(self.SCHEDULED, self.BEFORE_STARTED);
+ self.addTransition(self.BEFORE_STARTED, self.STARTED);
+ self.addTransition(self.STARTED, self.COMPLETED, function () {
+ var twentyMinutes = 20 * 60;
+ var result = self.recordingSchedulerObject
+ .update(self.recording.id, undefined,
+ self.recording.duration + twentyMinutes,
+ undefined);
+
+ if (self.assertEquals(result, false)) {
+ resolve();
+ } else {
+ reject();
+ }
+ });
+
+ self.recording = self.recordingSchedulerObject
+ .record(self.programme);
+ });
+ },
+
+ bindToCurrentChannel: function() {
+ this.previousState = this.UNREALIZED;
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ console.log("Binding with current channel succeeded.");
+ });
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ findAFinishedProgramme: function() {
+ var self = this;
+ var metadataSearch = self.searchManagerObj.
+ createSearch(self.SCHEDULED_CONTENT);
+ var now = Math.round(Date.now() / 1000);
+ var query = metadataSearch.createQuery("Programme.startTime", 4, now);
+ metadataSearch.setQuery(query);
+
+ var offset = 0;
+ var count = 4;
+ metadataSearch.result.getResults(offset, count);
+
+ this.searchManagerObj.onMetadataSearch = function(search, state) {
+
+ console.log("[INFO]: onMetadataSearch called");
+
+ switch (state) {
+
+ case 0:
+ if (!self.assertEquals(search.result.length, 0)) {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: found");
+ self.programme = search.result[0];
+ console.log(self.programme);
+ } else {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: not found");
+ }
+ break;
+
+ default:
+ console.log("Unknow state");
+ reject();
+ }
+ };
+ },
+
+ findProgrammeFromStream: function() {
+ var searchTarget = 1;
+ var metaDataSearch = this.searchManagerObj.createSearch(searchTarget);
+ var currentChannel = this.vidBroadObj.currentChannel;
+ var startTime = null;
+ metaDataSearch.findProgrammesFromStream(currentChannel, startTime, 1);
+ var offset = 0;
+ var count = 1;
+ metaDataSearch.result.getResults(offset, count);
+ var self = this;
+ this.searchManagerObj.onMetadataSearch = function(search, state) {
+
+ console.log("[INFO]: onMetadataSearch called");
+
+ switch (state) {
+
+ case 0:
+ if (self.assertNotNull(search.result[0])) {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: found");
+ self.programme = search.result[0];
+ console.log(self.programme);
+ } else {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: not found");
+ }
+ break;
+
+ default:
+ console.log("Unknow state");
+ }
+ };
+ },
+
+ resetTransitionVariables: function() {
+ this.currentIndex = 0;
+ this.transitions = [];
+ this.previousState = null;
+ }
+});
+
+
Added: oipf/test/js/SearchManagerTest.js
===================================================================
--- oipf/test/js/SearchManagerTest.js (rev 0)
+++ oipf/test/js/SearchManagerTest.js 2015-06-09 12:04:48 UTC (rev 1636)
@@ -0,0 +1,694 @@
+/*
+ * Description:
+ * This class gather a set of method necessary to test a search manager object.
+ *
+ */
+var SearchManagerTest = TestCase.extend({
+
+ UNREALIZED: 0,
+
+ CONNECTING: 1,
+
+ PRESENTING: 2,
+
+ STOPPED: 3,
+
+ searchManagerObj: null,
+
+ init: function() {
+ this.super.init();
+ },
+
+ beforeTest: function(resolve, reject) {
+ this.searchManagerObj = oipfObjectFactory.createSearchManagerObject();
+ this.vidBroadObj = oipfObjectFactory.createVideoBroadcastObject();
+ this.onPlayStateChange = this.onChangeState.bind(this, resolve, reject);
+ this.vidBroadObj.addEventListener("PlayStateChange", this.onPlayStateChange, false);
+ this.transitions = [];
+ this.previousState = this.vidBroadObj.playState;
+ this.currentIndex = 0;
+ this.channel = null;
+ logTest("State: Pending");
+ },
+
+ afterTest: function(resolve, reject) {
+ this.vidBroadObj.removeEventListener("PlayStateChange",
+ this.onPlayStateChange);
+ this.searchManagerObj.removeEventListener("MetadataSearch",
+ this.onPlayStateChange);
+ this.timerManager.clearTimer();
+ },
+
+ testFindAFinishedProgramme: function(resolve, reject) {
+ var self = this;
+ var metadataSearch = self.searchManagerObj.
+ createSearch(self.SCHEDULED_CONTENT);
+ var now = Math.round(Date.now() / 1000);
+ var query = metadataSearch.createQuery("Programme.startTime", 4, now);
+ metadataSearch.setQuery(query);
+
+ var offset = 0;
+ var count = 4;
+ metadataSearch.result.getResults(offset, count);
+
+ this.searchManagerObj.onMetadataSearch = function(search, state) {
+
+ console.log("[INFO]: onMetadataSearch called");
+
+ switch (state) {
+
+ case 0:
+ if (!self.assertEquals(search.result.length, 0)) {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: found");
+ resolve();
+ } else {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: not found");
+ reject();
+ }
+ break;
+
+ default:
+ console.log("Unknow state");
+ reject();
+ }
+ };
+
+ },
+
+ testGetCurrentProgrammeFromStream: function (resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+
+ var stat = "Pending";
+ logTest("State: " + stat);
+ var searchTarget = 1;
+ var metaDataSearch = self.searchManagerObj.createSearch(searchTarget);
+ var currentChannel = self.vidBroadObj.currentChannel;
+ var startTime = null;
+ metaDataSearch.findProgrammesFromStream(currentChannel, startTime);
+ var offset = 0;
+ var count = 1;
+ metaDataSearch.result.getResults(offset, count);
+// console.log(metaDataSearch.result[0]);//Must return undefined else wrong implementation of getResults method
+ });
+
+ this.searchManagerObj.onMetadataSearch = function(search, state) {
+
+ console.log("[INFO]: onMetadataSearch called");
+
+ switch (state) {
+
+ case 0:
+ if (self.assertNotNull(search.result[0])) {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: found");
+ resolve();
+ } else {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: not found");
+ reject();
+ }
+ break;
+
+ case 3:
+ var message = "[INFO] MetadataSearch in Idle state because of either search abort or parameters have been modified (query, constraints or search target)";
+ console.log(message);
+ reject();
+ break;
+
+ case 4:
+ message = "[INFO] The search cannot be complete because of lack of ressources or any other reason.";
+ console.log(message);
+ reject();
+ break;
+
+ default:
+ console.log("Unknow state");
+ reject();
+
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testSearchingForASpecificProgrammeByName: function(resolve, reject) {
+ var self = this;
+ var value = "X:enius";
+
+ var stat = "Pending";
+ logTest("State: " + stat);
+ var metadataSearch = self.searchManagerObj.
+ createSearch(self.SCHEDULED_CONTENT);
+
+ var query = metadataSearch.createQuery("Programme.name", 0, value);
+ metadataSearch.setQuery(query);
+
+ var offset = 0;
+ var count = 1;
+ metadataSearch.result.getResults(offset, count);
+
+ this.searchManagerObj.onMetadataSearch = function(search, state) {
+
+ console.log("[INFO]: onMetadataSearch called");
+
+ switch (state) {
+
+ case 0:
+ if (self.assertNotNull(search.result[0]) &&
+ self.assertEquals(search.result[0].name, value)) {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: found");
+ resolve();
+ } else {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: not found");
+ reject();
+ }
+ break;
+
+ case 3:
+ var message = "[INFO] MetadataSearch in Idle state because of either search abort or parameters have been modified (query, constraints or search target)";
+ console.log(message);
+ reject();
+ break;
+
+ case 4:
+ message = "[INFO] The search cannot be complete because of lack of ressources or any other reason.";
+ console.log(message);
+ reject();
+ break;
+
+ default:
+ console.log("Unknow state");
+ reject();
+
+ }
+ };
+
+// this.vidBroadObj.bindToCurrentChannel();
+
+ },
+
+ testSearchingForProgrammesWithDurationLowerThanOneHour: function(resolve, reject) {
+ var self = this;
+ var value = 3600;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+
+ var stat = "Pending";
+ logTest("State: " + stat);
+ var metadataSearch = self.searchManagerObj.
+ createSearch(self.SCHEDULED_CONTENT);
+
+ var query = metadataSearch.createQuery("Programme.duration", 4,
+ value);
+ metadataSearch.setQuery(query);
+
+ var offset = 0;
+ var count = 6;
+ metadataSearch.result.getResults(offset, count);
+// //Must return undefined else wrong implementation of getResults method
+// console.log(metaDataSearch.result[0]);
+ });
+
+ this.searchManagerObj.onMetadataSearch = function(search, state) {
+
+ console.log("[INFO]: onMetadataSearch called");
+
+ switch (state) {
+
+ case 0:
+ if (self.assertEquals(search.result.length, 6)) {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: found");
+ resolve();
+ } else {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: not found");
+ reject();
+ }
+ break;
+
+ default:
+ console.log("Unknow state");
+ reject();
+
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+
+ },
+
+ testAbortWhileProgrammesSearchWithoutConstraints: function(resolve, reject) {
+ var value = 3600;
+ var self = this;
+ var stat = "Pending";
+ logTest("State: " + stat);
+ var metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+ var query = metadataSearch.createQuery("duration", 4, value);
+ metadataSearch.setQuery(query);
+
+ var offset = 0;
+ var count = 6;
+ metadataSearch.result.getResults(offset, count);
+// //Must return undefined else wrong implementation of getResults method
+// console.log(metadataSearch.result[0]);
+ metadataSearch.result.abort();
+ resolve();
+
+
+ this.searchManagerObj.onMetadataSearch = function(search, state) {
+
+ console.log("[INFO]: onMetadataSearch called");
+
+ switch (state) {
+
+ case 0:
+ if (self.assertEquals(search.result.length, 6)) {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: found");
+ resolve();
+ } else {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: not found");
+ reject();
+ }
+ break;
+
+ case 3:
+ var message = "[INFO] MetadataSearch in Idle state because of either search abort or parameters have been modified (query, constraints or search target)";
+ console.log(message);
+ break;
+
+ default:
+ console.log("Unknow state");
+ reject();
+
+ }
+ };
+
+ },
+
+ testSetQueryWhileSearchWithoutConstraints: function(resolve, reject) {
+ var value = 3600;
+ var stat = "Pending";
+ logTest("State: " + stat);
+ var metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+ var query = metadataSearch.createQuery("duration", 4, value);
+ metadataSearch.setQuery(query);
+
+ var offset = 0;
+ var count = 6;
+ metadataSearch.result.getResults(offset, count);
+// //Must return undefined else wrong implementation of getResults method
+// console.log(metadataSearch.result[0]);
+ metadataSearch.setQuery(query);
+
+ if (this.assertEquals(metadataSearch.result.length, 0)) {
+ resolve();
+ } else {
+ reject();
+ }
+
+ },
+
+ testFindProgrammesFromStreamWhileSearchWithoutConstraints: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+
+ var stat = "Pending";
+ logTest("State: " + stat);
+ var searchTarget = 1;
+ var metadataSearch = self.searchManagerObj.createSearch(searchTarget);
+
+ var currentChannel = self.vidBroadObj.currentChannel;
+ var startTime = null;
+ metadataSearch.findProgrammesFromStream(currentChannel, startTime);
+
+ var offset = 0;
+ var count = 1;
+ metadataSearch.result.getResults(offset, count);
+
+ metadataSearch.findProgrammesFromStream(currentChannel, startTime);
+
+ if (self.assertEquals(metadataSearch.result.length, 0)) {
+ resolve();
+ } else {
+ reject();
+ }
+ });
+ this.vidBroadObj.bindToCurrentChannel();
+
+ },
+
+ testAddChannelConstraintWhileSearchWithoutConstraints: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+
+ var stat = "Pending";
+ logTest("State: " + stat);
+ var searchTarget = 1;
+ var metadataSearch = self.searchManagerObj
+ .createSearch(searchTarget);
+
+ var currentChannel = self.vidBroadObj.currentChannel;
+ var startTime = null;
+ metadataSearch.findProgrammesFromStream(currentChannel, startTime);
+
+ var offset = 0;
+ var count = 1;
+ metadataSearch.result.getResults(offset, count);
+
+ metadataSearch.addChannelConstraint(currentChannel);
+
+ if (self.assertEquals(metadataSearch.result.length, 0)) {
+ resolve();
+ } else {
+ reject();
+ }
+ });
+
+ this.vidBroadObj.bindToCurrentChannel();
+
+ },
+
+ testRemoveChannelConstraintWhileSearchWithoutConstraints: function(resolve, reject) {
+ var value = 3600;
+ var stat = "Pending";
+ logTest("State: " + stat);
+ var metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+ var query = metadataSearch.createQuery("duration", 4, value);
+ metadataSearch.setQuery(query);
+
+ var offset = 0;
+ var count = 6;
+ metadataSearch.result.getResults(offset, count);
+ metadataSearch.addChannelConstraint(null);
+
+ if (this.assertEquals(metadataSearch.result.length, 0)) {
+ resolve();
+ } else {
+ reject();
+ }
+
+ },
+
+ testGetCurrentProgrammeFromNullStream: function (resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+
+ var stat = "Pending";
+ logTest("State: " + stat);
+ var searchTarget = 1;
+ var metaDataSearch = self.searchManagerObj.createSearch(searchTarget);
+ var currentChannel = null;
+ var startTime = null;
+ new Promise(function (resolve, reject) {
+ metaDataSearch.findProgrammesFromStream(currentChannel, startTime);
+ })
+ .catch(function(val) {
+ console.log(val);
+ resolve();
+ });
+ });
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testCreateSearchForScheduledContent: function(resolve, reject) {
+ this.metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+ if (this.assertNotNull(this.metadataSearch) &&
+ this.assertEquals(this.metadataSearch.searchTarget,
+ this.SCHEDULED_CONTENT)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testCreateSearchForContentOnDemand: function(resolve, reject) {
+ this.metadataSearch = this.searchManagerObj.
+ createSearch(this.CONTENT_ON_DEMAND);
+
+ if (this.assertNotNull(this.metadataSearch) &&
+ this.assertEquals(this.metadataSearch.searchTarget,
+ this.CONTENT_ON_DEMAND)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testCreateSearchWithNull: function(resolve, reject) {
+ this.metadataSearch = this.searchManagerObj.
+ createSearch(null);
+
+ if (!this.assertNotNull(this.metadataSearch)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testCreateSearchWithString: function(resolve, reject) {
+ this.metadataSearch = this.searchManagerObj.
+ createSearch("1");
+
+ if (!this.assertNotNull(this.metadataSearch)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testCreateSearchWithZero: function(resolve, reject) {
+ this.metadataSearch = this.searchManagerObj.
+ createSearch(0);
+
+ if (!this.assertNotNull(this.metadataSearch)) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testCreateQueryWithWellArguments: function(resolve, reject) {
+ var metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+ var query = metadataSearch.createQuery("name", 0, "X:ENIUS");
+
+ if (this.assertNotNull(query)) {
+ resolve();
+ } else {
+ reject();
+ }
+
+ },
+
+ testCreateQueryWithoutParameters: function(resolve, reject) {
+ var metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+ new Promise(function (resolve, reject) {
+ var query = metadataSearch.createQuery();
+ })
+ .catch(function(val) {
+ console.log(val);
+ resolve();
+ });
+
+ },
+
+ testCreateQueryWithFieldArgumentNull: function(resolve, reject) {
+ var metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+
+ new Promise(function (resolve, reject) {
+ var query = metadataSearch.createQuery(null, 0, "X:ENIUS");
+ })
+ .catch(function(val) {
+ console.log(val);
+ resolve();
+ });
+
+ },
+
+ testCreateQueryWithIntegerFieldArgument: function(resolve, reject) {
+ var metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+
+ new Promise(function (resolve, reject) {
+ var query = metadataSearch.createQuery(10, 0, "X:ENIUS");
+ })
+ .catch(function(val) {
+ console.log(val);
+ resolve();
+ });
+
+ },
+
+ testCreateQueryWithComparisonArgumentNull: function(resolve, reject) {
+ var metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+
+ new Promise(function (resolve, reject) {
+ metadataSearch.createQuery("name", null, "X:ENIUS");
+ })
+ .catch(function(val) {
+ console.log(val);
+ resolve();
+ });
+
+ },
+
+ testCreateQueryWithStringComparisonArgument: function(resolve, reject) {
+ var metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+
+ new Promise(function (resolve, reject) {
+ metadataSearch.createQuery("name", "null", "X:ENIUS");
+ })
+ .catch(function(val) {
+ console.log(val);
+ resolve();
+ });
+
+ },
+
+ testCreateQueryWithValueArgumentNull: function(resolve, reject) {
+ var metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+ new Promise(function (resolve, reject) {
+ metadataSearch.createQuery("name", 0, null);
+ })
+ .catch(function(val) {
+ console.log(val);
+ resolve();
+ });
+
+ },
+
+ testAnd: function(resolve, reject) {
+ var metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+ var queryA = metadataSearch.createQuery("name", 0, "X:ENIUS");
+ var queryB = metadataSearch.createQuery("name", 0, "X:ENIUS");
+
+ var newQuery = queryA.and(queryB);
+
+ if (this.assertNotNull(newQuery) &&
+ !this.assertEquals(newQuery, queryA)) {
+
+ resolve();
+ } else {
+ reject();
+ }
+
+ },
+
+ testOr: function(resolve, reject) {
+ var metadataSearch = this.searchManagerObj.
+ createSearch(this.SCHEDULED_CONTENT);
+
+ var queryA = metadataSearch.createQuery("name", 0, "X:ENIUS");
+ var queryB = metadataSearch.createQuery("name", 0, "X:ENIUS");
+
+ var newQuery = queryA.or(queryB);
+
+ if (this.assertNotNull(newQuery) &&
+ !this.assertEquals(newQuery, queryA)) {
+
+ resolve();
+ } else {
+ reject();
+ }
+
+ },
+
+ testProgrammePropertiesImplementationState: function() {
+ var self = this;
+ var value = "X:ENIUS";
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+
+ var stat = "Pending";
+ logTest("State: " + stat);
+ var metadataSearch = self.searchManagerObj.
+ createSearch(self.SCHEDULED_CONTENT);
+
+ var query = metadataSearch.createQuery("Programme.name", 0,
+ value);
+ metadataSearch.setQuery(query);
+
+ var offset = 0;
+ var count = 1;
+ metadataSearch.result.getResults(offset, count);
+// //Must return undefined else wrong implementation of getResults method
+// console.log(metaDataSearch.result[0]);
+ });
+
+ this.searchManagerObj.onMetadataSearch = function(search, state) {
+
+ console.log("[INFO]: onMetadataSearch called");
+
+ switch (state) {
+
+ case 0:
+ if (self.assertNotNull(search.result[0]) &&
+ self.assertEquals(search.result[0].name, value)) {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: found");
+ resolve();
+ } else {
+ console.log("[TEST-RUNNING][Info] Label: Obtain current program according to oipf norm, State: not found");
+ reject();
+ }
+ break;
+
+ case 3:
+ var message = "[INFO] MetadataSearch in Idle state because of either search abort or parameters have been modified (query, constraints or search target)";
+ console.log(message);
+ reject();
+ break;
+
+ case 4:
+ message = "[INFO] The search cannot be complete because of lack of ressources or any other reason.";
+ console.log(message);
+ reject();
+ break;
+
+ default:
+ console.log("Unknow state");
+ reject();
+
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+ }
+
+});
\ No newline at end of file
Added: oipf/test/js/Test.js
===================================================================
--- oipf/test/js/Test.js (rev 0)
+++ oipf/test/js/Test.js 2015-06-09 12:04:48 UTC (rev 1636)
@@ -0,0 +1,1149 @@
+/*
+ * 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.
+ */
+var Test = Class.extend({
+ testsObjects: [{
+ name : "OipfFactoryTest",
+ object: new OipfFactoryTest(),
+ tests: [
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfApplicationManager'.",
+ method: "testIsApplicationManagerObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfCapabilities'.",
+ method: "testIsCapabilitiesObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'channelConfig'.",
+ method: "testIsChannelConfigSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfCodManager'.",
+ method: "testIsCodManagerObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfConfiguration'.",
+ method: "testIsConfigurationObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfDownloadManager'.",
+ method: "testIsDownloadManagerObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfDownloadTrigger'.",
+ method: "testIsDownloadTriggerObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfDrmAgent'.",
+ method: "testIsDrmAgentObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfGatewayInfo'.",
+ method: "testIsGatewayInfoObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfCommunicationServices'.",
+ method: "testIsIMSObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfMDTF'.",
+ method: "testIsMDTFObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/notifsocket'.",
+ method: "testIsNotifSocketObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfParentalControlManager'.",
+ method: "testIsParentalControlManagerObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfRecordingScheduler'.",
+ method: "testIsRecordingSchedulerObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfRemoteControlFunction'.",
+ method: "testIsRemoteControlFunctionObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfRemoteManagement'.",
+ method: "testIsRemoteManagementObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfSearchManager'.",
+ method: "testIsSearchManagerObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'application/oipfStatusView'.",
+ method: "testIsStatusViewObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'video/broadcast'.",
+ method: "testIsVideoBroadcastObjectSupported"
+ },
+ {
+ label: "Call the method 'isObjectSupported' with mime-type 'video/mpeg'.",
+ method: "testIsVideoMpegObjectSupported"
+ },
+ {
+ label: "Call the method 'createApplicationManagerObject of oifp factory.",
+ method: "testCreateApplicationManagerObject"
+ },
+ {
+ label: "Call the method createCapabilitiesObject of oifp factory.",
+ method: "testCreateCapabilitiesObject"
+ },
+ {
+ label: "Call the method createChannelConfig of oifp factory.",
+ method: "testCreateChannelConfig"
+ },
+ {
+ label: "Call the method createCodManagerObject of oifp factory.",
+ method: "testCreateCodManagerObject"
+ },
+ {
+ label: "Call the method createConfigurationObject of oifp factory.",
+ method: "testCreateConfigurationObject"
+ },
+ {
+ label: "Call the method createDownloadManagerObject of oifp factory.",
+ method: "testCreateDownloadManagerObject"
+ },
+ {
+ label: "Call the method createDownloadTriggerObject of oifp factory.",
+ method: "testCreateDownloadTriggerObject"
+ },
+ {
+ label: "Call the method createDrmAgentObject of oifp factory.",
+ method: "testCreateDrmAgentObject"
+ },
+ {
+ label: "Call the method createGatewayInfoObject of oifp factory.",
+ method: "testCreateGatewayInfoObject"
+ },
+ {
+ label: "Call the method createImsObject of oifp factory.",
+ method: "testCreateIMSObject"
+ },
+ {
+ label: "Call the method createMdtfObject of oifp factory.",
+ method: "testCreateMDTFObject"
+ },
+ {
+ label: "Call the method createNotifSocketObject of oifp factory.",
+ method: "testCreateNotifSocketObject"
+ },
+ {
+ label: "Call the method createParentalControlManagerObject of oifp factory.",
+ method: "testCreateParentalControlManagerObject"
+ },
+ {
+ label: "Call the method createRecordingSchedulerObject of oifp factory.",
+ method: "testCreateRecordingSchedulerObject"
+ },
+ {
+ label: "Call the method createRemoteControlFunctionObject of oifp factory.",
+ method: "testCreateRemoteControlFunctionObject"
+ },
+ {
+ label: "Call the method createRemoteManagementObject of oifp factory.",
+ method: "testCreateRemoteManagementObject"
+ },
+ {
+ label: "Call the method createSearchManagerObject of oifp factory.",
+ method: "testCreateSearchManagerObject"
+ },
+ {
+ label: "Call the method createStatusViewObject of oifp factory.",
+ method: "testCreateStatusViewObject"
+ },
+ {
+ label: "Call the method createVideoBroadcastObject of oifp factory.",
+ method: "testCreateVideoBroadcastObject"
+ },
+ {
+ label: "Call the method createVideoMpegObject of oifp factory.",
+ method: "testCreateVideoMpegObject"
+ }
+ ]},{
+ name : "VideoBroadcastTest",
+ object: new VideoBroadcastTest(),
+ tests: [
+ {
+ label: "Call 'bindToCurrentChannel' when there isn't channel presentation.",
+ method: "testBindToCurrentChannelWhenNoChannelPresentation"
+ },
+ {
+ label: "Bind the current channel stream with a video broadcast object while this one is in connecting state.",
+ method: "testBindToCurrentChannelInConnecting"
+ },
+ {
+ label: "Bind the current channel stream with a video broadcast object while this one is in presenting state.",
+ method: "testBindToCurrentChannelInPresenting"
+ },
+ {
+ label: "Bind the current channel stream with a video broadcast object while this one is in stopped state.",
+ method: "testBindToCurrentChannelInStopped"
+ },
+ {
+ label: "Bind the current channel stream with a video broadcast object while this one is in stopped state.",
+ method: "testBindToCurrentChannelInStoppedWhenNoTuner"
+ },
+ {
+ label: "Call 'bindToCurrentChannel' twice.",
+ method: "testDoubleBindToCurrentChannel"
+ },
+ {
+ label: "Switch to precedent channel in unrealized state.",
+ method: "testPrevChannelInUnrealized"
+ },
+ {
+ label: "Switch to precedent channel in connecting state.",
+ method: "testPrevChannelInConnecting"
+ },
+ {
+ label: "Switch to precedent channel in presenting state.",
+ method: "testPrevChannelInPresenting"
+ },
+ {
+ label: "Switch to precedent channel in stopped state.",
+ method: "testPrevChannelInStopped"
+ },
+ {
+ label: "Switch to next channel in unrealized state.",
+ method: "testNextChannelInUnrealized"
+ },
+ {
+ label: "Switch to next channel in connecting state.",
+ method: "testNextChannelInConnecting"
+ },
+ {
+ label: "Switch to next channel in presenting state.",
+ method: "testNextChannelInPresenting"
+ },
+ {
+ label: "Switch to next channel in stopped state.",
+ method: "testNextChannelInStopped"
+ },
+ {
+ label: "Release any tuner and/or ressources held by a video broadcast object in connecting.",
+ method: "testReleaseInConnecting"
+ },
+ {
+ label: "Release any tuner and/or ressources held by a video broadcast object in presenting.",
+ method: "testReleaseInPresenting"
+ },
+ {
+ label: "Release any tuner and/or ressources held by a video broadcast object in stopped.",
+ method: "testReleaseInStopped"
+ },
+ {
+ label: "Stop the video and audio presentation of video broadcast object in connecting.",
+ method: "testStopInConnecting"
+ },
+ {
+ label: "Stop the video and audio presentation of video broadcast object in presenting.",
+ method: "testStopInPresenting"
+ },
+ {
+ label: "Set the volume of current VideoBroadcastObject to 15.",
+ method: "testSetVolume"
+ },
+ {
+ label: "Don't pass argument to method which set the volume of Video-Broadcast Object.",
+ method: "testSetVolumeWithoutArgument"
+ },
+ {
+ label: "Set the volume of current VideoBroadcastObject with a float value.",
+ method: "testSetVolumeWithFloatArgument"
+ },
+ {
+ label: "Set the volume of current VideoBroadcastObject with a float value superior of bound max.",
+ method: "testSetVolumeWithFloatUnderBoundMin"
+ },
+ {
+ label: "Set the volume of current VideoBroadcastObject with a float value inferior of bound min.",
+ method: "testSetVolumeWithFloatAboveBoundMax"
+ },
+ {
+ label: "Set the volume of current VideoBroadcastObject inferior to 0.",
+ method: "testSetVolumeWithValueUnderBoundMin"
+ },
+ {
+ label: "Set the volume of current VideoBroadcastObject superior to 100.",
+ method: "testSetVolumeWithValueAboveBoundMax"
+ },
+ {
+ label: "Get the volume of current VideoBroadcastObject.",
+ method: "testGetVolume"
+ },
+ {
+ label: "Set a channel in unrealized state.",
+ method: "testSetChannelInUnrealized"
+ },
+ {
+ label: "Set a channel in connecting state.",
+ method: "testSetChannelInConnecting"
+ },
+ {
+ label: "Call method 'setChannel' with null in connecting state.",
+ method: "testSetChannelInConnectingWithNull"
+ },
+ {
+ label: "Set a channel in presenting state.",
+ method: "testSetChannelInPresenting"
+ },
+ {
+ label: "Call method 'setChannel' with null in presenting state.",
+ method: "testSetChannelInPresentingWithNull"
+ },
+ {
+ label: "Set a channel in stopped state.",
+ method: "testSetChannelInStopped"
+ },
+ {
+ label: "Call method 'setChannel' with null in stopped state.",
+ method: "testSetChannelInStoppedWithNull"
+ }
+ ]},{
+ name: "SearchManagerTest",
+ object: new SearchManagerTest(),
+ tests: [
+ {
+ label: "Verify the right creation of search object.",
+ method: "testCreateSearchForScheduledContent"
+ },
+ {
+ label: "Verify the right creation of search object about content on demand.",
+ method: "testCreateSearchForContentOnDemand"
+ },
+ {
+ label: "Call method 'createSearch' with parameter equals to null.",
+ method: "testCreateSearchWithNull"
+ },
+ {
+ label: "Call method 'createSearch' with a String parameter.",
+ method: "testCreateSearchWithString"
+ },
+ {
+ label: "Call method 'createSearch' with parameter equals to 0.",
+ method: "testCreateSearchWithZero"
+ },
+ {
+ label: "Looking for a programme already broadcasted.",
+ method: "testFindAFinishedProgramme"
+ },
+ {
+ label: "Obtain current program according to oipf norm.",
+ method: "testGetCurrentProgrammeFromStream"
+ },
+ {
+ label: "Try to obtain current program with a null stream.",
+ method: "testGetCurrentProgrammeFromNullStream"
+ },
+ {
+ label: "Try to obtain a programme by its name.",
+ method: "testSearchingForASpecificProgrammeByName"
+ },
+ {
+ label: "Try to obtain all programme \n\
+ with duration lower than one hour.",
+ method: "testSearchingForProgrammesWithDurationLowerThanOneHour"
+ },
+ {
+ label: "Create a query with well parameters.",
+ method: "testCreateQueryWithWellArguments"
+ },
+ {
+ label: "Create a query with well parameters.",
+ method: "testCreateQueryWithoutParameters"
+ },
+ {
+ label: "Create a query with its first parameters null.",
+ method: "testCreateQueryWithFieldArgumentNull"
+ },
+ {
+ label: "Create a query with a Integer as first parameter.",
+ method: "testCreateQueryWithIntegerFieldArgument"
+ },
+ {
+ label: "Create a query with its second parameters.",
+ method: "testCreateQueryWithComparisonArgumentNull"
+ },
+ {
+ label: "Create a query with a String as second parameters.",
+ method: "testCreateQueryWithStringComparisonArgument"
+ },
+ {
+ label: "Create a query with its last parameters.",
+ method: "testCreateQueryWithValueArgumentNull"
+ },
+ {
+ label: "Modify query while search performing by calling 'setQuery'.",
+ method: "testSetQueryWhileSearchWithoutConstraints"
+ },
+ {
+ label: "Call 'findProgrammesFromStream' while search performing.",
+ method: "testFindProgrammesFromStreamWhileSearchWithoutConstraints"
+ },
+ {
+ label: "Call 'addChannelConstraint' while search performing.",
+ method: "testAddChannelConstraintWhileSearchWithoutConstraints"
+ },
+ {
+ label: "Call 'removeChannelConstraint' while search performing.",
+ method: "testRemoveChannelConstraintWhileSearchWithoutConstraints"
+ },
+ {
+ label: "Abort a search.",
+ method: "testAbortWhileProgrammesSearchWithoutConstraints"
+ },
+ {
+ label: "Call method 'or' of a 'Query' object.",
+ method: "testAnd"
+ },
+ {
+ label: "Call method 'and' of a 'Query' object.",
+ method: "testOr"
+ }
+ ]},{
+ name: "ConfigurationTest",
+ object: new ConfigurationTest(),
+ tests: [
+ {
+ label: "Call method 'setScreenSize' with right parameters(Type and value).",
+ method: "testSetScreenSize"
+ },
+ {
+ label: "Call method 'setScreenSize' without parameters.",
+ method: "testSetScreenSizeWithoutParameters"
+ },
+ {
+ label: "Call method 'setScreenSize' with 'String' parameters.",
+ method: "testSetScreenSizeWithUnexpectedTypeParameters"
+ },
+ {
+ label: "Call method 'setScreenSize' with an excessive number of parameters.",
+ method: "testSetScreenSizeWithExcessiveParametersNumber"
+ },
+ {
+ label: "Call method 'setTvStandard' with right parameters(Type and value).",
+ method: "testSetTvStandard"
+ },
+ {
+ label: "Call method 'setTvStandard' without parameters.",
+ method: "testSetTvStandardWihtoutParameters"
+ },
+ {
+ label: "Call method 'setTvStandard' with wrong parameters(Type).",
+ method: "testSetTvStandardWithUnexpectedTypeParameters"
+ },
+ {
+ label: "Call method 'setTvStandard' with an excessive number of parameters.",
+ method: "testSetTvStandardWithExcessiveParametersNumber"
+ },
+ {
+ label: "Call method 'setPvrSupport' with right parameters(Type and value).",
+ method: "testSetPvrSupport"
+ },
+ {
+ label: "Call method 'setPvrSupport' without parameters.",
+ method: "testSetPvrSupportWithoutParameters"
+ },
+ {
+ label: "Call method 'setPvrSupport' with wrong parameters(Type).",
+ method: "testSetPvrSupportWithUnexpectedTypeParameters"
+ },
+ {
+ label: "Call method 'setPvrSupport' with an excessive number of parameters.",
+ method: "testSetPvrSupportWithExcessiveParametersNumber"
+ },
+ {
+ label: "Call method 'setPowerState' with right parameters(Type and value).",
+ method: "testSetPowerState"
+ },
+ {
+ label: "Call method 'setPowerState' without parameters.",
+ method: "testSetPowerStateWithoutParameters"
+ },
+ {
+ label: "Call method 'setPowerState' with wrong parameters(Type).",
+ method: "testSetPowerStateWithUnexpectedTypeParameters"
+ },
+ {
+ label: "Call method 'setPowerState' with an excessive number of parameters.",
+ method: "testSetPowerStateWithExcessiveParametersNumber"
+ },
+ {
+ label: "Call method 'setDigestCredentials' with right parameters(Type and value).",
+ method: "testSetDigestCredentials"
+ },
+ {
+ label: "Call method 'setDigestCredentials' without parameters.",
+ method: "testSetDigestCredentialsWithoutParameters"
+ },
+ {
+ label: "Call method 'setDigestCredentials' with wrong parameters(Type).",
+ method: "testSetDigestCredentialsWithUnexpectedTypeParameters"
+ },
+ {
+ label: "Call method 'setDigestCredentials' with an excessive number of parameters.",
+ method: "testSetDigestCredentialsWithExcessiveParametersNumber"
+ },
+ {
+ label: "Call method 'clearDigestCredentials' with right parameters(Type and value).",
+ method: "testClearDigestCredentials"
+ },
+ {
+ label: "Call method 'clearDigestCredentials' without parameters.",
+ method: "testClearDigestCredentialsWithoutParameters"
+ },
+ {
+ label: "Call method 'clearDigestCredentials' with wrong parameters(Type).",
+ method: "testClearDigestCredentialsWithUnexpectedTypeParameters"
+ },
+ {
+ label: "Call method 'clearDigestCredentials' with an excessive number of parameters.",
+ method: "testClearDigestCredentialsWithExcessiveParametersNumber"
+ },
+ {
+ label: "Call method 'hasDigestCredentials' with right parameters(Type and value).",
+ method: "testHasDigestCredentials"
+ },
+ {
+ label: "Call method 'hasDigestCredentials' without parameters.",
+ method: "testHasDigestCredentialsWithoutParameters"
+ },
+ {
+ label: "Call method 'hasDigestCredentials' with wrong parameters(Type).",
+ method: "testHasDigestCredentialsWithUnexpectedTypeParameters"
+ },
+ {
+ label: "Call method 'hasDigestCredentials' with an excessive number of parameters.",
+ method: "testHasDigestCredentialsWithExcessiveParametersNumber"
+ }
+ ]},{
+ name: "RecordingSchedulerTest",
+ object: new RecordingSchedulerTest(),
+ tests: [
+ {
+ label: "Call method 'setRecord' in order to record current programme.",
+ method: "testRecordCurrentProgramme"
+ },
+ {
+ label: "Try to call method 'setRecord' with a finished programme.",
+ method: "testRecordAFinishedProgramme"
+ },
+ {
+ label: "Call method 'setRecordAt' in order to record current programme.",
+ method: "testRecordAtCurrentProgramme"
+ },
+ {
+ label: "Call method 'stop' after a scheduling recording.",
+ method: "testStopAScheduledRecording"
+ },
+ {
+ label: "Call method 'stop' while a recording.",
+ method: "testStopAnOngoingRecording"
+ },
+ {
+ label: "Call method 'stop' at the end of a recording.",
+ method: "testStopACompletedRecording"
+ },
+ {
+ label: "Call method 'remove' after a scheduling recording.",
+ method: "testRemoveAScheduledRecording"
+ },
+ {
+ label: "Call method 'remove' while a recording.",
+ method: "testRemoveAnOngoingRecording"
+ },
+ {
+ label: "Call method 'remove' at the end of a recording.",
+ method: "testRemoveACompletedRecording"
+ },
+ {
+ label: "Call method 'update' to update start time of a scheduled recording",
+ method: "testUpdateAScheduledRecordingOnStartTime"
+ },
+ {
+ label: "Call method 'update' to update duration of a scheduled recording.",
+ method: "testUpdateAScheduledRecordingOnDuration"
+ },
+ {
+ label: "Call method 'update' to update duration of an in-progress recording.",
+ method: "testUpdateAnOngoingRecordingWithAValidDuration"
+ },
+ {
+ label: "Call method 'update' to update duration of an in-progress recording with a short duration.",
+ method: "testUpdateAnOngoingRecordingWithATooShortDuration"
+ },
+ {
+ label: "Call method 'update' to update start time of an in-progress recording.",
+ method: "testUpdateAnOngoingRecordingOnStartTime"
+ },
+ {
+ label: "Call method 'update' to update repetition frequency of an in-progress recording.",
+ method: "testUpdateAnOngoingRecordingOnRepeatDays"
+ }
+ ]},{
+ name: "CapabilitiesTest",
+ object: new CapabilitiesTest(),
+ tests: [
+ {
+ label: "Call method 'hasCapability' with an invalid profile name.",
+ method: "testHasCapabilityWithAnInvalidProfileName"
+ },
+ {
+ label: "Call method 'hasCapability' to verify that the TV support at least one of pre-defined base UI profiles.",
+ method: "testHasCapabilityForAtLeastOneBaseProfileName"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support all pre-defined UI fragments profiles.",
+ method: "testHasCapabilityForAllUIFragmentProfile"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'TRICKMODE'.",
+ method: "testHasCapabilityTRICKMODE"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'AVCAD'.",
+ method: "testHasCapabilityAVCAD"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'DL'.",
+ method: "testHasCapabilityDL"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'IPTV_SDS'.",
+ method: "testHasCapabilityIPTV_SDS"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'IPTV_URI'.",
+ method: "testHasCapabilityIPTV_URI"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'ANA'.",
+ method: "testHasCapabilityANA"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'DVB_C'.",
+ method: "testHasCapabilityDVB_C"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'DVB_T'.",
+ method: "testHasCapabilityDVB_T"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'DVB_S'.",
+ method: "testHasCapabilityDVB_S"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'DVB_C2'.",
+ method: "testHasCapabilityDVB_C2"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'DVB_T2'.",
+ method: "testHasCapabilityDVB_T2"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'DVB_S2'.",
+ method: "testHasCapabilityDVB_S2"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'ISDB_C'.",
+ method: "testHasCapabilityISDB_C"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'ISDB_T'.",
+ method: "testHasCapabilityISDB_T"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'ISDB_S'.",
+ method: "testHasCapabilityISDB_S"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'META_BCG'.",
+ method: "testHasCapabilityMETA_BCG"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'META_EIT'.",
+ method: "testHasCapabilityMETA_EIT"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'META_SI'.",
+ method: "testHasCapabilityMETA_SI"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'ITV_KEYS'.",
+ method: "testHasCapabilityITV_KEYS"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature 'CONTROLLED'.",
+ method: "testHasCapabilityCONTROLLED"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature recording(UI profile name fragment: 'PVR').",
+ method: "testHasCapabilityPVR"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature recording(UI profile name fragment: 'DRM').",
+ method: "testHasCapabilityDRM"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature recording(UI profile name fragment: 'CommunicationServices').",
+ method: "testHasCapabilityCommunicationServices"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature recording(UI profile name fragment: 'SVG').",
+ method: "testHasCapabilitySVG"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature recording(UI profile name fragment: 'POINTER').",
+ method: "testHasCapabilityPOINTER"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature recording(UI profile name fragment: 'POLLNOTIF').",
+ method: "testHasCapabilityPOLLNOTIF"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature recording(UI profile name fragment: 'HTML5_MEDIA').",
+ method: "testHasCapabilityHtml5Media"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature recording(UI profile name fragment: 'WIDGETS').",
+ method: "testHasCapabilityWIDGETS"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature recording(UI profile name fragment: 'RCF').",
+ method: "testHasCapabilityRCF"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature recording(UI profile name fragment: 'TELEPHONY').",
+ method: "testHasCapabilityTELEPHONY"
+ },
+ {
+ label: "Call method 'hasCapability' to verify if the TV support the feature recording(UI profile name fragment: 'VIDEOTELEPHONY').",
+ method: "testHasCapabilityVIDEOTELEPHONY"
+ }
+ ]},{
+ name: "ParentalControlManagerTest",
+ object: new ParentalControlManagerTest(),
+ tests: [
+ {
+ label: "Call method 'setParentalControlPIN' with valids parameters.",
+ method: "testSetParentalControlPINWithValidOldPINAndNewPIN"
+ },
+ {
+ label: "Call method 'setParentalControlPIN' with a invalid pin but a valid new pin.",
+ method: "testSetParentalControlPINWithInvalidOldPINAndValidNewPIN"
+ },
+ {
+ label: "Call method 'setParentalControlPIN' with a invalid pin but a valid new pin.",
+ method: "testSetParentalControlPINWithInvalidOldPINAndValidNewPIN10Times"
+ },
+ {
+ label: "Call method 'verifyParentalControlPIN' with an invalid pin 10 times.",
+ method: "testVerifyParentalControlPINWithInvalidPIN10Times"
+ },
+ {
+ label: "Call method 'verifyParentalControlPIN' with a valid pin.",
+ method: "testVerifyParentalControlPINWithValidPIN"
+ },
+ {
+ label: "Call method 'verifyParentalControlPIN' with an invalid pin.",
+ method: "testVerifyParentalControlPINWithInvalidPIN"
+ },
+ {
+ label: "Call method 'setBlockUnrated' with an invalid pin.",
+ method: "testSetBlockUnratedWithInvalidPIN10Times"
+ },
+ {
+ label: "Call method 'getBlockUnrated' when contents have not been blocked.",
+ method: "testGetBlockUnratedWhenUnratedContentsAreNotBlocked"
+ },
+ {
+ label: "Call method 'getBlockUnrated' when contents have been blocked.",
+ method: "testGetBlockUnratedWhenUnratedContentsAreBlocked"
+ },
+ {
+ label: "Call method 'setBlockUnrated' with a valid pin and value 'true' to blocked unrated contents.",
+ method: "testSetBlockUnratedWithValidPINAndTrue"
+ },
+ {
+ label: "Call method 'setBlockUnrated' with a valid pin and value 'false' to don't blocked unrated contents.",
+ method: "testSetBlockUnratedWithValidPINAndFalse"
+ },
+ {
+ label: "Call method 'setBlockUnrated' with an invalid pin and value 'true' to blocked unrated contents.",
+ method: "testSetBlockUnratedWithInvalidPINAndTrue"
+ },
+ {
+ label: "Call method 'setBlockUnrated' with an invalid pin and value 'false' to don't blocked unrated contents.",
+ method: "testSetBlockUnratedWithInvalidPINAndFalse"
+ },
+ {
+ label: "Call method 'setParentalControlStatus' with a valid pin\
+ and value 'true' to active parental control.",
+ method: "testSetParentalControlStatusWithValidPINAndTrue"
+ },
+ {
+ label: "Call method 'setParentalControlStatus' with a valid pin\
+ and value 'false' to desactive parental control.",
+ method: "testSetParentalControlStatusWithValidPINAndFalse"
+ },
+ {
+ label: "Call method 'setParentalControlStatus' with an invalid\
+ pin and value 'true' to active parental control.",
+ method: "testSetParentalControlStatusWithInvalidPINAndTrue"
+ },
+ {
+ label: "Call method 'setParentalControlStatus' with an invalid\
+ pin and value 'false' to desactive parental control.",
+ method: "testSetParentalControlStatusWithInvalidPINAndFalse"
+ },
+ {
+ label: "Call method 'setParentalControlStatus' with an invalid\
+ pin and value 'false' to verify the PIN entry locking",
+ method: "testSetParentalControlStatusWithInvalidOldPINAndValidNewPIN10Times"
+ },
+ {
+ label: "Call method 'getParentalControlStatus' when parental\
+ control status is activated.",
+ method: "testGetParentalControlStatusWhenParentalControlStatusActivated"
+ },
+ {
+ label: "Call method 'getParentalControlStatus' when parental\
+ control status is deactivated.",
+ method: "testGetParentalControlStatusWhenParentalControlStatusDeactivated"
+ }
+ ]},{
+ name: "ApplicationManagerTest",
+ object: new ApplicationManagerTest(),
+ tests: [
+ {
+ label: "Call method 'getOwnerApplication' with 'object document' of global property 'window'.",
+ method: "testGetOwnerApplicationOfDocumentOfGlobalPropertyWindow"
+ },
+ {
+ label: "Call method 'getOwnerApplication' with a parameter null.",
+ method: "testGetOwnerApplicationWithNull"
+ }
+ ]
+ }],
+
+ init: function() {
+ this.animation = {
+ i: 1,
+ start: true,
+ intervalID: 0
+ };
+
+ this.sectionsID = [];
+ },
+
+ runAll: function() {
+ this.results = [];
+ this.currentResult = {
+ succeeded: 0,
+ failed: 0
+ };
+ this.runLoop(0, 0).then(this.totalPercentage.bind(this));
+ },
+
+ runLoop: function(indexObject, indexTest) {
+ var element = this.testsObjects[indexObject];
+ var object = element.object;
+ var tests = element.tests;
+
+ var self = this;
+ var loop = function() {
+ if (indexTest < tests.length - 1) {
+ return self.runLoop(indexObject, indexTest + 1);
+
+ } else if (indexObject < self.testsObjects.length - 1) {
+ element.results = {
+ testName: "",
+ failed: 0,
+ succeeded: 0
+ };
+ element.results.testName = element.name;
+ element.results.failed = self.currentResult.failed;
+ element.results.succeeded = self.currentResult.succeeded;
+ self.currentResult.failed = 0;
+ self.currentResult.succeeded = 0;
+ return self.runLoop(indexObject + 1, 0);
+
+ }
+ if (indexObject == self.testsObjects.length - 1) {
+ element.results = {
+ testName: "",
+ failed: 0,
+ succeeded: 0
+ };
+ element.results.testName = element.name;
+ element.results.failed = self.currentResult.failed;
+ element.results.succeeded = self.currentResult.succeeded;
+ }
+ };
+
+ return this.updateTestResult(tests[indexTest], object)
+ .then(loop).catch(loop);
+
+ },
+
+ percentageCalculating: function(currentResult) {
+ this.round = Math.round.bind(Math);
+ var testNumber = currentResult.failed + currentResult.succeeded;
+ currentResult.failed = this.round((currentResult.failed/testNumber)*100);
+ currentResult.succeeded = this.round((currentResult.succeeded/testNumber)*100);
+ },
+
+ totalPercentage: function() {
+ this.resultsPercentageFailed = 0;
+ this.resultsPercentageSucceeded = 0;
+
+ for (var i = 0, l = this.testsObjects.length; i < l; i++) {
+
+ this.percentageCalculating(this.testsObjects[i].results);
+ this.resultsPercentageFailed += this.testsObjects[i].results.failed;
+ this.resultsPercentageSucceeded += this.testsObjects[i].results.succeeded;
+ this.results.push(this.testsObjects[i].results);
+ }
+ this.resultsPercentageFailed = this.resultsPercentageFailed/this.testsObjects.length;
+ this.resultsPercentageSucceeded = this.resultsPercentageSucceeded/this.testsObjects.length;
+ this.displayGlobalTestResults();
+ },
+
+ displayGlobalTestResults: function() {
+ var id = "globalTestResultsTable";
+ var tableResult = document.getElementById(id);
+ var content;
+ content += "<table>";
+ content += "<tbody>";
+ content += "<thead>";
+ content += "<tr>";
+ content += "<th></th>";
+ content += "<th>Succeeded (%)</th>";
+ content += "<th>Failed (%)</th>";
+ content += "</tr>";
+ content += "</thead>";
+ for (var i = 0, l = this.results.length; i < l; i++) {
+ content += "<tr>";
+ content += "<th>" + this.results[i].testName + "</th>";
+ content += "<td>" + this.results[i].succeeded + "</td>";
+ content += "<td>" + this.results[i].failed + "</td>";
+ content += "</tr>";
+ }
+ content += "<tr>";
+ content += "<th>Total</th>";
+ content += "<td>" + this.resultsPercentageSucceeded + "</td>";
+ content += "<td>" + this.resultsPercentageFailed + "</td>";
+ content += "</tr>";
+ content += "</tbody>";
+ content += "</table>";
+
+ tableResult.innerHTML = content;
+
+ var style = document.getElementById("globalTestResultsDiv").style;
+ style.display = (!style.display || style.display == "none") ? "block" : "none";
+ },
+
+ runSectionTest : function(indexObject, indexTest) {
+ var element = this.testsObjects[indexObject];
+ var object = element.object;
+ var tests = element.tests;
+
+ var self = this;
+ var loop = function() {
+ if (indexTest < tests.length - 1) {
+ self.runSectionTest(indexObject, indexTest + 1);
+ }
+ };
+
+ this.updateTestResult(tests[indexTest], object)
+ .then(loop).catch(loop);
+ },
+
+ run: function(indexObject, indexTest) {
+ var element = this.testsObjects[indexObject];
+ var object = element.object;
+ var tests = element.tests;
+
+ return this.updateTestResult(tests[indexTest], object);
+ },
+
+ displayInLineArray: function() {
+ var content = "<div id='testsDisplay'>";
+ content += "<div id='title'><h1> Test Page</h1></div>";
+ content += "<div id='testControllerDiv'>";
+ content += "<div id='titleTestControllerDiv'><h4>Test Controller<h4></div>";
+ content += "<button id='runAllBtn'>Run All</button>";
+ content += "<button id='displayConfigBtn'>Hide/Show</button>";
+ content += "<div id='globalTestResultsDiv'>";
+ content += "<div id='titleGlobalTestResultsDiv'><h4>Global Test Results<h4></div>";
+ content += "<table id='globalTestResultsTable'></table>";
+ content += "</div>";
+ content += "</div>";
+
+ var testsObjects = this.testsObjects;
+ content += "<div id=AllTestDiv>";
+
+ for (var i = 0; i < testsObjects.length; i++) {
+ var currentObject = testsObjects[i];
+ content += "<div id='" + currentObject.name + "Title'>"
+ + "Section " + currentObject.name
+ + "<button id='" + currentObject.name + "HideShowBtn'>Hide/Show</button>"
+ + "<button id='runAll" + currentObject.name + "Btn'>Run tests of this section</button>";
+ content += "</div>";
+ var idOfTestSection = currentObject.name + "Section";
+ this.sectionsID.push(idOfTestSection);
+
+ content += "<div id=" + idOfTestSection + ">";
+ content += "<table id='" + currentObject.name + "Table'>";
+ content += "<tbody>";
+ content += "<thead>";
+ content += "<tr>";
+ content += "<th>Lauching</th>";
+ content += "<th>Tested Method</th>";
+ content += "<th>Label</th>";
+ content += "<th>Test duration</th>";
+ content += "<th>Result</th>";
+ content += "</tr>";
+ content += "</thead>";
+
+ var currentObject = testsObjects[i];
+ var tests = currentObject["tests"];
+ for (var j = 0; j < tests.length; j++) {
+
+ var currentTest = tests[j];
+ content += "<tr id='" + currentTest["method"] + "'>";
+ content += "<td><button id='" + currentTest["method"] + "Btn" + "'>Run</button></td>";
+ content += "<td>" + currentTest["method"] + "</td>";
+ content += "<td>" + currentTest["label"] + "</td>";
+ content += "<td id='" + currentTest["method"] + "Duration'>None</td>";
+ content += "<td id='" + currentTest["method"] + "Result'>None</td>";
+ content += "</tr>";
+ }
+ content += "</tbody>";
+ content += "</table>";
+ content += "</div>";
+ }
+ content += "</div>";
+ content += "</div>";
+ document.body.innerHTML += content;
+ },
+
+ updateTestResult: function(currentTest, object) {
+ console.group(currentTest["label"]);
+ var timeStart = new Date();
+ var self = this;
+ var result = false;
+ var promiseTest = new Promise(function(resolve, reject) {
+ try {
+ timeout(object.timer || 5000)
+ .then(reject.bind(null, "No result returned."))
+ .then(function() {
+ !result
+ && self.stopAnimationInProgress(currentTest)
+ && object.afterTest
+ && object.afterTest.bind(object);
+ self.currentResult && self.currentResult.failed++;
+ });
+ object.beforeTest && object.beforeTest(resolve, reject);
+ object[currentTest["method"]] && object[currentTest["method"]](resolve, reject);
+ self.startAnimationInProgress(currentTest);
+ } catch (error) {
+ reject(error);
+ }
+ })
+ .then(function(val) {
+ self.stopAnimationInProgress(currentTest);
+ result = true;
+ console.groupEnd(currentTest["label"]);
+ var timeEnd = new Date();
+ self.currentResult && self.currentResult.succeeded++;
+ self.updateTestResultSuccess(timeStart, timeEnd, currentTest, val);
+ object.afterTest && object.afterTest();
+ })
+ .catch(function(val) {
+ self.stopAnimationInProgress(currentTest);
+ self.currentResult && self.currentResult.failed++;
+ result = true;
+ console.log(val);
+ console.groupEnd(currentTest["label"]);
+ var timeEnd = new Date();
+ self.updateTestResultError(timeStart, timeEnd, currentTest, val);
+ object.afterTest && object.afterTest();
+ });
+
+ return promiseTest;
+ },
+
+ updateTestResultSuccess: function(timeStart, timeEnd, currentTest, message) {
+ document.getElementById(currentTest["method"] + "Result").textContent = message || "Success";
+ document.getElementById(currentTest["method"] + "Result").style.backgroundColor = "limegreen";
+ document.getElementById(currentTest["method"] + "Duration").textContent = (timeEnd - timeStart).toFixed(2) + " ms";
+ },
+
+ updateTestResultError: function(timeStart, timeEnd, currentTest, message) {
+ document.getElementById(currentTest["method"] + "Result").textContent = message || "Error";
+ document.getElementById(currentTest["method"] + "Result").style.backgroundColor = this.colorManaging(message);
+ document.getElementById(currentTest["method"] + "Duration").textContent = (timeEnd - timeStart).toFixed(2) + " ms";
+ },
+
+ startAnimationInProgress: function(currentTest) {
+ var self = this;
+
+ self.animation.intervalID = setInterval(function() {
+ var currentTestResult = document
+ .getElementById(currentTest["method"] + "Result");
+
+ if((self.animation.i%6) == 0) {
+ currentTestResult.textContent = "*";
+ self.animation.i = 1;
+ } else {
+ if (self.animation.start) {
+ currentTestResult.textContent = "*";
+ self.animation.start = false;
+ } else {
+ currentTestResult.textContent += "*";
+ }
+ console.log("Test in progress");
+ self.animation.i++;
+ }
+
+ }, 500);
+ },
+
+ stopAnimationInProgress: function(object, currentTest) {
+
+ clearInterval(this.animation.intervalID);
+ this.animation.id = 1;
+ this.animation.start = true;
+ this.animation.intervalID = null;
+
+ },
+
+ colorManaging: function(errorMessage) {
+ var map = {
+ "No result returned.": "orange",
+ "Untestable case for the moment.": "sandybrown",
+ "Invalid state.": "orangered"
+ };
+
+ if (!errorMessage) {
+ return "red";
+ } else if (typeof errorMessage == "string") {
+ return map[errorMessage];
+ } else if (errorMessage instanceof Error) {
+ return "tomato";
+ }
+ }
+
+});
+
+
Added: oipf/test/js/TestCase.js
===================================================================
--- oipf/test/js/TestCase.js (rev 0)
+++ oipf/test/js/TestCase.js 2015-06-09 12:04:48 UTC (rev 1636)
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+var TestCase = Class.extend({
+
+ init: function() {
+ this.modelFactory = new ModelFactory();
+ this.UNREALIZED = videoBroadcastConstants.state.UNREALIZED;
+ this.CONNECTING = videoBroadcastConstants.state.CONNECTING;
+ this.PRESENTING = videoBroadcastConstants.state.PRESENTING;
+ this.SCHEDULED = recordingConstants.state.SCHEDULED;
+ this.STARTED = recordingConstants.state.STARTED;
+ this.COMPLETED = recordingConstants.state.COMPLETED;
+ this.BEFORE_STARTED = recordingConstants.state.BEFORE_STARTED;
+ this.REMOVED = recordingConstants.state.REMOVED;
+ this.UPDATED = recordingConstants.state.UPDATED;
+ this.SCHEDULED_CONTENT = 1;
+ this.CONTENT_ON_DEMAND = 2;
+ this.dateUtils = new DateUtils();
+ this.timerManager = new TimerManager();
+ this.timeout = this.timerManager.createTimer.bind(this.timerManager);
+// this.transitions = null;
+ },
+
+ assertNotUndefined : function(elmt) {
+ return elmt;
+ },
+
+ assertEquals: function(elmt1, elmt2) {
+ return elmt1 == elmt2;
+ },
+
+ assertNotNull: function(elmt) {
+ return elmt;
+ },
+
+ waitForError: function(callback, resolve) {
+ new Promise(function(resolve, reject) {
+ callback();
+ })
+ .catch(function(val) {
+ console.log(val);
+ resolve();
+ });
+ },
+
+ addTransition: function(begin, end, callback) {
+ this.addTransitionWithError(begin, end, null, callback);
+ },
+
+ addTransitionWithError: function(begin, end, error, callback) {
+ this.transitions.push({
+ begin: begin,
+ end: end,
+ error: error,
+ callback: callback
+ });
+ },
+
+ /*
+ *
+ * @param {type} resolve
+ * @param {type} reject
+ * @param {type} newState
+ * @param {type} errorCode
+ * @returns {undefined}
+ * FIXME: 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.");
+ }
+ }
+ }
+
+});
+
Added: oipf/test/js/VideoBroadcastTest.js
===================================================================
--- oipf/test/js/VideoBroadcastTest.js (rev 0)
+++ oipf/test/js/VideoBroadcastTest.js 2015-06-09 12:04:48 UTC (rev 1636)
@@ -0,0 +1,824 @@
+/*
+ * Description:
+ * This class gather a set of method necessary to test a video broadcast object.
+ *
+ */
+var VideoBroadcastTest = TestCase.extend({
+ channel: null,
+
+ UNREALIZED: 0,
+
+ CONNECTING: 1,
+
+ PRESENTING: 2,
+
+ STOPPED: 3,
+
+ vidBroadObj: null,
+
+ errorMap: {
+
+ 0: "Channel not supported by tuner.",
+ 1: "Cannot tune to given transport stream (e.g. no signal).",
+ 2: "Tuner locked by other object.",
+ 3: "Parental lock on channel.",
+ 4: "Encrypted channel, key/module missing.",
+ 5: "Unknown channel (e.g. can’t resolve DVB or ISDB triplet).",
+ 6: "Channel switch interrupted (e.g. because another channel switch was activated before the previous one completed).",
+ 7: "Channel cannot be changed, because it is currently being recorded.",
+ 8: "Cannot resolve URI of referenced IP channel.",
+ 9: "Insufficient bandwidth.",
+ 10: "Channel cannot be changed by nextChannel()/prevChannel() methods either because the OITF does not maintain a favourites or channel list or because the video/broadcast object is in the Unrealized state.",
+ 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."
+
+ },
+
+ init: function() {
+ this.super.init();
+ },
+
+ beforeTest: function(resolve, reject) {
+ this.vidBroadObj = oipfObjectFactory.createVideoBroadcastObject();
+ this.onPlayStateChange = this.onChangeState.bind(this, resolve, reject);
+ this.vidBroadObj.addEventListener("PlayStateChange", this.onPlayStateChange, false);
+ this.transitions = [];
+ this.previousState = this.vidBroadObj.playState;
+ this.currentIndex = 0;
+ this.channel = null;
+ logTest("State: Pending");
+ },
+
+ afterTest: function() {
+// this.vidBroadObj.release(); //Useful for test on tv plateform
+ this.vidBroadObj.removeEventListener("PlayStateChange", this.onPlayStateChange);
+ this.timerManager.clearTimer();
+ },
+
+ getChannel: function(channelCollection){
+ if (channelCollection.length != 0) {
+ return channelCollection[0];
+ }
+ return null;
+ },
+
+// /*
+// *
+// * @param {type} resolve
+// * @param {type} reject
+// * @param {type} newState
+// * @param {type} errorCode
+// * @returns {undefined}
+// * FIXME: 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");
+// }
+// }
+// },
+
+ /*
+ * This method must throw a error by using the method reject.
+ *
+ * @param {type} resolve
+ * @param {type} reject
+ * @returns {undefined}
+ */
+ testBindToCurrentChannelWhenNoChannelPresentation: function(resolve, reject) {
+ //Subject to modification not rigth way failed on the tv plateform.
+ this.vidBroadObj._channelService.currentChannel = null;
+
+ this.addTransitionWithError(this.UNREALIZED, this.UNREALIZED, 100, resolve);
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ /*
+ * Descrtiption:
+ * This method test the binding between the video broadcast object and the current program stream.
+ * ToDO: Extraction of method onPlayStateChange out.
+ */
+// testBindToCurrentChannel: function(resolve, reject) {
+// var self = this;
+//
+// this.addTransition(this.previousState, this.PRESENTING);
+//
+// this.vidBroadObj.bindToCurrentChannel();
+// },
+
+ testDoubleBindToCurrentChannel: function(resolve, reject) {
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, resolve);
+
+ this.vidBroadObj.bindToCurrentChannel();
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testBindToCurrentChannelInConnecting: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING, function() {
+ self.vidBroadObj.bindToCurrentChannel();
+ });
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, resolve);
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testBindToCurrentChannelInPresenting: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.bindToCurrentChannel();
+ resolve();
+ });
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testBindToCurrentChannelInStopped: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.stop();
+ });
+
+ this.addTransition(this.PRESENTING, this.STOPPED, function() {
+ self.vidBroadObj.bindToCurrentChannel();
+ });
+
+ this.addTransition(this.STOPPED, this.CONNECTING);
+ this.addTransition(this.CONNECTING, this.PRESENTING, resolve);
+
+ this.vidBroadObj.bindToCurrentChannel();
+
+ },
+
+ /*
+ * This method must throw a error by using the method reject.
+ * @param {type} resolve
+ * @param {type} reject
+ * @returns {undefined}
+ */
+ testBindToCurrentChannelInStoppedWhenNoTuner: function(resolve, reject) {
+ var self = this;
+
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.stop();
+ });
+
+ this.addTransition(this.PRESENTING, this.STOPPED, function() {
+ //We want test the case where the current channel has a idType whose
+ //any tuner supporting this kind of channel exist.
+ //So we create channel of idType "ATSCT".
+ self.vidBroadObj._channelService.currentChannel = new Channel(ID_ATSC_T, null, null);
+ self.vidBroadObj.bindToCurrentChannel();
+ });
+
+ this.addTransitionWithError(this.STOPPED, this.STOPPED, 0, resolve);
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testPrevChannelInUnrealized: function(resolve, reject) {
+ this.addTransition(null, null, reject);
+ this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+ reject();
+ };
+ this.vidBroadObj.prevChannel();
+ this.timeout(3000).then(resolve);
+
+ },
+
+ testPrevChannelInConnecting: function(resolve, reject) {
+ var self = this;
+ this.addTransition(this.UNREALIZED, this.CONNECTING, function() {
+ self.vidBroadObj.prevChannel();
+ });
+
+ this.addTransition(this.CONNECTING, this.CONNECTING);
+
+ this.addTransition(this.PRESENTING, this.CONNECTING);
+
+ this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+
+ if (self.assertNotNull(channel) && self.assertEquals(this.vidBroadObj, this.PRESENTING)) {
+ logTest("State: Successful");
+ resolve();
+ } else {
+ logTest("State: Failure");
+ reject("Failure : The channel is null for a unknown reason or wrong play state.");
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+
+ },
+
+ testPrevChannelInPresenting: function(resolve, reject) {
+ var self = this;
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.prevChannel();
+ });
+
+ this.addTransition(this.PRESENTING, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING);
+
+ this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+
+ if (self.assertNotNull(channel) && self.assertEquals(this.vidBroadObj, this.PRESENTING)) {
+ logTest("State: Successful");
+ resolve("Successfull");
+ } else {
+ logTest("State: Failure");
+ reject("Failure : The channel is null for a unknown reason or wrong play state.");
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+
+ },
+
+ testPrevChannelInStopped: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.stop();
+ });
+
+ this.addTransition(this.PRESENTING, this.STOPPED, function() {
+ self.vidBroadObj.prevChannel();
+ });
+
+ this.addTransition(this.STOPPED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING);
+
+ this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+
+ if (self.assertNotNull(channel) && self.assertEquals(this.vidBroadObj, this.PRESENTING)) {
+ logTest("State: Successful");
+ resolve("Successfull");
+ } else {
+ logTest("State: Failure");
+ reject("Failure : The channel is null for a unknown reason or wrong play state.");
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+
+ },
+
+// testPrevChannel: function(resolve, reject) {
+// var self = this;
+//
+// this.addTransition(this.PRESENTING, this.CONNECTING);
+//
+// this.addTransition(this.CONNECTING, this.PRESENTING);
+//
+// this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+//
+// if (self.assertNotNull(channel) && self.assertEquals(this.vidBroadObj, this.PRESENTING)) {
+// logTest("State: Successful");
+// resolve("Successfull");
+// } else {
+// logTest("State: Failure");
+// reject("Failure : The channel is null for a unknown reason or wrong play state.");
+// }
+// };
+//
+// this.vidBroadObj.prevChannel();
+//
+// },
+
+ testNextChannelInUnrealized: function(resolve, reject) {
+ this.addTransition(null, null, reject);
+ this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+ reject();
+ };
+ this.vidBroadObj.nextChannel();
+ this.timeout(3000)
+ .then(resolve);
+ },
+
+ testNextChannelInConnecting: function(resolve, reject) {
+ var self = this;
+ this.addTransition(this.UNREALIZED, this.CONNECTING, function() {
+ self.vidBroadObj.nextChannel();
+ });
+
+ this.addTransition(this.CONNECTING, this.CONNECTING);
+
+ this.addTransition(this.PRESENTING, this.CONNECTING);
+
+ this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+
+ if (self.assertNotNull(channel) && self.assertEquals(this.vidBroadObj, this.PRESENTING)) {
+ logTest("State: Successful");
+ resolve("Successfull");
+ } else {
+ logTest("State: Failure");
+ reject("Failure : The channel is null for a unknown reason or wrong play state.");
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+
+ },
+
+ testNextChannelInPresenting: function(resolve, reject) {
+ var self = this;
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.nextChannel();
+ });
+
+ this.addTransition(this.PRESENTING, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING);
+
+ this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+
+ if (self.assertNotNull(channel) && self.assertEquals(this.vidBroadObj, this.PRESENTING)) {
+ logTest("State: Successful");
+ resolve("Successfull");
+ } else {
+ logTest("State: Failure");
+ reject("Failure : The channel is null for a unknown reason or wrong play state.");
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+
+ },
+
+ testNextChannelInStopped: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.stop();
+ });
+
+ this.addTransition(this.PRESENTING, this.STOPPED, function() {
+ self.vidBroadObj.nextChannel();
+ });
+
+ this.addTransition(this.STOPPED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING);
+
+ this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+
+ if (self.assertNotNull(channel) && self.assertEquals(this.vidBroadObj, this.PRESENTING)) {
+ logTest("State: Successful");
+ resolve("Successfull");
+ } else {
+ logTest("State: Failure");
+ reject("Failure : The channel is null for a unknown reason or wrong play state.");
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+
+ },
+
+// testNextChannel: function(resolve, reject) {
+// var self = this;
+//
+// this.addTransition(this.PRESENTING, this.CONNECTING);
+//
+// this.addTransition(this.CONNECTING, this.PRESENTING);
+//
+// this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+//
+// if (self.assertNotNull(channel) && self.assertEquals(this.vidBroadObj, this.PRESENTING)) {
+// logTest("State: Successful");
+// resolve("Successfull");
+// } else {
+// logTest("State: Failure");
+// reject("Failure : The channel is null for a unknown reason or wrong play state.");
+// }
+// };
+//
+// this.vidBroadObj.nextChannel();
+// },
+
+ /*
+ * Description:
+ * Nominal Case
+ */
+ testReleaseInConnecting: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING, function() {
+ self.vidBroadObj.release();
+ });
+
+ this.addTransition(this.CONNECTING, this.UNREALIZED, resolve);
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testReleaseInPresenting: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.release();
+ });
+
+ this.addTransition(this.PRESENTING, this.UNREALIZED, resolve);
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ /*
+ * Description:
+ * Method stop is called in presenting state(but can be also in connecting state).
+ * @param {type} resolve
+ * @param {type} reject
+ * @returns {undefined}
+ */
+ testReleaseInStopped: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.stop();
+ });
+
+ this.addTransition(this.PRESENTING, this.STOPPED, function() {
+ self.vidBroadObj.release();
+ });
+
+ this.addTransition(this.STOPPED, this.UNREALIZED, resolve);
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+// testRelease: function(resolve, reject) {
+// var self = this;
+//
+// this.addTransition(this.PRESENTING, this.UNREALIZED, resolve);
+//
+// this.vidBroadObj.release();
+// },
+
+ /*
+ * Description:
+ * Nominal Case
+ */
+ testStopInConnecting: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING, function() {
+ self.vidBroadObj.stop();
+ });
+
+ this.addTransition(this.CONNECTING, this.STOPPED, resolve);
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testStopInPresenting: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.stop();
+ });
+
+ this.addTransition(this.PRESENTING, this.STOPPED, resolve);
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+// testStop: function(resolve, reject) {
+// var self = this;
+//
+// this.addTransition(this.PRESENTING, this.STOPPED, resolve);
+//
+// this.vidBroadObj.stop();
+// },
+
+ /*
+ * Description:
+ * Nominal Case
+ */
+ testSetVolume: function(resolve, reject) {
+ var volume = 15;
+ var done = this.vidBroadObj.setVolume(volume);
+
+ if (done && this.assertEquals(volume, this.vidBroadObj.getVolume())) {
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+ testSetVolumeWithoutArgument: function(resolve, reject) {
+ var done = this.vidBroadObj.setVolume();
+
+ if (done) {
+ reject();
+ } else {
+ resolve();
+ }
+ },
+
+ testSetVolumeWithFloatArgument: function(resolve, reject) {
+ var volume = 15.8;
+ var done = this.vidBroadObj.setVolume(volume);
+
+ if (done || this.assertEquals(volume, this.vidBroadObj.getVolume())) {
+ reject("[Stub]Wrong Implementation.");
+ } else {
+ resolve();
+ }
+ },
+
+ testSetVolumeWithFloatUnderBoundMin: function(resolve, reject) {
+ var volume = -15.8;
+ var done = this.vidBroadObj.setVolume(volume);
+
+ if (done || this.assertEquals(volume, this.vidBroadObj.getVolume())) {
+ reject("[Stub]Wrong Implementation.");
+ } else {
+ resolve();
+ }
+ },
+
+ testSetVolumeWithFloatAboveBoundMax: function(resolve, reject) {
+ var volume = 151.74;
+ var done = this.vidBroadObj.setVolume(volume);
+
+ if (done || this.assertEquals(volume, this.vidBroadObj.getVolume())) {
+ reject("[Stub]Wrong Implementation.");
+ } else {
+ resolve();
+ }
+ },
+
+ testSetVolumeWithValueUnderBoundMin: function(resolve, reject) {
+ var volume = -15;
+ var done = this.vidBroadObj.setVolume(volume);
+
+ if (done && this.assertEquals(volume, this.vidBroadObj.getVolume())) {
+ reject();
+ } else {
+ resolve();
+ }
+ },
+
+ testSetVolumeWithValueAboveBoundMax: function(resolve, reject) {
+ var volume = 105;
+ var done = this.vidBroadObj.setVolume(volume);
+
+ if (done && this.assertEquals(volume, this.vidBroadObj.getVolume())) {
+ reject();
+ } else {
+ resolve();
+ }
+ },
+
+// testSetVolume: function(resolve, reject) {
+// var volume = 15;
+//
+// var done = this.vidBroadObj.setVolume(volume);
+//
+// if (done) {
+// resolve();
+// } else {
+// reject();
+// }
+// },
+
+ /*
+ * Description:
+ * Nominal Case
+ * FIX-ME: Yannis - 24/03/2015 - Exception not throw in callback of method addTransition
+ */
+ testGetVolume: function(resolve, reject) {
+ var initialVolume = 15;
+ var done = this.vidBroadObj.setVolume(initialVolume);
+
+ var finalVolume = this.vidBroadObj.getVolume();
+
+ if (done && this.assertEquals(initialVolume, this.vidBroadObj.getVolume())
+ && this.assertEquals(initialVolume, finalVolume)
+ && this.assertEquals(this.vidBroadObj.getVolume(), finalVolume)) {
+
+ resolve();
+ } else {
+ reject();
+ }
+ },
+
+// testGetVolume: function(resolve, reject) {
+// var volume = this.vidBroadObj.getVolume();
+//
+// if (volume ) {
+// resovle();
+// } else {
+// reject();
+// }
+// },
+ testSetChannelInUnrealized: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.setChannel(self.channel);
+ });
+
+ this.addTransition(this.PRESENTING, this.CONNECTING);
+ this.addTransition(this.CONNECTING, this.PRESENTING);
+
+ this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+
+ if (self.assertNotNull(channel) && self.assertEquals(self.vidBroadObj.playState, self.PRESENTING)) {
+ logTest("State: Successful");
+ resolve("Success");
+ } else {
+ logTest("State: Failure");
+ reject("Failure : The channel is null for a unknown reason or wrong play state.");
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testSetChannelInConnecting: function(resolve, reject) {
+ var self = this;
+
+ this.channel = this.getChannel(
+ this.vidBroadObj.getChannelConfig().channelList);
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING, function() {
+ self.vidBroadObj.setChannel(self.channel);
+ });
+
+ this.addTransition(this.CONNECTING, this.PRESENTING);
+
+ this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+
+ if (self.assertNotNull(channel) && self.assertEquals(self.vidBroadObj.playState, self.PRESENTING)) {
+ logTest("State: Successful");
+ resolve("Success");
+ } else {
+ logTest("State: Failure");
+ reject("Failure : The channel is null for a unknown reason or wrong play state.");
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testSetChannelInConnectingWithNull: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING, function() {
+ self.vidBroadObj.setChannel(null);
+ });
+
+ this.addTransition(this.CONNECTING, this.UNREALIZED, resolve);
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testSetChannelInPresenting: function(resolve, reject) {
+ var self = this;
+
+ this.channel = this.getChannel(
+ this.vidBroadObj.getChannelConfig().channelList);
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.setChannel(self.channel);
+ });
+
+ this.addTransition(this.PRESENTING, this.CONNECTING);
+ this.addTransition(this.CONNECTING, this.PRESENTING);
+
+ this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+
+ if (self.assertNotNull(channel) && self.assertEquals(self.vidBroadObj.playState, self.PRESENTING)) {
+ logTest("State: Successful");
+ resolve("Success");
+ } else {
+ logTest("State: Failure");
+ reject("Failure : The channel is null for a unknown reason or wrong play state.");
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testSetChannelInPresentingWithNull: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.setChannel(null);
+ });
+
+ this.addTransition(this.PRESENTING, this.UNREALIZED, resolve);
+
+ this.vidBroadObj.bindToCurrentChannel();
+
+ },
+
+ testSetChannelInStopped: function(resolve, reject) {
+ var self = this;
+
+ this.channel = this.getChannel(
+ this.vidBroadObj.getChannelConfig().channelList);
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.stop();
+ });
+
+ this.addTransition(this.PRESENTING, this.STOPPED, function() {
+ self.vidBroadObj.setChannel(self.channel);
+ });
+
+ this.addTransition(this.STOPPED, this.CONNECTING);
+ this.addTransition(this.CONNECTING, this.PRESENTING);
+
+ this.vidBroadObj.onChannelChangeSucceeded = function(channel) {
+
+ if (self.assertNotNull(channel) && self.assertEquals(self.vidBroadObj.playState, self.PRESENTING)) {
+ logTest("State: Successful");
+ resolve("Success");
+ } else {
+ logTest("State: Failure");
+ reject("Failure : The channel is null for a unknown reason or wrong play state.");
+ }
+ };
+
+ this.vidBroadObj.bindToCurrentChannel();
+ },
+
+ testSetChannelInStoppedWithNull: function(resolve, reject) {
+ var self = this;
+
+ this.addTransition(this.UNREALIZED, this.CONNECTING);
+
+ this.addTransition(this.CONNECTING, this.PRESENTING, function() {
+ self.vidBroadObj.stop();
+ });
+
+ this.addTransition(this.PRESENTING, this.STOPPED, function() {
+ self.vidBroadObj.setChannel(null);
+ });
+
+ this.addTransition(this.STOPPED, this.UNREALIZED, resolve);
+
+ this.vidBroadObj.bindToCurrentChannel();
+
+ }
+
+});
\ No newline at end of file
1
0
Author: jruchaud
Date: 2015-06-09 10:12:28 +0000 (Tue, 09 Jun 2015)
New Revision: 1635
Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1635
Log:
Configure eslint
Added:
oipf/.eslintrc
Modified:
oipf/
oipf/lib/gulpfile.js
Property changes on: oipf
___________________________________________________________________
Modified: svn:ignore
- node_modules
nbproject
.goutputstream-98NAWX
dist
+ node_modules
nbproject
.goutputstream-98NAWX
dist
.eslintrc
Added: oipf/.eslintrc
===================================================================
--- oipf/.eslintrc (rev 0)
+++ oipf/.eslintrc 2015-06-09 10:12:28 UTC (rev 1635)
@@ -0,0 +1,249 @@
+{
+ "ecmaFeatures": {
+ "jsx": true
+ },
+ "globals": {
+ "console": false,
+ "React": false,
+ "scope": false,
+ "alert": false
+ },
+ "env": {
+ "browser": true,
+ "node": true,
+ "es6": true
+ },
+ "rules": {
+ "comma-dangle": [
+ 2,
+ "never"
+ ],
+ "no-comma-dangle": 0,
+ "no-cond-assign": 2,
+ "no-console": 2,
+ "no-constant-condition": 2,
+ "no-control-regex": 2,
+ "no-debugger": 2,
+ "no-dupe-keys": 2,
+ "no-empty": 2,
+ "no-empty-class": 2,
+ "no-ex-assign": 2,
+ "no-extra-boolean-cast": 2,
+ "no-extra-parens": 2,
+ "no-extra-semi": 2,
+ "no-func-assign": 2,
+ "no-inner-declarations": [
+ 0,
+ "both"
+ ],
+ "no-invalid-regexp": 2,
+ "no-irregular-whitespace": 2,
+ "no-negated-in-lhs": 2,
+ "no-obj-calls": 2,
+ "no-regex-spaces": 2,
+ "no-reserved-keys": 2,
+ "no-sparse-arrays": 2,
+ "no-unreachable": 2,
+ "use-isnan": 2,
+ "valid-jsdoc": 0,
+ "valid-typeof": 2,
+ "block-scoped-var": 0,
+ "complexity": 0,
+ "consistent-return": 2,
+ "curly": [
+ 2,
+ "all"
+ ],
+ "default-case": 2,
+ "dot-notation": 2,
+ "eqeqeq": [
+ 2,
+ "smart"
+ ],
+ "guard-for-in": 2,
+ "no-alert": 2,
+ "no-caller": 2,
+ "no-div-regex": 2,
+ "no-else-return": 2,
+ "no-empty-label": 2,
+ "no-eq-null": 0,
+ "no-eval": 2,
+ "no-extend-native": 2,
+ "no-extra-bind": 2,
+ "no-fallthrough": 2,
+ "no-floating-decimal": 2,
+ "no-implied-eval": 2,
+ "no-iterator": 2,
+ "no-labels": 2,
+ "no-lone-blocks": 2,
+ "no-loop-func": 2,
+ "no-multi-spaces": 1,
+ "no-multi-str": 2,
+ "no-native-reassign": 2,
+ "no-new": 2,
+ "no-new-func": 2,
+ "no-new-wrappers": 2,
+ "no-octal": 2,
+ "no-octal-escape": 2,
+ "no-process-env": 1,
+ "no-proto": 2,
+ "no-redeclare": 2,
+ "no-return-assign": 2,
+ "no-script-url": 2,
+ "no-self-compare": 2,
+ "no-sequences": 2,
+ "no-throw-literal": 2,
+ "no-unused-expressions": 2,
+ "no-void": 2,
+ "no-warning-comments": 0,
+ "no-with": 2,
+ "radix": 2,
+ "vars-on-top": 0,
+ "wrap-iife": 2,
+ "yoda": 2,
+ "global-strict": 0,
+ "no-extra-strict": 0,
+ "strict": [
+ 2,
+ "never"
+ ],
+ "no-catch-shadow": 2,
+ "no-delete-var": 2,
+ "no-label-var": 2,
+ "no-shadow": 2,
+ "no-shadow-restricted-names": 2,
+ "no-undef": 2,
+ "no-undef-init": 2,
+ "no-undefined": 0,
+ "no-unused-vars": 2,
+ "no-use-before-define": 2,
+ "indent": [
+ 1,
+ 4
+ ],
+ "brace-style": [
+ 1,
+ "1tbs",
+ {
+ "allowSingleLine": true
+ }
+ ],
+ "camelcase": 1,
+ "comma-spacing": [
+ 1,
+ {
+ "before": false,
+ "after": true
+ }
+ ],
+ "comma-style": [
+ 1,
+ "last"
+ ],
+ "consistent-this": [
+ 2,
+ "_this"
+ ],
+ "eol-last": 1,
+ "func-names": 0,
+ "func-style": 0,
+ "key-spacing": [
+ 1,
+ {
+ "beforeColon": false,
+ "afterColon": true
+ }
+ ],
+ "max-nested-callbacks": [
+ 2,
+ 5
+ ],
+ "new-cap": 2,
+ "new-parens": 2,
+ "no-array-constructor": 2,
+ "no-inline-comments": 0,
+ "no-lonely-if": 2,
+ "no-mixed-spaces-and-tabs": 1,
+ "no-multiple-empty-lines": 1,
+ "no-nested-ternary": 2,
+ "no-new-object": 2,
+ "no-space-before-semi": 0,
+ "no-spaced-func": 1,
+ "no-ternary": 0,
+ "no-trailing-spaces": 1,
+ "no-underscore-dangle": 0,
+ "no-wrap-func": 2,
+ "one-var": 0,
+ "operator-assignment": 0,
+ "padded-blocks": 0,
+ "quote-props": [
+ 2,
+ "as-needed"
+ ],
+ "quotes": [
+ 1,
+ "double"
+ ],
+ "semi": [
+ 2,
+ "always"
+ ],
+ "semi-spacing": [
+ 1,
+ {
+ "before": false,
+ "after": true
+ }
+ ],
+ "sort-vars": 0,
+ "space-after-function-name": 0,
+ "space-after-keywords": [
+ 1,
+ "always"
+ ],
+ "space-before-blocks": [
+ 1,
+ "always"
+ ],
+ "space-before-function-paren": [
+ 1,
+ "never"
+ ],
+ "space-in-brackets": [
+ 1,
+ "never"
+ ],
+ "space-in-parens": [
+ 1,
+ "never"
+ ],
+ "space-infix-ops": 1,
+ "space-return-throw-case": 2,
+ "space-unary-ops": 2,
+ "spaced-line-comment": 0,
+ "wrap-regex": 0,
+ "no-var": 0,
+ "generator-star": [
+ 2,
+ "start"
+ ],
+ "max-depth": [
+ 2,
+ 10
+ ],
+ "max-len": [
+ 1,
+ 180
+ ],
+ "max-params": [
+ 2,
+ 10
+ ],
+ "max-statements": [
+ 1,
+ 100
+ ],
+ "no-bitwise": 2,
+ "no-plusplus": 0
+ }
+}
Modified: oipf/lib/gulpfile.js
===================================================================
--- oipf/lib/gulpfile.js 2015-06-09 10:02:18 UTC (rev 1634)
+++ oipf/lib/gulpfile.js 2015-06-09 10:12:28 UTC (rev 1635)
@@ -1,5 +1,5 @@
var gulp = require("gulp");
-var gulpSequence = require('gulp-sequence');
+var gulpSequence = require("gulp-sequence");
var concat = require("gulp-concat");
var sourcemaps = require("gulp-sourcemaps");
var babel = require("gulp-babel");
@@ -24,13 +24,13 @@
});
gulp.task("javascript", function() {
- return gulp.src("js/**/*.js")
+ return gulp.src("js/**/*.js")
.pipe(sourcemaps.init())
.pipe(babel({
blacklist: [
"es3.memberExpressionLiterals",
"es3.propertyLiterals",
- "es5.properties.mutators",
+ "es5.properties.mutators"
],
optional: [
"asyncToGenerator",
1
0