diff --git a/storage/BUILD.gn b/storage/BUILD.gn
index 1edfd674fb96454847bf29fc6f54276e9bd6ad89..cfad6e2f5fffcde4456d06899e2324bd0610f9f0 100644
--- a/storage/BUILD.gn
+++ b/storage/BUILD.gn
@@ -20,6 +20,7 @@ group("storage") {
"storagefileioerrorjstest:storagefileioerror_js_test",
"storagefileiojstest:storagefileio_js_test",
"storagefilejstest:storagefile_js_test",
+ "storagefilemanagerjstest:storagefilemanager_js_test",
"storagesecuritylabeljstest:storagesecuritylabel_js_test",
"storagestatfsjstest:storagestatfs_js_test",
"storagestatisticsjstest:storagestatistics_js_test",
diff --git a/storage/storagefilemanagerjstest/BUILD.gn b/storage/storagefilemanagerjstest/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..5d6161d3d159e87aa96d4c4ebc5c111a42114860
--- /dev/null
+++ b/storage/storagefilemanagerjstest/BUILD.gn
@@ -0,0 +1,31 @@
+# Copyright (C) 2022 Huawei Device 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.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("storagefilemanager_js_test") {
+ hap_profile = "./src/main/config.json"
+ deps = [
+ ":storagefilemanager_js_assets",
+ ":storagefilemanager_js_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsStorageFilemanagerJsTest"
+}
+ohos_js_assets("storagefilemanager_js_assets") {
+ source_dir = "./src/main/js/default"
+}
+ohos_resources("storagefilemanager_js_resources") {
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/storage/storagefilemanagerjstest/Test.json b/storage/storagefilemanagerjstest/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..d8e89109f7237415c489596930f89a4ab4d9f5da
--- /dev/null
+++ b/storage/storagefilemanagerjstest/Test.json
@@ -0,0 +1,51 @@
+{
+ "description": "Configuration for filemanager Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "2000000",
+ "package": "ohos.acts.storage.filemanager",
+ "shell-timeout": "60000"
+ },
+ "kits": [
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "mkdir /storage/media/100/local/files/photo",
+ "mkdir /storage/media/100/local/files/document",
+ "mkdir /storage/media/100/local/files/video",
+ "mkdir /storage/media/100/local/files/audio",
+ "mkdir /storage/media/100/local/files/photo/weixin",
+ "touch /storage/media/100/local/files/photo/weixin/1.jpg",
+ "touch /storage/media/100/local/files/photo/weixin/2.jpg",
+ "touch /storage/media/100/local/files/photo/weixin/3.jpg",
+ "touch /storage/media/100/local/files/photo/weixin/1.mp3",
+ "touch /storage/media/100/local/files/photo/weixin/1.mp4",
+ "mkdir /storage/media/100/local/files/photo/taobao",
+ "touch /storage/media/100/local/files/photo/taobao/1.mp4",
+ "mkdir /storage/media/100/local/files/taobao",
+ "touch /storage/media/100/local/files/taobao/1.jpg",
+ "mkdir /storage/media/100/local/files/image",
+ "touch /storage/media/100/local/files/image/1.jpg",
+ "touch /storage/media/100/local/files/image/2.jpg",
+ "mkdir /storage/media/100/local/files/alarms",
+ "touch /storage/media/100/local/files/alarms/tree.mp3",
+ "mkdir /storage/media/100/local/files/wps",
+ "touch /storage/media/100/local/files/wps/news.pdf",
+ "touch /storage/media/100/local/files/wps/introduce.doc",
+ "killall com.ohos.medialibrary.MediaScannerAbilityA",
+ "aa start -a MediaScannerAbility -b com.ohos.medialibrary.MediaScannerAbilityA",
+ "sleep 10"
+ ],
+ "teardown-command":[
+ "rm -rf /storage/media/100/local/files/*"
+ ]
+ },
+ {
+ "test-file-name": [
+ "ActsStorageFilemanagerJsTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/storage/storagefilemanagerjstest/signature/openharmony_sx.p7b b/storage/storagefilemanagerjstest/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5
Binary files /dev/null and b/storage/storagefilemanagerjstest/signature/openharmony_sx.p7b differ
diff --git a/storage/storagefilemanagerjstest/src/main/config.json b/storage/storagefilemanagerjstest/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..ff67126dedbb7d42af23d1a1578a0cc7e300f5a9
--- /dev/null
+++ b/storage/storagefilemanagerjstest/src/main/config.json
@@ -0,0 +1,61 @@
+{
+ "app": {
+ "bundleName": "ohos.acts.storage.filemanager",
+ "vendor": "example",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.acts.storage.filemanager",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": true
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "ohos.acts.storage.filemanager.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard",
+ "visible": true
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/storage/storagefilemanagerjstest/src/main/js/default/app.js b/storage/storagefilemanagerjstest/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..8c1fa4d1a4594da2afecfd6d4f30fd7fb2f40f91
--- /dev/null
+++ b/storage/storagefilemanagerjstest/src/main/js/default/app.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2021 Huawei Device 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.
+ */
+
+export default {
+ onCreate() {
+ console.info('ohos.acts.storage.filemanager onCreate');
+ },
+ onDestroy() {
+ console.info('ohos.acts.storage.filemanager onDestroy');
+ }
+};
diff --git a/storage/storagefilemanagerjstest/src/main/js/default/i18n/en-US.json b/storage/storagefilemanagerjstest/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..ead52ed2e09ec82aaf7aa9f4e714ed39ea88308e
--- /dev/null
+++ b/storage/storagefilemanagerjstest/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "Test"
+ }
+}
\ No newline at end of file
diff --git a/storage/storagefilemanagerjstest/src/main/js/default/i18n/zh-CN.json b/storage/storagefilemanagerjstest/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..3f48f2585b24a8fe4a745e8ee2972a9e991a7803
--- /dev/null
+++ b/storage/storagefilemanagerjstest/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "测试"
+ }
+}
\ No newline at end of file
diff --git a/storage/storagefilemanagerjstest/src/main/js/default/pages/index/index.css b/storage/storagefilemanagerjstest/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/storage/storagefilemanagerjstest/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/storage/storagefilemanagerjstest/src/main/js/default/pages/index/index.hml b/storage/storagefilemanagerjstest/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/storage/storagefilemanagerjstest/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/storage/storagefilemanagerjstest/src/main/js/default/pages/index/index.js b/storage/storagefilemanagerjstest/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..61921cf3ba7d0a16a9c2edb9b9f04c1fb69a6333
--- /dev/null
+++ b/storage/storagefilemanagerjstest/src/main/js/default/pages/index/index.js
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 Huawei Device 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.
+ */
+
+import app from '@system.app'
+
+import {Core} from 'deccjsunit/index'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ const core = Core.getInstance()
+ core.init()
+ const configService = core.getDefaultService('config')
+ configService.setConfig(this)
+ require('../../test/List.test')
+ core.execute()
+ },
+ onReady() {
+ },
+}
\ No newline at end of file
diff --git a/storage/storagefilemanagerjstest/src/main/js/default/test/List.test.js b/storage/storagefilemanagerjstest/src/main/js/default/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..009b47b10ac76c354616e46a0c99b90ce1e20ab3
--- /dev/null
+++ b/storage/storagefilemanagerjstest/src/main/js/default/test/List.test.js
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2022 Huawei Device 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.
+ */
+
+require("./filemanager.test.js");
diff --git a/storage/storagefilemanagerjstest/src/main/js/default/test/filemanager.test.js b/storage/storagefilemanagerjstest/src/main/js/default/test/filemanager.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..c79e3dc1839fec792d4e40e9eb05ade7f67a795f
--- /dev/null
+++ b/storage/storagefilemanagerjstest/src/main/js/default/test/filemanager.test.js
@@ -0,0 +1,462 @@
+/*
+ * Copyright (C) 2022 Huawei Device 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.
+ */
+
+import filemanager from '@ohos.filemanager';
+import {
+ describe,
+ it,
+ expect
+}
+from 'deccjsunit/index'
+
+// getRoot() interface, when the parameter is "local", the returned data and the data contrast, return the same data is correct
+const ROOTFILE = [
+ {"name":"image_album","path":"dataability:///album","type":"album","size":0,"added_time":0,"modified_time":0},
+ {"name":"video_album","path":"dataability:///album","type":"album","size":0,"added_time":0,"modified_time":0},
+ {"name":"audio_album","path":"dataability:///album","type":"album","size":0,"added_time":0,"modified_time":0},
+ {"name":"file_folder","path":"dataability:///album","type":"album","size":0,"added_time":0,"modified_time":0}
+];
+
+let IMAGE_ROOT = "";
+let VIDEO_ROOT = "";
+let FILE_ROOT = "";
+let AUDIO_ROOT = "";
+let IMAGE_ALBUM = "";
+let LOG_ = "FMS_XTS_TEXT: "
+describe("filemanager_test", function () {
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_GET_ROOT_0000
+ * @tc.name filemanager_test_get_root_async_000
+ * @tc.desc Test getRoot() interfaces, the first layer directory album information, promise way back.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_get_root_async_000", 0, async function (done) {
+ try {
+ let fileInfos = await filemanager.getRoot();
+ expect(Array.isArray(fileInfos)).assertTrue();
+ expect(JSON.stringify(fileInfos) == JSON.stringify(ROOTFILE)).assertTrue();
+ console.log(JSON.stringify(fileInfos))
+ for (let i = 0; i < fileInfos.length; i++) {
+ if (fileInfos[i].name == "image_album") {
+ console.log(LOG_ +JSON.stringify(fileInfos[i]))
+ IMAGE_ROOT = fileInfos[i].path;
+ console.log(LOG_ + IMAGE_ROOT)
+ } else if (fileInfos[i].name == "audio_album") {
+ console.log(LOG_ + JSON.stringify(fileInfos[i]))
+ AUDIO_ROOT = fileInfos[i].path;
+ console.log(LOG_ + AUDIO_ROOT)
+ } else if (fileInfos[i].name == "video_album") {
+ console.log(LOG_ + JSON.stringify(fileInfos[i]))
+ VIDEO_ROOT = fileInfos[i].path;
+ console.log(LOG_ + VIDEO_ROOT)
+ } else if (fileInfos[i].name == "file_folder") {
+ console.log(LOG_ + JSON.stringify(fileInfos[i]))
+ FILE_ROOT = fileInfos[i].path;
+ console.log(LOG_ + FILE_ROOT)
+ }
+ }
+ } catch (error) {
+ console.log("filemanager_test_get_root_async_000 has failed for " + error);
+ expect(null).assertFail();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_GET_ROOT_0010
+ * @tc.name filemanager_test_get_root_async_001
+ * @tc.desc Test getRoot() interfaces, the first layer directory album information, callback way back.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_get_root_async_001", 0, async function (done) {
+ try {
+ filemanager.getRoot((error, fileInfos) => {
+ expect(Array.isArray(fileInfos)).assertTrue();
+ expect(JSON.stringify(fileInfos) == JSON.stringify(ROOTFILE)).assertTrue();
+ });
+ } catch (error) {
+ console.log("filemanager_test_get_root_async_001 has failed for " + error);
+ expect(null).assertFail();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_GET_ROOT_0020
+ * @tc.name filemanager_test_get_root_async_002
+ * @tc.desc Test getRoot() interfaces, without any parameters, throw an exception.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_get_root_async_002", 0, async function (done) {
+ try {
+ filemanager.getRoot("1")
+ .then(file => {
+ console.log("filemanager_test_get_root_async_002 file " + JSON.stringify(file));
+ expect(null).assertFail();
+ }).catch(e => {
+ console.log("filemanager_test_get_root_async_002 e " + e);
+ })
+ } catch (error) {
+ console.log("filemanager_test_get_root_async_002 has failed for " + error);
+ expect(error.toString().indexOf("Number of argments unmatched") != -1).assertTrue();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_LIST_FILE_0000
+ * @tc.name filemanager_test_list_file_async_000
+ * @tc.desc Test listFile() interfaces,when the type parameters as the "image", return path of files information accordingly.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_list_file_async_000", 0, async function (done) {
+ try {
+ let path = IMAGE_ROOT;
+ let fileInfos = await filemanager.listFile(path, "image");
+ expect(Array.isArray(fileInfos)).assertTrue();
+ console.log(JSON.stringify(fileInfos))
+ for (let i = 0; i < fileInfos.length; i++) {
+ if (fileInfos[i].name == "image") {
+ console.log(JSON.stringify(fileInfos[i]))
+ IMAGE_ALBUM = fileInfos[i].path;
+ console.log(LOG_ + JSON.stringify(fileInfos[i]))
+ console.log(LOG_ + IMAGE_ALBUM)
+ }
+ }
+ } catch (error) {
+ console.log("filemanager_test_list_file_async_000 has failed for " + error);
+ expect(null).assertFail();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_LIST_FILE_0010
+ * @tc.name filemanager_test_list_file_async_001
+ * @tc.desc Test listFile() interfaces, when the type parameters as the "image", return path of files information accordingly.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_list_file_async_001", 0, async function (done) {
+ try {
+ let path = IMAGE_ALBUM;
+ let fileInfos = await filemanager.listFile(path, "image");
+ expect(Array.isArray(fileInfos)).assertTrue();
+ } catch (error) {
+ console.log("filemanager_test_list_file_async_001 has failed for " + error);
+ expect(null).assertFail();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_LIST_FILE_0020
+ * @tc.name filemanager_test_list_file_async_002
+ * @tc.desc Test listFile() interfaces, when the type parameters as the "file", return path of files information accordingly.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_list_file_async_002", 0, async function (done) {
+ try {
+ let path = FILE_ROOT;
+ filemanager.listFile(path, "file", (error,fileInfos)=>{
+ expect(Array.isArray(fileInfos)).assertTrue();
+ });
+ } catch (error) {
+ console.log("filemanager_test_list_file_async_002 has failed for " + error);
+ expect(null).assertFail();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_LIST_FILE_0030
+ * @tc.name filemanager_test_list_file_async_003
+ * @tc.desc Test listFile() interfaces, when the type parameter to an empty string, throw an exception.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_list_file_async_003", 0, async function (done) {
+ try {
+ let path = FILE_ROOT;
+ await filemanager.listFile(path, " ");
+ } catch (error) {
+ console.log("filemanager_test_list_file_async_003 has failed for " + error);
+ expect(error.message == "Not a directory").assertTrue();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_LIST_FILE_0040
+ * @tc.name filemanager_test_list_file_async_004
+ * @tc.desc Test listFile() interfaces, when the path parameter to an empty string, throw an exception..
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_list_file_async_004", 0, async function (done) {
+ try {
+ await filemanager.listFile(" ", "file");
+ } catch (error) {
+ console.log("filemanager_test_list_file_async_004 has failed for " + error);
+ expect(error.message == "No such file or directory").assertTrue();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_CREATEFILE_0000
+ * @tc.name filemanager_test_createfile_async_000
+ * @tc.desc Test createFile() interfaces promise way to create a file normally.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_createfile_async_000", 0, async function (done) {
+ try {
+ let name = "create00" + new Date().getTime() + ".jpg";
+ let path = IMAGE_ROOT;
+ let uri = await filemanager.createFile(path, name);
+ console.log(LOG_ + name + " " + path)
+ console.log(LOG_ + uri)
+ expect(uri != undefined).assertTrue();
+ } catch (error) {
+ console.log("filemanager_test_createfile_async_000 has failed for " + error);
+ expect(null).assertFail();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_CREATEFILE_0010
+ * @tc.name filemanager_test_createfile_async_001
+ * @tc.desc Test createFile() interfaces callback way to create a file normally.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_createfile_async_001", 0, async function (done) {
+ let name = "create00" + new Date().getTime() + ".txt";
+ let path = IMAGE_ROOT;
+ filemanager.createFile(path, name, (err, uri) => {
+ expect(uri != undefined).assertTrue();
+ console.log(LOG_ + uri)
+ });
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_CREATEFILE_0020
+ * @tc.name filemanager_test_createfile_async_002
+ * @tc.desc Test createFile() interfaces to create an existing file, throw an exception.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_createfile_async_002", 0, async function (done) {
+ try {
+ let name = "1.jpg";
+ let path = IMAGE_ROOT;
+ filemanager.createFile(path, name)
+ .then(uri => {
+ console.log("filemanager_test_createfile_async_002 uri " + uri);
+ expect(null).assertFail();
+ }).catch(e => {
+ console.log("filemanager_test_createfile_async_002 e " + e);
+ expect(e.message == "Operation not permitted").assertTrue();
+ })
+ } catch (error) {
+ console.log("filemanager_test_createfile_async_002 for " + error);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_CREATEFILE_0030
+ * @tc.name filemanager_test_createfile_async_003
+ * @tc.desc Test createFile() interfaces to create a file, the path error parameters, throw an exception.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_createfile_async_003", 0, async function (done) {
+ try {
+ let name = "filemanager_test_createfile_async_003";
+ filemanager.createFile("123", name)
+ .then(uri => {
+ console.log("filemanager_test_createfile_async_003 uri " + uri);
+ expect(null).assertFail();
+ }).catch(error => {
+ console.log("filemanager_test_createfile_async_003 e " + error);
+ expect(error.message == "No such file or directory").assertTrue();
+ })
+ } catch (error) {
+ console.log("filemanager_test_createfile_async_003 has failed for " + error);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_CREATEFILE_0040
+ * @tc.name filemanager_test_createfile_async_004
+ * @tc.desc Test createFile() interfaces to create a file, without any parameters, throw an exception.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_createfile_async_004", 0, async function (done) {
+ try {
+ filemanager.createFile()
+ .then(uri => {
+ console.log("filemanager_test_createfile_async_004 uri " + uri);
+ expect(null).assertFail();
+ }).catch(e => {
+ console.log("filemanager_test_createfile_async_004 e " + e);
+ })
+ } catch (error) {
+ console.log("filemanager_test_createfile_async_004 has failed for " + error);
+ expect(error.toString().indexOf("Number of arguments unmatched") !=-1).assertTrue();
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_CREATEFILE_0050
+ * @tc.name filemanager_test_createfile_async_005
+ * @tc.desc Test createFile() interfaces to create a file, all parameters to an empty string, throw an exception.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_createfile_async_005", 0, async function (done) {
+ try {
+ filemanager.createFile("", "", "")
+ .then(uri => {
+ console.log("filemanager_test_createfile_async_005 uri " + uri);
+ expect(null).assertFail();
+ }).catch(error => {
+ console.log("filemanager_test_createfile_async_005 e " + error);
+ expect(error.message == "No such file or directory").assertTrue();
+ })
+ } catch (error) {
+ console.log("filemanager_test_createfile_async_005 has failed for " + error);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_CREATEFILE_0060
+ * @tc.name filemanager_test_createfile_async_006
+ * @tc.desc Test createFile() interfaces create a file, parameter path contains escape characters, throw an exception.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_createfile_async_006", 0, async function (done) {
+ try {
+ let name = "filemanager_test_createfile_async_006";
+ filemanager.createFile("internal://cache%d%sfile", name)
+ .then(uri => {
+ console.log("filemanager_test_createfile_async_006 uri " + uri);
+ expect(null).assertFail();
+ }).catch(error => {
+ console.log("filemanager_test_createfile_async_006 e " + error);
+ expect(error.message == "No such file or directory").assertTrue();
+ })
+ } catch (error) {
+ console.log("filemanager_test_createfile_async_006 has failed for " + error);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_CREATEFILE_0070
+ * @tc.name filemanager_test_createfile_async_007
+ * @tc.desc Test createFile() interfaces a file, parameter path contain special characters, throw an exception.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_createfile_async_007", 0, async function (done) {
+ try {
+ filemanager.createFile("internal://cache/@#$&^", "filemanager_test_createfile_async_007")
+ .then(uri => {
+ console.log("filemanager_test_createfile_async_007 uri " + uri);
+ expect(null).assertFail();
+ }).catch(error => {
+ console.log("filemanager_test_createfile_async_007 e " + error);
+ expect(error.message == "No such file or directory").assertTrue();
+ })
+ } catch (error) {
+ console.log("filemanager_test_createfile_async_007 has failed for " + error);
+ }
+ done();
+ });
+
+ /**
+ * @tc.number SUB_DF_FILEMANAGER_CREATEFILE_0080
+ * @tc.name filemanager_test_createfile_async_008
+ * @tc.desc Test createFile() interfaces to create a file, lack of path parameters, throw an exception.
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 0
+ * @tc.require
+ */
+ it("filemanager_test_createfile_async_008", 0, async function (done) {
+ let name = "filemanager_test_createfile_async_008";
+ try {
+ filemanager.createFile(name)
+ .then(uri => {
+ console.log("filemanager_test_createfile_async_008 uri " + uri);
+ expect(null).assertFail();
+ }).catch(e => {
+ console.log("filemanager_test_createfile_async_008 e " + e);
+ })
+ } catch (error) {
+ console.log("filemanager_test_createfile_async_008 has failed for " + error);
+ expect(error.toString().indexOf("Number of arguments unmatched") !=-1).assertTrue();
+ }
+ done();
+ });
+});
\ No newline at end of file
diff --git a/storage/storagefilemanagerjstest/src/main/resources/base/element/string.json b/storage/storagefilemanagerjstest/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..dad69c299676525bccf657899a9b50e0bffd7b28
--- /dev/null
+++ b/storage/storagefilemanagerjstest/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "Storagefilemanagerjstest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/storage/storagefilemanagerjstest/src/main/resources/base/media/icon.png b/storage/storagefilemanagerjstest/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/storage/storagefilemanagerjstest/src/main/resources/base/media/icon.png differ