AC_CONFIG_FILES([Makefile \
secureelement/Makefile \
+ secureelement/support/Makefile \
resources/Makefile \
testkit/Makefile \
])
+++ /dev/null
-/*
-
-Copyright (c) 2013 Samsung Electronics Co., Ltd.
-
-Licensed under the Apache License, Version 2.0 (the License);
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-
-
-Authors:
-
- */
-
-
-MIN_BYTE = -128;
-MAX_BYTE = 127;
-MIN_OCTET = 0;
-MAX_OCTET = 255;
-MIN_SHORT = -32768;
-MAX_SHORT = 32767;
-MIN_UNSIGNED_SHORT = 0;
-MAX_UNSIGNED_SHORT = 65535;
-MIN_LONG = -2147483648;
-MAX_LONG = 2147483647;
-MIN_UNSIGNED_LONG = 0;
-MAX_UNSIGNED_LONG = 4294967295;
-MIN_LONG_LONG = -9223372036854775808;
-MAX_LONG_LONG = 9223372036854775807;
-MIN_UNSIGNED_LONG_LONG = 0;
-MAX_UNSIGNED_LONG_LONG = 18446744073709551615;
-
-TYPE_MISMATCH_EXCEPTION = {name: 'TypeMismatchError'};
-NOT_FOUND_EXCEPTION = {name: 'NotFoundError'};
-INVALID_VALUES_EXCEPTION = {name: 'InvalidValuesError'};
-IO_EXCEPTION = {name: 'IOError'};
-SECURITY_EXCEPTION = {name: 'SecurityError'};
-
-
-(function () {
- var head_src = document.head.innerHTML;
- if (head_src.search(/\/testharness.js\W/) === -1) {
- document.write('<script language="javascript" src="../resources/testharness.js"></script>\n');
- }
- if (head_src.search(/\/testharnessreport.js\W/) === -1) {
- document.write('<script language="javascript" src="../resources/testharnessreport.js"></script>\n');
- }
-})();
-
-var _registered_types = {};
-
-function _resolve_registered_type(type) {
- while (type in _registered_types) {
- type = _registered_types[type];
- }
- return type;
-}
-
-/**
- * Method checks extra argument for none argument method.
- * The only check is that method will not throw an exception.
- * Example usage:
- * checkExtraArgument(tizen.notification, "removeAll");
- *
- * @param object object
- * @param methodName string - name of the method
- */
-function checkExtraArgument(object, methodName) {
- var extraArgument = [
- null,
- undefined,
- "Tizen",
- 1,
- false,
- ["one", "two"],
- {argument: 1},
- function () {}
- ], i;
-
- for (i = 0; i < extraArgument.length; i++) {
- object[methodName](extraArgument[i]);
- }
-}
-
-/**
- * Method to validate conversion.
- * Example usage:
- * conversionTable = getTypeConversionExceptions("functionObject", true);
- * for(i = 0; i < conversionTable.length; i++) {
- * errorCallback = conversionTable[i][0];
- * exceptionName = conversionTable[i][1];
- *
- * assert_throws({name : exceptionName},
- * function () {
- * tizen.systemsetting.setProperty("HOME_SCREEN",
- * propertyValue, successCallback, errorCallback);
- * }, exceptionName + " should be thrown - given incorrect errorCallback.");
- * }
- *
- * @param conversionType
- * @param isOptional
- * @returns table of tables which contain value (index 0) and exceptionName (index 1)
- *
- */
-function getTypeConversionExceptions(conversionType, isOptional) {
- var exceptionName = "TypeMismatchError",
- conversionTable;
- switch (conversionType) {
- case "enum":
- conversionTable = [
- [undefined, exceptionName],
- [null, exceptionName],
- [0, exceptionName],
- [true, exceptionName],
- ["dummyInvalidEnumValue", exceptionName],
- [{ }, exceptionName]
- ];
- break;
- case "double":
- conversionTable = [
- [undefined, exceptionName],
- [NaN, exceptionName],
- [Number.POSITIVE_INFINITY, exceptionName],
- [Number.NEGATIVE_INFINITY, exceptionName],
- ["TIZEN", exceptionName],
- [{ name : "TIZEN" }, exceptionName],
- [function () { }, exceptionName]
- ];
- break;
- case "object":
- conversionTable = [
- [true, exceptionName],
- [false, exceptionName],
- [NaN, exceptionName],
- [0, exceptionName],
- ["", exceptionName],
- ["TIZEN", exceptionName],
- [undefined, exceptionName]
- ];
- if (!isOptional) {
- conversionTable.push([null, exceptionName]);
- }
- break;
- case "functionObject":
- conversionTable = [
- [true, exceptionName],
- [false, exceptionName],
- [NaN, exceptionName],
- [0, exceptionName],
- ["", exceptionName],
- ["TIZEN", exceptionName],
- [[], exceptionName],
- [{ }, exceptionName],
- [undefined, exceptionName]
- ];
- if (!isOptional) {
- conversionTable.push([null, exceptionName]);
- }
- break;
- case "array":
- conversionTable = [
- [true, exceptionName],
- [false, exceptionName],
- [NaN, exceptionName],
- [0, exceptionName],
- ["", exceptionName],
- ["TIZEN", exceptionName],
- [{ }, exceptionName],
- [function () { }, exceptionName],
- [undefined, exceptionName]
- ];
- if (!isOptional) {
- conversionTable.push([null, exceptionName]);
- }
- break;
- case "dictionary":
- conversionTable = [
- [true, exceptionName],
- [false, exceptionName],
- [NaN, exceptionName],
- [0, exceptionName],
- ["", exceptionName],
- ["TIZEN", exceptionName],
- [undefined, exceptionName]
- ];
- if (!isOptional) {
- conversionTable.push([null, exceptionName]);
- }
- break;
- default:
- assert_unreached("Fix your test. Wrong conversionType '" + conversionType + "'.");
- };
-
- return conversionTable;
-}
-
-
-function assert_type(obj, type, description) {
- var org_type = type, prop_name, prop_type, prop_value;
-
- type = _resolve_registered_type(type);
-
- if (typeof (type) === 'string') {
- type = type.toLowerCase();
- switch (type) {
- case 'object':
- case 'string':
- case 'number':
- case 'function':
- case 'boolean':
- case 'undefined':
- case 'xml':
- assert_equals(typeof (obj), type, description);
- break;
- case 'null':
- assert_true(obj === null, description);
- break;
- case 'array':
- assert_true(Array.isArray(obj), description);
- break;
- case 'date':
- assert_true(obj instanceof Date, description);
- break;
- case 'byte':
- assert_equals(typeof (obj), 'number', description);
- assert_greater_than_equal(obj, MIN_BYTE, description + " - value too low.");
- assert_less_than_equal(obj, MAX_BYTE, description + " - value too high.");
- assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
- break;
- case 'octet':
- assert_equals(typeof (obj), 'number', description);
- assert_greater_than_equal(obj, MIN_OCTET, description + " - value too low.");
- assert_less_than_equal(obj, MAX_OCTET, description + " - value too high.");
- assert_equals(obj % 1, 0, description + " - value is not an integer.");
- break;
- case 'short':
- assert_equals(typeof (obj), 'number', description);
- assert_greater_than_equal(obj, MIN_SHORT, description + " - value too low.");
- assert_less_than_equal(obj, MAX_SHORT, description + " - value too high.");
- assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
- break;
- case 'unsigned short':
- assert_equals(typeof (obj), 'number', description);
- assert_greater_than_equal(obj, MIN_UNSIGNED_SHORT, description + " - value too low.");
- assert_less_than_equal(obj, MAX_UNSIGNED_SHORT, description + " - value too high.");
- assert_equals(obj % 1, 0, description + " - value is not an integer.");
- break;
- case 'long':
- assert_equals(typeof (obj), 'number', description);
- assert_greater_than_equal(obj, MIN_LONG, description + " - value too low.");
- assert_less_than_equal(obj, MAX_LONG, description + " - value too high.");
- assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
- break;
- case 'unsigned long':
- assert_equals(typeof (obj), 'number', description);
- assert_greater_than_equal(obj, MIN_UNSIGNED_LONG, description + " - value too low.");
- assert_less_than_equal(obj, MAX_UNSIGNED_LONG, description + " - value too high.");
- assert_equals(obj % 1, 0, description + " - value is not an integer.");
- break;
- case 'long long':
- assert_equals(typeof (obj), 'number', description);
- assert_greater_than_equal(obj, MIN_LONG_LONG, description + " - value too low.");
- assert_less_than_equal(obj, MAX_LONG_LONG, description + " - value too high.");
- assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
- break;
- case 'unsigned long long':
- assert_equals(typeof (obj), 'number', description);
- assert_greater_than_equal(obj, MIN_UNSIGNED_LONG_LONG, description + " - value too low.");
- assert_less_than_equal(obj, MAX_UNSIGNED_LONG_LONG, description + " - value too high.");
- assert_equals(obj % 1, 0, description + " - value is not an integer.");
- break;
- default:
- assert_unreached('Fix your test. Wrong type \'' + org_type + '\'');
- }
- } else if (typeof (type) === 'function') {
- assert_true(obj instanceof type, description);
- } else if (typeof (type) === 'object') {
- for (prop_name in type) {
- prop_type = type[prop_name];
- if (prop_type === 'function') {
- assert_inherits(obj, prop_name);
- assert_equals(typeof obj[prop_name], prop_type, 'Object should have method ' + prop_name);
- } else {
- assert_own_property(obj, prop_name);
- }
- }
- } else {
- assert_unreached('Fix your test. Wrong type ' + org_type);
- }
-}
-
-function register_type(alias, type_spec) {
- _registered_types[alias] = type_spec;
-}
-
-/**
- * Method to check if attribute is const.
- * Example usage:
- * check_const(tizen.bluetooth.deviceMinor, 'TOY_DOLL', 0x03, 'number', 0x29B);
- *
- * @param obj object to test which has const attribute
- * @param attributeName attribute name.
- * @param expectedValue expected value of provided attribute name
- * @param expectedType expected type of provided attribute name
- * @param valueToAssign value to assign in order to check if attribute value can be modified
- */
-function check_const(obj, attributeName, expectedValue, expectedType, valueToAssign) {
- var tmp;
- if (expectedValue === valueToAssign) {
- assert_unreached("Fix your test. The same values given for " + attributeName +
- " in 'value' and 'valueToSet' arguments.");
- }
- if (typeof (attributeName) === "string") {
- assert_true(attributeName in obj, "Name " + attributeName + " doesn't exist in provided object.");
- assert_equals(obj[attributeName], expectedValue, "Value of " + attributeName + " is diffrent.");
- if (typeof (expectedType) !== "undefined") {
- if (expectedValue === null) {
- assert_type(obj[attributeName], "object", "Type of " + attributeName + " is different.");
- } else {
- assert_type(obj[attributeName], expectedType, "Type of " + attributeName + " is different.");
- }
- } else {
- assert_unreached("Fix your test. Wrong type " + expectedType);
- }
- tmp = obj[attributeName];
- obj[attributeName] = valueToAssign;
- assert_equals(obj[attributeName], tmp, attributeName + " can be modified.");
- } else {
- assert_unreached("Fix your test. Wrong type of name " + typeof (attributeName));
- }
-}
-
-/**
- * Method to check if attribute is readonly.
- * Example usage:
- * check_readonly(statusNotification, "postedTime", null, 'object', new Date());
- *
- * @param obj object to test which has readonly attribute
- * @param attributeName attribute name.
- * @param expectedValue expected value of provided attribute name
- * @param expectedType expected type of provided attribute name
- * @param valueToAssign value to assign in order to check if attribute value can be modified
- */
-function check_readonly(obj, attributeName, expectedValue, expectedType, valueToAssign) {
- check_const(obj, attributeName, expectedValue, expectedType, valueToAssign);
-}
-
-/**
- * Method to check if attribute can be set to null.
- * Example usage:
- * check_not_nullable(syncInfo, "mode");
- *
- * @param obj object to test which has not nullable attribute
- * @param attributeName attribute name.
- */
-function check_not_nullable(obj, attributeName)
-{ var old_value = obj[attributeName];
- obj[attributeName] = null;
- assert_not_equals(obj[attributeName], null, "Attribute " + attributeName + " can be set to null.");
- obj[attributeName] = old_value;
-}
-
-/**
- * Method to check NoInterfaceObject
- * Example usage:
- * check_no_interface_object("BluetoothAdapter")
- *
- * @param interfaceName interface name
- */
-function check_no_interface_object(interfaceName) {
- assert_throws({name: "TypeError"}, function () {
- tizen[interfaceName]();
- },"Wrong call as a function");
- assert_throws({name: "TypeError"}, function () {
- new tizen[interfaceName]();
- },"Wrong call as a new function");
- assert_throws({name: "TypeError"}, function () {
- ({}) instanceof tizen[interfaceName];
- },"instanceof exception");
- assert_equals(tizen[interfaceName], undefined, interfaceName + " is not undefined.");
-}
-
-
-/**
- * Method to check Constructors
- * Example usage:
- * check_constructor("BluetoothAdapter")
- *
- * @param constructorName constructor name
- */
-
-function check_constructor(constructorName) {
- assert_true(constructorName in tizen, "No " + constructorName + " in tizen.");
- assert_false({} instanceof tizen[constructorName],"Custom object is not instance of " + constructorName);
- assert_throws({
- name: "TypeError"
- }, function () {
- tizen[constructorName]();
- }, "Constructor called as function.");
-}
-
-/**
- * Method to check if given method can be overridden in a given object - (TEMPORARY REMOVED).
- * That method also checks if given method exists in a given object.
- * Example usage:
- * check_method_exists(tizen.notification, "get");
- *
- * @param obj object with method
- * @param methodName name of the method to check.
- */
-function check_method_exists(obj, methodName) {
- assert_type(obj[methodName], 'function', "Method does not exist.");
-}
-
-/**
- * Method to check extensibility of given object.
- * Method checks if new attribute and method can be added.
- * Example usage:
- * check_extensibility(tizen.notification);
- *
- * @param obj object to check
- */
-function check_extensibility(obj) {
- var dummyAttribute = "dummyAttributeValue", dummyMethodResult = "dummyMethodResultValue";
- obj.newDummyMethod = function() {
- return dummyMethodResult;
- }
- assert_equals(obj.newDummyMethod(), dummyMethodResult, "Incorrect result from added method.");
-
- obj.newDummyAttribute = dummyAttribute;
- assert_equals(obj.newDummyAttribute, dummyAttribute, "Incorrect result from added attribute.");
-}
-
-/**
- * Method to check if attribute can be modify.
- * Example usage:
- * check_attr(downloadRequest, "fileName", default_val, "string", "file_name.html");
- *
- * @param obj object to test which has not readonly attribute
- * @param attributeName attribute name.
- * @param expectedValue expected value of provided attribute name
- * @param expectedType expected type of provided attribute name
- * @param valueToAssign value to assign in order to check if attribute value can be modified
- */
-function check_attribute(obj, attributeName, expectedValue, expectedType, valueToAssign) {
- if (expectedValue === valueToAssign) {
- assert_unreached("Fix your test. The same values given for " + attributeName +
- " in 'value' and 'valueToSet' arguments.");
- }
- if (typeof (attributeName) === "string") {
- assert_true(attributeName in obj, "Name " + attributeName + " doesn't exist in provided object.");
- assert_equals(obj[attributeName], expectedValue, "Value of " + attributeName + " is diffrent.");
- if (typeof (expectedType) !== "undefined") {
- if (expectedValue === null) {
- assert_type(obj[attributeName], "object", "Type of " + attributeName + " is different.");
- } else {
- assert_type(obj[attributeName], expectedType, "Type of " + attributeName + " is different.");
- }
- } else {
- assert_unreached("Fix your test. Wrong type " + expectedType);
- }
- obj[attributeName] = valueToAssign;
- assert_equals(obj[attributeName], valueToAssign, attributeName + " can be modified.");
- } else {
- assert_unreached("Fix your test. Wrong type of name " + typeof (attributeName));
- }
-}
-
-/**
- * Method to check if whole array can be overwritten with an invalid value.
- * Sample usage:
- * check_invalid_array_assignments(message, "to", false);
- *
- * @param obj object which has the array as its property
- * @param array name of the array to check
- * @param isNullable indicates if the array can be null
- */
-function check_invalid_array_assignments(obj, array, isNullable) {
- var args = [undefined, true, false, NaN, 0, "TIZEN", {}, function () {}],
- val = obj[array], i;
-
- if (!isNullable) {
- obj[array] = null;
- assert_not_equals(obj[array], null, "Non-nullable array was set to null");
- assert_type(obj[array], "array", "Non-nullable array type changed after assigning null");
- assert_equals(obj[array].toString(), val.toString(), "Non-nullable array contents changed after assigning null");
- }
-
- for (i = 0 ; i < args.length ; i++) {
- obj[array] = args[i];
- assert_type(obj[array], "array", "Array type changed after assigning an invalid value");
- assert_equals(obj[array].toString(), val.toString(), "Array contents changed after assigning an invalid value");
- }
-}
-
-/**
- * Method to check if an object can be overwritten with an invalid value.
- * Sample usage:
- * check_invalid_object_assignments(message, "body", false);
- *
- * @param parentObj object which has the 'obj' object as its property
- * @param obj name of the object to check
- * @param isNullable indicates if the object can be null
- */
-function check_invalid_obj_assignments(parentObj, obj, isNullable) {
- var args = [undefined, true, false, NaN, 0, "TIZEN", function () {}],
- val = parentObj[obj], i;
-
- if (!isNullable) {
- parentObj[obj] = null;
- assert_equals(parentObj[obj], val, "Non-nullable obj was modified after assigning null");
- }
-
- for (i = 0 ; i < args.length ; i++) {
- parentObj[obj] = args[i];
- assert_equals(parentObj[obj], val, "The object was set to " + args[i]);
- }
-}
-
-/**
- * Method to validate conversion for listeners.
- * Example usage:
- * incorrectListeners = getListenerConversionExceptions(["oninstalled", "onupdated", "onuninstalled"]);
- * for(i = 0; i < incorrectListeners.length; i++) {
- * packageInformationEventCallback = incorrectListeners[i][0];
- * exceptionName = incorrectListeners[i][1];
- * assert_throws({name : exceptionName},
- * function () {
- * tizen.package.setPackageInfoEventListener(packageInformationEventCallback);
- * }, exceptionName + " should be thrown - given incorrect successCallback.");
- * }
- *
- *
- * @param callbackNames Array with names
- * @returns {Array} table of tables which contain incorrect listener (index 0) and exceptionName (index 1)
- *
- */
-function getListenerConversionExceptions(callbackNames) {
- var result = [], conversionTable, i, j, listenerName;
- conversionTable = getTypeConversionExceptions("functionObject", false);
-
- for (i = 0; i < callbackNames.length; i++) {
- for (j = 0; j < conversionTable.length; j++) {
- listenerName = {};
- listenerName[callbackNames[i]] = conversionTable[j][0];
- result.push([listenerName, conversionTable[j][1]]);
- }
- }
-
- return result;
-}
<head>
<title>ChannelSuccessCallback_notexist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== TEST_CRITERIA CBNIO
test(function () {
check_no_interface_object("ChannelSuccessCallback");
-}, "ChannelSuccessCallback_notexist");
+}, document.title);
</script>
</body>
<head>
<title>Channel_notexist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== TEST_CRITERIA NIO
test(function () {
check_no_interface_object("Channel");
-}, "Channel_notexist");
+}, document.title);
</script>
</body>
-worker_DATA = *
-workerdir = /opt/tct-secureelement-tizen-tests/secureelement
-EXTRA_DIST = $(worker_DATA)
+SUBDIRS = support
+secureelement_SCRIPTS = *
+secureelementdir = /opt/tct-secureelement-tizen-tests/secureelement
+EXTRA_DIST = $(secureelement_SCRIPTS)
<head>
<title>ReaderArraySuccessCallback_notexist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== TEST_CRITERIA CBNIO
test(function () {
check_no_interface_object("ReaderArraySuccessCallback");
-}, "ReaderArraySuccessCallback_notexist");
+}, document.title);
</script>
</body>
<head>
<title>ReaderArraySuccessCallback_onsuccess</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== ONLOAD_DELAY 90
//==== TEST_CRITERIA CBOA
setup({timeout: 90000});
-var t = async_test(document.title, {timeout: 90000} ), onSuccess, onError;
+var t = async_test(document.title, {timeout: 90000}), onSuccess, onError;
t.step(function () {
<head>
<title>Reader_notexist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== TEST_CRITERIA NIO
test(function () {
check_no_interface_object("Reader");
-}, "Reader_notexist");
+}, document.title);
</script>
</body>
<head>
<title>SEChangeListener_notexist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== TEST_CRITERIA CBNIO
test(function () {
check_no_interface_object("SEChangeListener");
-}, "SEChangeListener_notexist");
+}, document.title);
</script>
</body>
<head>
<title>SEServiceManagerObject_notexist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== TEST_CRITERIA NIO
test(function () {
check_no_interface_object("SEServiceManagerObject");
-}, "SEServiceManagerObject_notexist");
+}, document.title);
</script>
</body>
<head>
<title>SEService_extend</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
<div id="log"></div>
<script>
//==== TEST: SEService_extend
-//==== LABEL test whether the SEServiceManager object can have new attribute added
+//==== LABEL Test whether the SEServiceManager object can have new attribute added
//==== PRIORITY: P3
//==== SPEC Tizen Web API:Communication:SE:SEService:SEService U
//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/se.html
//==== TEST_CRITERIA OBX
test(function () {
check_extensibility(tizen.seService);
-}, "SEService_extend");
+}, document.title);
</script>
</body>
<head>
<title>SEService_getReaders</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
setup({timeout: 90000});
-var t = async_test("SEService_getReaders", {timeout: 90000}), getReadersSuccessCallback;
+var t = async_test(document.title, {timeout: 90000}), getReadersSuccessCallback;
t.step(function () {
getReadersSuccessCallback = t.step_func(function (readers) {
<html>
<head>
<title>SEService_getReaders_errorCallback_TypeMismatch</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
</head>
<body>
<div id="log"></div>
incorrectErrorCallback = conversionTable[i][0];
exceptionName = conversionTable[i][1];
- assert_throws({name : exceptionName},
+ assert_throws({name: exceptionName},
function () {
tizen.seService.getReaders(successCallback, incorrectErrorCallback);
}, exceptionName + " should be thrown - given incorrect errorCallback.");
<html>
<head>
<title>SEService_getReaders_errorCallback_invalid_cb</title>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
<div id="log"></div>
<script type="text/javascript">
//==== TEST: SEService_getReaders_errorCallback_invalid_cb
-//==== LABEL getReaders - check argument errorCallback validation - use {onerror: function (){}}
+//==== LABEL GetReaders - check argument errorCallback validation - use {onerror: function (){}}
//==== PRIORITY: P2
//==== SPEC: Tizen Web API:Communication:SE:SEService:getReaders M
//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/se.html
//==== ONLOAD_DELAY 90
//==== TEST_CRITERIA MTCB
setup({timeout: 90000});
-var t = async_test(document.title, { timeout: 90000 }), incorrectCallback,
- exceptionName = "TypeMismatchError", successCallback;
+var t = async_test(document.title, {timeout: 90000}), incorrectCallback,
+ successCallback;
t.step(function () {
incorrectCallback = {
assert_unreached("successCallback invoked.");
});
- assert_throws({name: exceptionName}, function () {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
tizen.seService.getReaders(successCallback, incorrectCallback);
- }, exceptionName + " should be thrown - given incorrect error callback.");
+ }, "Given incorrect error callback");
tizen.seService.shutdown();
t.done();
<head>
<title>SEService_getReaders_exist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
test(function () {
assert_true("getReaders" in tizen.seService, "getReaders method exists");
check_method_exists(tizen.seService, "getReaders");
-}, "SEService_getReaders_exist");
+}, document.title);
</script>
</body>
<html>
<head>
<title>SEService_getReaders_missarg</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
</head>
<body>
//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/se.html
//==== TEST_CRITERIA MMA
test(function () {
- assert_throws({ name: "TypeMismatchError" }, function () {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
tizen.seService.getReaders();
}, "Calling getReaders without arguments should throw an exception.");
}, document.title);
<html>
<head>
<title>SEService_getReaders_successCallback_TypeMismatch</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
</head>
<body>
<div id="log"></div>
successCallback = conversionTable[i][0];
exceptionName = conversionTable[i][1];
- assert_throws({name : exceptionName},
+ assert_throws({name: exceptionName},
function () {
tizen.seService.getReaders(successCallback);
}, exceptionName + " should be thrown - given incorrect successCallback.");
<html>
<head>
<title>SEService_getReaders_successCallback_invalid_cb</title>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
<div id="log"></div>
<script type="text/javascript">
//==== TEST: SEService_getReaders_successCallback_invalid_cb
-//==== LABEL getReaders - check argument successCallback validation - use {onsuccess: function (){}}
+//==== LABEL GetReaders - check argument successCallback validation - use {onsuccess: function (){}}
//==== PRIORITY: P2
//==== SPEC: Tizen Web API:Communication:SE:SEService:getReaders M
//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/se.html
//==== ONLOAD_DELAY 90
//==== TEST_CRITERIA MTCB
setup({timeout: 90000});
-var t = async_test(document.title, { timeout: 90000 }), incorrectCallback,
- exceptionName = "TypeMismatchError";
+var t = async_test(document.title, {timeout: 90000}), incorrectCallback;
t.step(function () {
incorrectCallback = {
assert_unreached("Invalid successCallback invoked: ");
})
};
- assert_throws({
- name: exceptionName
- }, function () {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
tizen.seService.getReaders(incorrectCallback);
- }, exceptionName + " should be thrown - given incorrect success callback.");
+ }, "Given incorrect success callback");
tizen.seService.shutdown();
t.done();
});
<head>
<meta charset="utf-8"/>
<title>SEService_getReaders_with_errorCallback</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
</head>
<body>
<div id="log"></div>
//==== TEST_CRITERIA MOA
setup({timeout: 90000});
-var t = async_test("SEService_getReaders_with_errorCallback", {timeout: 90000}), getReadersSuccessCallback, getReadersErrorCallback;
+var t = async_test(document.title, {timeout: 90000}), getReadersSuccessCallback, getReadersErrorCallback;
t.step(function () {
getReadersSuccessCallback = t.step_func(function (readers) {
<head>
<title>SEService_notexist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== TEST_CRITERIA NIO
test(function () {
check_no_interface_object("SEService");
-}, "SEService_notexist");
+}, document.title);
</script>
</body>
<head>
<title>SEService_registerSEListener</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== ONLOAD_DELAY 90
//==== TEST_CRITERIA MMINA MR
setup({timeout: 90000});
-var t = async_test("SEService_registerSEListener", {timeout: 90000}),
+var t = async_test(document.title, {timeout: 90000}),
listenerId, listener;
t.step(function () {
listener = {
<head>
<title>SEService_registerSEListener_exist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
test(function () {
assert_true("registerSEListener" in tizen.seService, "registerSEListener method exists");
check_method_exists(tizen.seService, "registerSEListener");
-}, "SEService_registerSEListener_exist");
+}, document.title);
</script>
</body>
<html>
<head>
<title>SEService_registerSEListener_listener_TypeMismatch</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
</head>
<body>
<div id="log"></div>
<script type="text/javascript">
//==== TEST: SEService_registerSEListener_listener_TypeMismatch
-//==== LABEL check if registerSEListener of SEService throws exception when argument is incorrect
+//==== LABEL Check if registerSEListener of SEService throws exception when argument is incorrect
//==== PRIORITY P2
//==== SPEC Tizen Web API:Communication:SE:SEService:registerSEListener M
//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/se.html
//==== TEST_CRITERIA MC
setup({timeout: 90000});
var t = async_test(document.title, {timeout: 90000}), i,
- conversionTable, SEChangeListener, exceptionName;
+ conversionTable, seChangeListener, exceptionName;
t.step(function () {
conversionTable = getTypeConversionExceptions("object", false);
for(i = 0; i < conversionTable.length; i++) {
- SEChangeListener = conversionTable[i][0];
+ seChangeListener = conversionTable[i][0];
exceptionName = conversionTable[i][1];
- assert_throws({name : exceptionName},
+ assert_throws({name: exceptionName},
function () {
- tizen.seService.registerSEListener(SEChangeListener);
- }, exceptionName + " should be thrown - given incorrect SEChangeListener - " + SEChangeListener);
+ tizen.seService.registerSEListener(seChangeListener);
+ }, exceptionName + " should be thrown - given incorrect SEChangeListener - " + seChangeListener);
}
tizen.seService.shutdown();
t.done();
<head>
<title>SEService_registerSEListener_listener_empty</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
tizen.seService.unregisterSEListener(listenerId);
tizen.seService.shutdown();
-}, "SEService_registerSEListener_listener_empty");
+}, document.title);
</script>
</body>
<head>
<meta charset="utf-8"/>
<title>SEService_registerSEListener_listener_invalid_cb</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
</head>
<body>
<script type="text/javascript">
//==== TEST: SEService_registerSEListener_listener_invalid_cb
-//==== LABEL check if registerSEListener of SEService throws exception when listener is invalid
+//==== LABEL Check if registerSEListener of SEService throws exception when listener is invalid
//==== PRIORITY P2
-//==== LABEL Check argument listener validation - use simple function
//==== SPEC Tizen Web API:Communication:SE:SEService:registerSEListener M
//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/se.html
//==== TEST_CRITERIA MTL
incorrectListener = conversionTable[i][0];
exceptionName = conversionTable[i][1];
- assert_throws({name : exceptionName},
+ assert_throws({name: exceptionName},
function () {
tizen.seService.registerSEListener(incorrectListener);
}, exceptionName + " should be thrown - given incorrect listener.");
}
-}, "SEService_registerSEListener_listener_invalid_cb");
+}, document.title);
</script>
</body>
<html>
<head>
<title>SEService_registerSEListener_missarg</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
</head>
<body>
//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/se.html
//==== TEST_CRITERIA MMA
test(function () {
- assert_throws({ name: "TypeMismatchError" }, function () {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
tizen.seService.registerSEListener();
}, "Calling registerSEListener without arguments should throw an exception.");
}, document.title);
<head>
<title>SEService_shutdown</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
var retVal = null;
retVal = tizen.seService.shutdown();
assert_equals(retVal, undefined, "shutdown() should return undefined.");
-}, "SEService_shutdown");
+}, document.title);
</script>
</body>
<head>
<title>SEService_shutdown_exist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
test(function () {
assert_true("shutdown" in tizen.seService, "shutdown method exists");
check_method_exists(tizen.seService, "shutdown");
-}, "SEService_shutdown_exist");
+}, document.title);
</script>
</body>
<head>
<title>SEService_shutdown_extra_argument</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
test(function () {
checkExtraArgument(tizen.seService, "shutdown");
-});
+}, document.title);
</script>
</body>
<head>
<title>SEService_unregisterSEListener</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== ONLOAD_DELAY 90
//==== TEST_CRITERIA MMINA MR
setup({timeout: 90000});
-var t = async_test("SEService_unregisterSEListener", {timeout: 90000}),
+var t = async_test(document.title, {timeout: 90000}),
listenerId, listener, returnedValue = null;
t.step(function () {
<head>
<title>SEService_unregisterSEListener_exist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
test(function () {
assert_true("unregisterSEListener" in tizen.seService, "unregisterSEListener method exists");
check_method_exists(tizen.seService, "unregisterSEListener");
-}, "SEService_unregisterSEListener_exist");
+}, document.title);
</script>
</body>
<head>
<title>SessionSuccessCallback_notexist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== TEST_CRITERIA CBNIO
test(function () {
check_no_interface_object("SessionSuccessCallback");
-}, "SessionSuccessCallback_notexist");
+}, document.title);
</script>
</body>
<head>
<title>Session_notexist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== TEST_CRITERIA NIO
test(function () {
check_no_interface_object("Session");
-}, "Session_notexist");
+}, document.title);
</script>
</body>
<head>
<title>Tizen_seService_exist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
test(function () {
assert_own_property(tizen, "seService", "Tizen should implement SEServiceManagerObject");
assert_equals(typeof(tizen.seService), "object", "tizen.seService should be object");
-}, "Tizen_seService_exist");
+}, document.title);
</script>
</body>
<head>
<title>TransmitSuccessCallback_notexist</title>
<meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
</head>
<body>
//==== TEST_CRITERIA CBNIO
test(function () {
check_no_interface_object("TransmitSuccessCallback");
-}, "TransmitSuccessCallback_notexist");
+}, document.title);
</script>
</body>
--- /dev/null
+supportdir = /opt/tct-secureelement-tizen-tests/secureelement/support
+support_SCRIPTS = *.js
+EXTRA_DIST = $(support_SCRIPTS)
--- /dev/null
+/*
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd.
+
+Licensed under the Apache License, Version 2.0 (the License);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+
+Authors:
+
+ */
+
+
+MIN_BYTE = -128;
+MAX_BYTE = 127;
+MIN_OCTET = 0;
+MAX_OCTET = 255;
+MIN_SHORT = -32768;
+MAX_SHORT = 32767;
+MIN_UNSIGNED_SHORT = 0;
+MAX_UNSIGNED_SHORT = 65535;
+MIN_LONG = -2147483648;
+MAX_LONG = 2147483647;
+MIN_UNSIGNED_LONG = 0;
+MAX_UNSIGNED_LONG = 4294967295;
+MIN_LONG_LONG = -9223372036854775808;
+MAX_LONG_LONG = 9223372036854775807;
+MIN_UNSIGNED_LONG_LONG = 0;
+MAX_UNSIGNED_LONG_LONG = 18446744073709551615;
+
+TYPE_MISMATCH_EXCEPTION = {name: 'TypeMismatchError'};
+NOT_FOUND_EXCEPTION = {name: 'NotFoundError'};
+INVALID_VALUES_EXCEPTION = {name: 'InvalidValuesError'};
+IO_EXCEPTION = {name: 'IOError'};
+SECURITY_EXCEPTION = {name: 'SecurityError'};
+
+
+(function () {
+ var head_src = document.head.innerHTML;
+ if (head_src.search(/\/testharness.js\W/) === -1) {
+ document.write('<script language="javascript" src="../resources/testharness.js"></script>\n');
+ }
+ if (head_src.search(/\/testharnessreport.js\W/) === -1) {
+ document.write('<script language="javascript" src="../resources/testharnessreport.js"></script>\n');
+ }
+})();
+
+var _registered_types = {};
+
+function _resolve_registered_type(type) {
+ while (type in _registered_types) {
+ type = _registered_types[type];
+ }
+ return type;
+}
+
+/**
+ * Method checks extra argument for none argument method.
+ * The only check is that method will not throw an exception.
+ * Example usage:
+ * checkExtraArgument(tizen.notification, "removeAll");
+ *
+ * @param object object
+ * @param methodName string - name of the method
+ */
+function checkExtraArgument(object, methodName) {
+ var extraArgument = [
+ null,
+ undefined,
+ "Tizen",
+ 1,
+ false,
+ ["one", "two"],
+ {argument: 1},
+ function () {}
+ ], i;
+
+ for (i = 0; i < extraArgument.length; i++) {
+ object[methodName](extraArgument[i]);
+ }
+}
+
+/**
+ * Method to validate conversion.
+ * Example usage:
+ * conversionTable = getTypeConversionExceptions("functionObject", true);
+ * for(i = 0; i < conversionTable.length; i++) {
+ * errorCallback = conversionTable[i][0];
+ * exceptionName = conversionTable[i][1];
+ *
+ * assert_throws({name : exceptionName},
+ * function () {
+ * tizen.systemsetting.setProperty("HOME_SCREEN",
+ * propertyValue, successCallback, errorCallback);
+ * }, exceptionName + " should be thrown - given incorrect errorCallback.");
+ * }
+ *
+ * @param conversionType
+ * @param isOptional
+ * @returns table of tables which contain value (index 0) and exceptionName (index 1)
+ *
+ */
+function getTypeConversionExceptions(conversionType, isOptional) {
+ var exceptionName = "TypeMismatchError",
+ conversionTable;
+ switch (conversionType) {
+ case "enum":
+ conversionTable = [
+ [undefined, exceptionName],
+ [null, exceptionName],
+ [0, exceptionName],
+ [true, exceptionName],
+ ["dummyInvalidEnumValue", exceptionName],
+ [{ }, exceptionName]
+ ];
+ break;
+ case "double":
+ conversionTable = [
+ [undefined, exceptionName],
+ [NaN, exceptionName],
+ [Number.POSITIVE_INFINITY, exceptionName],
+ [Number.NEGATIVE_INFINITY, exceptionName],
+ ["TIZEN", exceptionName],
+ [{ name : "TIZEN" }, exceptionName],
+ [function () { }, exceptionName]
+ ];
+ break;
+ case "object":
+ conversionTable = [
+ [true, exceptionName],
+ [false, exceptionName],
+ [NaN, exceptionName],
+ [0, exceptionName],
+ ["", exceptionName],
+ ["TIZEN", exceptionName],
+ [undefined, exceptionName]
+ ];
+ if (!isOptional) {
+ conversionTable.push([null, exceptionName]);
+ }
+ break;
+ case "functionObject":
+ conversionTable = [
+ [true, exceptionName],
+ [false, exceptionName],
+ [NaN, exceptionName],
+ [0, exceptionName],
+ ["", exceptionName],
+ ["TIZEN", exceptionName],
+ [[], exceptionName],
+ [{ }, exceptionName],
+ [undefined, exceptionName]
+ ];
+ if (!isOptional) {
+ conversionTable.push([null, exceptionName]);
+ }
+ break;
+ case "array":
+ conversionTable = [
+ [true, exceptionName],
+ [false, exceptionName],
+ [NaN, exceptionName],
+ [0, exceptionName],
+ ["", exceptionName],
+ ["TIZEN", exceptionName],
+ [{ }, exceptionName],
+ [function () { }, exceptionName],
+ [undefined, exceptionName]
+ ];
+ if (!isOptional) {
+ conversionTable.push([null, exceptionName]);
+ }
+ break;
+ case "dictionary":
+ conversionTable = [
+ [true, exceptionName],
+ [false, exceptionName],
+ [NaN, exceptionName],
+ [0, exceptionName],
+ ["", exceptionName],
+ ["TIZEN", exceptionName],
+ [undefined, exceptionName]
+ ];
+ if (!isOptional) {
+ conversionTable.push([null, exceptionName]);
+ }
+ break;
+ default:
+ assert_unreached("Fix your test. Wrong conversionType '" + conversionType + "'.");
+ };
+
+ return conversionTable;
+}
+
+
+function assert_type(obj, type, description) {
+ var org_type = type, prop_name, prop_type, prop_value;
+
+ type = _resolve_registered_type(type);
+
+ if (typeof (type) === 'string') {
+ type = type.toLowerCase();
+ switch (type) {
+ case 'object':
+ case 'string':
+ case 'number':
+ case 'function':
+ case 'boolean':
+ case 'undefined':
+ case 'xml':
+ assert_equals(typeof (obj), type, description);
+ break;
+ case 'null':
+ assert_true(obj === null, description);
+ break;
+ case 'array':
+ assert_true(Array.isArray(obj), description);
+ break;
+ case 'date':
+ assert_true(obj instanceof Date, description);
+ break;
+ case 'byte':
+ assert_equals(typeof (obj), 'number', description);
+ assert_greater_than_equal(obj, MIN_BYTE, description + " - value too low.");
+ assert_less_than_equal(obj, MAX_BYTE, description + " - value too high.");
+ assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
+ break;
+ case 'octet':
+ assert_equals(typeof (obj), 'number', description);
+ assert_greater_than_equal(obj, MIN_OCTET, description + " - value too low.");
+ assert_less_than_equal(obj, MAX_OCTET, description + " - value too high.");
+ assert_equals(obj % 1, 0, description + " - value is not an integer.");
+ break;
+ case 'short':
+ assert_equals(typeof (obj), 'number', description);
+ assert_greater_than_equal(obj, MIN_SHORT, description + " - value too low.");
+ assert_less_than_equal(obj, MAX_SHORT, description + " - value too high.");
+ assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
+ break;
+ case 'unsigned short':
+ assert_equals(typeof (obj), 'number', description);
+ assert_greater_than_equal(obj, MIN_UNSIGNED_SHORT, description + " - value too low.");
+ assert_less_than_equal(obj, MAX_UNSIGNED_SHORT, description + " - value too high.");
+ assert_equals(obj % 1, 0, description + " - value is not an integer.");
+ break;
+ case 'long':
+ assert_equals(typeof (obj), 'number', description);
+ assert_greater_than_equal(obj, MIN_LONG, description + " - value too low.");
+ assert_less_than_equal(obj, MAX_LONG, description + " - value too high.");
+ assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
+ break;
+ case 'unsigned long':
+ assert_equals(typeof (obj), 'number', description);
+ assert_greater_than_equal(obj, MIN_UNSIGNED_LONG, description + " - value too low.");
+ assert_less_than_equal(obj, MAX_UNSIGNED_LONG, description + " - value too high.");
+ assert_equals(obj % 1, 0, description + " - value is not an integer.");
+ break;
+ case 'long long':
+ assert_equals(typeof (obj), 'number', description);
+ assert_greater_than_equal(obj, MIN_LONG_LONG, description + " - value too low.");
+ assert_less_than_equal(obj, MAX_LONG_LONG, description + " - value too high.");
+ assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
+ break;
+ case 'unsigned long long':
+ assert_equals(typeof (obj), 'number', description);
+ assert_greater_than_equal(obj, MIN_UNSIGNED_LONG_LONG, description + " - value too low.");
+ assert_less_than_equal(obj, MAX_UNSIGNED_LONG_LONG, description + " - value too high.");
+ assert_equals(obj % 1, 0, description + " - value is not an integer.");
+ break;
+ default:
+ assert_unreached('Fix your test. Wrong type \'' + org_type + '\'');
+ }
+ } else if (typeof (type) === 'function') {
+ assert_true(obj instanceof type, description);
+ } else if (typeof (type) === 'object') {
+ for (prop_name in type) {
+ prop_type = type[prop_name];
+ if (prop_type === 'function') {
+ assert_inherits(obj, prop_name);
+ assert_equals(typeof obj[prop_name], prop_type, 'Object should have method ' + prop_name);
+ } else {
+ assert_own_property(obj, prop_name);
+ }
+ }
+ } else {
+ assert_unreached('Fix your test. Wrong type ' + org_type);
+ }
+}
+
+function register_type(alias, type_spec) {
+ _registered_types[alias] = type_spec;
+}
+
+/**
+ * Method to check if attribute is const.
+ * Example usage:
+ * check_const(tizen.bluetooth.deviceMinor, 'TOY_DOLL', 0x03, 'number', 0x29B);
+ *
+ * @param obj object to test which has const attribute
+ * @param attributeName attribute name.
+ * @param expectedValue expected value of provided attribute name
+ * @param expectedType expected type of provided attribute name
+ * @param valueToAssign value to assign in order to check if attribute value can be modified
+ */
+function check_const(obj, attributeName, expectedValue, expectedType, valueToAssign) {
+ var tmp;
+ if (expectedValue === valueToAssign) {
+ assert_unreached("Fix your test. The same values given for " + attributeName +
+ " in 'value' and 'valueToSet' arguments.");
+ }
+ if (typeof (attributeName) === "string") {
+ assert_true(attributeName in obj, "Name " + attributeName + " doesn't exist in provided object.");
+ assert_equals(obj[attributeName], expectedValue, "Value of " + attributeName + " is diffrent.");
+ if (typeof (expectedType) !== "undefined") {
+ if (expectedValue === null) {
+ assert_type(obj[attributeName], "object", "Type of " + attributeName + " is different.");
+ } else {
+ assert_type(obj[attributeName], expectedType, "Type of " + attributeName + " is different.");
+ }
+ } else {
+ assert_unreached("Fix your test. Wrong type " + expectedType);
+ }
+ tmp = obj[attributeName];
+ obj[attributeName] = valueToAssign;
+ assert_equals(obj[attributeName], tmp, attributeName + " can be modified.");
+ } else {
+ assert_unreached("Fix your test. Wrong type of name " + typeof (attributeName));
+ }
+}
+
+/**
+ * Method to check if attribute is readonly.
+ * Example usage:
+ * check_readonly(statusNotification, "postedTime", null, 'object', new Date());
+ *
+ * @param obj object to test which has readonly attribute
+ * @param attributeName attribute name.
+ * @param expectedValue expected value of provided attribute name
+ * @param expectedType expected type of provided attribute name
+ * @param valueToAssign value to assign in order to check if attribute value can be modified
+ */
+function check_readonly(obj, attributeName, expectedValue, expectedType, valueToAssign) {
+ check_const(obj, attributeName, expectedValue, expectedType, valueToAssign);
+}
+
+/**
+ * Method to check if attribute can be set to null.
+ * Example usage:
+ * check_not_nullable(syncInfo, "mode");
+ *
+ * @param obj object to test which has not nullable attribute
+ * @param attributeName attribute name.
+ */
+function check_not_nullable(obj, attributeName)
+{ var old_value = obj[attributeName];
+ obj[attributeName] = null;
+ assert_not_equals(obj[attributeName], null, "Attribute " + attributeName + " can be set to null.");
+ obj[attributeName] = old_value;
+}
+
+/**
+ * Method to check NoInterfaceObject
+ * Example usage:
+ * check_no_interface_object("BluetoothAdapter")
+ *
+ * @param interfaceName interface name
+ */
+function check_no_interface_object(interfaceName) {
+ assert_throws({name: "TypeError"}, function () {
+ tizen[interfaceName]();
+ },"Wrong call as a function");
+ assert_throws({name: "TypeError"}, function () {
+ new tizen[interfaceName]();
+ },"Wrong call as a new function");
+ assert_throws({name: "TypeError"}, function () {
+ ({}) instanceof tizen[interfaceName];
+ },"instanceof exception");
+ assert_equals(tizen[interfaceName], undefined, interfaceName + " is not undefined.");
+}
+
+
+/**
+ * Method to check Constructors
+ * Example usage:
+ * check_constructor("BluetoothAdapter")
+ *
+ * @param constructorName constructor name
+ */
+
+function check_constructor(constructorName) {
+ assert_true(constructorName in tizen, "No " + constructorName + " in tizen.");
+ assert_false({} instanceof tizen[constructorName],"Custom object is not instance of " + constructorName);
+ assert_throws({
+ name: "TypeError"
+ }, function () {
+ tizen[constructorName]();
+ }, "Constructor called as function.");
+}
+
+/**
+ * Method to check if given method can be overridden in a given object - (TEMPORARY REMOVED).
+ * That method also checks if given method exists in a given object.
+ * Example usage:
+ * check_method_exists(tizen.notification, "get");
+ *
+ * @param obj object with method
+ * @param methodName name of the method to check.
+ */
+function check_method_exists(obj, methodName) {
+ assert_type(obj[methodName], 'function', "Method does not exist.");
+}
+
+/**
+ * Method to check extensibility of given object.
+ * Method checks if new attribute and method can be added.
+ * Example usage:
+ * check_extensibility(tizen.notification);
+ *
+ * @param obj object to check
+ */
+function check_extensibility(obj) {
+ var dummyAttribute = "dummyAttributeValue", dummyMethodResult = "dummyMethodResultValue";
+ obj.newDummyMethod = function() {
+ return dummyMethodResult;
+ }
+ assert_equals(obj.newDummyMethod(), dummyMethodResult, "Incorrect result from added method.");
+
+ obj.newDummyAttribute = dummyAttribute;
+ assert_equals(obj.newDummyAttribute, dummyAttribute, "Incorrect result from added attribute.");
+}
+
+/**
+ * Method to check if attribute can be modify.
+ * Example usage:
+ * check_attr(downloadRequest, "fileName", default_val, "string", "file_name.html");
+ *
+ * @param obj object to test which has not readonly attribute
+ * @param attributeName attribute name.
+ * @param expectedValue expected value of provided attribute name
+ * @param expectedType expected type of provided attribute name
+ * @param valueToAssign value to assign in order to check if attribute value can be modified
+ */
+function check_attribute(obj, attributeName, expectedValue, expectedType, valueToAssign) {
+ if (expectedValue === valueToAssign) {
+ assert_unreached("Fix your test. The same values given for " + attributeName +
+ " in 'value' and 'valueToSet' arguments.");
+ }
+ if (typeof (attributeName) === "string") {
+ assert_true(attributeName in obj, "Name " + attributeName + " doesn't exist in provided object.");
+ assert_equals(obj[attributeName], expectedValue, "Value of " + attributeName + " is diffrent.");
+ if (typeof (expectedType) !== "undefined") {
+ if (expectedValue === null) {
+ assert_type(obj[attributeName], "object", "Type of " + attributeName + " is different.");
+ } else {
+ assert_type(obj[attributeName], expectedType, "Type of " + attributeName + " is different.");
+ }
+ } else {
+ assert_unreached("Fix your test. Wrong type " + expectedType);
+ }
+ obj[attributeName] = valueToAssign;
+ assert_equals(obj[attributeName], valueToAssign, attributeName + " can be modified.");
+ } else {
+ assert_unreached("Fix your test. Wrong type of name " + typeof (attributeName));
+ }
+}
+
+/**
+ * Method to check if whole array can be overwritten with an invalid value.
+ * Sample usage:
+ * check_invalid_array_assignments(message, "to", false);
+ *
+ * @param obj object which has the array as its property
+ * @param array name of the array to check
+ * @param isNullable indicates if the array can be null
+ */
+function check_invalid_array_assignments(obj, array, isNullable) {
+ var args = [undefined, true, false, NaN, 0, "TIZEN", {}, function () {}],
+ val = obj[array], i;
+
+ if (!isNullable) {
+ obj[array] = null;
+ assert_not_equals(obj[array], null, "Non-nullable array was set to null");
+ assert_type(obj[array], "array", "Non-nullable array type changed after assigning null");
+ assert_equals(obj[array].toString(), val.toString(), "Non-nullable array contents changed after assigning null");
+ }
+
+ for (i = 0 ; i < args.length ; i++) {
+ obj[array] = args[i];
+ assert_type(obj[array], "array", "Array type changed after assigning an invalid value");
+ assert_equals(obj[array].toString(), val.toString(), "Array contents changed after assigning an invalid value");
+ }
+}
+
+/**
+ * Method to check if an object can be overwritten with an invalid value.
+ * Sample usage:
+ * check_invalid_object_assignments(message, "body", false);
+ *
+ * @param parentObj object which has the 'obj' object as its property
+ * @param obj name of the object to check
+ * @param isNullable indicates if the object can be null
+ */
+function check_invalid_obj_assignments(parentObj, obj, isNullable) {
+ var args = [undefined, true, false, NaN, 0, "TIZEN", function () {}],
+ val = parentObj[obj], i;
+
+ if (!isNullable) {
+ parentObj[obj] = null;
+ assert_equals(parentObj[obj], val, "Non-nullable obj was modified after assigning null");
+ }
+
+ for (i = 0 ; i < args.length ; i++) {
+ parentObj[obj] = args[i];
+ assert_equals(parentObj[obj], val, "The object was set to " + args[i]);
+ }
+}
+
+/**
+ * Method to validate conversion for listeners.
+ * Example usage:
+ * incorrectListeners = getListenerConversionExceptions(["oninstalled", "onupdated", "onuninstalled"]);
+ * for(i = 0; i < incorrectListeners.length; i++) {
+ * packageInformationEventCallback = incorrectListeners[i][0];
+ * exceptionName = incorrectListeners[i][1];
+ * assert_throws({name : exceptionName},
+ * function () {
+ * tizen.package.setPackageInfoEventListener(packageInformationEventCallback);
+ * }, exceptionName + " should be thrown - given incorrect successCallback.");
+ * }
+ *
+ *
+ * @param callbackNames Array with names
+ * @returns {Array} table of tables which contain incorrect listener (index 0) and exceptionName (index 1)
+ *
+ */
+function getListenerConversionExceptions(callbackNames) {
+ var result = [], conversionTable, i, j, listenerName;
+ conversionTable = getTypeConversionExceptions("functionObject", false);
+
+ for (i = 0; i < callbackNames.length; i++) {
+ for (j = 0; j < conversionTable.length; j++) {
+ listenerName = {};
+ listenerName[callbackNames[i]] = conversionTable[j][0];
+ result.push([listenerName, conversionTable[j][1]]);
+ }
+ }
+
+ return result;
+}
</spec>
</specs>
</testcase>
- <testcase purpose="test whether the SEServiceManager object can have new attribute added" type="compliance" status="approved" component="TizenAPI/Communication/SE" execution_type="auto" priority="P3" id="SEService_extend">
+ <testcase purpose="Test whether the SEServiceManager object can have new attribute added" type="compliance" status="approved" component="TizenAPI/Communication/SE" execution_type="auto" priority="P3" id="SEService_extend">
<description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/SEService_extend.html</test_script_entry>
</description>
</spec>
</specs>
</testcase>
- <testcase purpose="getReaders - check argument successCallback validation - use {onsuccess: function (){}}" type="compliance" onload_delay="90" status="approved" component="TizenAPI/Communication/SE" execution_type="auto" priority="P2" id="SEService_getReaders_successCallback_invalid_cb">
+ <testcase purpose="GetReaders - check argument successCallback validation - use {onsuccess: function (){}}" type="compliance" onload_delay="90" status="approved" component="TizenAPI/Communication/SE" execution_type="auto" priority="P2" id="SEService_getReaders_successCallback_invalid_cb">
<description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/SEService_getReaders_successCallback_invalid_cb.html</test_script_entry>
</description>
</spec>
</specs>
</testcase>
- <testcase purpose="check if registerSEListener of SEService throws exception when argument is incorrect" type="compliance" onload_delay="90" status="approved" component="TizenAPI/Communication/SE" execution_type="auto" priority="P2" id="SEService_registerSEListener_listener_TypeMismatch">
+ <testcase purpose="Check if registerSEListener of SEService throws exception when argument is incorrect" type="compliance" onload_delay="90" status="approved" component="TizenAPI/Communication/SE" execution_type="auto" priority="P2" id="SEService_registerSEListener_listener_TypeMismatch">
<description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/SEService_registerSEListener_listener_TypeMismatch.html</test_script_entry>
</description>
</spec>
</specs>
</testcase>
- <testcase purpose="check if registerSEListener of SEService throws exception when listener is invalid Check argument listener validation - use simple function" type="compliance" status="approved" component="TizenAPI/Communication/SE" execution_type="auto" priority="P2" id="SEService_registerSEListener_listener_invalid_cb">
+ <testcase purpose="Check if registerSEListener of SEService throws exception when listener is invalid" type="compliance" status="approved" component="TizenAPI/Communication/SE" execution_type="auto" priority="P2" id="SEService_registerSEListener_listener_invalid_cb">
<description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/SEService_registerSEListener_listener_invalid_cb.html</test_script_entry>
</description>
</spec>
</specs>
</testcase>
- <testcase purpose="getReaders - check argument errorCallback validation - use {onerror: function (){}}" type="compliance" onload_delay="90" status="approved" component="TizenAPI/Communication/SE" execution_type="auto" priority="P2" id="SEService_getReaders_errorCallback_invalid_cb">
+ <testcase purpose="GetReaders - check argument errorCallback validation - use {onerror: function (){}}" type="compliance" onload_delay="90" status="approved" component="TizenAPI/Communication/SE" execution_type="auto" priority="P2" id="SEService_getReaders_errorCallback_invalid_cb">
<description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/SEService_getReaders_errorCallback_invalid_cb.html</test_script_entry>
</description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/TransmitSuccessCallback_notexist.html</test_script_entry>
</description>
</testcase>
- <testcase purpose="test whether the SEServiceManager object can have new attribute added" component="TizenAPI/Communication/SE" execution_type="auto" id="SEService_extend">
+ <testcase purpose="Test whether the SEServiceManager object can have new attribute added" component="TizenAPI/Communication/SE" execution_type="auto" id="SEService_extend">
<description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/SEService_extend.html</test_script_entry>
</description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/SEService_getReaders_successCallback_TypeMismatch.html</test_script_entry>
</description>
</testcase>
- <testcase purpose="getReaders - check argument successCallback validation - use {onsuccess: function (){}}" onload_delay="90" component="TizenAPI/Communication/SE" execution_type="auto" id="SEService_getReaders_successCallback_invalid_cb">
+ <testcase purpose="GetReaders - check argument successCallback validation - use {onsuccess: function (){}}" onload_delay="90" component="TizenAPI/Communication/SE" execution_type="auto" id="SEService_getReaders_successCallback_invalid_cb">
<description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/SEService_getReaders_successCallback_invalid_cb.html</test_script_entry>
</description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/SEService_getReaders_with_errorCallback.html</test_script_entry>
</description>
</testcase>
- <testcase purpose="check if registerSEListener of SEService throws exception when argument is incorrect" onload_delay="90" component="TizenAPI/Communication/SE" execution_type="auto" id="SEService_registerSEListener_listener_TypeMismatch">
+ <testcase purpose="Check if registerSEListener of SEService throws exception when argument is incorrect" onload_delay="90" component="TizenAPI/Communication/SE" execution_type="auto" id="SEService_registerSEListener_listener_TypeMismatch">
<description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/SEService_registerSEListener_listener_TypeMismatch.html</test_script_entry>
</description>
</testcase>
- <testcase purpose="check if registerSEListener of SEService throws exception when listener is invalid Check argument listener validation - use simple function" component="TizenAPI/Communication/SE" execution_type="auto" id="SEService_registerSEListener_listener_invalid_cb">
+ <testcase purpose="Check if registerSEListener of SEService throws exception when listener is invalid" component="TizenAPI/Communication/SE" execution_type="auto" id="SEService_registerSEListener_listener_invalid_cb">
<description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/SEService_registerSEListener_listener_invalid_cb.html</test_script_entry>
</description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/ChannelSuccessCallback_notexist.html</test_script_entry>
</description>
</testcase>
- <testcase purpose="getReaders - check argument errorCallback validation - use {onerror: function (){}}" onload_delay="90" component="TizenAPI/Communication/SE" execution_type="auto" id="SEService_getReaders_errorCallback_invalid_cb">
+ <testcase purpose="GetReaders - check argument errorCallback validation - use {onerror: function (){}}" onload_delay="90" component="TizenAPI/Communication/SE" execution_type="auto" id="SEService_getReaders_errorCallback_invalid_cb">
<description>
<test_script_entry>/opt/tct-secureelement-tizen-tests/secureelement/SEService_getReaders_errorCallback_invalid_cb.html</test_script_entry>
</description>