</description>
</testcase>
</set>
+ <set name="WRT Sp02">
+ <testcase component="behavior" execution_type="manual" id="WRTSp02" purpose="WRT sp02 Test">
+ <description>
+ <pre_condition/>
+ <steps>
+ <step order="1">
+ <step_desc>0</step_desc>
+ <expected>0</expected>
+ </step>
+ </steps>
+ <test_script_entry test_script_expected_result="0"/>
+ </description>
+ </testcase>
+ </set>
</suite>
</test_definition>
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2017 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:
+ Wei Ji <wei.ji@samsung.com>
+
+-->
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width"/>
+ <link rel="stylesheet" type="text/css" href="../../css/jquery.mobile.css"/>
+ <link rel="stylesheet" type="text/css" href="../../css/main.css"/>
+ <script src="../../js/thirdparty/jquery.js"></script>
+ <script src="../../js/thirdparty/jquery.mobile.js"></script>
+ <script src="../../js/tests.js"></script>
+ <script src="js/main.js"></script>
+ </head>
+ <body bgcolor="FFFFFF" >
+ <div data-role="page" id="main">
+ <div data-role="header" data-position="fixed" data-tap-toggle="false">
+ <h1 id="main_page_title"></h1>
+ </div>
+ <div id="content">
+ <ul data-role="listview" id="sp02List" data-divider-theme="b" data-inset="true">
+ <li data-role="list-divider" role="heading">WRT Sp02</li>
+ <li id="WRT-sp02">
+ <a href="javascript:goToApp('res/WRT-sp02.html')" data-transition="slide" style="">
+ <h2>WRT-sp02</h2>
+ </a>
+ </li>
+ <li data-role="list-divider" role="heading">Clean all the installed packages</li>
+ <li>
+ <div data-role="button" id="wgtClean" class="wgtButton">Clean all test applications</div>
+ </li>
+ </ul>
+ </div>
+ <div data-role="footer" data-position="fixed" data-tap-toggle="false">
+ </div>
+ <div data-role="popup" id="popup_info" data-theme="a">
+ <font class="fontSize">
+ <p>Test Note: </p>
+ <p>Verifies the localStorage space of Application.</p>
+ <p>Test Purpose: </p>
+ <p>Verifies that Application has its own localStorage space.</p>
+ <p>Expected Result: </p>
+ <p>Test passes if all sub-tests pass.</p>
+ </font>
+ </div>
+ </div>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+/*
+Copyright (c) 2013 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.sandbox
+* 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:
+ Feng, GangX <gangx.feng@intel.com>
+ Wei Ji <wei.ji@samsung.com>
+
+*/
+var allId=new Array('wrt5plc001');
+
+var installedId = new Array();
+var resultXML, tests;
+var MOUDLE_NAME = "WRTSp02";
+var RESULT_FILE_NAME = "tct-behavior-child.wrtsp02.result.xml";
+var RESOURCE_DIR;
+$.ajax({
+ url:"/opt/usr/home/owner/share/TCT_CONFIG",
+ data:{},
+ async:false,
+ success:function(data){
+ var regEx = /DEVICE_SUITE_TARGET_30=(.+)/i;
+ var path = regEx.exec(data);
+ RESOURCE_DIR = path[1];
+ }
+});
+$(document).delegate("#main", "pageinit", function() {
+ DisablePassButton();
+ $("#wgtClean").bind("vclick", function() {
+ showTotalBar();
+ });
+});
+
+function showTotalBar(){
+ $.each(allId,function(key,val){
+ try {
+ var packageInfo = tizen.package.getPackageInfo(val);
+ console.log("Current Package ID : " + packageInfo.id);
+ } catch (e) {
+ //alert("Exception: " + e.message);
+ }
+ if(packageInfo != "" && packageInfo != undefined){
+ installedId.push(val);
+ }
+ });
+ checkInstalledPackage();
+}
+
+function checkInstalledPackage(){
+ if(installedId.length > 0){
+ setTimeout(function() {
+ uninstall(installedId[0]);
+ }, 1000);
+ } else {
+ $.mobile.hidePageLoadingMsg();
+ alert("All widgets is uninstalled!");
+ if (checkIfAllPackagePass()) {
+ EnablePassButton();
+ }
+ }
+}
+
+function checkIfAllPackagePass() {
+ var result = true;
+
+ tests.each(function() {
+ if ($(this).attr('result') != "PASS") {
+ result = false;
+ }
+ });
+ return result;
+}
+
+function uninstall(val) {
+ installedId.shift();
+ var totalBar = Math.floor((allId.length - installedId.length - 1) / allId.length * 100);
+
+ var onUninstallationSuccess = {
+
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On uninstallation(" + packageId + "): progress(" + percentage + ")");
+ $.mobile.showPageLoadingMsg();
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Uninstallation(" + packageId + ") Complete");
+ alert("The package " + packageId + " is uninstalled");
+ checkInstalledPackage();
+ }
+ }
+
+ var onError = function (err) {
+ $.mobile.hidePageLoadingMsg();
+ if (err.name != "UnknownError") {
+ alert("Error occured on uninstallation : " + err.name);
+ }
+ }
+
+ try {
+ tizen.package.uninstall(val, onUninstallationSuccess, onError);
+ } catch (e) {
+ alert("Exception: " + e.name);
+ }
+}
+
+function goToApp(path) {
+ window.open(path);
+}
+
+function recordResultToXML(test_name, result){
+ tests.each(
+ function() {
+ if($(this).attr('id') == test_name){
+ $(this).attr('result', result);
+ }
+ }
+ );
+}
+
+function initTests() {
+ loadTests();
+ window.addEventListener('message', function(e) {
+ console.log(e.data);
+ var jsonData = eval("(" + e.data + ")");
+ if(jsonData.length > 0){
+ if(jsonData[0].testname != "" && jsonData[0].result != ""){
+ recordResultToXML(jsonData[0].testname, jsonData[0].result);
+ updateAppDecoration();
+ exportTmpResult();
+ }
+ }
+ }, false);
+}
+
+function exportTmpResult() {
+ writeFile(RESULT_FILE_NAME, (new XMLSerializer()).serializeToString(resultXML), false);
+}
+
+function writeFile(filename, content, need_exit) {
+ successCallback = function(fs) {
+ fs.write(content);
+ fs.close();
+ if (need_exit)
+ exitTest();
+ };
+
+
+ onsuccess = function(dir) {
+ dir.deleteFile(dir.fullPath + "/" + filename);
+
+ file = dir.createFile(filename);
+ file.openStream("rw", successCallback, onerror, "UTF-8");
+ };
+
+ onerror = function(error) {
+ alert("Export result fail: " + error);
+ };
+
+ try {
+ tizen.filesystem.resolve('file://' + RESOURCE_DIR + '/Documents', onsuccess, onerror, "rw");
+ } catch (err) {
+ alert("Write file fail: " + err.message);
+ }
+}
+
+function loadTests() {
+ $.ajax({
+ async : false,
+ type : "GET",
+ url : "../../subtestresult.xml",
+ dataType : "xml",
+ success : function(xml){
+ resultXML = xml;
+ $(xml).find("set").each(
+ function(){
+ if($(this).attr("name") == MOUDLE_NAME){
+ tests = $(this).find("testcase");
+ }
+ }
+ );
+ loadTmpResult();
+ }
+ });
+}
+
+function loadTmpResult(){
+ successCallback = function(files) {
+ for(var i = 0; i < files.length; i++){
+ if (files[i].name == RESULT_FILE_NAME) {
+ if (confirm("Continue last test?")) {
+ files[i].readAsText(
+ function(xml){
+ _mergeResult($(xml).find("set"));
+ updateAppDecoration();
+ }, function(err){
+ console.log("read tmp result error: " + err.message);
+ }, "UTF-8"
+ );
+ return;
+ }
+ else break;
+ }
+ }
+ };
+
+ onsuccess = function(dir) {
+ dir.listFiles(successCallback, onerror);
+ };
+
+ onerror = function(error) {
+ console.log(error);
+ updateAppDecoration();
+ };
+
+ try {
+ tizen.filesystem.resolve('file://' + RESOURCE_DIR + '/Documents', onsuccess, onerror, "rw");
+ } catch (err) {
+ console.log("Load tmp result fail: " + err.message);
+ updateAppDecoration();
+ }
+}
+
+function _mergeResult(tmpResult) {
+ tests.each(
+ function(index, item) {
+ tmpResult.each(
+ function(order1, tmpItem1){
+ if($(tmpItem1).attr("name") == MOUDLE_NAME){
+ $(tmpItem1).find("testcase").each(
+ function(order, tmpItem){
+ if ($(item).attr("id") === $(tmpItem).attr("id")) {
+ $(item).attr("result", $(tmpItem).attr("result"));
+ }
+ }
+ );
+ }
+ }
+ );
+ }
+ );
+}
+
+function updateAppDecoration() {
+ $(resultXML).find("set").each(
+ function(){
+ if($(this).attr("name") == MOUDLE_NAME){
+ $(this).find("testcase").each(
+ function() {
+ if($(this).attr("result") == "PASS"){
+ $("#"+$(this).attr("id")).find("h2").css("color","green");
+ }else if($(this).attr("result") == "FAIL"){
+ $("#"+$(this).attr("id")).find("h2").css("color","red");
+ }
+ }
+ );
+ }
+ }
+ );
+ $("#sp02List").listview( "refresh" );
+}
+
+function backAppsHome() {
+ window.close();
+}
+
+function successBackAppsHome() {
+ window.close();
+}
+
+function reportResult(res) {
+ var jsonStr="[{\"testname\":\""+getAppName()+"\",\"result\":\""+res+"\"}]";
+ window.opener.postMessage(jsonStr, '*');
+ successBackAppsHome();
+}
+
+window.addEventListener('load', initTests, false);
--- /dev/null
+/*
+Copyright (c) 2013 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.sandbox
+* 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:
+ Feng, GangX <gangx.feng@intel.com>
+ Wei Ji <wei.ji@samsung.com>
+
+*/
+
+var installUrl;
+var wgt_name;
+var app_id;
+var package_id;
+var RESOURCE_DIR;
+$.ajax({
+ url:"/opt/usr/home/owner/share/TCT_CONFIG",
+ data:{},
+ async:false,
+ success:function(data){
+ var regEx = /DEVICE_SUITE_TARGET_30=(.+)/i;
+ var path = regEx.exec(data);
+ RESOURCE_DIR = path[1];
+ }
+});
+$(document).ready(function(){
+ updateFooterButton();
+ DisablePassButton();
+
+ wgt_name = $("#wgt_name").val();
+ app_id = $("#app_id").val();
+ package_id = $("#package_id").val();
+
+ $("#install").bind("vclick", function() {
+ install();
+ });
+ $("#launch").bind("vclick", function() {
+ launch(app_id);
+ $('#uninstall').removeClass("ui-disabled");
+ });
+ $("#uninstall").bind("vclick", function() {
+ uninstall(package_id);
+ });
+ try {
+ tizen.package.setPackageInfoEventListener(packageEventCallback);
+ } catch (e) {
+ alert("Exception: " + e.message);
+ }
+
+ packagePre(wgt_name);
+ $('#uninstall').addClass("ui-disabled");
+ $('#launch').addClass("ui-disabled");
+
+ if(checkInstalledPkg(package_id)) {
+ $('#install').addClass("ui-disabled");
+ $('#launch').removeClass("ui-disabled");
+ }
+});
+
+var packageEventCallback = {
+ oninstalled: function(packageInfo) {
+ $.mobile.hidePageLoadingMsg();
+ alert("The package " + packageInfo.name + " is installed");
+ },
+ onupdated: function(packageInfo) {
+ $.mobile.hidePageLoadingMsg();
+ alert("The package " + packageInfo.name + " is updated");
+ },
+ onuninstalled: function(packageId) {
+ $.mobile.hidePageLoadingMsg();
+ alert("The package " + packageId + " is uninstalled");
+ }
+}
+
+function fileURI(wgt_name) {
+ var documentsDir;
+ function onsuccess(files) {
+ for (var i = 0; i < files.length; i++)
+ {
+ if(files[i].name == wgt_name+".wgt")
+ {
+ var Url1 = files[i].toURI();
+ installUrl = Url1.replace("file:///", "/");
+ }
+ }
+ }
+
+ function onerror(error) {
+ alert("The error " + error.message + " occurred when listing the files in the selected folder");
+ }
+
+ tizen.filesystem.resolve(
+ 'file://' + RESOURCE_DIR + '/Documents',
+ function(dir){
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+ }, function(e) {
+ alert("Error" + e.message);
+ }, "r"
+ );
+}
+
+function install() {
+ var onInstallationSuccess = {
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On installation(" + packageId + "): progress(" + percentage + ")");
+ $.mobile.showPageLoadingMsg();
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Installation(" + packageId + ") Complete");
+ if(checkInstalledPkg(package_id)) {
+ $('#install').addClass("ui-disabled");
+ $('#launch').removeClass("ui-disabled");
+ }
+ }
+ }
+
+ var onError = function (err) {
+ alert("Error occured on installation : " + err.message);
+ $.mobile.hidePageLoadingMsg();
+ }
+
+ try {
+ tizen.package.install(installUrl, onInstallationSuccess, onError);
+ } catch(e) {
+ alert("Exception: " + e.name);
+ }
+}
+
+function uninstall(package_id) {
+ var onUninstallationSuccess = {
+
+ onprogress: function(packageId, percentage)
+ {
+ console.log("On uninstallation(" + packageId + "): progress(" + percentage + ")");
+ $.mobile.showPageLoadingMsg();
+ },
+ oncomplete: function(packageId)
+ {
+ console.log("Uninstallation(" + packageId + ") Complete");
+ $('#launch').addClass("ui-disabled");
+ $('#uninstall').addClass("ui-disabled");
+ EnablePassButton();
+ }
+ }
+
+ var onError = function (err) {
+ alert("Error occured on uninstallation : " + err.name);
+ $.mobile.hidePageLoadingMsg();
+ }
+
+ try {
+ tizen.package.uninstall(package_id, onUninstallationSuccess, onError);
+ } catch (e) {
+ alert("Exception: " + e.name);
+ }
+}
+
+function launch(app_id) {
+ function onSuccess() {
+ console.log(id + " launched successfully!");
+ }
+
+ function onError(err) {
+ alert("launch failed : " + err.message);
+ }
+
+ try {
+ tizen.application.launch(app_id, onSuccess, onError);
+ } catch (exc) {
+ alert("launch exc:" + exc.message);
+ }
+}
+
+function packagePre(wgt_name) {
+
+ var documentsDir;
+ function onsuccess(files) {
+ for (var i = 0; i < files.length; i++)
+ {
+ if(files[i].name == wgt_name+".wgt")
+ {
+ documentsDir.copyTo(
+ files[i].fullPath,
+ "file://" + RESOURCE_DIR + "/Documents/"+wgt_name+".wgt",
+ true,
+ function() {
+ console.log(wgt_name+" Precondition Success!");
+ });
+ }
+ }
+ fileURI(wgt_name);
+ }
+
+ function onerror(error) {
+ alert("The error " + error.message + " occurred when listing the files in the selected folder");
+ }
+
+ tizen.filesystem.resolve(
+ 'wgt-package/tests/WRTSp02/res/',
+ function(dir){
+ documentsDir = dir;
+ dir.listFiles(onsuccess, onerror);
+ }, function(e) {
+ alert("Error" + e.message);
+ }, "r"
+ );
+}
+
+function reportResult(res) {
+ var jsonStr="[{\"testname\":\"" + wgt_name + "\",\"result\":\"" + res + "\"}]";
+ window.opener.postMessage(jsonStr, '*');
+ backAppsHome();
+}
+
+document.write('<script src="../webrunner/jquery-1.10.2.min.js"></script>');
--- /dev/null
+<!DOCTYPE html>
+<!--
+Copyright (c) 2017 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:
+ Wei Ji <wei.ji@samsung.com>
+
+-->
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
+ <link rel="stylesheet" type="text/css" href="../../../css/jquery.mobile.css" />
+ <link rel="stylesheet" type="text/css" href="../../../css/main.css" />
+ <script src="../../../js/thirdparty/jquery.js"></script>
+ <script src="../../../js/thirdparty/jquery.mobile.js"></script>
+ <script src="../../../js/tests.js"></script>
+ <script src="../js/tests.js"></script>
+ </head>
+ <body>
+ <div data-role="page" id="WRT-sp02">
+ <div id="content">
+ <div>
+ <input type="hidden" id="wgt_name" value="private_localstorage_check"/>
+ <input type="hidden" id="app_id" value="wrt5plc001.privatelocalstoragecheck"/>
+ <input type="hidden" id="package_id" value="wrt5plc001"/>
+ </div>
+ <ul data-role="listview">
+ <li data-role="list-divider">Package Install</li>
+ <li>
+ <div data-role="button" id="install" class="wgtButton">Install</div>
+ </li>
+ <li data-role="list-divider">Package Check</li>
+ <li>
+ <div data-role="button" id="launch" class="wgtButton">Check</div>
+ </li>
+ <li data-role="list-divider">Package Uninstall</li>
+ <li>
+ <div data-role="button" id="uninstall" class="wgtButton">Uninstall</div>
+ </li>
+ </ul>
+ </div>
+ <div data-role="footer" data-position="fixed" data-tap-toggle="false">
+ </div>
+ <div data-role="popup" id="popup_info" data-theme="a">
+ <font class="fontSize">
+ <p>Test Step: </p>
+ <ol>
+ <li>Click the "Install" button to install the widget.</li>
+ <li>Click the "Check" button to check if files exist in application installed path, it will show "Pass".</li>
+ <li>Click the "Uninstall" button to uninstall the widget.</li>
+ </ol>
+ <p>Expected Result: </p>
+ <p>Test passes if all the test points work well.</p>
+ </font>
+ </div>
+ </div>
+ </body>
+</html>
\ No newline at end of file