--- /dev/null
+----------------------------------------------
+License
+----------------------------------------------
+Copyright (c) 2020 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:
+ Qunfang Lin <qunfang.lin@samsung.com>
+
+
+
+----------------------------------------------
+Introduction
+----------------------------------------------
+This test suite is for testing VD Web API, which covers the following specifications:
+TBD
+
+----------------------------------------------
+Test Environment
+----------------------------------------------
+1. Testkit-stub must be installed on target device.
+2. Testkit-lite must be installed on test machine.
+
+----------------------------------------------
+Build and Run
+----------------------------------------------
+(Suppose you only get the source code and Testkit-Lite has been set up on your test machine.
+ If you have got tct-ml-tizen-tests ZIP packages, you can directly go to step 3 on the test machine;
+ if you have not installed Testkit-Lite, you need to install the latest version.)
+
+Steps:
+1. Prepare for building by running the following command:
+ cd tct-ml-tizen-tests
+
+2. Build ZIP package by running the following command:
+ ./pack.py -t wgt --sign platform
+
+3. Unzip the package on the test machine by running the following command:
+ unzip -o tct-ml-tizen-tests-<version>.zip -d /home/owner/share/tct
+
+4. Install the package on the test machine by running the following command:
+ /home/owner/share/tct/opt/tct-ml-tizen-tests/inst.sh
+
+5. Run test cases by running the following command on host:
+ testkit-lite -f device:/home/owner/share/tct/opt/tct-ml-tizen-tests/tests.xml -e "WRTLauncher" -o tct-ml-tizen-tests.results.xml
--- /dev/null
+#!/bin/bash
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+for i in `grep -r "0xA" /var/cynara/db/_ | grep $1`
+do
+ CLIENT=`echo $i | cut -d ";" -f1`
+ USER=`echo $i | cut -d ";" -f2`
+ PRIVILEGE=`echo $i | cut -d ";" -f3`
+ #echo "cyad --erase=\"\" -r=no -c $CLIENT -u $USER -p $PRIVILEGE"
+ cyad --erase="" -r=no -c $CLIENT -u $USER -p $PRIVILEGE
+done
--- /dev/null
+<widget id='http://tizen.org/test/tct-ml-tizen-tests' xmlns='http://www.w3.org/ns/widgets' xmlns:tizen='http://tizen.org/ns/widgets'>
+ <access origin="*"/>
+ <name>tct-ml-tizen-tests</name>
+ <icon src="icon.png" height="117" width="117"/>
+ <tizen:application id="machinelea.WebAPITizenMLTests" package="machinelea" required_version="6.5"/>
+ <tizen:setting screen-orientation="landscape"/>
+ <tizen:setting background-support="enable"/>
+ <tizen:privilege name="http://tizen.org/privilege/mediastorage"/>
+ <tizen:privilege name="http://tizen.org/privilege/externalstorage"/>
+</widget>
--- /dev/null
+#!/usr/bin/env python
+
+import os
+import shutil
+import glob
+import time
+import sys
+import subprocess
+from optparse import OptionParser, make_option\r
+import ConfigParser
+
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+PARAMETERS = None
+ADB_CMD = "adb"
+
+
+def doCMD(cmd):
+ # Do not need handle timeout in this short script, let tool do it
+ print "-->> \"%s\"" % cmd
+ output = []
+ cmd_return_code = 1
+ cmd_proc = subprocess.Popen(
+ cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
+
+ while True:
+ output_line = cmd_proc.stdout.readline().strip("\r\n")
+ cmd_return_code = cmd_proc.poll()
+ if output_line == '' and cmd_return_code != None:
+ break
+ sys.stdout.write("%s\n" % output_line)
+ sys.stdout.flush()
+ output.append(output_line)
+
+ return (cmd_return_code, output)
+
+
+def uninstPKGs():
+ action_status = True
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ for file in files:
+ if file.endswith(".apk"):
+ cmd = "%s -s %s uninstall org.xwalk.%s" % (
+ ADB_CMD, PARAMETERS.device, os.path.basename(os.path.splitext(file)[0]))
+ (return_code, output) = doCMD(cmd)
+ for line in output:
+ if "Failure" in line:
+ action_status = False
+ break
+ return action_status
+
+
+def instPKGs():
+ action_status = True
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ for file in files:
+ if file.endswith(".apk"):
+ cmd = "%s -s %s install %s" % (ADB_CMD,
+ PARAMETERS.device, os.path.join(root, file))
+ (return_code, output) = doCMD(cmd)
+ for line in output:
+ if "Failure" in line:
+ action_status = False
+ break
+ return action_status
+
+
+def main():
+ try:
+ usage = "usage: inst.py -i"
+ opts_parser = OptionParser(usage=usage)
+ opts_parser.add_option(
+ "-s", dest="device", action="store", help="Specify device")
+ opts_parser.add_option(
+ "-i", dest="binstpkg", action="store_true", help="Install package")
+ opts_parser.add_option(
+ "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
+ global PARAMETERS
+ (PARAMETERS, args) = opts_parser.parse_args()
+ except Exception, e:
+ print "Got wrong option: %s, exit ..." % e
+ sys.exit(1)
+
+ if not PARAMETERS.device:
+ (return_code, output) = doCMD("adb devices")
+ for line in output:
+ if str.find(line, "\tdevice") != -1:
+ PARAMETERS.device = line.split("\t")[0]
+ break
+
+ if not PARAMETERS.device:
+ print "No device found"
+ sys.exit(1)
+
+ if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
+ print "-i and -u are conflict"
+ sys.exit(1)
+
+ if PARAMETERS.buninstpkg:
+ if not uninstPKGs():
+ sys.exit(1)
+ else:
+ if not instPKGs():
+ sys.exit(1)
+
+if __name__ == "__main__":
+ main()
+ sys.exit(0)
--- /dev/null
+#!/usr/bin/env python
+
+import os
+import shutil
+import glob
+import time
+import sys
+import subprocess
+import string
+from optparse import OptionParser, make_option
+import ConfigParser
+
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+PKG_NAME = os.path.basename(SCRIPT_DIR)
+PARAMETERS = None
+#XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
+TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
+tct_parser = ConfigParser.ConfigParser()
+tct_parser.read(TCT_CONFIG_FILE)
+SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
+PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
+EXECUTION_MODE_30 = tct_parser.get('DEVICE', 'DEVICE_EXECUTION_MODE_30')
+ADMIN_USER_30 = tct_parser.get('DEVICE', 'DEVICE_ADMIN_USER_30')
+
+def userCheck():
+ global GLOVAL_OPT
+ if ADMIN_USER_30 == EXECUTION_MODE_30:
+ GLOVAL_OPT="--global"
+ else:
+ GLOVAL_OPT=""
+
+
+def askpolicyremoving():
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ for file in files:
+ if file.endswith(".wgt"):
+ pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0]))
+
+ print pkg_id
+ print (os.getcwd())
+ print (os.path.dirname(os.path.realpath(__file__)) )
+ if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)):
+ action_status = False
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell .%s/askpolicy.sh %s" % (PARAMETERS.device,
+ SRC_DIR, pkg_id)
+ return doCMD(cmd)
+
+def doCMD(cmd):
+ # Do not need handle timeout in this short script, let tool do it
+ print "-->> \"%s\"" % cmd
+ output = []
+ cmd_return_code = 1
+ cmd_proc = subprocess.Popen(
+ cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
+
+ while True:
+ output_line = cmd_proc.stdout.readline().strip("\r\n")
+ cmd_return_code = cmd_proc.poll()
+ if output_line == '' and cmd_return_code != None:
+ break
+ sys.stdout.write("%s\n" % output_line)
+ sys.stdout.flush()
+ output.append(output_line)
+
+ return (cmd_return_code, output)
+
+def updateCMD(cmd=None):
+ if "pkgcmd" in cmd:
+ cmd = "su - %s -c '%s;%s'" % (PARAMETERS.user, XW_ENV, cmd)
+ return cmd
+def getUSERID():
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell id -u %s" % (
+ PARAMETERS.device, PARAMETERS.user)
+ else:
+ cmd = "ssh %s \"id -u %s\"" % (
+ PARAMETERS.device, PARAMETERS.user )
+ return doCMD(cmd)
+
+
+def getPKGID(pkg_name=None):
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell %s" % (
+ PARAMETERS.device, updateCMD('pkgcmd -l'))
+ else:
+ cmd = "ssh %s \"%s\"" % (
+ PARAMETERS.device, updateCMD('pkgcmd -l'))
+
+ (return_code, output) = doCMD(cmd)
+ if return_code != 0:
+ return None
+
+ test_pkg_id = None
+ for line in output:
+ if line.find("[" + pkg_name + "]") != -1:
+ pkgidIndex = line.split().index("pkgid")
+ test_pkg_id = line.split()[pkgidIndex+1].strip("[]")
+ break
+ return test_pkg_id
+
+
+def doRemoteCMD(cmd=None):
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell %s" % (PARAMETERS.device, updateCMD(cmd))
+ else:
+ cmd = "ssh %s \"%s\"" % (PARAMETERS.device, updateCMD(cmd))
+
+ return doCMD(cmd)
+
+
+def doRemoteCopy(src=None, dest=None):
+ if PARAMETERS.mode == "SDB":
+ cmd_prefix = "sdb -s %s push" % PARAMETERS.device
+ cmd = "%s %s %s" % (cmd_prefix, src, dest)
+ else:
+ cmd = "scp -r %s %s:/%s" % (src, PARAMETERS.device, dest)
+
+ (return_code, output) = doCMD(cmd)
+ doRemoteCMD("sync")
+
+ if return_code != 0:
+ return True
+ else:
+ return False
+
+
+def uninstPKGs():
+ action_status = True
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ if root.endswith("mediasrc"):
+ continue
+
+ for file in files:
+ if file.endswith(".wgt"):
+ pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0]))
+ if not pkg_id:
+ action_status = False
+ continue
+ (return_code, output) = doRemoteCMD(
+ "pkgcmd %s -q -u -n %s" % (GLOVAL_OPT, pkg_id))
+ for line in output:
+ if "Failure" in line:
+ action_status = False
+ break
+
+ (return_code, output) = doRemoteCMD(
+ "rm -rf %s" % PKG_SRC_DIR)
+ if return_code != 0:
+ action_status = False
+
+ return action_status
+
+
+def instPKGs():
+ action_status = True
+ (return_code, output) = doRemoteCMD(
+ "mkdir -p %s" % PKG_SRC_DIR)
+ if return_code != 0:
+ action_status = False
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ if root.endswith("mediasrc"):
+ continue
+
+ for file in files:
+ if file.endswith("%s.wgt" % PKG_NAME):
+ if not doRemoteCopy(os.path.join(root, file), "%s/%s" % (SRC_DIR, file)):
+ action_status = False
+ (return_code, output) = doRemoteCMD(
+ "pkgcmd %s -i -t wgt -q -p %s/%s" % (GLOVAL_OPT, SRC_DIR, file))
+ doRemoteCMD("rm -rf %s/%s" % (SRC_DIR, file))
+ for line in output:
+ if "Failure" in line:
+ action_status = False
+ break
+
+ for item in glob.glob("%s/*" % SCRIPT_DIR):
+ if item.endswith(".wgt"):
+ continue
+ elif item.endswith("inst.py"):
+ continue
+ else:
+ item_name = os.path.basename(item)
+ if not doRemoteCopy(item, "%s/%s" % (PKG_SRC_DIR, item_name)):
+ action_status = False
+
+ return action_status
+
+
+def main():
+ try:
+ usage = "usage: inst.py -i"
+ opts_parser = OptionParser(usage=usage)
+ opts_parser.add_option(
+ "-m", dest="mode", action="store", help="Specify mode")
+ opts_parser.add_option(
+ "-s", dest="device", action="store", help="Specify device")
+ opts_parser.add_option(
+ "-i", dest="binstpkg", action="store_true", help="Install package")
+ opts_parser.add_option(
+ "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
+ opts_parser.add_option(
+ "-a", dest="user", action="store", help="User name")
+ global PARAMETERS
+ (PARAMETERS, args) = opts_parser.parse_args()
+ except Exception, e:
+ print "Got wrong option: %s, exit ..." % e
+ sys.exit(1)
+
+ if not PARAMETERS.user:
+ PARAMETERS.user = EXECUTION_MODE_30
+ if not PARAMETERS.mode:
+ PARAMETERS.mode = "SDB"
+
+ if PARAMETERS.mode == "SDB":
+ if not PARAMETERS.device:
+ (return_code, output) = doCMD("sdb devices")
+ for line in output:
+ if str.find(line, "\tdevice") != -1:
+ PARAMETERS.device = line.split("\t")[0]
+ break
+ else:
+ PARAMETERS.mode = "SSH"
+
+ if not PARAMETERS.device:
+ print "No device provided"
+ sys.exit(1)
+
+ userCheck()
+
+ user_info = getUSERID()
+ re_code = user_info[0]
+ if re_code == 0 :
+ global XW_ENV
+ userid = user_info[1][0]
+ XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
+ else:
+ print "[Error] cmd commands error : %s"%str(user_info[1])
+ sys.exit(1)
+ if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
+ print "-i and -u are conflict"
+ sys.exit(1)
+
+ if PARAMETERS.buninstpkg:
+ if not uninstPKGs():
+ sys.exit(1)
+ else:
+ if not instPKGs():
+ #askpolicyremoving()
+ sys.exit(1)
+
+if __name__ == "__main__":
+ main()
+ sys.exit(0)
--- /dev/null
+#!/usr/bin/env python
+
+import os
+import shutil
+import glob
+import time
+import sys
+import subprocess
+import string
+from optparse import OptionParser, make_option\r
+import ConfigParser
+
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+PKG_NAME = os.path.basename(SCRIPT_DIR)
+PARAMETERS = None
+#XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
+TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
+tct_parser = ConfigParser.ConfigParser()
+tct_parser.read(TCT_CONFIG_FILE)
+SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
+PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
+
+
+def doCMD(cmd):
+ # Do not need handle timeout in this short script, let tool do it
+ print "-->> \"%s\"" % cmd
+ output = []
+ cmd_return_code = 1
+ cmd_proc = subprocess.Popen(
+ cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
+
+ while True:
+ output_line = cmd_proc.stdout.readline().strip("\r\n")
+ cmd_return_code = cmd_proc.poll()
+ if output_line == '' and cmd_return_code != None:
+ break
+ sys.stdout.write("%s\n" % output_line)
+ sys.stdout.flush()
+ output.append(output_line)
+
+ return (cmd_return_code, output)
+
+
+def updateCMD(cmd=None):
+ if "pkgcmd" in cmd:
+ cmd = "su - %s -c '%s;%s'" % (PARAMETERS.user, XW_ENV, cmd)
+ return cmd
+def getUSERID():
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell id -u %s" % (
+ PARAMETERS.device, PARAMETERS.user)
+ else:
+ cmd = "ssh %s \"id -u %s\"" % (
+ PARAMETERS.device, PARAMETERS.user )
+ return doCMD(cmd)
+
+
+
+
+def getPKGID(pkg_name=None):
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell %s" % (
+ PARAMETERS.device, updateCMD('pkgcmd -l'))
+ else:
+ cmd = "ssh %s \"%s\"" % (
+ PARAMETERS.device, updateCMD('pkgcmd -l'))
+
+ (return_code, output) = doCMD(cmd)
+ if return_code != 0:
+ return None
+
+ test_pkg_id = None
+ for line in output:
+ if line.find("[" + pkg_name + "]") != -1:
+ pkgidIndex = line.split().index("pkgid")
+ test_pkg_id = line.split()[pkgidIndex+1].strip("[]")
+ break
+ return test_pkg_id
+
+
+def doRemoteCMD(cmd=None):
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell %s" % (PARAMETERS.device, updateCMD(cmd))
+ else:
+ cmd = "ssh %s \"%s\"" % (PARAMETERS.device, updateCMD(cmd))
+
+ return doCMD(cmd)
+
+
+def doRemoteCopy(src=None, dest=None):
+ if PARAMETERS.mode == "SDB":
+ cmd_prefix = "sdb -s %s push" % PARAMETERS.device
+ cmd = "%s %s %s" % (cmd_prefix, src, dest)
+ else:
+ cmd = "scp -r %s %s:/%s" % (src, PARAMETERS.device, dest)
+
+ (return_code, output) = doCMD(cmd)
+ doRemoteCMD("sync")
+
+ if return_code != 0:
+ return True
+ else:
+ return False
+
+
+def uninstPKGs():
+ action_status = True
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ if root.endswith("mediasrc"):
+ continue
+
+ for file in files:
+ if file.endswith(".xpk"):
+ pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0]))
+ if not pkg_id:
+ action_status = False
+ continue
+ (return_code, output) = doRemoteCMD(
+ "pkgcmd -u -t xpk -q -n %s" % pkg_id)
+ for line in output:
+ if "Failure" in line:
+ action_status = False
+ break
+
+ (return_code, output) = doRemoteCMD(
+ "rm -rf %s" % PKG_SRC_DIR)
+ if return_code != 0:
+ action_status = False
+
+ return action_status
+
+
+def instPKGs():
+ action_status = True
+ (return_code, output) = doRemoteCMD(
+ "mkdir -p %s" % PKG_SRC_DIR)
+ if return_code != 0:
+ action_status = False
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ if root.endswith("mediasrc"):
+ continue
+
+ for file in files:
+ if file.endswith(".xpk"):
+ if not doRemoteCopy(os.path.join(root, file), "%s/%s" % (SRC_DIR, file)):
+ action_status = False
+ (return_code, output) = doRemoteCMD(
+ "pkgcmd -i -t xpk -q -p %s/%s" % (SRC_DIR, file))
+ doRemoteCMD("rm -rf %s/%s" % (SRC_DIR, file))
+ for line in output:
+ if "Failure" in line:
+ action_status = False
+ break
+
+ # Do some special copy/delete... steps
+ '''
+ (return_code, output) = doRemoteCMD(
+ "mkdir -p %s/tests" % PKG_SRC_DIR)
+ if return_code != 0:
+ action_status = False
+
+ if not doRemoteCopy("specname/tests", "%s/tests" % PKG_SRC_DIR):
+ action_status = False
+ '''
+
+ return action_status
+
+
+def main():
+ try:
+ usage = "usage: inst.py -i"
+ opts_parser = OptionParser(usage=usage)
+ opts_parser.add_option(
+ "-m", dest="mode", action="store", help="Specify mode")
+ opts_parser.add_option(
+ "-s", dest="device", action="store", help="Specify device")
+ opts_parser.add_option(
+ "-i", dest="binstpkg", action="store_true", help="Install package")
+ opts_parser.add_option(
+ "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
+ opts_parser.add_option(
+ "-a", dest="user", action="store", help="User name")
+ global PARAMETERS
+ (PARAMETERS, args) = opts_parser.parse_args()
+ except Exception, e:
+ print "Got wrong option: %s, exit ..." % e
+ sys.exit(1)
+
+ if not PARAMETERS.user:
+ PARAMETERS.user = "owner"
+ if not PARAMETERS.mode:
+ PARAMETERS.mode = "SDB"
+
+ if PARAMETERS.mode == "SDB":
+ if not PARAMETERS.device:
+ (return_code, output) = doCMD("sdb devices")
+ for line in output:
+ if str.find(line, "\tdevice") != -1:
+ PARAMETERS.device = line.split("\t")[0]
+ break
+ else:
+ PARAMETERS.mode = "SSH"
+
+ if not PARAMETERS.device:
+ print "No device provided"
+ sys.exit(1)
+
+ user_info = getUSERID()
+ re_code = user_info[0]
+ if re_code == 0 :
+ global XW_ENV
+ userid = user_info[1][0]
+ XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
+ else:
+ print "[Error] cmd commands error : %s"%str(user_info[1])
+ sys.exit(1)
+ if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
+ print "-i and -u are conflict"
+ sys.exit(1)
+
+ if PARAMETERS.buninstpkg:
+ if not uninstPKGs():
+ sys.exit(1)
+ else:
+ if not instPKGs():
+ sys.exit(1)
+
+if __name__ == "__main__":
+ main()
+ sys.exit(0)
--- /dev/null
+{
+ "version": "6.5",
+ "name": "tct-ml-tizen-tests",
+ "permissions": ["tabs", "unlimited_storage", "notifications", "http://*/*", "https://*/*"],
+ "description": "tct-ml-tizen-tests",
+ "webapimanager": true,
+ "file_name": "manifest.json",
+ "app": {
+ "launch": {
+ "local_path": "index.html"
+ }
+ }
+}
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningManagerObject_ml_attribute</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningManagerObject_ml_attribute
+//==== LABEL Test whether MachineLearningManagerObject contains the attribute ml, has type object and is readonly
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManagerObject:ml A
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA AE AT ARO
+test(function () {
+ check_readonly(tizen, "ml", tizen.ml, "object", "dummyValue");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningManagerObject_notexist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningManagerObject_notexist
+//==== LABEL Check if interface MachineLearningManagerObject exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManagerObject:MachineLearningManagerObject U
+//==== SPEC_URL TBD
+//==== PRIORITY P3
+//==== TEST_CRITERIA NIO
+test(function () {
+ check_no_interface_object("MachineLearningManagerObject");
+}, document.title);
+
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningManager_checkNNFWAvailability</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningManager_checkNNFWAvailability
+//==== LABEL Checks if set Neural Network Framework with supported configuration return true value, otherwise false
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManager:checkNNFWAvailability M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR
+test(function () {
+ var nnfw, hw, returnedValue;
+
+ nnfw = "TENSORFLOW_LITE";
+ hw = "CPU";
+ returnedValue = tizen.ml.checkNNFWAvailability(nnfw, hw);
+ assert_type(returnedValue, "boolean", "Returned value should be bool");
+ assert_equals(returnedValue, true, "Returned value should be true");
+
+ nnfw = "ANY";
+ hw = "ANY";
+ returnedValue = tizen.ml.checkNNFWAvailability(nnfw, hw);
+ assert_type(returnedValue, "boolean", "Returned value should be bool");
+ assert_equals(returnedValue, false, "Returned value should be false");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningManager_checkNNFWAvailability_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningManager_checkNNFWAvailability_exist
+//==== LABEL Check if MachineLearningManager:checkNNFWAvailability method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManager:checkNNFWAvailability M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ check_method_exists(tizen.ml, "checkNNFWAvailability");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningManager_checkNNFWAvailability_hw_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningManager_checkNNFWAvailability_hw_TypeMismatch
+//==== LABEL Check if MachineLearningManager:checkNNFWAvailability() with incorrect hw type throws an exception
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManager:checkNNFWAvailability M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+test(function () {
+ var conversionTable, i, nnfw;
+ nnfw = "TENSORFLOW_LITE";
+
+ conversionTable = getTypeConversionExceptions("enum", false);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tizen.ml.checkNNFWAvailability(nnfw, conversionTable[i][0]);
+ }, "Exception should be thrown - given incorrect hw object");
+ }
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>MachineLearningManager_checkNNFWAvailability_misarg</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: MachineLearningManager_checkNNFWAvailability_hw_misarg\r
+//==== LABEL Check checkNNFWAvailability with missing hw argument\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManager:checkNNFWAvailability M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P2\r
+//==== TEST_CRITERIA MMA\r
+test(function () {\r
+ var nnfw;\r
+ nnfw = "TENSORFLOW_LITE";\r
+ assert_throws (TYPE_MISMATCH_EXCEPTION,function () {\r
+ tizen.ml.checkNNFWAvailability(nnfw, undefined);\r
+ }, "TypeMismatchError should be thrown, Method with missing non-optional argument.");\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningManager_checkNNFWAvailability_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningManager_checkNNFWAvailability_misarg
+//==== LABEL Check checkNNFWAvailability with missing all argument
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManager:checkNNFWAvailability M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ assert_throws (TYPE_MISMATCH_EXCEPTION,function () {
+ tizen.ml.checkNNFWAvailability();
+ }, "TypeMismatchError should be thrown, Method with missing non-optional argument.");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningManager_checkNNFWAvailability_nnfw_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningManager_checkNNFWAvailability_nnfw_TypeMismatch
+//==== LABEL Check if MachineLearningManager:checkNNFWAvailability() with incorrect nnfw type throws an exception
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManager:checkNNFWAvailability M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+test(function () {
+ var conversionTable, i, hw = "ANY";
+
+ conversionTable = getTypeConversionExceptions("enum", false);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tizen.ml.checkNNFWAvailability(conversionTable[i][0], hw);
+ }, "Exception should be thrown - given incorrect nnfw ");
+ }
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>MachineLearningManager_checkNNFWAvailability_misarg</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: MachineLearningManager_checkNNFWAvailability_nnfw_misarg\r
+//==== LABEL Check checkNNFWAvailability with missing all argument\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManager:checkNNFWAvailability M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P2\r
+//==== TEST_CRITERIA MMA\r
+test(function () {\r
+ var hw;\r
+ hw = "ANY";\r
+ assert_throws (TYPE_MISMATCH_EXCEPTION,function () {\r
+ tizen.ml.checkNNFWAvailability(undefined, hw);\r
+ }, "TypeMismatchError should be thrown, Method with missing non-optional argument.");\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningManager_extend</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningManager_extend
+//==== LABEL Check if MachineLearningManager object is extendable
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManager:MachineLearningManager U
+//==== SPEC_URL TBD
+//==== PRIORITY P3
+//==== TEST_CRITERIA OBX
+test(function () {
+ check_extensibility(tizen.ml);
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningManager_in_tizen</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningManager_in_tizen
+//==== LABEL This MachineLearningManager exists in tizens
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManager:MachineLearningManager U
+//==== SPEC_URL TBD
+//==== PRIORITY P3
+//==== TEST_CRITERIA OBME
+test(function () {
+ check_readonly(tizen, "ml", tizen.ml, "object", "dummyValue");
+}, document.title);
+
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningManager_notexist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningManager_notexist
+//==== LABEL Check if interface MachineLearningManager exists.
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManager:MachineLearningManager U
+//==== SPEC_URL TBD
+//==== PRIORITY P3
+//==== TEST_CRITERIA NIO
+test(function () {
+ check_no_interface_object("MachineLearningManager");
+}, document.title);
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningManager_pipeline_attribute</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningManager_pipeline_attribute
+//==== LABEL Test whether MachineLearningManager contains the attribute pipeline, has type object and is readonly
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManager:pipeline A
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA AE AT ARO
+test(function () {
+ check_readonly(tizen.ml, "pipeline", tizen.ml.pipeline, "object", "dummyValue");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningManager_single_attribute</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningManager_single_attribute
+//==== LABEL Test whether MachineLearningManager contains the attribute single, has type object and is readonly
+//==== SPEC Tizen Web API:TBD:MachineLearning:MachineLearningManager:single A
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA AE AT ARO
+test(function () {
+ check_readonly(tizen.ml, "single", tizen.ml.single, "object", "dummyValue");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorRawData_data_attribute</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorRawData_data_attribute
+//==== LABEL Check if attribute id of TensorRawData exists, has type TypeArray and is readonly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorRawData:data A
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA AE AT ARO
+test(function () {
+ var tensorsInfo, tensorsData, rawData, data;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
+ rawData = tensorsData.getTensorRawData(0, [1, 0], [3, 2]);
+ data = new Uint8Array([0, 1, 2, 3, 4, 5]);
+ check_readonly(rawData, "data", rawData.data, "object", data);
+ assert_true(rawData.data instanceof Uint8Array);
+ tensorsInfo.dispose();
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorRawData_notexist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorRawData_notexist
+//==== LABEL Check if interface TensorRawData exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorRawData:TensorRawData U
+//==== SPEC_URL TBD
+//==== PRIORITY P3
+//==== TEST_CRITERIA NIO
+test(function () {
+ check_no_interface_object("TensorRawData");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorRawData_shape_attribute</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorRawData_shape_attribute
+//==== LABEL Check if attribute id of TensorRawData exists, has type array and is readonly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorRawData:shape A
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA AE AT ARO
+test(function () {
+ var tensorsInfo, tensorsData, rawData;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
+ rawData = tensorsData.getTensorRawData(0, [1, 0], [3, 2]);
+ check_readonly(rawData, "shape", rawData.shape, "array", [1, 1, 1, 1]);
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorRawData_size_attribute</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorRawData_size_attribute
+//==== LABEL Check if attribute id of TensorRawData exists, has type size and is readonly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorRawData:size A
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA AE AT ARO
+test(function () {
+ var tensorsInfo, tensorsData, rawData;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
+ rawData = tensorsData.getTensorRawData(0, [1, 0], [3, 2]);
+ check_readonly(rawData, "size", rawData.size, "number", 1);
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_count_attribute</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_count_attribute
+//==== LABEL Check if attribute id of tensorsData exists, has type count and is readonly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:count A
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA AE AT ARO
+test(function () {
+ var tensorsInfo, tensorsData;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ check_readonly(tensorsData, "count", tensorsData.count, "long", 2);
+ tensorsData.dispose();
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_dispose</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_dispose
+//==== LABEL Check if TensorsData::dispose() method release memory
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:dispose M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MNA MNAST
+test(function () {
+ var tensorsInfo ,tensorsData, retVal;
+ add_result_callback(function () {
+ try {
+ tensorsInfo.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ retVal = tensorsData.dispose();
+ assert_type(retVal, "undefined", "method returned value");
+
+ assert_throws({name: 'AbortError'}, function () {
+ tensorsData.getTensorRawData(0);
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_dispose_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_dispose_exist
+//==== LABEL Check if MachineLearning:TensorsData:dispose method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:dispose M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo, tensorsData;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ check_method_exists(tensorsData, "dispose");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_dispose_extra_argument</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_dispose_extra_argument
+//==== LABEL Check using tensorsData::dispose() method with extra argument
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:dispose M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MNAEX
+test(function () {
+ var tensorsInfo, tensorsData;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ checkExtraArgument(tensorsData, "dispose");
+ tensorsData.dispose();
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_getTensorRawData</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_getTensorRawData
+//==== LABEL Check if TensorsData::getTensorRawData() method works properly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:getTensorRawData M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MMINA
+test(function () {
+ var tensorsInfo, tensorsData, rawData1, rawData2, rawData3;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT16", [3, 3]);
+ tensorsData = tensorsInfo.getTensorsData();
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8]);
+ //MMINA
+ //param 3
+ rawData1 = tensorsData.getTensorRawData(0, [0, 1], [-1, 1]);
+ data1 = new Uint8Array([3, 4, 5]);
+ shape1 = new Array(3, 1, 1, 1);
+ size1 = 6;
+ assert_type(rawData1.data, "object", "type of the returned value is not a byte");
+ assert_type(rawData1.shape, "array", "type of the returned value is not a array");
+ assert_type(rawData1.size, "number", "type of the returned value is not a byte");
+
+ assert_array_equals(rawData1.data, data1, "Returned data should be correct");
+ assert_array_equals(rawData1.shape, shape1, "Returned shape should be correct");
+ assert_equals(rawData1.size, size1, "Returned size should be correct");
+ //param 1
+ rawData2 = tensorsData.getTensorRawData(0);
+ data2 = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8]);
+ shape2 = new Array(3, 3, 1, 1);
+ size2 = 18;
+ assert_array_equals(rawData2.data, data2, "Returned data should be correct");
+ assert_array_equals(rawData2.shape, shape2, "Returned shape should be correct");
+ assert_equals(rawData2.size, size2, "Returned size should be correct");
+ //param 2
+ rawData3 = tensorsData.getTensorRawData(0, [1, 1]);
+ data3 = new Uint8Array([ 4, 5, 7, 8]);
+ shape3 = new Array(2, 2, 1, 1);
+ size3 = 8;
+ assert_array_equals(rawData3.data, data3, "Returned data should be correct");
+ assert_array_equals(rawData3.shape, shape3, "Returned shape should be correct");
+ assert_equals(rawData3.size, size3, "Returned size should be correct");
+
+ tensorsData.dispose();
+ tensorsInfo.dispose();
+}, document.title);
+
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsData_getTensorRawData_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsData_getTensorRawData_AbortError\r
+//==== LABEL Check if TensorsData::getTensorRawData() error occur throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:getTensorRawData M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MR MMINA\r
+test(function () {\r
+ var tensorsInfo, tensorsData;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 3]);\r
+ tensorsData = tensorsInfo.getTensorsData();\r
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8]);\r
+ tensorsData.dispose();\r
+ tensorsInfo.dispose();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ tensorsData.getTensorRawData(0);\r
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");\r
+\r
+}, document.title);\r
+ \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsData_getTensorRawData_InvalidValueError_1</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsData_getTensorRawData_InvalidValueError_1\r
+//==== LABEL Check if TensorsData::getTensorRawData() with incorrect argument value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:getTensorRawData M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsData.dispose();\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo, tensorsData;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 3]);\r
+ tensorsData = tensorsInfo.getTensorsData();\r
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8]);\r
+ //\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsData.getTensorRawData(0, [5, 5]);\r
+ }, "Location or size out of rank, Should throw InvalidValuesError exception");\r
+\r
+}, document.title);\r
+ \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsData_getTensorRawData_InvalidValueError_2</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsData_getTensorRawData_InvalidValueError_2\r
+//==== LABEL Check if TensorsData::getTensorRawData() with incorrect argument value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:getTensorRawData M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsData.dispose();\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo, tensorsData;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 3]);\r
+ tensorsData = tensorsInfo.getTensorsData();\r
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8]);\r
+ //\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsData.getTensorRawData(1);\r
+ }, "Index not exist, Should throw InvalidValuesError exception");\r
+\r
+}, document.title);\r
+ \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_getTensorRawData_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_getTensorRawData_exist
+//==== LABEL Check if MachineLearning:TensorsData:getTensorRawData method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:getTensorRawData M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo, tensorsData;
+ tensorsInfo= new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ check_method_exists(tensorsData, "getTensorRawData");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_getTensorRawData_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_getTensorRawData_misarg
+//==== LABEL Check if TensorsData::getTensorRawData() throws exception when index is missing
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:getTensorRawData M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ var tensorsInfo, tensorsData;
+ add_result_callback(function () {
+ try {
+ tensorsData.dispose();
+ tensorsInfo.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tensorsData.getTensorRawData();
+ },"Not given any getTensorRawData.");
+}, document.title);
+
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsData_getTensorRawData_with_location</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsData_getTensorRawData_with_location\r
+//==== LABEL Check if TensorsData::getTensorRawData() method works properly with optional argument location\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:getTensorRawData M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MOA MR\r
+test(function () {\r
+ var tensorsInfo, tensorsData, rawData, data, shape, size;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 3]);\r
+ tensorsData = tensorsInfo.getTensorsData();\r
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8]);\r
+ rawData = tensorsData.getTensorRawData(0, [1, 1]);\r
+ data = new Uint8Array([4, 5, 7, 8]);\r
+ shape = new Array(2, 2, 1, 1);\r
+ size = 4;\r
+ assert_type(rawData.data, "object", "type of the returned value is not a TypedArray");\r
+ assert_true(rawData.data instanceof Uint8Array);\r
+ assert_type(rawData.shape, "array", "type of the returned value is not a array");\r
+ assert_type(rawData.size, "number", "type of the returned value is not a byte");\r
+\r
+ assert_array_equals(rawData.data, data, "Returned data should be correct");\r
+ assert_array_equals(rawData.shape, shape, "Returned shape should be correct");\r
+ assert_equals(rawData.size, size, "Returned size should be correct");\r
+ tensorsData.dispose();\r
+ tensorsInfo.dispose();\r
+\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_getTensorRawData_with_size</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_getTensorRawData_with_size
+//==== LABEL Check if TensorsData::getTensorRawData() method works properly with optional argument size
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:getTensorRawData M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MOA MR
+test(function () {
+ var tensorsInfo, tensorsData, rawData, data, shape, size;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 3]);
+ tensorsData = tensorsInfo.getTensorsData();
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8]);
+ rawData = tensorsData.getTensorRawData(0, [0, 1], [-1, 1]);
+ data = new Uint8Array([3, 4, 5]);
+ shape = new Array(3, 1, 1, 1);
+ size = 3;
+ assert_type(rawData.data, "object", "type of the returned value is not a TypedArray");
+ assert_true(rawData.data instanceof Uint8Array);
+ assert_type(rawData.shape, "array", "type of the returned value is not a array");
+ assert_type(rawData.size, "number", "type of the returned value is not a byte");
+
+ assert_array_equals(rawData.data, data, "Returned data should be correct");
+ assert_array_equals(rawData.shape, shape, "Returned shape should be correct");
+ assert_equals(rawData.size, size, "Returned size should be correct");
+ tensorsData.dispose();
+ tensorsInfo.dispose();
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_notexist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_notexist
+//==== LABEL Check if interface TensorsData exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:TensorsData U
+//==== SPEC_URL TBD
+//==== PRIORITY P3
+//==== TEST_CRITERIA NIO
+test(function () {
+ check_no_interface_object("TensorsData");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_setTensorRawData</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_setTensorRawData
+//==== LABEL Check if TensorsData::setTensorRawData() method works properly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:setTensorRawData M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MMINA MAST
+test(function () {
+ var tensorsInfo, tensorsData, rawData, retValue, data;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ retValue = tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
+ assert_equals(retValue, undefined, "Returned data should be undefined");
+
+ rawData = tensorsData.getTensorRawData(0, [1, 0], [3, 2]);
+ data = new Uint8Array([1, 2, 3, 5, 6, 7]);
+ shape = new Array(3, 2, 1, 1);
+ size = 6;
+ assert_type(rawData.data, "object", "type of the returned value is not a TypeArray");
+ assert_true(rawData.data instanceof Uint8Array);
+ assert_type(rawData.shape, "array", "type of the returned value is not a array");
+ assert_type(rawData.size, "number", "type of the returned value is not a byte");
+
+ assert_array_equals(rawData.data, data, "Returned data should be correct");
+ assert_array_equals(rawData.shape, shape, "Returned shape should be correct");
+ assert_equals(rawData.size, size, "Returned size should be correct");
+
+ tensorsData.dispose();
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsData_setTensorRawData_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsData_setTensorRawData_AbortError\r
+//==== LABEL Check if TensorsData::setTensorRawData() any error occurs throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:setTensorRawData M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ var tensorsInfo, tensorsData;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 3]);\r
+ tensorsData = tensorsInfo.getTensorsData();\r
+ tensorsData.dispose();\r
+ tensorsInfo.dispose();\r
+ \r
+ assert_throws({name: 'AbortError'}, function () {\r
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8]);\r
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");\r
+\r
+}, document.title);\r
+ \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsData_setTensorRawData_InvalidValueError_1</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsData_setTensorRawData_InvalidValueError_1\r
+//==== LABEL Check if TensorsData::setTensorRawData() with incorrect argument value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:setTensorRawData M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsData.dispose();\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo, tensorsData;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 3]);\r
+ tensorsData = tensorsInfo.getTensorsData();\r
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8]);\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsData.setTensorRawData(0, [13], [5, 5]);\r
+ }, "Out of rank, Should throw InvalidValuesError exception");\r
+\r
+}, document.title);\r
+ \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsData_setTensorRawData_InvalidValueError_2</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsData_setTensorRawData_InvalidValueError_2\r
+//==== LABEL Check if TensorsData::setTensorRawData() with incorrect argument value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:setTensorRawData M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsData.dispose();\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo, tensorsData;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 3]);\r
+ tensorsData = tensorsInfo.getTensorsData();\r
+ ////buffer Raw tensor data to be set. If buffer is too small or too big, InvalidValuesError will be thrown.\r
+ \r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ,10 ,11, 12, 13, 14, 15]);\r
+ }, "buffer is too big, Should throw InvalidValuesError exception");\r
+\r
+}, document.title);\r
+ \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsData_setTensorRawData_InvalidValueError_3</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsData_setTensorRawData_InvalidValueError_3\r
+//==== LABEL Check if TensorsData::setTensorRawData() with incorrect argument value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:setTensorRawData M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsData.dispose();\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo, tensorsData;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 3]);\r
+ tensorsData = tensorsInfo.getTensorsData();\r
+ ////buffer Raw tensor data to be set. If buffer is too small or too big, InvalidValuesError will be thrown.\r
+ \r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsData.setTensorRawData(0, [0, 1, 2]);\r
+ }, "buffer is too small, Should throw InvalidValuesError exception");\r
+\r
+}, document.title);\r
+ \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_setTensorRawData_buffer_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_setTensorRawData_buffer_TypeMismatch
+//==== LABEL Check whether setTensorRawData() method called with invalid buffer throws an exception
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:setTensorRawData M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+test(function () {
+ add_result_callback(function () {
+ try {
+ tensorsData.dispose();
+ tensorsInfo.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var tensorsInfo, tensorsData, param = [null, undefined, 1, "aaa", {}];
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+
+ for (i = 0; i < param.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION,function () {
+ tensorsData.setTensorRawData(0, param[i]);
+ }, "Given incorrect buffer.");
+ }
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_setTensorRawData_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_setTensorRawData_exist
+//==== LABEL Check if MachineLearning:TensorsData:setTensorRawData method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:setTensorRawData M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ var tensorsData = tensorsInfo.getTensorsData();
+ check_method_exists(tensorsData, "setTensorRawData");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_setTensorRawData_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_setTensorRawData_misarg
+//==== LABEL Check if TensorsData::setTensorRawData() throws exception when arguments are missing
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:setTensorRawData M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ add_result_callback(function () {
+ try {
+ tensorsData.dispose();
+ tensorsInfo.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var tensorsInfo, tensorsData;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ assert_throws(TYPE_MISMATCH_EXCEPTION,function () {
+ tensorsData.setTensorRawData();
+ }, "Method was called without argument but exception was not thrown");
+
+}, document.title);
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsData_setTensorRawData_with_location</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsData_setTensorRawData_with_location\r
+//==== LABEL Check if TensorsData::setTensorRawData() method works properly with optional argument location\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:setTensorRawData M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MOA MR\r
+test(function () {\r
+ var tensorsInfo, tensorsData, rawData, data, shape, size;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 3]);\r
+ tensorsData = tensorsInfo.getTensorsData();\r
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8]);\r
+ tensorsData.setTensorRawData(0, [22], [2, 2]);\r
+\r
+ rawData = tensorsData.getTensorRawData(0);\r
+ data = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 22]);\r
+ shape = new Array(3, 3, 1, 1);\r
+ size = 9;\r
+ assert_type(rawData.data, "object", "type of the returned value is not a byte");\r
+ assert_true(rawData.data instanceof Uint8Array);\r
+ assert_type(rawData.shape, "array", "type of the returned value is not a array");\r
+ assert_type(rawData.size, "number", "type of the returned value is not a byte");\r
+\r
+ assert_array_equals(rawData.data, data, "Returned data should be correct");\r
+ assert_array_equals(rawData.shape, shape, "Returned shape should be correct");\r
+ assert_equals(rawData.size, size, "Returned size should be correct");\r
+ \r
+ tensorsData.dispose();\r
+ tensorsInfo.dispose();\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_setTensorRawData_with_size</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_setTensorRawData_with_size
+//==== LABEL Check if TensorsData::setTensorRawData() method works properly with optional argument size
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:setTensorRawData M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MOA MR
+test(function () {
+ var tensorsInfo, tensorsData, rawData;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 3]);
+ tensorsData = tensorsInfo.getTensorsData();
+ tensorsData.setTensorRawData(0, [0, 1, 2, 3, 4, 5, 6, 7, 8]);
+ tensorsData.setTensorRawData(0, [13], [1, 1], [1, 1]);
+
+ rawData = tensorsData.getTensorRawData(0);
+ data = new Uint8Array([0, 1, 2, 3, 13, 5, 6, 7, 8]);
+ shape = new Array(3, 3, 1, 1);
+ size = 9;
+ assert_type(rawData.data, "object", "type of the returned value is not a byte");
+ assert_true(rawData.data instanceof Uint8Array);
+ assert_type(rawData.shape, "array", "type of the returned value is not a array");
+ assert_type(rawData.size, "number", "type of the returned value is not a byte");
+
+ assert_array_equals(rawData.data, data, "Returned data should be correct");
+ assert_array_equals(rawData.shape, shape, "Returned shape should be correct");
+ assert_equals(rawData.size, size, "Returned size should be correct");
+
+ tensorsData.dispose();
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsData_tensorsInfo_attribute</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsData_tensorsInfo_attribute
+//==== LABEL Check if TensorsData:tensorsInfo attribute exists, has type object, is readonly and has proper default value
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsData:tensorsInfo A
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA AE AT ARO
+test(function () {
+ var tensorsInfo, tensorsData, oldValue, isEqual;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ //Note: tensorsData.TensorsInfo returns clone of tensorsData.TensorsInfo, it means that tensorsData.
+ //tensorsInfo != tensorsData.tensorsInfo. It differs by _id attribute. To check whether TensorsInfo are equal, one can use TensorsInfo.equals() method.
+ //check_readonly(tensorsData, "tensorsInfo", tensorsData.tensorsInfo, "object", "tensorsInfo: ");
+ assert_true("tensorsInfo" in tensorsData, "tensorsInfo doesn't exist in tensorsData object.");
+ assert_type(tensorsData.tensorsInfo, "object", "tensorsInfo should be a object type");
+
+ oldValue = tensorsData.tensorsInfo;
+ tensorsData.tensorsInfo = "dummyValue";
+ isEqual = oldValue.equals(tensorsData.tensorsInfo);
+ assert_equals(isEqual, true, "tensorsInfo should not be modified.");
+
+ tensorsData.dispose();
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_addTensorInfo</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_addTensorInfo
+//==== LABEL Check if TensorsInfo:addTensorInfo() work properly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:addTensorInfo M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MAST MMINA
+
+
+test(function () {
+ var tensorsInfo, retValue;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ retValue = tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ assert_type(retValue, "long", "type of the returned value is not long type");
+ assert_equals(retValue, 0, "Returned data should be right index");
+
+ TensorName = tensorsInfo.getTensorName(0);
+ assert_type(TensorName, "string", "type of the returned value is not a domstring");
+ assert_equals(TensorName, "tensor", "Returned data should be correct");
+
+ tensorType = tensorsInfo.getTensorType(0);
+ assert_type(tensorType, "string", "tensorType isn't an string type");
+ assert_equals(tensorType, "UINT8" , "the returned value should be correct");
+
+ Dimensions = tensorsInfo.getDimensions(0);
+ Dimensions1 = new Array(4, 4, 1, 1);
+ assert_array_equals(Dimensions, Dimensions1, "getDimensions of tensor in tensorsInfo incorrect");
+
+ retValue = tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4, 4, 4, 4]);
+ assert_type(retValue, "long", "type of the returned value is not long type");
+ assert_equals(retValue, 1, "Returned data should be right index");
+
+ tensorsInfo.dispose();
+}, document.title);
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_addTensorInfo_AbortError_1</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_addTensorInfo_AbortError_1\r
+//==== LABEL Check if TensorsInfo::addTensorInfo() error occurs throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:addTensorInfo M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P2\r
+//==== TEST_CRITERIA MC\r
+\r
+test(function () {\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.dispose();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);\r
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_addTensorInfo_AbortError_2</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_addTensorInfo_AbortError_2\r
+//==== LABEL Check if TensorsInfo::addTensorInfo() error occurs throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:addTensorInfo M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P2\r
+//==== TEST_CRITERIA MC\r
+\r
+//TensorsInfo object can hold information about up to 16 tensors. \r
+//An attempt to add more tensors will trigger AbortError.\r
+test(function () {\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor2", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor3", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor4", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor5", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor6", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor7", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor8", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor9", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor10", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor11", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor12", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor13", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor14", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor15", "UINT8", [4, 4]);\r
+ tensorsInfo.addTensorInfo("tensor16", "UINT8", [4, 4]);\r
+\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ tensorsInfo.addTensorInfo("tensor17", "UINT8", [4, 4]);\r
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_addTensorInfo_InvalidValueError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_addTensorInfo_InvalidValueError\r
+//==== LABEL Check if TensorsInfo::addTensorInfo with incorrect argument value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:addTensorInfo M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [-3, -2]);\r
+ }, "Should throw InvalidValuesError exception");\r
+\r
+}, document.title);\r
+ \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_addTensorInfo_type_TypeMismatch</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_addTensorInfo_dimension_TypeMismatch\r
+//==== LABEL Check if TensorsInfo::addTensorInfo() with incorrect type argument throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:addTensorInfo M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P2\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ var tensorsInfo, conversionTable;\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ conversionTable = getTypeConversionExceptions("array", false);\r
+ for (i = 0; i < conversionTable.length; i++) {\r
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", conversionTable[i][0]);\r
+ }, "Exception should be thrown - given incorrect type");\r
+ }\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_addTensorInfo_dimension_misarg</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_addTensorInfo_dimension_misarg\r
+//==== LABEL Check if TensorsInfo::addTensorInfo() throws exception when specific argument are missing\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:addTensorInfo M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P2\r
+//==== TEST_CRITERIA MMA\r
+test(function () {\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ assert_throws(TYPE_MISMATCH_EXCEPTION,function () {\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", undefined);\r
+ }, "Method was called without argument but exception was not thrown");\r
+ \r
+}, document.title); \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_addTensorInfo_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_addTensorInfo_exist
+//==== LABEL Check if MachineLearning:TensorsInfo:addTensorInfo method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:addTensorInfo M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo = new tizen.ml.TensorsInfo();
+ check_method_exists(tensorsInfo, "addTensorInfo");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_addTensorInfo_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_addTensorInfo_misarg
+//==== LABEL Check if TensorsInfo::addTensorInfo() throws exception when arguments are missing
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:addTensorInfo M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ var tensorsInfo;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ assert_throws(TYPE_MISMATCH_EXCEPTION,function () {
+ tensorsInfo.addTensorInfo();
+ }, "Method was called without argument but exception was not thrown");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_addTensorInfo_type_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_addTensorInfo_type_TypeMismatch
+//==== LABEL Check if TensorsInfo::addTensorInfo() with incorrect type argument throws an exception
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:addTensorInfo M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+test(function () {
+ var tensorsInfo;
+ add_result_callback(function () {
+ try {
+ tensorsInfo.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ conversionTable = getTypeConversionExceptions("enum", false);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tensorsInfo.addTensorInfo("tensor", conversionTable[i][0], [4, 4]);
+ }, "Exception should be thrown - given incorrect type");
+ }
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_addTensorInfo_type_misarg</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_addTensorInfo_type_misarg\r
+//==== LABEL Check if TensorsInfo::addTensorInfo() throws exception when specific argument are missing\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:addTensorInfo M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P2\r
+//==== TEST_CRITERIA MMA\r
+test(function () {\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ assert_throws(TYPE_MISMATCH_EXCEPTION,function () {\r
+ tensorsInfo.addTensorInfo("tensor", undefined, [4, 4]);\r
+ }, "Method was called without argument but exception was not thrown");\r
+ \r
+}, document.title); \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_clone</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_clone
+//==== LABEL Check if TensorsInfo::clone() method clone the tensorsInfo object properly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:clone M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MNA MAST
+test(function () {
+ var tensorsInfo, tensorsInfo1, isEqual;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo1 = tensorsInfo.clone();
+ isEqual = tensorsInfo1.equals(tensorsInfo);
+ assert_equals(isEqual, true, "isEqual should be true.");
+ tensorsInfo1.dispose();
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_clone_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_clone_exist
+//==== LABEL Check if MachineLearning:TensorsInfo:clone method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:clone M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo, retValue;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ check_method_exists(tensorsInfo, "clone");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_clone_extra_argument</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_clone_extra_argument
+//==== LABEL Check using TensorsInfo:clone() with extra argument to get current TensorsInfo object
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:clone M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MNAEX
+test(function () {
+ var tensorsInfo;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ checkExtraArgument(tensorsInfo, "clone");
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_count_attribute</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_count_attribute
+//==== LABEL LABEL Check if attribute count of TensorsInfo exists, has type TensorsInfo and is readonly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:count A
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA AE AT ARO
+test(function () {
+ var tensorsInfo;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ check_readonly(tensorsInfo, "count", tensorsInfo.count, "unsigned long", 111);
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_dispose</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_dispose
+//==== LABEL Check if TensorsInfo::dispose() method release memory
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:dispose M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MNA MNAST
+//TO DO test
+test(function () {
+ var tensorsInfo ,tensorsData, retVal;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ retVal = tensorsInfo.dispose();
+ assert_type(retVal, "undefined", "method returned value");
+
+ assert_throws({name: 'AbortError'}, function () {
+ tensorsInfo.getTensorsData();
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_dispose_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_dispose_exist
+//==== LABEL Check if MachineLearning:TensorsInfo:dispose method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:dispose M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo = new tizen.ml.TensorsInfo();
+ check_method_exists(tensorsInfo, "dispose");
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_dispose_extra_argument</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_dispose_extra_argument
+//==== LABEL LABEL Check using TensorsInfo::dispose() method with extra argument
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:dispose M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MNAEX
+test(function () {
+ var tensorsInfo;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ checkExtraArgument(tensorsInfo, "dispose");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_equals</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_equals
+//==== LABEL Check if TensorsInfo has the same contents, false otherwise
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:equals M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR
+test(function () {
+ var tensorsInfo1, tensorsInfo2, tensorsInfo3, isEqual;
+ tensorsInfo1 = new tizen.ml.TensorsInfo();
+ tensorsInfo1.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsInfo2 = new tizen.ml.TensorsInfo();
+ tensorsInfo2.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsInfo3 = new tizen.ml.TensorsInfo();
+ tensorsInfo3.addTensorInfo("tensor", "UINT8", [2, 3])
+ isEqual = tensorsInfo1.equals(tensorsInfo2);
+ assert_type(isEqual, "boolean", "isEqual should be bool.")
+ assert_equals(isEqual, true, "isEqual should be true.");
+ isEqual = tensorsInfo1.equals(tensorsInfo3);
+ assert_equals(isEqual, false, "isEqual should be false.");
+ tensorsInfo1.dispose();
+ tensorsInfo2.dispose();
+ tensorsInfo3.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_equals_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_equals_exist
+//==== LABEL Check if MachineLearning:TensorsInfo:equals method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:equals M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo = new tizen.ml.TensorsInfo();
+ check_method_exists(tensorsInfo, "equals");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_equals_invalid_obj</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_equals_invalid_obj
+//==== LABEL Check if TensorsInfo:equals method throw exception when a fake system object was passed
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:equals M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MTO
+test(function () {
+ add_result_callback(function () {
+ try {
+ tensorsInfo1.dispose();
+ tensorsInfo2.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var tensorsInfo1 ,tensorsInfo2;
+ tensorsInfo1 = new tizen.ml.TensorsInfo();
+ tensorsInfo1.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsInfo2 = {
+ name: "tensor",
+ type: "UINT8",
+ dimensions:[4, 4]
+ };
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tensorsInfo1.equals(tensorsInfo2);
+ }, "Fake system object was passed but exception wasn't thrown");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_equals_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_equals_misarg
+//==== LABEL Check if MachineLearning:TensorsInfo:equals() throws exception when TensorsInfo is missing
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:equals M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ add_result_callback(function () {
+ try {
+ tensorsInfo1.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var tensorsInfo1 = new tizen.ml.TensorsInfo();
+ tensorsInfo1.addTensorInfo("tensor", "UINT8", [4, 4]);
+
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tensorsInfo1.equals();
+ }, "Not given any argument.");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_equals_other_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_equals_other_TypeMismatch
+//==== LABEL Check if MachineLearning:TensorsInfo:equals() with converted TensorInfo type throws an exception
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:equals M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+test(function () {
+ add_result_callback(function () {
+ try {
+ tensorsInfo1.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var tensorsInfo1 = new tizen.ml.TensorsInfo();
+ tensorsInfo1.addTensorInfo("tensor", "UINT8", [4, 4]);
+
+ var conversionTable, i;
+ conversionTable = getTypeConversionExceptions("object", false);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tensorsInfo1.equals(conversionTable[i][0]);
+ }, "TypeMismatchError should be thrown - given incorrect TensorsInfo object");
+ }
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_exist
+//==== LABEL Check if TensorsInfo method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:TensorsInfo C
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA CONSTRF
+test(function () {
+ assert_true("TensorsInfo" in tizen.ml, "TensorsInfo does not exist");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getDimensions</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getDimensions
+//==== LABEL Check if TensorsInfo:getDimensions() work properly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getDimensions M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR
+test(function () {
+ var tensorsInfo, dimension1, retValue1;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [1, 1]);
+ retValue1 = tensorsInfo.getDimensions(0);
+ dismension1 = new Array(1, 1, 1, 1);
+ assert_type(retValue1, "array", "returned value should be long[] type");
+ assert_array_equals(retValue1, dismension1, "returned value should be correct value");
+ //dimensions Array with tensor's dimensions to be set. Each value determines number of elements in each dimension. Valid array contains only postive numbers.
+ //The maximum supported rank is 4. Values on bigger indexes will be discarded. In case when dimensions' length is less than 4,
+ //remaining values will be filled with 1.
+ tensorsInfo.addTensorInfo("tensor2", "UINT8", [3, 3, 3, 3, 3, 3, 3]);
+ retValue2 = tensorsInfo.getDimensions(1);
+ dismension2 = new Array(3, 3, 3, 3);
+ assert_type(retValue2, "array", "returned value should be long[] type");
+ assert_array_equals(retValue2, dismension2, "returned value should be correct value");
+
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_addTensorInfo_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_getDimensions_AbortError\r
+//==== LABEL Check if TensorsInfo::getDimensions() error occurs throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo::getDimensions M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P2\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [1, 1]);\r
+ tensorsInfo.dispose();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ tensorsInfo.getDimensions(0);\r
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_getDimensions_InvalidValueError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_getDimensions_InvalidValueError\r
+//==== LABEL Check if TensorsInfo::getDimensions with incorrect argument value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getDimensions M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [1, 1]);\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsInfo.getDimensions(-111);\r
+ }, "Error Index, Should throw InvalidValuesError exception"); \r
+}, document.title); \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getDimensions_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getDimensions_exist
+//==== LABEL Check if MachineLearning:TensorsInfo:getDimensions method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getDimensions M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo = new tizen.ml.TensorsInfo();
+ check_method_exists(tensorsInfo, "getDimensions");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getDimensions_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getDimensions_misarg
+//==== LABEL LABEL Check using TensorsInfo::getDimensions() method with extra argument
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getDimensions M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ add_result_callback(function () {
+ try {
+ tensorsInfo.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var tensorsInfo;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ assert_throws(TYPE_MISMATCH_EXCEPTION,function () {
+ tensorsInfo.getDimensions();
+ }, "Method was called without argument but exception was not thrown");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getTensorName</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getTensorName
+//==== LABEL Check if TensorsInfo:getTensorName() work properly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorName M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR
+test(function () {
+ var tensorsInfo, TensorName;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ TensorName = tensorsInfo.getTensorName(0);
+ assert_type(TensorName, "string", "type of the returned value is not a domstring");
+ assert_equals(TensorName, "tensor", "Returned data should be correct");
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_getTensorName_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_getTensorName_AbortError\r
+//==== LABEL Check if TensorsInfo:getTensorName() with error occured throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorName M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);\r
+ tensorsInfo.dispose();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ tensorsInfo.getTensorName(0);\r
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");\r
+}, document.title); \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_getTensorName_InvalidValueError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_getTensorName_InvalidValueError\r
+//==== LABEL Check if TensorsInfo:getTensorName() with incorrect argument value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorName M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsInfo.getTensorName(2);\r
+ }, "No such index, Should throw InvalidValuesError exception");\r
+}, document.title); \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getTensorName_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getTensorName_exist
+//==== LABEL Check if MachineLearning:TensorsInfo:getTensorName() method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorName M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo = new tizen.ml.TensorsInfo();
+ check_method_exists(tensorsInfo, "getTensorName");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getTensorName_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== LABEL Check if TensorsInfo::getTensorName() throws exception when arguments are missing
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorName M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ add_result_callback(function () {
+ try {
+ tensorsInfo.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var tensorsInfo;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ assert_throws(TYPE_MISMATCH_EXCEPTION,function () {
+ tensorsInfo.getTensorName();
+ }, "Method was called without argument but exception was not thrown");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getTensorSize</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getTensorSize
+//==== LABEL Check if TensorsInfo:getTensorSize() work properly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorSize M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR
+test(function () {
+ var tensorsInfo, tensorSize1, tensorSize2, tensorSize3;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [2, 2]);
+ tensorsInfo.addTensorInfo("tensor2", "INT16", [4, 5, 3]);
+ tensorSize1 = tensorsInfo.getTensorSize(0);
+ tensorSize2 = tensorsInfo.getTensorSize(1);
+ tensorSize3 = tensorsInfo.getTensorSize(-1);
+ assert_type(tensorSize1, "long", "tensorSize isn't an long type");
+ assert_equals(tensorSize1, 4 , "the returned value should be correct");
+ assert_equals(tensorSize2, 120, "the returned value should be correct");
+ assert_equals(tensorSize3, 124, "the returned value should be correct");
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_getTensorSize_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_getTensorSize_AbortError\r
+//==== LABEL Check if TensorsInfo:getTensorSize() with error occured throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorSize M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+\r
+test(function () {\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [2, 2]);\r
+ tensorsInfo.dispose();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ tensorsInfo.getTensorSize(0);\r
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_getTensorName_InvalidValueError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_getTensorSize_InvalidValueError\r
+//==== LABEL Check if TensorsInfo::getTensorSize() with incorrect argument value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo::getTensorSize M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsInfo.getTensorSize(2.55);\r
+ }, "No such index, Should throw InvalidValuesError exception");\r
+}, document.title); \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getTensorSize_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getTensorSize_exist
+//==== LABEL Check if MachineLearning:TensorsInfo:getTensorSize method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorSize M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo = new tizen.ml.TensorsInfo();
+ check_method_exists(tensorsInfo, "getTensorSize");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getTensorSize_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getTensorSize_misarg
+//==== LABEL Check if TensorsInfo::getTensorSize() throws exception when arguments are missing
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorSize M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ add_result_callback(function () {
+ try {
+ tensorsInfo.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var tensorsInfo;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ assert_throws(TYPE_MISMATCH_EXCEPTION,function () {
+ tensorsInfo.getTensorSize();
+ }, "Method was called without argument but exception was not thrown");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getTensorType</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getTensorType
+//==== LABEL Check if TensorsInfo:getTensorType() method works properly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorType M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR
+test(function () {
+ var tensorsInfo, tensorType1, tensorType2;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [2, 2]);
+ tensorsInfo.addTensorInfo("tensor2", "INT16", [4, 5, 3]);
+ tensorType1 = tensorsInfo.getTensorType(0);
+ tensorType2 = tensorsInfo.getTensorType(1);
+ assert_type(tensorType1, "string", "tensorType isn't an string type");
+ assert_equals(tensorType1, "UINT8" , "the returned value should be correct");
+ assert_equals(tensorType2, "INT16", "the returned value should be correct");
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_getTensorType_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_getTensorType_AbortError\r
+//==== LABEL Check if TensorsInfo:getTensorType() with error occured throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorType M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+\r
+test(function () {\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [2, 2]);\r
+ tensorsInfo.dispose();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ tensorsInfo.getTensorType(0);\r
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_getTensorType_InvalidValueError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_getTensorType_InvalidValueError\r
+//==== LABEL Check if TensorsInfo::getTensorType() with incorrect argument value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo::getTensorType M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsInfo.getTensorType(-2);\r
+ }, "No such index, Should throw InvalidValuesError exception");\r
+}, document.title); \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getTensorType_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getTensorType_exist
+//==== LABEL Check if MachineLearning:TensorsInfo:getTensorType method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorType M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo = new tizen.ml.TensorsInfo();
+ check_method_exists(tensorsInfo, "getTensorType");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getTensorType_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getTensorType_misarg
+//==== LABEL LABEL Check using TensorsInfo::getTensorType() method with extra argument
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorType M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ var tensorsInfo;
+ add_result_callback(function () {
+ try {
+ tensorsInfo.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ assert_throws(TYPE_MISMATCH_EXCEPTION,function () {
+ tensorsInfo.getTensorType();
+ }, "Method was called without argument but exception was not thrown");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getTensorsData</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getTensorsData
+//==== LABEL Check if TensorsInfo::getTensorsData() work properly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorsData M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MNA
+test(function () {
+ var tensorsInfo, tensorsData;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ tensorsData = tensorsInfo.getTensorsData();
+ assert_type(tensorsData, "object", "type of the returned value is not a object");
+ tensorsData.dispose();
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_getTensorsData_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_getTensorsData_AbortError\r
+//==== LABEL Check if TensorsInfo::getTensorsData() error occurs throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorsData M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);\r
+ tensorsInfo.dispose();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ tensorsInfo.getTensorsData();\r
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getTensorsData_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getTensorsData_exist
+//==== LABEL Check if MachineLearning:TensorsInfo:getTensorsData method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorsData M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo = new tizen.ml.TensorsInfo();
+ check_method_exists(tensorsInfo, "getTensorsData");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_getTensorsData_extra_argument</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_getTensorsData_extra_argument
+//==== LABEL Check using tensorsData::getTensorsData() method with extra argument
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:getTensorsData M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MNAEX
+test(function () {
+ var tensorsInfo, tensorsData;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+ checkExtraArgument(tensorsInfo, "getTensorsData");
+ tensorsInfo.dispose();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_setDimensions</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_setDimensions
+//==== LABEL Check if TensorsInfo:setDimensions() work properly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setDimensions M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MAST
+test(function () {
+ var tensorsInfo, retValue, Dimensions1, Dimensions2, Dimensions3, Dimensions4;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [2, 2]);
+ Dimensions1 = tensorsInfo.getDimensions(0);
+ Dimensions2 = new Array(2, 2, 1, 1);
+ assert_array_equals(Dimensions1, Dimensions2, "getDimensions of tensor in tensorsInfo incorrect");
+
+ retValue = tensorsInfo.setDimensions(0, [4, 4, 4, 4]);
+ assert_type(retValue, "undefined", "return value should be unidefined");
+ Dimensions3 = tensorsInfo.getDimensions(0);
+ Dimensions4 = new Array(4, 4, 4, 4);
+ assert_array_equals(Dimensions3, Dimensions4, "getDimensions of tensor in tensorsInfo incorrect");
+ tensorsInfo.dispose();
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_setDimensions_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_setDimensions_AbortError\r
+//==== LABEL Check if TensorsInfo:setDimensions() with error occured throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setDimensions M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+\r
+test(function () {\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [2, 2]);\r
+ tensorsInfo.dispose();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ tensorsInfo.setDimensions(0, [4, 4, 4, 4]);\r
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_setDimensions_InvalidValueError_1</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_setDimensions_InvalidValueError_1\r
+//==== LABEL Check if TensorsInfo::setDimensions() with incorrect index value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo::setDimensions M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsInfo.setDimensions(-2, [4, 4]);\r
+ }, "No such index, Should throw InvalidValuesError exception");\r
+}, document.title); \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_setDimensions_InvalidValueError_2</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_setDimensions_InvalidValueError_2\r
+//==== LABEL Check if TensorsInfo::setDimensions() with incorrect dismension value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo::setDimensions M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsInfo.setDimensions(0, [-4, -4]);\r
+ }, "invalid dismension, Should throw InvalidValuesError exception");\r
+}, document.title); \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_setDimensions_TypeMismatch</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_setDimensions_TypeMismatch\r
+//==== LABEL Check if TensorsInfo::setDimensions() with incorrect type argument throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setDimensions M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P2\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ var tensorsInfo, conversionTable;\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ conversionTable = getTypeConversionExceptions("array", false);\r
+ for (i = 0; i < conversionTable.length; i++) {\r
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {\r
+ tensorsInfo.setDimensions(0, conversionTable[i][0]);\r
+ }, "Exception should be thrown - given incorrect type");\r
+ }\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_setDimensions_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_setDimensions_exist
+//==== LABEL Check if MachineLearning:TensorsInfo:setDimensions method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setDimensions M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo = new tizen.ml.TensorsInfo();
+ check_method_exists(tensorsInfo, "setDimensions");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_setDimensions_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_setDimensions_misarg
+//==== LABEL LABEL Check using TensorsInfo::setDimensions() method with extra argument
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setDimensions M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ add_result_callback(function () {
+ try {
+ tensorsInfo.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var tensorsInfo;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ assert_throws(TYPE_MISMATCH_EXCEPTION,function () {
+ tensorsInfo.setDimensions();
+ }, "Method was called without argument but exception was not thrown");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_setTensorName</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_setTensorName
+//==== LABEL Check if TensorsInfo:setTensorName() work properly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setTensorName M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MAST
+test(function () {
+ var tensorsInfo, retValue, tensorName1, tensorName2, tensorName3;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [2, 2]);
+ tensorName1 = tensorsInfo.getTensorName(0);
+ assert_equals(tensorName1, "tensor1", "getTensorName of tensor in tensorsInfo incorrect");
+
+ retValue = tensorsInfo.setTensorName(0, "different_name");
+ assert_type(retValue, "undefined", "return value should be unidefined");
+ tensorName2 = tensorsInfo.getTensorName(0);
+ assert_equals(tensorName2, "different_name", "getTensorName of tensor in tensorsInfo incorrect");
+
+ retValue = tensorsInfo.setTensorName(0, "");
+ tensorName3 = tensorsInfo.getTensorName(0);
+ assert_equals(tensorName3, "", "getTensorName of tensor in tensorsInfo incorrect");
+ tensorsInfo.dispose();
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_setTensorName_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_setTensorName_AbortError\r
+//==== LABEL Check if TensorsInfo:setTensorName() with error occured throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setTensorName M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+\r
+test(function () {\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [2, 2]);\r
+ tensorsInfo.dispose();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ tensorsInfo.setTensorName(0, "tensor2");\r
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_setTensorName_InvalidValueError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_setTensorName_InvalidValueError\r
+//==== LABEL Check if TensorsInfo::setTensorName() with incorrect index value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo::setTensorName M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsInfo.setTensorName(-2, "tensor1");\r
+ }, "No such index, Should throw InvalidValuesError exception");\r
+}, document.title); \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_setTensorName_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_setTensorName_exist
+//==== LABEL Check if MachineLearning:TensorsInfo:setTensorName method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setTensorName M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo = new tizen.ml.TensorsInfo();
+ check_method_exists(tensorsInfo, "setTensorName");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_setTensorName_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_setTensorName_misarg
+//==== LABEL Check using TensorsInfo::setTensorName() method with extra argument
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setTensorName M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ var tensorsInfo;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ assert_throws(TYPE_MISMATCH_EXCEPTION,function () {
+ tensorsInfo.setTensorName();
+ }, "Method was called without argument but exception was not thrown");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_setTensorType</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_setTensorType
+//==== LABEL Check if TensorsInfo:setTensorType() work properly
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setTensorType M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MAST
+test(function () {
+ var tensorsInfo, retValue, tensorType1, tensorType2;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor1", "INT8", [2, 2]);
+ tensorType1 = tensorsInfo.getTensorType(0);
+ assert_equals(tensorType1, "INT8", "getTensorType of tensor in tensorsInfo incorrect");
+ retValue = tensorsInfo.setTensorType(0, "FLOAT32");
+ assert_type(retValue, "undefined", "return value should be unidefined");
+ tensorType2 = tensorsInfo.getTensorType(0);
+ assert_equals(tensorType2, "FLOAT32", "getTensorType of tensor in tensorsInfo incorrect");
+ tensorsInfo.dispose();
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_setTensorType_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_setTensorType_AbortError\r
+//==== LABEL Check if TensorsInfo:setTensorType() with error occured throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setTensorType M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+\r
+test(function () {\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor1", "UINT8", [2, 2]);\r
+ tensorsInfo.dispose();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ tensorsInfo.setTensorType(0, "UINT16");\r
+ }, "AbortError should be thrown - Disposes an object and releases the memory. Object should not be used after calling dispose.");\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_setTensorType_InvalidValueError_1</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_setTensorType_InvalidValueError_1\r
+//==== LABEL Check if TensorsInfo::setTensorType() with incorrect index value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo::setTensorType M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsInfo.setTensorType(-1, "FLOAT32");\r
+ }, "No such index, Should throw InvalidValuesError exception");\r
+}, document.title); \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>TensorsInfo_setTensorType_InvalidValueError_2</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: TensorsInfo_setTensorType_InvalidValueError_2\r
+//==== LABEL Check if TensorsInfo::setTensorType() with incorrect index value throws an exception\r
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo::setTensorType M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var tensorsInfo;\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ tensorsInfo.setTensorType(0, "UNKNOWN");\r
+ }, "No such type, Should throw InvalidValuesError exception");\r
+}, document.title); \r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_setTensorType_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_setTensorType_exist
+//==== LABEL Check if MachineLearning:TensorsInfo:setTensorType method exists
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setTensorType M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var tensorsInfo = new tizen.ml.TensorsInfo();
+ check_method_exists(tensorsInfo, "setTensorType");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_setTensorType_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_setTensorType_misarg
+//==== LABEL Check using TensorsInfo::setTensorType() method with extra argument
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setTensorType M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ var tensorsInfo;
+ add_result_callback(function () {
+ try {
+ tensorsInfo.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ assert_throws(TYPE_MISMATCH_EXCEPTION,function () {
+ tensorsInfo.setTensorType();
+ }, "Method was called without argument but exception was not thrown");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>TensorsInfo_setTensorType_type_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: TensorsInfo_setTensorType_type_TypeMismatch
+//==== LABEL Check if MachineLearning:TensorsInfo:setTensorType() with incorrect type throws an exception
+//==== SPEC Tizen Web API:TBD:MachineLearning:TensorsInfo:setTensorType M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+test(function () {
+ add_result_callback(function () {
+ try {
+ tensorsInfo.dispose();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var tensorsInfo, conversionTable, i;
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [4, 4]);
+
+ conversionTable = getTypeConversionExceptions("object", false);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tensorsInfo.setTensorType(0, conversionTable[i][0]);
+ }, "TypeMismatchError should be thrown - given incorrect TensorsInfo object");
+ }
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /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],
+ [0, exceptionName],
+ [true, exceptionName],
+ ["dummyInvalidEnumValue", exceptionName],
+ [{ }, exceptionName]
+ ];
+ if (!isOptional) {
+ conversionTable.push([null, 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;
+ case "long":
+ conversionTable = [
+ [true, exceptionName],
+ [false, exceptionName],
+ [NaN, exceptionName],
+ [[], exceptionName],
+ [{ }, exceptionName],
+ [function () { }, 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;
+ case 'double':
+ assert_equals(typeof (obj), 'number', description);
+ 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 different.");
+ 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;
+}
--- /dev/null
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Intel Corporation.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of works must retain the original copyright notice, this
+# list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the original copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Intel Corporation nor the names of its contributors
+# may be used to endorse or promote products derived from this work without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
+# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors:
+# Fan, Yugang <yugang.fan@intel.com>
+
+import os
+import shutil
+import glob
+import time
+import sys
+import stat
+import random
+import json
+import logging
+import zipfile
+import signal
+import subprocess
+from optparse import OptionParser
+
+reload(sys)
+sys.setdefaultencoding('utf8')
+
+TOOL_VERSION = "v0.1"
+VERSION_FILE = "VERSION"
+DEFAULT_CMD_TIMEOUT = 600
+PKG_TYPES = ["apk", "xpk", "wgt", "apk-aio", "cordova-aio", "cordova", "embeddingapi"]
+PKG_MODES = ["shared", "embedded"]
+PKG_ARCHS = ["x86", "arm"]
+PKG_BLACK_LIST = []
+PKG_NAME = None
+BUILD_PARAMETERS = None
+BUILD_ROOT = None
+BUILD_ROOT_SRC = None
+BUILD_ROOT_SRC_PKG = None
+BUILD_ROOT_SRC_PKG_APP = None
+BUILD_ROOT_SRC_SUB_APP = None
+BUILD_ROOT_PKG = None
+BUILD_ROOT_PKG_APP = None
+LOG = None
+LOG_LEVEL = logging.DEBUG
+
+
+class ColorFormatter(logging.Formatter):
+
+ def __init__(self, msg):
+ logging.Formatter.__init__(self, msg)
+
+ def format(self, record):
+ red, green, yellow, blue = range(4)
+ colors = {'INFO': green, 'DEBUG': blue,
+ 'WARNING': yellow, 'ERROR': red}
+ msg = record.msg
+ if msg[0] == "+":
+ msg = "\33[01m" + msg[1:] + "\033[0m"
+ elif msg[0] == "=":
+ msg = "\33[07m" + msg + "\033[0m"
+ levelname = record.levelname
+ if levelname in colors:
+ msg_color = "\033[0;%dm" % (
+ 31 + colors[levelname]) + msg + "\033[0m"
+ record.msg = msg_color
+
+ return logging.Formatter.format(self, record)
+
+
+def pidExists(pid):
+ if pid < 0:
+ return False
+ try:
+ os.kill(pid, 0)
+ except OSError:
+ return False
+ else:
+ return True
+
+
+def isWindows():
+ return sys.platform == "cygwin" or sys.platform.startswith("win")
+
+
+def killProcesses(ppid=None):
+ if isWindows():
+ subprocess.check_call("TASKKILL /F /PID %s /T" % ppid)
+ else:
+ ppid = str(ppid)
+ pidgrp = []
+
+ def GetChildPids(ppid):
+ command = "ps -ef | awk '{if ($3 ==%s) print $2;}'" % str(ppid)
+ pids = os.popen(command).read()
+ pids = pids.split()
+ return pids
+
+ pidgrp.extend(GetChildPids(ppid))
+ for pid in pidgrp:
+ pidgrp.extend(GetChildPids(pid))
+
+ pidgrp.insert(0, ppid)
+ while len(pidgrp) > 0:
+ pid = pidgrp.pop()
+ try:
+ os.kill(int(pid), signal.SIGKILL)
+ return True
+ except OSError:
+ try:
+ os.popen("kill -9 %d" % int(pid))
+ return True
+ except Exception:
+ return False
+
+
+def safelyGetValue(origin_json=None, key=None):
+ if origin_json and key and key in origin_json:
+ return origin_json[key]
+ return None
+
+
+def checkContains(origin_str=None, key_str=None):
+ if origin_str.upper().find(key_str.upper()) >= 0:
+ return True
+ return False
+
+
+def getRandomStr():
+ str_pool = list("abcdefghijklmnopqrstuvwxyz1234567890")
+ random_str = ""
+ for i in range(15):
+ index = random.randint(0, len(str_pool) - 1)
+ random_str = random_str + str_pool[index]
+
+ return random_str
+
+
+def zipDir(dir_path, zip_file):
+ try:
+ if os.path.exists(zip_file):
+ if not doRemove([zip_file]):
+ return False
+ if not os.path.exists(os.path.dirname(zip_file)):
+ os.makedirs(os.path.dirname(zip_file))
+ z_file = zipfile.ZipFile(zip_file, "w")
+ orig_dir = os.getcwd()
+ os.chdir(dir_path)
+ for root, dirs, files in os.walk("."):
+ for i_file in files:
+ LOG.info("zip %s" % os.path.join(root, i_file))
+ z_file.write(os.path.join(root, i_file))
+ z_file.close()
+ os.chdir(orig_dir)
+ except Exception as e:
+ LOG.error("Fail to pack %s to %s: %s" % (dir_path, zip_file, e))
+ return False
+ LOG.info("Done to zip %s to %s" % (dir_path, zip_file))
+ return True
+
+
+def overwriteCopy(src, dest, symlinks=False, ignore=None):
+ if not os.path.exists(dest):
+ os.makedirs(dest)
+ shutil.copystat(src, dest)
+ sub_list = os.listdir(src)
+ if ignore:
+ excl = ignore(src, sub_list)
+ sub_list = [x for x in sub_list if x not in excl]
+ for i_sub in sub_list:
+ s_path = os.path.join(src, i_sub)
+ d_path = os.path.join(dest, i_sub)
+ if symlinks and os.path.islink(s_path):
+ if os.path.lexists(d_path):
+ os.remove(d_path)
+ os.symlink(os.readlink(s_path), d_path)
+ try:
+ s_path_s = os.lstat(s_path)
+ s_path_mode = stat.S_IMODE(s_path_s.st_mode)
+ os.lchmod(d_path, s_path_mode)
+ except Exception:
+ pass
+ elif os.path.isdir(s_path):
+ overwriteCopy(s_path, d_path, symlinks, ignore)
+ else:
+ shutil.copy2(s_path, d_path)
+
+
+def doCopy(src_item=None, dest_item=None):
+ LOG.info("Copying %s to %s" % (src_item, dest_item))
+ try:
+ if os.path.isdir(src_item):
+ overwriteCopy(src_item, dest_item, symlinks=True)
+ else:
+ if not os.path.exists(os.path.dirname(dest_item)):
+ LOG.info("Create non-existent dir: %s" %
+ os.path.dirname(dest_item))
+ os.makedirs(os.path.dirname(dest_item))
+ shutil.copy2(src_item, dest_item)
+ except Exception as e:
+ LOG.error("Fail to copy file %s: %s" % (src_item, e))
+ return False
+
+ return True
+
+
+def doRemove(target_file_list=None):
+ for i_file in target_file_list:
+ LOG.info("Removing %s" % i_file)
+ try:
+ if os.path.isdir(i_file):
+ shutil.rmtree(i_file)
+ else:
+ os.remove(i_file)
+ except Exception as e:
+ LOG.error("Fail to remove file %s: %s" % (i_file, e))
+ return False
+ return True
+
+
+def updateCopylistPrefix(src_default, dest_default, src_sub, dest_sub):
+ src_new = ""
+ dest_new = ""
+ PACK_TOOL_TAG = "PACK-TOOL-ROOT"
+
+ if src_sub[0:len(PACK_TOOL_TAG)] == PACK_TOOL_TAG:
+ src_new = src_sub.replace(PACK_TOOL_TAG, BUILD_PARAMETERS.pkgpacktools)
+ else:
+ src_new = os.path.join(src_default, src_sub)
+
+ if dest_sub[0:len(PACK_TOOL_TAG)] == PACK_TOOL_TAG:
+ dest_new = dest_sub.replace(PACK_TOOL_TAG, BUILD_ROOT)
+ else:
+ dest_new = os.path.join(dest_default, dest_sub)
+
+ return (src_new, dest_new)
+
+
+def buildSRC(src=None, dest=None, build_json=None):
+ if not os.path.exists(src):
+ LOG.info("+Src dir does not exist, skip build src process ...")
+ return True
+ if not doCopy(src, dest):
+ return False
+ if "blacklist" in build_json:
+ if build_json["blacklist"].count("") > 0:
+ build_json["blacklist"].remove("")
+ black_file_list = []
+ for i_black in build_json["blacklist"]:
+ black_file_list = black_file_list + \
+ glob.glob(os.path.join(dest, i_black))
+
+ black_file_list = list(set(black_file_list))
+ if not doRemove(black_file_list):
+ return False
+
+ if "copylist" in build_json:
+ for i_s_key in build_json["copylist"].keys():
+ if i_s_key and build_json["copylist"][i_s_key]:
+ (src_updated, dest_updated) = updateCopylistPrefix(
+ src, dest, i_s_key, build_json["copylist"][i_s_key])
+ if not doCopy(src_updated, dest_updated):
+ return False
+
+ return True
+
+
+def exitHandler(return_code=1):
+ LOG.info("+Cleaning build root folder ...")
+ if not BUILD_PARAMETERS.bnotclean and os.path.exists(BUILD_ROOT):
+ if not doRemove([BUILD_ROOT]):
+ LOG.error("Fail to clean build root, exit ...")
+ sys.exit(1)
+
+ if return_code == 0:
+ LOG.info("================ DONE ================")
+ else:
+ LOG.error(
+ "================ Found Something Wrong !!! ================")
+ sys.exit(return_code)
+
+
+def prepareBuildRoot():
+ LOG.info("+Preparing build root folder ...")
+ global BUILD_ROOT
+ global BUILD_ROOT_SRC
+ global BUILD_ROOT_SRC_PKG
+ global BUILD_ROOT_SRC_PKG_APP
+ global BUILD_ROOT_SRC_SUB_APP
+ global BUILD_ROOT_PKG
+ global BUILD_ROOT_PKG_APP
+
+ while True:
+ BUILD_ROOT = os.path.join("/tmp", getRandomStr())
+ if os.path.exists(BUILD_ROOT):
+ continue
+ else:
+ break
+
+ BUILD_ROOT_SRC = os.path.join(BUILD_ROOT, PKG_NAME)
+ BUILD_ROOT_SRC_PKG = os.path.join(BUILD_ROOT, "pkg")
+ BUILD_ROOT_SRC_PKG_APP = os.path.join(BUILD_ROOT, "pkg-app")
+ BUILD_ROOT_SRC_SUB_APP = os.path.join(BUILD_ROOT, "sub-app")
+ BUILD_ROOT_PKG = os.path.join(BUILD_ROOT, "pkg", "opt", PKG_NAME)
+ BUILD_ROOT_PKG_APP = os.path.join(BUILD_ROOT, "pkg-app", "opt", PKG_NAME)
+
+ if not doCopy(BUILD_PARAMETERS.srcdir, BUILD_ROOT_SRC):
+ return False
+ if not doRemove(
+ glob.glob(os.path.join(BUILD_ROOT_SRC, "%s*.zip" % PKG_NAME))):
+ return False
+
+ return True
+
+
+def doCMD(cmd, time_out=DEFAULT_CMD_TIMEOUT, no_check_return=False):
+ LOG.info("Doing CMD: [ %s ]" % cmd)
+ pre_time = time.time()
+ cmd_proc = subprocess.Popen(args=cmd, shell=True)
+ while True:
+ cmd_exit_code = cmd_proc.poll()
+ elapsed_time = time.time() - pre_time
+ if cmd_exit_code is None:
+ if elapsed_time >= time_out:
+ killProcesses(ppid=cmd_proc.pid)
+ LOG.error("Timeout to exe CMD")
+ return False
+ else:
+ if not no_check_return and cmd_exit_code != 0:
+ LOG.error("Fail to exe CMD")
+ return False
+ break
+ time.sleep(2)
+ return True
+
+
+def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
+ LOG.info("Doing CMD: [ %s ]" % cmd)
+ pre_time = time.time()
+ output = []
+ cmd_return_code = 1
+ cmd_proc = subprocess.Popen(
+ cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
+
+ while True:
+ output_line = cmd_proc.stdout.readline().strip("\r\n")
+ cmd_return_code = cmd_proc.poll()
+ elapsed_time = time.time() - pre_time
+ if cmd_return_code is None:
+ if elapsed_time >= time_out:
+ killProcesses(ppid=cmd_proc.pid)
+ LOG.error("Timeout to exe CMD")
+ return False
+ elif output_line == '' and cmd_return_code is not None:
+ break
+
+ sys.stdout.write("%s\n" % output_line)
+ sys.stdout.flush()
+ output.append(output_line)
+ if cmd_return_code != 0:
+ LOG.error("Fail to exe CMD")
+
+ return (cmd_return_code, output)
+
+
+def packXPK(build_json=None, app_src=None, app_dest=None, app_name=None):
+ pack_tool = os.path.join(BUILD_ROOT, "make_xpk.py")
+ if not os.path.exists(pack_tool):
+ if not doCopy(
+ os.path.join(BUILD_PARAMETERS.pkgpacktools, "make_xpk.py"),
+ pack_tool):
+ return False
+ orig_dir = os.getcwd()
+ os.chdir(BUILD_ROOT)
+ if os.path.exists("key.file"):
+ if not doRemove(["key.file"]):
+ os.chdir(orig_dir)
+ return False
+
+ key_file = safelyGetValue(build_json, "key-file")
+ if key_file == "key.file":
+ LOG.error(
+ "\"key.file\" is reserved name for default key file, "
+ "pls change the key file name ...")
+ os.chdir(orig_dir)
+ return False
+ if key_file:
+ pack_cmd = "python make_xpk.py %s %s -o %s" % (
+ app_src, key_file, os.path.join(app_dest, "%s.xpk" % app_name))
+ else:
+ pack_cmd = "python make_xpk.py %s key.file -o %s" % (
+ app_src, os.path.join(app_dest, "%s.xpk" % app_name))
+ if not doCMD(pack_cmd, DEFAULT_CMD_TIMEOUT):
+ os.chdir(orig_dir)
+ return False
+
+ os.chdir(orig_dir)
+ return True
+
+
+def packWGT(build_json=None, app_src=None, app_dest=None, app_name=None):
+ if not zipDir(app_src, os.path.join(app_dest, "%s.wgt" % app_name)):
+ return False
+
+ if BUILD_PARAMETERS.signature == True:
+ if safelyGetValue(build_json, "sign-flag") == "true":
+ if not os.path.exists(os.path.join(BUILD_ROOT, "signing")):
+ if not doCopy(
+ os.path.join(BUILD_PARAMETERS.pkgpacktools, "signing"),
+ os.path.join(BUILD_ROOT, "signing")):
+ return False
+ signing_cmd = "%s --dist platform %s" % (
+ os.path.join(BUILD_ROOT, "signing", "sign-widget.sh"),
+ os.path.join(app_dest, "%s.wgt" % app_name))
+ if not doCMD(signing_cmd, DEFAULT_CMD_TIMEOUT):
+ return False
+
+ return True
+
+
+def packAPK(build_json=None, app_src=None, app_dest=None, app_name=None):
+ app_name = app_name.replace("-", "_")
+
+ if not os.path.exists(os.path.join(BUILD_ROOT, "crosswalk")):
+ if not doCopy(
+ os.path.join(BUILD_PARAMETERS.pkgpacktools, "crosswalk"),
+ os.path.join(BUILD_ROOT, "crosswalk")):
+ return False
+
+ files = glob.glob(os.path.join(BUILD_ROOT, "crosswalk", "*.apk"))
+ if files:
+ if not doRemove(files):
+ return False
+
+ ext_opt = ""
+ cmd_opt = ""
+ url_opt = ""
+ mode_opt = ""
+ arch_opt = ""
+ icon_opt = ""
+
+ common_opts = safelyGetValue(build_json, "apk-common-opts")
+ if common_opts is None:
+ common_opts = ""
+
+ tmp_opt = safelyGetValue(build_json, "apk-ext-opt")
+ if tmp_opt:
+ ext_opt = "--extensions='%s'" % os.path.join(BUILD_ROOT_SRC, tmp_opt)
+
+ tmp_opt = safelyGetValue(build_json, "apk-cmd-opt")
+ if tmp_opt:
+ cmd_opt = "--xwalk-command-line='%s'" % tmp_opt
+
+ tmp_opt = safelyGetValue(build_json, "apk-url-opt")
+ if tmp_opt:
+ url_opt = "--app-url='%s'" % tmp_opt
+
+ tmp_opt = safelyGetValue(build_json, "apk-mode-opt")
+ if tmp_opt:
+ if tmp_opt in PKG_MODES:
+ mode_opt = "--mode=%s" % tmp_opt
+ else:
+ LOG.error("Got wrong app mode: %s" % tmp_opt)
+ return False
+ else:
+ mode_opt = "--mode=%s" % BUILD_PARAMETERS.pkgmode
+
+ tmp_opt = safelyGetValue(build_json, "apk-arch-opt")
+ if tmp_opt:
+ if tmp_opt in PKG_ARCHS:
+ arch_opt = "--arch=%s" % tmp_opt
+ else:
+ LOG.error("Got wrong app arch: %s" % tmp_opt)
+ return False
+ else:
+ arch_opt = "--arch=%s" % BUILD_PARAMETERS.pkgarch
+
+ tmp_opt = safelyGetValue(build_json, "apk-icon-opt")
+ if tmp_opt:
+ icon_opt = "--icon=%s" % tmp_opt
+ elif tmp_opt == "":
+ icon_opt = ""
+ else:
+ icon_opt = "--icon=%s/icon.png" % app_src
+
+ if safelyGetValue(build_json, "apk-type") == "MANIFEST":
+ pack_cmd = "python make_apk.py --package=org.xwalk.%s " \
+ "--manifest=%s/manifest.json %s %s %s %s %s" % (
+ app_name, app_src, mode_opt, arch_opt,
+ ext_opt, cmd_opt, common_opts)
+ elif safelyGetValue(build_json, "apk-type") == "HOSTEDAPP":
+ if not url_opt:
+ LOG.error(
+ "Fail to find the key \"apk-url-opt\" for hosted APP packing")
+ return False
+ pack_cmd = "python make_apk.py --package=org.xwalk.%s --name=%s %s " \
+ "%s %s %s %s %s" % (
+ app_name, app_name, mode_opt, arch_opt, ext_opt,
+ cmd_opt, url_opt, common_opts)
+ else:
+ pack_cmd = "python make_apk.py --package=org.xwalk.%s --name=%s " \
+ "--app-root=%s --app-local-path=index.html %s %s " \
+ "%s %s %s %s" % (
+ app_name, app_name, app_src, icon_opt, mode_opt,
+ arch_opt, ext_opt, cmd_opt, common_opts)
+
+ orig_dir = os.getcwd()
+ os.chdir(os.path.join(BUILD_ROOT, "crosswalk"))
+ if not doCMD(pack_cmd, DEFAULT_CMD_TIMEOUT):
+ os.chdir(orig_dir)
+ return False
+
+ files = glob.glob(os.path.join(BUILD_ROOT, "crosswalk", "*.apk"))
+ if files:
+ if not doCopy(files[0], os.path.join(app_dest, "%s.apk" % app_name)):
+ os.chdir(orig_dir)
+ return False
+ else:
+ LOG.error("Fail to find the apk file")
+ os.chdir(orig_dir)
+ return False
+
+ os.chdir(orig_dir)
+ return True
+
+
+def packCordova(build_json=None, app_src=None, app_dest=None, app_name=None):
+ pack_tool = os.path.join(BUILD_ROOT, "cordova")
+ app_name = app_name.replace("-", "_")
+ if not os.path.exists(pack_tool):
+ if not doCopy(
+ os.path.join(BUILD_PARAMETERS.pkgpacktools, "cordova"),
+ pack_tool):
+ return False
+
+ plugin_tool = os.path.join(BUILD_ROOT, "cordova_plugins")
+ if not os.path.exists(plugin_tool):
+ if not doCopy(
+ os.path.join(BUILD_PARAMETERS.pkgpacktools, "cordova_plugins"),
+ plugin_tool):
+ return False
+
+ orig_dir = os.getcwd()
+ os.chdir(pack_tool)
+ pack_cmd = "bin/create %s org.xwalk.%s %s" % (
+ app_name, app_name, app_name)
+ if not doCMD(pack_cmd, DEFAULT_CMD_TIMEOUT):
+ os.chdir(orig_dir)
+ return False
+
+ os.chdir(os.path.join(pack_tool, app_name))
+ plugin_dirs = os.listdir(plugin_tool)
+ for i_dir in plugin_dirs:
+ i_plugin_dir = os.path.join(plugin_tool, i_dir)
+ plugin_install_cmd = "plugman install --platform android --project " \
+ "./ --plugin %s" % i_plugin_dir
+ if not doCMD(plugin_install_cmd, DEFAULT_CMD_TIMEOUT):
+ os.chdir(orig_dir)
+ return False
+ os.chdir(pack_tool)
+
+ if not doCopy(app_src, os.path.join(pack_tool, app_name, "assets", "www")):
+ os.chdir(orig_dir)
+ return False
+ os.chdir(os.path.join(BUILD_ROOT, "cordova", app_name))
+ pack_cmd = "./cordova/build"
+ if not doCMD(pack_cmd, DEFAULT_CMD_TIMEOUT):
+ os.chdir(orig_dir)
+ return False
+
+ if not doCopy(os.path.join(
+ BUILD_ROOT, "cordova", app_name, "bin", "%s-debug.apk" %
+ app_name),
+ os.path.join(app_dest, "%s.apk" % app_name)):
+ os.chdir(orig_dir)
+ return False
+ os.chdir(orig_dir)
+ return True
+
+
+def packEmbeddingAPI(
+ build_json=None, app_src=None, app_dest=None, app_name=None):
+ app_name = app_name.replace("-", "_")
+
+ library_dir_name = safelyGetValue(build_json, "embeddingapi-library-name")
+ if not library_dir_name:
+ LOG.error("Fail to get embeddingapi-library-name ...")
+ return False
+
+ new_library_dir_name = "core_library"
+ pack_tool = os.path.join(app_src, "..", new_library_dir_name)
+
+ if os.path.exists(pack_tool):
+ if not doRemove([pack_tool]):
+ return False
+
+ if not doCopy(
+ os.path.join(BUILD_PARAMETERS.pkgpacktools, library_dir_name),
+ pack_tool):
+ return False
+
+ if os.path.exists(os.path.join(pack_tool, "bin", "res", "crunch")):
+ if not doRemove([os.path.join(pack_tool, "bin", "res", "crunch")]):
+ return False
+
+ orig_dir = os.getcwd()
+ android_project_path = os.path.join(app_src, "android-project")
+ try:
+ os.makedirs(android_project_path)
+ except Exception as e:
+ LOG.error("Fail to create tmp project dir: %s" % e)
+ return False
+
+ (return_code, output) = doCMDWithOutput("android list target")
+ api_level = ""
+ for line in output:
+ if "API level" in line:
+ api_level = line.split(":")[1].strip()
+ break
+ if not api_level:
+ LOG.error("Fail to get Android API Level")
+ os.chdir(orig_dir)
+ return False
+
+ android_project_cmd = "android create project --name %s --target " \
+ "android-%s --path %s --package com.%s " \
+ "--activity MainActivity" % (
+ app_name, api_level, android_project_path, app_name)
+ if not doCMD(android_project_cmd):
+ os.chdir(orig_dir)
+ return False
+
+ try:
+ update_file = open(
+ os.path.join(android_project_path, "project.properties"), "a+")
+ update_file.writelines(
+ "{0}\n".format(
+ "android.library.reference.1=../%s" %
+ new_library_dir_name))
+ update_file.close()
+ except Exception as e:
+ LOG.error(
+ "Fail to update %s: %s" %
+ (os.path.join(
+ android_project_path,
+ "project.properties"),
+ e))
+ os.chdir(orig_dir)
+ return False
+
+ if not doCopy(os.path.join(android_project_path, "build.xml"),
+ os.path.join(app_src, "build.xml")):
+ os.chdir(orig_dir)
+ return False
+
+ if not doCopy(
+ os.path.join(android_project_path, "project.properties"),
+ os.path.join(app_src, "project.properties")):
+ os.chdir(orig_dir)
+ return False
+
+ if not doCopy(
+ os.path.join(android_project_path, "local.properties"),
+ os.path.join(app_src, "local.properties")):
+ os.chdir(orig_dir)
+ return False
+
+ if not doCopy(
+ os.path.join(android_project_path, "local.properties"),
+ os.path.join(pack_tool, "local.properties")):
+ os.chdir(orig_dir)
+ return False
+
+ os.chdir(app_src)
+ if not doCMD("ant debug"):
+ os.chdir(orig_dir)
+ return False
+
+ if not doCopy(
+ os.path.join(app_src, "bin", "%s-debug.apk" % app_name),
+ os.path.join(app_dest, "%s.apk" % app_name)):
+ os.chdir(orig_dir)
+ return False
+ os.chdir(orig_dir)
+ return True
+
+
+def packAPP(build_json=None, app_src=None, app_dest=None, app_name=None):
+ LOG.info("Packing %s(%s)" % (app_name, app_src))
+ if not os.path.exists(app_dest):
+ try:
+ os.makedirs(app_dest)
+ except Exception as e:
+ LOG.error("Fail to init package install dest dir: %s" % e)
+ return False
+
+ if checkContains(BUILD_PARAMETERS.pkgtype, "XPK"):
+ if not packXPK(build_json, app_src, app_dest, app_name):
+ return False
+ elif checkContains(BUILD_PARAMETERS.pkgtype, "WGT"):
+ if not packWGT(build_json, app_src, app_dest, app_name):
+ return False
+ elif checkContains(BUILD_PARAMETERS.pkgtype, "APK"):
+ if not packAPK(build_json, app_src, app_dest, app_name):
+ return False
+ elif checkContains(BUILD_PARAMETERS.pkgtype, "CORDOVA"):
+ if not packCordova(build_json, app_src, app_dest, app_name):
+ return False
+ elif checkContains(BUILD_PARAMETERS.pkgtype, "EMBEDDINGAPI"):
+ if not packEmbeddingAPI(build_json, app_src, app_dest, app_name):
+ return False
+ else:
+ LOG.error("Got wrong pkg type: %s" % BUILD_PARAMETERS.pkgtype)
+ return False
+
+ LOG.info("Success to pack APP: %s" % app_name)
+ return True
+
+
+def createIndexFile(index_file_path=None, hosted_app=None):
+ try:
+ if hosted_app:
+ index_url = "http://127.0.0.1/opt/%s/webrunner/index.html?" \
+ "testsuite=../tests.xml&testprefix=../../.." % PKG_NAME
+ else:
+ index_url = "opt/%s/webrunner/index.html?testsuite=../tests.xml" \
+ "&testprefix=../../.." % PKG_NAME
+ html_content = "<!doctype html><head><meta http-equiv='Refresh' " \
+ "content='1; url=%s'></head>" % index_url
+ index_file = open(index_file_path, "w")
+ index_file.write(html_content)
+ index_file.close()
+ except Exception as e:
+ LOG.error("Fail to create index.html for top-app: %s" % e)
+ return False
+ LOG.info("Success to create index file %s" % index_file_path)
+ return True
+
+
+def buildSubAPP(app_dir=None, build_json=None, app_dest_default=None):
+ app_dir_inside = safelyGetValue(build_json, "app-dir")
+ if app_dir_inside:
+ app_dir = app_dir_inside
+ LOG.info("+Building sub APP(s) from %s ..." % app_dir)
+ app_dir = os.path.join(BUILD_ROOT_SRC, app_dir)
+ app_name = safelyGetValue(build_json, "app-name")
+ if not app_name:
+ app_name = os.path.basename(app_dir)
+
+ app_src = os.path.join(BUILD_ROOT_SRC_SUB_APP, app_name)
+ if buildSRC(app_dir, app_src, build_json):
+ app_dest = safelyGetValue(build_json, "install-path")
+ if app_dest:
+ app_dest = os.path.join(app_dest_default, app_dest)
+ else:
+ app_dest = app_dest_default
+
+ if safelyGetValue(build_json, "all-apps") == "true":
+ app_dirs = os.listdir(app_src)
+ apps_num = 0
+ for i_app_dir in app_dirs:
+ if os.path.isdir(os.path.join(app_src, i_app_dir)):
+ i_app_name = os.path.basename(i_app_dir)
+ if not packAPP(
+ build_json, os.path.join(app_src, i_app_name),
+ app_dest, i_app_name):
+ return False
+ else:
+ apps_num = apps_num + 1
+ if apps_num > 0:
+ LOG.info("Totally packed %d apps in %s" % (apps_num, app_dir))
+ return True
+ else:
+ return packAPP(build_json, app_src, app_dest, app_name)
+ return False
+
+
+def buildPKGAPP(build_json=None):
+ LOG.info("+Building package APP ...")
+ if not doCopy(os.path.join(BUILD_ROOT_SRC, "icon.png"),
+ os.path.join(BUILD_ROOT_SRC_PKG_APP, "icon.png")):
+ return False
+
+ if checkContains(BUILD_PARAMETERS.pkgtype, "XPK"):
+ if not doCopy(
+ os.path.join(BUILD_ROOT_SRC, "manifest.json"),
+ os.path.join(BUILD_ROOT_SRC_PKG_APP, "manifest.json")):
+ return False
+ elif checkContains(BUILD_PARAMETERS.pkgtype, "WGT"):
+ if not doCopy(os.path.join(BUILD_ROOT_SRC, "config.xml"),
+ os.path.join(BUILD_ROOT_SRC_PKG_APP, "config.xml")):
+ return False
+
+ hosted_app = False
+ if safelyGetValue(build_json, "hosted-app") == "true":
+ hosted_app = True
+ if not createIndexFile(
+ os.path.join(BUILD_ROOT_SRC_PKG_APP, "index.html"), hosted_app):
+ return False
+
+ if not hosted_app:
+ if "blacklist" not in build_json:
+ build_json.update({"blacklist": []})
+ build_json["blacklist"].extend(PKG_BLACK_LIST)
+ if not buildSRC(BUILD_ROOT_SRC, BUILD_ROOT_PKG_APP, build_json):
+ return False
+
+ if "subapp-list" in build_json:
+ for i_sub_app in build_json["subapp-list"].keys():
+ if not buildSubAPP(
+ i_sub_app, build_json["subapp-list"][i_sub_app],
+ BUILD_ROOT_PKG_APP):
+ return False
+
+ if not packAPP(
+ build_json, BUILD_ROOT_SRC_PKG_APP, BUILD_ROOT_PKG, PKG_NAME):
+ return False
+
+ return True
+
+
+def buildPKG(build_json=None):
+ if "blacklist" not in build_json:
+ build_json.update({"blacklist": []})
+ build_json["blacklist"].extend(PKG_BLACK_LIST)
+ if not buildSRC(BUILD_ROOT_SRC, BUILD_ROOT_PKG, build_json):
+ return False
+
+ if "subapp-list" in build_json:
+ for i_sub_app in build_json["subapp-list"].keys():
+ if not buildSubAPP(
+ i_sub_app, build_json["subapp-list"][i_sub_app],
+ BUILD_ROOT_PKG):
+ return False
+
+ if "pkg-app" in build_json:
+ if not buildPKGAPP(build_json["pkg-app"]):
+ return False
+
+ return True
+
+
+def main():
+ global LOG
+ LOG = logging.getLogger("pack-tool")
+ LOG.setLevel(LOG_LEVEL)
+ stream_handler = logging.StreamHandler()
+ stream_handler.setLevel(LOG_LEVEL)
+ stream_formatter = ColorFormatter("[%(asctime)s] %(message)s")
+ stream_handler.setFormatter(stream_formatter)
+ LOG.addHandler(stream_handler)
+
+ try:
+ usage = "Usage: ./pack.py -t apk -m shared -a x86"
+ opts_parser = OptionParser(usage=usage)
+ opts_parser.add_option(
+ "-c",
+ "--cfg",
+ dest="pkgcfg",
+ help="specify the path of config json file")
+ opts_parser.add_option(
+ "-t",
+ "--type",
+ dest="pkgtype",
+ help="specify the pkg type, e.g. apk, xpk, wgt ...")
+ opts_parser.add_option(
+ "-m",
+ "--mode",
+ dest="pkgmode",
+ help="specify the apk mode, e.g. shared, embedded")
+ opts_parser.add_option(
+ "-a",
+ "--arch",
+ dest="pkgarch",
+ help="specify the apk arch, e.g. x86, arm")
+ opts_parser.add_option(
+ "-d",
+ "--dest",
+ dest="destdir",
+ help="specify the installation folder for packed package")
+ opts_parser.add_option(
+ "-s",
+ "--src",
+ dest="srcdir",
+ help="specify the path of pkg resource for packing")
+ opts_parser.add_option(
+ "--tools",
+ dest="pkgpacktools",
+ help="specify the parent folder of pack tools")
+ opts_parser.add_option(
+ "--notclean",
+ dest="bnotclean",
+ action="store_true",
+ help="disable the build root clean after the packing")
+ opts_parser.add_option(
+ "--sign",
+ dest="signature",
+ action="store_true",
+ help="signature operation will be done when packing wgt")
+ opts_parser.add_option(
+ "-v",
+ "--version",
+ dest="bversion",
+ action="store_true",
+ help="show this tool's version")
+ opts_parser.add_option(
+ "--pkg-version",
+ dest="pkgversion",
+ help="specify the pkg version, e.g. 0.0.0.1")
+
+ if len(sys.argv) == 1:
+ sys.argv.append("-h")
+
+ global BUILD_PARAMETERS
+ (BUILD_PARAMETERS, args) = opts_parser.parse_args()
+ except Exception as e:
+ LOG.error("Got wrong options: %s, exit ..." % e)
+ sys.exit(1)
+
+ if BUILD_PARAMETERS.bversion:
+ print "Version: %s" % TOOL_VERSION
+ sys.exit(0)
+
+ if not BUILD_PARAMETERS.srcdir:
+ BUILD_PARAMETERS.srcdir = os.getcwd()
+ BUILD_PARAMETERS.srcdir = os.path.expanduser(BUILD_PARAMETERS.srcdir)
+
+ if not os.path.exists(
+ os.path.join(BUILD_PARAMETERS.srcdir, "..", "..", VERSION_FILE)):
+ if not os.path.exists(
+ os.path.join(BUILD_PARAMETERS.srcdir, "..", VERSION_FILE)):
+ if not os.path.exists(
+ os.path.join(BUILD_PARAMETERS.srcdir, VERSION_FILE)):
+ LOG.info(
+ "Not found pkg version file, try to use option --pkg-version")
+ pkg_version_file_path = None
+ else:
+ pkg_version_file_path = os.path.join(
+ BUILD_PARAMETERS.srcdir, VERSION_FILE)
+ else:
+ pkg_version_file_path = os.path.join(
+ BUILD_PARAMETERS.srcdir, "..", VERSION_FILE)
+ else:
+ pkg_version_file_path = os.path.join(
+ BUILD_PARAMETERS.srcdir, "..", "..", VERSION_FILE)
+
+ try:
+ pkg_main_version = 0
+ pkg_release_version = 0
+ if BUILD_PARAMETERS.pkgversion:
+ LOG.info("Using %s as pkg version " % BUILD_PARAMETERS.pkgversion)
+ pkg_main_version = BUILD_PARAMETERS.pkgversion
+ else:
+ if pkg_version_file_path is not None:
+ LOG.info("Using pkg version file: %s" % pkg_version_file_path)
+ with open(pkg_version_file_path, "rt") as pkg_version_file:
+ pkg_version_raw = pkg_version_file.read()
+ pkg_version_file.close()
+ pkg_version_json = json.loads(pkg_version_raw)
+ pkg_main_version = pkg_version_json["main-version"]
+ pkg_release_version = pkg_version_json["release-version"]
+ except Exception as e:
+ LOG.error("Fail to read pkg version file: %s, exit ..." % e)
+ sys.exit(1)
+
+ if not BUILD_PARAMETERS.pkgtype:
+ LOG.error("No pkg type provided, exit ...")
+ sys.exit(1)
+ elif not BUILD_PARAMETERS.pkgtype in PKG_TYPES:
+ LOG.error("Wrong pkg type, only support: %s, exit ..." %
+ PKG_TYPES)
+ sys.exit(1)
+
+ if BUILD_PARAMETERS.pkgtype == "apk" or \
+ BUILD_PARAMETERS.pkgtype == "apk-aio":
+ if not BUILD_PARAMETERS.pkgmode:
+ LOG.error("No pkg mode option provided, exit ...")
+ sys.exit(1)
+ elif not BUILD_PARAMETERS.pkgmode in PKG_MODES:
+ LOG.error(
+ "Wrong pkg mode option provided, only support:%s, exit ..." %
+ PKG_MODES)
+ sys.exit(1)
+
+ if not BUILD_PARAMETERS.pkgarch:
+ LOG.error("No pkg arch option provided, exit ...")
+ sys.exit(1)
+ elif not BUILD_PARAMETERS.pkgarch in PKG_ARCHS:
+ LOG.error(
+ "Wrong pkg arch option provided, only support:%s, exit ..." %
+ PKG_ARCHS)
+ sys.exit(1)
+
+ if BUILD_PARAMETERS.pkgtype == "apk-aio" or \
+ BUILD_PARAMETERS.pkgtype == "cordova-aio":
+ if not BUILD_PARAMETERS.destdir or not os.path.exists(
+ BUILD_PARAMETERS.destdir):
+ LOG.error("No all-in-one installation dest dir found, exit ...")
+ sys.exit(1)
+
+ elif not BUILD_PARAMETERS.destdir:
+ BUILD_PARAMETERS.destdir = BUILD_PARAMETERS.srcdir
+ BUILD_PARAMETERS.destdir = os.path.expanduser(BUILD_PARAMETERS.destdir)
+
+ if not BUILD_PARAMETERS.pkgpacktools:
+ BUILD_PARAMETERS.pkgpacktools = os.path.join(
+ BUILD_PARAMETERS.srcdir, "..", "..", "..", "tools")
+ BUILD_PARAMETERS.pkgpacktools = os.path.expanduser(
+ BUILD_PARAMETERS.pkgpacktools)
+
+ config_json = None
+ if BUILD_PARAMETERS.pkgcfg:
+ config_json_file_path = BUILD_PARAMETERS.pkgcfg
+ else:
+ config_json_file_path = os.path.join(
+ BUILD_PARAMETERS.srcdir, "suite.json")
+ try:
+ LOG.info("Using config json file: %s" % config_json_file_path)
+ with open(config_json_file_path, "rt") as config_json_file:
+ config_raw = config_json_file.read()
+ config_json_file.close()
+ config_json = json.loads(config_raw)
+ except Exception as e:
+ LOG.error("Fail to read config json file: %s, exit ..." % e)
+ sys.exit(1)
+
+ global PKG_NAME
+ PKG_NAME = safelyGetValue(config_json, "pkg-name")
+ if not PKG_NAME:
+ PKG_NAME = os.path.basename(BUILD_PARAMETERS.srcdir)
+ LOG.warning(
+ "Fail to read pkg name from json, "
+ "using src dir name as pkg name ...")
+
+ LOG.info("================= %s (%s-%s) ================" %
+ (PKG_NAME, pkg_main_version, pkg_release_version))
+
+ if not safelyGetValue(config_json, "pkg-list"):
+ LOG.error("Fail to read pkg-list, exit ...")
+ sys.exit(1)
+
+ pkg_json = None
+ for i_pkg in config_json["pkg-list"].keys():
+ i_pkg_list = i_pkg.replace(" ", "").split(",")
+ if BUILD_PARAMETERS.pkgtype in i_pkg_list:
+ pkg_json = config_json["pkg-list"][i_pkg]
+
+ if not pkg_json:
+ LOG.error("Fail to read pkg json, exit ...")
+ sys.exit(1)
+
+ if not prepareBuildRoot():
+ exitHandler(1)
+
+ if "pkg-blacklist" in config_json:
+ PKG_BLACK_LIST.extend(config_json["pkg-blacklist"])
+
+ if not buildPKG(pkg_json):
+ exitHandler(1)
+
+ LOG.info("+Building package ...")
+ if BUILD_PARAMETERS.pkgtype == "apk-aio" or \
+ BUILD_PARAMETERS.pkgtype == "cordova-aio":
+ pkg_file_list = os.listdir(os.path.join(BUILD_ROOT, "pkg"))
+ for i_file in pkg_file_list:
+ if not doCopy(
+ os.path.join(BUILD_ROOT, "pkg", i_file),
+ os.path.join(BUILD_PARAMETERS.destdir, i_file)):
+ exitHandler(1)
+ else:
+ pkg_file = os.path.join(
+ BUILD_PARAMETERS.destdir,
+ "%s-%s.%s.zip" %
+ (PKG_NAME,
+ pkg_main_version,
+ pkg_release_version))
+
+
+ if not zipDir(os.path.join(BUILD_ROOT, "pkg"), pkg_file):
+ exitHandler(1)
+
+if __name__ == "__main__":
+ main()
+ exitHandler(0)
--- /dev/null
+The testharness files come from
+https://github.com/w3c/testharness.js (commit 2486f01bf4c58de1c1b7cb39322af7b55c6c700b)
+without any modification.
+
+These tests are copyright by W3C and/or the author listed in the test
+file. The tests are dual-licensed under the W3C Test Suite License:
+http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
+and the BSD 3-clause License:
+http://www.w3.org/Consortium/Legal/2008/03-bsd-license
+under W3C's test suite licensing policy:
+http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright
+
--- /dev/null
+html {
+ font-family:DejaVu Sans, Bitstream Vera Sans, Arial, Sans;
+}
+
+#log .warning,
+#log .warning a {
+ color: black;
+ background: yellow;
+}
+
+#log .error,
+#log .error a {
+ color: white;
+ background: red;
+}
+
+#log pre {
+ border: 1px solid black;
+ padding: 1em;
+}
+
+section#summary {
+ margin-bottom:1em;
+}
+
+table#results {
+ border-collapse:collapse;
+ table-layout:fixed;
+ width:100%;
+}
+
+table#results th:first-child,
+table#results td:first-child {
+ width:4em;
+}
+
+table#results th:last-child,
+table#results td:last-child {
+ width:50%;
+}
+
+table#results.assertions th:last-child,
+table#results.assertions td:last-child {
+ width:35%;
+}
+
+table#results th {
+ padding:0;
+ padding-bottom:0.5em;
+ border-bottom:medium solid black;
+}
+
+table#results td {
+ padding:1em;
+ padding-bottom:0.5em;
+ border-bottom:thin solid black;
+}
+
+tr.pass > td:first-child {
+ color:green;
+}
+
+tr.fail > td:first-child {
+ color:red;
+}
+
+tr.timeout > td:first-child {
+ color:red;
+}
+
+tr.notrun > td:first-child {
+ color:blue;
+}
+
+.pass > td:first-child, .fail > td:first-child, .timeout > td:first-child, .notrun > td:first-child {
+ font-variant:small-caps;
+}
+
+table#results span {
+ display:block;
+}
+
+table#results span.expected {
+ font-family:DejaVu Sans Mono, Bitstream Vera Sans Mono, Monospace;
+ white-space:pre;
+}
+
+table#results span.actual {
+ font-family:DejaVu Sans Mono, Bitstream Vera Sans Mono, Monospace;
+ white-space:pre;
+}
+
+span.ok {
+ color:green;
+}
+
+tr.error {
+ color:red;
+}
+
+span.timeout {
+ color:red;
+}
+
+span.ok, span.timeout, span.error {
+ font-variant:small-caps;
+}
\ No newline at end of file
--- /dev/null
+/*global self*/
+/*jshint latedef: nofunc*/
+/*
+Distributed under both the W3C Test Suite License [1] and the W3C
+3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
+policies and contribution forms [3].
+
+[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
+[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
+[3] http://www.w3.org/2004/10/27-testcases
+*/
+
+/* Documentation is in docs/api.md */
+
+(function ()
+{
+ var debug = false;
+ // default timeout is 10 seconds, test can override if needed
+ var settings = {
+ output:true,
+ harness_timeout:{
+ "normal":10000,
+ "long":60000
+ },
+ test_timeout:null
+ };
+
+ var xhtml_ns = "http://www.w3.org/1999/xhtml";
+
+ /*
+ * TestEnvironment is an abstraction for the environment in which the test
+ * harness is used. Each implementation of a test environment has to provide
+ * the following interface:
+ *
+ * interface TestEnvironment {
+ * // Invoked after the global 'tests' object has been created and it's
+ * // safe to call add_*_callback() to register event handlers.
+ * void on_tests_ready();
+ *
+ * // Invoked after setup() has been called to notify the test environment
+ * // of changes to the test harness properties.
+ * void on_new_harness_properties(object properties);
+ *
+ * // Should return a new unique default test name.
+ * DOMString next_default_test_name();
+ *
+ * // Should return the test harness timeout duration in milliseconds.
+ * float test_timeout();
+ *
+ * // Should return the global scope object.
+ * object global_scope();
+ * };
+ */
+
+ /*
+ * A test environment with a DOM. The global object is 'window'. By default
+ * test results are displayed in a table. Any parent windows receive
+ * callbacks or messages via postMessage() when test events occur. See
+ * apisample11.html and apisample12.html.
+ */
+ function WindowTestEnvironment() {
+ this.name_counter = 0;
+ this.window_cache = null;
+ this.output_handler = null;
+ this.all_loaded = false;
+ var this_obj = this;
+ on_event(window, 'load', function() {
+ this_obj.all_loaded = true;
+ });
+ }
+
+ WindowTestEnvironment.prototype._dispatch = function(selector, callback_args, message_arg) {
+ this._forEach_windows(
+ function(w, is_same_origin) {
+ if (is_same_origin && selector in w) {
+ try {
+ w[selector].apply(undefined, callback_args);
+ } catch (e) {
+ if (debug) {
+ throw e;
+ }
+ }
+ }
+ if (supports_post_message(w) && w !== self) {
+ w.postMessage(message_arg, "*");
+ }
+ });
+ };
+
+ WindowTestEnvironment.prototype._forEach_windows = function(callback) {
+ // Iterate of the the windows [self ... top, opener]. The callback is passed
+ // two objects, the first one is the windows object itself, the second one
+ // is a boolean indicating whether or not its on the same origin as the
+ // current window.
+ var cache = this.window_cache;
+ if (!cache) {
+ cache = [[self, true]];
+ var w = self;
+ var i = 0;
+ var so;
+ var origins = location.ancestorOrigins;
+ while (w != w.parent) {
+ w = w.parent;
+ // In WebKit, calls to parent windows' properties that aren't on the same
+ // origin cause an error message to be displayed in the error console but
+ // don't throw an exception. This is a deviation from the current HTML5
+ // spec. See: https://bugs.webkit.org/show_bug.cgi?id=43504
+ // The problem with WebKit's behavior is that it pollutes the error console
+ // with error messages that can't be caught.
+ //
+ // This issue can be mitigated by relying on the (for now) proprietary
+ // `location.ancestorOrigins` property which returns an ordered list of
+ // the origins of enclosing windows. See:
+ // http://trac.webkit.org/changeset/113945.
+ if (origins) {
+ so = (location.origin == origins[i]);
+ } else {
+ so = is_same_origin(w);
+ }
+ cache.push([w, so]);
+ i++;
+ }
+ w = window.opener;
+ if (w) {
+ // window.opener isn't included in the `location.ancestorOrigins` prop.
+ // We'll just have to deal with a simple check and an error msg on WebKit
+ // browsers in this case.
+ cache.push([w, is_same_origin(w)]);
+ }
+ this.window_cache = cache;
+ }
+
+ forEach(cache,
+ function(a) {
+ callback.apply(null, a);
+ });
+ };
+
+ WindowTestEnvironment.prototype.on_tests_ready = function() {
+ var output = new Output();
+ this.output_handler = output;
+
+ var this_obj = this;
+ add_start_callback(function (properties) {
+ this_obj.output_handler.init(properties);
+ this_obj._dispatch("start_callback", [properties],
+ { type: "start", properties: properties });
+ });
+ add_test_state_callback(function(test) {
+ this_obj.output_handler.show_status();
+ this_obj._dispatch("test_state_callback", [test],
+ { type: "test_state", test: test.structured_clone() });
+ });
+ add_result_callback(function (test) {
+ this_obj.output_handler.show_status();
+ this_obj._dispatch("result_callback", [test],
+ { type: "result", test: test.structured_clone() });
+ });
+ add_completion_callback(function (tests, harness_status) {
+ this_obj.output_handler.show_results(tests, harness_status);
+ var cloned_tests = map(tests, function(test) { return test.structured_clone(); });
+ this_obj._dispatch("completion_callback", [tests, harness_status],
+ { type: "complete", tests: cloned_tests,
+ status: harness_status.structured_clone() });
+ });
+ };
+
+ WindowTestEnvironment.prototype.next_default_test_name = function() {
+ //Don't use document.title to work around an Opera bug in XHTML documents
+ var title = document.getElementsByTagName("title")[0];
+ var prefix = (title && title.firstChild && title.firstChild.data) || "Untitled";
+ var suffix = this.name_counter > 0 ? " " + this.name_counter : "";
+ this.name_counter++;
+ return prefix + suffix;
+ };
+
+ WindowTestEnvironment.prototype.on_new_harness_properties = function(properties) {
+ this.output_handler.setup(properties);
+ };
+
+ WindowTestEnvironment.prototype.add_on_loaded_callback = function(callback) {
+ on_event(window, 'load', callback);
+ };
+
+ WindowTestEnvironment.prototype.test_timeout = function() {
+ var metas = document.getElementsByTagName("meta");
+ for (var i = 0; i < metas.length; i++) {
+ if (metas[i].name == "timeout") {
+ if (metas[i].content == "long") {
+ return settings.harness_timeout.long;
+ }
+ break;
+ }
+ }
+ return settings.harness_timeout.normal;
+ };
+
+ WindowTestEnvironment.prototype.global_scope = function() {
+ return window;
+ };
+
+ /*
+ * Base TestEnvironment implementation for a generic web worker.
+ *
+ * Workers accumulate test results. One or more clients can connect and
+ * retrieve results from a worker at any time.
+ *
+ * WorkerTestEnvironment supports communicating with a client via a
+ * MessagePort. The mechanism for determining the appropriate MessagePort
+ * for communicating with a client depends on the type of worker and is
+ * implemented by the various specializations of WorkerTestEnvironment
+ * below.
+ *
+ * A client document using testharness can use fetch_tests_from_worker() to
+ * retrieve results from a worker. See apisample16.html.
+ */
+ function WorkerTestEnvironment() {
+ this.name_counter = 0;
+ this.all_loaded = true;
+ this.message_list = [];
+ this.message_ports = [];
+ }
+
+ WorkerTestEnvironment.prototype._dispatch = function(message) {
+ this.message_list.push(message);
+ for (var i = 0; i < this.message_ports.length; ++i)
+ {
+ this.message_ports[i].postMessage(message);
+ }
+ };
+
+ // The only requirement is that port has a postMessage() method. It doesn't
+ // have to be an instance of a MessagePort, and often isn't.
+ WorkerTestEnvironment.prototype._add_message_port = function(port) {
+ this.message_ports.push(port);
+ for (var i = 0; i < this.message_list.length; ++i)
+ {
+ port.postMessage(this.message_list[i]);
+ }
+ };
+
+ WorkerTestEnvironment.prototype.next_default_test_name = function() {
+ var suffix = this.name_counter > 0 ? " " + this.name_counter : "";
+ this.name_counter++;
+ return "Untitled" + suffix;
+ };
+
+ WorkerTestEnvironment.prototype.on_new_harness_properties = function() {};
+
+ WorkerTestEnvironment.prototype.on_tests_ready = function() {
+ var this_obj = this;
+ add_start_callback(
+ function(properties) {
+ this_obj._dispatch({
+ type: "start",
+ properties: properties,
+ });
+ });
+ add_test_state_callback(
+ function(test) {
+ this_obj._dispatch({
+ type: "test_state",
+ test: test.structured_clone()
+ });
+ });
+ add_result_callback(
+ function(test) {
+ this_obj._dispatch({
+ type: "result",
+ test: test.structured_clone()
+ });
+ });
+ add_completion_callback(
+ function(tests, harness_status) {
+ this_obj._dispatch({
+ type: "complete",
+ tests: map(tests,
+ function(test) {
+ return test.structured_clone();
+ }),
+ status: harness_status.structured_clone()
+ });
+ });
+ };
+
+ WorkerTestEnvironment.prototype.add_on_loaded_callback = function() {};
+
+ WorkerTestEnvironment.prototype.test_timeout = function() {
+ // Tests running in a worker don't have a default timeout. I.e. all
+ // worker tests behave as if settings.explicit_timeout is true.
+ return null;
+ };
+
+ WorkerTestEnvironment.prototype.global_scope = function() {
+ return self;
+ };
+
+ /*
+ * Dedicated web workers.
+ * https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope
+ *
+ * This class is used as the test_environment when testharness is running
+ * inside a dedicated worker.
+ */
+ function DedicatedWorkerTestEnvironment() {
+ WorkerTestEnvironment.call(this);
+ // self is an instance of DedicatedWorkerGlobalScope which exposes
+ // a postMessage() method for communicating via the message channel
+ // established when the worker is created.
+ this._add_message_port(self);
+ }
+ DedicatedWorkerTestEnvironment.prototype = Object.create(WorkerTestEnvironment.prototype);
+
+ DedicatedWorkerTestEnvironment.prototype.on_tests_ready = function() {
+ WorkerTestEnvironment.prototype.on_tests_ready.call(this);
+ // In the absence of an onload notification, we a require dedicated
+ // workers to explicitly signal when the tests are done.
+ tests.wait_for_finish = true;
+ };
+
+ /*
+ * Shared web workers.
+ * https://html.spec.whatwg.org/multipage/workers.html#sharedworkerglobalscope
+ *
+ * This class is used as the test_environment when testharness is running
+ * inside a shared web worker.
+ */
+ function SharedWorkerTestEnvironment() {
+ WorkerTestEnvironment.call(this);
+ var this_obj = this;
+ // Shared workers receive message ports via the 'onconnect' event for
+ // each connection.
+ self.addEventListener("connect",
+ function(message_event) {
+ this_obj._add_message_port(message_event.source);
+ });
+ }
+ SharedWorkerTestEnvironment.prototype = Object.create(WorkerTestEnvironment.prototype);
+
+ SharedWorkerTestEnvironment.prototype.on_tests_ready = function() {
+ WorkerTestEnvironment.prototype.on_tests_ready.call(this);
+ // In the absence of an onload notification, we a require shared
+ // workers to explicitly signal when the tests are done.
+ tests.wait_for_finish = true;
+ };
+
+ /*
+ * Service workers.
+ * http://www.w3.org/TR/service-workers/
+ *
+ * This class is used as the test_environment when testharness is running
+ * inside a service worker.
+ */
+ function ServiceWorkerTestEnvironment() {
+ WorkerTestEnvironment.call(this);
+ this.all_loaded = false;
+ this.on_loaded_callback = null;
+ var this_obj = this;
+ self.addEventListener("message",
+ function(event) {
+ if (event.data.type && event.data.type === "connect") {
+ this_obj._add_message_port(event.ports[0]);
+ event.ports[0].start();
+ }
+ });
+
+ // The oninstall event is received after the service worker script and
+ // all imported scripts have been fetched and executed. It's the
+ // equivalent of an onload event for a document. All tests should have
+ // been added by the time this event is received, thus it's not
+ // necessary to wait until the onactivate event.
+ on_event(self, "install",
+ function(event) {
+ this_obj.all_loaded = true;
+ if (this_obj.on_loaded_callback) {
+ this_obj.on_loaded_callback();
+ }
+ });
+ }
+ ServiceWorkerTestEnvironment.prototype = Object.create(WorkerTestEnvironment.prototype);
+
+ ServiceWorkerTestEnvironment.prototype.add_on_loaded_callback = function(callback) {
+ if (this.all_loaded) {
+ callback();
+ } else {
+ this.on_loaded_callback = callback;
+ }
+ };
+
+ function create_test_environment() {
+ if ('document' in self) {
+ return new WindowTestEnvironment();
+ }
+ if ('DedicatedWorkerGlobalScope' in self &&
+ self instanceof DedicatedWorkerGlobalScope) {
+ return new DedicatedWorkerTestEnvironment();
+ }
+ if ('SharedWorkerGlobalScope' in self &&
+ self instanceof SharedWorkerGlobalScope) {
+ return new SharedWorkerTestEnvironment();
+ }
+ if ('ServiceWorkerGlobalScope' in self &&
+ self instanceof ServiceWorkerGlobalScope) {
+ return new ServiceWorkerTestEnvironment();
+ }
+ throw new Error("Unsupported test environment");
+ }
+
+ var test_environment = create_test_environment();
+
+ function is_shared_worker(worker) {
+ return 'SharedWorker' in self && worker instanceof SharedWorker;
+ }
+
+ function is_service_worker(worker) {
+ return 'ServiceWorker' in self && worker instanceof ServiceWorker;
+ }
+
+ /*
+ * API functions
+ */
+
+ function test(func, name, properties)
+ {
+ var test_name = name ? name : test_environment.next_default_test_name();
+ properties = properties ? properties : {};
+ var test_obj = new Test(test_name, properties);
+ test_obj.step(func, test_obj, test_obj);
+ if (test_obj.phase === test_obj.phases.STARTED) {
+ test_obj.done();
+ }
+ }
+
+ function async_test(func, name, properties)
+ {
+ if (typeof func !== "function") {
+ properties = name;
+ name = func;
+ func = null;
+ }
+ var test_name = name ? name : test_environment.next_default_test_name();
+ properties = properties ? properties : {};
+ var test_obj = new Test(test_name, properties);
+ if (func) {
+ test_obj.step(func, test_obj, test_obj);
+ }
+ return test_obj;
+ }
+
+ function promise_test(func, name, properties) {
+ var test = async_test(name, properties);
+ Promise.resolve(test.step(func, test, test))
+ .then(
+ function() {
+ test.done();
+ })
+ .catch(test.step_func(
+ function(value) {
+ if (value instanceof AssertionError) {
+ throw value;
+ }
+ assert(false, "promise_test", null,
+ "Unhandled rejection with value: ${value}", {value:value});
+ }));
+ }
+
+ function setup(func_or_properties, maybe_properties)
+ {
+ var func = null;
+ var properties = {};
+ if (arguments.length === 2) {
+ func = func_or_properties;
+ properties = maybe_properties;
+ } else if (func_or_properties instanceof Function) {
+ func = func_or_properties;
+ } else {
+ properties = func_or_properties;
+ }
+ tests.setup(func, properties);
+ test_environment.on_new_harness_properties(properties);
+ }
+
+ function done() {
+ if (tests.tests.length === 0) {
+ tests.set_file_is_test();
+ }
+ if (tests.file_is_test) {
+ tests.tests[0].done();
+ }
+ tests.end_wait();
+ }
+
+ function generate_tests(func, args, properties) {
+ forEach(args, function(x, i)
+ {
+ var name = x[0];
+ test(function()
+ {
+ func.apply(this, x.slice(1));
+ },
+ name,
+ Array.isArray(properties) ? properties[i] : properties);
+ });
+ }
+
+ function on_event(object, event, callback)
+ {
+ object.addEventListener(event, callback, false);
+ }
+
+ expose(test, 'test');
+ expose(async_test, 'async_test');
+ expose(promise_test, 'promise_test');
+ expose(generate_tests, 'generate_tests');
+ expose(setup, 'setup');
+ expose(done, 'done');
+ expose(on_event, 'on_event');
+
+ /*
+ * Return a string truncated to the given length, with ... added at the end
+ * if it was longer.
+ */
+ function truncate(s, len)
+ {
+ if (s.length > len) {
+ return s.substring(0, len - 3) + "...";
+ }
+ return s;
+ }
+
+ /*
+ * Return true if object is probably a Node object.
+ */
+ function is_node(object)
+ {
+ // I use duck-typing instead of instanceof, because
+ // instanceof doesn't work if the node is from another window (like an
+ // iframe's contentWindow):
+ // http://www.w3.org/Bugs/Public/show_bug.cgi?id=12295
+ if ("nodeType" in object &&
+ "nodeName" in object &&
+ "nodeValue" in object &&
+ "childNodes" in object) {
+ try {
+ object.nodeType;
+ } catch (e) {
+ // The object is probably Node.prototype or another prototype
+ // object that inherits from it, and not a Node instance.
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * Convert a value to a nice, human-readable string
+ */
+ function format_value(val, seen)
+ {
+ if (!seen) {
+ seen = [];
+ }
+ if (typeof val === "object" && val !== null) {
+ if (seen.indexOf(val) >= 0) {
+ return "[...]";
+ }
+ seen.push(val);
+ }
+ if (Array.isArray(val)) {
+ return "[" + val.map(function(x) {return format_value(x, seen);}).join(", ") + "]";
+ }
+
+ switch (typeof val) {
+ case "string":
+ val = val.replace("\\", "\\\\");
+ for (var i = 0; i < 32; i++) {
+ var replace = "\\";
+ switch (i) {
+ case 0: replace += "0"; break;
+ case 1: replace += "x01"; break;
+ case 2: replace += "x02"; break;
+ case 3: replace += "x03"; break;
+ case 4: replace += "x04"; break;
+ case 5: replace += "x05"; break;
+ case 6: replace += "x06"; break;
+ case 7: replace += "x07"; break;
+ case 8: replace += "b"; break;
+ case 9: replace += "t"; break;
+ case 10: replace += "n"; break;
+ case 11: replace += "v"; break;
+ case 12: replace += "f"; break;
+ case 13: replace += "r"; break;
+ case 14: replace += "x0e"; break;
+ case 15: replace += "x0f"; break;
+ case 16: replace += "x10"; break;
+ case 17: replace += "x11"; break;
+ case 18: replace += "x12"; break;
+ case 19: replace += "x13"; break;
+ case 20: replace += "x14"; break;
+ case 21: replace += "x15"; break;
+ case 22: replace += "x16"; break;
+ case 23: replace += "x17"; break;
+ case 24: replace += "x18"; break;
+ case 25: replace += "x19"; break;
+ case 26: replace += "x1a"; break;
+ case 27: replace += "x1b"; break;
+ case 28: replace += "x1c"; break;
+ case 29: replace += "x1d"; break;
+ case 30: replace += "x1e"; break;
+ case 31: replace += "x1f"; break;
+ }
+ val = val.replace(RegExp(String.fromCharCode(i), "g"), replace);
+ }
+ return '"' + val.replace(/"/g, '\\"') + '"';
+ case "boolean":
+ case "undefined":
+ return String(val);
+ case "number":
+ // In JavaScript, -0 === 0 and String(-0) == "0", so we have to
+ // special-case.
+ if (val === -0 && 1/val === -Infinity) {
+ return "-0";
+ }
+ return String(val);
+ case "object":
+ if (val === null) {
+ return "null";
+ }
+
+ // Special-case Node objects, since those come up a lot in my tests. I
+ // ignore namespaces.
+ if (is_node(val)) {
+ switch (val.nodeType) {
+ case Node.ELEMENT_NODE:
+ var ret = "<" + val.localName;
+ for (var i = 0; i < val.attributes.length; i++) {
+ ret += " " + val.attributes[i].name + '="' + val.attributes[i].value + '"';
+ }
+ ret += ">" + val.innerHTML + "</" + val.localName + ">";
+ return "Element node " + truncate(ret, 60);
+ case Node.TEXT_NODE:
+ return 'Text node "' + truncate(val.data, 60) + '"';
+ case Node.PROCESSING_INSTRUCTION_NODE:
+ return "ProcessingInstruction node with target " + format_value(truncate(val.target, 60)) + " and data " + format_value(truncate(val.data, 60));
+ case Node.COMMENT_NODE:
+ return "Comment node <!--" + truncate(val.data, 60) + "-->";
+ case Node.DOCUMENT_NODE:
+ return "Document node with " + val.childNodes.length + (val.childNodes.length == 1 ? " child" : " children");
+ case Node.DOCUMENT_TYPE_NODE:
+ return "DocumentType node";
+ case Node.DOCUMENT_FRAGMENT_NODE:
+ return "DocumentFragment node with " + val.childNodes.length + (val.childNodes.length == 1 ? " child" : " children");
+ default:
+ return "Node object of unknown type";
+ }
+ }
+
+ /* falls through */
+ default:
+ return typeof val + ' "' + truncate(String(val), 60) + '"';
+ }
+ }
+ expose(format_value, "format_value");
+
+ /*
+ * Assertions
+ */
+
+ function assert_true(actual, description)
+ {
+ assert(actual === true, "assert_true", description,
+ "expected true got ${actual}", {actual:actual});
+ }
+ expose(assert_true, "assert_true");
+
+ function assert_false(actual, description)
+ {
+ assert(actual === false, "assert_false", description,
+ "expected false got ${actual}", {actual:actual});
+ }
+ expose(assert_false, "assert_false");
+
+ function same_value(x, y) {
+ if (y !== y) {
+ //NaN case
+ return x !== x;
+ }
+ if (x === 0 && y === 0) {
+ //Distinguish +0 and -0
+ return 1/x === 1/y;
+ }
+ return x === y;
+ }
+
+ function assert_equals(actual, expected, description)
+ {
+ /*
+ * Test if two primitives are equal or two objects
+ * are the same object
+ */
+ if (typeof actual != typeof expected) {
+ assert(false, "assert_equals", description,
+ "expected (" + typeof expected + ") ${expected} but got (" + typeof actual + ") ${actual}",
+ {expected:expected, actual:actual});
+ return;
+ }
+ assert(same_value(actual, expected), "assert_equals", description,
+ "expected ${expected} but got ${actual}",
+ {expected:expected, actual:actual});
+ }
+ expose(assert_equals, "assert_equals");
+
+ function assert_not_equals(actual, expected, description)
+ {
+ /*
+ * Test if two primitives are unequal or two objects
+ * are different objects
+ */
+ assert(!same_value(actual, expected), "assert_not_equals", description,
+ "got disallowed value ${actual}",
+ {actual:actual});
+ }
+ expose(assert_not_equals, "assert_not_equals");
+
+ function assert_in_array(actual, expected, description)
+ {
+ assert(expected.indexOf(actual) != -1, "assert_in_array", description,
+ "value ${actual} not in array ${expected}",
+ {actual:actual, expected:expected});
+ }
+ expose(assert_in_array, "assert_in_array");
+
+ function assert_object_equals(actual, expected, description)
+ {
+ //This needs to be improved a great deal
+ function check_equal(actual, expected, stack)
+ {
+ stack.push(actual);
+
+ var p;
+ for (p in actual) {
+ assert(expected.hasOwnProperty(p), "assert_object_equals", description,
+ "unexpected property ${p}", {p:p});
+
+ if (typeof actual[p] === "object" && actual[p] !== null) {
+ if (stack.indexOf(actual[p]) === -1) {
+ check_equal(actual[p], expected[p], stack);
+ }
+ } else {
+ assert(same_value(actual[p], expected[p]), "assert_object_equals", description,
+ "property ${p} expected ${expected} got ${actual}",
+ {p:p, expected:expected, actual:actual});
+ }
+ }
+ for (p in expected) {
+ assert(actual.hasOwnProperty(p),
+ "assert_object_equals", description,
+ "expected property ${p} missing", {p:p});
+ }
+ stack.pop();
+ }
+ check_equal(actual, expected, []);
+ }
+ expose(assert_object_equals, "assert_object_equals");
+
+ function assert_array_equals(actual, expected, description)
+ {
+ assert(actual.length === expected.length,
+ "assert_array_equals", description,
+ "lengths differ, expected ${expected} got ${actual}",
+ {expected:expected.length, actual:actual.length});
+
+ for (var i = 0; i < actual.length; i++) {
+ assert(actual.hasOwnProperty(i) === expected.hasOwnProperty(i),
+ "assert_array_equals", description,
+ "property ${i}, property expected to be ${expected} but was ${actual}",
+ {i:i, expected:expected.hasOwnProperty(i) ? "present" : "missing",
+ actual:actual.hasOwnProperty(i) ? "present" : "missing"});
+ assert(same_value(expected[i], actual[i]),
+ "assert_array_equals", description,
+ "property ${i}, expected ${expected} but got ${actual}",
+ {i:i, expected:expected[i], actual:actual[i]});
+ }
+ }
+ expose(assert_array_equals, "assert_array_equals");
+
+ function assert_approx_equals(actual, expected, epsilon, description)
+ {
+ /*
+ * Test if two primitive numbers are equal within +/- epsilon
+ */
+ assert(typeof actual === "number",
+ "assert_approx_equals", description,
+ "expected a number but got a ${type_actual}",
+ {type_actual:typeof actual});
+
+ assert(Math.abs(actual - expected) <= epsilon,
+ "assert_approx_equals", description,
+ "expected ${expected} +/- ${epsilon} but got ${actual}",
+ {expected:expected, actual:actual, epsilon:epsilon});
+ }
+ expose(assert_approx_equals, "assert_approx_equals");
+
+ function assert_less_than(actual, expected, description)
+ {
+ /*
+ * Test if a primitive number is less than another
+ */
+ assert(typeof actual === "number",
+ "assert_less_than", description,
+ "expected a number but got a ${type_actual}",
+ {type_actual:typeof actual});
+
+ assert(actual < expected,
+ "assert_less_than", description,
+ "expected a number less than ${expected} but got ${actual}",
+ {expected:expected, actual:actual});
+ }
+ expose(assert_less_than, "assert_less_than");
+
+ function assert_greater_than(actual, expected, description)
+ {
+ /*
+ * Test if a primitive number is greater than another
+ */
+ assert(typeof actual === "number",
+ "assert_greater_than", description,
+ "expected a number but got a ${type_actual}",
+ {type_actual:typeof actual});
+
+ assert(actual > expected,
+ "assert_greater_than", description,
+ "expected a number greater than ${expected} but got ${actual}",
+ {expected:expected, actual:actual});
+ }
+ expose(assert_greater_than, "assert_greater_than");
+
+ function assert_less_than_equal(actual, expected, description)
+ {
+ /*
+ * Test if a primitive number is less than or equal to another
+ */
+ assert(typeof actual === "number",
+ "assert_less_than_equal", description,
+ "expected a number but got a ${type_actual}",
+ {type_actual:typeof actual});
+
+ assert(actual <= expected,
+ "assert_less_than", description,
+ "expected a number less than or equal to ${expected} but got ${actual}",
+ {expected:expected, actual:actual});
+ }
+ expose(assert_less_than_equal, "assert_less_than_equal");
+
+ function assert_greater_than_equal(actual, expected, description)
+ {
+ /*
+ * Test if a primitive number is greater than or equal to another
+ */
+ assert(typeof actual === "number",
+ "assert_greater_than_equal", description,
+ "expected a number but got a ${type_actual}",
+ {type_actual:typeof actual});
+
+ assert(actual >= expected,
+ "assert_greater_than_equal", description,
+ "expected a number greater than or equal to ${expected} but got ${actual}",
+ {expected:expected, actual:actual});
+ }
+ expose(assert_greater_than_equal, "assert_greater_than_equal");
+
+ function assert_regexp_match(actual, expected, description) {
+ /*
+ * Test if a string (actual) matches a regexp (expected)
+ */
+ assert(expected.test(actual),
+ "assert_regexp_match", description,
+ "expected ${expected} but got ${actual}",
+ {expected:expected, actual:actual});
+ }
+ expose(assert_regexp_match, "assert_regexp_match");
+
+ function assert_class_string(object, class_string, description) {
+ assert_equals({}.toString.call(object), "[object " + class_string + "]",
+ description);
+ }
+ expose(assert_class_string, "assert_class_string");
+
+
+ function _assert_own_property(name) {
+ return function(object, property_name, description)
+ {
+ assert(property_name in object,
+ name, description,
+ "expected property ${p} missing", {p:property_name});
+ };
+ }
+ expose(_assert_own_property("assert_exists"), "assert_exists");
+ expose(_assert_own_property("assert_own_property"), "assert_own_property");
+
+ function assert_not_exists(object, property_name, description)
+ {
+ assert(!object.hasOwnProperty(property_name),
+ "assert_not_exists", description,
+ "unexpected property ${p} found", {p:property_name});
+ }
+ expose(assert_not_exists, "assert_not_exists");
+
+ function _assert_inherits(name) {
+ return function (object, property_name, description)
+ {
+ assert(typeof object === "object",
+ name, description,
+ "provided value is not an object");
+
+ assert("hasOwnProperty" in object,
+ name, description,
+ "provided value is an object but has no hasOwnProperty method");
+
+ assert(!object.hasOwnProperty(property_name),
+ name, description,
+ "property ${p} found on object expected in prototype chain",
+ {p:property_name});
+
+ assert(property_name in object,
+ name, description,
+ "property ${p} not found in prototype chain",
+ {p:property_name});
+ };
+ }
+ expose(_assert_inherits("assert_inherits"), "assert_inherits");
+ expose(_assert_inherits("assert_idl_attribute"), "assert_idl_attribute");
+
+ function assert_readonly(object, property_name, description)
+ {
+ var initial_value = object[property_name];
+ try {
+ //Note that this can have side effects in the case where
+ //the property has PutForwards
+ object[property_name] = initial_value + "a"; //XXX use some other value here?
+ assert(same_value(object[property_name], initial_value),
+ "assert_readonly", description,
+ "changing property ${p} succeeded",
+ {p:property_name});
+ } finally {
+ object[property_name] = initial_value;
+ }
+ }
+ expose(assert_readonly, "assert_readonly");
+
+ function assert_throws(code, func, description)
+ {
+ try {
+ func.call(this);
+ assert(false, "assert_throws", description,
+ "${func} did not throw", {func:func});
+ } catch (e) {
+ if (e instanceof AssertionError) {
+ throw e;
+ }
+ if (code === null) {
+ return;
+ }
+ if (typeof code === "object") {
+ assert(typeof e == "object" && "name" in e && e.name == code.name,
+ "assert_throws", description,
+ "${func} threw ${actual} (${actual_name}) expected ${expected} (${expected_name})",
+ {func:func, actual:e, actual_name:e.name,
+ expected:code,
+ expected_name:code.name});
+ return;
+ }
+
+ var code_name_map = {
+ INDEX_SIZE_ERR: 'IndexSizeError',
+ HIERARCHY_REQUEST_ERR: 'HierarchyRequestError',
+ WRONG_DOCUMENT_ERR: 'WrongDocumentError',
+ INVALID_CHARACTER_ERR: 'InvalidCharacterError',
+ NO_MODIFICATION_ALLOWED_ERR: 'NoModificationAllowedError',
+ NOT_FOUND_ERR: 'NotFoundError',
+ NOT_SUPPORTED_ERR: 'NotSupportedError',
+ INVALID_STATE_ERR: 'InvalidStateError',
+ SYNTAX_ERR: 'SyntaxError',
+ INVALID_MODIFICATION_ERR: 'InvalidModificationError',
+ NAMESPACE_ERR: 'NamespaceError',
+ INVALID_ACCESS_ERR: 'InvalidAccessError',
+ TYPE_MISMATCH_ERR: 'TypeMismatchError',
+ SECURITY_ERR: 'SecurityError',
+ NETWORK_ERR: 'NetworkError',
+ ABORT_ERR: 'AbortError',
+ URL_MISMATCH_ERR: 'URLMismatchError',
+ QUOTA_EXCEEDED_ERR: 'QuotaExceededError',
+ TIMEOUT_ERR: 'TimeoutError',
+ INVALID_NODE_TYPE_ERR: 'InvalidNodeTypeError',
+ DATA_CLONE_ERR: 'DataCloneError'
+ };
+
+ var name = code in code_name_map ? code_name_map[code] : code;
+
+ var name_code_map = {
+ IndexSizeError: 1,
+ HierarchyRequestError: 3,
+ WrongDocumentError: 4,
+ InvalidCharacterError: 5,
+ NoModificationAllowedError: 7,
+ NotFoundError: 8,
+ NotSupportedError: 9,
+ InvalidStateError: 11,
+ SyntaxError: 12,
+ InvalidModificationError: 13,
+ NamespaceError: 14,
+ InvalidAccessError: 15,
+ TypeMismatchError: 17,
+ SecurityError: 18,
+ NetworkError: 19,
+ AbortError: 20,
+ URLMismatchError: 21,
+ QuotaExceededError: 22,
+ TimeoutError: 23,
+ InvalidNodeTypeError: 24,
+ DataCloneError: 25,
+
+ UnknownError: 0,
+ ConstraintError: 0,
+ DataError: 0,
+ TransactionInactiveError: 0,
+ ReadOnlyError: 0,
+ VersionError: 0
+ };
+
+ if (!(name in name_code_map)) {
+ throw new AssertionError('Test bug: unrecognized DOMException code "' + code + '" passed to assert_throws()');
+ }
+
+ var required_props = { code: name_code_map[name] };
+
+ if (required_props.code === 0 ||
+ ("name" in e && e.name !== e.name.toUpperCase() && e.name !== "DOMException")) {
+ // New style exception: also test the name property.
+ required_props.name = name;
+ }
+
+ //We'd like to test that e instanceof the appropriate interface,
+ //but we can't, because we don't know what window it was created
+ //in. It might be an instanceof the appropriate interface on some
+ //unknown other window. TODO: Work around this somehow?
+
+ assert(typeof e == "object",
+ "assert_throws", description,
+ "${func} threw ${e} with type ${type}, not an object",
+ {func:func, e:e, type:typeof e});
+
+ for (var prop in required_props) {
+ assert(typeof e == "object" && prop in e && e[prop] == required_props[prop],
+ "assert_throws", description,
+ "${func} threw ${e} that is not a DOMException " + code + ": property ${prop} is equal to ${actual}, expected ${expected}",
+ {func:func, e:e, prop:prop, actual:e[prop], expected:required_props[prop]});
+ }
+ }
+ }
+ expose(assert_throws, "assert_throws");
+
+ function assert_unreached(description) {
+ assert(false, "assert_unreached", description,
+ "Reached unreachable code");
+ }
+ expose(assert_unreached, "assert_unreached");
+
+ function assert_any(assert_func, actual, expected_array)
+ {
+ var args = [].slice.call(arguments, 3);
+ var errors = [];
+ var passed = false;
+ forEach(expected_array,
+ function(expected)
+ {
+ try {
+ assert_func.apply(this, [actual, expected].concat(args));
+ passed = true;
+ } catch (e) {
+ errors.push(e.message);
+ }
+ });
+ if (!passed) {
+ throw new AssertionError(errors.join("\n\n"));
+ }
+ }
+ expose(assert_any, "assert_any");
+
+ function Test(name, properties)
+ {
+ if (tests.file_is_test && tests.tests.length) {
+ throw new Error("Tried to create a test with file_is_test");
+ }
+ this.name = name;
+
+ this.phase = this.phases.INITIAL;
+
+ this.status = this.NOTRUN;
+ this.timeout_id = null;
+ this.index = null;
+
+ this.properties = properties;
+ var timeout = properties.timeout ? properties.timeout : settings.test_timeout;
+ if (timeout !== null) {
+ this.timeout_length = timeout * tests.timeout_multiplier;
+ } else {
+ this.timeout_length = null;
+ }
+
+ this.message = null;
+
+ this.steps = [];
+
+ this.cleanup_callbacks = [];
+
+ tests.push(this);
+ }
+
+ Test.statuses = {
+ PASS:0,
+ FAIL:1,
+ TIMEOUT:2,
+ NOTRUN:3
+ };
+
+ Test.prototype = merge({}, Test.statuses);
+
+ Test.prototype.phases = {
+ INITIAL:0,
+ STARTED:1,
+ HAS_RESULT:2,
+ COMPLETE:3
+ };
+
+ Test.prototype.structured_clone = function()
+ {
+ if (!this._structured_clone) {
+ var msg = this.message;
+ msg = msg ? String(msg) : msg;
+ this._structured_clone = merge({
+ name:String(this.name),
+ properties:merge({}, this.properties),
+ }, Test.statuses);
+ }
+ this._structured_clone.status = this.status;
+ this._structured_clone.message = this.message;
+ this._structured_clone.index = this.index;
+ return this._structured_clone;
+ };
+
+ Test.prototype.step = function(func, this_obj)
+ {
+ if (this.phase > this.phases.STARTED) {
+ return;
+ }
+ this.phase = this.phases.STARTED;
+ //If we don't get a result before the harness times out that will be a test timeout
+ this.set_status(this.TIMEOUT, "Test timed out");
+
+ tests.started = true;
+ tests.notify_test_state(this);
+
+ if (this.timeout_id === null) {
+ this.set_timeout();
+ }
+
+ this.steps.push(func);
+
+ if (arguments.length === 1) {
+ this_obj = this;
+ }
+
+ try {
+ return func.apply(this_obj, Array.prototype.slice.call(arguments, 2));
+ } catch (e) {
+ if (this.phase >= this.phases.HAS_RESULT) {
+ return;
+ }
+ var message = (typeof e === "object" && e !== null) ? e.message : e;
+ if (typeof e.stack != "undefined" && typeof e.message == "string") {
+ //Try to make it more informative for some exceptions, at least
+ //in Gecko and WebKit. This results in a stack dump instead of
+ //just errors like "Cannot read property 'parentNode' of null"
+ //or "root is null". Makes it a lot longer, of course.
+ message += "(stack: " + e.stack + ")";
+ }
+ this.set_status(this.FAIL, message);
+ this.phase = this.phases.HAS_RESULT;
+ this.done();
+ }
+ };
+
+ Test.prototype.step_func = function(func, this_obj)
+ {
+ var test_this = this;
+
+ if (arguments.length === 1) {
+ this_obj = test_this;
+ }
+
+ return function()
+ {
+ return test_this.step.apply(test_this, [func, this_obj].concat(
+ Array.prototype.slice.call(arguments)));
+ };
+ };
+
+ Test.prototype.step_func_done = function(func, this_obj)
+ {
+ var test_this = this;
+
+ if (arguments.length === 1) {
+ this_obj = test_this;
+ }
+
+ return function()
+ {
+ if (func) {
+ test_this.step.apply(test_this, [func, this_obj].concat(
+ Array.prototype.slice.call(arguments)));
+ }
+ test_this.done();
+ };
+ };
+
+ Test.prototype.unreached_func = function(description)
+ {
+ return this.step_func(function() {
+ assert_unreached(description);
+ });
+ };
+
+ Test.prototype.add_cleanup = function(callback) {
+ this.cleanup_callbacks.push(callback);
+ };
+
+ Test.prototype.force_timeout = function() {
+ this.set_status(this.TIMEOUT);
+ this.phase = this.phases.HAS_RESULT;
+ };
+
+ Test.prototype.set_timeout = function()
+ {
+ if (this.timeout_length !== null) {
+ var this_obj = this;
+ this.timeout_id = setTimeout(function()
+ {
+ this_obj.timeout();
+ }, this.timeout_length);
+ }
+ };
+
+ Test.prototype.set_status = function(status, message)
+ {
+ this.status = status;
+ this.message = message;
+ };
+
+ Test.prototype.timeout = function()
+ {
+ this.timeout_id = null;
+ this.set_status(this.TIMEOUT, "Test timed out");
+ this.phase = this.phases.HAS_RESULT;
+ this.done();
+ };
+
+ Test.prototype.done = function()
+ {
+ if (this.phase == this.phases.COMPLETE) {
+ return;
+ }
+
+ if (this.phase <= this.phases.STARTED) {
+ this.set_status(this.PASS, null);
+ }
+
+ this.phase = this.phases.COMPLETE;
+
+ clearTimeout(this.timeout_id);
+ tests.result(this);
+ this.cleanup();
+ };
+
+ Test.prototype.cleanup = function() {
+ forEach(this.cleanup_callbacks,
+ function(cleanup_callback) {
+ cleanup_callback();
+ });
+ };
+
+ /*
+ * A RemoteTest object mirrors a Test object on a remote worker. The
+ * associated RemoteWorker updates the RemoteTest object in response to
+ * received events. In turn, the RemoteTest object replicates these events
+ * on the local document. This allows listeners (test result reporting
+ * etc..) to transparently handle local and remote events.
+ */
+ function RemoteTest(clone) {
+ var this_obj = this;
+ Object.keys(clone).forEach(
+ function(key) {
+ this_obj[key] = clone[key];
+ });
+ this.index = null;
+ this.phase = this.phases.INITIAL;
+ this.update_state_from(clone);
+ tests.push(this);
+ }
+
+ RemoteTest.prototype.structured_clone = function() {
+ var clone = {};
+ Object.keys(this).forEach(
+ function(key) {
+ if (typeof(this[key]) === "object") {
+ clone[key] = merge({}, this[key]);
+ } else {
+ clone[key] = this[key];
+ }
+ });
+ clone.phases = merge({}, this.phases);
+ return clone;
+ };
+
+ RemoteTest.prototype.cleanup = function() {};
+ RemoteTest.prototype.phases = Test.prototype.phases;
+ RemoteTest.prototype.update_state_from = function(clone) {
+ this.status = clone.status;
+ this.message = clone.message;
+ if (this.phase === this.phases.INITIAL) {
+ this.phase = this.phases.STARTED;
+ }
+ };
+ RemoteTest.prototype.done = function() {
+ this.phase = this.phases.COMPLETE;
+ }
+
+ /*
+ * A RemoteWorker listens for test events from a worker. These events are
+ * then used to construct and maintain RemoteTest objects that mirror the
+ * tests running on the remote worker.
+ */
+ function RemoteWorker(worker) {
+ this.running = true;
+ this.tests = new Array();
+
+ var this_obj = this;
+ worker.onerror = function(error) { this_obj.worker_error(error); };
+
+ var message_port;
+
+ if (is_service_worker(worker)) {
+ // The ServiceWorker's implicit MessagePort is currently not
+ // reliably accessible from the ServiceWorkerGlobalScope due to
+ // Blink setting MessageEvent.source to null for messages sent via
+ // ServiceWorker.postMessage(). Until that's resolved, create an
+ // explicit MessageChannel and pass one end to the worker.
+ var message_channel = new MessageChannel();
+ message_port = message_channel.port1;
+ message_port.start();
+ worker.postMessage({type: "connect"}, [message_channel.port2]);
+ } else if (is_shared_worker(worker)) {
+ message_port = worker.port;
+ } else {
+ message_port = worker;
+ }
+
+ // Keeping a reference to the worker until worker_done() is seen
+ // prevents the Worker object and its MessageChannel from going away
+ // before all the messages are dispatched.
+ this.worker = worker;
+
+ message_port.onmessage =
+ function(message) {
+ if (this_obj.running && (message.data.type in this_obj.message_handlers)) {
+ this_obj.message_handlers[message.data.type].call(this_obj, message.data);
+ }
+ };
+ }
+
+ RemoteWorker.prototype.worker_error = function(error) {
+ var message = error.message || String(error);
+ var filename = (error.filename ? " " + error.filename: "");
+ // FIXME: Display worker error states separately from main document
+ // error state.
+ this.worker_done({
+ status: {
+ status: tests.status.ERROR,
+ message: "Error in worker" + filename + ": " + message
+ }
+ });
+ error.preventDefault();
+ };
+
+ RemoteWorker.prototype.test_state = function(data) {
+ var remote_test = this.tests[data.test.index];
+ if (!remote_test) {
+ remote_test = new RemoteTest(data.test);
+ this.tests[data.test.index] = remote_test;
+ }
+ remote_test.update_state_from(data.test);
+ tests.notify_test_state(remote_test);
+ };
+
+ RemoteWorker.prototype.test_done = function(data) {
+ var remote_test = this.tests[data.test.index];
+ remote_test.update_state_from(data.test);
+ remote_test.done();
+ tests.result(remote_test);
+ };
+
+ RemoteWorker.prototype.worker_done = function(data) {
+ if (tests.status.status === null &&
+ data.status.status !== data.status.OK) {
+ tests.status.status = data.status.status;
+ tests.status.message = data.status.message;
+ }
+ this.running = false;
+ this.worker = null;
+ if (tests.all_done()) {
+ tests.complete();
+ }
+ };
+
+ RemoteWorker.prototype.message_handlers = {
+ test_state: RemoteWorker.prototype.test_state,
+ result: RemoteWorker.prototype.test_done,
+ complete: RemoteWorker.prototype.worker_done
+ };
+
+ /*
+ * Harness
+ */
+
+ function TestsStatus()
+ {
+ this.status = null;
+ this.message = null;
+ }
+
+ TestsStatus.statuses = {
+ OK:0,
+ ERROR:1,
+ TIMEOUT:2
+ };
+
+ TestsStatus.prototype = merge({}, TestsStatus.statuses);
+
+ TestsStatus.prototype.structured_clone = function()
+ {
+ if (!this._structured_clone) {
+ var msg = this.message;
+ msg = msg ? String(msg) : msg;
+ this._structured_clone = merge({
+ status:this.status,
+ message:msg
+ }, TestsStatus.statuses);
+ }
+ return this._structured_clone;
+ };
+
+ function Tests()
+ {
+ this.tests = [];
+ this.num_pending = 0;
+
+ this.phases = {
+ INITIAL:0,
+ SETUP:1,
+ HAVE_TESTS:2,
+ HAVE_RESULTS:3,
+ COMPLETE:4
+ };
+ this.phase = this.phases.INITIAL;
+
+ this.properties = {};
+
+ this.wait_for_finish = false;
+ this.processing_callbacks = false;
+
+ this.allow_uncaught_exception = false;
+
+ this.file_is_test = false;
+
+ this.timeout_multiplier = 1;
+ this.timeout_length = test_environment.test_timeout();
+ this.timeout_id = null;
+
+ this.start_callbacks = [];
+ this.test_state_callbacks = [];
+ this.test_done_callbacks = [];
+ this.all_done_callbacks = [];
+
+ this.pending_workers = [];
+
+ this.status = new TestsStatus();
+
+ var this_obj = this;
+
+ test_environment.add_on_loaded_callback(function() {
+ if (this_obj.all_done()) {
+ this_obj.complete();
+ }
+ });
+
+ this.set_timeout();
+ }
+
+ Tests.prototype.setup = function(func, properties)
+ {
+ if (this.phase >= this.phases.HAVE_RESULTS) {
+ return;
+ }
+
+ if (this.phase < this.phases.SETUP) {
+ this.phase = this.phases.SETUP;
+ }
+
+ this.properties = properties;
+
+ for (var p in properties) {
+ if (properties.hasOwnProperty(p)) {
+ var value = properties[p];
+ if (p == "allow_uncaught_exception") {
+ this.allow_uncaught_exception = value;
+ } else if (p == "explicit_done" && value) {
+ this.wait_for_finish = true;
+ } else if (p == "explicit_timeout" && value) {
+ this.timeout_length = null;
+ if (this.timeout_id)
+ {
+ clearTimeout(this.timeout_id);
+ }
+ } else if (p == "timeout_multiplier") {
+ this.timeout_multiplier = value;
+ }
+ }
+ }
+
+ if (func) {
+ try {
+ func();
+ } catch (e) {
+ this.status.status = this.status.ERROR;
+ this.status.message = String(e);
+ }
+ }
+ this.set_timeout();
+ };
+
+ Tests.prototype.set_file_is_test = function() {
+ if (this.tests.length > 0) {
+ throw new Error("Tried to set file as test after creating a test");
+ }
+ this.wait_for_finish = true;
+ this.file_is_test = true;
+ // Create the test, which will add it to the list of tests
+ async_test();
+ };
+
+ Tests.prototype.set_timeout = function() {
+ var this_obj = this;
+ clearTimeout(this.timeout_id);
+ if (this.timeout_length !== null) {
+ this.timeout_id = setTimeout(function() {
+ this_obj.timeout();
+ }, this.timeout_length);
+ }
+ };
+
+ Tests.prototype.timeout = function() {
+ if (this.status.status === null) {
+ this.status.status = this.status.TIMEOUT;
+ }
+ this.complete();
+ };
+
+ Tests.prototype.end_wait = function()
+ {
+ this.wait_for_finish = false;
+ if (this.all_done()) {
+ this.complete();
+ }
+ };
+
+ Tests.prototype.push = function(test)
+ {
+ if (this.phase < this.phases.HAVE_TESTS) {
+ this.start();
+ }
+ this.num_pending++;
+ test.index = this.tests.push(test);
+ this.notify_test_state(test);
+ };
+
+ Tests.prototype.notify_test_state = function(test) {
+ var this_obj = this;
+ forEach(this.test_state_callbacks,
+ function(callback) {
+ callback(test, this_obj);
+ });
+ };
+
+ Tests.prototype.all_done = function() {
+ return (this.tests.length > 0 && test_environment.all_loaded &&
+ this.num_pending === 0 && !this.wait_for_finish &&
+ !this.processing_callbacks &&
+ !this.pending_workers.some(function(w) { return w.running; }));
+ };
+
+ Tests.prototype.start = function() {
+ this.phase = this.phases.HAVE_TESTS;
+ this.notify_start();
+ };
+
+ Tests.prototype.notify_start = function() {
+ var this_obj = this;
+ forEach (this.start_callbacks,
+ function(callback)
+ {
+ callback(this_obj.properties);
+ });
+ };
+
+ Tests.prototype.result = function(test)
+ {
+ if (this.phase > this.phases.HAVE_RESULTS) {
+ return;
+ }
+ this.phase = this.phases.HAVE_RESULTS;
+ this.num_pending--;
+ this.notify_result(test);
+ };
+
+ Tests.prototype.notify_result = function(test) {
+ var this_obj = this;
+ this.processing_callbacks = true;
+ forEach(this.test_done_callbacks,
+ function(callback)
+ {
+ callback(test, this_obj);
+ });
+ this.processing_callbacks = false;
+ if (this_obj.all_done()) {
+ this_obj.complete();
+ }
+ };
+
+ Tests.prototype.complete = function() {
+ if (this.phase === this.phases.COMPLETE) {
+ return;
+ }
+ this.phase = this.phases.COMPLETE;
+ var this_obj = this;
+ this.tests.forEach(
+ function(x)
+ {
+ if (x.phase < x.phases.COMPLETE) {
+ this_obj.notify_result(x);
+ x.cleanup();
+ x.phase = x.phases.COMPLETE;
+ }
+ }
+ );
+ this.notify_complete();
+ };
+
+ Tests.prototype.notify_complete = function() {
+ var this_obj = this;
+ if (this.status.status === null) {
+ this.status.status = this.status.OK;
+ }
+
+ forEach (this.all_done_callbacks,
+ function(callback)
+ {
+ callback(this_obj.tests, this_obj.status);
+ });
+ };
+
+ Tests.prototype.fetch_tests_from_worker = function(worker) {
+ if (this.phase >= this.phases.COMPLETE) {
+ return;
+ }
+
+ this.pending_workers.push(new RemoteWorker(worker));
+ };
+
+ function fetch_tests_from_worker(port) {
+ tests.fetch_tests_from_worker(port);
+ }
+ expose(fetch_tests_from_worker, 'fetch_tests_from_worker');
+
+ function timeout() {
+ if (tests.timeout_length === null) {
+ tests.timeout();
+ }
+ }
+ expose(timeout, 'timeout');
+
+ function add_start_callback(callback) {
+ tests.start_callbacks.push(callback);
+ }
+
+ function add_test_state_callback(callback) {
+ tests.test_state_callbacks.push(callback);
+ }
+
+ function add_result_callback(callback)
+ {
+ tests.test_done_callbacks.push(callback);
+ }
+
+ function add_completion_callback(callback)
+ {
+ tests.all_done_callbacks.push(callback);
+ }
+
+ expose(add_start_callback, 'add_start_callback');
+ expose(add_test_state_callback, 'add_test_state_callback');
+ expose(add_result_callback, 'add_result_callback');
+ expose(add_completion_callback, 'add_completion_callback');
+
+ /*
+ * Output listener
+ */
+
+ function Output() {
+ this.output_document = document;
+ this.output_node = null;
+ this.enabled = settings.output;
+ this.phase = this.INITIAL;
+ }
+
+ Output.prototype.INITIAL = 0;
+ Output.prototype.STARTED = 1;
+ Output.prototype.HAVE_RESULTS = 2;
+ Output.prototype.COMPLETE = 3;
+
+ Output.prototype.setup = function(properties) {
+ if (this.phase > this.INITIAL) {
+ return;
+ }
+
+ //If output is disabled in testharnessreport.js the test shouldn't be
+ //able to override that
+ this.enabled = this.enabled && (properties.hasOwnProperty("output") ?
+ properties.output : settings.output);
+ };
+
+ Output.prototype.init = function(properties) {
+ if (this.phase >= this.STARTED) {
+ return;
+ }
+ if (properties.output_document) {
+ this.output_document = properties.output_document;
+ } else {
+ this.output_document = document;
+ }
+ this.phase = this.STARTED;
+ };
+
+ Output.prototype.resolve_log = function() {
+ var output_document;
+ if (typeof this.output_document === "function") {
+ output_document = this.output_document.apply(undefined);
+ } else {
+ output_document = this.output_document;
+ }
+ if (!output_document) {
+ return;
+ }
+ var node = output_document.getElementById("log");
+ if (!node) {
+ if (!document.body || document.readyState == "loading") {
+ return;
+ }
+ node = output_document.createElement("div");
+ node.id = "log";
+ output_document.body.appendChild(node);
+ }
+ this.output_document = output_document;
+ this.output_node = node;
+ };
+
+ Output.prototype.show_status = function() {
+ if (this.phase < this.STARTED) {
+ this.init();
+ }
+ if (!this.enabled) {
+ return;
+ }
+ if (this.phase < this.HAVE_RESULTS) {
+ this.resolve_log();
+ this.phase = this.HAVE_RESULTS;
+ }
+ var done_count = tests.tests.length - tests.num_pending;
+ if (this.output_node) {
+ if (done_count < 100 ||
+ (done_count < 1000 && done_count % 100 === 0) ||
+ done_count % 1000 === 0) {
+ this.output_node.textContent = "Running, " +
+ done_count + " complete, " +
+ tests.num_pending + " remain";
+ }
+ }
+ };
+
+ Output.prototype.show_results = function (tests, harness_status) {
+ if (this.phase >= this.COMPLETE) {
+ return;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ if (!this.output_node) {
+ this.resolve_log();
+ }
+ this.phase = this.COMPLETE;
+
+ var log = this.output_node;
+ if (!log) {
+ return;
+ }
+ var output_document = this.output_document;
+
+ while (log.lastChild) {
+ log.removeChild(log.lastChild);
+ }
+
+ var script_prefix = null;
+ var scripts = document.getElementsByTagName("script");
+ for (var i = 0; i < scripts.length; i++) {
+ var src;
+ if (scripts[i].src) {
+ src = scripts[i].src;
+ } else if (scripts[i].href) {
+ //SVG case
+ src = scripts[i].href.baseVal;
+ }
+
+ var matches = src && src.match(/^(.*\/|)testharness\.js$/);
+ if (matches) {
+ script_prefix = matches[1];
+ break;
+ }
+ }
+
+ if (script_prefix !== null) {
+ var stylesheet = output_document.createElementNS(xhtml_ns, "link");
+ stylesheet.setAttribute("rel", "stylesheet");
+ stylesheet.setAttribute("href", script_prefix + "testharness.css");
+ var heads = output_document.getElementsByTagName("head");
+ if (heads.length) {
+ heads[0].appendChild(stylesheet);
+ }
+ }
+
+ var status_text_harness = {};
+ status_text_harness[harness_status.OK] = "OK";
+ status_text_harness[harness_status.ERROR] = "Error";
+ status_text_harness[harness_status.TIMEOUT] = "Timeout";
+
+ var status_text = {};
+ status_text[Test.prototype.PASS] = "Pass";
+ status_text[Test.prototype.FAIL] = "Fail";
+ status_text[Test.prototype.TIMEOUT] = "Timeout";
+ status_text[Test.prototype.NOTRUN] = "Not Run";
+
+ var status_number = {};
+ forEach(tests,
+ function(test) {
+ var status = status_text[test.status];
+ if (status_number.hasOwnProperty(status)) {
+ status_number[status] += 1;
+ } else {
+ status_number[status] = 1;
+ }
+ });
+
+ function status_class(status)
+ {
+ return status.replace(/\s/g, '').toLowerCase();
+ }
+
+ var summary_template = ["section", {"id":"summary"},
+ ["h2", {}, "Summary"],
+ function()
+ {
+
+ var status = status_text_harness[harness_status.status];
+ var rv = [["section", {},
+ ["p", {},
+ "Harness status: ",
+ ["span", {"class":status_class(status)},
+ status
+ ],
+ ]
+ ]];
+
+ if (harness_status.status === harness_status.ERROR) {
+ rv[0].push(["pre", {}, harness_status.message]);
+ }
+ return rv;
+ },
+ ["p", {}, "Found ${num_tests} tests"],
+ function() {
+ var rv = [["div", {}]];
+ var i = 0;
+ while (status_text.hasOwnProperty(i)) {
+ if (status_number.hasOwnProperty(status_text[i])) {
+ var status = status_text[i];
+ rv[0].push(["div", {"class":status_class(status)},
+ ["label", {},
+ ["input", {type:"checkbox", checked:"checked"}],
+ status_number[status] + " " + status]]);
+ }
+ i++;
+ }
+ return rv;
+ },
+ ];
+
+ log.appendChild(render(summary_template, {num_tests:tests.length}, output_document));
+
+ forEach(output_document.querySelectorAll("section#summary label"),
+ function(element)
+ {
+ on_event(element, "click",
+ function(e)
+ {
+ if (output_document.getElementById("results") === null) {
+ e.preventDefault();
+ return;
+ }
+ var result_class = element.parentNode.getAttribute("class");
+ var style_element = output_document.querySelector("style#hide-" + result_class);
+ var input_element = element.querySelector("input");
+ if (!style_element && !input_element.checked) {
+ style_element = output_document.createElementNS(xhtml_ns, "style");
+ style_element.id = "hide-" + result_class;
+ style_element.textContent = "table#results > tbody > tr."+result_class+"{display:none}";
+ output_document.body.appendChild(style_element);
+ } else if (style_element && input_element.checked) {
+ style_element.parentNode.removeChild(style_element);
+ }
+ });
+ });
+
+ // This use of innerHTML plus manual escaping is not recommended in
+ // general, but is necessary here for performance. Using textContent
+ // on each individual <td> adds tens of seconds of execution time for
+ // large test suites (tens of thousands of tests).
+ function escape_html(s)
+ {
+ return s.replace(/\&/g, "&")
+ .replace(/</g, "<")
+ .replace(/"/g, """)
+ .replace(/'/g, "'");
+ }
+
+ function has_assertions()
+ {
+ for (var i = 0; i < tests.length; i++) {
+ if (tests[i].properties.hasOwnProperty("assert")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ function get_assertion(test)
+ {
+ if (test.properties.hasOwnProperty("assert")) {
+ if (Array.isArray(test.properties.assert)) {
+ return test.properties.assert.join(' ');
+ }
+ return test.properties.assert;
+ }
+ return '';
+ }
+
+ log.appendChild(document.createElementNS(xhtml_ns, "section"));
+ var assertions = has_assertions();
+ var html = "<h2>Details</h2><table id='results' " + (assertions ? "class='assertions'" : "" ) + ">" +
+ "<thead><tr><th>Result</th><th>Test Name</th>" +
+ (assertions ? "<th>Assertion</th>" : "") +
+ "<th>Message</th></tr></thead>" +
+ "<tbody>";
+ for (var i = 0; i < tests.length; i++) {
+ html += '<tr class="' +
+ escape_html(status_class(status_text[tests[i].status])) +
+ '"><td>' +
+ escape_html(status_text[tests[i].status]) +
+ "</td><td>" +
+ escape_html(tests[i].name) +
+ "</td><td>" +
+ (assertions ? escape_html(get_assertion(tests[i])) + "</td><td>" : "") +
+ escape_html(tests[i].message ? tests[i].message : " ") +
+ "</td></tr>";
+ }
+ html += "</tbody></table>";
+ try {
+ log.lastChild.innerHTML = html;
+ } catch (e) {
+ log.appendChild(document.createElementNS(xhtml_ns, "p"))
+ .textContent = "Setting innerHTML for the log threw an exception.";
+ log.appendChild(document.createElementNS(xhtml_ns, "pre"))
+ .textContent = html;
+ }
+ };
+
+ /*
+ * Template code
+ *
+ * A template is just a javascript structure. An element is represented as:
+ *
+ * [tag_name, {attr_name:attr_value}, child1, child2]
+ *
+ * the children can either be strings (which act like text nodes), other templates or
+ * functions (see below)
+ *
+ * A text node is represented as
+ *
+ * ["{text}", value]
+ *
+ * String values have a simple substitution syntax; ${foo} represents a variable foo.
+ *
+ * It is possible to embed logic in templates by using a function in a place where a
+ * node would usually go. The function must either return part of a template or null.
+ *
+ * In cases where a set of nodes are required as output rather than a single node
+ * with children it is possible to just use a list
+ * [node1, node2, node3]
+ *
+ * Usage:
+ *
+ * render(template, substitutions) - take a template and an object mapping
+ * variable names to parameters and return either a DOM node or a list of DOM nodes
+ *
+ * substitute(template, substitutions) - take a template and variable mapping object,
+ * make the variable substitutions and return the substituted template
+ *
+ */
+
+ function is_single_node(template)
+ {
+ return typeof template[0] === "string";
+ }
+
+ function substitute(template, substitutions)
+ {
+ if (typeof template === "function") {
+ var replacement = template(substitutions);
+ if (!replacement) {
+ return null;
+ }
+
+ return substitute(replacement, substitutions);
+ }
+
+ if (is_single_node(template)) {
+ return substitute_single(template, substitutions);
+ }
+
+ return filter(map(template, function(x) {
+ return substitute(x, substitutions);
+ }), function(x) {return x !== null;});
+ }
+
+ function substitute_single(template, substitutions)
+ {
+ var substitution_re = /\$\{([^ }]*)\}/g;
+
+ function do_substitution(input) {
+ var components = input.split(substitution_re);
+ var rv = [];
+ for (var i = 0; i < components.length; i += 2) {
+ rv.push(components[i]);
+ if (components[i + 1]) {
+ rv.push(String(substitutions[components[i + 1]]));
+ }
+ }
+ return rv;
+ }
+
+ function substitute_attrs(attrs, rv)
+ {
+ rv[1] = {};
+ for (var name in template[1]) {
+ if (attrs.hasOwnProperty(name)) {
+ var new_name = do_substitution(name).join("");
+ var new_value = do_substitution(attrs[name]).join("");
+ rv[1][new_name] = new_value;
+ }
+ }
+ }
+
+ function substitute_children(children, rv)
+ {
+ for (var i = 0; i < children.length; i++) {
+ if (children[i] instanceof Object) {
+ var replacement = substitute(children[i], substitutions);
+ if (replacement !== null) {
+ if (is_single_node(replacement)) {
+ rv.push(replacement);
+ } else {
+ extend(rv, replacement);
+ }
+ }
+ } else {
+ extend(rv, do_substitution(String(children[i])));
+ }
+ }
+ return rv;
+ }
+
+ var rv = [];
+ rv.push(do_substitution(String(template[0])).join(""));
+
+ if (template[0] === "{text}") {
+ substitute_children(template.slice(1), rv);
+ } else {
+ substitute_attrs(template[1], rv);
+ substitute_children(template.slice(2), rv);
+ }
+
+ return rv;
+ }
+
+ function make_dom_single(template, doc)
+ {
+ var output_document = doc || document;
+ var element;
+ if (template[0] === "{text}") {
+ element = output_document.createTextNode("");
+ for (var i = 1; i < template.length; i++) {
+ element.data += template[i];
+ }
+ } else {
+ element = output_document.createElementNS(xhtml_ns, template[0]);
+ for (var name in template[1]) {
+ if (template[1].hasOwnProperty(name)) {
+ element.setAttribute(name, template[1][name]);
+ }
+ }
+ for (var i = 2; i < template.length; i++) {
+ if (template[i] instanceof Object) {
+ var sub_element = make_dom(template[i]);
+ element.appendChild(sub_element);
+ } else {
+ var text_node = output_document.createTextNode(template[i]);
+ element.appendChild(text_node);
+ }
+ }
+ }
+
+ return element;
+ }
+
+ function make_dom(template, substitutions, output_document)
+ {
+ if (is_single_node(template)) {
+ return make_dom_single(template, output_document);
+ }
+
+ return map(template, function(x) {
+ return make_dom_single(x, output_document);
+ });
+ }
+
+ function render(template, substitutions, output_document)
+ {
+ return make_dom(substitute(template, substitutions), output_document);
+ }
+
+ /*
+ * Utility funcions
+ */
+ function assert(expected_true, function_name, description, error, substitutions)
+ {
+ if (tests.tests.length === 0) {
+ tests.set_file_is_test();
+ }
+ if (expected_true !== true) {
+ var msg = make_message(function_name, description,
+ error, substitutions);
+ throw new AssertionError(msg);
+ }
+ }
+
+ function AssertionError(message)
+ {
+ this.message = message;
+ }
+
+ AssertionError.prototype.toString = function() {
+ return this.message;
+ };
+
+ function make_message(function_name, description, error, substitutions)
+ {
+ for (var p in substitutions) {
+ if (substitutions.hasOwnProperty(p)) {
+ substitutions[p] = format_value(substitutions[p]);
+ }
+ }
+ var node_form = substitute(["{text}", "${function_name}: ${description}" + error],
+ merge({function_name:function_name,
+ description:(description?description + " ":"")},
+ substitutions));
+ return node_form.slice(1).join("");
+ }
+
+ function filter(array, callable, thisObj) {
+ var rv = [];
+ for (var i = 0; i < array.length; i++) {
+ if (array.hasOwnProperty(i)) {
+ var pass = callable.call(thisObj, array[i], i, array);
+ if (pass) {
+ rv.push(array[i]);
+ }
+ }
+ }
+ return rv;
+ }
+
+ function map(array, callable, thisObj)
+ {
+ var rv = [];
+ rv.length = array.length;
+ for (var i = 0; i < array.length; i++) {
+ if (array.hasOwnProperty(i)) {
+ rv[i] = callable.call(thisObj, array[i], i, array);
+ }
+ }
+ return rv;
+ }
+
+ function extend(array, items)
+ {
+ Array.prototype.push.apply(array, items);
+ }
+
+ function forEach (array, callback, thisObj)
+ {
+ for (var i = 0; i < array.length; i++) {
+ if (array.hasOwnProperty(i)) {
+ callback.call(thisObj, array[i], i, array);
+ }
+ }
+ }
+
+ function merge(a,b)
+ {
+ var rv = {};
+ var p;
+ for (p in a) {
+ rv[p] = a[p];
+ }
+ for (p in b) {
+ rv[p] = b[p];
+ }
+ return rv;
+ }
+
+ function expose(object, name)
+ {
+ var components = name.split(".");
+ var target = test_environment.global_scope();
+ for (var i = 0; i < components.length - 1; i++) {
+ if (!(components[i] in target)) {
+ target[components[i]] = {};
+ }
+ target = target[components[i]];
+ }
+ target[components[components.length - 1]] = object;
+ }
+
+ function is_same_origin(w) {
+ try {
+ 'random_prop' in w;
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+
+ function supports_post_message(w)
+ {
+ var supports;
+ var type;
+ // Given IE implements postMessage across nested iframes but not across
+ // windows or tabs, you can't infer cross-origin communication from the presence
+ // of postMessage on the current window object only.
+ //
+ // Touching the postMessage prop on a window can throw if the window is
+ // not from the same origin AND post message is not supported in that
+ // browser. So just doing an existence test here won't do, you also need
+ // to wrap it in a try..cacth block.
+ try {
+ type = typeof w.postMessage;
+ if (type === "function") {
+ supports = true;
+ }
+
+ // IE8 supports postMessage, but implements it as a host object which
+ // returns "object" as its `typeof`.
+ else if (type === "object") {
+ supports = true;
+ }
+
+ // This is the case where postMessage isn't supported AND accessing a
+ // window property across origins does NOT throw (e.g. old Safari browser).
+ else {
+ supports = false;
+ }
+ } catch (e) {
+ // This is the case where postMessage isn't supported AND accessing a
+ // window property across origins throws (e.g. old Firefox browser).
+ supports = false;
+ }
+ return supports;
+ }
+
+ /**
+ * Setup globals
+ */
+
+ var tests = new Tests();
+
+ addEventListener("error", function(e) {
+ if (tests.file_is_test) {
+ var test = tests.tests[0];
+ if (test.phase >= test.phases.HAS_RESULT) {
+ return;
+ }
+ var message = e.message;
+ test.set_status(test.FAIL, message);
+ test.phase = test.phases.HAS_RESULT;
+ test.done();
+ done();
+ } else if (!tests.allow_uncaught_exception) {
+ tests.status.status = tests.status.ERROR;
+ tests.status.message = e.message;
+ }
+ });
+
+ test_environment.on_tests_ready();
+
+})();
+// vim: set expandtab shiftwidth=4 tabstop=4:
--- /dev/null
+/*global add_completion_callback, setup */
+/*
+ * This file is intended for vendors to implement
+ * code needed to integrate testharness.js tests with their own test systems.
+ *
+ * The default implementation extracts metadata from the tests and validates
+ * it against the cached version that should be present in the test source
+ * file. If the cache is not found or is out of sync, source code suitable for
+ * caching the metadata is optionally generated.
+ *
+ * The cached metadata is present for extraction by test processing tools that
+ * are unable to execute javascript.
+ *
+ * Metadata is attached to tests via the properties parameter in the test
+ * constructor. See testharness.js for details.
+ *
+ * Typically test system integration will attach callbacks when each test has
+ * run, using add_result_callback(callback(test)), or when the whole test file
+ * has completed, using
+ * add_completion_callback(callback(tests, harness_status)).
+ *
+ * For more documentation about the callback functions and the
+ * parameters they are called with see testharness.js
+ */
+
+
+
+var metadata_generator = {
+
+ currentMetadata: {},
+ cachedMetadata: false,
+ metadataProperties: ['help', 'assert', 'author'],
+
+ error: function(message) {
+ var messageElement = document.createElement('p');
+ messageElement.setAttribute('class', 'error');
+ this.appendText(messageElement, message);
+
+ var summary = document.getElementById('summary');
+ if (summary) {
+ summary.parentNode.insertBefore(messageElement, summary);
+ }
+ else {
+ document.body.appendChild(messageElement);
+ }
+ },
+
+ /**
+ * Ensure property value has contact information
+ */
+ validateContact: function(test, propertyName) {
+ var result = true;
+ var value = test.properties[propertyName];
+ var values = Array.isArray(value) ? value : [value];
+ for (var index = 0; index < values.length; index++) {
+ value = values[index];
+ var re = /(\S+)(\s*)<(.*)>(.*)/;
+ if (! re.test(value)) {
+ re = /(\S+)(\s+)(http[s]?:\/\/)(.*)/;
+ if (! re.test(value)) {
+ this.error('Metadata property "' + propertyName +
+ '" for test: "' + test.name +
+ '" must have name and contact information ' +
+ '("name <email>" or "name http(s)://")');
+ result = false;
+ }
+ }
+ }
+ return result;
+ },
+
+ /**
+ * Extract metadata from test object
+ */
+ extractFromTest: function(test) {
+ var testMetadata = {};
+ // filter out metadata from other properties in test
+ for (var metaIndex = 0; metaIndex < this.metadataProperties.length;
+ metaIndex++) {
+ var meta = this.metadataProperties[metaIndex];
+ if (test.properties.hasOwnProperty(meta)) {
+ if ('author' == meta) {
+ this.validateContact(test, meta);
+ }
+ testMetadata[meta] = test.properties[meta];
+ }
+ }
+ return testMetadata;
+ },
+
+ /**
+ * Compare cached metadata to extracted metadata
+ */
+ validateCache: function() {
+ for (var testName in this.currentMetadata) {
+ if (! this.cachedMetadata.hasOwnProperty(testName)) {
+ return false;
+ }
+ var testMetadata = this.currentMetadata[testName];
+ var cachedTestMetadata = this.cachedMetadata[testName];
+ delete this.cachedMetadata[testName];
+
+ for (var metaIndex = 0; metaIndex < this.metadataProperties.length;
+ metaIndex++) {
+ var meta = this.metadataProperties[metaIndex];
+ if (cachedTestMetadata.hasOwnProperty(meta) &&
+ testMetadata.hasOwnProperty(meta)) {
+ if (Array.isArray(cachedTestMetadata[meta])) {
+ if (! Array.isArray(testMetadata[meta])) {
+ return false;
+ }
+ if (cachedTestMetadata[meta].length ==
+ testMetadata[meta].length) {
+ for (var index = 0;
+ index < cachedTestMetadata[meta].length;
+ index++) {
+ if (cachedTestMetadata[meta][index] !=
+ testMetadata[meta][index]) {
+ return false;
+ }
+ }
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ if (Array.isArray(testMetadata[meta])) {
+ return false;
+ }
+ if (cachedTestMetadata[meta] != testMetadata[meta]) {
+ return false;
+ }
+ }
+ }
+ else if (cachedTestMetadata.hasOwnProperty(meta) ||
+ testMetadata.hasOwnProperty(meta)) {
+ return false;
+ }
+ }
+ }
+ for (var testName in this.cachedMetadata) {
+ return false;
+ }
+ return true;
+ },
+
+ appendText: function(elemement, text) {
+ elemement.appendChild(document.createTextNode(text));
+ },
+
+ jsonifyArray: function(arrayValue, indent) {
+ var output = '[';
+
+ if (1 == arrayValue.length) {
+ output += JSON.stringify(arrayValue[0]);
+ }
+ else {
+ for (var index = 0; index < arrayValue.length; index++) {
+ if (0 < index) {
+ output += ',\n ' + indent;
+ }
+ output += JSON.stringify(arrayValue[index]);
+ }
+ }
+ output += ']';
+ return output;
+ },
+
+ jsonifyObject: function(objectValue, indent) {
+ var output = '{';
+ var value;
+
+ var count = 0;
+ for (var property in objectValue) {
+ ++count;
+ if (Array.isArray(objectValue[property]) ||
+ ('object' == typeof(value))) {
+ ++count;
+ }
+ }
+ if (1 == count) {
+ for (var property in objectValue) {
+ output += ' "' + property + '": ' +
+ JSON.stringify(objectValue[property]) +
+ ' ';
+ }
+ }
+ else {
+ var first = true;
+ for (var property in objectValue) {
+ if (! first) {
+ output += ',';
+ }
+ first = false;
+ output += '\n ' + indent + '"' + property + '": ';
+ value = objectValue[property];
+ if (Array.isArray(value)) {
+ output += this.jsonifyArray(value, indent +
+ ' '.substr(0, 5 + property.length));
+ }
+ else if ('object' == typeof(value)) {
+ output += this.jsonifyObject(value, indent + ' ');
+ }
+ else {
+ output += JSON.stringify(value);
+ }
+ }
+ if (1 < output.length) {
+ output += '\n' + indent;
+ }
+ }
+ output += '}';
+ return output;
+ },
+
+ /**
+ * Generate javascript source code for captured metadata
+ * Metadata is in pretty-printed JSON format
+ */
+ generateSource: function() {
+ var source =
+ '<script id="metadata_cache">/*\n' +
+ this.jsonifyObject(this.currentMetadata, '') + '\n' +
+ '*/</script>\n';
+ return source;
+ },
+
+ /**
+ * Add element containing metadata source code
+ */
+ addSourceElement: function(event) {
+ var sourceWrapper = document.createElement('div');
+ sourceWrapper.setAttribute('id', 'metadata_source');
+
+ var instructions = document.createElement('p');
+ if (this.cachedMetadata) {
+ this.appendText(instructions,
+ 'Replace the existing <script id="metadata_cache"> element ' +
+ 'in the test\'s <head> with the following:');
+ }
+ else {
+ this.appendText(instructions,
+ 'Copy the following into the <head> element of the test ' +
+ 'or the test\'s metadata sidecar file:');
+ }
+ sourceWrapper.appendChild(instructions);
+
+ var sourceElement = document.createElement('pre');
+ this.appendText(sourceElement, this.generateSource());
+
+ sourceWrapper.appendChild(sourceElement);
+
+ var messageElement = document.getElementById('metadata_issue');
+ messageElement.parentNode.insertBefore(sourceWrapper,
+ messageElement.nextSibling);
+ messageElement.parentNode.removeChild(messageElement);
+
+ (event.preventDefault) ? event.preventDefault() :
+ event.returnValue = false;
+ },
+
+ /**
+ * Extract the metadata cache from the cache element if present
+ */
+ getCachedMetadata: function() {
+ var cacheElement = document.getElementById('metadata_cache');
+
+ if (cacheElement) {
+ var cacheText = cacheElement.firstChild.nodeValue;
+ var openBrace = cacheText.indexOf('{');
+ var closeBrace = cacheText.lastIndexOf('}');
+ if ((-1 < openBrace) && (-1 < closeBrace)) {
+ cacheText = cacheText.slice(openBrace, closeBrace + 1);
+ try {
+ this.cachedMetadata = JSON.parse(cacheText);
+ }
+ catch (exc) {
+ this.cachedMetadata = 'Invalid JSON in Cached metadata. ';
+ }
+ }
+ else {
+ this.cachedMetadata = 'Metadata not found in cache element. ';
+ }
+ }
+ },
+
+ /**
+ * Main entry point, extract metadata from tests, compare to cached version
+ * if present.
+ * If cache not present or differs from extrated metadata, generate an error
+ */
+ process: function(tests) {
+ for (var index = 0; index < tests.length; index++) {
+ var test = tests[index];
+ if (this.currentMetadata.hasOwnProperty(test.name)) {
+ this.error('Duplicate test name: ' + test.name);
+ }
+ else {
+ this.currentMetadata[test.name] = this.extractFromTest(test);
+ }
+ }
+
+ this.getCachedMetadata();
+
+ var message = null;
+ var messageClass = 'warning';
+ var showSource = false;
+
+ if (0 === tests.length) {
+ if (this.cachedMetadata) {
+ message = 'Cached metadata present but no tests. ';
+ }
+ }
+ else if (1 === tests.length) {
+ if (this.cachedMetadata) {
+ message = 'Single test files should not have cached metadata. ';
+ }
+ else {
+ var testMetadata = this.currentMetadata[tests[0].name];
+ for (var meta in testMetadata) {
+ if (testMetadata.hasOwnProperty(meta)) {
+ message = 'Single tests should not have metadata. ' +
+ 'Move metadata to <head>. ';
+ break;
+ }
+ }
+ }
+ }
+ else {
+ if (this.cachedMetadata) {
+ messageClass = 'error';
+ if ('string' == typeof(this.cachedMetadata)) {
+ message = this.cachedMetadata;
+ showSource = true;
+ }
+ else if (! this.validateCache()) {
+ message = 'Cached metadata out of sync. ';
+ showSource = true;
+ }
+ }
+ }
+
+ if (message) {
+ var messageElement = document.createElement('p');
+ messageElement.setAttribute('id', 'metadata_issue');
+ messageElement.setAttribute('class', messageClass);
+ this.appendText(messageElement, message);
+
+ if (showSource) {
+ var link = document.createElement('a');
+ this.appendText(link, 'Click for source code.');
+ link.setAttribute('href', '#');
+ link.setAttribute('onclick',
+ 'metadata_generator.addSourceElement(event)');
+ messageElement.appendChild(link);
+ }
+
+ var summary = document.getElementById('summary');
+ if (summary) {
+ summary.parentNode.insertBefore(messageElement, summary);
+ }
+ else {
+ var log = document.getElementById('log');
+ if (log) {
+ log.appendChild(messageElement);
+ }
+ }
+ }
+ },
+
+ setup: function() {
+ add_completion_callback(
+ function (tests, harness_status) {
+ metadata_generator.process(tests, harness_status);
+ });
+ }
+};
+
+metadata_generator.setup();
+
+/* If the parent window has a testharness_properties object,
+ * we use this to provide the test settings. This is used by the
+ * default in-browser runner to configure the timeout and the
+ * rendering of results
+ */
+try {
+ if (window.opener && "testharness_properties" in window.opener) {
+ /* If we pass the testharness_properties object as-is here without
+ * JSON stringifying and reparsing it, IE fails & emits the message
+ * "Could not complete the operation due to error 80700019".
+ */
+ setup(JSON.parse(JSON.stringify(window.opener.testharness_properties)));
+ }
+} catch (e) {
+}
+// vim: set expandtab shiftwidth=4 tabstop=4:
--- /dev/null
+{
+ "pkg-blacklist": [
+ "config.xml",
+ "pack.py",
+ "testcase.xsl",
+ "testresult.xsl",
+ "tests.css",
+ "icon.png",
+ "manifest.json",
+ "suite.json",
+ "inst.*"
+ ],
+ "pkg-list": {
+ "wgt": {
+ "blacklist": ["*"],
+ "copylist": {
+ "inst.wgt.py": "inst.py",
+ "askpolicy.sh": "askpolicy.sh",
+ "tests.full.xml": "tests.full.xml",
+ "tests.xml": "tests.xml"
+ },
+ "pkg-app": {
+ "blacklist": [],
+ "sign-flag": "true"
+ }
+ }
+ },
+ "pkg-name": "tct-ml-tizen-tests"
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="html" version="1.0" encoding="UTF-8"
+ indent="yes" />
+ <xsl:template match="/">
+ <html>
+ <STYLE type="text/css">
+ @import "tests.css";
+ </STYLE>
+
+ <body>
+ <div id="testcasepage">
+ <div id="title">
+ <table>
+ <tr>
+ <td>
+ <h1>Test Cases</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="suites">
+ <table>
+ <tr>
+ <th>Test Suite</th>
+ <th>Total</th>
+ <th>Auto</th>
+ <th>Manual</th>
+ </tr>
+ <tr>
+ <td>
+ Total
+ </td>
+ <td>
+ <xsl:value-of select="count(test_definition/suite/set//testcase)" />
+ </td>
+ <td>
+ <xsl:value-of
+ select="count(test_definition/suite/set//testcase[@execution_type = 'auto'])" />
+ </td>
+ <td>
+ <xsl:value-of
+ select="count(test_definition/suite/set//testcase[@execution_type != 'auto'])" />
+ </td>
+ </tr>
+ <xsl:for-each select="test_definition/suite">
+ <tr>
+ <td>
+ <xsl:value-of select="@name" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set//testcase)" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set/testcase[@execution_type = 'auto'])" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set/testcase[@execution_type != 'auto'])" />
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </div>
+ <div id="title">
+ <table>
+ <tr>
+ <td class="title">
+ <h1>Detailed Test Cases</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="cases">
+ <xsl:for-each select="test_definition/suite">
+ <xsl:sort select="@name" />
+ <p>
+ Test Suite:
+ <xsl:value-of select="@name" />
+ </p>
+ <table>
+ <tr>
+ <th>Case_ID</th>
+ <th>Purpose</th>
+ <th>Type</th>
+ <th>Component</th>
+ <th>Execution Type</th>
+ <th>Description</th>
+ <th>Specification</th>
+ </tr>
+ <xsl:for-each select=".//set">
+ <xsl:sort select="@name" />
+ <tr>
+ <td colspan="7">
+ Test Set:
+ <xsl:value-of select="@name" />
+ </td>
+ </tr>
+ <xsl:for-each select=".//testcase">
+ <xsl:sort select="@id" />
+ <tr>
+ <td>
+ <xsl:value-of select="@id" />
+ </td>
+ <td>
+ <xsl:value-of select="@purpose" />
+ </td>
+ <td>
+ <xsl:value-of select="@type" />
+ </td>
+ <td>
+ <xsl:value-of select="@component" />
+ </td>
+ <td>
+ <xsl:value-of select="@execution_type" />
+ </td>
+ <td>
+ <p>
+ Pre_condition:
+ <xsl:value-of select=".//description/pre_condition" />
+ </p>
+ <p>
+ Post_condition:
+ <xsl:value-of select=".//description/post_condition" />
+ </p>
+ <p>
+ Test Script Entry:
+ <xsl:value-of select=".//description/test_script_entry" />
+ </p>
+ <p>
+ Steps:
+ <p />
+ <xsl:for-each select=".//description/steps/step">
+ <xsl:sort select="@order" />
+ Step
+ <xsl:value-of select="@order" />
+ :
+ <xsl:value-of select="./step_desc" />
+ ;
+ <p />
+ Expected Result:
+ <xsl:value-of select="./expected" />
+ <p />
+ </xsl:for-each>
+ </p>
+ </td>
+ <td>
+ <xsl:call-template name="br-replace">
+ <xsl:with-param name="word" select=".//spec" />
+ </xsl:call-template>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+ </table>
+ </xsl:for-each>
+ </div>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+ <xsl:template name="br-replace">
+ <xsl:param name="word" />
+ <xsl:variable name="cr">
+ <xsl:text>
+</xsl:text>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($word,$cr)">
+ <xsl:value-of select="substring-before($word,$cr)" />
+ <br />
+ <xsl:call-template name="br-replace">
+ <xsl:with-param name="word" select="substring-after($word,$cr)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$word" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="html" version="1.0" encoding="UTF-8"
+ indent="yes" />
+ <xsl:template match="/">
+ <html>
+ <STYLE type="text/css">
+ @import "tests.css";
+ </STYLE>
+
+ <body>
+ <div id="testcasepage">
+ <div id="title">
+ <table>
+ <tr>
+ <td>
+ <h1>Test Report</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="device">
+ <table>
+ <tr>
+ <th colspan="2">Device Information</th>
+ </tr>
+ <tr>
+ <td>Device Name</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@device_name" />
+ </td>
+ </tr>
+ <tr>
+ <td>Device Model</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@device_model" />
+ </td>
+ </tr>
+ <tr>
+ <td>OS Version</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@os_version" />
+ </td>
+ </tr>
+ <tr>
+ <td>Device ID</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@device_id" />
+ </td>
+ </tr>
+ <tr>
+ <td>Firmware Version</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@firmware_version" />
+ </td>
+ </tr>
+ <tr>
+ <td>Screen Size</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@screen_size" />
+ </td>
+ </tr>
+ <tr>
+ <td>Resolution</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@resolution" />
+ </td>
+ </tr>
+ <tr>
+ <td>Host Info</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@host" />
+ </td>
+ </tr>
+ <tr>
+ <td>Others</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/other" />
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div id="summary">
+ <table>
+ <tr>
+ <th colspan="2">Test Summary</th>
+ </tr>
+ <tr>
+ <td>Test Plan Name</td>
+ <td>
+ <xsl:value-of select="test_definition/summary/@test_plan_name" />
+ </td>
+ </tr>
+ <tr>
+ <td>Tests Total</td>
+ <td>
+ <xsl:value-of select="count(test_definition//suite/set/testcase)" />
+ </td>
+ </tr>
+ <tr>
+ <td>Test Passed</td>
+ <td>
+ <xsl:value-of
+ select="count(test_definition//suite/set/testcase[@result = 'PASS'])" />
+ </td>
+ </tr>
+ <tr>
+ <td>Test Failed</td>
+ <td>
+ <xsl:value-of
+ select="count(test_definition//suite/set/testcase[@result = 'FAIL'])" />
+ </td>
+ </tr>
+ <tr>
+ <td>Test N/A</td>
+ <td>
+ <xsl:value-of
+ select="count(test_definition//suite/set/testcase[@result = 'BLOCK'])" />
+ </td>
+ </tr>
+ <tr>
+ <td>Test Not Run</td>
+ <td>
+ <xsl:value-of
+ select="count(test_definition//suite/set/testcase) - count(test_definition//suite/set/testcase[@result = 'PASS']) - count(test_definition//suite/set/testcase[@result = 'FAIL']) - count(test_definition//suite/set/testcase[@result = 'BLOCK'])" />
+ </td>
+ </tr>
+ <tr>
+ <td>Start time</td>
+ <td>
+ <xsl:value-of select="test_definition/summary/start_at" />
+ </td>
+ </tr>
+ <tr>
+ <td>End time</td>
+ <td>
+ <xsl:value-of select="test_definition/summary/end_at" />
+ </td>
+ </tr>
+ </table>
+ </div>
+
+
+ <div id="suite_summary">
+ <div id="title">
+ <table>
+ <tr>
+ <td class="title">
+ <h1>Test Summary by Suite</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <table>
+ <tr>
+ <th>Suite</th>
+ <th>Passed</th>
+ <th>Failed</th>
+ <th>N/A</th>
+ <th>Not Run</th>
+ <th>Total</th>
+ </tr>
+ <xsl:for-each select="test_definition/suite">
+ <xsl:sort select="@name" />
+ <tr>
+ <td>
+ <xsl:value-of select="@name" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set//testcase[@result = 'PASS'])" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set//testcase[@result = 'FAIL'])" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set//testcase[@result = 'BLOCK'])" />
+ </td>
+ <td>
+ <xsl:value-of
+ select="count(set//testcase) - count(set//testcase[@result = 'PASS']) - count(set//testcase[@result = 'FAIL']) - count(set//testcase[@result = 'BLOCK'])" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set//testcase)" />
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </div>
+
+ <div id="cases">
+ <div id="title">
+ <table>
+ <tr>
+ <td class="title">
+ <h1 align="center">Detailed Test Results</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <xsl:for-each select="test_definition/suite">
+ <xsl:sort select="@name" />
+ <p>
+ Test Suite:
+ <xsl:value-of select="@name" />
+ </p>
+ <table>
+ <tr>
+ <th>Case_ID</th>
+ <th>Purpose</th>
+ <th>Result</th>
+ <th>Stdout</th>
+ </tr>
+ <xsl:for-each select=".//set">
+ <xsl:sort select="@name" />
+ <tr>
+ <td colspan="4">
+ Test Set:
+ <xsl:value-of select="@name" />
+ </td>
+ </tr>
+ <xsl:for-each select=".//testcase">
+ <xsl:sort select="@id" />
+ <tr>
+ <td>
+ <xsl:value-of select="@id" />
+ </td>
+ <td>
+ <xsl:value-of select="@purpose" />
+ </td>
+
+ <xsl:choose>
+ <xsl:when test="@result">
+ <xsl:if test="@result = 'FAIL'">
+ <td class="red_rate">
+ <xsl:value-of select="@result" />
+ </td>
+ </xsl:if>
+ <xsl:if test="@result = 'PASS'">
+ <td class="green_rate">
+ <xsl:value-of select="@result" />
+ </td>
+ </xsl:if>
+ <xsl:if test="@result = 'BLOCK' ">
+ <td>
+ BLOCK
+ </td>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <td>
+
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ <td>
+ <xsl:value-of select=".//result_info/stdout" />
+ <xsl:if test=".//result_info/stdout = ''">
+ N/A
+ </xsl:if>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+ </table>
+ </xsl:for-each>
+ </div>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="./testcase.xsl"?>
+<test_definition>
+ <suite name="tct-ml-tizen-tests" extension="crosswalk" category="Tizen Device APIs">
+ <set name="MachineLearning">
+ <capabilities>
+ <capability name="http://tizen.org/feature/machine_learning"/>
+ </capabilities>
+ <testcase purpose="Test whether MachineLearningManagerObject contains the attribute ml, has type object and is readonly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="MachineLearningManagerObject_ml_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManagerObject_ml_attribute.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManagerObject" element_type="attribute" element_name="ml" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if interface MachineLearningManagerObject exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P3" id="MachineLearningManagerObject_notexist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManagerObject_notexist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManagerObject" usage="true" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Checks if set Neural Network Framework with supported configuration return true value, otherwise false" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="MachineLearningManager_checkNNFWAvailability">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManager" element_type="method" element_name="checkNNFWAvailability" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningManager:checkNNFWAvailability method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="MachineLearningManager_checkNNFWAvailability_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManager" element_type="method" element_name="checkNNFWAvailability" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningManager:checkNNFWAvailability() with incorrect hw type throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="MachineLearningManager_checkNNFWAvailability_hw_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability_hw_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManager" element_type="method" element_name="checkNNFWAvailability" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check checkNNFWAvailability with missing hw argument " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="MachineLearningManager_checkNNFWAvailability_hw_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability_hw_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManager" element_type="method" element_name="checkNNFWAvailability" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check checkNNFWAvailability with missing all argument" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="MachineLearningManager_checkNNFWAvailability_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManager" element_type="method" element_name="checkNNFWAvailability" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningManager:checkNNFWAvailability() with incorrect nnfw type throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="MachineLearningManager_checkNNFWAvailability_nnfw_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability_nnfw_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManager" element_type="method" element_name="checkNNFWAvailability" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check checkNNFWAvailability with missing all argument " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="MachineLearningManager_checkNNFWAvailability_nnfw_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability_nnfw_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManager" element_type="method" element_name="checkNNFWAvailability" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningManager object is extendable" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P3" id="MachineLearningManager_extend">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_extend.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManager" usage="true" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="This MachineLearningManager exists in tizens" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P3" id="MachineLearningManager_in_tizen">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_in_tizen.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManager" usage="true" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if interface MachineLearningManager exists." type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P3" id="MachineLearningManager_notexist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_notexist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManager" usage="true" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Test whether MachineLearningManager contains the attribute pipeline, has type object and is readonly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="MachineLearningManager_pipeline_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_pipeline_attribute.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManager" element_type="attribute" element_name="pipeline" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Test whether MachineLearningManager contains the attribute single, has type object and is readonly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="MachineLearningManager_single_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_single_attribute.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningManager" element_type="attribute" element_name="single" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if attribute id of TensorRawData exists, has type TypeArray and is readonly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorRawData_data_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorRawData_data_attribute.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorRawData" element_type="attribute" element_name="data" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if interface TensorRawData exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P3" id="TensorRawData_notexist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorRawData_notexist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorRawData" usage="true" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if attribute id of TensorRawData exists, has type array and is readonly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorRawData_shape_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorRawData_shape_attribute.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorRawData" element_type="attribute" element_name="shape" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if attribute id of TensorRawData exists, has type size and is readonly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorRawData_size_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorRawData_size_attribute.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorRawData" element_type="attribute" element_name="size" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if attribute id of tensorsData exists, has type count and is readonly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_count_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_count_attribute.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="attribute" element_name="count" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::dispose() method release memory" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_dispose">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_dispose.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="dispose" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsData:dispose method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsData_dispose_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_dispose_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="dispose" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check using tensorsData::dispose() method with extra argument" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_dispose_extra_argument">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_dispose_extra_argument.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="dispose" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() method works properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_getTensorRawData">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="getTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() error occur throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_getTensorRawData_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="getTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsData:getTensorRawData method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsData_getTensorRawData_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="getTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() throws exception when index is missing" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsData_getTensorRawData_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="getTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() method works properly with optional argument location " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_getTensorRawData_with_size">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_with_location.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="getTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() method works properly with optional argument size" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_getTensorRawData_with_size">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_with_size.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="getTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if interface TensorsData exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P3" id="TensorsData_notexist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_notexist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" usage="true" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() method works properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_setTensorRawData">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="setTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check whether setTensorRawData() method called with invalid buffer throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsData_setTensorRawData_buffer_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_buffer_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="setTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsData:setTensorRawData method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsData_setTensorRawData_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="setTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() throws exception when arguments are missing" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsData_setTensorRawData_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="setTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() method works properly with optional argument size" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_setTensorRawData_with_size">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_with_size.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="setTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData:tensorsInfo attribute exists, has type object, is readonly and has proper default value" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_tensorsInfo_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_tensorsInfo_attribute.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="attribute" element_name="tensorsInfo" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:addTensorInfo() work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_addTensorInfo">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="addTensorInfo" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:addTensorInfo method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_addTensorInfo_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="addTensorInfo" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() throws exception when arguments are missing" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_addTensorInfo_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="addTensorInfo" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() with incorrect type argument throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_addTensorInfo_type_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_type_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="addTensorInfo" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::clone() method clone the tensorsInfo object properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_clone">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_clone.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="clone" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:clone method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_clone_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_clone_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="clone" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check using TensorsInfo:clone() with extra argument to get current TensorsInfo object" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_clone_extra_argument">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_clone_extra_argument.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="clone" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="LABEL Check if attribute count of TensorsInfo exists, has type TensorsInfo and is readonly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_count_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_count_attribute.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="attribute" element_name="count" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::dispose() method release memory" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_dispose">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_dispose.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="dispose" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:dispose method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_dispose_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_dispose_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="dispose" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="LABEL Check using TensorsInfo::dispose() method with extra argument" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_dispose_extra_argument">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_dispose_extra_argument.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="dispose" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo has the same contents, false otherwise" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_equals">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_equals.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="equals" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:equals method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_equals_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_equals_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="equals" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:equals method throw exception when a fake system object was passed" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_equals_invalid_obj">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_equals_invalid_obj.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="equals" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:equals() throws exception when TensorsInfo is missing" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_equals_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_equals_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="equals" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:equals() with converted TensorInfo type throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_equals_other_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_equals_other_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="equals" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="constructor" element_name="TensorsInfo" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getDimensions() work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_getDimensions">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getDimensions.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getDimensions" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:getDimensions method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_getDimensions_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getDimensions_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getDimensions" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="LABEL Check using TensorsInfo::getDimensions() method with extra argument" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_getDimensions_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getDimensions_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getDimensions" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorName() work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_getTensorName">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorName.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorName" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:getTensorName() method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_getTensorName_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorName_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorName" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorSize() work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_getTensorSize">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorSize.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorSize" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:getTensorSize method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_getTensorSize_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorSize_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorSize" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getTensorSize() throws exception when arguments are missing" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_getTensorSize_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorSize_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorSize" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorType() method works properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_getTensorType">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorType.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorType" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:getTensorType method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_getTensorType_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorType_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorType" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="LABEL Check using TensorsInfo::getTensorType() method with extra argument" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_getTensorType_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorType_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorType" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getTensorsData() work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_getTensorsData">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorsData.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorsData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:getTensorsData method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_getTensorsData_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorsData_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorsData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check using tensorsData::getTensorsData() method with extra argument" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_getTensorsData_extra_argument">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorsData_extra_argument.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorsData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:setDimensions() work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_setDimensions">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setDimensions" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:setDimensions method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_setDimensions_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setDimensions" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="LABEL Check using TensorsInfo::setDimensions() method with extra argument" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_setDimensions_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setDimensions" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:setTensorName() work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_setTensorName">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorName.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setTensorName" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:setTensorName method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_setTensorName_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorName_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setTensorName" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check using TensorsInfo::setTensorName() method with extra argument" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_setTensorName_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorName_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setTensorName" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:setTensorType() work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_setTensorType">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setTensorType" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:setTensorType method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_setTensorType_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setTensorType" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check using TensorsInfo::setTensorType() method with extra argument" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_setTensorType_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setTensorType" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:setTensorType() with incorrect type throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_setTensorType_type_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType_type_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setTensorType" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() method works properly with optional argument location " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_getTensorRawData_with_location">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_with_location.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="getTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() method works properly with optional argument location " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_setTensorRawData_with_location">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_with_location.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="setTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() any error occurs throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_setTensorRawData_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="setTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo with incorrect argument value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_addTensorInfo_InvalidValueError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_InvalidValueError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="addTensorInfo" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() with incorrect type argument throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_addTensorInfo_dimension_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_dimension_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="addTensorInfo" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() throws exception when specific argument are missing " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_addTensorInfo_dimension_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_dimension_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="addTensorInfo" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() throws exception when specific argument are missing " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_addTensorInfo_type_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_type_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="addTensorInfo" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() with incorrect argument value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_getTensorRawData_InvalidValueError_1">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_InvalidValueError_1.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="getTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() with incorrect argument value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_getTensorRawData_InvalidValueError_2">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_InvalidValueError_2.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="getTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() with incorrect argument value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_setTensorRawData_InvalidValueError_1">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_InvalidValueError_1.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="setTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() with incorrect argument value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_setTensorRawData_InvalidValueError_2">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_InvalidValueError_2.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="setTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() with incorrect argument value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_setTensorRawData_InvalidValueError_3">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_InvalidValueError_3.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsData" element_type="method" element_name="setTensorRawData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() error occurs throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_addTensorInfo_AbortError_1">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_AbortError_1.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="addTensorInfo" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() error occurs throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_addTensorInfo_AbortError_2">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_AbortError_2.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="addTensorInfo" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getDimensions() error occurs throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_getDimensions_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getDimensions_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getDimensions" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getDimensions with incorrect argument value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getDimensions_InvalidValueError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getDimensions_InvalidValueError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getDimensions" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorName() with error occured throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorName_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorName_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorName" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorName() with incorrect argument value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorName_InvalidValueError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorName_InvalidValueError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorName" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorSize() with error occured throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorSize_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorSize_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorSize" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getTensorSize() with incorrect argument value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorSize_InvalidValueError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorSize_InvalidValueError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorSize" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorType() with error occured throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorType_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorType_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorType" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getTensorType() with incorrect argument value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorType_InvalidValueError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorType_InvalidValueError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorType" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getTensorsData() error occurs throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorsData_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorsData_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="getTensorsData" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:setDimensions() with error occured throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setDimensions_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setDimensions" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::setDimensions() with incorrect index value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setDimensions_InvalidValueError_1">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions_InvalidValueError_1.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setDimensions" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::setDimensions() with incorrect dismension value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setDimensions_InvalidValueError_2">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions_InvalidValueError_2.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setDimensions" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::setDimensions() with incorrect type argument throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_setDimensions_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setDimensions" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:setTensorName() with error occured throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setTensorName_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorName_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setTensorName" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::setTensorName() with incorrect index value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setTensorName_InvalidValueError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorName_InvalidValueError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setTensorName" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:setTensorType() with error occured throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setTensorType_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setTensorType" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::setTensorType() with incorrect index value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setTensorType_InvalidValueError_1">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType_InvalidValueError_1.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setTensorType" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::setTensorType() with incorrect index value throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setTensorType_InvalidValueError_2">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType_InvalidValueError_2.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="TensorsInfo" element_type="method" element_name="setTensorType" specification="MachineLearning" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/machinelearning.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ </set>
+ </suite>
+</test_definition>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="./testcase.xsl"?>
+<test_definition>
+ <suite name="tct-ml-tizen-tests" extension="crosswalk" category="Tizen Device APIs">
+ <set name="MachineLearning">
+ <capabilities>
+ <capability name="http://tizen.org/feature/machine_learning"/>
+ </capabilities>
+ <testcase purpose="Test whether MachineLearningManagerObject contains the attribute ml, has type object and is readonly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="MachineLearningManagerObject_ml_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManagerObject_ml_attribute.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if interface MachineLearningManagerObject exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P3" id="MachineLearningManagerObject_notexist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManagerObject_notexist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Checks if set Neural Network Framework with supported configuration return true value, otherwise false" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="MachineLearningManager_checkNNFWAvailability">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningManager:checkNNFWAvailability method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="MachineLearningManager_checkNNFWAvailability_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningManager:checkNNFWAvailability() with incorrect hw type throws an exception" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="MachineLearningManager_checkNNFWAvailability_hw_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability_hw_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check checkNNFWAvailability with missing hw argument " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="MachineLearningManager_checkNNFWAvailability_hw_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability_hw_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check checkNNFWAvailability with missing all argument" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="MachineLearningManager_checkNNFWAvailability_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningManager:checkNNFWAvailability() with incorrect nnfw type throws an exception" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="MachineLearningManager_checkNNFWAvailability_nnfw_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability_nnfw_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check checkNNFWAvailability with missing all argument " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="MachineLearningManager_checkNNFWAvailability_nnfw_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_checkNNFWAvailability_nnfw_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningManager object is extendable" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P3" id="MachineLearningManager_extend">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_extend.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="This MachineLearningManager exists in tizens" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P3" id="MachineLearningManager_in_tizen">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_in_tizen.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if interface MachineLearningManager exists." component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P3" id="MachineLearningManager_notexist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_notexist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Test whether MachineLearningManager contains the attribute pipeline, has type object and is readonly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="MachineLearningManager_pipeline_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_pipeline_attribute.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Test whether MachineLearningManager contains the attribute single, has type object and is readonly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="MachineLearningManager_single_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/MachineLearningManager_single_attribute.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if attribute id of TensorRawData exists, has type TypeArray and is readonly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorRawData_data_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorRawData_data_attribute.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if interface TensorRawData exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P3" id="TensorRawData_notexist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorRawData_notexist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if attribute id of TensorRawData exists, has type array and is readonly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorRawData_shape_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorRawData_shape_attribute.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if attribute id of TensorRawData exists, has type size and is readonly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorRawData_size_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorRawData_size_attribute.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if attribute id of tensorsData exists, has type count and is readonly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_count_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_count_attribute.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::dispose() method release memory" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_dispose">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_dispose.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsData:dispose method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsData_dispose_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_dispose_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check using tensorsData::dispose() method with extra argument" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_dispose_extra_argument">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_dispose_extra_argument.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() method works properly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_getTensorRawData">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() error occur throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_getTensorRawData_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsData:getTensorRawData method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsData_getTensorRawData_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() throws exception when index is missing" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsData_getTensorRawData_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() method works properly with optional argument location " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_getTensorRawData_with_size">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_with_location.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() method works properly with optional argument size" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_getTensorRawData_with_size">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_with_size.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if interface TensorsData exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P3" id="TensorsData_notexist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_notexist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() method works properly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_setTensorRawData">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check whether setTensorRawData() method called with invalid buffer throws an exception" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsData_setTensorRawData_buffer_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_buffer_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsData:setTensorRawData method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsData_setTensorRawData_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() throws exception when arguments are missing" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsData_setTensorRawData_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() method works properly with optional argument size" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_setTensorRawData_with_size">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_with_size.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData:tensorsInfo attribute exists, has type object, is readonly and has proper default value" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsData_tensorsInfo_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_tensorsInfo_attribute.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:addTensorInfo() work properly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_addTensorInfo">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:addTensorInfo method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_addTensorInfo_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() throws exception when arguments are missing" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_addTensorInfo_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() with incorrect type argument throws an exception" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_addTensorInfo_type_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_type_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::clone() method clone the tensorsInfo object properly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_clone">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_clone.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:clone method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_clone_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_clone_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check using TensorsInfo:clone() with extra argument to get current TensorsInfo object" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_clone_extra_argument">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_clone_extra_argument.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="LABEL Check if attribute count of TensorsInfo exists, has type TensorsInfo and is readonly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_count_attribute">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_count_attribute.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::dispose() method release memory" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_dispose">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_dispose.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:dispose method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_dispose_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_dispose_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="LABEL Check using TensorsInfo::dispose() method with extra argument" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_dispose_extra_argument">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_dispose_extra_argument.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo has the same contents, false otherwise" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_equals">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_equals.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:equals method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_equals_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_equals_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:equals method throw exception when a fake system object was passed" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_equals_invalid_obj">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_equals_invalid_obj.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:equals() throws exception when TensorsInfo is missing" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_equals_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_equals_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:equals() with converted TensorInfo type throws an exception" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_equals_other_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_equals_other_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getDimensions() work properly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_getDimensions">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getDimensions.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:getDimensions method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_getDimensions_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getDimensions_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="LABEL Check using TensorsInfo::getDimensions() method with extra argument" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_getDimensions_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getDimensions_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorName() work properly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_getTensorName">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorName.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:getTensorName() method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_getTensorName_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorName_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorSize() work properly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_getTensorSize">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorSize.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:getTensorSize method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_getTensorSize_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorSize_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getTensorSize() throws exception when arguments are missing" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_getTensorSize_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorSize_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorType() method works properly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_getTensorType">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorType.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:getTensorType method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_getTensorType_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorType_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="LABEL Check using TensorsInfo::getTensorType() method with extra argument" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_getTensorType_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorType_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getTensorsData() work properly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_getTensorsData">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorsData.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:getTensorsData method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_getTensorsData_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorsData_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check using tensorsData::getTensorsData() method with extra argument" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_getTensorsData_extra_argument">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorsData_extra_argument.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:setDimensions() work properly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_setDimensions">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:setDimensions method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_setDimensions_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="LABEL Check using TensorsInfo::setDimensions() method with extra argument" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_setDimensions_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:setTensorName() work properly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_setTensorName">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorName.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:setTensorName method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_setTensorName_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorName_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check using TensorsInfo::setTensorName() method with extra argument" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_setTensorName_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorName_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:setTensorType() work properly" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1" id="TensorsInfo_setTensorType">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:setTensorType method exists" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P0" id="TensorsInfo_setTensorType_exist">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check using TensorsInfo::setTensorType() method with extra argument" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_setTensorType_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearning:TensorsInfo:setTensorType() with incorrect type throws an exception" component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2" id="TensorsInfo_setTensorType_type_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType_type_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() method works properly with optional argument location " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_getTensorRawData_with_location">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_with_location.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() method works properly with optional argument location " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_setTensorRawData_with_location">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_with_location.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() any error occurs throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_setTensorRawData_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo with incorrect argument value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_addTensorInfo_InvalidValueError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_InvalidValueError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() with incorrect type argument throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_addTensorInfo_dimension_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_dimension_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() throws exception when specific argument are missing " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_addTensorInfo_dimension_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_dimension_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() throws exception when specific argument are missing " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_addTensorInfo_type_misarg">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_type_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() with incorrect argument value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_getTensorRawData_InvalidValueError_1">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_InvalidValueError_1.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::getTensorRawData() with incorrect argument value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_getTensorRawData_InvalidValueError_2">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_getTensorRawData_InvalidValueError_2.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() with incorrect argument value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_setTensorRawData_InvalidValueError_1">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_InvalidValueError_1.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() with incorrect argument value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_setTensorRawData_InvalidValueError_2">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_InvalidValueError_2.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsData::setTensorRawData() with incorrect argument value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsData_setTensorRawData_InvalidValueError_3">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsData_setTensorRawData_InvalidValueError_3.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() error occurs throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_addTensorInfo_AbortError_1">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_AbortError_1.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::addTensorInfo() error occurs throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_addTensorInfo_AbortError_2">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_addTensorInfo_AbortError_2.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getDimensions() error occurs throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_getDimensions_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getDimensions_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getDimensions with incorrect argument value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getDimensions_InvalidValueError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getDimensions_InvalidValueError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorName() with error occured throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorName_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorName_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorName() with incorrect argument value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorName_InvalidValueError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorName_InvalidValueError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorSize() with error occured throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorSize_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorSize_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getTensorSize() with incorrect argument value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorSize_InvalidValueError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorSize_InvalidValueError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:getTensorType() with error occured throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorType_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorType_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getTensorType() with incorrect argument value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorType_InvalidValueError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorType_InvalidValueError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::getTensorsData() error occurs throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_getTensorsData_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_getTensorsData_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:setDimensions() with error occured throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setDimensions_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::setDimensions() with incorrect index value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setDimensions_InvalidValueError_1">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions_InvalidValueError_1.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::setDimensions() with incorrect dismension value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setDimensions_InvalidValueError_2">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions_InvalidValueError_2.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::setDimensions() with incorrect type argument throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P2 " id="TensorsInfo_setDimensions_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setDimensions_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:setTensorName() with error occured throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setTensorName_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorName_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::setTensorName() with incorrect index value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setTensorName_InvalidValueError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorName_InvalidValueError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo:setTensorType() with error occured throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setTensorType_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::setTensorType() with incorrect index value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setTensorType_InvalidValueError_1">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType_InvalidValueError_1.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if TensorsInfo::setTensorType() with incorrect index value throws an exception " component="Tizen Device APIs/TBD/MachineLearning" execution_type="auto" priority="P1 " id="TensorsInfo_setTensorType_InvalidValueError_2">
+ <description>
+ <test_script_entry>/opt/tct-ml-tizen-tests/ml/TensorsInfo_setTensorType_InvalidValueError_2.html</test_script_entry>
+ </description>
+ </testcase>
+ </set>
+ </suite>
+</test_definition>
--- /dev/null
+----------------------------------------------
+License
+----------------------------------------------
+Copyright (c) 2020 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:
+ Qunfang Lin <qunfang.lin@samsung.com>
+
+
+
+----------------------------------------------
+Introduction
+----------------------------------------------
+This test suite is for testing VD Web API, which covers the following specifications:
+TBD
+
+----------------------------------------------
+Test Environment
+----------------------------------------------
+1. Testkit-stub must be installed on target device.
+2. Testkit-lite must be installed on test machine.
+
+----------------------------------------------
+Build and Run
+----------------------------------------------
+(Suppose you only get the source code and Testkit-Lite has been set up on your test machine.
+ If you have got tct-mlsingleshot-tizen-tests ZIP packages, you can directly go to step 3 on the test machine;
+ if you have not installed Testkit-Lite, you need to install the latest version.)
+
+Steps:
+1. Prepare for building by running the following command:
+ cd tct-mlsingleshot-tizen-tests
+
+2. Build ZIP package by running the following command:
+ ./pack.py -t wgt --sign platform
+
+3. Unzip the package on the test machine by running the following command:
+ unzip -o tct-mlsingleshot-tizen-tests-<version>.zip -d /home/owner/share/tct
+
+4. Install the package on the test machine by running the following command:
+ /home/owner/share/tct/opt/tct-mlsingleshot-tizen-tests/inst.sh
+
+5. Run test cases by running the following command on host:
+ testkit-lite -f device:/home/owner/share/tct/opt/tct-mlsingleshot-tizen-tests/tests.xml -e "WRTLauncher" -o tct-mlsingleshot-tizen-tests.results.xml
--- /dev/null
+#!/bin/bash
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+for i in `grep -r "0xA" /var/cynara/db/_ | grep $1`
+do
+ CLIENT=`echo $i | cut -d ";" -f1`
+ USER=`echo $i | cut -d ";" -f2`
+ PRIVILEGE=`echo $i | cut -d ";" -f3`
+ #echo "cyad --erase=\"\" -r=no -c $CLIENT -u $USER -p $PRIVILEGE"
+ cyad --erase="" -r=no -c $CLIENT -u $USER -p $PRIVILEGE
+done
--- /dev/null
+<widget id='http://tizen.org/test/tct-mlsingleshot-tizen-tests' xmlns='http://www.w3.org/ns/widgets' xmlns:tizen='http://tizen.org/ns/widgets'>
+ <access origin="*"/>
+ <name>tct-mlsingleshot-tizen-tests</name>
+ <icon src="icon.png" height="117" width="117"/>
+ <tizen:application id="mlsingle01.WebAPITizenMLSingleTests" package="mlsingle01" required_version="6.5"/>
+ <tizen:setting screen-orientation="landscape"/>
+ <tizen:setting background-support="enable"/>
+ <tizen:privilege name="http://tizen.org/privilege/mediastorage"/>
+ <tizen:privilege name="http://tizen.org/privilege/externalstorage"/>
+</widget>
--- /dev/null
+#!/usr/bin/env python
+
+import os
+import shutil
+import glob
+import time
+import sys
+import subprocess
+from optparse import OptionParser, make_option\r
+import ConfigParser
+
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+PARAMETERS = None
+ADB_CMD = "adb"
+
+
+def doCMD(cmd):
+ # Do not need handle timeout in this short script, let tool do it
+ print "-->> \"%s\"" % cmd
+ output = []
+ cmd_return_code = 1
+ cmd_proc = subprocess.Popen(
+ cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
+
+ while True:
+ output_line = cmd_proc.stdout.readline().strip("\r\n")
+ cmd_return_code = cmd_proc.poll()
+ if output_line == '' and cmd_return_code != None:
+ break
+ sys.stdout.write("%s\n" % output_line)
+ sys.stdout.flush()
+ output.append(output_line)
+
+ return (cmd_return_code, output)
+
+
+def uninstPKGs():
+ action_status = True
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ for file in files:
+ if file.endswith(".apk"):
+ cmd = "%s -s %s uninstall org.xwalk.%s" % (
+ ADB_CMD, PARAMETERS.device, os.path.basename(os.path.splitext(file)[0]))
+ (return_code, output) = doCMD(cmd)
+ for line in output:
+ if "Failure" in line:
+ action_status = False
+ break
+ return action_status
+
+
+def instPKGs():
+ action_status = True
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ for file in files:
+ if file.endswith(".apk"):
+ cmd = "%s -s %s install %s" % (ADB_CMD,
+ PARAMETERS.device, os.path.join(root, file))
+ (return_code, output) = doCMD(cmd)
+ for line in output:
+ if "Failure" in line:
+ action_status = False
+ break
+ return action_status
+
+
+def main():
+ try:
+ usage = "usage: inst.py -i"
+ opts_parser = OptionParser(usage=usage)
+ opts_parser.add_option(
+ "-s", dest="device", action="store", help="Specify device")
+ opts_parser.add_option(
+ "-i", dest="binstpkg", action="store_true", help="Install package")
+ opts_parser.add_option(
+ "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
+ global PARAMETERS
+ (PARAMETERS, args) = opts_parser.parse_args()
+ except Exception, e:
+ print "Got wrong option: %s, exit ..." % e
+ sys.exit(1)
+
+ if not PARAMETERS.device:
+ (return_code, output) = doCMD("adb devices")
+ for line in output:
+ if str.find(line, "\tdevice") != -1:
+ PARAMETERS.device = line.split("\t")[0]
+ break
+
+ if not PARAMETERS.device:
+ print "No device found"
+ sys.exit(1)
+
+ if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
+ print "-i and -u are conflict"
+ sys.exit(1)
+
+ if PARAMETERS.buninstpkg:
+ if not uninstPKGs():
+ sys.exit(1)
+ else:
+ if not instPKGs():
+ sys.exit(1)
+
+if __name__ == "__main__":
+ main()
+ sys.exit(0)
--- /dev/null
+#!/usr/bin/env python
+
+import os
+import shutil
+import glob
+import time
+import sys
+import subprocess
+import string
+from optparse import OptionParser, make_option
+import ConfigParser
+
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+PKG_NAME = os.path.basename(SCRIPT_DIR)
+PARAMETERS = None
+#XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
+TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
+tct_parser = ConfigParser.ConfigParser()
+tct_parser.read(TCT_CONFIG_FILE)
+SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
+PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
+EXECUTION_MODE_30 = tct_parser.get('DEVICE', 'DEVICE_EXECUTION_MODE_30')
+ADMIN_USER_30 = tct_parser.get('DEVICE', 'DEVICE_ADMIN_USER_30')
+
+def userCheck():
+ global GLOVAL_OPT
+ if ADMIN_USER_30 == EXECUTION_MODE_30:
+ GLOVAL_OPT="--global"
+ else:
+ GLOVAL_OPT=""
+
+
+def askpolicyremoving():
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ for file in files:
+ if file.endswith(".wgt"):
+ pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0]))
+
+ print pkg_id
+ print (os.getcwd())
+ print (os.path.dirname(os.path.realpath(__file__)) )
+ if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)):
+ action_status = False
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell .%s/askpolicy.sh %s" % (PARAMETERS.device,
+ SRC_DIR, pkg_id)
+ return doCMD(cmd)
+
+def doCMD(cmd):
+ # Do not need handle timeout in this short script, let tool do it
+ print "-->> \"%s\"" % cmd
+ output = []
+ cmd_return_code = 1
+ cmd_proc = subprocess.Popen(
+ cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
+
+ while True:
+ output_line = cmd_proc.stdout.readline().strip("\r\n")
+ cmd_return_code = cmd_proc.poll()
+ if output_line == '' and cmd_return_code != None:
+ break
+ sys.stdout.write("%s\n" % output_line)
+ sys.stdout.flush()
+ output.append(output_line)
+
+ return (cmd_return_code, output)
+
+def updateCMD(cmd=None):
+ if "pkgcmd" in cmd:
+ cmd = "su - %s -c '%s;%s'" % (PARAMETERS.user, XW_ENV, cmd)
+ return cmd
+def getUSERID():
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell id -u %s" % (
+ PARAMETERS.device, PARAMETERS.user)
+ else:
+ cmd = "ssh %s \"id -u %s\"" % (
+ PARAMETERS.device, PARAMETERS.user )
+ return doCMD(cmd)
+
+
+def getPKGID(pkg_name=None):
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell %s" % (
+ PARAMETERS.device, updateCMD('pkgcmd -l'))
+ else:
+ cmd = "ssh %s \"%s\"" % (
+ PARAMETERS.device, updateCMD('pkgcmd -l'))
+
+ (return_code, output) = doCMD(cmd)
+ if return_code != 0:
+ return None
+
+ test_pkg_id = None
+ for line in output:
+ if line.find("[" + pkg_name + "]") != -1:
+ pkgidIndex = line.split().index("pkgid")
+ test_pkg_id = line.split()[pkgidIndex+1].strip("[]")
+ break
+ return test_pkg_id
+
+
+def doRemoteCMD(cmd=None):
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell %s" % (PARAMETERS.device, updateCMD(cmd))
+ else:
+ cmd = "ssh %s \"%s\"" % (PARAMETERS.device, updateCMD(cmd))
+
+ return doCMD(cmd)
+
+
+def doRemoteCopy(src=None, dest=None):
+ if PARAMETERS.mode == "SDB":
+ cmd_prefix = "sdb -s %s push" % PARAMETERS.device
+ cmd = "%s %s %s" % (cmd_prefix, src, dest)
+ else:
+ cmd = "scp -r %s %s:/%s" % (src, PARAMETERS.device, dest)
+
+ (return_code, output) = doCMD(cmd)
+ doRemoteCMD("sync")
+
+ if return_code != 0:
+ return True
+ else:
+ return False
+
+
+def uninstPKGs():
+ action_status = True
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ if root.endswith("mediasrc"):
+ continue
+
+ for file in files:
+ if file.endswith(".wgt"):
+ pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0]))
+ if not pkg_id:
+ action_status = False
+ continue
+ (return_code, output) = doRemoteCMD(
+ "pkgcmd %s -q -u -n %s" % (GLOVAL_OPT, pkg_id))
+ for line in output:
+ if "Failure" in line:
+ action_status = False
+ break
+
+ (return_code, output) = doRemoteCMD(
+ "rm -rf %s" % PKG_SRC_DIR)
+ if return_code != 0:
+ action_status = False
+
+ (return_code, output) = doRemoteCMD(
+ "rm -rf %s/downloads" % SRC_DIR)
+ if return_code != 0:
+ action_status = False
+
+ return action_status
+
+
+def instPKGs():
+ action_status = True
+ (return_code, output) = doRemoteCMD(
+ "mkdir -p %s" % PKG_SRC_DIR)
+ if return_code != 0:
+ action_status = False
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ if root.endswith("mediasrc"):
+ continue
+
+ for file in files:
+ if file.endswith(".wgt"):
+ if not doRemoteCopy(os.path.join(root, file), "%s/%s" % (SRC_DIR, file)):
+ action_status = False
+ (return_code, output) = doRemoteCMD(
+ "pkgcmd %s -i -t wgt -q -p %s/%s" % (GLOVAL_OPT, SRC_DIR, file))
+ doRemoteCMD("rm -rf %s/%s" % (SRC_DIR, file))
+ for line in output:
+ if "Failure" in line:
+ action_status = False
+ break
+
+ for item in glob.glob("%s/*" % SCRIPT_DIR):
+ if item.endswith(".wgt"):
+ continue
+ elif item.endswith("inst.py"):
+ continue
+ else:
+ item_name = os.path.basename(item)
+ if not doRemoteCopy(item, "%s/%s" % (PKG_SRC_DIR, item_name)):
+ action_status = False
+
+ # Do some special copy/delete... steps
+ (return_code, output) = doRemoteCMD(
+ "mkdir -p %s/Downloads" % SRC_DIR)
+ if return_code != 0:
+ action_status = False
+ if not doRemoteCopy(os.path.join(SCRIPT_DIR, "media"), SRC_DIR + "/Downloads"):
+ action_status = False
+ (return_code, output) = doRemoteCMD("chmod -R 777 %s/Downloads" % SRC_DIR)
+ #action_status = False
+ #(return_code, output) = doRemoteCMD("chmod -R 777 %s/Downloads" % INTERNAL_STORAGE)
+ return action_status
+
+
+def main():
+ try:
+ usage = "usage: inst.py -i"
+ opts_parser = OptionParser(usage=usage)
+ opts_parser.add_option(
+ "-m", dest="mode", action="store", help="Specify mode")
+ opts_parser.add_option(
+ "-s", dest="device", action="store", help="Specify device")
+ opts_parser.add_option(
+ "-i", dest="binstpkg", action="store_true", help="Install package")
+ opts_parser.add_option(
+ "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
+ opts_parser.add_option(
+ "-a", dest="user", action="store", help="User name")
+ global PARAMETERS
+ (PARAMETERS, args) = opts_parser.parse_args()
+ except Exception, e:
+ print "Got wrong option: %s, exit ..." % e
+ sys.exit(1)
+
+ if not PARAMETERS.user:
+ PARAMETERS.user = EXECUTION_MODE_30
+ if not PARAMETERS.mode:
+ PARAMETERS.mode = "SDB"
+
+ if PARAMETERS.mode == "SDB":
+ if not PARAMETERS.device:
+ (return_code, output) = doCMD("sdb devices")
+ for line in output:
+ if str.find(line, "\tdevice") != -1:
+ PARAMETERS.device = line.split("\t")[0]
+ break
+ else:
+ PARAMETERS.mode = "SSH"
+
+ if not PARAMETERS.device:
+ print "No device provided"
+ sys.exit(1)
+
+ userCheck()
+
+ user_info = getUSERID()
+ re_code = user_info[0]
+ if re_code == 0 :
+ global XW_ENV
+ userid = user_info[1][0]
+ XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
+ else:
+ print "[Error] cmd commands error : %s"%str(user_info[1])
+ sys.exit(1)
+ if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
+ print "-i and -u are conflict"
+ sys.exit(1)
+
+ if PARAMETERS.buninstpkg:
+ if not uninstPKGs():
+ sys.exit(1)
+ else:
+ if not instPKGs():
+ #askpolicyremoving()
+ sys.exit(1)
+
+if __name__ == "__main__":
+ main()
+ sys.exit(0)
--- /dev/null
+#!/usr/bin/env python
+
+import os
+import shutil
+import glob
+import time
+import sys
+import subprocess
+import string
+from optparse import OptionParser, make_option\r
+import ConfigParser
+
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+PKG_NAME = os.path.basename(SCRIPT_DIR)
+PARAMETERS = None
+#XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
+TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
+tct_parser = ConfigParser.ConfigParser()
+tct_parser.read(TCT_CONFIG_FILE)
+SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
+PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
+
+
+def doCMD(cmd):
+ # Do not need handle timeout in this short script, let tool do it
+ print "-->> \"%s\"" % cmd
+ output = []
+ cmd_return_code = 1
+ cmd_proc = subprocess.Popen(
+ cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
+
+ while True:
+ output_line = cmd_proc.stdout.readline().strip("\r\n")
+ cmd_return_code = cmd_proc.poll()
+ if output_line == '' and cmd_return_code != None:
+ break
+ sys.stdout.write("%s\n" % output_line)
+ sys.stdout.flush()
+ output.append(output_line)
+
+ return (cmd_return_code, output)
+
+
+def updateCMD(cmd=None):
+ if "pkgcmd" in cmd:
+ cmd = "su - %s -c '%s;%s'" % (PARAMETERS.user, XW_ENV, cmd)
+ return cmd
+def getUSERID():
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell id -u %s" % (
+ PARAMETERS.device, PARAMETERS.user)
+ else:
+ cmd = "ssh %s \"id -u %s\"" % (
+ PARAMETERS.device, PARAMETERS.user )
+ return doCMD(cmd)
+
+
+
+
+def getPKGID(pkg_name=None):
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell %s" % (
+ PARAMETERS.device, updateCMD('pkgcmd -l'))
+ else:
+ cmd = "ssh %s \"%s\"" % (
+ PARAMETERS.device, updateCMD('pkgcmd -l'))
+
+ (return_code, output) = doCMD(cmd)
+ if return_code != 0:
+ return None
+
+ test_pkg_id = None
+ for line in output:
+ if line.find("[" + pkg_name + "]") != -1:
+ pkgidIndex = line.split().index("pkgid")
+ test_pkg_id = line.split()[pkgidIndex+1].strip("[]")
+ break
+ return test_pkg_id
+
+
+def doRemoteCMD(cmd=None):
+ if PARAMETERS.mode == "SDB":
+ cmd = "sdb -s %s shell %s" % (PARAMETERS.device, updateCMD(cmd))
+ else:
+ cmd = "ssh %s \"%s\"" % (PARAMETERS.device, updateCMD(cmd))
+
+ return doCMD(cmd)
+
+
+def doRemoteCopy(src=None, dest=None):
+ if PARAMETERS.mode == "SDB":
+ cmd_prefix = "sdb -s %s push" % PARAMETERS.device
+ cmd = "%s %s %s" % (cmd_prefix, src, dest)
+ else:
+ cmd = "scp -r %s %s:/%s" % (src, PARAMETERS.device, dest)
+
+ (return_code, output) = doCMD(cmd)
+ doRemoteCMD("sync")
+
+ if return_code != 0:
+ return True
+ else:
+ return False
+
+
+def uninstPKGs():
+ action_status = True
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ if root.endswith("mediasrc"):
+ continue
+
+ for file in files:
+ if file.endswith(".xpk"):
+ pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0]))
+ if not pkg_id:
+ action_status = False
+ continue
+ (return_code, output) = doRemoteCMD(
+ "pkgcmd -u -t xpk -q -n %s" % pkg_id)
+ for line in output:
+ if "Failure" in line:
+ action_status = False
+ break
+
+ (return_code, output) = doRemoteCMD(
+ "rm -rf %s" % PKG_SRC_DIR)
+ if return_code != 0:
+ action_status = False
+
+ return action_status
+
+
+def instPKGs():
+ action_status = True
+ (return_code, output) = doRemoteCMD(
+ "mkdir -p %s" % PKG_SRC_DIR)
+ if return_code != 0:
+ action_status = False
+ for root, dirs, files in os.walk(SCRIPT_DIR):
+ if root.endswith("mediasrc"):
+ continue
+
+ for file in files:
+ if file.endswith(".xpk"):
+ if not doRemoteCopy(os.path.join(root, file), "%s/%s" % (SRC_DIR, file)):
+ action_status = False
+ (return_code, output) = doRemoteCMD(
+ "pkgcmd -i -t xpk -q -p %s/%s" % (SRC_DIR, file))
+ doRemoteCMD("rm -rf %s/%s" % (SRC_DIR, file))
+ for line in output:
+ if "Failure" in line:
+ action_status = False
+ break
+
+ # Do some special copy/delete... steps
+ '''
+ (return_code, output) = doRemoteCMD(
+ "mkdir -p %s/tests" % PKG_SRC_DIR)
+ if return_code != 0:
+ action_status = False
+
+ if not doRemoteCopy("specname/tests", "%s/tests" % PKG_SRC_DIR):
+ action_status = False
+ '''
+
+ return action_status
+
+
+def main():
+ try:
+ usage = "usage: inst.py -i"
+ opts_parser = OptionParser(usage=usage)
+ opts_parser.add_option(
+ "-m", dest="mode", action="store", help="Specify mode")
+ opts_parser.add_option(
+ "-s", dest="device", action="store", help="Specify device")
+ opts_parser.add_option(
+ "-i", dest="binstpkg", action="store_true", help="Install package")
+ opts_parser.add_option(
+ "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
+ opts_parser.add_option(
+ "-a", dest="user", action="store", help="User name")
+ global PARAMETERS
+ (PARAMETERS, args) = opts_parser.parse_args()
+ except Exception, e:
+ print "Got wrong option: %s, exit ..." % e
+ sys.exit(1)
+
+ if not PARAMETERS.user:
+ PARAMETERS.user = "owner"
+ if not PARAMETERS.mode:
+ PARAMETERS.mode = "SDB"
+
+ if PARAMETERS.mode == "SDB":
+ if not PARAMETERS.device:
+ (return_code, output) = doCMD("sdb devices")
+ for line in output:
+ if str.find(line, "\tdevice") != -1:
+ PARAMETERS.device = line.split("\t")[0]
+ break
+ else:
+ PARAMETERS.mode = "SSH"
+
+ if not PARAMETERS.device:
+ print "No device provided"
+ sys.exit(1)
+
+ user_info = getUSERID()
+ re_code = user_info[0]
+ if re_code == 0 :
+ global XW_ENV
+ userid = user_info[1][0]
+ XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
+ else:
+ print "[Error] cmd commands error : %s"%str(user_info[1])
+ sys.exit(1)
+ if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
+ print "-i and -u are conflict"
+ sys.exit(1)
+
+ if PARAMETERS.buninstpkg:
+ if not uninstPKGs():
+ sys.exit(1)
+ else:
+ if not instPKGs():
+ sys.exit(1)
+
+if __name__ == "__main__":
+ main()
+ sys.exit(0)
--- /dev/null
+{
+ "version": "6.5",
+ "name": "tct-mlsingleshot-tizen-tests",
+ "permissions": ["tabs", "unlimited_storage", "notifications", "http://*/*", "https://*/*"],
+ "description": "tct-mlsingleshot-tizen-tests",
+ "webapimanager": true,
+ "file_name": "manifest.json",
+ "app": {
+ "launch": {
+ "local_path": "index.html"
+ }
+ }
+}
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_notexist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_notexist
+//==== LABEL Check if interface MachineLearningSingle exists, it should not
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:MachineLearningSingle U
+//==== SPEC_URL TBD
+//==== PRIORITY P3
+//==== TEST_CRITERIA NIO
+test(function () {
+ check_no_interface_object("MachineLearningSingle");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModel</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModel
+//==== LABEL Check if method work properly
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModel M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MMINA MOA
+
+test(function () {
+ var model;
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY");
+
+ assert_type(model, "object", "the return value should be object type");
+ model.close();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync
+//==== LABEL Check if openModelAsync method work properly
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MMINA
+var t = async_test(document.title), model;
+
+t.step(function () {
+ successCallback = t.step_func(function (model) {
+ model.close();
+ t.done();
+ });
+
+ errorCallback = t.step_func(function (error) {
+ assert_unreached("openModelAsync() errorCallback invoked");
+ });
+
+ tizen.ml.single.openModelAsync(TENSORFLOW_LITE_MODEL_PATH, successCallback,
+ errorCallback, null, null, "TENSORFLOW_LITE", "ANY");
+
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_errorCallback_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_errorCallback_TypeMismatch
+//==== LABEL Check if MachineLearningSingle:openModelAsync with incorrect errorCallback type throws an exception
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+setup({timeout: 30000});
+
+var t = async_test(document.title, {timeout: 30000}),
+ successCallback, i, conversionTable;
+
+t.step(function () {
+ successCallback = t.step_func(function (model) {
+ assert_unreached("this function should not be run");
+ });
+
+ conversionTable = getTypeConversionExceptions("functionObject", true);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ model = tizen.ml.single.openModelAsync(
+ TENSORFLOW_LITE_MODEL_PATH, successCallback, conversionTable[i][0], null, null, "TENSORFLOW_LITE", "ANY");
+ }, "Exception should be thrown - given incorrect inTensorsInfo");
+ }
+
+ t.done();
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_errorCallback_invalid_cb</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_errorCallback_invalid_cb
+//==== LABEL Check if an exception was thrown when a fake errorCallback was passed into openModelAsync method
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MTCB
+setup({timeout: 900000});
+
+var t = async_test(document.title, {timeout: 900000}),
+ findSuccess, findErrorFunc, findError;
+
+t.step(function () {
+ findSuccess = t.step_func(function () {
+ assert_unreached("this function should not be run");
+ });
+
+ findErrorFunc = t.step_func(function (error) {
+ assert_unreached("openModelAsync() error callback invoked: name:" + error.name + "msg:" + error.message);
+ });
+
+ findError = {
+ onerror: findErrorFunc
+ };
+
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tizen.ml.single.openModelAsync(TENSORFLOW_LITE_MODEL_PATH, findSuccess,
+ findError, null, null, "TENSORFLOW_LITE", "ANY");
+ }, "exception should be thrown");
+
+ t.done();
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_errorCallback_invoked_InvalidValuesError</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_errorCallback_invoked_InvalidValuesError
+//==== LABEL Check MachineLearningSingle:openModelAsync method errorCallback invoked when invalidvalue input
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MERRCB
+var t = async_test(document.title), successCallback, errorCallback, inTensorsInfo;
+
+t.step(function () {
+ successCallback = t.step_func(function (model) {
+ assert_unreached("Success callback invoked");
+ });
+
+ errorCallback = t.step_func(function (error) {
+ assert_equals(error.name, "InvalidValuesError", "Incorrect error name.");
+ assert_type(error.message, "string", "Error message is not a string");
+ assert_not_equals(error.message, "", "Error message is empty");
+ t.done();
+ });
+ inTensorsInfo = new tizen.ml.TensorsInfo();
+
+ tizen.ml.single.openModelAsync(TENSORFLOW_LITE_MODEL_PATH, successCallback,
+ errorCallback, inTensorsInfo, null, "ANY", "ANY");
+
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_errorCallback_invoked_NotFoundError</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_errorCallback_invoked_NotFoundError
+//==== LABEL Check MachineLearningSingle:openModelAsync method throws exception when errorCallback is invoked
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MERRCB
+setup({timeout: 900000});
+var t = async_test(document.title, {timeout: 900000}), successCallback, errorCallback;
+
+t.step(function () {
+ successCallback = t.step_func(function (model) {
+ assert_unreached("Success callback invoked");
+ });
+
+ errorCallback = t.step_func(function (error) {
+ assert_equals(error.name, "NotFoundError", "Incorrect error name.");
+ assert_type(error.message, "string", "Error message is not a string");
+ assert_not_equals(error.message, "", "Error message is empty");
+ t.done();
+ });
+
+ tizen.ml.single.openModelAsync("downloads/a.tflite", successCallback,
+ errorCallback, null, null, "TENSORFLOW_LITE", "ANY");
+
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_exist
+//==== LABEL Check if MachineLearningSingle:openModelAsync() method exists
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ check_method_exists(tizen.ml.single, "openModelAsync");
+}, document.title);
+
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_fwType_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_fwType_TypeMismatch
+//==== LABEL Check if MachineLearningSingle:openModelAsync with incorrect optional fwType type throws an exception
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+setup({timeout: 90000});
+
+var t = async_test(document.title, {timeout: 90000}),
+ successCallback, errorCallback, i, conversionTable;
+
+t.step(function () {
+ successCallback = t.step_func(function (model) {
+ assert_unreached("this function should not be run");
+ });
+
+ errorCallback = t.step_func(function (error) {
+ assert_unreached("openModelAsync() error callback invoked: name:" + error.name + "msg:" + error.message);
+ });
+
+ conversionTable = getTypeConversionExceptions("enum", true);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ model = tizen.ml.single.openModelAsync(TENSORFLOW_LITE_MODEL_PATH, successCallback,
+ errorCallback, null, null, conversionTable[i][0], "ANY");
+ }, "exception should be thrown");
+ }
+
+ t.done();
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_hwType_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_hwType_TypeMismatch
+//==== LABEL Check if MachineLearningSingle:openModelAsync with incorrect optional hwType type throws an exception
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+setup({timeout: 900000});
+
+var t = async_test(document.title, {timeout: 900000}),
+ successCallback, errorCallback, i, conversionTable;
+
+t.step(function () {
+ successCallback = t.step_func(function (model) {
+ assert_unreached("this function should not be run");
+ });
+
+ errorCallback = t.step_func(function (error) {
+ assert_unreached("openModelAsync() error callback invoked: name:" + error.name + "msg:" + error.message);
+ });
+
+ conversionTable = getTypeConversionExceptions("enum", true);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tizen.ml.single.openModelAsync(TENSORFLOW_LITE_MODEL_PATH, successCallback,
+ errorCallback, null, null, "TENSORFLOW_LITE", conversionTable[i][0]);
+ }, "exception should be thrown");
+ }
+
+ t.done();
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_inTensorsInfo_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_inTensorsInfo_TypeMismatch
+//==== LABEL Check if MachineLearningSingle:openModelAsync with incorrect optional type inTensorsInfo throws an exception
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+setup({timeout: 30000});
+
+var t = async_test(document.title, {timeout: 30000}),
+ successCallback, errorCallback, i, conversionTable;
+
+t.step(function () {
+ successCallback = t.step_func(function (model) {
+ assert_unreached("this function should not be run");
+ });
+
+ errorCallback = t.step_func(function (error) {
+ assert_unreached("openModelAsync() error callback invoked: name:" + error.name + "msg:" + error.message);
+ });
+
+ conversionTable = getTypeConversionExceptions("object", true);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tizen.ml.single.openModelAsync(
+ TENSORFLOW_LITE_MODEL_PATH, successCallback, errorCallback, conversionTable[i][0], null, "TENSORFLOW_LITE", "ANY");
+ }, "Exception should be thrown - given incorrect inTensorsInfo");
+ }
+
+ t.done();
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>MachineLearningSingle_openModelAsync_misarg</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+<script src="support/mlsinglecommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: MachineLearningSingle_openModelAsync_misarg\r
+//==== LABEL Check if MachineLearningSingle:openModelAsync () throws exception when successCallback is missing\r
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P2\r
+//==== TEST_CRITERIA MMA\r
+var t = async_test(document.title), successCallback, errorCallback;\r
+\r
+t.step(function () {\r
+\r
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {\r
+ tizen.ml.single.openModelAsync();\r
+ }, "Not given any argument.");\r
+ t.done();\r
+});\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_outTensorsInfo_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_outTensorsInfo_TypeMismatch
+//==== LABEL Check if MachineLearningSingle:openModelAsync with incorrect optional type outTensorsInfo throws an exception
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+setup({timeout: 30000});
+
+var t = async_test(document.title, {timeout: 30000}),
+ successCallback, errorCallback, i, conversionTable;
+
+t.step(function () {
+ successCallback = t.step_func(function (model) {
+ assert_unreached("this function should not be run");
+ });
+
+ errorCallback = t.step_func(function (error) {
+ assert_unreached("openModelAsync() error callback invoked: name:" + error.name + "msg:" + error.message);
+ });
+
+ conversionTable = getTypeConversionExceptions("object", true);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tizen.ml.single.openModelAsync(
+ TENSORFLOW_LITE_MODEL_PATH, successCallback, errorCallback, null, conversionTable[i][0], "TENSORFLOW_LITE", "ANY");
+ }, "Exception should be thrown - given incorrect inTensorsInfo");
+ }
+
+ t.done();
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_successCallback_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_successCallback_TypeMismatch
+//==== LABEL Check if MachineLearningSingle:openModelAsync with incorrect optional successCallback type throws an exception
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+setup({timeout: 30000});
+
+var t = async_test(document.title, {timeout: 30000}),
+ errorCallback, i, conversionTable;
+
+t.step(function () {
+
+ errorCallback = t.step_func(function (error) {
+ assert_unreached("openModelAsync() error callback invoked: name:" + error.name + "msg:" + error.message);
+ });
+
+ conversionTable = getTypeConversionExceptions("functionObject", true);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tizen.ml.single.openModelAsync(
+ TENSORFLOW_LITE_MODEL_PATH, conversionTable[i][0], errorCallback, null, null, "TENSORFLOW_LITE", "ANY");
+ }, "Exception should be thrown - given incorrect inTensorsInfo");
+ }
+
+ t.done();
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_successCallback_invalid_cb</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_successCallback_invalid_cb
+//==== LABEL Check if an exception was thrown when a fake successCallback was passed into openModelAsync method
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MTCB
+setup({timeout: 30000});
+
+var t = async_test(document.title, {timeout: 30000}),
+ findSuccess, findErrorFunc, findError, appControl;
+
+t.step(function () {
+ findSuccess = t.step_func(function () {
+ assert_unreached("this function should not be run");
+ });
+
+ findErrorFunc = t.step_func(function (error) {
+ assert_unreached("openModelAsync() error callback invoked: name:" + error.name + "msg:" + error.message);
+ });
+
+ findSucc = {
+ onsuccess: findSuccess
+ };
+
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tizen.ml.single.openModelAsync(TENSORFLOW_LITE_MODEL_PATH, findSucc,
+ findError, null, null, "TENSORFLOW_LITE", "ANY");
+ }, "exception should be thrown");
+
+ t.done();
+});
+
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_successCallback_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_successCallback_misarg
+//==== LABEL Check if MachineLearningSingle:openModelAsync () throws exception when successCallback is missing
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+var t = async_test(document.title), errorCallback;
+
+t.step(function () {
+
+ errorCallback = t.step_func(function (error) {
+ assert_unreached("error callback invoked");
+ });
+
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tizen.ml.single.openModelAsync(TENSORFLOW_LITE_MODEL_PATH, undefined,
+ errorCallback, null, null, "TENSORFLOW_LITE", "ANY");
+ }, "Not given non-optional successCallback argument.");
+ t.done();
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModelAsync_with_isDynamicMode</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModelAsync_with_isDynamicMode
+//==== LABEL Check if MachineLearningSingle:openModelAsync() method works properly with optional argument
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModelAsync M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MOA MR
+
+var t = async_test(document.title), model, inputTI1, inputTI2, tensorsData1, tensorsData2, tensorsDataOut1, tensorsDataOut2;
+
+t.step(function () {
+ successCallback = t.step_func(function (model) {
+ inputTI1 = new tizen.ml.TensorsInfo();
+ inputTI1.addTensorInfo("tensor1", "FLOAT32", [1, 1, 1, 1]);
+ tensorsData1 = inputTI1.getTensorsData();
+
+ tensorsDataOut1 = model.invoke(tensorsData1);
+
+ inputTI2 = new tizen.ml.TensorsInfo();
+ inputTI2.addTensorInfo("tensor2", "FLOAT32", [3, 1, 1, 1]);
+ tensorsData2 = inputTI2.getTensorsData();
+ //change input1
+
+ tensorsDataOut2 = model.invoke(tensorsData2);
+
+ tensorsDataOut1.dispose();
+ tensorsData1.dispose();
+ tensorsDataOut2.dispose();
+ tensorsData2.dispose();
+ inputTI1.dispose();
+ inputTI2.dispose();
+ model.close();
+ t.done();
+ });
+
+ errorCallback = t.step_func(function (error) {
+ assert_unreached("openModelAsync() errorCallback invoked");
+ });
+
+ tizen.ml.single.openModelAsync(TENSORFLOW_LITE_DYNAMICMODE_PATH, successCallback,
+ errorCallback, null, null, "TENSORFLOW_LITE", "ANY", true);
+
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>MachineLearningSingle_openModel_InvalidValue_1</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+<script src="support/mlsinglecommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: MachineLearningSingle_openModel_InvalidValue_1\r
+//==== LABEL Check MachineLearningSingle:openModel method throw an exception when invalidvalue input\r
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModel M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ model.close();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var model, inTensorsInfo;\r
+ inTensorsInfo = new tizen.ml.TensorsInfo();\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ model = tizen.ml.single.openModel(\r
+ TENSORFLOW_LITE_MODEL_PATH, inTensorsInfo, null, "TENSORFLOW_LITE", "ANY");\r
+ }, "invalid tensorInfo , Should throw InvalidValuesError exception"); \r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>MachineLearningSingle_openModel_InvalidValue_2</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+<script src="support/mlsinglecommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: MachineLearningSingle_openModel_InvalidValue_2\r
+//==== LABEL Check MachineLearningSingle:openModel method throw an exception when invalidvalue input\r
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModel M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ model.close();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var model, outTensorsInfo;\r
+ outTensorsInfo = new tizen.ml.TensorsInfo();\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ model = tizen.ml.single.openModel(\r
+ TENSORFLOW_LITE_MODEL_PATH, null, outTensorsInfo, "TENSORFLOW_LITE", "ANY");\r
+ }, "invalid tensorInfo , Should throw InvalidValuesError exception"); \r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModel_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModel_exist
+//==== LABEL Check if MachineLearningSingle:openModel() method exists
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModel M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ check_method_exists(tizen.ml.single, "openModel");
+}, document.title);
+tizen.ml.pipeline
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModel_fwType_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModel_fwType_TypeMismatch
+//==== LABEL Check if MachineLearningSingle:openModel with incorrect optional fwType type throws an exception
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModel M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+test(function () {
+ var conversionTable, i, model;
+ add_result_callback(function () {
+ try {
+ model.close();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+
+ conversionTable = getTypeConversionExceptions("enum", true);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, conversionTable[i][0], "ANY");
+ }, "Exception should be thrown - given incorrect fwtype");
+ }
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModel_hwType_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModel_hwType_TypeMismatch
+//==== LABEL Check if MachineLearningSingle:openModel with incorrect optional type hwType throws an exception
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModel M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+test(function () {
+ var conversionTable, i, model;
+ add_result_callback(function () {
+ try {
+ model.close();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+
+ conversionTable = getTypeConversionExceptions("enum", true);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", conversionTable[i][0]);
+ }, "Exception should be thrown - given incorrect hwtype");
+ }
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModel_inTensorsInfo_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModel_inTensorsInfo_TypeMismatch
+//==== LABEL Check if MachineLearningSingle:openModel with incorrect optional type inTensorsInfo throws an exception
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModel M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+test(function () {
+ var conversionTable, i, model;
+ add_result_callback(function () {
+ try {
+ model.close();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+
+ conversionTable = getTypeConversionExceptions("object", true);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, conversionTable[i][0], null, "TENSORFLOW_LITE", "ANY");
+ }, "Exception should be thrown - given incorrect inTensorsInfo");
+ }
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModel_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModel_misarg
+//==== LABEL Check if MachineLearningSingle:openModel() throws exception when argument is missing
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModel M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ tizen.ml.single.openModel();
+ }, "missing non-opational, Not given any argument.");
+
+}, document.title);
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModel_outTensorsInfo_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModel_outTensorsInfo_TypeMismatch
+//==== LABEL Check if MachineLearningSingle:openModel with incorrect optional type outTensorsInfo throws an exception
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModel M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+test(function () {
+ var conversionTable, i, model;
+ add_result_callback(function () {
+ try {
+ model.close();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+
+ conversionTable = getTypeConversionExceptions("object", true);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, conversionTable[i][0], "TENSORFLOW_LITE", "ANY");
+ }, "Exception should be thrown - given incorrect outTensorsInfo");
+ }
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>MachineLearningSingle_openModel_with_isDynamicMode</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: MachineLearningSingle_openModel_with_isDynamicMode
+//==== LABEL Check if MachineLearningSingle:openModel() method with DynamicMode works properly with optional argument
+//==== SPEC Tizen Web API:TBD:MLSingleShot:MachineLearningSingle:openModel M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MOA MR MAST
+test(function () {
+ var model, inputTI1, inputTI2, tensorsData1, tensorsData2, tensorsDataOut1, tensorsDataOut2;
+
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_DYNAMICMODE_PATH, null, null, "TENSORFLOW_LITE", "ANY", true);
+ assert_type(model, "object", "the return value should be object type");
+
+ inputTI1 = new tizen.ml.TensorsInfo();
+ inputTI1.addTensorInfo("tensor1", "FLOAT32", [1, 1, 1, 1]);
+ tensorsData1 = inputTI1.getTensorsData();
+
+ tensorsDataOut1 = model.invoke(tensorsData1);
+
+ inputTI2 = new tizen.ml.TensorsInfo();
+ inputTI2.addTensorInfo("tensor2", "FLOAT32", [3, 1, 1, 1]);
+ tensorsData2 = inputTI2.getTensorsData();
+ //change input1
+
+ tensorsDataOut2 = model.invoke(tensorsData2);
+
+ retValue1 = model.output.getDimensions(0);
+ dismension1 = new Array(3, 1, 1, 1);
+ assert_type(retValue1, "array", "returned value should be long[] type");
+ assert_array_equals(retValue1, dismension1, "returned value should be correct value");
+
+ //change input2
+ //inputTI3 = new tizen.ml.TensorsInfo();
+ //inputTI3.addTensorInfo("tensor3", "FLOAT32", [2, 1, 1, 1]);
+
+ //model.input = inputTI3;
+
+ //retValue2 = model.output.getDimensions(0);
+ //dismension2 = new Array(2, 1, 1, 1);
+ //assert_type(retValue2, "array", "returned value should be long[] type");
+ //assert_array_equals(retValue2, dismension2, "returned value should be correct value");
+ tensorsDataOut1.dispose();
+ tensorsDataOut2.dispose();
+ tensorsData1.dispose();
+ tensorsData2.dispose();
+ inputTI1.dispose();
+ inputTI2.dispose();
+ //inputTI3.dispose();
+ model.close();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>OpenModelSuccessCallback_notexist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: OpenModelSuccessCallback_notexist
+//==== LABEL Check if interface OpenModelSuccessCallback exists, it should not
+//==== SPEC Tizen Web API:TBD:MLSingleShot:OpenModelSuccessCallback:OpenModelSuccessCallback U
+//==== SPEC_URL TBD
+//==== PRIORITY P3
+//==== TEST_CRITERIA CBNIO
+test(function () {
+ check_no_interface_object("OpenModelSuccessCallback");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>OpenModelSuccessCallback_onsuccess</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: OpenModelSuccessCallback_onsuccess
+//==== LABEL Check if OpenModelSuccessCallback:onsuccess method work properly
+//==== SPEC Tizen Web API:TBD:MLSingleShot:OpenModelSuccessCallback:onsuccess M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA CBOA CBT
+var t = async_test(document.title), successCallback, errorCallback;
+
+t.step(function () {
+ successCallback = t.step_func(function (model) {
+ model.close();
+ t.done();
+ });
+
+ errorCallback = t.step_func(function (error) {
+ assert_unreached("error callback should not be invoked");
+ });
+
+ tizen.ml.single.openModelAsync(TENSORFLOW_LITE_MODEL_PATH, successCallback,
+ errorCallback, null, null, "TENSORFLOW_LITE", "ANY");
+});
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_close</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_close
+//==== LABEL Check if close method work properly
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:close M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR MNAST
+test(function () {
+ var model;
+
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY");
+
+ retVal = model.close();
+ assert_type(retVal, "undefined", "method should returned undefined value");
+
+ assert_throws({name: 'AbortError'}, function () {
+ model.setTimeout(1);
+ }, "AbortError should be thrown - model closed. Object should not be used after calling close.");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>SingleShot_close_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+<script src="support/mlsinglecommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: SingleShot_close_AbortError\r
+//==== LABEL Check if SingleShot:close error occur throws an exception\r
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:close M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ var model;\r
+ model = tizen.ml.single.openModel(TENSORFLOW_LITE_MODEL_PATH);\r
+ model.close();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ model.close();\r
+ }, "AbortError should be thrown. Object should not be used after calling close.");\r
+\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>\r
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_close_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_close_exist
+//==== LABEL Check if SingleShot:close() method exists
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:close M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var model;
+ try
+ {
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY");
+ }
+ catch (e)
+ {
+ console.log("Error while opening model: " + e.message);
+ }
+ check_method_exists(model, "close");
+ model.close();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_close_extra_argument</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_close_extra_argument
+//==== LABEL Check using SingleShot::close() method with extra argument
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:close M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MNAEX
+
+test(function () {
+ var model, extraArgument, i;
+ extraArgument = [
+ null,
+ undefined,
+ "Tizen",
+ 1,
+ false,
+ ["one", "two"],
+ {argument: 1},
+ function () {}
+ ], i;
+
+ for (i = 0; i < extraArgument.length; i++) {
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY");
+ model.close(extraArgument[i]);
+ }
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_getValue</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_getValue
+//==== LABEL Check if getvalue method work properly
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:getValue M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR
+test(function () {
+ var model, key, value;
+ model = tizen.ml.single.openModel(TENSORFLOW_LITE_MODEL_PATH);
+ key = "input";
+ value = model.getValue(key)
+ assert_type(value, "string", "type of the returned value is not a domstring");
+ assert_equals(value, "3:224:224:1", "Returned data should be correct");
+ model.close();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>SingleShot_getValue_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+<script src="support/mlsinglecommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: SingleShot_getValue_AbortError\r
+//==== LABEL Check if SingleShot:getValue error occur throws an exception\r
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:getValue M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ var model, key, value;\r
+ model = tizen.ml.single.openModel(TENSORFLOW_LITE_MODEL_PATH);\r
+ key = "input";\r
+ model.close();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ value = model.getValue(key);\r
+ }, "AbortError should be thrown. Object should not be used after calling close.");\r
+\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>\r
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>SingleShot_getValue_NotSupported</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+<script src="support/mlsinglecommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: SingleShot_getValue_NotSupported\r
+//==== LABEL Check if getValue method input parameters with unsupported value could throw an exception\r
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:getValue M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ model.close();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var model, key;\r
+ model = tizen.ml.single.openModel(\r
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY");\r
+ key = "invalid";\r
+ assert_throws(NOT_SUPPORTED_EXCEPTION, function () {\r
+ model.getValue(key);\r
+ }, "unsupported key, Should throw NOT_SUPPORTED_EXCEPTION exception"); \r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>\r
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_getValue_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_getValue_exist
+//==== LABEL Check if SingleShot:getValue() method exists
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:getValue M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var model;
+ try
+ {
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY");
+ }
+ catch (e)
+ {
+ console.log("Error while opening model: " + e.message);
+ }
+ check_method_exists(model, "getValue");
+ model.close();
+}, document.title);
+
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_getValue_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_getValue_misarg
+//==== LABEL Check if SingleShot:getValue () throws exception when argument is missing
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:getValue M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ var model;
+ add_result_callback(function () {
+ try {
+ model.close();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ model = tizen.ml.single.openModel(TENSORFLOW_LITE_MODEL_PATH);
+
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ model.getValue();
+ }, "Not given any argument.");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_input_attribute</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_input_attribute
+//==== LABEL Test whether SingleShot contains the attribute input, has type object and is readonly
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:input A
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA AE AT ARO
+test(function () {
+ var model, oldValue, isEqual;
+
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY");
+
+ assert_true("input" in model, "input doesn't exist in model object.");
+ assert_type(model.input, "object", "input should be a object type");
+ //Note: model.input returns clone of input, it means thatmodel.input != model.input.
+ //It differs by _id attribute.To check whether TensorsInfo are equal, one can use equals mehtod
+ oldValue = model.input;
+ tensorsInfoIn = new tizen.ml.TensorsInfo();
+ tensorsInfoIn.addTensorInfo("tensor", "UINT8", [3, 224, 224]);
+ model.input = tensorsInfoIn;
+ isEqual = oldValue.equals(model.input);
+ assert_equals(isEqual, true, "tensorsInfo should not be modified.");
+ tensorsInfoIn.dispose();
+ model.close();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_invoke</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_invoke
+//==== LABEL Check if SingleShot:invoke method work properly
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:invoke M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR
+test(function () {
+ var model, tensorsInfo, tensorsData, tensorsDataOut, tensorRawData;
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH);
+ //model.setTimeout(1);
+ tensorsInfo = new tizen.ml.TensorsInfo();
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 224, 224]);
+ tensorsData = tensorsInfo.getTensorsData();
+
+ tensorsDataOut = model.invoke(tensorsData);
+ tensorRawData = tensorsDataOut.getTensorRawData(0);
+ assert_type(tensorRawData.data, "object", "type of the returned value is not a byte");
+ assert_type(tensorRawData.shape, "array", "type of the returned value is not a array");
+ assert_type(tensorRawData.size, "number", "type of the returned value is not a byte");
+
+ //data = new Uint8Array(1001);
+ shape = new Array(1001, 1, 1, 1);
+ size = 1001;
+ //assert_equals(tensorRawData.data, data, "Returned data should be correct");
+ assert_array_equals(tensorRawData.shape, shape, "Returned shape should be correct");
+ assert_equals(tensorRawData.size, size, "Returned size should be correct");
+
+ tensorsDataOut.dispose();
+ tensorsData.dispose();
+ tensorsInfo.dispose();
+ model.close();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>SingleShot_invoke_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+<script src="support/mlsinglecommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: SingleShot_invoke_AbortError\r
+//==== LABEL Check if SingleShot:invoke error occur throws an exception\r
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:invoke M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsData.dispose();\r
+ tensorsInfo.dispose();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var model, tensorsInfo, tensorsData;\r
+ model = tizen.ml.single.openModel(TENSORFLOW_LITE_MODEL_PATH);\r
+ //model.setTimeout(1);\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 224, 224]);\r
+ tensorsData = tensorsInfo.getTensorsData();\r
+ model.close();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ model.invoke(tensorsData);\r
+ }, "AbortError should be thrown. Object should not be used after calling close.");\r
+\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>\r
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>SingleShot_invoke_TimeoutError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+<script src="support/mlsinglecommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: SingleShot_invoke_TimeoutError\r
+//==== LABEL Check if SingleShot:invoke throw TimeoutError if the operation timed out\r
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:invoke M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ tensorsData.dispose();\r
+ tensorsInfo.dispose();\r
+ model.close();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var model, tensorsInfo, tensorsData;\r
+ model = tizen.ml.single.openModel(\r
+ TENSORFLOW_LITE_MODEL_PATH);\r
+\r
+ tensorsInfo = new tizen.ml.TensorsInfo();\r
+ tensorsInfo.addTensorInfo("tensor", "UINT8", [3, 224, 224]);\r
+ tensorsData = tensorsInfo.getTensorsData();\r
+ // 1 ms is used only for testing, to show TimeoutError\r
+ // Use more reasonable value in real life applications\r
+ model.setTimeout(1);\r
+ assert_throws({name: 'TimeoutError'}, function () {\r
+ model.invoke(tensorsData);\r
+ }, "Timeout error should be thrown.");\r
+\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_invoke_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_invoke_exist
+//==== LABEL Check if SingleShot:invoke() method exists
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:invoke M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var model;
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY");
+
+ check_method_exists(model, "invoke");
+ model.close();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_invoke_inTensorsData_TypeMismatch</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_invoke_inTensorsData_TypeMismatch
+//==== LABEL Check if SingleShot:invoke with incorrect inTensorsData type throws an exception
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:invoke M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MC
+test(function () {
+ var conversionTable, i, model;
+ add_result_callback(function () {
+ try {
+ model.close();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH);
+ conversionTable = getTypeConversionExceptions("object", false);
+ for (i = 0; i < conversionTable.length; i++) {
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ model.invoke(conversionTable[i][0]);
+ }, "Exception should be thrown - given incorrect inTensorsData");
+ }
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_invoke_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_invoke_misarg
+//==== LABEL Check if SingleShot:invoke () throws exception when argument is missing
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:invoke M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ add_result_callback(function () {
+ try {
+ model.close();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var model;
+ model = tizen.ml.single.openModel(TENSORFLOW_LITE_MODEL_PATH);
+ model.setTimeout(1);
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ model.invoke();
+ }, "Not given any argument.");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_notexist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_notexist
+//==== LABEL Check if interface SingleShot exists, it should not
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:SingleShot U
+//==== SPEC_URL TBD
+//==== PRIORITY P3
+//==== TEST_CRITERIA NIO
+test(function () {
+ check_no_interface_object("SingleShot");
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_output_attribute</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_output_attribute
+//==== LABEL Test whether SingleShot contains the attribute output, has type object and is readonly
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:output A
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA AE AT ARO
+test(function () {
+ var model;
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY");
+
+ assert_true("output" in model, "output doesn't exist in model object.");
+ assert_type(model.output, "object", "output should be a object type");
+ //Note: model.output returns clone of output, it means thatmodel.output != model.output.
+ //It differs by _id attribute.To check whether TensorsInfo are equal, one can use equals mehtod
+ oldValue = model.output;
+ model.output = "dummyValue";
+ isEqual = oldValue.equals(model.output);
+ assert_equals(isEqual, true, "tensorsInfo should not be modified.");
+
+ model.close();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_setTimeout</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_setTimeout
+//==== LABEL Check if setTimeout method work properly
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:setTimeout M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR
+test(function () {
+ var model, retVal;
+
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY");
+
+ retVal = model.setTimeout(1);
+ assert_type(retVal, "undefined", "method should returned undefined value");
+ model.close();
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>SingleShot_setTimeout_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+<script src="support/mlsinglecommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: SingleShot_setTimeout_AbortError\r
+//==== LABEL Check if SingleShot:setTimeout error occur throws an exception\r
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:setTimeout M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ var model;\r
+ model = tizen.ml.single.openModel(TENSORFLOW_LITE_MODEL_PATH);\r
+ model.close();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ model.setTimeout(1);\r
+ }, "AbortError should be thrown. Object should not be used after calling close.");\r
+\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>\r
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_setTimeout_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_setTimeout_exist
+//==== LABEL Check if SingleShot:setTimeout() method exists
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:setTimeout M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var model;
+ try
+ {
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY");
+ }
+ catch (e)
+ {
+ console.log("Error while opening model: " + e.message);
+ }
+ check_method_exists(model, "setTimeout");
+ model.close();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_setTimeout_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_setTimeout_misarg
+//==== LABEL Check if SingleShot:setTimeout () throws exception when argument is missing
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:setTimeout M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ add_result_callback(function () {
+ try {
+ model.close();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var model;
+ model = tizen.ml.single.openModel(TENSORFLOW_LITE_MODEL_PATH);
+
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ model.setTimeout();
+ }, "Not given any argument.");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_setValue</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_setValue
+//==== LABEL Check if setValue method work properly
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:setValue M
+//==== SPEC_URL TBD
+//==== PRIORITY P1
+//==== TEST_CRITERIA MR
+test(function () {
+ var model, key, retVal;
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_DYNAMICMODE_PATH, null, null, "TENSORFLOW_LITE", "ANY", true);
+ key = "input";
+ retVal = model.setValue(key, "3:1:1:1");
+ assert_type(retVal, "undefined", "method should returned undefined value");
+ value = model.getValue(key)
+ assert_type(value, "string", "type of the returned value is not a domstring");
+ assert_equals(value, "3:1:1:1", "Returned data should be correct");
+ model.close();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>SingleShot_setValue_AbortError</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+<script src="support/mlsinglecommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: SingleShot_setValue_AbortError\r
+//==== LABEL Check if SingleShot:setValue error occur throws an exception\r
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:setValue M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ var model, key, value;\r
+ model = tizen.ml.single.openModel(TENSORFLOW_LITE_MODEL_PATH);\r
+ key = "input";\r
+ model.setValue(key, "3:224:224:7");\r
+ model.close();\r
+ assert_throws({name: 'AbortError'}, function () {\r
+ value = model.getValue(key);\r
+ }, "AbortError should be thrown. Object should not be used after calling close.");\r
+\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>\r
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>SingleShot_setValue_InvalidValue</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+<script src="support/mlsinglecommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: SingleShot_setValue_InvalidValue\r
+//==== LABEL Check if setValue method input parameters with invalid value could throw an exception\r
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:setValue M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MC\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ model.close();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var model, key;\r
+ model = tizen.ml.single.openModel(\r
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY", true);\r
+ key = "input";\r
+ assert_throws(INVALID_VALUES_EXCEPTION, function () {\r
+ model.setValue(key, "1001:1001:1001:7");\r
+ }, "invalid value, Should throw InvalidValuesError exception"); \r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>\r
--- /dev/null
+<!DOCTYPE html>\r
+<!--\r
+Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+-->\r
+<html>\r
+<head>\r
+<title>SingleShot_setValue_NotSupported</title>\r
+<meta charset="utf-8"/>\r
+<script src="support/unitcommon.js"></script>\r
+<script src="support/mlsinglecommon.js"></script>\r
+</head>\r
+<body>\r
+<div id="log"></div>\r
+<script>\r
+//==== TEST: SingleShot_setValue_NotSupported\r
+//==== LABEL Check if setValue method input parameters with unsupported value could throw an exception\r
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:setValue M\r
+//==== SPEC_URL TBD\r
+//==== PRIORITY P1\r
+//==== TEST_CRITERIA MR\r
+test(function () {\r
+ add_result_callback(function () {\r
+ try {\r
+ model.close();\r
+ } catch (err) {\r
+ // do nothing in case dispose throw an exception\r
+ }\r
+ });\r
+ var model, key;\r
+ model = tizen.ml.single.openModel(\r
+ TENSORFLOW_LITE_DYNAMICMODE_PATH, null, null, "TENSORFLOW_LITE", "ANY", true);\r
+ key = "invalid";\r
+ assert_throws(NOT_SUPPORTED_EXCEPTION, function () {\r
+ model.setValue(key, "3: 1: 1: 1");\r
+ }, "invalid key, Should throw InvalidValuesError exception");\r
+}, document.title);\r
+\r
+</script>\r
+</body>\r
+</html>\r
+\r
+\r
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_setValue_exist</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_setValue_exist
+//==== LABEL Check if SingleShot:setValue() method exists
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:setValue M
+//==== SPEC_URL TBD
+//==== PRIORITY P0
+//==== TEST_CRITERIA ME
+test(function () {
+ var model;
+ try
+ {
+ model = tizen.ml.single.openModel(
+ TENSORFLOW_LITE_MODEL_PATH, null, null, "TENSORFLOW_LITE", "ANY");
+ }
+ catch (e)
+ {
+ console.log("Error while opening model: " + e.message);
+ }
+ check_method_exists(model, "setValue");
+ model.close();
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2021 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:
+ Chen Chen <chen89.chen@samsung.com>
+
+-->
+<html>
+<head>
+<title>SingleShot_setValue_misarg</title>
+<meta charset="utf-8"/>
+<script src="support/unitcommon.js"></script>
+<script src="support/mlsinglecommon.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+//==== TEST: SingleShot_setValue_misarg
+//==== LABEL Check if SingleShot:setValue () throws exception when argument is missing
+//==== SPEC Tizen Web API:TBD:MLSingleShot:SingleShot:setValue M
+//==== SPEC_URL TBD
+//==== PRIORITY P2
+//==== TEST_CRITERIA MMA
+test(function () {
+ add_result_callback(function () {
+ try {
+ model.close();
+ } catch (err) {
+ // do nothing in case dispose throw an exception
+ }
+ });
+ var model, key;
+ model = tizen.ml.single.openModel(TENSORFLOW_LITE_MODEL_PATH);
+
+ assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
+ model.setValue();
+ }, "no argument is given.");
+
+}, document.title);
+
+</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+/*\r
+\r
+Copyright (c) 2014 Samsung Electronics Co., Ltd.\r
+\r
+Licensed under the Apache License, Version 2.0 (the License);\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+limitations under the License.\r
+\r
+Authors:\r
+ Chen Chen <chen89.chen@samsung.com>\r
+\r
+ */\r
+\r
+var TENSORFLOW_LITE_MODEL_PATH = "/opt/usr/home/owner/share/Downloads/mobilenet_v1_1.0_224_quant.tflite";\r
+var TENSORFLOW_LITE_DYNAMICMODE_PATH = "/opt/usr/home/owner/share/Downloads/add.tflite";\r
+\r
+\r
+\r
+\r
+\r
--- /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'};
+NOT_SUPPORTED_EXCEPTION = {name: 'NotSupportedError'};
+
+
+(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],
+ [0, exceptionName],
+ [true, exceptionName],
+ ["dummyInvalidEnumValue", exceptionName],
+ [{ }, exceptionName]
+ ];
+ if (!isOptional) {
+ conversionTable.push([null, 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;
+ case "long":
+ conversionTable = [
+ [true, exceptionName],
+ [false, exceptionName],
+ [NaN, exceptionName],
+ [[], exceptionName],
+ [{ }, exceptionName],
+ [function () { }, 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;
+ case 'double':
+ assert_equals(typeof (obj), 'number', description);
+ 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 different.");
+ 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;
+}
--- /dev/null
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Intel Corporation.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of works must retain the original copyright notice, this
+# list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the original copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Intel Corporation nor the names of its contributors
+# may be used to endorse or promote products derived from this work without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
+# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors:
+# Fan, Yugang <yugang.fan@intel.com>
+
+import os
+import shutil
+import glob
+import time
+import sys
+import stat
+import random
+import json
+import logging
+import zipfile
+import signal
+import subprocess
+from optparse import OptionParser
+
+reload(sys)
+sys.setdefaultencoding('utf8')
+
+TOOL_VERSION = "v0.1"
+VERSION_FILE = "VERSION"
+DEFAULT_CMD_TIMEOUT = 600
+PKG_TYPES = ["apk", "xpk", "wgt", "apk-aio", "cordova-aio", "cordova", "embeddingapi"]
+PKG_MODES = ["shared", "embedded"]
+PKG_ARCHS = ["x86", "arm"]
+PKG_BLACK_LIST = []
+PKG_NAME = None
+BUILD_PARAMETERS = None
+BUILD_ROOT = None
+BUILD_ROOT_SRC = None
+BUILD_ROOT_SRC_PKG = None
+BUILD_ROOT_SRC_PKG_APP = None
+BUILD_ROOT_SRC_SUB_APP = None
+BUILD_ROOT_PKG = None
+BUILD_ROOT_PKG_APP = None
+LOG = None
+LOG_LEVEL = logging.DEBUG
+
+
+class ColorFormatter(logging.Formatter):
+
+ def __init__(self, msg):
+ logging.Formatter.__init__(self, msg)
+
+ def format(self, record):
+ red, green, yellow, blue = range(4)
+ colors = {'INFO': green, 'DEBUG': blue,
+ 'WARNING': yellow, 'ERROR': red}
+ msg = record.msg
+ if msg[0] == "+":
+ msg = "\33[01m" + msg[1:] + "\033[0m"
+ elif msg[0] == "=":
+ msg = "\33[07m" + msg + "\033[0m"
+ levelname = record.levelname
+ if levelname in colors:
+ msg_color = "\033[0;%dm" % (
+ 31 + colors[levelname]) + msg + "\033[0m"
+ record.msg = msg_color
+
+ return logging.Formatter.format(self, record)
+
+
+def pidExists(pid):
+ if pid < 0:
+ return False
+ try:
+ os.kill(pid, 0)
+ except OSError:
+ return False
+ else:
+ return True
+
+
+def isWindows():
+ return sys.platform == "cygwin" or sys.platform.startswith("win")
+
+
+def killProcesses(ppid=None):
+ if isWindows():
+ subprocess.check_call("TASKKILL /F /PID %s /T" % ppid)
+ else:
+ ppid = str(ppid)
+ pidgrp = []
+
+ def GetChildPids(ppid):
+ command = "ps -ef | awk '{if ($3 ==%s) print $2;}'" % str(ppid)
+ pids = os.popen(command).read()
+ pids = pids.split()
+ return pids
+
+ pidgrp.extend(GetChildPids(ppid))
+ for pid in pidgrp:
+ pidgrp.extend(GetChildPids(pid))
+
+ pidgrp.insert(0, ppid)
+ while len(pidgrp) > 0:
+ pid = pidgrp.pop()
+ try:
+ os.kill(int(pid), signal.SIGKILL)
+ return True
+ except OSError:
+ try:
+ os.popen("kill -9 %d" % int(pid))
+ return True
+ except Exception:
+ return False
+
+
+def safelyGetValue(origin_json=None, key=None):
+ if origin_json and key and key in origin_json:
+ return origin_json[key]
+ return None
+
+
+def checkContains(origin_str=None, key_str=None):
+ if origin_str.upper().find(key_str.upper()) >= 0:
+ return True
+ return False
+
+
+def getRandomStr():
+ str_pool = list("abcdefghijklmnopqrstuvwxyz1234567890")
+ random_str = ""
+ for i in range(15):
+ index = random.randint(0, len(str_pool) - 1)
+ random_str = random_str + str_pool[index]
+
+ return random_str
+
+
+def zipDir(dir_path, zip_file):
+ try:
+ if os.path.exists(zip_file):
+ if not doRemove([zip_file]):
+ return False
+ if not os.path.exists(os.path.dirname(zip_file)):
+ os.makedirs(os.path.dirname(zip_file))
+ z_file = zipfile.ZipFile(zip_file, "w")
+ orig_dir = os.getcwd()
+ os.chdir(dir_path)
+ for root, dirs, files in os.walk("."):
+ for i_file in files:
+ LOG.info("zip %s" % os.path.join(root, i_file))
+ z_file.write(os.path.join(root, i_file))
+ z_file.close()
+ os.chdir(orig_dir)
+ except Exception as e:
+ LOG.error("Fail to pack %s to %s: %s" % (dir_path, zip_file, e))
+ return False
+ LOG.info("Done to zip %s to %s" % (dir_path, zip_file))
+ return True
+
+
+def overwriteCopy(src, dest, symlinks=False, ignore=None):
+ if not os.path.exists(dest):
+ os.makedirs(dest)
+ shutil.copystat(src, dest)
+ sub_list = os.listdir(src)
+ if ignore:
+ excl = ignore(src, sub_list)
+ sub_list = [x for x in sub_list if x not in excl]
+ for i_sub in sub_list:
+ s_path = os.path.join(src, i_sub)
+ d_path = os.path.join(dest, i_sub)
+ if symlinks and os.path.islink(s_path):
+ if os.path.lexists(d_path):
+ os.remove(d_path)
+ os.symlink(os.readlink(s_path), d_path)
+ try:
+ s_path_s = os.lstat(s_path)
+ s_path_mode = stat.S_IMODE(s_path_s.st_mode)
+ os.lchmod(d_path, s_path_mode)
+ except Exception:
+ pass
+ elif os.path.isdir(s_path):
+ overwriteCopy(s_path, d_path, symlinks, ignore)
+ else:
+ shutil.copy2(s_path, d_path)
+
+
+def doCopy(src_item=None, dest_item=None):
+ LOG.info("Copying %s to %s" % (src_item, dest_item))
+ try:
+ if os.path.isdir(src_item):
+ overwriteCopy(src_item, dest_item, symlinks=True)
+ else:
+ if not os.path.exists(os.path.dirname(dest_item)):
+ LOG.info("Create non-existent dir: %s" %
+ os.path.dirname(dest_item))
+ os.makedirs(os.path.dirname(dest_item))
+ shutil.copy2(src_item, dest_item)
+ except Exception as e:
+ LOG.error("Fail to copy file %s: %s" % (src_item, e))
+ return False
+
+ return True
+
+
+def doRemove(target_file_list=None):
+ for i_file in target_file_list:
+ LOG.info("Removing %s" % i_file)
+ try:
+ if os.path.isdir(i_file):
+ shutil.rmtree(i_file)
+ else:
+ os.remove(i_file)
+ except Exception as e:
+ LOG.error("Fail to remove file %s: %s" % (i_file, e))
+ return False
+ return True
+
+
+def updateCopylistPrefix(src_default, dest_default, src_sub, dest_sub):
+ src_new = ""
+ dest_new = ""
+ PACK_TOOL_TAG = "PACK-TOOL-ROOT"
+
+ if src_sub[0:len(PACK_TOOL_TAG)] == PACK_TOOL_TAG:
+ src_new = src_sub.replace(PACK_TOOL_TAG, BUILD_PARAMETERS.pkgpacktools)
+ else:
+ src_new = os.path.join(src_default, src_sub)
+
+ if dest_sub[0:len(PACK_TOOL_TAG)] == PACK_TOOL_TAG:
+ dest_new = dest_sub.replace(PACK_TOOL_TAG, BUILD_ROOT)
+ else:
+ dest_new = os.path.join(dest_default, dest_sub)
+
+ return (src_new, dest_new)
+
+
+def buildSRC(src=None, dest=None, build_json=None):
+ if not os.path.exists(src):
+ LOG.info("+Src dir does not exist, skip build src process ...")
+ return True
+ if not doCopy(src, dest):
+ return False
+ if "blacklist" in build_json:
+ if build_json["blacklist"].count("") > 0:
+ build_json["blacklist"].remove("")
+ black_file_list = []
+ for i_black in build_json["blacklist"]:
+ black_file_list = black_file_list + \
+ glob.glob(os.path.join(dest, i_black))
+
+ black_file_list = list(set(black_file_list))
+ if not doRemove(black_file_list):
+ return False
+
+ if "copylist" in build_json:
+ for i_s_key in build_json["copylist"].keys():
+ if i_s_key and build_json["copylist"][i_s_key]:
+ (src_updated, dest_updated) = updateCopylistPrefix(
+ src, dest, i_s_key, build_json["copylist"][i_s_key])
+ if not doCopy(src_updated, dest_updated):
+ return False
+
+ return True
+
+
+def exitHandler(return_code=1):
+ LOG.info("+Cleaning build root folder ...")
+ if not BUILD_PARAMETERS.bnotclean and os.path.exists(BUILD_ROOT):
+ if not doRemove([BUILD_ROOT]):
+ LOG.error("Fail to clean build root, exit ...")
+ sys.exit(1)
+
+ if return_code == 0:
+ LOG.info("================ DONE ================")
+ else:
+ LOG.error(
+ "================ Found Something Wrong !!! ================")
+ sys.exit(return_code)
+
+
+def prepareBuildRoot():
+ LOG.info("+Preparing build root folder ...")
+ global BUILD_ROOT
+ global BUILD_ROOT_SRC
+ global BUILD_ROOT_SRC_PKG
+ global BUILD_ROOT_SRC_PKG_APP
+ global BUILD_ROOT_SRC_SUB_APP
+ global BUILD_ROOT_PKG
+ global BUILD_ROOT_PKG_APP
+
+ while True:
+ BUILD_ROOT = os.path.join("/tmp", getRandomStr())
+ if os.path.exists(BUILD_ROOT):
+ continue
+ else:
+ break
+
+ BUILD_ROOT_SRC = os.path.join(BUILD_ROOT, PKG_NAME)
+ BUILD_ROOT_SRC_PKG = os.path.join(BUILD_ROOT, "pkg")
+ BUILD_ROOT_SRC_PKG_APP = os.path.join(BUILD_ROOT, "pkg-app")
+ BUILD_ROOT_SRC_SUB_APP = os.path.join(BUILD_ROOT, "sub-app")
+ BUILD_ROOT_PKG = os.path.join(BUILD_ROOT, "pkg", "opt", PKG_NAME)
+ BUILD_ROOT_PKG_APP = os.path.join(BUILD_ROOT, "pkg-app", "opt", PKG_NAME)
+
+ if not doCopy(BUILD_PARAMETERS.srcdir, BUILD_ROOT_SRC):
+ return False
+ if not doRemove(
+ glob.glob(os.path.join(BUILD_ROOT_SRC, "%s*.zip" % PKG_NAME))):
+ return False
+
+ return True
+
+
+def doCMD(cmd, time_out=DEFAULT_CMD_TIMEOUT, no_check_return=False):
+ LOG.info("Doing CMD: [ %s ]" % cmd)
+ pre_time = time.time()
+ cmd_proc = subprocess.Popen(args=cmd, shell=True)
+ while True:
+ cmd_exit_code = cmd_proc.poll()
+ elapsed_time = time.time() - pre_time
+ if cmd_exit_code is None:
+ if elapsed_time >= time_out:
+ killProcesses(ppid=cmd_proc.pid)
+ LOG.error("Timeout to exe CMD")
+ return False
+ else:
+ if not no_check_return and cmd_exit_code != 0:
+ LOG.error("Fail to exe CMD")
+ return False
+ break
+ time.sleep(2)
+ return True
+
+
+def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
+ LOG.info("Doing CMD: [ %s ]" % cmd)
+ pre_time = time.time()
+ output = []
+ cmd_return_code = 1
+ cmd_proc = subprocess.Popen(
+ cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
+
+ while True:
+ output_line = cmd_proc.stdout.readline().strip("\r\n")
+ cmd_return_code = cmd_proc.poll()
+ elapsed_time = time.time() - pre_time
+ if cmd_return_code is None:
+ if elapsed_time >= time_out:
+ killProcesses(ppid=cmd_proc.pid)
+ LOG.error("Timeout to exe CMD")
+ return False
+ elif output_line == '' and cmd_return_code is not None:
+ break
+
+ sys.stdout.write("%s\n" % output_line)
+ sys.stdout.flush()
+ output.append(output_line)
+ if cmd_return_code != 0:
+ LOG.error("Fail to exe CMD")
+
+ return (cmd_return_code, output)
+
+
+def packXPK(build_json=None, app_src=None, app_dest=None, app_name=None):
+ pack_tool = os.path.join(BUILD_ROOT, "make_xpk.py")
+ if not os.path.exists(pack_tool):
+ if not doCopy(
+ os.path.join(BUILD_PARAMETERS.pkgpacktools, "make_xpk.py"),
+ pack_tool):
+ return False
+ orig_dir = os.getcwd()
+ os.chdir(BUILD_ROOT)
+ if os.path.exists("key.file"):
+ if not doRemove(["key.file"]):
+ os.chdir(orig_dir)
+ return False
+
+ key_file = safelyGetValue(build_json, "key-file")
+ if key_file == "key.file":
+ LOG.error(
+ "\"key.file\" is reserved name for default key file, "
+ "pls change the key file name ...")
+ os.chdir(orig_dir)
+ return False
+ if key_file:
+ pack_cmd = "python make_xpk.py %s %s -o %s" % (
+ app_src, key_file, os.path.join(app_dest, "%s.xpk" % app_name))
+ else:
+ pack_cmd = "python make_xpk.py %s key.file -o %s" % (
+ app_src, os.path.join(app_dest, "%s.xpk" % app_name))
+ if not doCMD(pack_cmd, DEFAULT_CMD_TIMEOUT):
+ os.chdir(orig_dir)
+ return False
+
+ os.chdir(orig_dir)
+ return True
+
+
+def packWGT(build_json=None, app_src=None, app_dest=None, app_name=None):
+ if not zipDir(app_src, os.path.join(app_dest, "%s.wgt" % app_name)):
+ return False
+
+ if BUILD_PARAMETERS.signature == True:
+ if safelyGetValue(build_json, "sign-flag") == "true":
+ if not os.path.exists(os.path.join(BUILD_ROOT, "signing")):
+ if not doCopy(
+ os.path.join(BUILD_PARAMETERS.pkgpacktools, "signing"),
+ os.path.join(BUILD_ROOT, "signing")):
+ return False
+ signing_cmd = "%s --dist platform %s" % (
+ os.path.join(BUILD_ROOT, "signing", "sign-widget.sh"),
+ os.path.join(app_dest, "%s.wgt" % app_name))
+ if not doCMD(signing_cmd, DEFAULT_CMD_TIMEOUT):
+ return False
+
+ return True
+
+
+def packAPK(build_json=None, app_src=None, app_dest=None, app_name=None):
+ app_name = app_name.replace("-", "_")
+
+ if not os.path.exists(os.path.join(BUILD_ROOT, "crosswalk")):
+ if not doCopy(
+ os.path.join(BUILD_PARAMETERS.pkgpacktools, "crosswalk"),
+ os.path.join(BUILD_ROOT, "crosswalk")):
+ return False
+
+ files = glob.glob(os.path.join(BUILD_ROOT, "crosswalk", "*.apk"))
+ if files:
+ if not doRemove(files):
+ return False
+
+ ext_opt = ""
+ cmd_opt = ""
+ url_opt = ""
+ mode_opt = ""
+ arch_opt = ""
+ icon_opt = ""
+
+ common_opts = safelyGetValue(build_json, "apk-common-opts")
+ if common_opts is None:
+ common_opts = ""
+
+ tmp_opt = safelyGetValue(build_json, "apk-ext-opt")
+ if tmp_opt:
+ ext_opt = "--extensions='%s'" % os.path.join(BUILD_ROOT_SRC, tmp_opt)
+
+ tmp_opt = safelyGetValue(build_json, "apk-cmd-opt")
+ if tmp_opt:
+ cmd_opt = "--xwalk-command-line='%s'" % tmp_opt
+
+ tmp_opt = safelyGetValue(build_json, "apk-url-opt")
+ if tmp_opt:
+ url_opt = "--app-url='%s'" % tmp_opt
+
+ tmp_opt = safelyGetValue(build_json, "apk-mode-opt")
+ if tmp_opt:
+ if tmp_opt in PKG_MODES:
+ mode_opt = "--mode=%s" % tmp_opt
+ else:
+ LOG.error("Got wrong app mode: %s" % tmp_opt)
+ return False
+ else:
+ mode_opt = "--mode=%s" % BUILD_PARAMETERS.pkgmode
+
+ tmp_opt = safelyGetValue(build_json, "apk-arch-opt")
+ if tmp_opt:
+ if tmp_opt in PKG_ARCHS:
+ arch_opt = "--arch=%s" % tmp_opt
+ else:
+ LOG.error("Got wrong app arch: %s" % tmp_opt)
+ return False
+ else:
+ arch_opt = "--arch=%s" % BUILD_PARAMETERS.pkgarch
+
+ tmp_opt = safelyGetValue(build_json, "apk-icon-opt")
+ if tmp_opt:
+ icon_opt = "--icon=%s" % tmp_opt
+ elif tmp_opt == "":
+ icon_opt = ""
+ else:
+ icon_opt = "--icon=%s/icon.png" % app_src
+
+ if safelyGetValue(build_json, "apk-type") == "MANIFEST":
+ pack_cmd = "python make_apk.py --package=org.xwalk.%s " \
+ "--manifest=%s/manifest.json %s %s %s %s %s" % (
+ app_name, app_src, mode_opt, arch_opt,
+ ext_opt, cmd_opt, common_opts)
+ elif safelyGetValue(build_json, "apk-type") == "HOSTEDAPP":
+ if not url_opt:
+ LOG.error(
+ "Fail to find the key \"apk-url-opt\" for hosted APP packing")
+ return False
+ pack_cmd = "python make_apk.py --package=org.xwalk.%s --name=%s %s " \
+ "%s %s %s %s %s" % (
+ app_name, app_name, mode_opt, arch_opt, ext_opt,
+ cmd_opt, url_opt, common_opts)
+ else:
+ pack_cmd = "python make_apk.py --package=org.xwalk.%s --name=%s " \
+ "--app-root=%s --app-local-path=index.html %s %s " \
+ "%s %s %s %s" % (
+ app_name, app_name, app_src, icon_opt, mode_opt,
+ arch_opt, ext_opt, cmd_opt, common_opts)
+
+ orig_dir = os.getcwd()
+ os.chdir(os.path.join(BUILD_ROOT, "crosswalk"))
+ if not doCMD(pack_cmd, DEFAULT_CMD_TIMEOUT):
+ os.chdir(orig_dir)
+ return False
+
+ files = glob.glob(os.path.join(BUILD_ROOT, "crosswalk", "*.apk"))
+ if files:
+ if not doCopy(files[0], os.path.join(app_dest, "%s.apk" % app_name)):
+ os.chdir(orig_dir)
+ return False
+ else:
+ LOG.error("Fail to find the apk file")
+ os.chdir(orig_dir)
+ return False
+
+ os.chdir(orig_dir)
+ return True
+
+
+def packCordova(build_json=None, app_src=None, app_dest=None, app_name=None):
+ pack_tool = os.path.join(BUILD_ROOT, "cordova")
+ app_name = app_name.replace("-", "_")
+ if not os.path.exists(pack_tool):
+ if not doCopy(
+ os.path.join(BUILD_PARAMETERS.pkgpacktools, "cordova"),
+ pack_tool):
+ return False
+
+ plugin_tool = os.path.join(BUILD_ROOT, "cordova_plugins")
+ if not os.path.exists(plugin_tool):
+ if not doCopy(
+ os.path.join(BUILD_PARAMETERS.pkgpacktools, "cordova_plugins"),
+ plugin_tool):
+ return False
+
+ orig_dir = os.getcwd()
+ os.chdir(pack_tool)
+ pack_cmd = "bin/create %s org.xwalk.%s %s" % (
+ app_name, app_name, app_name)
+ if not doCMD(pack_cmd, DEFAULT_CMD_TIMEOUT):
+ os.chdir(orig_dir)
+ return False
+
+ os.chdir(os.path.join(pack_tool, app_name))
+ plugin_dirs = os.listdir(plugin_tool)
+ for i_dir in plugin_dirs:
+ i_plugin_dir = os.path.join(plugin_tool, i_dir)
+ plugin_install_cmd = "plugman install --platform android --project " \
+ "./ --plugin %s" % i_plugin_dir
+ if not doCMD(plugin_install_cmd, DEFAULT_CMD_TIMEOUT):
+ os.chdir(orig_dir)
+ return False
+ os.chdir(pack_tool)
+
+ if not doCopy(app_src, os.path.join(pack_tool, app_name, "assets", "www")):
+ os.chdir(orig_dir)
+ return False
+ os.chdir(os.path.join(BUILD_ROOT, "cordova", app_name))
+ pack_cmd = "./cordova/build"
+ if not doCMD(pack_cmd, DEFAULT_CMD_TIMEOUT):
+ os.chdir(orig_dir)
+ return False
+
+ if not doCopy(os.path.join(
+ BUILD_ROOT, "cordova", app_name, "bin", "%s-debug.apk" %
+ app_name),
+ os.path.join(app_dest, "%s.apk" % app_name)):
+ os.chdir(orig_dir)
+ return False
+ os.chdir(orig_dir)
+ return True
+
+
+def packEmbeddingAPI(
+ build_json=None, app_src=None, app_dest=None, app_name=None):
+ app_name = app_name.replace("-", "_")
+
+ library_dir_name = safelyGetValue(build_json, "embeddingapi-library-name")
+ if not library_dir_name:
+ LOG.error("Fail to get embeddingapi-library-name ...")
+ return False
+
+ new_library_dir_name = "core_library"
+ pack_tool = os.path.join(app_src, "..", new_library_dir_name)
+
+ if os.path.exists(pack_tool):
+ if not doRemove([pack_tool]):
+ return False
+
+ if not doCopy(
+ os.path.join(BUILD_PARAMETERS.pkgpacktools, library_dir_name),
+ pack_tool):
+ return False
+
+ if os.path.exists(os.path.join(pack_tool, "bin", "res", "crunch")):
+ if not doRemove([os.path.join(pack_tool, "bin", "res", "crunch")]):
+ return False
+
+ orig_dir = os.getcwd()
+ android_project_path = os.path.join(app_src, "android-project")
+ try:
+ os.makedirs(android_project_path)
+ except Exception as e:
+ LOG.error("Fail to create tmp project dir: %s" % e)
+ return False
+
+ (return_code, output) = doCMDWithOutput("android list target")
+ api_level = ""
+ for line in output:
+ if "API level" in line:
+ api_level = line.split(":")[1].strip()
+ break
+ if not api_level:
+ LOG.error("Fail to get Android API Level")
+ os.chdir(orig_dir)
+ return False
+
+ android_project_cmd = "android create project --name %s --target " \
+ "android-%s --path %s --package com.%s " \
+ "--activity MainActivity" % (
+ app_name, api_level, android_project_path, app_name)
+ if not doCMD(android_project_cmd):
+ os.chdir(orig_dir)
+ return False
+
+ try:
+ update_file = open(
+ os.path.join(android_project_path, "project.properties"), "a+")
+ update_file.writelines(
+ "{0}\n".format(
+ "android.library.reference.1=../%s" %
+ new_library_dir_name))
+ update_file.close()
+ except Exception as e:
+ LOG.error(
+ "Fail to update %s: %s" %
+ (os.path.join(
+ android_project_path,
+ "project.properties"),
+ e))
+ os.chdir(orig_dir)
+ return False
+
+ if not doCopy(os.path.join(android_project_path, "build.xml"),
+ os.path.join(app_src, "build.xml")):
+ os.chdir(orig_dir)
+ return False
+
+ if not doCopy(
+ os.path.join(android_project_path, "project.properties"),
+ os.path.join(app_src, "project.properties")):
+ os.chdir(orig_dir)
+ return False
+
+ if not doCopy(
+ os.path.join(android_project_path, "local.properties"),
+ os.path.join(app_src, "local.properties")):
+ os.chdir(orig_dir)
+ return False
+
+ if not doCopy(
+ os.path.join(android_project_path, "local.properties"),
+ os.path.join(pack_tool, "local.properties")):
+ os.chdir(orig_dir)
+ return False
+
+ os.chdir(app_src)
+ if not doCMD("ant debug"):
+ os.chdir(orig_dir)
+ return False
+
+ if not doCopy(
+ os.path.join(app_src, "bin", "%s-debug.apk" % app_name),
+ os.path.join(app_dest, "%s.apk" % app_name)):
+ os.chdir(orig_dir)
+ return False
+ os.chdir(orig_dir)
+ return True
+
+
+def packAPP(build_json=None, app_src=None, app_dest=None, app_name=None):
+ LOG.info("Packing %s(%s)" % (app_name, app_src))
+ if not os.path.exists(app_dest):
+ try:
+ os.makedirs(app_dest)
+ except Exception as e:
+ LOG.error("Fail to init package install dest dir: %s" % e)
+ return False
+
+ if checkContains(BUILD_PARAMETERS.pkgtype, "XPK"):
+ if not packXPK(build_json, app_src, app_dest, app_name):
+ return False
+ elif checkContains(BUILD_PARAMETERS.pkgtype, "WGT"):
+ if not packWGT(build_json, app_src, app_dest, app_name):
+ return False
+ elif checkContains(BUILD_PARAMETERS.pkgtype, "APK"):
+ if not packAPK(build_json, app_src, app_dest, app_name):
+ return False
+ elif checkContains(BUILD_PARAMETERS.pkgtype, "CORDOVA"):
+ if not packCordova(build_json, app_src, app_dest, app_name):
+ return False
+ elif checkContains(BUILD_PARAMETERS.pkgtype, "EMBEDDINGAPI"):
+ if not packEmbeddingAPI(build_json, app_src, app_dest, app_name):
+ return False
+ else:
+ LOG.error("Got wrong pkg type: %s" % BUILD_PARAMETERS.pkgtype)
+ return False
+
+ LOG.info("Success to pack APP: %s" % app_name)
+ return True
+
+
+def createIndexFile(index_file_path=None, hosted_app=None):
+ try:
+ if hosted_app:
+ index_url = "http://127.0.0.1/opt/%s/webrunner/index.html?" \
+ "testsuite=../tests.xml&testprefix=../../.." % PKG_NAME
+ else:
+ index_url = "opt/%s/webrunner/index.html?testsuite=../tests.xml" \
+ "&testprefix=../../.." % PKG_NAME
+ html_content = "<!doctype html><head><meta http-equiv='Refresh' " \
+ "content='1; url=%s'></head>" % index_url
+ index_file = open(index_file_path, "w")
+ index_file.write(html_content)
+ index_file.close()
+ except Exception as e:
+ LOG.error("Fail to create index.html for top-app: %s" % e)
+ return False
+ LOG.info("Success to create index file %s" % index_file_path)
+ return True
+
+
+def buildSubAPP(app_dir=None, build_json=None, app_dest_default=None):
+ app_dir_inside = safelyGetValue(build_json, "app-dir")
+ if app_dir_inside:
+ app_dir = app_dir_inside
+ LOG.info("+Building sub APP(s) from %s ..." % app_dir)
+ app_dir = os.path.join(BUILD_ROOT_SRC, app_dir)
+ app_name = safelyGetValue(build_json, "app-name")
+ if not app_name:
+ app_name = os.path.basename(app_dir)
+
+ app_src = os.path.join(BUILD_ROOT_SRC_SUB_APP, app_name)
+ if buildSRC(app_dir, app_src, build_json):
+ app_dest = safelyGetValue(build_json, "install-path")
+ if app_dest:
+ app_dest = os.path.join(app_dest_default, app_dest)
+ else:
+ app_dest = app_dest_default
+
+ if safelyGetValue(build_json, "all-apps") == "true":
+ app_dirs = os.listdir(app_src)
+ apps_num = 0
+ for i_app_dir in app_dirs:
+ if os.path.isdir(os.path.join(app_src, i_app_dir)):
+ i_app_name = os.path.basename(i_app_dir)
+ if not packAPP(
+ build_json, os.path.join(app_src, i_app_name),
+ app_dest, i_app_name):
+ return False
+ else:
+ apps_num = apps_num + 1
+ if apps_num > 0:
+ LOG.info("Totally packed %d apps in %s" % (apps_num, app_dir))
+ return True
+ else:
+ return packAPP(build_json, app_src, app_dest, app_name)
+ return False
+
+
+def buildPKGAPP(build_json=None):
+ LOG.info("+Building package APP ...")
+ if not doCopy(os.path.join(BUILD_ROOT_SRC, "icon.png"),
+ os.path.join(BUILD_ROOT_SRC_PKG_APP, "icon.png")):
+ return False
+
+ if checkContains(BUILD_PARAMETERS.pkgtype, "XPK"):
+ if not doCopy(
+ os.path.join(BUILD_ROOT_SRC, "manifest.json"),
+ os.path.join(BUILD_ROOT_SRC_PKG_APP, "manifest.json")):
+ return False
+ elif checkContains(BUILD_PARAMETERS.pkgtype, "WGT"):
+ if not doCopy(os.path.join(BUILD_ROOT_SRC, "config.xml"),
+ os.path.join(BUILD_ROOT_SRC_PKG_APP, "config.xml")):
+ return False
+
+ hosted_app = False
+ if safelyGetValue(build_json, "hosted-app") == "true":
+ hosted_app = True
+ if not createIndexFile(
+ os.path.join(BUILD_ROOT_SRC_PKG_APP, "index.html"), hosted_app):
+ return False
+
+ if not hosted_app:
+ if "blacklist" not in build_json:
+ build_json.update({"blacklist": []})
+ build_json["blacklist"].extend(PKG_BLACK_LIST)
+ if not buildSRC(BUILD_ROOT_SRC, BUILD_ROOT_PKG_APP, build_json):
+ return False
+
+ if "subapp-list" in build_json:
+ for i_sub_app in build_json["subapp-list"].keys():
+ if not buildSubAPP(
+ i_sub_app, build_json["subapp-list"][i_sub_app],
+ BUILD_ROOT_PKG_APP):
+ return False
+
+ if not packAPP(
+ build_json, BUILD_ROOT_SRC_PKG_APP, BUILD_ROOT_PKG, PKG_NAME):
+ return False
+
+ return True
+
+
+def buildPKG(build_json=None):
+ if "blacklist" not in build_json:
+ build_json.update({"blacklist": []})
+ build_json["blacklist"].extend(PKG_BLACK_LIST)
+ if not buildSRC(BUILD_ROOT_SRC, BUILD_ROOT_PKG, build_json):
+ return False
+
+ if "subapp-list" in build_json:
+ for i_sub_app in build_json["subapp-list"].keys():
+ if not buildSubAPP(
+ i_sub_app, build_json["subapp-list"][i_sub_app],
+ BUILD_ROOT_PKG):
+ return False
+
+ if "pkg-app" in build_json:
+ if not buildPKGAPP(build_json["pkg-app"]):
+ return False
+
+ return True
+
+
+def main():
+ global LOG
+ LOG = logging.getLogger("pack-tool")
+ LOG.setLevel(LOG_LEVEL)
+ stream_handler = logging.StreamHandler()
+ stream_handler.setLevel(LOG_LEVEL)
+ stream_formatter = ColorFormatter("[%(asctime)s] %(message)s")
+ stream_handler.setFormatter(stream_formatter)
+ LOG.addHandler(stream_handler)
+
+ try:
+ usage = "Usage: ./pack.py -t apk -m shared -a x86"
+ opts_parser = OptionParser(usage=usage)
+ opts_parser.add_option(
+ "-c",
+ "--cfg",
+ dest="pkgcfg",
+ help="specify the path of config json file")
+ opts_parser.add_option(
+ "-t",
+ "--type",
+ dest="pkgtype",
+ help="specify the pkg type, e.g. apk, xpk, wgt ...")
+ opts_parser.add_option(
+ "-m",
+ "--mode",
+ dest="pkgmode",
+ help="specify the apk mode, e.g. shared, embedded")
+ opts_parser.add_option(
+ "-a",
+ "--arch",
+ dest="pkgarch",
+ help="specify the apk arch, e.g. x86, arm")
+ opts_parser.add_option(
+ "-d",
+ "--dest",
+ dest="destdir",
+ help="specify the installation folder for packed package")
+ opts_parser.add_option(
+ "-s",
+ "--src",
+ dest="srcdir",
+ help="specify the path of pkg resource for packing")
+ opts_parser.add_option(
+ "--tools",
+ dest="pkgpacktools",
+ help="specify the parent folder of pack tools")
+ opts_parser.add_option(
+ "--notclean",
+ dest="bnotclean",
+ action="store_true",
+ help="disable the build root clean after the packing")
+ opts_parser.add_option(
+ "--sign",
+ dest="signature",
+ action="store_true",
+ help="signature operation will be done when packing wgt")
+ opts_parser.add_option(
+ "-v",
+ "--version",
+ dest="bversion",
+ action="store_true",
+ help="show this tool's version")
+ opts_parser.add_option(
+ "--pkg-version",
+ dest="pkgversion",
+ help="specify the pkg version, e.g. 0.0.0.1")
+
+ if len(sys.argv) == 1:
+ sys.argv.append("-h")
+
+ global BUILD_PARAMETERS
+ (BUILD_PARAMETERS, args) = opts_parser.parse_args()
+ except Exception as e:
+ LOG.error("Got wrong options: %s, exit ..." % e)
+ sys.exit(1)
+
+ if BUILD_PARAMETERS.bversion:
+ print "Version: %s" % TOOL_VERSION
+ sys.exit(0)
+
+ if not BUILD_PARAMETERS.srcdir:
+ BUILD_PARAMETERS.srcdir = os.getcwd()
+ BUILD_PARAMETERS.srcdir = os.path.expanduser(BUILD_PARAMETERS.srcdir)
+
+ if not os.path.exists(
+ os.path.join(BUILD_PARAMETERS.srcdir, "..", "..", VERSION_FILE)):
+ if not os.path.exists(
+ os.path.join(BUILD_PARAMETERS.srcdir, "..", VERSION_FILE)):
+ if not os.path.exists(
+ os.path.join(BUILD_PARAMETERS.srcdir, VERSION_FILE)):
+ LOG.info(
+ "Not found pkg version file, try to use option --pkg-version")
+ pkg_version_file_path = None
+ else:
+ pkg_version_file_path = os.path.join(
+ BUILD_PARAMETERS.srcdir, VERSION_FILE)
+ else:
+ pkg_version_file_path = os.path.join(
+ BUILD_PARAMETERS.srcdir, "..", VERSION_FILE)
+ else:
+ pkg_version_file_path = os.path.join(
+ BUILD_PARAMETERS.srcdir, "..", "..", VERSION_FILE)
+
+ try:
+ pkg_main_version = 0
+ pkg_release_version = 0
+ if BUILD_PARAMETERS.pkgversion:
+ LOG.info("Using %s as pkg version " % BUILD_PARAMETERS.pkgversion)
+ pkg_main_version = BUILD_PARAMETERS.pkgversion
+ else:
+ if pkg_version_file_path is not None:
+ LOG.info("Using pkg version file: %s" % pkg_version_file_path)
+ with open(pkg_version_file_path, "rt") as pkg_version_file:
+ pkg_version_raw = pkg_version_file.read()
+ pkg_version_file.close()
+ pkg_version_json = json.loads(pkg_version_raw)
+ pkg_main_version = pkg_version_json["main-version"]
+ pkg_release_version = pkg_version_json["release-version"]
+ except Exception as e:
+ LOG.error("Fail to read pkg version file: %s, exit ..." % e)
+ sys.exit(1)
+
+ if not BUILD_PARAMETERS.pkgtype:
+ LOG.error("No pkg type provided, exit ...")
+ sys.exit(1)
+ elif not BUILD_PARAMETERS.pkgtype in PKG_TYPES:
+ LOG.error("Wrong pkg type, only support: %s, exit ..." %
+ PKG_TYPES)
+ sys.exit(1)
+
+ if BUILD_PARAMETERS.pkgtype == "apk" or \
+ BUILD_PARAMETERS.pkgtype == "apk-aio":
+ if not BUILD_PARAMETERS.pkgmode:
+ LOG.error("No pkg mode option provided, exit ...")
+ sys.exit(1)
+ elif not BUILD_PARAMETERS.pkgmode in PKG_MODES:
+ LOG.error(
+ "Wrong pkg mode option provided, only support:%s, exit ..." %
+ PKG_MODES)
+ sys.exit(1)
+
+ if not BUILD_PARAMETERS.pkgarch:
+ LOG.error("No pkg arch option provided, exit ...")
+ sys.exit(1)
+ elif not BUILD_PARAMETERS.pkgarch in PKG_ARCHS:
+ LOG.error(
+ "Wrong pkg arch option provided, only support:%s, exit ..." %
+ PKG_ARCHS)
+ sys.exit(1)
+
+ if BUILD_PARAMETERS.pkgtype == "apk-aio" or \
+ BUILD_PARAMETERS.pkgtype == "cordova-aio":
+ if not BUILD_PARAMETERS.destdir or not os.path.exists(
+ BUILD_PARAMETERS.destdir):
+ LOG.error("No all-in-one installation dest dir found, exit ...")
+ sys.exit(1)
+
+ elif not BUILD_PARAMETERS.destdir:
+ BUILD_PARAMETERS.destdir = BUILD_PARAMETERS.srcdir
+ BUILD_PARAMETERS.destdir = os.path.expanduser(BUILD_PARAMETERS.destdir)
+
+ if not BUILD_PARAMETERS.pkgpacktools:
+ BUILD_PARAMETERS.pkgpacktools = os.path.join(
+ BUILD_PARAMETERS.srcdir, "..", "..", "..", "tools")
+ BUILD_PARAMETERS.pkgpacktools = os.path.expanduser(
+ BUILD_PARAMETERS.pkgpacktools)
+
+ config_json = None
+ if BUILD_PARAMETERS.pkgcfg:
+ config_json_file_path = BUILD_PARAMETERS.pkgcfg
+ else:
+ config_json_file_path = os.path.join(
+ BUILD_PARAMETERS.srcdir, "suite.json")
+ try:
+ LOG.info("Using config json file: %s" % config_json_file_path)
+ with open(config_json_file_path, "rt") as config_json_file:
+ config_raw = config_json_file.read()
+ config_json_file.close()
+ config_json = json.loads(config_raw)
+ except Exception as e:
+ LOG.error("Fail to read config json file: %s, exit ..." % e)
+ sys.exit(1)
+
+ global PKG_NAME
+ PKG_NAME = safelyGetValue(config_json, "pkg-name")
+ if not PKG_NAME:
+ PKG_NAME = os.path.basename(BUILD_PARAMETERS.srcdir)
+ LOG.warning(
+ "Fail to read pkg name from json, "
+ "using src dir name as pkg name ...")
+
+ LOG.info("================= %s (%s-%s) ================" %
+ (PKG_NAME, pkg_main_version, pkg_release_version))
+
+ if not safelyGetValue(config_json, "pkg-list"):
+ LOG.error("Fail to read pkg-list, exit ...")
+ sys.exit(1)
+
+ pkg_json = None
+ for i_pkg in config_json["pkg-list"].keys():
+ i_pkg_list = i_pkg.replace(" ", "").split(",")
+ if BUILD_PARAMETERS.pkgtype in i_pkg_list:
+ pkg_json = config_json["pkg-list"][i_pkg]
+
+ if not pkg_json:
+ LOG.error("Fail to read pkg json, exit ...")
+ sys.exit(1)
+
+ if not prepareBuildRoot():
+ exitHandler(1)
+
+ if "pkg-blacklist" in config_json:
+ PKG_BLACK_LIST.extend(config_json["pkg-blacklist"])
+
+ if not buildPKG(pkg_json):
+ exitHandler(1)
+
+ LOG.info("+Building package ...")
+ if BUILD_PARAMETERS.pkgtype == "apk-aio" or \
+ BUILD_PARAMETERS.pkgtype == "cordova-aio":
+ pkg_file_list = os.listdir(os.path.join(BUILD_ROOT, "pkg"))
+ for i_file in pkg_file_list:
+ if not doCopy(
+ os.path.join(BUILD_ROOT, "pkg", i_file),
+ os.path.join(BUILD_PARAMETERS.destdir, i_file)):
+ exitHandler(1)
+ else:
+ pkg_file = os.path.join(
+ BUILD_PARAMETERS.destdir,
+ "%s-%s.%s.zip" %
+ (PKG_NAME,
+ pkg_main_version,
+ pkg_release_version))
+
+
+ if not zipDir(os.path.join(BUILD_ROOT, "pkg"), pkg_file):
+ exitHandler(1)
+
+if __name__ == "__main__":
+ main()
+ exitHandler(0)
--- /dev/null
+The testharness files come from
+https://github.com/w3c/testharness.js (commit 2486f01bf4c58de1c1b7cb39322af7b55c6c700b)
+without any modification.
+
+These tests are copyright by W3C and/or the author listed in the test
+file. The tests are dual-licensed under the W3C Test Suite License:
+http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
+and the BSD 3-clause License:
+http://www.w3.org/Consortium/Legal/2008/03-bsd-license
+under W3C's test suite licensing policy:
+http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright
+
--- /dev/null
+html {
+ font-family:DejaVu Sans, Bitstream Vera Sans, Arial, Sans;
+}
+
+#log .warning,
+#log .warning a {
+ color: black;
+ background: yellow;
+}
+
+#log .error,
+#log .error a {
+ color: white;
+ background: red;
+}
+
+#log pre {
+ border: 1px solid black;
+ padding: 1em;
+}
+
+section#summary {
+ margin-bottom:1em;
+}
+
+table#results {
+ border-collapse:collapse;
+ table-layout:fixed;
+ width:100%;
+}
+
+table#results th:first-child,
+table#results td:first-child {
+ width:4em;
+}
+
+table#results th:last-child,
+table#results td:last-child {
+ width:50%;
+}
+
+table#results.assertions th:last-child,
+table#results.assertions td:last-child {
+ width:35%;
+}
+
+table#results th {
+ padding:0;
+ padding-bottom:0.5em;
+ border-bottom:medium solid black;
+}
+
+table#results td {
+ padding:1em;
+ padding-bottom:0.5em;
+ border-bottom:thin solid black;
+}
+
+tr.pass > td:first-child {
+ color:green;
+}
+
+tr.fail > td:first-child {
+ color:red;
+}
+
+tr.timeout > td:first-child {
+ color:red;
+}
+
+tr.notrun > td:first-child {
+ color:blue;
+}
+
+.pass > td:first-child, .fail > td:first-child, .timeout > td:first-child, .notrun > td:first-child {
+ font-variant:small-caps;
+}
+
+table#results span {
+ display:block;
+}
+
+table#results span.expected {
+ font-family:DejaVu Sans Mono, Bitstream Vera Sans Mono, Monospace;
+ white-space:pre;
+}
+
+table#results span.actual {
+ font-family:DejaVu Sans Mono, Bitstream Vera Sans Mono, Monospace;
+ white-space:pre;
+}
+
+span.ok {
+ color:green;
+}
+
+tr.error {
+ color:red;
+}
+
+span.timeout {
+ color:red;
+}
+
+span.ok, span.timeout, span.error {
+ font-variant:small-caps;
+}
\ No newline at end of file
--- /dev/null
+/*global self*/
+/*jshint latedef: nofunc*/
+/*
+Distributed under both the W3C Test Suite License [1] and the W3C
+3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
+policies and contribution forms [3].
+
+[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
+[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
+[3] http://www.w3.org/2004/10/27-testcases
+*/
+
+/* Documentation is in docs/api.md */
+
+(function ()
+{
+ var debug = false;
+ // default timeout is 10 seconds, test can override if needed
+ var settings = {
+ output:true,
+ harness_timeout:{
+ "normal":10000,
+ "long":60000
+ },
+ test_timeout:null
+ };
+
+ var xhtml_ns = "http://www.w3.org/1999/xhtml";
+
+ /*
+ * TestEnvironment is an abstraction for the environment in which the test
+ * harness is used. Each implementation of a test environment has to provide
+ * the following interface:
+ *
+ * interface TestEnvironment {
+ * // Invoked after the global 'tests' object has been created and it's
+ * // safe to call add_*_callback() to register event handlers.
+ * void on_tests_ready();
+ *
+ * // Invoked after setup() has been called to notify the test environment
+ * // of changes to the test harness properties.
+ * void on_new_harness_properties(object properties);
+ *
+ * // Should return a new unique default test name.
+ * DOMString next_default_test_name();
+ *
+ * // Should return the test harness timeout duration in milliseconds.
+ * float test_timeout();
+ *
+ * // Should return the global scope object.
+ * object global_scope();
+ * };
+ */
+
+ /*
+ * A test environment with a DOM. The global object is 'window'. By default
+ * test results are displayed in a table. Any parent windows receive
+ * callbacks or messages via postMessage() when test events occur. See
+ * apisample11.html and apisample12.html.
+ */
+ function WindowTestEnvironment() {
+ this.name_counter = 0;
+ this.window_cache = null;
+ this.output_handler = null;
+ this.all_loaded = false;
+ var this_obj = this;
+ on_event(window, 'load', function() {
+ this_obj.all_loaded = true;
+ });
+ }
+
+ WindowTestEnvironment.prototype._dispatch = function(selector, callback_args, message_arg) {
+ this._forEach_windows(
+ function(w, is_same_origin) {
+ if (is_same_origin && selector in w) {
+ try {
+ w[selector].apply(undefined, callback_args);
+ } catch (e) {
+ if (debug) {
+ throw e;
+ }
+ }
+ }
+ if (supports_post_message(w) && w !== self) {
+ w.postMessage(message_arg, "*");
+ }
+ });
+ };
+
+ WindowTestEnvironment.prototype._forEach_windows = function(callback) {
+ // Iterate of the the windows [self ... top, opener]. The callback is passed
+ // two objects, the first one is the windows object itself, the second one
+ // is a boolean indicating whether or not its on the same origin as the
+ // current window.
+ var cache = this.window_cache;
+ if (!cache) {
+ cache = [[self, true]];
+ var w = self;
+ var i = 0;
+ var so;
+ var origins = location.ancestorOrigins;
+ while (w != w.parent) {
+ w = w.parent;
+ // In WebKit, calls to parent windows' properties that aren't on the same
+ // origin cause an error message to be displayed in the error console but
+ // don't throw an exception. This is a deviation from the current HTML5
+ // spec. See: https://bugs.webkit.org/show_bug.cgi?id=43504
+ // The problem with WebKit's behavior is that it pollutes the error console
+ // with error messages that can't be caught.
+ //
+ // This issue can be mitigated by relying on the (for now) proprietary
+ // `location.ancestorOrigins` property which returns an ordered list of
+ // the origins of enclosing windows. See:
+ // http://trac.webkit.org/changeset/113945.
+ if (origins) {
+ so = (location.origin == origins[i]);
+ } else {
+ so = is_same_origin(w);
+ }
+ cache.push([w, so]);
+ i++;
+ }
+ w = window.opener;
+ if (w) {
+ // window.opener isn't included in the `location.ancestorOrigins` prop.
+ // We'll just have to deal with a simple check and an error msg on WebKit
+ // browsers in this case.
+ cache.push([w, is_same_origin(w)]);
+ }
+ this.window_cache = cache;
+ }
+
+ forEach(cache,
+ function(a) {
+ callback.apply(null, a);
+ });
+ };
+
+ WindowTestEnvironment.prototype.on_tests_ready = function() {
+ var output = new Output();
+ this.output_handler = output;
+
+ var this_obj = this;
+ add_start_callback(function (properties) {
+ this_obj.output_handler.init(properties);
+ this_obj._dispatch("start_callback", [properties],
+ { type: "start", properties: properties });
+ });
+ add_test_state_callback(function(test) {
+ this_obj.output_handler.show_status();
+ this_obj._dispatch("test_state_callback", [test],
+ { type: "test_state", test: test.structured_clone() });
+ });
+ add_result_callback(function (test) {
+ this_obj.output_handler.show_status();
+ this_obj._dispatch("result_callback", [test],
+ { type: "result", test: test.structured_clone() });
+ });
+ add_completion_callback(function (tests, harness_status) {
+ this_obj.output_handler.show_results(tests, harness_status);
+ var cloned_tests = map(tests, function(test) { return test.structured_clone(); });
+ this_obj._dispatch("completion_callback", [tests, harness_status],
+ { type: "complete", tests: cloned_tests,
+ status: harness_status.structured_clone() });
+ });
+ };
+
+ WindowTestEnvironment.prototype.next_default_test_name = function() {
+ //Don't use document.title to work around an Opera bug in XHTML documents
+ var title = document.getElementsByTagName("title")[0];
+ var prefix = (title && title.firstChild && title.firstChild.data) || "Untitled";
+ var suffix = this.name_counter > 0 ? " " + this.name_counter : "";
+ this.name_counter++;
+ return prefix + suffix;
+ };
+
+ WindowTestEnvironment.prototype.on_new_harness_properties = function(properties) {
+ this.output_handler.setup(properties);
+ };
+
+ WindowTestEnvironment.prototype.add_on_loaded_callback = function(callback) {
+ on_event(window, 'load', callback);
+ };
+
+ WindowTestEnvironment.prototype.test_timeout = function() {
+ var metas = document.getElementsByTagName("meta");
+ for (var i = 0; i < metas.length; i++) {
+ if (metas[i].name == "timeout") {
+ if (metas[i].content == "long") {
+ return settings.harness_timeout.long;
+ }
+ break;
+ }
+ }
+ return settings.harness_timeout.normal;
+ };
+
+ WindowTestEnvironment.prototype.global_scope = function() {
+ return window;
+ };
+
+ /*
+ * Base TestEnvironment implementation for a generic web worker.
+ *
+ * Workers accumulate test results. One or more clients can connect and
+ * retrieve results from a worker at any time.
+ *
+ * WorkerTestEnvironment supports communicating with a client via a
+ * MessagePort. The mechanism for determining the appropriate MessagePort
+ * for communicating with a client depends on the type of worker and is
+ * implemented by the various specializations of WorkerTestEnvironment
+ * below.
+ *
+ * A client document using testharness can use fetch_tests_from_worker() to
+ * retrieve results from a worker. See apisample16.html.
+ */
+ function WorkerTestEnvironment() {
+ this.name_counter = 0;
+ this.all_loaded = true;
+ this.message_list = [];
+ this.message_ports = [];
+ }
+
+ WorkerTestEnvironment.prototype._dispatch = function(message) {
+ this.message_list.push(message);
+ for (var i = 0; i < this.message_ports.length; ++i)
+ {
+ this.message_ports[i].postMessage(message);
+ }
+ };
+
+ // The only requirement is that port has a postMessage() method. It doesn't
+ // have to be an instance of a MessagePort, and often isn't.
+ WorkerTestEnvironment.prototype._add_message_port = function(port) {
+ this.message_ports.push(port);
+ for (var i = 0; i < this.message_list.length; ++i)
+ {
+ port.postMessage(this.message_list[i]);
+ }
+ };
+
+ WorkerTestEnvironment.prototype.next_default_test_name = function() {
+ var suffix = this.name_counter > 0 ? " " + this.name_counter : "";
+ this.name_counter++;
+ return "Untitled" + suffix;
+ };
+
+ WorkerTestEnvironment.prototype.on_new_harness_properties = function() {};
+
+ WorkerTestEnvironment.prototype.on_tests_ready = function() {
+ var this_obj = this;
+ add_start_callback(
+ function(properties) {
+ this_obj._dispatch({
+ type: "start",
+ properties: properties,
+ });
+ });
+ add_test_state_callback(
+ function(test) {
+ this_obj._dispatch({
+ type: "test_state",
+ test: test.structured_clone()
+ });
+ });
+ add_result_callback(
+ function(test) {
+ this_obj._dispatch({
+ type: "result",
+ test: test.structured_clone()
+ });
+ });
+ add_completion_callback(
+ function(tests, harness_status) {
+ this_obj._dispatch({
+ type: "complete",
+ tests: map(tests,
+ function(test) {
+ return test.structured_clone();
+ }),
+ status: harness_status.structured_clone()
+ });
+ });
+ };
+
+ WorkerTestEnvironment.prototype.add_on_loaded_callback = function() {};
+
+ WorkerTestEnvironment.prototype.test_timeout = function() {
+ // Tests running in a worker don't have a default timeout. I.e. all
+ // worker tests behave as if settings.explicit_timeout is true.
+ return null;
+ };
+
+ WorkerTestEnvironment.prototype.global_scope = function() {
+ return self;
+ };
+
+ /*
+ * Dedicated web workers.
+ * https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope
+ *
+ * This class is used as the test_environment when testharness is running
+ * inside a dedicated worker.
+ */
+ function DedicatedWorkerTestEnvironment() {
+ WorkerTestEnvironment.call(this);
+ // self is an instance of DedicatedWorkerGlobalScope which exposes
+ // a postMessage() method for communicating via the message channel
+ // established when the worker is created.
+ this._add_message_port(self);
+ }
+ DedicatedWorkerTestEnvironment.prototype = Object.create(WorkerTestEnvironment.prototype);
+
+ DedicatedWorkerTestEnvironment.prototype.on_tests_ready = function() {
+ WorkerTestEnvironment.prototype.on_tests_ready.call(this);
+ // In the absence of an onload notification, we a require dedicated
+ // workers to explicitly signal when the tests are done.
+ tests.wait_for_finish = true;
+ };
+
+ /*
+ * Shared web workers.
+ * https://html.spec.whatwg.org/multipage/workers.html#sharedworkerglobalscope
+ *
+ * This class is used as the test_environment when testharness is running
+ * inside a shared web worker.
+ */
+ function SharedWorkerTestEnvironment() {
+ WorkerTestEnvironment.call(this);
+ var this_obj = this;
+ // Shared workers receive message ports via the 'onconnect' event for
+ // each connection.
+ self.addEventListener("connect",
+ function(message_event) {
+ this_obj._add_message_port(message_event.source);
+ });
+ }
+ SharedWorkerTestEnvironment.prototype = Object.create(WorkerTestEnvironment.prototype);
+
+ SharedWorkerTestEnvironment.prototype.on_tests_ready = function() {
+ WorkerTestEnvironment.prototype.on_tests_ready.call(this);
+ // In the absence of an onload notification, we a require shared
+ // workers to explicitly signal when the tests are done.
+ tests.wait_for_finish = true;
+ };
+
+ /*
+ * Service workers.
+ * http://www.w3.org/TR/service-workers/
+ *
+ * This class is used as the test_environment when testharness is running
+ * inside a service worker.
+ */
+ function ServiceWorkerTestEnvironment() {
+ WorkerTestEnvironment.call(this);
+ this.all_loaded = false;
+ this.on_loaded_callback = null;
+ var this_obj = this;
+ self.addEventListener("message",
+ function(event) {
+ if (event.data.type && event.data.type === "connect") {
+ this_obj._add_message_port(event.ports[0]);
+ event.ports[0].start();
+ }
+ });
+
+ // The oninstall event is received after the service worker script and
+ // all imported scripts have been fetched and executed. It's the
+ // equivalent of an onload event for a document. All tests should have
+ // been added by the time this event is received, thus it's not
+ // necessary to wait until the onactivate event.
+ on_event(self, "install",
+ function(event) {
+ this_obj.all_loaded = true;
+ if (this_obj.on_loaded_callback) {
+ this_obj.on_loaded_callback();
+ }
+ });
+ }
+ ServiceWorkerTestEnvironment.prototype = Object.create(WorkerTestEnvironment.prototype);
+
+ ServiceWorkerTestEnvironment.prototype.add_on_loaded_callback = function(callback) {
+ if (this.all_loaded) {
+ callback();
+ } else {
+ this.on_loaded_callback = callback;
+ }
+ };
+
+ function create_test_environment() {
+ if ('document' in self) {
+ return new WindowTestEnvironment();
+ }
+ if ('DedicatedWorkerGlobalScope' in self &&
+ self instanceof DedicatedWorkerGlobalScope) {
+ return new DedicatedWorkerTestEnvironment();
+ }
+ if ('SharedWorkerGlobalScope' in self &&
+ self instanceof SharedWorkerGlobalScope) {
+ return new SharedWorkerTestEnvironment();
+ }
+ if ('ServiceWorkerGlobalScope' in self &&
+ self instanceof ServiceWorkerGlobalScope) {
+ return new ServiceWorkerTestEnvironment();
+ }
+ throw new Error("Unsupported test environment");
+ }
+
+ var test_environment = create_test_environment();
+
+ function is_shared_worker(worker) {
+ return 'SharedWorker' in self && worker instanceof SharedWorker;
+ }
+
+ function is_service_worker(worker) {
+ return 'ServiceWorker' in self && worker instanceof ServiceWorker;
+ }
+
+ /*
+ * API functions
+ */
+
+ function test(func, name, properties)
+ {
+ var test_name = name ? name : test_environment.next_default_test_name();
+ properties = properties ? properties : {};
+ var test_obj = new Test(test_name, properties);
+ test_obj.step(func, test_obj, test_obj);
+ if (test_obj.phase === test_obj.phases.STARTED) {
+ test_obj.done();
+ }
+ }
+
+ function async_test(func, name, properties)
+ {
+ if (typeof func !== "function") {
+ properties = name;
+ name = func;
+ func = null;
+ }
+ var test_name = name ? name : test_environment.next_default_test_name();
+ properties = properties ? properties : {};
+ var test_obj = new Test(test_name, properties);
+ if (func) {
+ test_obj.step(func, test_obj, test_obj);
+ }
+ return test_obj;
+ }
+
+ function promise_test(func, name, properties) {
+ var test = async_test(name, properties);
+ Promise.resolve(test.step(func, test, test))
+ .then(
+ function() {
+ test.done();
+ })
+ .catch(test.step_func(
+ function(value) {
+ if (value instanceof AssertionError) {
+ throw value;
+ }
+ assert(false, "promise_test", null,
+ "Unhandled rejection with value: ${value}", {value:value});
+ }));
+ }
+
+ function setup(func_or_properties, maybe_properties)
+ {
+ var func = null;
+ var properties = {};
+ if (arguments.length === 2) {
+ func = func_or_properties;
+ properties = maybe_properties;
+ } else if (func_or_properties instanceof Function) {
+ func = func_or_properties;
+ } else {
+ properties = func_or_properties;
+ }
+ tests.setup(func, properties);
+ test_environment.on_new_harness_properties(properties);
+ }
+
+ function done() {
+ if (tests.tests.length === 0) {
+ tests.set_file_is_test();
+ }
+ if (tests.file_is_test) {
+ tests.tests[0].done();
+ }
+ tests.end_wait();
+ }
+
+ function generate_tests(func, args, properties) {
+ forEach(args, function(x, i)
+ {
+ var name = x[0];
+ test(function()
+ {
+ func.apply(this, x.slice(1));
+ },
+ name,
+ Array.isArray(properties) ? properties[i] : properties);
+ });
+ }
+
+ function on_event(object, event, callback)
+ {
+ object.addEventListener(event, callback, false);
+ }
+
+ expose(test, 'test');
+ expose(async_test, 'async_test');
+ expose(promise_test, 'promise_test');
+ expose(generate_tests, 'generate_tests');
+ expose(setup, 'setup');
+ expose(done, 'done');
+ expose(on_event, 'on_event');
+
+ /*
+ * Return a string truncated to the given length, with ... added at the end
+ * if it was longer.
+ */
+ function truncate(s, len)
+ {
+ if (s.length > len) {
+ return s.substring(0, len - 3) + "...";
+ }
+ return s;
+ }
+
+ /*
+ * Return true if object is probably a Node object.
+ */
+ function is_node(object)
+ {
+ // I use duck-typing instead of instanceof, because
+ // instanceof doesn't work if the node is from another window (like an
+ // iframe's contentWindow):
+ // http://www.w3.org/Bugs/Public/show_bug.cgi?id=12295
+ if ("nodeType" in object &&
+ "nodeName" in object &&
+ "nodeValue" in object &&
+ "childNodes" in object) {
+ try {
+ object.nodeType;
+ } catch (e) {
+ // The object is probably Node.prototype or another prototype
+ // object that inherits from it, and not a Node instance.
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * Convert a value to a nice, human-readable string
+ */
+ function format_value(val, seen)
+ {
+ if (!seen) {
+ seen = [];
+ }
+ if (typeof val === "object" && val !== null) {
+ if (seen.indexOf(val) >= 0) {
+ return "[...]";
+ }
+ seen.push(val);
+ }
+ if (Array.isArray(val)) {
+ return "[" + val.map(function(x) {return format_value(x, seen);}).join(", ") + "]";
+ }
+
+ switch (typeof val) {
+ case "string":
+ val = val.replace("\\", "\\\\");
+ for (var i = 0; i < 32; i++) {
+ var replace = "\\";
+ switch (i) {
+ case 0: replace += "0"; break;
+ case 1: replace += "x01"; break;
+ case 2: replace += "x02"; break;
+ case 3: replace += "x03"; break;
+ case 4: replace += "x04"; break;
+ case 5: replace += "x05"; break;
+ case 6: replace += "x06"; break;
+ case 7: replace += "x07"; break;
+ case 8: replace += "b"; break;
+ case 9: replace += "t"; break;
+ case 10: replace += "n"; break;
+ case 11: replace += "v"; break;
+ case 12: replace += "f"; break;
+ case 13: replace += "r"; break;
+ case 14: replace += "x0e"; break;
+ case 15: replace += "x0f"; break;
+ case 16: replace += "x10"; break;
+ case 17: replace += "x11"; break;
+ case 18: replace += "x12"; break;
+ case 19: replace += "x13"; break;
+ case 20: replace += "x14"; break;
+ case 21: replace += "x15"; break;
+ case 22: replace += "x16"; break;
+ case 23: replace += "x17"; break;
+ case 24: replace += "x18"; break;
+ case 25: replace += "x19"; break;
+ case 26: replace += "x1a"; break;
+ case 27: replace += "x1b"; break;
+ case 28: replace += "x1c"; break;
+ case 29: replace += "x1d"; break;
+ case 30: replace += "x1e"; break;
+ case 31: replace += "x1f"; break;
+ }
+ val = val.replace(RegExp(String.fromCharCode(i), "g"), replace);
+ }
+ return '"' + val.replace(/"/g, '\\"') + '"';
+ case "boolean":
+ case "undefined":
+ return String(val);
+ case "number":
+ // In JavaScript, -0 === 0 and String(-0) == "0", so we have to
+ // special-case.
+ if (val === -0 && 1/val === -Infinity) {
+ return "-0";
+ }
+ return String(val);
+ case "object":
+ if (val === null) {
+ return "null";
+ }
+
+ // Special-case Node objects, since those come up a lot in my tests. I
+ // ignore namespaces.
+ if (is_node(val)) {
+ switch (val.nodeType) {
+ case Node.ELEMENT_NODE:
+ var ret = "<" + val.localName;
+ for (var i = 0; i < val.attributes.length; i++) {
+ ret += " " + val.attributes[i].name + '="' + val.attributes[i].value + '"';
+ }
+ ret += ">" + val.innerHTML + "</" + val.localName + ">";
+ return "Element node " + truncate(ret, 60);
+ case Node.TEXT_NODE:
+ return 'Text node "' + truncate(val.data, 60) + '"';
+ case Node.PROCESSING_INSTRUCTION_NODE:
+ return "ProcessingInstruction node with target " + format_value(truncate(val.target, 60)) + " and data " + format_value(truncate(val.data, 60));
+ case Node.COMMENT_NODE:
+ return "Comment node <!--" + truncate(val.data, 60) + "-->";
+ case Node.DOCUMENT_NODE:
+ return "Document node with " + val.childNodes.length + (val.childNodes.length == 1 ? " child" : " children");
+ case Node.DOCUMENT_TYPE_NODE:
+ return "DocumentType node";
+ case Node.DOCUMENT_FRAGMENT_NODE:
+ return "DocumentFragment node with " + val.childNodes.length + (val.childNodes.length == 1 ? " child" : " children");
+ default:
+ return "Node object of unknown type";
+ }
+ }
+
+ /* falls through */
+ default:
+ return typeof val + ' "' + truncate(String(val), 60) + '"';
+ }
+ }
+ expose(format_value, "format_value");
+
+ /*
+ * Assertions
+ */
+
+ function assert_true(actual, description)
+ {
+ assert(actual === true, "assert_true", description,
+ "expected true got ${actual}", {actual:actual});
+ }
+ expose(assert_true, "assert_true");
+
+ function assert_false(actual, description)
+ {
+ assert(actual === false, "assert_false", description,
+ "expected false got ${actual}", {actual:actual});
+ }
+ expose(assert_false, "assert_false");
+
+ function same_value(x, y) {
+ if (y !== y) {
+ //NaN case
+ return x !== x;
+ }
+ if (x === 0 && y === 0) {
+ //Distinguish +0 and -0
+ return 1/x === 1/y;
+ }
+ return x === y;
+ }
+
+ function assert_equals(actual, expected, description)
+ {
+ /*
+ * Test if two primitives are equal or two objects
+ * are the same object
+ */
+ if (typeof actual != typeof expected) {
+ assert(false, "assert_equals", description,
+ "expected (" + typeof expected + ") ${expected} but got (" + typeof actual + ") ${actual}",
+ {expected:expected, actual:actual});
+ return;
+ }
+ assert(same_value(actual, expected), "assert_equals", description,
+ "expected ${expected} but got ${actual}",
+ {expected:expected, actual:actual});
+ }
+ expose(assert_equals, "assert_equals");
+
+ function assert_not_equals(actual, expected, description)
+ {
+ /*
+ * Test if two primitives are unequal or two objects
+ * are different objects
+ */
+ assert(!same_value(actual, expected), "assert_not_equals", description,
+ "got disallowed value ${actual}",
+ {actual:actual});
+ }
+ expose(assert_not_equals, "assert_not_equals");
+
+ function assert_in_array(actual, expected, description)
+ {
+ assert(expected.indexOf(actual) != -1, "assert_in_array", description,
+ "value ${actual} not in array ${expected}",
+ {actual:actual, expected:expected});
+ }
+ expose(assert_in_array, "assert_in_array");
+
+ function assert_object_equals(actual, expected, description)
+ {
+ //This needs to be improved a great deal
+ function check_equal(actual, expected, stack)
+ {
+ stack.push(actual);
+
+ var p;
+ for (p in actual) {
+ assert(expected.hasOwnProperty(p), "assert_object_equals", description,
+ "unexpected property ${p}", {p:p});
+
+ if (typeof actual[p] === "object" && actual[p] !== null) {
+ if (stack.indexOf(actual[p]) === -1) {
+ check_equal(actual[p], expected[p], stack);
+ }
+ } else {
+ assert(same_value(actual[p], expected[p]), "assert_object_equals", description,
+ "property ${p} expected ${expected} got ${actual}",
+ {p:p, expected:expected, actual:actual});
+ }
+ }
+ for (p in expected) {
+ assert(actual.hasOwnProperty(p),
+ "assert_object_equals", description,
+ "expected property ${p} missing", {p:p});
+ }
+ stack.pop();
+ }
+ check_equal(actual, expected, []);
+ }
+ expose(assert_object_equals, "assert_object_equals");
+
+ function assert_array_equals(actual, expected, description)
+ {
+ assert(actual.length === expected.length,
+ "assert_array_equals", description,
+ "lengths differ, expected ${expected} got ${actual}",
+ {expected:expected.length, actual:actual.length});
+
+ for (var i = 0; i < actual.length; i++) {
+ assert(actual.hasOwnProperty(i) === expected.hasOwnProperty(i),
+ "assert_array_equals", description,
+ "property ${i}, property expected to be ${expected} but was ${actual}",
+ {i:i, expected:expected.hasOwnProperty(i) ? "present" : "missing",
+ actual:actual.hasOwnProperty(i) ? "present" : "missing"});
+ assert(same_value(expected[i], actual[i]),
+ "assert_array_equals", description,
+ "property ${i}, expected ${expected} but got ${actual}",
+ {i:i, expected:expected[i], actual:actual[i]});
+ }
+ }
+ expose(assert_array_equals, "assert_array_equals");
+
+ function assert_approx_equals(actual, expected, epsilon, description)
+ {
+ /*
+ * Test if two primitive numbers are equal within +/- epsilon
+ */
+ assert(typeof actual === "number",
+ "assert_approx_equals", description,
+ "expected a number but got a ${type_actual}",
+ {type_actual:typeof actual});
+
+ assert(Math.abs(actual - expected) <= epsilon,
+ "assert_approx_equals", description,
+ "expected ${expected} +/- ${epsilon} but got ${actual}",
+ {expected:expected, actual:actual, epsilon:epsilon});
+ }
+ expose(assert_approx_equals, "assert_approx_equals");
+
+ function assert_less_than(actual, expected, description)
+ {
+ /*
+ * Test if a primitive number is less than another
+ */
+ assert(typeof actual === "number",
+ "assert_less_than", description,
+ "expected a number but got a ${type_actual}",
+ {type_actual:typeof actual});
+
+ assert(actual < expected,
+ "assert_less_than", description,
+ "expected a number less than ${expected} but got ${actual}",
+ {expected:expected, actual:actual});
+ }
+ expose(assert_less_than, "assert_less_than");
+
+ function assert_greater_than(actual, expected, description)
+ {
+ /*
+ * Test if a primitive number is greater than another
+ */
+ assert(typeof actual === "number",
+ "assert_greater_than", description,
+ "expected a number but got a ${type_actual}",
+ {type_actual:typeof actual});
+
+ assert(actual > expected,
+ "assert_greater_than", description,
+ "expected a number greater than ${expected} but got ${actual}",
+ {expected:expected, actual:actual});
+ }
+ expose(assert_greater_than, "assert_greater_than");
+
+ function assert_less_than_equal(actual, expected, description)
+ {
+ /*
+ * Test if a primitive number is less than or equal to another
+ */
+ assert(typeof actual === "number",
+ "assert_less_than_equal", description,
+ "expected a number but got a ${type_actual}",
+ {type_actual:typeof actual});
+
+ assert(actual <= expected,
+ "assert_less_than", description,
+ "expected a number less than or equal to ${expected} but got ${actual}",
+ {expected:expected, actual:actual});
+ }
+ expose(assert_less_than_equal, "assert_less_than_equal");
+
+ function assert_greater_than_equal(actual, expected, description)
+ {
+ /*
+ * Test if a primitive number is greater than or equal to another
+ */
+ assert(typeof actual === "number",
+ "assert_greater_than_equal", description,
+ "expected a number but got a ${type_actual}",
+ {type_actual:typeof actual});
+
+ assert(actual >= expected,
+ "assert_greater_than_equal", description,
+ "expected a number greater than or equal to ${expected} but got ${actual}",
+ {expected:expected, actual:actual});
+ }
+ expose(assert_greater_than_equal, "assert_greater_than_equal");
+
+ function assert_regexp_match(actual, expected, description) {
+ /*
+ * Test if a string (actual) matches a regexp (expected)
+ */
+ assert(expected.test(actual),
+ "assert_regexp_match", description,
+ "expected ${expected} but got ${actual}",
+ {expected:expected, actual:actual});
+ }
+ expose(assert_regexp_match, "assert_regexp_match");
+
+ function assert_class_string(object, class_string, description) {
+ assert_equals({}.toString.call(object), "[object " + class_string + "]",
+ description);
+ }
+ expose(assert_class_string, "assert_class_string");
+
+
+ function _assert_own_property(name) {
+ return function(object, property_name, description)
+ {
+ assert(property_name in object,
+ name, description,
+ "expected property ${p} missing", {p:property_name});
+ };
+ }
+ expose(_assert_own_property("assert_exists"), "assert_exists");
+ expose(_assert_own_property("assert_own_property"), "assert_own_property");
+
+ function assert_not_exists(object, property_name, description)
+ {
+ assert(!object.hasOwnProperty(property_name),
+ "assert_not_exists", description,
+ "unexpected property ${p} found", {p:property_name});
+ }
+ expose(assert_not_exists, "assert_not_exists");
+
+ function _assert_inherits(name) {
+ return function (object, property_name, description)
+ {
+ assert(typeof object === "object",
+ name, description,
+ "provided value is not an object");
+
+ assert("hasOwnProperty" in object,
+ name, description,
+ "provided value is an object but has no hasOwnProperty method");
+
+ assert(!object.hasOwnProperty(property_name),
+ name, description,
+ "property ${p} found on object expected in prototype chain",
+ {p:property_name});
+
+ assert(property_name in object,
+ name, description,
+ "property ${p} not found in prototype chain",
+ {p:property_name});
+ };
+ }
+ expose(_assert_inherits("assert_inherits"), "assert_inherits");
+ expose(_assert_inherits("assert_idl_attribute"), "assert_idl_attribute");
+
+ function assert_readonly(object, property_name, description)
+ {
+ var initial_value = object[property_name];
+ try {
+ //Note that this can have side effects in the case where
+ //the property has PutForwards
+ object[property_name] = initial_value + "a"; //XXX use some other value here?
+ assert(same_value(object[property_name], initial_value),
+ "assert_readonly", description,
+ "changing property ${p} succeeded",
+ {p:property_name});
+ } finally {
+ object[property_name] = initial_value;
+ }
+ }
+ expose(assert_readonly, "assert_readonly");
+
+ function assert_throws(code, func, description)
+ {
+ try {
+ func.call(this);
+ assert(false, "assert_throws", description,
+ "${func} did not throw", {func:func});
+ } catch (e) {
+ if (e instanceof AssertionError) {
+ throw e;
+ }
+ if (code === null) {
+ return;
+ }
+ if (typeof code === "object") {
+ assert(typeof e == "object" && "name" in e && e.name == code.name,
+ "assert_throws", description,
+ "${func} threw ${actual} (${actual_name}) expected ${expected} (${expected_name})",
+ {func:func, actual:e, actual_name:e.name,
+ expected:code,
+ expected_name:code.name});
+ return;
+ }
+
+ var code_name_map = {
+ INDEX_SIZE_ERR: 'IndexSizeError',
+ HIERARCHY_REQUEST_ERR: 'HierarchyRequestError',
+ WRONG_DOCUMENT_ERR: 'WrongDocumentError',
+ INVALID_CHARACTER_ERR: 'InvalidCharacterError',
+ NO_MODIFICATION_ALLOWED_ERR: 'NoModificationAllowedError',
+ NOT_FOUND_ERR: 'NotFoundError',
+ NOT_SUPPORTED_ERR: 'NotSupportedError',
+ INVALID_STATE_ERR: 'InvalidStateError',
+ SYNTAX_ERR: 'SyntaxError',
+ INVALID_MODIFICATION_ERR: 'InvalidModificationError',
+ NAMESPACE_ERR: 'NamespaceError',
+ INVALID_ACCESS_ERR: 'InvalidAccessError',
+ TYPE_MISMATCH_ERR: 'TypeMismatchError',
+ SECURITY_ERR: 'SecurityError',
+ NETWORK_ERR: 'NetworkError',
+ ABORT_ERR: 'AbortError',
+ URL_MISMATCH_ERR: 'URLMismatchError',
+ QUOTA_EXCEEDED_ERR: 'QuotaExceededError',
+ TIMEOUT_ERR: 'TimeoutError',
+ INVALID_NODE_TYPE_ERR: 'InvalidNodeTypeError',
+ DATA_CLONE_ERR: 'DataCloneError'
+ };
+
+ var name = code in code_name_map ? code_name_map[code] : code;
+
+ var name_code_map = {
+ IndexSizeError: 1,
+ HierarchyRequestError: 3,
+ WrongDocumentError: 4,
+ InvalidCharacterError: 5,
+ NoModificationAllowedError: 7,
+ NotFoundError: 8,
+ NotSupportedError: 9,
+ InvalidStateError: 11,
+ SyntaxError: 12,
+ InvalidModificationError: 13,
+ NamespaceError: 14,
+ InvalidAccessError: 15,
+ TypeMismatchError: 17,
+ SecurityError: 18,
+ NetworkError: 19,
+ AbortError: 20,
+ URLMismatchError: 21,
+ QuotaExceededError: 22,
+ TimeoutError: 23,
+ InvalidNodeTypeError: 24,
+ DataCloneError: 25,
+
+ UnknownError: 0,
+ ConstraintError: 0,
+ DataError: 0,
+ TransactionInactiveError: 0,
+ ReadOnlyError: 0,
+ VersionError: 0
+ };
+
+ if (!(name in name_code_map)) {
+ throw new AssertionError('Test bug: unrecognized DOMException code "' + code + '" passed to assert_throws()');
+ }
+
+ var required_props = { code: name_code_map[name] };
+
+ if (required_props.code === 0 ||
+ ("name" in e && e.name !== e.name.toUpperCase() && e.name !== "DOMException")) {
+ // New style exception: also test the name property.
+ required_props.name = name;
+ }
+
+ //We'd like to test that e instanceof the appropriate interface,
+ //but we can't, because we don't know what window it was created
+ //in. It might be an instanceof the appropriate interface on some
+ //unknown other window. TODO: Work around this somehow?
+
+ assert(typeof e == "object",
+ "assert_throws", description,
+ "${func} threw ${e} with type ${type}, not an object",
+ {func:func, e:e, type:typeof e});
+
+ for (var prop in required_props) {
+ assert(typeof e == "object" && prop in e && e[prop] == required_props[prop],
+ "assert_throws", description,
+ "${func} threw ${e} that is not a DOMException " + code + ": property ${prop} is equal to ${actual}, expected ${expected}",
+ {func:func, e:e, prop:prop, actual:e[prop], expected:required_props[prop]});
+ }
+ }
+ }
+ expose(assert_throws, "assert_throws");
+
+ function assert_unreached(description) {
+ assert(false, "assert_unreached", description,
+ "Reached unreachable code");
+ }
+ expose(assert_unreached, "assert_unreached");
+
+ function assert_any(assert_func, actual, expected_array)
+ {
+ var args = [].slice.call(arguments, 3);
+ var errors = [];
+ var passed = false;
+ forEach(expected_array,
+ function(expected)
+ {
+ try {
+ assert_func.apply(this, [actual, expected].concat(args));
+ passed = true;
+ } catch (e) {
+ errors.push(e.message);
+ }
+ });
+ if (!passed) {
+ throw new AssertionError(errors.join("\n\n"));
+ }
+ }
+ expose(assert_any, "assert_any");
+
+ function Test(name, properties)
+ {
+ if (tests.file_is_test && tests.tests.length) {
+ throw new Error("Tried to create a test with file_is_test");
+ }
+ this.name = name;
+
+ this.phase = this.phases.INITIAL;
+
+ this.status = this.NOTRUN;
+ this.timeout_id = null;
+ this.index = null;
+
+ this.properties = properties;
+ var timeout = properties.timeout ? properties.timeout : settings.test_timeout;
+ if (timeout !== null) {
+ this.timeout_length = timeout * tests.timeout_multiplier;
+ } else {
+ this.timeout_length = null;
+ }
+
+ this.message = null;
+
+ this.steps = [];
+
+ this.cleanup_callbacks = [];
+
+ tests.push(this);
+ }
+
+ Test.statuses = {
+ PASS:0,
+ FAIL:1,
+ TIMEOUT:2,
+ NOTRUN:3
+ };
+
+ Test.prototype = merge({}, Test.statuses);
+
+ Test.prototype.phases = {
+ INITIAL:0,
+ STARTED:1,
+ HAS_RESULT:2,
+ COMPLETE:3
+ };
+
+ Test.prototype.structured_clone = function()
+ {
+ if (!this._structured_clone) {
+ var msg = this.message;
+ msg = msg ? String(msg) : msg;
+ this._structured_clone = merge({
+ name:String(this.name),
+ properties:merge({}, this.properties),
+ }, Test.statuses);
+ }
+ this._structured_clone.status = this.status;
+ this._structured_clone.message = this.message;
+ this._structured_clone.index = this.index;
+ return this._structured_clone;
+ };
+
+ Test.prototype.step = function(func, this_obj)
+ {
+ if (this.phase > this.phases.STARTED) {
+ return;
+ }
+ this.phase = this.phases.STARTED;
+ //If we don't get a result before the harness times out that will be a test timeout
+ this.set_status(this.TIMEOUT, "Test timed out");
+
+ tests.started = true;
+ tests.notify_test_state(this);
+
+ if (this.timeout_id === null) {
+ this.set_timeout();
+ }
+
+ this.steps.push(func);
+
+ if (arguments.length === 1) {
+ this_obj = this;
+ }
+
+ try {
+ return func.apply(this_obj, Array.prototype.slice.call(arguments, 2));
+ } catch (e) {
+ if (this.phase >= this.phases.HAS_RESULT) {
+ return;
+ }
+ var message = (typeof e === "object" && e !== null) ? e.message : e;
+ if (typeof e.stack != "undefined" && typeof e.message == "string") {
+ //Try to make it more informative for some exceptions, at least
+ //in Gecko and WebKit. This results in a stack dump instead of
+ //just errors like "Cannot read property 'parentNode' of null"
+ //or "root is null". Makes it a lot longer, of course.
+ message += "(stack: " + e.stack + ")";
+ }
+ this.set_status(this.FAIL, message);
+ this.phase = this.phases.HAS_RESULT;
+ this.done();
+ }
+ };
+
+ Test.prototype.step_func = function(func, this_obj)
+ {
+ var test_this = this;
+
+ if (arguments.length === 1) {
+ this_obj = test_this;
+ }
+
+ return function()
+ {
+ return test_this.step.apply(test_this, [func, this_obj].concat(
+ Array.prototype.slice.call(arguments)));
+ };
+ };
+
+ Test.prototype.step_func_done = function(func, this_obj)
+ {
+ var test_this = this;
+
+ if (arguments.length === 1) {
+ this_obj = test_this;
+ }
+
+ return function()
+ {
+ if (func) {
+ test_this.step.apply(test_this, [func, this_obj].concat(
+ Array.prototype.slice.call(arguments)));
+ }
+ test_this.done();
+ };
+ };
+
+ Test.prototype.unreached_func = function(description)
+ {
+ return this.step_func(function() {
+ assert_unreached(description);
+ });
+ };
+
+ Test.prototype.add_cleanup = function(callback) {
+ this.cleanup_callbacks.push(callback);
+ };
+
+ Test.prototype.force_timeout = function() {
+ this.set_status(this.TIMEOUT);
+ this.phase = this.phases.HAS_RESULT;
+ };
+
+ Test.prototype.set_timeout = function()
+ {
+ if (this.timeout_length !== null) {
+ var this_obj = this;
+ this.timeout_id = setTimeout(function()
+ {
+ this_obj.timeout();
+ }, this.timeout_length);
+ }
+ };
+
+ Test.prototype.set_status = function(status, message)
+ {
+ this.status = status;
+ this.message = message;
+ };
+
+ Test.prototype.timeout = function()
+ {
+ this.timeout_id = null;
+ this.set_status(this.TIMEOUT, "Test timed out");
+ this.phase = this.phases.HAS_RESULT;
+ this.done();
+ };
+
+ Test.prototype.done = function()
+ {
+ if (this.phase == this.phases.COMPLETE) {
+ return;
+ }
+
+ if (this.phase <= this.phases.STARTED) {
+ this.set_status(this.PASS, null);
+ }
+
+ this.phase = this.phases.COMPLETE;
+
+ clearTimeout(this.timeout_id);
+ tests.result(this);
+ this.cleanup();
+ };
+
+ Test.prototype.cleanup = function() {
+ forEach(this.cleanup_callbacks,
+ function(cleanup_callback) {
+ cleanup_callback();
+ });
+ };
+
+ /*
+ * A RemoteTest object mirrors a Test object on a remote worker. The
+ * associated RemoteWorker updates the RemoteTest object in response to
+ * received events. In turn, the RemoteTest object replicates these events
+ * on the local document. This allows listeners (test result reporting
+ * etc..) to transparently handle local and remote events.
+ */
+ function RemoteTest(clone) {
+ var this_obj = this;
+ Object.keys(clone).forEach(
+ function(key) {
+ this_obj[key] = clone[key];
+ });
+ this.index = null;
+ this.phase = this.phases.INITIAL;
+ this.update_state_from(clone);
+ tests.push(this);
+ }
+
+ RemoteTest.prototype.structured_clone = function() {
+ var clone = {};
+ Object.keys(this).forEach(
+ function(key) {
+ if (typeof(this[key]) === "object") {
+ clone[key] = merge({}, this[key]);
+ } else {
+ clone[key] = this[key];
+ }
+ });
+ clone.phases = merge({}, this.phases);
+ return clone;
+ };
+
+ RemoteTest.prototype.cleanup = function() {};
+ RemoteTest.prototype.phases = Test.prototype.phases;
+ RemoteTest.prototype.update_state_from = function(clone) {
+ this.status = clone.status;
+ this.message = clone.message;
+ if (this.phase === this.phases.INITIAL) {
+ this.phase = this.phases.STARTED;
+ }
+ };
+ RemoteTest.prototype.done = function() {
+ this.phase = this.phases.COMPLETE;
+ }
+
+ /*
+ * A RemoteWorker listens for test events from a worker. These events are
+ * then used to construct and maintain RemoteTest objects that mirror the
+ * tests running on the remote worker.
+ */
+ function RemoteWorker(worker) {
+ this.running = true;
+ this.tests = new Array();
+
+ var this_obj = this;
+ worker.onerror = function(error) { this_obj.worker_error(error); };
+
+ var message_port;
+
+ if (is_service_worker(worker)) {
+ // The ServiceWorker's implicit MessagePort is currently not
+ // reliably accessible from the ServiceWorkerGlobalScope due to
+ // Blink setting MessageEvent.source to null for messages sent via
+ // ServiceWorker.postMessage(). Until that's resolved, create an
+ // explicit MessageChannel and pass one end to the worker.
+ var message_channel = new MessageChannel();
+ message_port = message_channel.port1;
+ message_port.start();
+ worker.postMessage({type: "connect"}, [message_channel.port2]);
+ } else if (is_shared_worker(worker)) {
+ message_port = worker.port;
+ } else {
+ message_port = worker;
+ }
+
+ // Keeping a reference to the worker until worker_done() is seen
+ // prevents the Worker object and its MessageChannel from going away
+ // before all the messages are dispatched.
+ this.worker = worker;
+
+ message_port.onmessage =
+ function(message) {
+ if (this_obj.running && (message.data.type in this_obj.message_handlers)) {
+ this_obj.message_handlers[message.data.type].call(this_obj, message.data);
+ }
+ };
+ }
+
+ RemoteWorker.prototype.worker_error = function(error) {
+ var message = error.message || String(error);
+ var filename = (error.filename ? " " + error.filename: "");
+ // FIXME: Display worker error states separately from main document
+ // error state.
+ this.worker_done({
+ status: {
+ status: tests.status.ERROR,
+ message: "Error in worker" + filename + ": " + message
+ }
+ });
+ error.preventDefault();
+ };
+
+ RemoteWorker.prototype.test_state = function(data) {
+ var remote_test = this.tests[data.test.index];
+ if (!remote_test) {
+ remote_test = new RemoteTest(data.test);
+ this.tests[data.test.index] = remote_test;
+ }
+ remote_test.update_state_from(data.test);
+ tests.notify_test_state(remote_test);
+ };
+
+ RemoteWorker.prototype.test_done = function(data) {
+ var remote_test = this.tests[data.test.index];
+ remote_test.update_state_from(data.test);
+ remote_test.done();
+ tests.result(remote_test);
+ };
+
+ RemoteWorker.prototype.worker_done = function(data) {
+ if (tests.status.status === null &&
+ data.status.status !== data.status.OK) {
+ tests.status.status = data.status.status;
+ tests.status.message = data.status.message;
+ }
+ this.running = false;
+ this.worker = null;
+ if (tests.all_done()) {
+ tests.complete();
+ }
+ };
+
+ RemoteWorker.prototype.message_handlers = {
+ test_state: RemoteWorker.prototype.test_state,
+ result: RemoteWorker.prototype.test_done,
+ complete: RemoteWorker.prototype.worker_done
+ };
+
+ /*
+ * Harness
+ */
+
+ function TestsStatus()
+ {
+ this.status = null;
+ this.message = null;
+ }
+
+ TestsStatus.statuses = {
+ OK:0,
+ ERROR:1,
+ TIMEOUT:2
+ };
+
+ TestsStatus.prototype = merge({}, TestsStatus.statuses);
+
+ TestsStatus.prototype.structured_clone = function()
+ {
+ if (!this._structured_clone) {
+ var msg = this.message;
+ msg = msg ? String(msg) : msg;
+ this._structured_clone = merge({
+ status:this.status,
+ message:msg
+ }, TestsStatus.statuses);
+ }
+ return this._structured_clone;
+ };
+
+ function Tests()
+ {
+ this.tests = [];
+ this.num_pending = 0;
+
+ this.phases = {
+ INITIAL:0,
+ SETUP:1,
+ HAVE_TESTS:2,
+ HAVE_RESULTS:3,
+ COMPLETE:4
+ };
+ this.phase = this.phases.INITIAL;
+
+ this.properties = {};
+
+ this.wait_for_finish = false;
+ this.processing_callbacks = false;
+
+ this.allow_uncaught_exception = false;
+
+ this.file_is_test = false;
+
+ this.timeout_multiplier = 1;
+ this.timeout_length = test_environment.test_timeout();
+ this.timeout_id = null;
+
+ this.start_callbacks = [];
+ this.test_state_callbacks = [];
+ this.test_done_callbacks = [];
+ this.all_done_callbacks = [];
+
+ this.pending_workers = [];
+
+ this.status = new TestsStatus();
+
+ var this_obj = this;
+
+ test_environment.add_on_loaded_callback(function() {
+ if (this_obj.all_done()) {
+ this_obj.complete();
+ }
+ });
+
+ this.set_timeout();
+ }
+
+ Tests.prototype.setup = function(func, properties)
+ {
+ if (this.phase >= this.phases.HAVE_RESULTS) {
+ return;
+ }
+
+ if (this.phase < this.phases.SETUP) {
+ this.phase = this.phases.SETUP;
+ }
+
+ this.properties = properties;
+
+ for (var p in properties) {
+ if (properties.hasOwnProperty(p)) {
+ var value = properties[p];
+ if (p == "allow_uncaught_exception") {
+ this.allow_uncaught_exception = value;
+ } else if (p == "explicit_done" && value) {
+ this.wait_for_finish = true;
+ } else if (p == "explicit_timeout" && value) {
+ this.timeout_length = null;
+ if (this.timeout_id)
+ {
+ clearTimeout(this.timeout_id);
+ }
+ } else if (p == "timeout_multiplier") {
+ this.timeout_multiplier = value;
+ }
+ }
+ }
+
+ if (func) {
+ try {
+ func();
+ } catch (e) {
+ this.status.status = this.status.ERROR;
+ this.status.message = String(e);
+ }
+ }
+ this.set_timeout();
+ };
+
+ Tests.prototype.set_file_is_test = function() {
+ if (this.tests.length > 0) {
+ throw new Error("Tried to set file as test after creating a test");
+ }
+ this.wait_for_finish = true;
+ this.file_is_test = true;
+ // Create the test, which will add it to the list of tests
+ async_test();
+ };
+
+ Tests.prototype.set_timeout = function() {
+ var this_obj = this;
+ clearTimeout(this.timeout_id);
+ if (this.timeout_length !== null) {
+ this.timeout_id = setTimeout(function() {
+ this_obj.timeout();
+ }, this.timeout_length);
+ }
+ };
+
+ Tests.prototype.timeout = function() {
+ if (this.status.status === null) {
+ this.status.status = this.status.TIMEOUT;
+ }
+ this.complete();
+ };
+
+ Tests.prototype.end_wait = function()
+ {
+ this.wait_for_finish = false;
+ if (this.all_done()) {
+ this.complete();
+ }
+ };
+
+ Tests.prototype.push = function(test)
+ {
+ if (this.phase < this.phases.HAVE_TESTS) {
+ this.start();
+ }
+ this.num_pending++;
+ test.index = this.tests.push(test);
+ this.notify_test_state(test);
+ };
+
+ Tests.prototype.notify_test_state = function(test) {
+ var this_obj = this;
+ forEach(this.test_state_callbacks,
+ function(callback) {
+ callback(test, this_obj);
+ });
+ };
+
+ Tests.prototype.all_done = function() {
+ return (this.tests.length > 0 && test_environment.all_loaded &&
+ this.num_pending === 0 && !this.wait_for_finish &&
+ !this.processing_callbacks &&
+ !this.pending_workers.some(function(w) { return w.running; }));
+ };
+
+ Tests.prototype.start = function() {
+ this.phase = this.phases.HAVE_TESTS;
+ this.notify_start();
+ };
+
+ Tests.prototype.notify_start = function() {
+ var this_obj = this;
+ forEach (this.start_callbacks,
+ function(callback)
+ {
+ callback(this_obj.properties);
+ });
+ };
+
+ Tests.prototype.result = function(test)
+ {
+ if (this.phase > this.phases.HAVE_RESULTS) {
+ return;
+ }
+ this.phase = this.phases.HAVE_RESULTS;
+ this.num_pending--;
+ this.notify_result(test);
+ };
+
+ Tests.prototype.notify_result = function(test) {
+ var this_obj = this;
+ this.processing_callbacks = true;
+ forEach(this.test_done_callbacks,
+ function(callback)
+ {
+ callback(test, this_obj);
+ });
+ this.processing_callbacks = false;
+ if (this_obj.all_done()) {
+ this_obj.complete();
+ }
+ };
+
+ Tests.prototype.complete = function() {
+ if (this.phase === this.phases.COMPLETE) {
+ return;
+ }
+ this.phase = this.phases.COMPLETE;
+ var this_obj = this;
+ this.tests.forEach(
+ function(x)
+ {
+ if (x.phase < x.phases.COMPLETE) {
+ this_obj.notify_result(x);
+ x.cleanup();
+ x.phase = x.phases.COMPLETE;
+ }
+ }
+ );
+ this.notify_complete();
+ };
+
+ Tests.prototype.notify_complete = function() {
+ var this_obj = this;
+ if (this.status.status === null) {
+ this.status.status = this.status.OK;
+ }
+
+ forEach (this.all_done_callbacks,
+ function(callback)
+ {
+ callback(this_obj.tests, this_obj.status);
+ });
+ };
+
+ Tests.prototype.fetch_tests_from_worker = function(worker) {
+ if (this.phase >= this.phases.COMPLETE) {
+ return;
+ }
+
+ this.pending_workers.push(new RemoteWorker(worker));
+ };
+
+ function fetch_tests_from_worker(port) {
+ tests.fetch_tests_from_worker(port);
+ }
+ expose(fetch_tests_from_worker, 'fetch_tests_from_worker');
+
+ function timeout() {
+ if (tests.timeout_length === null) {
+ tests.timeout();
+ }
+ }
+ expose(timeout, 'timeout');
+
+ function add_start_callback(callback) {
+ tests.start_callbacks.push(callback);
+ }
+
+ function add_test_state_callback(callback) {
+ tests.test_state_callbacks.push(callback);
+ }
+
+ function add_result_callback(callback)
+ {
+ tests.test_done_callbacks.push(callback);
+ }
+
+ function add_completion_callback(callback)
+ {
+ tests.all_done_callbacks.push(callback);
+ }
+
+ expose(add_start_callback, 'add_start_callback');
+ expose(add_test_state_callback, 'add_test_state_callback');
+ expose(add_result_callback, 'add_result_callback');
+ expose(add_completion_callback, 'add_completion_callback');
+
+ /*
+ * Output listener
+ */
+
+ function Output() {
+ this.output_document = document;
+ this.output_node = null;
+ this.enabled = settings.output;
+ this.phase = this.INITIAL;
+ }
+
+ Output.prototype.INITIAL = 0;
+ Output.prototype.STARTED = 1;
+ Output.prototype.HAVE_RESULTS = 2;
+ Output.prototype.COMPLETE = 3;
+
+ Output.prototype.setup = function(properties) {
+ if (this.phase > this.INITIAL) {
+ return;
+ }
+
+ //If output is disabled in testharnessreport.js the test shouldn't be
+ //able to override that
+ this.enabled = this.enabled && (properties.hasOwnProperty("output") ?
+ properties.output : settings.output);
+ };
+
+ Output.prototype.init = function(properties) {
+ if (this.phase >= this.STARTED) {
+ return;
+ }
+ if (properties.output_document) {
+ this.output_document = properties.output_document;
+ } else {
+ this.output_document = document;
+ }
+ this.phase = this.STARTED;
+ };
+
+ Output.prototype.resolve_log = function() {
+ var output_document;
+ if (typeof this.output_document === "function") {
+ output_document = this.output_document.apply(undefined);
+ } else {
+ output_document = this.output_document;
+ }
+ if (!output_document) {
+ return;
+ }
+ var node = output_document.getElementById("log");
+ if (!node) {
+ if (!document.body || document.readyState == "loading") {
+ return;
+ }
+ node = output_document.createElement("div");
+ node.id = "log";
+ output_document.body.appendChild(node);
+ }
+ this.output_document = output_document;
+ this.output_node = node;
+ };
+
+ Output.prototype.show_status = function() {
+ if (this.phase < this.STARTED) {
+ this.init();
+ }
+ if (!this.enabled) {
+ return;
+ }
+ if (this.phase < this.HAVE_RESULTS) {
+ this.resolve_log();
+ this.phase = this.HAVE_RESULTS;
+ }
+ var done_count = tests.tests.length - tests.num_pending;
+ if (this.output_node) {
+ if (done_count < 100 ||
+ (done_count < 1000 && done_count % 100 === 0) ||
+ done_count % 1000 === 0) {
+ this.output_node.textContent = "Running, " +
+ done_count + " complete, " +
+ tests.num_pending + " remain";
+ }
+ }
+ };
+
+ Output.prototype.show_results = function (tests, harness_status) {
+ if (this.phase >= this.COMPLETE) {
+ return;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ if (!this.output_node) {
+ this.resolve_log();
+ }
+ this.phase = this.COMPLETE;
+
+ var log = this.output_node;
+ if (!log) {
+ return;
+ }
+ var output_document = this.output_document;
+
+ while (log.lastChild) {
+ log.removeChild(log.lastChild);
+ }
+
+ var script_prefix = null;
+ var scripts = document.getElementsByTagName("script");
+ for (var i = 0; i < scripts.length; i++) {
+ var src;
+ if (scripts[i].src) {
+ src = scripts[i].src;
+ } else if (scripts[i].href) {
+ //SVG case
+ src = scripts[i].href.baseVal;
+ }
+
+ var matches = src && src.match(/^(.*\/|)testharness\.js$/);
+ if (matches) {
+ script_prefix = matches[1];
+ break;
+ }
+ }
+
+ if (script_prefix !== null) {
+ var stylesheet = output_document.createElementNS(xhtml_ns, "link");
+ stylesheet.setAttribute("rel", "stylesheet");
+ stylesheet.setAttribute("href", script_prefix + "testharness.css");
+ var heads = output_document.getElementsByTagName("head");
+ if (heads.length) {
+ heads[0].appendChild(stylesheet);
+ }
+ }
+
+ var status_text_harness = {};
+ status_text_harness[harness_status.OK] = "OK";
+ status_text_harness[harness_status.ERROR] = "Error";
+ status_text_harness[harness_status.TIMEOUT] = "Timeout";
+
+ var status_text = {};
+ status_text[Test.prototype.PASS] = "Pass";
+ status_text[Test.prototype.FAIL] = "Fail";
+ status_text[Test.prototype.TIMEOUT] = "Timeout";
+ status_text[Test.prototype.NOTRUN] = "Not Run";
+
+ var status_number = {};
+ forEach(tests,
+ function(test) {
+ var status = status_text[test.status];
+ if (status_number.hasOwnProperty(status)) {
+ status_number[status] += 1;
+ } else {
+ status_number[status] = 1;
+ }
+ });
+
+ function status_class(status)
+ {
+ return status.replace(/\s/g, '').toLowerCase();
+ }
+
+ var summary_template = ["section", {"id":"summary"},
+ ["h2", {}, "Summary"],
+ function()
+ {
+
+ var status = status_text_harness[harness_status.status];
+ var rv = [["section", {},
+ ["p", {},
+ "Harness status: ",
+ ["span", {"class":status_class(status)},
+ status
+ ],
+ ]
+ ]];
+
+ if (harness_status.status === harness_status.ERROR) {
+ rv[0].push(["pre", {}, harness_status.message]);
+ }
+ return rv;
+ },
+ ["p", {}, "Found ${num_tests} tests"],
+ function() {
+ var rv = [["div", {}]];
+ var i = 0;
+ while (status_text.hasOwnProperty(i)) {
+ if (status_number.hasOwnProperty(status_text[i])) {
+ var status = status_text[i];
+ rv[0].push(["div", {"class":status_class(status)},
+ ["label", {},
+ ["input", {type:"checkbox", checked:"checked"}],
+ status_number[status] + " " + status]]);
+ }
+ i++;
+ }
+ return rv;
+ },
+ ];
+
+ log.appendChild(render(summary_template, {num_tests:tests.length}, output_document));
+
+ forEach(output_document.querySelectorAll("section#summary label"),
+ function(element)
+ {
+ on_event(element, "click",
+ function(e)
+ {
+ if (output_document.getElementById("results") === null) {
+ e.preventDefault();
+ return;
+ }
+ var result_class = element.parentNode.getAttribute("class");
+ var style_element = output_document.querySelector("style#hide-" + result_class);
+ var input_element = element.querySelector("input");
+ if (!style_element && !input_element.checked) {
+ style_element = output_document.createElementNS(xhtml_ns, "style");
+ style_element.id = "hide-" + result_class;
+ style_element.textContent = "table#results > tbody > tr."+result_class+"{display:none}";
+ output_document.body.appendChild(style_element);
+ } else if (style_element && input_element.checked) {
+ style_element.parentNode.removeChild(style_element);
+ }
+ });
+ });
+
+ // This use of innerHTML plus manual escaping is not recommended in
+ // general, but is necessary here for performance. Using textContent
+ // on each individual <td> adds tens of seconds of execution time for
+ // large test suites (tens of thousands of tests).
+ function escape_html(s)
+ {
+ return s.replace(/\&/g, "&")
+ .replace(/</g, "<")
+ .replace(/"/g, """)
+ .replace(/'/g, "'");
+ }
+
+ function has_assertions()
+ {
+ for (var i = 0; i < tests.length; i++) {
+ if (tests[i].properties.hasOwnProperty("assert")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ function get_assertion(test)
+ {
+ if (test.properties.hasOwnProperty("assert")) {
+ if (Array.isArray(test.properties.assert)) {
+ return test.properties.assert.join(' ');
+ }
+ return test.properties.assert;
+ }
+ return '';
+ }
+
+ log.appendChild(document.createElementNS(xhtml_ns, "section"));
+ var assertions = has_assertions();
+ var html = "<h2>Details</h2><table id='results' " + (assertions ? "class='assertions'" : "" ) + ">" +
+ "<thead><tr><th>Result</th><th>Test Name</th>" +
+ (assertions ? "<th>Assertion</th>" : "") +
+ "<th>Message</th></tr></thead>" +
+ "<tbody>";
+ for (var i = 0; i < tests.length; i++) {
+ html += '<tr class="' +
+ escape_html(status_class(status_text[tests[i].status])) +
+ '"><td>' +
+ escape_html(status_text[tests[i].status]) +
+ "</td><td>" +
+ escape_html(tests[i].name) +
+ "</td><td>" +
+ (assertions ? escape_html(get_assertion(tests[i])) + "</td><td>" : "") +
+ escape_html(tests[i].message ? tests[i].message : " ") +
+ "</td></tr>";
+ }
+ html += "</tbody></table>";
+ try {
+ log.lastChild.innerHTML = html;
+ } catch (e) {
+ log.appendChild(document.createElementNS(xhtml_ns, "p"))
+ .textContent = "Setting innerHTML for the log threw an exception.";
+ log.appendChild(document.createElementNS(xhtml_ns, "pre"))
+ .textContent = html;
+ }
+ };
+
+ /*
+ * Template code
+ *
+ * A template is just a javascript structure. An element is represented as:
+ *
+ * [tag_name, {attr_name:attr_value}, child1, child2]
+ *
+ * the children can either be strings (which act like text nodes), other templates or
+ * functions (see below)
+ *
+ * A text node is represented as
+ *
+ * ["{text}", value]
+ *
+ * String values have a simple substitution syntax; ${foo} represents a variable foo.
+ *
+ * It is possible to embed logic in templates by using a function in a place where a
+ * node would usually go. The function must either return part of a template or null.
+ *
+ * In cases where a set of nodes are required as output rather than a single node
+ * with children it is possible to just use a list
+ * [node1, node2, node3]
+ *
+ * Usage:
+ *
+ * render(template, substitutions) - take a template and an object mapping
+ * variable names to parameters and return either a DOM node or a list of DOM nodes
+ *
+ * substitute(template, substitutions) - take a template and variable mapping object,
+ * make the variable substitutions and return the substituted template
+ *
+ */
+
+ function is_single_node(template)
+ {
+ return typeof template[0] === "string";
+ }
+
+ function substitute(template, substitutions)
+ {
+ if (typeof template === "function") {
+ var replacement = template(substitutions);
+ if (!replacement) {
+ return null;
+ }
+
+ return substitute(replacement, substitutions);
+ }
+
+ if (is_single_node(template)) {
+ return substitute_single(template, substitutions);
+ }
+
+ return filter(map(template, function(x) {
+ return substitute(x, substitutions);
+ }), function(x) {return x !== null;});
+ }
+
+ function substitute_single(template, substitutions)
+ {
+ var substitution_re = /\$\{([^ }]*)\}/g;
+
+ function do_substitution(input) {
+ var components = input.split(substitution_re);
+ var rv = [];
+ for (var i = 0; i < components.length; i += 2) {
+ rv.push(components[i]);
+ if (components[i + 1]) {
+ rv.push(String(substitutions[components[i + 1]]));
+ }
+ }
+ return rv;
+ }
+
+ function substitute_attrs(attrs, rv)
+ {
+ rv[1] = {};
+ for (var name in template[1]) {
+ if (attrs.hasOwnProperty(name)) {
+ var new_name = do_substitution(name).join("");
+ var new_value = do_substitution(attrs[name]).join("");
+ rv[1][new_name] = new_value;
+ }
+ }
+ }
+
+ function substitute_children(children, rv)
+ {
+ for (var i = 0; i < children.length; i++) {
+ if (children[i] instanceof Object) {
+ var replacement = substitute(children[i], substitutions);
+ if (replacement !== null) {
+ if (is_single_node(replacement)) {
+ rv.push(replacement);
+ } else {
+ extend(rv, replacement);
+ }
+ }
+ } else {
+ extend(rv, do_substitution(String(children[i])));
+ }
+ }
+ return rv;
+ }
+
+ var rv = [];
+ rv.push(do_substitution(String(template[0])).join(""));
+
+ if (template[0] === "{text}") {
+ substitute_children(template.slice(1), rv);
+ } else {
+ substitute_attrs(template[1], rv);
+ substitute_children(template.slice(2), rv);
+ }
+
+ return rv;
+ }
+
+ function make_dom_single(template, doc)
+ {
+ var output_document = doc || document;
+ var element;
+ if (template[0] === "{text}") {
+ element = output_document.createTextNode("");
+ for (var i = 1; i < template.length; i++) {
+ element.data += template[i];
+ }
+ } else {
+ element = output_document.createElementNS(xhtml_ns, template[0]);
+ for (var name in template[1]) {
+ if (template[1].hasOwnProperty(name)) {
+ element.setAttribute(name, template[1][name]);
+ }
+ }
+ for (var i = 2; i < template.length; i++) {
+ if (template[i] instanceof Object) {
+ var sub_element = make_dom(template[i]);
+ element.appendChild(sub_element);
+ } else {
+ var text_node = output_document.createTextNode(template[i]);
+ element.appendChild(text_node);
+ }
+ }
+ }
+
+ return element;
+ }
+
+ function make_dom(template, substitutions, output_document)
+ {
+ if (is_single_node(template)) {
+ return make_dom_single(template, output_document);
+ }
+
+ return map(template, function(x) {
+ return make_dom_single(x, output_document);
+ });
+ }
+
+ function render(template, substitutions, output_document)
+ {
+ return make_dom(substitute(template, substitutions), output_document);
+ }
+
+ /*
+ * Utility funcions
+ */
+ function assert(expected_true, function_name, description, error, substitutions)
+ {
+ if (tests.tests.length === 0) {
+ tests.set_file_is_test();
+ }
+ if (expected_true !== true) {
+ var msg = make_message(function_name, description,
+ error, substitutions);
+ throw new AssertionError(msg);
+ }
+ }
+
+ function AssertionError(message)
+ {
+ this.message = message;
+ }
+
+ AssertionError.prototype.toString = function() {
+ return this.message;
+ };
+
+ function make_message(function_name, description, error, substitutions)
+ {
+ for (var p in substitutions) {
+ if (substitutions.hasOwnProperty(p)) {
+ substitutions[p] = format_value(substitutions[p]);
+ }
+ }
+ var node_form = substitute(["{text}", "${function_name}: ${description}" + error],
+ merge({function_name:function_name,
+ description:(description?description + " ":"")},
+ substitutions));
+ return node_form.slice(1).join("");
+ }
+
+ function filter(array, callable, thisObj) {
+ var rv = [];
+ for (var i = 0; i < array.length; i++) {
+ if (array.hasOwnProperty(i)) {
+ var pass = callable.call(thisObj, array[i], i, array);
+ if (pass) {
+ rv.push(array[i]);
+ }
+ }
+ }
+ return rv;
+ }
+
+ function map(array, callable, thisObj)
+ {
+ var rv = [];
+ rv.length = array.length;
+ for (var i = 0; i < array.length; i++) {
+ if (array.hasOwnProperty(i)) {
+ rv[i] = callable.call(thisObj, array[i], i, array);
+ }
+ }
+ return rv;
+ }
+
+ function extend(array, items)
+ {
+ Array.prototype.push.apply(array, items);
+ }
+
+ function forEach (array, callback, thisObj)
+ {
+ for (var i = 0; i < array.length; i++) {
+ if (array.hasOwnProperty(i)) {
+ callback.call(thisObj, array[i], i, array);
+ }
+ }
+ }
+
+ function merge(a,b)
+ {
+ var rv = {};
+ var p;
+ for (p in a) {
+ rv[p] = a[p];
+ }
+ for (p in b) {
+ rv[p] = b[p];
+ }
+ return rv;
+ }
+
+ function expose(object, name)
+ {
+ var components = name.split(".");
+ var target = test_environment.global_scope();
+ for (var i = 0; i < components.length - 1; i++) {
+ if (!(components[i] in target)) {
+ target[components[i]] = {};
+ }
+ target = target[components[i]];
+ }
+ target[components[components.length - 1]] = object;
+ }
+
+ function is_same_origin(w) {
+ try {
+ 'random_prop' in w;
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+
+ function supports_post_message(w)
+ {
+ var supports;
+ var type;
+ // Given IE implements postMessage across nested iframes but not across
+ // windows or tabs, you can't infer cross-origin communication from the presence
+ // of postMessage on the current window object only.
+ //
+ // Touching the postMessage prop on a window can throw if the window is
+ // not from the same origin AND post message is not supported in that
+ // browser. So just doing an existence test here won't do, you also need
+ // to wrap it in a try..cacth block.
+ try {
+ type = typeof w.postMessage;
+ if (type === "function") {
+ supports = true;
+ }
+
+ // IE8 supports postMessage, but implements it as a host object which
+ // returns "object" as its `typeof`.
+ else if (type === "object") {
+ supports = true;
+ }
+
+ // This is the case where postMessage isn't supported AND accessing a
+ // window property across origins does NOT throw (e.g. old Safari browser).
+ else {
+ supports = false;
+ }
+ } catch (e) {
+ // This is the case where postMessage isn't supported AND accessing a
+ // window property across origins throws (e.g. old Firefox browser).
+ supports = false;
+ }
+ return supports;
+ }
+
+ /**
+ * Setup globals
+ */
+
+ var tests = new Tests();
+
+ addEventListener("error", function(e) {
+ if (tests.file_is_test) {
+ var test = tests.tests[0];
+ if (test.phase >= test.phases.HAS_RESULT) {
+ return;
+ }
+ var message = e.message;
+ test.set_status(test.FAIL, message);
+ test.phase = test.phases.HAS_RESULT;
+ test.done();
+ done();
+ } else if (!tests.allow_uncaught_exception) {
+ tests.status.status = tests.status.ERROR;
+ tests.status.message = e.message;
+ }
+ });
+
+ test_environment.on_tests_ready();
+
+})();
+// vim: set expandtab shiftwidth=4 tabstop=4:
--- /dev/null
+/*global add_completion_callback, setup */
+/*
+ * This file is intended for vendors to implement
+ * code needed to integrate testharness.js tests with their own test systems.
+ *
+ * The default implementation extracts metadata from the tests and validates
+ * it against the cached version that should be present in the test source
+ * file. If the cache is not found or is out of sync, source code suitable for
+ * caching the metadata is optionally generated.
+ *
+ * The cached metadata is present for extraction by test processing tools that
+ * are unable to execute javascript.
+ *
+ * Metadata is attached to tests via the properties parameter in the test
+ * constructor. See testharness.js for details.
+ *
+ * Typically test system integration will attach callbacks when each test has
+ * run, using add_result_callback(callback(test)), or when the whole test file
+ * has completed, using
+ * add_completion_callback(callback(tests, harness_status)).
+ *
+ * For more documentation about the callback functions and the
+ * parameters they are called with see testharness.js
+ */
+
+
+
+var metadata_generator = {
+
+ currentMetadata: {},
+ cachedMetadata: false,
+ metadataProperties: ['help', 'assert', 'author'],
+
+ error: function(message) {
+ var messageElement = document.createElement('p');
+ messageElement.setAttribute('class', 'error');
+ this.appendText(messageElement, message);
+
+ var summary = document.getElementById('summary');
+ if (summary) {
+ summary.parentNode.insertBefore(messageElement, summary);
+ }
+ else {
+ document.body.appendChild(messageElement);
+ }
+ },
+
+ /**
+ * Ensure property value has contact information
+ */
+ validateContact: function(test, propertyName) {
+ var result = true;
+ var value = test.properties[propertyName];
+ var values = Array.isArray(value) ? value : [value];
+ for (var index = 0; index < values.length; index++) {
+ value = values[index];
+ var re = /(\S+)(\s*)<(.*)>(.*)/;
+ if (! re.test(value)) {
+ re = /(\S+)(\s+)(http[s]?:\/\/)(.*)/;
+ if (! re.test(value)) {
+ this.error('Metadata property "' + propertyName +
+ '" for test: "' + test.name +
+ '" must have name and contact information ' +
+ '("name <email>" or "name http(s)://")');
+ result = false;
+ }
+ }
+ }
+ return result;
+ },
+
+ /**
+ * Extract metadata from test object
+ */
+ extractFromTest: function(test) {
+ var testMetadata = {};
+ // filter out metadata from other properties in test
+ for (var metaIndex = 0; metaIndex < this.metadataProperties.length;
+ metaIndex++) {
+ var meta = this.metadataProperties[metaIndex];
+ if (test.properties.hasOwnProperty(meta)) {
+ if ('author' == meta) {
+ this.validateContact(test, meta);
+ }
+ testMetadata[meta] = test.properties[meta];
+ }
+ }
+ return testMetadata;
+ },
+
+ /**
+ * Compare cached metadata to extracted metadata
+ */
+ validateCache: function() {
+ for (var testName in this.currentMetadata) {
+ if (! this.cachedMetadata.hasOwnProperty(testName)) {
+ return false;
+ }
+ var testMetadata = this.currentMetadata[testName];
+ var cachedTestMetadata = this.cachedMetadata[testName];
+ delete this.cachedMetadata[testName];
+
+ for (var metaIndex = 0; metaIndex < this.metadataProperties.length;
+ metaIndex++) {
+ var meta = this.metadataProperties[metaIndex];
+ if (cachedTestMetadata.hasOwnProperty(meta) &&
+ testMetadata.hasOwnProperty(meta)) {
+ if (Array.isArray(cachedTestMetadata[meta])) {
+ if (! Array.isArray(testMetadata[meta])) {
+ return false;
+ }
+ if (cachedTestMetadata[meta].length ==
+ testMetadata[meta].length) {
+ for (var index = 0;
+ index < cachedTestMetadata[meta].length;
+ index++) {
+ if (cachedTestMetadata[meta][index] !=
+ testMetadata[meta][index]) {
+ return false;
+ }
+ }
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ if (Array.isArray(testMetadata[meta])) {
+ return false;
+ }
+ if (cachedTestMetadata[meta] != testMetadata[meta]) {
+ return false;
+ }
+ }
+ }
+ else if (cachedTestMetadata.hasOwnProperty(meta) ||
+ testMetadata.hasOwnProperty(meta)) {
+ return false;
+ }
+ }
+ }
+ for (var testName in this.cachedMetadata) {
+ return false;
+ }
+ return true;
+ },
+
+ appendText: function(elemement, text) {
+ elemement.appendChild(document.createTextNode(text));
+ },
+
+ jsonifyArray: function(arrayValue, indent) {
+ var output = '[';
+
+ if (1 == arrayValue.length) {
+ output += JSON.stringify(arrayValue[0]);
+ }
+ else {
+ for (var index = 0; index < arrayValue.length; index++) {
+ if (0 < index) {
+ output += ',\n ' + indent;
+ }
+ output += JSON.stringify(arrayValue[index]);
+ }
+ }
+ output += ']';
+ return output;
+ },
+
+ jsonifyObject: function(objectValue, indent) {
+ var output = '{';
+ var value;
+
+ var count = 0;
+ for (var property in objectValue) {
+ ++count;
+ if (Array.isArray(objectValue[property]) ||
+ ('object' == typeof(value))) {
+ ++count;
+ }
+ }
+ if (1 == count) {
+ for (var property in objectValue) {
+ output += ' "' + property + '": ' +
+ JSON.stringify(objectValue[property]) +
+ ' ';
+ }
+ }
+ else {
+ var first = true;
+ for (var property in objectValue) {
+ if (! first) {
+ output += ',';
+ }
+ first = false;
+ output += '\n ' + indent + '"' + property + '": ';
+ value = objectValue[property];
+ if (Array.isArray(value)) {
+ output += this.jsonifyArray(value, indent +
+ ' '.substr(0, 5 + property.length));
+ }
+ else if ('object' == typeof(value)) {
+ output += this.jsonifyObject(value, indent + ' ');
+ }
+ else {
+ output += JSON.stringify(value);
+ }
+ }
+ if (1 < output.length) {
+ output += '\n' + indent;
+ }
+ }
+ output += '}';
+ return output;
+ },
+
+ /**
+ * Generate javascript source code for captured metadata
+ * Metadata is in pretty-printed JSON format
+ */
+ generateSource: function() {
+ var source =
+ '<script id="metadata_cache">/*\n' +
+ this.jsonifyObject(this.currentMetadata, '') + '\n' +
+ '*/</script>\n';
+ return source;
+ },
+
+ /**
+ * Add element containing metadata source code
+ */
+ addSourceElement: function(event) {
+ var sourceWrapper = document.createElement('div');
+ sourceWrapper.setAttribute('id', 'metadata_source');
+
+ var instructions = document.createElement('p');
+ if (this.cachedMetadata) {
+ this.appendText(instructions,
+ 'Replace the existing <script id="metadata_cache"> element ' +
+ 'in the test\'s <head> with the following:');
+ }
+ else {
+ this.appendText(instructions,
+ 'Copy the following into the <head> element of the test ' +
+ 'or the test\'s metadata sidecar file:');
+ }
+ sourceWrapper.appendChild(instructions);
+
+ var sourceElement = document.createElement('pre');
+ this.appendText(sourceElement, this.generateSource());
+
+ sourceWrapper.appendChild(sourceElement);
+
+ var messageElement = document.getElementById('metadata_issue');
+ messageElement.parentNode.insertBefore(sourceWrapper,
+ messageElement.nextSibling);
+ messageElement.parentNode.removeChild(messageElement);
+
+ (event.preventDefault) ? event.preventDefault() :
+ event.returnValue = false;
+ },
+
+ /**
+ * Extract the metadata cache from the cache element if present
+ */
+ getCachedMetadata: function() {
+ var cacheElement = document.getElementById('metadata_cache');
+
+ if (cacheElement) {
+ var cacheText = cacheElement.firstChild.nodeValue;
+ var openBrace = cacheText.indexOf('{');
+ var closeBrace = cacheText.lastIndexOf('}');
+ if ((-1 < openBrace) && (-1 < closeBrace)) {
+ cacheText = cacheText.slice(openBrace, closeBrace + 1);
+ try {
+ this.cachedMetadata = JSON.parse(cacheText);
+ }
+ catch (exc) {
+ this.cachedMetadata = 'Invalid JSON in Cached metadata. ';
+ }
+ }
+ else {
+ this.cachedMetadata = 'Metadata not found in cache element. ';
+ }
+ }
+ },
+
+ /**
+ * Main entry point, extract metadata from tests, compare to cached version
+ * if present.
+ * If cache not present or differs from extrated metadata, generate an error
+ */
+ process: function(tests) {
+ for (var index = 0; index < tests.length; index++) {
+ var test = tests[index];
+ if (this.currentMetadata.hasOwnProperty(test.name)) {
+ this.error('Duplicate test name: ' + test.name);
+ }
+ else {
+ this.currentMetadata[test.name] = this.extractFromTest(test);
+ }
+ }
+
+ this.getCachedMetadata();
+
+ var message = null;
+ var messageClass = 'warning';
+ var showSource = false;
+
+ if (0 === tests.length) {
+ if (this.cachedMetadata) {
+ message = 'Cached metadata present but no tests. ';
+ }
+ }
+ else if (1 === tests.length) {
+ if (this.cachedMetadata) {
+ message = 'Single test files should not have cached metadata. ';
+ }
+ else {
+ var testMetadata = this.currentMetadata[tests[0].name];
+ for (var meta in testMetadata) {
+ if (testMetadata.hasOwnProperty(meta)) {
+ message = 'Single tests should not have metadata. ' +
+ 'Move metadata to <head>. ';
+ break;
+ }
+ }
+ }
+ }
+ else {
+ if (this.cachedMetadata) {
+ messageClass = 'error';
+ if ('string' == typeof(this.cachedMetadata)) {
+ message = this.cachedMetadata;
+ showSource = true;
+ }
+ else if (! this.validateCache()) {
+ message = 'Cached metadata out of sync. ';
+ showSource = true;
+ }
+ }
+ }
+
+ if (message) {
+ var messageElement = document.createElement('p');
+ messageElement.setAttribute('id', 'metadata_issue');
+ messageElement.setAttribute('class', messageClass);
+ this.appendText(messageElement, message);
+
+ if (showSource) {
+ var link = document.createElement('a');
+ this.appendText(link, 'Click for source code.');
+ link.setAttribute('href', '#');
+ link.setAttribute('onclick',
+ 'metadata_generator.addSourceElement(event)');
+ messageElement.appendChild(link);
+ }
+
+ var summary = document.getElementById('summary');
+ if (summary) {
+ summary.parentNode.insertBefore(messageElement, summary);
+ }
+ else {
+ var log = document.getElementById('log');
+ if (log) {
+ log.appendChild(messageElement);
+ }
+ }
+ }
+ },
+
+ setup: function() {
+ add_completion_callback(
+ function (tests, harness_status) {
+ metadata_generator.process(tests, harness_status);
+ });
+ }
+};
+
+metadata_generator.setup();
+
+/* If the parent window has a testharness_properties object,
+ * we use this to provide the test settings. This is used by the
+ * default in-browser runner to configure the timeout and the
+ * rendering of results
+ */
+try {
+ if (window.opener && "testharness_properties" in window.opener) {
+ /* If we pass the testharness_properties object as-is here without
+ * JSON stringifying and reparsing it, IE fails & emits the message
+ * "Could not complete the operation due to error 80700019".
+ */
+ setup(JSON.parse(JSON.stringify(window.opener.testharness_properties)));
+ }
+} catch (e) {
+}
+// vim: set expandtab shiftwidth=4 tabstop=4:
--- /dev/null
+{
+ "pkg-blacklist": [
+ "config.xml",
+ "pack.py",
+ "testcase.xsl",
+ "testresult.xsl",
+ "tests.css",
+ "icon.png",
+ "manifest.json",
+ "suite.json",
+ "inst.*"
+ ],
+ "pkg-list": {
+ "wgt": {
+ "blacklist": ["*"],
+ "copylist": {
+ "inst.wgt.py": "inst.py",
+ "media": "media",
+ "askpolicy.sh": "askpolicy.sh",
+ "tests.full.xml": "tests.full.xml",
+ "tests.xml": "tests.xml"
+ },
+ "pkg-app": {
+ "blacklist": [],
+ "sign-flag": "true"
+ }
+ }
+ },
+ "pkg-name": "tct-mlsingleshot-tizen-tests"
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="html" version="1.0" encoding="UTF-8"
+ indent="yes" />
+ <xsl:template match="/">
+ <html>
+ <STYLE type="text/css">
+ @import "tests.css";
+ </STYLE>
+
+ <body>
+ <div id="testcasepage">
+ <div id="title">
+ <table>
+ <tr>
+ <td>
+ <h1>Test Cases</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="suites">
+ <table>
+ <tr>
+ <th>Test Suite</th>
+ <th>Total</th>
+ <th>Auto</th>
+ <th>Manual</th>
+ </tr>
+ <tr>
+ <td>
+ Total
+ </td>
+ <td>
+ <xsl:value-of select="count(test_definition/suite/set//testcase)" />
+ </td>
+ <td>
+ <xsl:value-of
+ select="count(test_definition/suite/set//testcase[@execution_type = 'auto'])" />
+ </td>
+ <td>
+ <xsl:value-of
+ select="count(test_definition/suite/set//testcase[@execution_type != 'auto'])" />
+ </td>
+ </tr>
+ <xsl:for-each select="test_definition/suite">
+ <tr>
+ <td>
+ <xsl:value-of select="@name" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set//testcase)" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set/testcase[@execution_type = 'auto'])" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set/testcase[@execution_type != 'auto'])" />
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </div>
+ <div id="title">
+ <table>
+ <tr>
+ <td class="title">
+ <h1>Detailed Test Cases</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="cases">
+ <xsl:for-each select="test_definition/suite">
+ <xsl:sort select="@name" />
+ <p>
+ Test Suite:
+ <xsl:value-of select="@name" />
+ </p>
+ <table>
+ <tr>
+ <th>Case_ID</th>
+ <th>Purpose</th>
+ <th>Type</th>
+ <th>Component</th>
+ <th>Execution Type</th>
+ <th>Description</th>
+ <th>Specification</th>
+ </tr>
+ <xsl:for-each select=".//set">
+ <xsl:sort select="@name" />
+ <tr>
+ <td colspan="7">
+ Test Set:
+ <xsl:value-of select="@name" />
+ </td>
+ </tr>
+ <xsl:for-each select=".//testcase">
+ <xsl:sort select="@id" />
+ <tr>
+ <td>
+ <xsl:value-of select="@id" />
+ </td>
+ <td>
+ <xsl:value-of select="@purpose" />
+ </td>
+ <td>
+ <xsl:value-of select="@type" />
+ </td>
+ <td>
+ <xsl:value-of select="@component" />
+ </td>
+ <td>
+ <xsl:value-of select="@execution_type" />
+ </td>
+ <td>
+ <p>
+ Pre_condition:
+ <xsl:value-of select=".//description/pre_condition" />
+ </p>
+ <p>
+ Post_condition:
+ <xsl:value-of select=".//description/post_condition" />
+ </p>
+ <p>
+ Test Script Entry:
+ <xsl:value-of select=".//description/test_script_entry" />
+ </p>
+ <p>
+ Steps:
+ <p />
+ <xsl:for-each select=".//description/steps/step">
+ <xsl:sort select="@order" />
+ Step
+ <xsl:value-of select="@order" />
+ :
+ <xsl:value-of select="./step_desc" />
+ ;
+ <p />
+ Expected Result:
+ <xsl:value-of select="./expected" />
+ <p />
+ </xsl:for-each>
+ </p>
+ </td>
+ <td>
+ <xsl:call-template name="br-replace">
+ <xsl:with-param name="word" select=".//spec" />
+ </xsl:call-template>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+ </table>
+ </xsl:for-each>
+ </div>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+ <xsl:template name="br-replace">
+ <xsl:param name="word" />
+ <xsl:variable name="cr">
+ <xsl:text>
+</xsl:text>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($word,$cr)">
+ <xsl:value-of select="substring-before($word,$cr)" />
+ <br />
+ <xsl:call-template name="br-replace">
+ <xsl:with-param name="word" select="substring-after($word,$cr)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$word" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="html" version="1.0" encoding="UTF-8"
+ indent="yes" />
+ <xsl:template match="/">
+ <html>
+ <STYLE type="text/css">
+ @import "tests.css";
+ </STYLE>
+
+ <body>
+ <div id="testcasepage">
+ <div id="title">
+ <table>
+ <tr>
+ <td>
+ <h1>Test Report</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="device">
+ <table>
+ <tr>
+ <th colspan="2">Device Information</th>
+ </tr>
+ <tr>
+ <td>Device Name</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@device_name" />
+ </td>
+ </tr>
+ <tr>
+ <td>Device Model</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@device_model" />
+ </td>
+ </tr>
+ <tr>
+ <td>OS Version</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@os_version" />
+ </td>
+ </tr>
+ <tr>
+ <td>Device ID</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@device_id" />
+ </td>
+ </tr>
+ <tr>
+ <td>Firmware Version</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@firmware_version" />
+ </td>
+ </tr>
+ <tr>
+ <td>Screen Size</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@screen_size" />
+ </td>
+ </tr>
+ <tr>
+ <td>Resolution</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@resolution" />
+ </td>
+ </tr>
+ <tr>
+ <td>Host Info</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/@host" />
+ </td>
+ </tr>
+ <tr>
+ <td>Others</td>
+ <td>
+ <xsl:value-of select="test_definition/environment/other" />
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div id="summary">
+ <table>
+ <tr>
+ <th colspan="2">Test Summary</th>
+ </tr>
+ <tr>
+ <td>Test Plan Name</td>
+ <td>
+ <xsl:value-of select="test_definition/summary/@test_plan_name" />
+ </td>
+ </tr>
+ <tr>
+ <td>Tests Total</td>
+ <td>
+ <xsl:value-of select="count(test_definition//suite/set/testcase)" />
+ </td>
+ </tr>
+ <tr>
+ <td>Test Passed</td>
+ <td>
+ <xsl:value-of
+ select="count(test_definition//suite/set/testcase[@result = 'PASS'])" />
+ </td>
+ </tr>
+ <tr>
+ <td>Test Failed</td>
+ <td>
+ <xsl:value-of
+ select="count(test_definition//suite/set/testcase[@result = 'FAIL'])" />
+ </td>
+ </tr>
+ <tr>
+ <td>Test N/A</td>
+ <td>
+ <xsl:value-of
+ select="count(test_definition//suite/set/testcase[@result = 'BLOCK'])" />
+ </td>
+ </tr>
+ <tr>
+ <td>Test Not Run</td>
+ <td>
+ <xsl:value-of
+ select="count(test_definition//suite/set/testcase) - count(test_definition//suite/set/testcase[@result = 'PASS']) - count(test_definition//suite/set/testcase[@result = 'FAIL']) - count(test_definition//suite/set/testcase[@result = 'BLOCK'])" />
+ </td>
+ </tr>
+ <tr>
+ <td>Start time</td>
+ <td>
+ <xsl:value-of select="test_definition/summary/start_at" />
+ </td>
+ </tr>
+ <tr>
+ <td>End time</td>
+ <td>
+ <xsl:value-of select="test_definition/summary/end_at" />
+ </td>
+ </tr>
+ </table>
+ </div>
+
+
+ <div id="suite_summary">
+ <div id="title">
+ <table>
+ <tr>
+ <td class="title">
+ <h1>Test Summary by Suite</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <table>
+ <tr>
+ <th>Suite</th>
+ <th>Passed</th>
+ <th>Failed</th>
+ <th>N/A</th>
+ <th>Not Run</th>
+ <th>Total</th>
+ </tr>
+ <xsl:for-each select="test_definition/suite">
+ <xsl:sort select="@name" />
+ <tr>
+ <td>
+ <xsl:value-of select="@name" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set//testcase[@result = 'PASS'])" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set//testcase[@result = 'FAIL'])" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set//testcase[@result = 'BLOCK'])" />
+ </td>
+ <td>
+ <xsl:value-of
+ select="count(set//testcase) - count(set//testcase[@result = 'PASS']) - count(set//testcase[@result = 'FAIL']) - count(set//testcase[@result = 'BLOCK'])" />
+ </td>
+ <td>
+ <xsl:value-of select="count(set//testcase)" />
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </div>
+
+ <div id="cases">
+ <div id="title">
+ <table>
+ <tr>
+ <td class="title">
+ <h1 align="center">Detailed Test Results</h1>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <xsl:for-each select="test_definition/suite">
+ <xsl:sort select="@name" />
+ <p>
+ Test Suite:
+ <xsl:value-of select="@name" />
+ </p>
+ <table>
+ <tr>
+ <th>Case_ID</th>
+ <th>Purpose</th>
+ <th>Result</th>
+ <th>Stdout</th>
+ </tr>
+ <xsl:for-each select=".//set">
+ <xsl:sort select="@name" />
+ <tr>
+ <td colspan="4">
+ Test Set:
+ <xsl:value-of select="@name" />
+ </td>
+ </tr>
+ <xsl:for-each select=".//testcase">
+ <xsl:sort select="@id" />
+ <tr>
+ <td>
+ <xsl:value-of select="@id" />
+ </td>
+ <td>
+ <xsl:value-of select="@purpose" />
+ </td>
+
+ <xsl:choose>
+ <xsl:when test="@result">
+ <xsl:if test="@result = 'FAIL'">
+ <td class="red_rate">
+ <xsl:value-of select="@result" />
+ </td>
+ </xsl:if>
+ <xsl:if test="@result = 'PASS'">
+ <td class="green_rate">
+ <xsl:value-of select="@result" />
+ </td>
+ </xsl:if>
+ <xsl:if test="@result = 'BLOCK' ">
+ <td>
+ BLOCK
+ </td>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <td>
+
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ <td>
+ <xsl:value-of select=".//result_info/stdout" />
+ <xsl:if test=".//result_info/stdout = ''">
+ N/A
+ </xsl:if>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:for-each>
+ </table>
+ </xsl:for-each>
+ </div>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="./testcase.xsl"?>
+<test_definition>
+ <suite name="tct-mlsingleshot-tizen-tests" extension="crosswalk" category="Tizen Device APIs">
+ <set name="MachineLearning">
+ <capabilities>
+ <capability name="http://tizen.org/feature/machine_learning"/>
+ </capabilities>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync() method works properly with optional argument" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="MachineLearningSingle_openModelAsync_with_isDynamicMode">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_with_isDynamicMode.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel() method with DynamicMode works properly with optional argument" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="MachineLearningSingle_openModel_with_isDynamicMode">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_with_isDynamicMode.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModel" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if interface MachineLearningSingle exists, it should not" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P3" id="MachineLearningSingle_notexist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_notexist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" usage="true" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if method work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="MachineLearningSingle_openModel">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModel" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if openModelAsync method work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="MachineLearningSingle_openModelAsync">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync with incorrect errorCallback type throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_errorCallback_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_errorCallback_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if an exception was thrown when a fake errorCallback was passed into openModelAsync method" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_errorCallback_invalid_cb">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_errorCallback_invalid_cb.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check MachineLearningSingle:openModelAsync method errorCallback invoked when invalidvalue input" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_errorCallback_invoked_InvalidValuesError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_errorCallback_invoked_InvalidValuesError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check MachineLearningSingle:openModelAsync method throws exception when errorCallback is invoked" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_errorCallback_invoked_NotFoundError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_errorCallback_invoked_NotFoundError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync() method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="MachineLearningSingle_openModelAsync_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync with incorrect optional fwType type throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_fwType_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_fwType_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync with incorrect optional hwType type throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_hwType_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_hwType_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync with incorrect optional type inTensorsInfo throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_inTensorsInfo_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_inTensorsInfo_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync () throws exception when successCallback is missing " type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2 " id="MachineLearningSingle_openModelAsync_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync with incorrect optional type outTensorsInfo throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_outTensorsInfo_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_outTensorsInfo_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync with incorrect optional successCallback type throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_successCallback_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_successCallback_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if an exception was thrown when a fake successCallback was passed into openModelAsync method" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_successCallback_invalid_cb">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_successCallback_invalid_cb.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync () throws exception when successCallback is missing" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_successCallback_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_successCallback_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModelAsync" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check MachineLearningSingle:openModel method throw an exception when invalidvalue input " type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="MachineLearningSingle_openModel_InvalidValue_1">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_InvalidValue_1.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModel" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check MachineLearningSingle:openModel method throw an exception when invalidvalue input " type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="MachineLearningSingle_openModel_InvalidValue_2">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_InvalidValue_2.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModel" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel() method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="MachineLearningSingle_openModel_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModel" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel with incorrect optional fwType type throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModel_fwType_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_fwType_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModel" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel with incorrect optional type hwType throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModel_hwType_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_hwType_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModel" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel with incorrect optional type inTensorsInfo throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModel_inTensorsInfo_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_inTensorsInfo_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModel" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel() throws exception when argument is missing" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModel_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModel" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel with incorrect optional type outTensorsInfo throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModel_outTensorsInfo_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_outTensorsInfo_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="MachineLearningSingle" element_type="method" element_name="openModel" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if interface OpenModelSuccessCallback exists, it should not" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P3" id="OpenModelSuccessCallback_notexist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/OpenModelSuccessCallback_notexist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="OpenModelSuccessCallback" usage="true" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if OpenModelSuccessCallback:onsuccess method work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="OpenModelSuccessCallback_onsuccess">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/OpenModelSuccessCallback_onsuccess.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="OpenModelSuccessCallback" element_type="method" element_name="onsuccess" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if close method work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_close">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_close.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="close" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:close error occur throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_close_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_close_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="close" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:close() method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="SingleShot_close_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_close_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="close" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check using SingleShot::close() method with extra argument" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_close_extra_argument">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_close_extra_argument.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="close" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if getvalue method work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_getValue">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_getValue.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="getValue" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:getValue error occur throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_getValue_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_getValue_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="getValue" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if getValue method input parameters with unsupported value could throw an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_getValue_NotSupported">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_getValue_NotSupported.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="getValue" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:getValue() method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="SingleShot_getValue_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_getValue_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="getValue" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:getValue () throws exception when argument is missing" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="SingleShot_getValue_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_getValue_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="getValue" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Test whether SingleShot contains the attribute input, has type object and is readonly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_input_attribute">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_input_attribute.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="attribute" element_name="input" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:invoke method work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_invoke">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_invoke.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="invoke" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:invoke error occur throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_invoke_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_invoke_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="invoke" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:invoke throw TimeoutError if the operation timed out " type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_invoke_TimeoutError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_invoke_TimeoutError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="invoke" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:invoke() method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="SingleShot_invoke_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_invoke_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="invoke" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:invoke with incorrect inTensorsData type throws an exception" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="SingleShot_invoke_inTensorsData_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_invoke_inTensorsData_TypeMismatch.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="invoke" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:invoke () throws exception when argument is missing" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="SingleShot_invoke_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_invoke_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="invoke" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if interface SingleShot exists, it should not" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P3" id="SingleShot_notexist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_notexist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" usage="true" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Test whether SingleShot contains the attribute output, has type object and is readonly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_output_attribute">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_output_attribute.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="attribute" element_name="output" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if setTimeout method work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_setTimeout">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setTimeout.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="setTimeout" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:setTimeout error occur throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_setTimeout_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setTimeout_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="setTimeout" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:setTimeout() method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="SingleShot_setTimeout_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setTimeout_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="setTimeout" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:setTimeout () throws exception when argument is missing" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="SingleShot_setTimeout_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setTimeout_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="setTimeout" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if setValue method work properly" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_setValue">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setValue.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="setValue" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:setValue error occur throws an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_setValue_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setValue_AbortError.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="setValue" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if setValue method input parameters with invalid value could throw an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_setValue_InvalidValue">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setValue_InvalidValue.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="setValue" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if setValue method input parameters with unsupported value could throw an exception " type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_setValue_NotSupported">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setValue_NotSupported.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="setValue" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:setValue() method exists" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="SingleShot_setValue_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setValue_exist.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="setValue" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="Check if SingleShot:setValue () throws exception when argument is missing" type="compliance" status="approved" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="SingleShot_setValue_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setValue_misarg.html</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion interface="SingleShot" element_type="method" element_name="setValue" specification="MLSingleShot" section="TBD" category="Tizen Device API Specifications"/>
+ <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/mlsingleshot.html</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ </set>
+ </suite>
+</test_definition>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="./testcase.xsl"?>
+<test_definition>
+ <suite name="tct-mlsingleshot-tizen-tests" extension="crosswalk" category="Tizen Device APIs">
+ <set name="MachineLearning">
+ <capabilities>
+ <capability name="http://tizen.org/feature/machine_learning"/>
+ </capabilities>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync() method works properly with optional argument" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="MachineLearningSingle_openModelAsync_with_isDynamicMode">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_with_isDynamicMode.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel() method with DynamicMode works properly with optional argument" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="MachineLearningSingle_openModel_with_isDynamicMode">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_with_isDynamicMode.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if interface MachineLearningSingle exists, it should not" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P3" id="MachineLearningSingle_notexist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_notexist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if method work properly" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="MachineLearningSingle_openModel">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if openModelAsync method work properly" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="MachineLearningSingle_openModelAsync">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync with incorrect errorCallback type throws an exception" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_errorCallback_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_errorCallback_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if an exception was thrown when a fake errorCallback was passed into openModelAsync method" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_errorCallback_invalid_cb">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_errorCallback_invalid_cb.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check MachineLearningSingle:openModelAsync method errorCallback invoked when invalidvalue input" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_errorCallback_invoked_InvalidValuesError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_errorCallback_invoked_InvalidValuesError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check MachineLearningSingle:openModelAsync method throws exception when errorCallback is invoked" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_errorCallback_invoked_NotFoundError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_errorCallback_invoked_NotFoundError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync() method exists" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="MachineLearningSingle_openModelAsync_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync with incorrect optional fwType type throws an exception" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_fwType_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_fwType_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync with incorrect optional hwType type throws an exception" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_hwType_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_hwType_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync with incorrect optional type inTensorsInfo throws an exception" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_inTensorsInfo_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_inTensorsInfo_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync () throws exception when successCallback is missing " component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2 " id="MachineLearningSingle_openModelAsync_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync with incorrect optional type outTensorsInfo throws an exception" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_outTensorsInfo_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_outTensorsInfo_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync with incorrect optional successCallback type throws an exception" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_successCallback_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_successCallback_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if an exception was thrown when a fake successCallback was passed into openModelAsync method" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_successCallback_invalid_cb">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_successCallback_invalid_cb.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModelAsync () throws exception when successCallback is missing" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModelAsync_successCallback_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModelAsync_successCallback_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check MachineLearningSingle:openModel method throw an exception when invalidvalue input " component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="MachineLearningSingle_openModel_InvalidValue_1">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_InvalidValue_1.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check MachineLearningSingle:openModel method throw an exception when invalidvalue input " component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="MachineLearningSingle_openModel_InvalidValue_2">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_InvalidValue_2.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel() method exists" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="MachineLearningSingle_openModel_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel with incorrect optional fwType type throws an exception" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModel_fwType_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_fwType_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel with incorrect optional type hwType throws an exception" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModel_hwType_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_hwType_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel with incorrect optional type inTensorsInfo throws an exception" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModel_inTensorsInfo_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_inTensorsInfo_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel() throws exception when argument is missing" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModel_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if MachineLearningSingle:openModel with incorrect optional type outTensorsInfo throws an exception" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="MachineLearningSingle_openModel_outTensorsInfo_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/MachineLearningSingle_openModel_outTensorsInfo_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if interface OpenModelSuccessCallback exists, it should not" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P3" id="OpenModelSuccessCallback_notexist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/OpenModelSuccessCallback_notexist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if OpenModelSuccessCallback:onsuccess method work properly" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="OpenModelSuccessCallback_onsuccess">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/OpenModelSuccessCallback_onsuccess.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if close method work properly" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_close">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_close.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:close error occur throws an exception " component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_close_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_close_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:close() method exists" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="SingleShot_close_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_close_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check using SingleShot::close() method with extra argument" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_close_extra_argument">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_close_extra_argument.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if getvalue method work properly" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_getValue">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_getValue.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:getValue error occur throws an exception " component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_getValue_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_getValue_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if getValue method input parameters with unsupported value could throw an exception " component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_getValue_NotSupported">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_getValue_NotSupported.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:getValue() method exists" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="SingleShot_getValue_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_getValue_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:getValue () throws exception when argument is missing" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="SingleShot_getValue_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_getValue_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Test whether SingleShot contains the attribute input, has type object and is readonly" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_input_attribute">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_input_attribute.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:invoke method work properly" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_invoke">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_invoke.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:invoke error occur throws an exception " component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_invoke_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_invoke_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:invoke throw TimeoutError if the operation timed out " component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_invoke_TimeoutError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_invoke_TimeoutError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:invoke() method exists" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="SingleShot_invoke_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_invoke_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:invoke with incorrect inTensorsData type throws an exception" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="SingleShot_invoke_inTensorsData_TypeMismatch">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_invoke_inTensorsData_TypeMismatch.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:invoke () throws exception when argument is missing" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="SingleShot_invoke_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_invoke_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if interface SingleShot exists, it should not" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P3" id="SingleShot_notexist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_notexist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Test whether SingleShot contains the attribute output, has type object and is readonly" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_output_attribute">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_output_attribute.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if setTimeout method work properly" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_setTimeout">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setTimeout.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:setTimeout error occur throws an exception " component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_setTimeout_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setTimeout_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:setTimeout() method exists" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="SingleShot_setTimeout_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setTimeout_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:setTimeout () throws exception when argument is missing" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="SingleShot_setTimeout_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setTimeout_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if setValue method work properly" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1" id="SingleShot_setValue">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setValue.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:setValue error occur throws an exception " component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_setValue_AbortError">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setValue_AbortError.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if setValue method input parameters with invalid value could throw an exception " component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_setValue_InvalidValue">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setValue_InvalidValue.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if setValue method input parameters with unsupported value could throw an exception " component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P1 " id="SingleShot_setValue_NotSupported">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setValue_NotSupported.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:setValue() method exists" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P0" id="SingleShot_setValue_exist">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setValue_exist.html</test_script_entry>
+ </description>
+ </testcase>
+ <testcase purpose="Check if SingleShot:setValue () throws exception when argument is missing" component="Tizen Device APIs/TBD/MLSingleShot" execution_type="auto" priority="P2" id="SingleShot_setValue_misarg">
+ <description>
+ <test_script_entry>/opt/tct-mlsingleshot-tizen-tests/mlsingleshot/SingleShot_setValue_misarg.html</test_script_entry>
+ </description>
+ </testcase>
+ </set>
+ </suite>
+</test_definition>