[common][filesystem][TFIVE-13753, path is not converted to file URI as expect] 84/189084/2
authorlin qunfang <qunfang.lin@samsung.com>
Thu, 13 Sep 2018 19:25:53 +0000 (03:25 +0800)
committerlin qunfang <qunfang.lin@samsung.com>
Thu, 13 Sep 2018 19:41:28 +0000 (03:41 +0800)
Change-Id: Ibf2b1de8a824a460bed5dcee1ee894a5891cddec
Signed-off-by: lin qunfang <qunfang.lin@samsung.com>
common/tct-filesystem-tizen-tests/filesystem/FileSystemManager_toURI.html
common/tct-filesystem-tizen-tests/filesystem/FileSystemManager_toURI_tv.html [deleted file]
common/tct-filesystem-tizen-tests/filesystem/support/filesystem_common.js
common/tct-filesystem-tizen-tests/filesystem/support/getJsonConf.js [new file with mode: 0755]
common/tct-filesystem-tizen-tests/tests.xml

index ac17dde3fbde9b808f1f1e6680feff3fd1c0c9e9..5b69eed8f5afa4cffb93c16dc1d1b49bf6bcbe73 100755 (executable)
@@ -24,6 +24,7 @@ Authors:
 <title>FileSystemManager_toURI</title>
 <meta charset="utf-8"/>
 <script src="support/unitcommon.js"></script>
+<script src="support/filesystem_common.js"></script>
 </head>
 <body>
 <div id="log"></div>
@@ -36,11 +37,11 @@ Authors:
 //==== TEST_CRITERIA MR
 
 test(function () {
-    var retVal;
+    var retVal, uri = "documents/directory/file.ext", expect = "file://" + CONTENT_DIR + "/Documents/directory/file.ext";
 
-    retVal = tizen.filesystem.toURI("documents/directory/file.ext");
+    retVal = tizen.filesystem.toURI(uri);
     assert_type(retVal, "string", "The type of return value should be string.");
-    assert_equals(retVal, "file:///opt/usr/home/owner/media/Documents/directory/file.ext", "Path is not successfully converted to file URI");
+    assert_equals(retVal, expect, "Path is not successfully converted to file URI");
 }, document.title);
 
 </script>
diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileSystemManager_toURI_tv.html b/common/tct-filesystem-tizen-tests/filesystem/FileSystemManager_toURI_tv.html
deleted file mode 100755 (executable)
index 8aea51e..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2018 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>
-
--->
-
-<html>
-<head>
-<title>FileSystemManager_toURI_tv</title>
-<meta charset="utf-8"/>
-<script src="support/unitcommon.js"></script>
-</head>
-<body>
-<div id="log"></div>
-<script>
-//==== TEST: FileSystemManager_toURI_tv
-//==== LABEL Check if FileSystemManager::toURI() method works properly
-//==== SPEC Tizen Web API:IO:Filesystem:FileSystemManager:toURI M
-//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/filesystem.html
-//==== PRIORITY P1
-//==== TEST_CRITERIA MR
-
-test(function () {
-    var retVal;
-
-    retVal = tizen.filesystem.toURI("documents/directory/file.ext");
-    assert_type(retVal, "string", "The type of return value should be string.");
-    assert_equals(retVal, "file:///opt/usr/home/owner/content/Documents/directory/file.ext", "Path is not successfully converted to file URI");
-}, document.title);
-
-</script>
-</body>
-</html>
index 7f3487ceee1824cc32143c0c6626075b80a44321..e833de44c0912c75abfcefbfcf1e0306152fe10f 100755 (executable)
@@ -34,6 +34,10 @@ var NOT_FOUND_ERR            = "NotFoundError";
 
 var globalCounter = 1;
 
+var CONTENT_DIR = "";
+document.write('<script src="../webrunner/jquery-1.10.2.min.js"></script>');
+document.write('<script src="support/getJsonConf.js"></script>');
+
 function isFileObject(obj) {
     return true;
 }
diff --git a/common/tct-filesystem-tizen-tests/filesystem/support/getJsonConf.js b/common/tct-filesystem-tizen-tests/filesystem/support/getJsonConf.js
new file mode 100755 (executable)
index 0000000..e56c550
--- /dev/null
@@ -0,0 +1,42 @@
+/*\r
+Copyright (c) 2013 Intel Corporation.\r
+\r
+Redistribution and use in source and binary forms, with or without modification,\r
+are permitted provided that the following conditions are met:\r
+\r
+* Redistributions of works must retain the original copyright notice, this list\r
+  of conditions and the following disclaimer.\r
+* Redistributions in binary form must reproduce the original copyright notice,\r
+  this list of conditions and the following disclaimer in the documentation\r
+  and/or other materials provided with the distribution.\r
+* Neither the name of Intel Corporation nor the names of its contributors\r
+  may be used to endorse or promote products derived from this work without\r
+  specific prior written permission.\r
+\r
+THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"\r
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,\r
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\r
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+Authors:\r
+        Li, Hao <haox.li@intel.com>\r
+\r
+*/\r
+var RESOURCE_DIR;\r
+$.ajax({\r
+  url:"/opt/usr/home/owner/share/TCT_CONFIG",\r
+  data:{},\r
+  async:false,\r
+  success:function(data){\r
+    var regEx2 = /DEVICE_STORAGE_30=(.+)/i;\r
+    var path2 = regEx2.exec(data);\r
+    CONTENT_DIR = path2[1];\r
+  }\r
+});\r
+\r
index 865abd523f91bb7863140ea1834e27b6cff4f386..2040883d05c1036484e876335e77b225377dde39 100755 (executable)
           <test_script_entry>/opt/tct-filesystem-tizen-tests/filesystem/FileSystemManager_rename_with_errorCallback.html</test_script_entry>
         </description>
       </testcase>
+      <testcase purpose="Check if FileSystemManager::toURI() method works properly" component="TizenAPI/IO/Filesystem" execution_type="auto" priority="P1" id="FileSystemManager_toURI">
+        <description>
+          <test_script_entry>/opt/tct-filesystem-tizen-tests/filesystem/FileSystemManager_toURI.html</test_script_entry>
+        </description>
+      </testcase>
       <testcase purpose="Check if FileSystemManager::toURI() method with invalid path throws InvalidValuesError" component="TizenAPI/IO/Filesystem" execution_type="auto" priority="P2" id="FileSystemManager_toURI_InvalidValuesError">
         <description>
           <test_script_entry>/opt/tct-filesystem-tizen-tests/filesystem/FileSystemManager_toURI_InvalidValuesError.html</test_script_entry>
                <test_script_entry>/opt/tct-filesystem-tizen-tests/filesystem/FileSystemManager_resolve_ringtones_invalid_mode_w.html</test_script_entry>
             </description>
          </testcase>
-         <testcase purpose="Check if FileSystemManager::toURI() method works properly" component="TizenAPI/IO/Filesystem" execution_type="auto" priority="P1" id="FileSystemManager_toURI">
-            <description>
-               <test_script_entry>/opt/tct-filesystem-tizen-tests/filesystem/FileSystemManager_toURI.html</test_script_entry>
-            </description>
-          </testcase>
     </set>
     <set name="Filesystem_wearable" type="js">
       <capabilities>
                <test_script_entry>/opt/tct-filesystem-tizen-tests/filesystem/FileSystemManager_resolve_ringtones_invalid_mode_w.html</test_script_entry>
             </description>
          </testcase>
-         <testcase purpose="Check if FileSystemManager::toURI() method works properly" component="TizenAPI/IO/Filesystem" execution_type="auto" priority="P1" id="FileSystemManager_toURI">
-           <description>
-             <test_script_entry>/opt/tct-filesystem-tizen-tests/filesystem/FileSystemManager_toURI.html</test_script_entry>
-           </description>
-         </testcase>
     </set>
     <set name="Filesystem_tv" type="js">
       <capabilities>
                <test_script_entry>/opt/tct-filesystem-tizen-tests/filesystem/FileSystemManager_removeStorageStateChangeListener_with_para_invalid.html</test_script_entry>
             </description>
          </testcase>
-         <testcase purpose="Check if FileSystemManager::toURI() method works properly" component="TizenAPI/IO/Filesystem" execution_type="auto" priority="P1" id="FileSystemManager_toURI_tv">
-           <description>
-             <test_script_entry>/opt/tct-filesystem-tizen-tests/filesystem/FileSystemManager_toURI_tv.html</test_script_entry>
-           </description>
-         </testcase>
       </set>
    </suite>
 </test_definition>