From: chen89.chen Date: Tue, 9 Nov 2021 13:58:26 +0000 (+0800) Subject: [common][filesystem][change time sequence for async apis] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F266205%2F2;p=test%2Ftct%2Fweb%2Fapi.git [common][filesystem][change time sequence for async apis] Change-Id: I74a92404bde4298f0124822ecabb2a390c273552 Signed-off-by: chen89.chen --- diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_flushNonBlocking.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_flushNonBlocking.html index acdb08fe9..2a2e0aaac 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_flushNonBlocking.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_flushNonBlocking.html @@ -51,6 +51,10 @@ t.step(function () { }); writeStringNonBlockingSuccess = t.step_func(function (bytesCount) { + retVal = fileHandleWrite.flushNonBlocking(); + assert_equals(retVal, undefined, "return value should be undefined"); + fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); + fileHandleRead.readStringNonBlocking(readStringNonBlockingSuccess, readStringNonBlockingError); }); writeStringNonBlockingError = t.step_func(function (error) { @@ -68,11 +72,6 @@ t.step(function () { fileHandleWrite = tizen.filesystem.openFile("documents/file", "w"); fileHandleWrite.writeStringNonBlocking(content, writeStringNonBlockingSuccess, writeStringNonBlockingError); - retVal = fileHandleWrite.flushNonBlocking(); - assert_equals(retVal, undefined, "return value should be undefined"); - - fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); - fileHandleRead.readStringNonBlocking(readStringNonBlockingSuccess, readStringNonBlockingError); }); diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_flushNonBlocking_with_onerror.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_flushNonBlocking_with_onerror.html index 7e41892cb..400bbb9d7 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_flushNonBlocking_with_onerror.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_flushNonBlocking_with_onerror.html @@ -50,36 +50,35 @@ t.step(function () { } }); - writeStringNonBlockingSuccess = t.step_func(function (bytesCount) { + readStringNonBlockingSuccess = t.step_func(function (output) { + assert_equals(output, content, "the flush content is not right"); + t.done(); }); - writeStringNonBlockingError = t.step_func(function (error) { - assert_unreached("writeStringNonBlocking() error callback invoked: name:" + error.name + "msg:" + error.message); + readStringNonBlockingError = t.step_func(function (error) { + assert_unreached("readStringNonBlocking() error callback invoked: name:" + error.name + "msg:" + error.message); }); flushNonBlockingSuccess = t.step_func(function () { + fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); + fileHandleRead.readStringNonBlocking(readStringNonBlockingSuccess, readStringNonBlockingError); }); flushNonBlockingError = t.step_func(function (error) { assert_unreached("flushNonBlocking() error callback invoked: name:" + error.name + "msg:" + error.message); }); - readStringNonBlockingSuccess = t.step_func(function (output) { - assert_equals(output, content, "the flush content is not right"); - t.done(); + writeStringNonBlockingSuccess = t.step_func(function (bytesCount) { + retVal = fileHandleWrite.flushNonBlocking(flushNonBlockingSuccess, flushNonBlockingError); + assert_equals(retVal, undefined, "return value should be undefined"); }); - readStringNonBlockingError = t.step_func(function (error) { - assert_unreached("readStringNonBlocking() error callback invoked: name:" + error.name + "msg:" + error.message); + writeStringNonBlockingError = t.step_func(function (error) { + assert_unreached("writeStringNonBlocking() error callback invoked: name:" + error.name + "msg:" + error.message); }); fileHandleWrite = tizen.filesystem.openFile("documents/file", "w"); fileHandleWrite.writeStringNonBlocking(content, writeStringNonBlockingSuccess, writeStringNonBlockingError); - retVal = fileHandleWrite.flushNonBlocking(flushNonBlockingSuccess, flushNonBlockingError); - assert_equals(retVal, undefined, "return value should be undefined"); - - fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); - fileHandleRead.readStringNonBlocking(readStringNonBlockingSuccess, readStringNonBlockingError); }); diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readBlobNonBlocking.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readBlobNonBlocking.html index a2fd56093..0b4398350 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readBlobNonBlocking.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readBlobNonBlocking.html @@ -42,12 +42,18 @@ var t = async_test(document.title), writeBlobNonBlockingSuccess, writeBlobNonBlo t.step(function () { add_result_callback(function () { try { + fileHandleWrite.close(); + fileHandleRead.close(); tizen.filesystem.deleteFile("documents/file"); } catch (err) { } }); writeBlobNonBlockingSuccess = t.step_func(function (blob) { + fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); + retVal = fileHandleRead.readBlobNonBlocking(); + assert_equals(retVal, undefined, "return value should be undefined"); + t.done(); }); writeBlobNonBlockingError = t.step_func(function (error) { @@ -57,13 +63,6 @@ t.step(function () { blob = new Blob([content], {type: "text/plain"}); fileHandleWrite = tizen.filesystem.openFile("documents/file", "w"); fileHandleWrite.writeBlobNonBlocking(blob, writeBlobNonBlockingSuccess, writeBlobNonBlockingError); - fileHandleWrite.close(); - - fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); - retVal = fileHandleRead.readBlobNonBlocking(); - assert_equals(retVal, undefined, "return value should be undefined"); - fileHandleRead.close(); - t.done(); }); diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readBlobNonBlocking_with_size.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readBlobNonBlocking_with_size.html index f65c2d579..808b57ecc 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readBlobNonBlocking_with_size.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readBlobNonBlocking_with_size.html @@ -43,6 +43,8 @@ var t = async_test(document.title), writeBlobNonBlockingSuccess, writeBlobNonBlo t.step(function () { add_result_callback(function () { try { + fileHandleWrite.close(); + fileHandleRead.close(); tizen.filesystem.deleteFile("documents/file"); } catch (err) { } @@ -51,11 +53,14 @@ t.step(function () { eventCallback = t.step_func(function (contents) { text = contents.srcElement.result; assert_equals(text, content.substring(0, 5), "The read blob content is not right"); - fileHandleRead.close(); t.done(); }); writeBlobNonBlockingSuccess = t.step_func(function (blob) { + fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); + reader = new FileReader(), + reader.addEventListener("loadend", eventCallback); + retVal = fileHandleRead.readBlobNonBlocking(readBlobNonBlockingSuccess, readBlobNonBlockingError, 5); }); writeBlobNonBlockingError = t.step_func(function (error) { @@ -74,12 +79,6 @@ t.step(function () { blob = new Blob([content], {type: "text/plain"}); fileHandleWrite = tizen.filesystem.openFile("documents/file", "w"); fileHandleWrite.writeBlobNonBlocking(blob, writeBlobNonBlockingSuccess, writeBlobNonBlockingError); - fileHandleWrite.close(); - - fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); - reader = new FileReader(), - reader.addEventListener("loadend", eventCallback); - retVal = fileHandleRead.readBlobNonBlocking(readBlobNonBlockingSuccess, readBlobNonBlockingError, 5); }); diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readData.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readData.html index c441359e6..010d35ce2 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readData.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readData.html @@ -40,6 +40,7 @@ test(function () { add_result_callback(function () { try { + fileHandleRead.close(); tizen.filesystem.deleteFile("documents/file"); } catch (err) { } @@ -53,7 +54,6 @@ test(function () { fileContentsInUint8Array = fileHandleRead.readData(); assert_type(fileContentsInUint8Array, "object", "The type returned should be of object type."); assert_array_equals(fileContentsInUint8Array, dataToWrite, "Data read from file is not right"); - fileHandleRead.close(); }, document.title); diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readDataNonBlocking.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readDataNonBlocking.html index 8a0434a50..d80414808 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readDataNonBlocking.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readDataNonBlocking.html @@ -42,12 +42,18 @@ var t = async_test(document.title), dataToWrite = new Uint8Array([11, 21, 31, 71 t.step(function () { add_result_callback(function () { try { + fileHandleWrite.close(); + fileHandleRead.close(); tizen.filesystem.deleteFile("documents/file"); } catch (err) { } }); writeDataNonBlockingSuccess = t.step_func(function () { + fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); + retVal = fileHandleRead.readDataNonBlocking(); + assert_equals(retVal, undefined, "return value should be undefined"); + t.done(); }); writeDataNonBlockingError = t.step_func(function (error) { @@ -56,14 +62,6 @@ t.step(function () { fileHandleWrite = tizen.filesystem.openFile("documents/file", "w"); fileHandleWrite.writeDataNonBlocking(dataToWrite, writeDataNonBlockingSuccess, writeDataNonBlockingError); - fileHandleWrite.close(); - - fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); - retVal = fileHandleRead.readDataNonBlocking(); - assert_equals(retVal, undefined, "return value should be undefined"); - - fileHandleRead.close(); - t.done(); }); diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readDataNonBlocking_with_size.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readDataNonBlocking_with_size.html index 2d78461e6..fb75456fe 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readDataNonBlocking_with_size.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readDataNonBlocking_with_size.html @@ -42,12 +42,16 @@ var t = async_test(document.title), dataToWrite = new Uint8Array([11, 21, 31, 71 t.step(function () { add_result_callback(function () { try { + fileHandleWrite.close(); + fileHandleRead.close(); tizen.filesystem.deleteFile("documents/file"); } catch (err) { } }); writeDataNonBlockingSuccess = t.step_func(function () { + fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); + retVal = fileHandleRead.readDataNonBlocking(readDataNonBlockingSuccess, readDataNonBlockingError, 3); }); writeDataNonBlockingError = t.step_func(function (error) { @@ -57,8 +61,6 @@ t.step(function () { readDataNonBlockingSuccess = t.step_func(function (data) { assert_equals(retVal, undefined, "return value should be undefined"); assert_array_equals(data, dataToWrite.subarray(0, 3), "Data read from file is not right"); - - fileHandleRead.close(); t.done(); }); @@ -68,10 +70,6 @@ t.step(function () { fileHandleWrite = tizen.filesystem.openFile("documents/file", "w"); fileHandleWrite.writeDataNonBlocking(dataToWrite, writeDataNonBlockingSuccess, writeDataNonBlockingError); - fileHandleWrite.close(); - - fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); - retVal = fileHandleRead.readDataNonBlocking(readDataNonBlockingSuccess, readDataNonBlockingError, 3); }); diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readData_InvalidValuesError.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readData_InvalidValuesError.html index ad4172c29..4df1aae7f 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readData_InvalidValuesError.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_readData_InvalidValuesError.html @@ -40,6 +40,7 @@ test(function () { add_result_callback(function () { try { + fileHandleRead.close(); tizen.filesystem.deleteFile("documents/file"); } catch (err) { } @@ -53,7 +54,6 @@ test(function () { assert_throws(INVALID_VALUES_EXCEPTION, function () { fileHandleRead.readData(0x7fffffffffffffff); }, "InvalidValuesError should be thrown - invalid count."); - fileHandleRead.close(); }, document.title); diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_syncNonBlocking.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_syncNonBlocking.html index 0725429d7..f41f381fd 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_syncNonBlocking.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_syncNonBlocking.html @@ -50,6 +50,11 @@ t.step(function () { }); writeDataNonBlockingSuccess = t.step_func(function (data) { + retVal = fileHandleWrite.syncNonBlocking(); + assert_equals(retVal, undefined, "return value should be undefined"); + + fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); + fileHandleRead.readDataNonBlocking(readDataNonBlockingSuccess, readDataNonBlockingError); }); writeDataNonBlockingError = t.step_func(function (error) { @@ -67,11 +72,6 @@ t.step(function () { fileHandleWrite = tizen.filesystem.openFile("documents/file", "w"); fileHandleWrite.writeDataNonBlocking(dataToWrite, writeDataNonBlockingSuccess, writeDataNonBlockingError); - retVal = fileHandleWrite.syncNonBlocking(); - assert_equals(retVal, undefined, "return value should be undefined"); - - fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); - fileHandleRead.readDataNonBlocking(readDataNonBlockingSuccess, readDataNonBlockingError); }); diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_syncNonBlocking_with_onerror.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_syncNonBlocking_with_onerror.html index a793cbdd9..7f7479499 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_syncNonBlocking_with_onerror.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_syncNonBlocking_with_onerror.html @@ -51,6 +51,8 @@ t.step(function () { }); writeDataNonBlockingSuccess = t.step_func(function (data) { + retVal = fileHandleWrite.syncNonBlocking(syncNonBlockingSuccess, syncNonBlockingError); + assert_equals(retVal, undefined, "return value should be undefined"); }); writeDataNonBlockingError = t.step_func(function (error) { @@ -67,6 +69,8 @@ t.step(function () { }); syncNonBlockingSuccess = t.step_func(function () { + fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); + fileHandleRead.readDataNonBlocking(readDataNonBlockingSuccess, readDataNonBlockingError); }); syncNonBlockingError = t.step_func(function (error) { @@ -75,11 +79,6 @@ t.step(function () { fileHandleWrite = tizen.filesystem.openFile("documents/file", "w"); fileHandleWrite.writeDataNonBlocking(dataToWrite, writeDataNonBlockingSuccess, writeDataNonBlockingError); - retVal = fileHandleWrite.syncNonBlocking(syncNonBlockingSuccess, syncNonBlockingError); - assert_equals(retVal, undefined, "return value should be undefined"); - - fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); - fileHandleRead.readDataNonBlocking(readDataNonBlockingSuccess, readDataNonBlockingError); }); diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_writeBlobNonBlocking_with_onerror.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_writeBlobNonBlocking_with_onerror.html index 4567c761a..f41338eae 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_writeBlobNonBlocking_with_onerror.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_writeBlobNonBlocking_with_onerror.html @@ -43,6 +43,7 @@ var t = async_test(document.title), writeBlobNonBlockingSuccess, writeBlobNonBlo t.step(function () { add_result_callback(function () { try { + fileHandleWrite.close(); fileHandleRead.close(); tizen.filesystem.deleteFile("documents/file"); } catch (err) { @@ -56,6 +57,10 @@ t.step(function () { }); writeBlobNonBlockingSuccess = t.step_func(function (blob) { + fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); + reader = new FileReader(), + reader.addEventListener("loadend", eventCallback); + fileHandleRead.readBlobNonBlocking(readBlobNonBlockingSuccess, readBlobNonBlockingError); }); writeBlobNonBlockingError = t.step_func(function (error) { @@ -74,12 +79,6 @@ t.step(function () { fileHandleWrite = tizen.filesystem.openFile("documents/file", "w"); retVal = fileHandleWrite.writeBlobNonBlocking(blob, writeBlobNonBlockingSuccess, writeBlobNonBlockingError); assert_equals(retVal, undefined, "return value should be undefined"); - fileHandleWrite.close(); - - fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); - reader = new FileReader(), - reader.addEventListener("loadend", eventCallback); - fileHandleRead.readBlobNonBlocking(readBlobNonBlockingSuccess, readBlobNonBlockingError); }); diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_writeDataNonBlocking_with_onerror.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_writeDataNonBlocking_with_onerror.html index 91b9b7994..8edc20c0f 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_writeDataNonBlocking_with_onerror.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_writeDataNonBlocking_with_onerror.html @@ -42,12 +42,16 @@ var t = async_test(document.title), dataToWrite = new Uint8Array([11, 21, 31, 71 t.step(function () { add_result_callback(function () { try { + fileHandleWrite.close(); + fileHandleRead.close(); tizen.filesystem.deleteFile("documents/file"); } catch (err) { } }); writeDataNonBlockingSuccess = t.step_func(function () { + fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); + fileHandleRead.readDataNonBlocking(readDataNonBlockingSuccess, readDataNonBlockingError); }); writeDataNonBlockingError = t.step_func(function (error) { @@ -56,7 +60,6 @@ t.step(function () { readDataNonBlockingSuccess = t.step_func(function (data) { assert_array_equals(data, dataToWrite, "Data read from file is not right"); - fileHandleRead.close(); t.done(); }); @@ -67,10 +70,6 @@ t.step(function () { fileHandleWrite = tizen.filesystem.openFile("documents/file", "w"); retVal = fileHandleWrite.writeDataNonBlocking(dataToWrite, writeDataNonBlockingSuccess, writeDataNonBlockingError); assert_equals(retVal, undefined, "return value should be undefined"); - fileHandleWrite.close(); - - fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); - fileHandleRead.readDataNonBlocking(readDataNonBlockingSuccess, readDataNonBlockingError); }); diff --git a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_writeStringNonBlocking_with_outputEncoding.html b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_writeStringNonBlocking_with_outputEncoding.html index da0215388..6a1998c8f 100755 --- a/common/tct-filesystem-tizen-tests/filesystem/FileHandle_writeStringNonBlocking_with_outputEncoding.html +++ b/common/tct-filesystem-tizen-tests/filesystem/FileHandle_writeStringNonBlocking_with_outputEncoding.html @@ -43,12 +43,16 @@ var t = async_test(document.title), writeStringNonBlockingSuccess, writeStringNo t.step(function () { add_result_callback(function () { try { + fileHandleWrite.close(); + fileHandleRead.close(); tizen.filesystem.deleteFile("documents/file"); } catch (err) { } }); writeStringNonBlockingSuccess = t.step_func(function (bytesCount) { + fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); + fileHandleRead.readStringNonBlocking(readStringNonBlockingSuccess, readStringNonBlockingError, 5, "UTF-8"); }); writeStringNonBlockingError = t.step_func(function (error) { @@ -57,7 +61,6 @@ t.step(function () { readStringNonBlockingSuccess = t.step_func(function (output) { assert_equals(output, content.substring(0, 5), "The read content should be same as the written content."); - fileHandleRead.close(); t.done(); }); @@ -68,10 +71,6 @@ t.step(function () { fileHandleWrite = tizen.filesystem.openFile("documents/file", "w"); retVal = fileHandleWrite.writeStringNonBlocking(content, writeStringNonBlockingSuccess, writeStringNonBlockingError, "UTF-8"); assert_equals(retVal, undefined, "return value should be undefined"); - fileHandleWrite.close(); - - fileHandleRead = tizen.filesystem.openFile("documents/file", "r"); - fileHandleRead.readStringNonBlocking(readStringNonBlockingSuccess, readStringNonBlockingError, 5, "UTF-8"); });