[Filesystem] adjustments and improvements
authorMariusz Polasinski <m.polasinski@samsung.com>
Wed, 14 Aug 2013 12:22:47 +0000 (14:22 +0200)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Wed, 14 Aug 2013 12:43:18 +0000 (12:43 +0000)
Change-Id: I26d298101c5abe9d59028c0217930e80a7c8a6f6

15 files changed:
tct-filesystem-tizen-tests/filesystem/FileStream_bytesAvailable_attribute.html
tct-filesystem-tizen-tests/filesystem/FileSystemManager_addStorageStateChangeListener_onerror_invalid_cb.html
tct-filesystem-tizen-tests/filesystem/FileSystemManager_listStorages_with_onerror.html
tct-filesystem-tizen-tests/filesystem/FileSystemManager_maxPathLength_attribute.html
tct-filesystem-tizen-tests/filesystem/FileSystemManager_resolve_mode_TypeMismatch.html
tct-filesystem-tizen-tests/filesystem/FileSystemStorage_label_attribute.html
tct-filesystem-tizen-tests/filesystem/File_fileSize_attribute.html
tct-filesystem-tizen-tests/filesystem/File_fullPath_attribute.html
tct-filesystem-tizen-tests/filesystem/File_isDirectory_attribute.html
tct-filesystem-tizen-tests/filesystem/File_isFile_attribute.html
tct-filesystem-tizen-tests/filesystem/File_length_attribute.html
tct-filesystem-tizen-tests/filesystem/File_name_attribute.html
tct-filesystem-tizen-tests/filesystem/File_path_attribute.html
tct-filesystem-tizen-tests/filesystem/File_readAsText_missarg.html
tct-filesystem-tizen-tests/filesystem/File_readOnly_attribute.html

index 6cab2eedfa640a8915c1f13815b291f1d13cfdef..01c6b67184688819e2bfef041d095a32e47b7f0f 100644 (file)
@@ -59,7 +59,7 @@ t.step(function () {
         fs.write(testStr);
         fs.position = 0;
         assert_true("bytesAvailable" in fs, "bytesAvailable doesn't exist");
-        check_readonly(fs, "bytesAvailable", fs.bytesAvailable, "number", 2);
+        check_readonly(fs, "bytesAvailable", fs.bytesAvailable, "long", fs.bytesAvailable + 2);
         fs.close();
         t.done();
     });
index 414d00488e548b9727582237e6e5e476f84266b5..4ff7210082380922d23c5a2000a22c4ae264fa18 100644 (file)
@@ -40,10 +40,11 @@ var t = async_test("FileSystemManager_addStorageStateChangeListener_onerror_inva
     exceptionName = "TypeMismatchError", incorrectCallback, onSuccess;
 t.step(function () {
     onSuccess = t.step_func(function (storage) {
+        assert_unreached("onSuccess callback invoked");
     });
     incorrectCallback = {
         onerror: t.step_func(function (){
-            assert_unreached("Invalid callback invoked: ");
+            assert_unreached("invalid callback invoked");
         })
     };
     assert_throws({name : exceptionName},
index be2be00a006d4123e6162def39529e54db3c346c..26463752814319d8fe4a614c8ffcfc75d14dafd2 100644 (file)
@@ -18,6 +18,7 @@ limitations under the License.
 Authors:
     Piotr Czaja <p.czaja@samsung.com>
     Beata Koziarek <b.koziarek@samsung.com>
+    Mariusz Polasinski <m.polasinski@samsung.com>
 
 -->
 <html lang="en">
@@ -29,25 +30,32 @@ Authors:
 
 <body>
 <div id="log"></div>
-<script>
+<script type="text/javascript">
+
 //==== TEST: FileSystemManager_listStorages_with_onerror
 //==== PRIORITY P1
 //==== LABEL Check with optional arguments listStorages
 //==== SPEC Tizen Web API:IO:Filesystem:FileSystemManager:listStorages M
 //==== SPEC_URL https://developer.tizen.org/help/index.jsp?topic=/org.tizen.web.device.apireference/tizen/filesystem.html
-//==== TEST_CRITERIA
+//==== TEST_CRITERIA MOA MR
 
-//  Check with optional arguments listStorages
 var t = async_test("FileSystemManager_listStorages_with_onerror"),
-    onSuccess, onError;
-t.step(function(){
-    onError = t.step_func(function (error) {
-        assert_unreached("Error: " + error.message);
-    });
-    onSuccess = t.step_func(function (storage) {
+    listStoragesSuccess, listStoragesError, retValue = null;
+
+t.step(function () {
+
+    listStoragesSuccess = t.step_func(function (storages) {
+        assert_type(storages, "array", "incorrect type of the received argument");
+        assert_true(storages.length > 0, "incorrect received argument");
+        assert_equals(retValue, undefined, "listStorages returns wrong value");
         t.done();
     });
-    tizen.filesystem.resolve("images", onSuccess, onError);
+
+    listStoragesError = t.step_func(function (error) {
+        assert_unreached("listStorages() error callback invoked: name: " + error.name + ", msg: " + error.message);
+    });
+
+    retValue = tizen.filesystem.listStorages(listStoragesSuccess, listStoragesError);
 });
 
 </script>
index 0bd750a702ad908713bc11703faa905a868b24a8..eb6c9f4de5d24bc011ab04c7bc8b9692d0d32c68 100644 (file)
@@ -41,7 +41,7 @@ Authors:
 test(function () {
     var maxLength = tizen.filesystem.maxPathLength;
     assert_true("maxPathLength" in tizen.filesystem, "attribute doesn't exist");
-    check_readonly(tizen.filesystem, "maxPathLength", maxLength, "long", 10);
+    check_readonly(tizen.filesystem, "maxPathLength", maxLength, "long", maxLength - 5);
 }, "FileSystemManager_maxPathLength_attribute");
 
 </script>
index bb185f053c0a65fed3c5e7b43a2d97902de477bf..4c3e5da61975bdfb81e4c02e9abce38493d34a25 100644 (file)
@@ -18,6 +18,7 @@ limitations under the License.
 Authors:
     Piotr Czaja <p.czaja@samsung.com>
     Beata Koziarek <b.koziarek@samsung.com>
+    Mariusz Polasinski <m.polasinski@samsung.com>
 
 -->
 <html lang="en">
@@ -38,12 +39,11 @@ Authors:
 //==== TEST_CRITERIA MC
 
 var t = async_test("FileSystemManager_resolve_mode_TypeMismatch"),
-    conversionTable, resolveSuccess, resolveError, mode, exceptionName, expected, i;
+    conversionTable, resolveSuccess, resolveError, mode, exceptionName, i;
 
 t.step(function () {
     resolveSuccess = t.step_func(function (dir) {
-        expected="images";
-        assert_equals(dir.path ,expected, "resolve a location to a file handle");
+        assert_unreached("resolveSuccess was invoked");
     });
     resolveError = t.step_func(function (error) {
         assert_unreached("resolve() error callback invoked: name:" + error.name + "msg:" + error.message);
index 5a221d7f70d92b3a802d0505f365d7a703f069e5..fa7d522d433166a82345e95c5acef0bf1ece6332 100644 (file)
@@ -36,16 +36,16 @@ Authors:
 //==== SPEC_URL: https://developer.tizen.org/help/index.jsp?topic=/org.tizen.web.device.apireference/tizen/filesystem.html
 //==== TEST_CRITERIA AE AT ARO
 
-var t = async_test("FileSystemStorage_label_attribute"), listStoragesSucces;
+var t = async_test("FileSystemStorage_label_attribute"), listStoragesSuccess;
 t.step(function () {
-    listStoragesSucces = t.step_func(function (storages) {
+    listStoragesSuccess = t.step_func(function (storages) {
         assert_true(storages.length > 0, "No available storage");
         assert_true("label" in storages[0],"label not in FileSystemStorage");
-        check_readonly(storages[0], "label", storages[0].label, "string", "dummyValue");
+        check_readonly(storages[0], "label", storages[0].label, "string", storages[0].label + "dummyValue");
         t.done();
     });
 
-    tizen.filesystem.listStorages(listStoragesSucces);
+    tizen.filesystem.listStorages(listStoragesSuccess);
 });
 
 </script>
index 956dbf94e8a7790a56e9af7855d4d064a3c875bc..c043ebc6918fb5e49d036dac6cd686a1f1aad6dd 100644 (file)
@@ -17,6 +17,7 @@ limitations under the License.
 
 Authors:
         Beata Koziarek <b.koziarek@samsung.com>
+        Mariusz Polasinski <m.polasinski@samsung.com>
 
 -->
 <html lang="en">
@@ -44,7 +45,8 @@ t.step(function () {
     resolveSuccess = t.step_func(function (dir) {
         fsTestFile = dir.createFile(fsTestFileName);
         assert_own_property(fsTestFile, "fileSize", "File does not own fileSize property.");
-        check_readonly(fsTestFile, "fileSize", 0, "number", "valueToAssign");
+        check_readonly(fsTestFile, "fileSize", 0, "unsigned long long", fsTestFile.fileSize + 512);
+        assert_equals(dir.fileSize, undefined, "fileSize of directory should be undefined");
         t.done();
     });
 
index 996508c2faae2a857305e2c1baccbc24ec948956..5a6c6f28267c09eeeca4abd5db25fd25babfa603 100644 (file)
@@ -44,7 +44,7 @@ t.step(function () {
     resolveSuccess = t.step_func(function (dir) {
         fsTestFile = dir.createFile(fsTestFileName);
         assert_own_property(fsTestFile, "fullPath", "File does not own fullPath property.");
-        check_readonly(fsTestFile, "fullPath", fsTestFile.fullPath, "string", "valueToAssign");
+        check_readonly(fsTestFile, "fullPath", fsTestFile.fullPath, "string", "images");
         t.done();
     });
 
index 4b0c031d4be25b7e7b00da62819db3b89e986466..bcea64ed9fa5cee08ac1f2f43752392c2fc8fc01 100644 (file)
@@ -41,7 +41,7 @@ var t = async_test("File_isDirectory_attribute"),
 t.step(function () {
     resolveSuccess = t.step_func(function (dir) {
         assert_own_property(dir, "isDirectory", "File does not own isDirectory property.");
-        check_readonly(dir, "isDirectory", true, "boolean", "valueToAssign");
+        check_readonly(dir, "isDirectory", true, "boolean", false);
         t.done();
     });
 
index 8365c53fb59a921b07aad287b35131719b2fadf2..db15bce69c9d9dffd5c2954bc76ce83a45e1e7e1 100644 (file)
@@ -41,7 +41,7 @@ var t = async_test("File_isFile_attribute"),
 t.step(function () {
     resolveSuccess = t.step_func(function (dir) {
         assert_own_property(dir, "isFile", "File does not own isFile property.");
-        check_readonly(dir, "isFile", false, "boolean", "valueToAssign");
+        check_readonly(dir, "isFile", false, "boolean", true);
         t.done();
     });
 
index 04f47673dc7d6f6cc03232597e6dd4df5ef4b46d..cc6c6945bafe793207d9474148ca6cf73f454f1d 100644 (file)
@@ -17,6 +17,7 @@ limitations under the License.
 
 Authors:
         Beata Koziarek <b.koziarek@samsung.com>
+        Mariusz Polasinski <m.polasinski@samsung.com>
 
 -->
 <html>
@@ -35,13 +36,15 @@ Authors:
 //==== SPEC_URL: https://developer.tizen.org/help/index.jsp?topic=/org.tizen.web.device.apireference/tizen/filesystem.html
 //==== TEST_CRITERIA AE AT ARO
 
-var t = async_test("File_length_attribute"),
-    resolveSuccess, resolveError
-;
+var t = async_test("File_length_attribute"), fsTestFileName =  getFileName("filesystem.txt"),
+    resolveSuccess, resolveError, fsTestFile;
+
 t.step(function () {
     resolveSuccess = t.step_func(function (dir) {
         assert_own_property(dir, "length", "File does not own length property.");
-        check_readonly(dir, "length", dir.length, "number", "valueToAssign");
+        check_readonly(dir, "length", dir.length, "long", dir.length + 10);
+        fsTestFile = dir.createFile(fsTestFileName);
+        assert_equals(fsTestFile.length, undefined, "length of file should be undefined");
         t.done();
     });
 
@@ -49,7 +52,9 @@ t.step(function () {
         assert_unreached("resolve() error callback invoked: name:" + error.name + "msg:" + error.message);
     });
 
-    tizen.filesystem.resolve("documents", resolveSuccess, resolveError, "rw");
+    prepareForTesting(t, function () {
+        tizen.filesystem.resolve("documents", resolveSuccess, resolveError, "rw");
+    });
 });
 
 </script>
index b7ef95f7b3d8283406c7ea33e5989b27bb2e0272..86c5a78c86313c2fc2cd5ac65702daf9b09200a1 100644 (file)
@@ -43,7 +43,7 @@ t.step(function () {
     resolveSuccess = t.step_func(function (dir) {
         fsTestFile = dir.createFile(fsTestFileName);
         assert_own_property(fsTestFile, "name", "File does not own name property.");
-        check_readonly(fsTestFile, "name", fsTestFile.name, "string", "valueToAssign");
+        check_readonly(fsTestFile, "name", fsTestFile.name, "string", fsTestFile.name + "dummyValue");
         t.done();
     });
 
index 1c50d78ce37a850cae4769ffd6eff67a949fd763..93e19c98019bf5732d0e662b3d6e246663537ba8 100644 (file)
@@ -41,7 +41,7 @@ var t = async_test("File_path_attribute"), resolveSuccess, resolveError;
 t.step(function () {
     resolveSuccess = t.step_func(function (dir) {
         assert_own_property(dir, "path", "file does not have own path property");
-        check_readonly(dir, "path", "documents", "string", "images");
+        check_readonly(dir, "path", dir.path, "string", "images");
         assert_equals(dir.path, "documents", "incorrect path");
         t.done();
     });
index 2e6054a6b24550d5c9f345054faa0dfd808f3fed..1534f1b00aa683183b977cf21f403893c00cbe2f 100644 (file)
@@ -17,6 +17,7 @@ limitations under the License.
 
 Authors:
     Beata Koziarek <b.koziarek@samsung.com>
+    Mariusz Polasinski <m.polasinski@samsung.com>
 
 -->
 <html lang="en">
@@ -29,7 +30,8 @@ Authors:
 
 <body>
 <div id="log"></div>
-<script>
+<script type="text/javascript">
+
 //==== TEST: File_readAsText_missarg
 //==== PRIORITY: P2
 //==== LABEL: Check if readAsText of File with missing non-optional argument works
@@ -41,19 +43,19 @@ var t = async_test("File_readAsText_missarg"),
     resolveSuccess, resolveError, file,
     fsTestFileName = getFileName("testMissArg.txt");
 
-t.step(function(){
+t.step(function () {
     resolveSuccess = t.step_func(function (dir) {
         file = dir.createFile(fsTestFileName);
         file.openStream("w",
-            function(fs){
+            t.step_func(function (fs) {
                 fs.write("HelloWorld");
                 fs.close();
-            });
-        assert_throws({name: "TypeMismatchError"},
-            function () {
-                file.readAsText();
-            });
-        t.done();
+                assert_throws({name: "TypeMismatchError"},
+                    function () {
+                        file.readAsText();
+                    });
+                t.done();
+            }));
     });
     resolveError = t.step_func(function (error) {
         assert_unreached("resolve() error callback invoked: name: " + error.name + ", msg: " + error.message);
index f365efda3ac63e8dc977e830197e35cae930beb6..835447bbc99ec53d9ab15e417e71ff304a28af9f 100644 (file)
@@ -37,10 +37,10 @@ Authors:
 
 var t = async_test("File_readOnly_attribute"),
     onSuccess, onError;
-t.step(function(){
+t.step(function () {
     onSuccess = t.step_func(function (dir) {
         assert_own_property(dir, "readOnly", "File does not own readOnly property.");
-        check_readonly(dir, "readOnly", false, "boolean", "valueToAssign");
+        check_readonly(dir, "readOnly", false, "boolean", true);
         t.done();
     });
     onError = t.step_func(function (error) {