// Check argument onError validation
var t = async_test(document.title),
- exceptionName = "TypeMismatchError", incorrectCallback, onSuccess;
+ incorrectCallback, onSuccess;
t.step(function () {
onSuccess = t.step_func(function (storage) {
assert_unreached("onSuccess callback invoked");
assert_unreached("invalid callback invoked");
})
};
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
tizen.filesystem.addStorageStateChangeListener(onSuccess, incorrectCallback);
- }, exceptionName + " should be thrown - given incorrect error callback.");
+ }, "given incorrect errorCallback");
t.done();
});
// Check argument onSuccess validation
var t = async_test(document.title),
- exceptionName = "TypeMismatchError", incorrectCallback;
+ incorrectCallback;
t.step(function () {
incorrectCallback = {
assert_unreached("Invalid callback invoked: ");
})
};
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
tizen.filesystem.addStorageStateChangeListener(incorrectCallback);
- }, exceptionName + " should be thrown - given incorrect error callback.");
+ }, "given incorrect error callback");
t.done();
});
// Check argument onError validation
var t = async_test(document.title),
- exceptionName = "TypeMismatchError", getStorageIncorrect, getStorageSuccess,
+ getStorageIncorrect, getStorageSuccess,
listStoragesSuccess, listStoragesError;
t.step(function () {
assert_unreached("listStorages() error callback invoked: name: " + error.name + ", msg: " + error.message);
});
listStoragesSuccess = t.step_func(function (storages) {
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
tizen.filesystem.getStorage(storages[0].label, getStorageSuccess, getStorageIncorrect);
- }, exceptionName + " should be thrown - given incorrect error callback.");
+ }, "given incorrect errorCallback");
t.done();
});
// Check argument onSuccess validation
var t = async_test(document.title),
- exceptionName = "TypeMismatchError", getStorageIncorrect, listStoragesError,
+ getStorageIncorrect, listStoragesError,
listStoragesSuccess;
t.step(function () {
};
listStoragesSuccess = t.step_func(function (storages) {
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
tizen.filesystem.getStorage(storages[0].label, getStorageIncorrect);
- }, exceptionName + " should be thrown - given incorrect error callback.");
+ }, "given incorrect error callback");
t.done();
});
listStoragesError = t.step_func(function (error) {
// Check argument onError validation
var t = async_test(document.title),
- exceptionName = "TypeMismatchError", listStoragesIncorrect,
- listStoragesSuccess;
+ listStoragesIncorrect, listStoragesSuccess;
t.step(function () {
assert_unreached("Invalid callback invoked: ");
})
};
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
tizen.filesystem.listStorages(listStoragesSuccess, listStoragesIncorrect);
- }, exceptionName + "should be thrown - given incorrect error callback.");
+ }, "given incorrect errorCallback");
t.done();
});
// Check argument onSuccess validation
var t = async_test(document.title),
- exceptionName = "TypeMismatchError", listStoragesIncorrect;
+ listStoragesIncorrect;
t.step(function () {
assert_unreached("Invalid callback invoked: ");
})
};
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
tizen.filesystem.listStorages(listStoragesIncorrect);
- }, exceptionName + "should be thrown - given incorrect error callback.");
+ }, "given incorrect error callback");
t.done();
});
//==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/filesystem.html
//==== TEST_CRITERIA MC
var t = async_test(document.title),
- invalid_type_params = [123, "abc", true, {}], getStorageSuccess, i;
+ invalidTypeParams = [123, "abc", true, {}], getStorageSuccess, i;
t.step(function () {
getStorageSuccess = t.step_func(function (storages) {
assert_unreached("Unexpected getStorageSuccess");
});
- for (i = 0; i < invalid_type_params.length; i++) {
+ for (i = 0; i < invalidTypeParams.length; i++) {
assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
tizen.filesystem.listStorages(
getStorageSuccess,
- invalid_type_params[i]
+ invalidTypeParams[i]
);
});
}
//==== TEST_CRITERIA MTCB
var t = async_test(document.title),
- exceptionName = "TypeMismatchError", resolveError, resolveSuccess,
- conversionTable;
+ resolveError, resolveSuccess, conversionTable;
t.step(function () {
conversionTable = getTypeConversionExceptions("functionObject", true);
assert_unreached("Invalid callback invoked: ");
})
};
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
tizen.filesystem.resolve("images", resolveSuccess, resolveError, "rw");
- }, exceptionName + "should be thrown - given incorrect error callback.");
+ }, "given incorrect errorCallback");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title),
- exceptionName = "TypeMismatchError", resolveSuccess, resolveError;
+ resolveSuccess, resolveError;
t.step(function () {
})
};
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
tizen.filesystem.resolve("documents", resolveSuccess, resolveError);
- }, exceptionName + "should be thrown - given incorrect error callback.");
+ }, "given incorrect error callback");
t.done();
});
assert_true("fileSize" in dir, "fileSize don't exist in object");
assert_type(dir.fileSize, "undefined", "fileSize should be undefined");
assert_true("length" in dir, "length don't exist in object");
- assert_type(dir.length, "number", "type of length should be number");
+ assert_type(dir.length, "long", "type of length should be number");
assert_true(dir.length >= 0, "value of length should be >= 0");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title), resolveSuccess, resolveError,
- copySuccess, copyError, exceptionName = "TypeMismatchError", fsTestFileName;
+ copySuccess, copyError, fsTestFileName;
t.step(function () {
fsTestFileName = getFileName("filesystem.txt");
});
resolveSuccess = t.step_func(function (dir) {
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
dir.copyTo(fsTestFileName, "images", true, copySuccess, copyError);
- }, exceptionName + " should be thrown - given incorrect errorCallback.");
+ }, "given incorrect errorCallback");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title),
- resolveSuccess, resolveError, copySuccess, exceptionName = "TypeMismatchError", fsTestFile, fsTestFileName;
+ resolveSuccess, resolveError, copySuccess, fsTestFile, fsTestFileName;
t.step(function (){
fsTestFileName = getFileName("filesystem.txt");
resolveSuccess = t.step_func(function (dir) {
fsTestFile = dir.createFile(fsTestFileName);
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
dir.copyTo(fsTestFile.fullPath, "images", true, copySuccess);
- }, exceptionName + " should be thrown - given incorrect successCallback.");
+ }, "given incorrect successCallback");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title),
- resolveSuccess, resolveError, deleteDirectorySuccess, deleteDirectoryError, fsTestDirName, fsTestDir,
- exceptionName = "TypeMismatchError";
+ resolveSuccess, resolveError, deleteDirectorySuccess, deleteDirectoryError, fsTestDirName, fsTestDir;
t.step(function () {
fsTestDirName = getDirName("filesystem");
resolveSuccess = t.step_func(function (dir) {
fsTestDir = dir.createDirectory(fsTestDirName);
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
dir.deleteDirectory(fsTestDir.fullPath, deleteDirectorySuccess, deleteDirectoryError);
- }, exceptionName + " should be thrown - given incorrect deleteDirectorySuccess.");
+ }, "given incorrect errorCallback");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title),
- resolveSuccess, resolveError, deleteSuccess, exceptionName = "TypeMismatchError", fsTestDirName, fsTestDir;
+ resolveSuccess, resolveError, deleteSuccess, fsTestDirName, fsTestDir;
t.step(function (){
fsTestDirName = getDirName("filesystem");
resolveSuccess = t.step_func(function (dir) {
fsTestDir = dir.createDirectory(fsTestDirName);
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
dir.deleteDirectory(fsTestDir.fullPath, false, deleteSuccess);
- }, exceptionName + " should be thrown - given incorrect successCallback.");
+ }, "given incorrect successCallback");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title), fsTestFileName, fsTestFile,
- resolveSuccess, resolveError, deleteFileSuccess, exceptionName = "TypeMismatchError",
- deleteFileError;
+ resolveSuccess, resolveError, deleteFileSuccess, deleteFileError;
t.step(function () {
fsTestFileName = getFileName("filesystem.txt");
});
resolveSuccess = t.step_func(function (dir) {
fsTestFile = dir.createDirectory(fsTestFileName);
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
dir.deleteFile(fsTestFile.fullPath, deleteFileSuccess, deleteFileError);
- }, exceptionName + " should be thrown - given incorrect successCallback.");
+ }, "given incorrect errorCallback");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title), fsTestFileName, fsTestFile,
- resolveSuccess, resolveError, deleteFileSuccess, exceptionName = "TypeMismatchError";
+ resolveSuccess, resolveError, deleteFileSuccess;
t.step(function () {
fsTestFileName = getFileName("filesystem.txt");
resolveSuccess = t.step_func(function (dir) {
fsTestFile = dir.createFile(fsTestFileName);
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
dir.deleteFile(fsTestFile.fullPath, deleteFileSuccess);
- }, exceptionName + " should be thrown - given incorrect successCallback.");
+ }, "given incorrect successCallback");
t.done();
});
<html>
<head>
<title>File_listFiles</title>
-<script type="text/javascript" src="support/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
<script type="text/javascript" src="support/filesystem_common.js"></script>
</head>
<body>
resolveSuccess, resolveError, listFilesSuccess, retVal=null;
t.step(function () {
listFilesSuccess = t.step_func(function (files) {
+ assert_type(files, "array", "files should be array");
assert_equals(retVal, undefined, "incorrect returned value");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title), fsTestFileName, fsTestFile,
- resolveSuccess, resolveError, listFilesSuccess, exceptionName = "TypeMismatchError",
- listFilesError;
+ resolveSuccess, resolveError, listFilesSuccess, listFilesError;
t.step(function () {
fsTestFileName = getFileName("filesystem.txt");
});
resolveSuccess = t.step_func(function (dir) {
fsTestFile = dir.createFile(fsTestFileName);
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
fsTestFile.listFiles(listFilesSuccess, listFilesError);
- }, exceptionName + " should be thrown - given incorrect successCallback.");
+ }, "given incorrect errorCallback");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title),
- resolveSuccess, resolveError, listFilesSuccess, exceptionName = "TypeMismatchError";
+ resolveSuccess, resolveError, listFilesSuccess;
t.step(function () {
listFilesSuccess = {
};
resolveSuccess = t.step_func(function (dir) {
- assert_throws({
- name: exceptionName
- }, function () {
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
+ function () {
dir.listFiles(listFilesSuccess);
- }, exceptionName + " should be thrown - given incorrect successCallback.");
+ }, "given incorrect successCallback");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title), fsTestFileName, fsTestFile,
- resolveSuccess, resolveError, moveToSuccess, exceptionName = "TypeMismatchError",
- moveToError;
+ resolveSuccess, resolveError, moveToSuccess, moveToError;
t.step(function () {
fsTestFileName = getFileName("filesystem.txt");
resolveSuccess = t.step_func(function (dir) {
fsTestFile = dir.createFile(fsTestFileName);
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
dir.moveTo(fsTestFile.fullPath, "images", true, moveToSuccess, moveToError);
- }, exceptionName + " should be thrown - given incorrect successCallback.");
+ }, "given incorrect errorCallback");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title), resolveSuccess, resolveError,
- moveToSuccess, exceptionName = "TypeMismatchError", fsTestFileName, fsTestFile;
+ moveToSuccess, fsTestFileName, fsTestFile;
t.step(function () {
fsTestFileName = getFileName("filesystem.txt");
resolveSuccess = t.step_func(function (dir) {
fsTestFile = dir.createFile(fsTestFileName);
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
dir.moveTo(fsTestFile.fullPath, "images", true, moveToSuccess);
- }, exceptionName + " should be thrown - given incorrect successCallback.");
+ }, "given incorrect successCallback");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title),
- resolveSuccess, resolveError, openStreamSuccess, exceptionName = "TypeMismatchError",
- openStreamError;
+ resolveSuccess, resolveError, openStreamSuccess, openStreamError;
t.step(function () {
openStreamError = {
onerror: t.step_func(function (error) {
});
resolveSuccess = t.step_func(function (dir) {
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
dir.openStream("r", openStreamSuccess, openStreamError);
- }, exceptionName + " should be thrown - given incorrect successCallback.");
+ }, "given incorrect errorCallback");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title),
- resolveSuccess, resolveError, openStreamSuccess, exceptionName = "TypeMismatchError", fsTestFileName, fsTestFile;
+ resolveSuccess, resolveError, openStreamSuccess, fsTestFileName, fsTestFile;
t.step(function (){
fsTestFileName = getFileName("filesystem.txt");
resolveSuccess = t.step_func(function (dir) {
fsTestFile = dir.createFile(fsTestFileName);
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
fsTestFile.openStream("r", openStreamSuccess);
- }, exceptionName + " should be thrown - given incorrect successCallback.");
+ }, "given incorrect successCallback");
t.done();
});
//==== TEST_CRITERIA MTCB
var t = async_test(document.title),
- resolveSuccess, resolveError, readAsTextSuccess, readAsTextError,
- exceptionName = "TypeMismatchError";
+ resolveSuccess, resolveError, readAsTextSuccess, readAsTextError;
t.step(function () {
readAsTextError = {
});
resolveSuccess = t.step_func(function (dir) {
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
dir.readAsText(readAsTextSuccess, readAsTextError);
- }, exceptionName + " should be thrown - given incorrect successCallback.");
+ }, "given incorrect errorCallback");
t.done();
});
resolveError = t.step_func(function (error) {
var t = async_test(document.title),
resolveSuccess, resolveError, readAsTextSuccess,
- exceptionName = "TypeMismatchError",
fsTestFileName = getFileName("goodFile.txt"), file;
t.step(function (){
};
resolveSuccess = t.step_func(function (dir) {
file = dir.createFile(fsTestFileName);
- assert_throws({name: exceptionName},
+ assert_throws(TYPE_MISMATCH_EXCEPTION,
function () {
file.readAsText(readAsTextSuccess);
- }, exceptionName + " should be thrown - given incorrect successCallback.");
+ }, "given incorrect successCallback");
t.done();
});
resolveError = t.step_func(function (error) {
readAsTextSuccess, readAsTextError, i;
t.step(function (){
- readAsTextSuccess = t.step_func(function (files) {
+ readAsTextSuccess = t.step_func(function (text) {
t.done();
});
readAsTextError = t.step_func(function (error) {
assert_not_equals(error.message, "", "incorrect error message");
t.done();
});
- readAsTextSuccess = t.step_func(function (files) {
+ readAsTextSuccess = t.step_func(function (text) {
assert_unreached("readAsTextSuccess: readAsTextError should be invoked");
});