From d56098c666d3e5de0b6e9938d8c5b52f2d714005 Mon Sep 17 00:00:00 2001 From: XTStarry Date: Sat, 25 Sep 2021 13:54:56 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20c91b32e=20from=20https://gitee.com/XTSt?= =?UTF-8?q?arry/xts=5Facts/pulls/733=20=E6=95=B4=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=94=A8=E4=BE=8B=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=BA=86dsm=E5=92=8Cfms=E9=83=A8=E5=88=86=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=94=A8=E4=BE=8B=20Signed-off-by:=20XTStarry=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- storage/BUILD.gn | 5 + storage/storagedsmjstest/BUILD.gn | 38 ++ storage/storagedsmjstest/Test.json | 18 + .../signature/openharmony_sx.p7b | Bin 0 -> 3437 bytes storage/storagedsmjstest/src/main/config.json | 61 ++ .../src/main/js/default/app.js | 23 + .../src/main/js/default/i18n/en-US.json | 6 + .../src/main/js/default/i18n/zh-CN.json | 6 + .../src/main/js/default/pages/index/index.css | 9 + .../src/main/js/default/pages/index/index.hml | 5 + .../src/main/js/default/pages/index/index.js | 40 ++ .../src/main/js/default/test/Common.js | 192 +++++++ .../src/main/js/default/test/Dsm.test.js | 544 ++++++++++++++++++ .../src/main/js/default/test/DsmError.test.js | 514 +++++++++++++++++ .../src/main/js/default/test/List.test.js | 17 + .../main/resources/base/element/string.json | 12 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes storage/storagedsmstabilityjstest/BUILD.gn | 38 ++ storage/storagedsmstabilityjstest/Test.json | 18 + .../signature/openharmony_sx.p7b | Bin 0 -> 3437 bytes .../src/main/config.json | 61 ++ .../src/main/js/default/app.js | 23 + .../src/main/js/default/i18n/en-US.json | 6 + .../src/main/js/default/i18n/zh-CN.json | 6 + .../src/main/js/default/pages/index/index.css | 9 + .../src/main/js/default/pages/index/index.hml | 5 + .../src/main/js/default/pages/index/index.js | 40 ++ .../src/main/js/default/test/Common.js | 180 ++++++ .../js/default/test/DsmPerformance.test.js | 372 ++++++++++++ .../js/default/test/DsmReliability.test.js | 224 ++++++++ .../src/main/js/default/test/List.test.js | 17 + .../main/resources/base/element/string.json | 12 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes storage/storagefileconcurrentjstest/BUILD.gn | 14 +- storage/storagefileconcurrentjstest/Test.json | 2 +- .../src/main/js/default/app.js | 15 + .../js/default/test/FileConcurrent.test.js | 38 +- storage/storagefileioerrorjstest/BUILD.gn | 16 +- .../main/js/default/test/FileError.test.js | 17 +- .../main/js/default/test/FileIOError.test.js | 19 +- .../js/default/test/FileVirtualPath.test.js | 45 ++ storage/storagefileiojstest/BUILD.gn | 16 +- .../src/main/js/default/app.js | 15 + .../src/main/js/default/test/File.test.js | 7 +- .../src/main/js/default/test/FileIO.test.js | 7 +- .../storagefileioperformancejstest/BUILD.gn | 16 +- .../src/main/js/default/app.js | 15 + .../main/js/default/test/FileIOPerformance.js | 1 + .../main/js/default/test/FilePerformance.js | 1 + .../storagefileioreliabilityjstest/BUILD.gn | 16 +- .../src/main/js/default/app.js | 15 + .../main/js/default/test/FileIOReliability.js | 1 + storage/storagefileiostabilityjstest/BUILD.gn | 16 +- .../src/main/js/default/app.js | 15 + .../main/js/default/test/FileIOStability.js | 5 +- storage/storagefilestabilityjstest/BUILD.gn | 16 +- .../src/main/js/default/app.js | 15 + .../main/js/default/test/FileReliability.js | 1 + .../src/main/js/default/test/FileStability.js | 12 + storage/storagefmspublicjstest/BUILD.gn | 38 ++ storage/storagefmspublicjstest/Test.json | 18 + .../signature/openharmony_sx.p7b | Bin 0 -> 3437 bytes .../src/main/config.json | 61 ++ .../src/main/js/default/app.js | 23 + .../src/main/js/default/i18n/en-US.json | 6 + .../src/main/js/default/i18n/zh-CN.json | 6 + .../src/main/js/default/pages/index/index.css | 9 + .../src/main/js/default/pages/index/index.hml | 5 + .../src/main/js/default/pages/index/index.js | 40 ++ .../src/main/js/default/test/Common.js | 192 +++++++ .../main/js/default/test/FmsPublic.test.js | 400 +++++++++++++ .../js/default/test/FmsPublicError.test.js | 520 +++++++++++++++++ .../src/main/js/default/test/List.test.js | 17 + .../main/resources/base/element/string.json | 12 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes storage/storagefmssharejstest/BUILD.gn | 38 ++ storage/storagefmssharejstest/Test.json | 18 + .../signature/openharmony_sx.p7b | Bin 0 -> 3437 bytes .../src/main/config.json | 72 +++ .../src/main/js/default/app.js | 23 + .../src/main/js/default/i18n/en-US.json | 6 + .../src/main/js/default/i18n/zh-CN.json | 6 + .../src/main/js/default/pages/index/index.css | 9 + .../src/main/js/default/pages/index/index.hml | 5 + .../src/main/js/default/pages/index/index.js | 40 ++ .../src/main/js/default/test/Common.js | 180 ++++++ .../src/main/js/default/test/FmsShare.test.js | 463 +++++++++++++++ .../src/main/js/default/test/List.test.js | 16 + .../main/resources/base/element/string.json | 12 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes 90 files changed, 4995 insertions(+), 97 deletions(-) create mode 100644 storage/storagedsmjstest/BUILD.gn create mode 100644 storage/storagedsmjstest/Test.json create mode 100644 storage/storagedsmjstest/signature/openharmony_sx.p7b create mode 100644 storage/storagedsmjstest/src/main/config.json create mode 100644 storage/storagedsmjstest/src/main/js/default/app.js create mode 100644 storage/storagedsmjstest/src/main/js/default/i18n/en-US.json create mode 100644 storage/storagedsmjstest/src/main/js/default/i18n/zh-CN.json create mode 100644 storage/storagedsmjstest/src/main/js/default/pages/index/index.css create mode 100644 storage/storagedsmjstest/src/main/js/default/pages/index/index.hml create mode 100644 storage/storagedsmjstest/src/main/js/default/pages/index/index.js create mode 100644 storage/storagedsmjstest/src/main/js/default/test/Common.js create mode 100644 storage/storagedsmjstest/src/main/js/default/test/Dsm.test.js create mode 100644 storage/storagedsmjstest/src/main/js/default/test/DsmError.test.js create mode 100644 storage/storagedsmjstest/src/main/js/default/test/List.test.js create mode 100644 storage/storagedsmjstest/src/main/resources/base/element/string.json create mode 100644 storage/storagedsmjstest/src/main/resources/base/media/icon.png create mode 100644 storage/storagedsmstabilityjstest/BUILD.gn create mode 100644 storage/storagedsmstabilityjstest/Test.json create mode 100644 storage/storagedsmstabilityjstest/signature/openharmony_sx.p7b create mode 100644 storage/storagedsmstabilityjstest/src/main/config.json create mode 100644 storage/storagedsmstabilityjstest/src/main/js/default/app.js create mode 100644 storage/storagedsmstabilityjstest/src/main/js/default/i18n/en-US.json create mode 100644 storage/storagedsmstabilityjstest/src/main/js/default/i18n/zh-CN.json create mode 100644 storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.css create mode 100644 storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.hml create mode 100644 storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.js create mode 100644 storage/storagedsmstabilityjstest/src/main/js/default/test/Common.js create mode 100644 storage/storagedsmstabilityjstest/src/main/js/default/test/DsmPerformance.test.js create mode 100644 storage/storagedsmstabilityjstest/src/main/js/default/test/DsmReliability.test.js create mode 100644 storage/storagedsmstabilityjstest/src/main/js/default/test/List.test.js create mode 100644 storage/storagedsmstabilityjstest/src/main/resources/base/element/string.json create mode 100644 storage/storagedsmstabilityjstest/src/main/resources/base/media/icon.png create mode 100644 storage/storagefmspublicjstest/BUILD.gn create mode 100644 storage/storagefmspublicjstest/Test.json create mode 100644 storage/storagefmspublicjstest/signature/openharmony_sx.p7b create mode 100644 storage/storagefmspublicjstest/src/main/config.json create mode 100644 storage/storagefmspublicjstest/src/main/js/default/app.js create mode 100644 storage/storagefmspublicjstest/src/main/js/default/i18n/en-US.json create mode 100644 storage/storagefmspublicjstest/src/main/js/default/i18n/zh-CN.json create mode 100644 storage/storagefmspublicjstest/src/main/js/default/pages/index/index.css create mode 100644 storage/storagefmspublicjstest/src/main/js/default/pages/index/index.hml create mode 100644 storage/storagefmspublicjstest/src/main/js/default/pages/index/index.js create mode 100644 storage/storagefmspublicjstest/src/main/js/default/test/Common.js create mode 100644 storage/storagefmspublicjstest/src/main/js/default/test/FmsPublic.test.js create mode 100644 storage/storagefmspublicjstest/src/main/js/default/test/FmsPublicError.test.js create mode 100644 storage/storagefmspublicjstest/src/main/js/default/test/List.test.js create mode 100644 storage/storagefmspublicjstest/src/main/resources/base/element/string.json create mode 100644 storage/storagefmspublicjstest/src/main/resources/base/media/icon.png create mode 100644 storage/storagefmssharejstest/BUILD.gn create mode 100644 storage/storagefmssharejstest/Test.json create mode 100644 storage/storagefmssharejstest/signature/openharmony_sx.p7b create mode 100644 storage/storagefmssharejstest/src/main/config.json create mode 100644 storage/storagefmssharejstest/src/main/js/default/app.js create mode 100644 storage/storagefmssharejstest/src/main/js/default/i18n/en-US.json create mode 100644 storage/storagefmssharejstest/src/main/js/default/i18n/zh-CN.json create mode 100644 storage/storagefmssharejstest/src/main/js/default/pages/index/index.css create mode 100644 storage/storagefmssharejstest/src/main/js/default/pages/index/index.hml create mode 100644 storage/storagefmssharejstest/src/main/js/default/pages/index/index.js create mode 100644 storage/storagefmssharejstest/src/main/js/default/test/Common.js create mode 100644 storage/storagefmssharejstest/src/main/js/default/test/FmsShare.test.js create mode 100644 storage/storagefmssharejstest/src/main/js/default/test/List.test.js create mode 100644 storage/storagefmssharejstest/src/main/resources/base/element/string.json create mode 100644 storage/storagefmssharejstest/src/main/resources/base/media/icon.png diff --git a/storage/BUILD.gn b/storage/BUILD.gn index c28cdb205..f07f9d949 100644 --- a/storage/BUILD.gn +++ b/storage/BUILD.gn @@ -16,9 +16,14 @@ group("storage") { testonly = true if (is_standard_system) { deps = [ + "storagedsmjstest:storagedsm_js_test", + + # "storagedsmstabilityjstest:storagedsmstability_js_test", "storagefileconcurrentjstest:storagefileconcurrent_js_test", "storagefileioerrorjstest:storagefileioerror_js_test", "storagefileiojstest:storagefileio_js_test", + "storagefmspublicjstest:storagefmspublic_js_test", + "storagefmssharejstest:storagefmsshare_js_test", # "storagefileioperformancejstest:storagefileioperformance_js_test", # "storagefileioreliabilityjstest:storagefileioreliability_js_test", diff --git a/storage/storagedsmjstest/BUILD.gn b/storage/storagedsmjstest/BUILD.gn new file mode 100644 index 000000000..f605e04f1 --- /dev/null +++ b/storage/storagedsmjstest/BUILD.gn @@ -0,0 +1,38 @@ +# 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("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("storagedsm_js_test") { + hap_profile = "./src/main/config.json" + deps = [ + ":storagedsm_js_assets", + ":storagedsm_js_resources", + ] + + # shared_libraries = [ + # "//third_party/giflib:libgif", + # "//third_party/libpng:libpng", + # ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "storagedsmjstest" + + # part_name = "prebuilt_hap" + # subsystem_name = "xts" +} +ohos_js_assets("storagedsm_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("storagedsm_js_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/storage/storagedsmjstest/Test.json b/storage/storagedsmjstest/Test.json new file mode 100644 index 000000000..4d5073412 --- /dev/null +++ b/storage/storagedsmjstest/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for storage file and fileio Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "60000", + "package": "ohos.acts.stroage.fileio", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "storagefmspublicjstest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/storage/storagedsmjstest/signature/openharmony_sx.p7b b/storage/storagedsmjstest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 GIT binary patch literal 3437 zcmcgvX>b$g8MY4FF(5FQyMT=#m||qU)nQ9cId-MBB-<-lvSdq&snM}IENNF>t+bK| zgowuF2vC|SxSZxNN5eHhV%(WPpbeB9Fc3;JDMtzMBv1-XAc2N~c2_tCXW&OCGw6qQ z-s9VS-tT?h=bI0tMS+~WDXqHJyCPmLzdbE-fV8Nd&*MRZfG8(#POFZG3xs@Lb{0ry z=R8j3wWo!5g=yjKx#BoZMFS)uA)H}cTp@-^K`9VV?RC3J59@}eik*>n|pRKOLZ zxdn7G!Yv@9O#y<&eUy{)vMXb;fQR)ffVAADQsEMXm;IBMDLfLD0w^U;6%HVo-0Q_5 zCHEa?DBuauNpZzoF+tK27w#n~?u%toS-DhR4k@Q*{7x^8Q=D6&kd^_~J#VVG2LXkL zaAy=}U*?Jto)9hx5MGjdp9hcQAu@tfk_;l!PeyxPY<8b&+&D!CyaBh9=8BSVKLpk4 z4Ml3yY|&Th)vyK4cpC{!uU8v2YBlVV`d~(nz&<@{G1oe*DHub1z7~J5*;s2bX<)_* zV_GbsPQg`(&rpxRb_*Od7}++3+liSw-$!1 zs5*g}EHWhI3i|!-FcfzYL0`SL-rq>LENC;PMl)G(0(1U2%Va|smp0UFx0xd@soZA* zD5LYc4OlbE7@ARt#h}rr3>K@bf%B#^-c+xz8Hr)0D5ExIFltezN@Hn8>o5d~bSfYtkc+_Z&kI#-N5_GhCg*V-^TSO=!G~ z(fXy{n2XV+k}6w_W`dTOP2a4u0ly;ANZ>4OxSKAzFB!yBzdo`gX zO?o|H@WiAw$y6l?=^3jA_Hy0S)nTYs12;4hKE&ekQ|>?|ZLJ}#F`2BczC7kdE4@xV zZBD_)Otwjhz+NSaz?d45!;FsGSu-#qh#hStD%B}f!mCT!KqzSo>I`NGH_9Dea$1Qi zg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00001 diff --git a/storage/storagedsmjstest/src/main/config.json b/storage/storagedsmjstest/src/main/config.json new file mode 100644 index 000000000..9b7cfe5d0 --- /dev/null +++ b/storage/storagedsmjstest/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "ohos.acts.stroage.fileio", + "vendor": "example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.stroage.fileio", + "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.stroage.fileio.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/storagedsmjstest/src/main/js/default/app.js b/storage/storagedsmjstest/src/main/js/default/app.js new file mode 100644 index 000000000..60ee141c8 --- /dev/null +++ b/storage/storagedsmjstest/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.distributeddatamgr.distributedfile onCreate'); + }, + onDestroy() { + console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); + } +}; diff --git a/storage/storagedsmjstest/src/main/js/default/i18n/en-US.json b/storage/storagedsmjstest/src/main/js/default/i18n/en-US.json new file mode 100644 index 000000000..ead52ed2e --- /dev/null +++ b/storage/storagedsmjstest/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/storagedsmjstest/src/main/js/default/i18n/zh-CN.json b/storage/storagedsmjstest/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 000000000..3f48f2585 --- /dev/null +++ b/storage/storagedsmjstest/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/storagedsmjstest/src/main/js/default/pages/index/index.css b/storage/storagedsmjstest/src/main/js/default/pages/index/index.css new file mode 100644 index 000000000..6fda79275 --- /dev/null +++ b/storage/storagedsmjstest/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/storagedsmjstest/src/main/js/default/pages/index/index.hml b/storage/storagedsmjstest/src/main/js/default/pages/index/index.hml new file mode 100644 index 000000000..f64b040a5 --- /dev/null +++ b/storage/storagedsmjstest/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/storage/storagedsmjstest/src/main/js/default/pages/index/index.js b/storage/storagedsmjstest/src/main/js/default/pages/index/index.js new file mode 100644 index 000000000..f7894a722 --- /dev/null +++ b/storage/storagedsmjstest/src/main/js/default/pages/index/index.js @@ -0,0 +1,40 @@ +/* + * 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/storagedsmjstest/src/main/js/default/test/Common.js b/storage/storagedsmjstest/src/main/js/default/test/Common.js new file mode 100644 index 000000000..c7b15f7ce --- /dev/null +++ b/storage/storagedsmjstest/src/main/js/default/test/Common.js @@ -0,0 +1,192 @@ +/* + * 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 fileio from '@system.fileio' +export const FILE_CONTENT = 'hello world' +export function prepareFile(fpath, content) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o666) + fileio.ftruncateSync(fd) + fileio.writeSync(fd, content) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function prepareFile1(fpath, content) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o777) + fileio.ftruncateSync(fd) + fileio.writeSync(fd, content) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function prepareEmptyFile(fpath) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o777) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function fileToReadOnly(fpath) { + try { + let fd = fileio.openSync(fpath, 0o1) + fileio.fchmodSync(fd, 0o444) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToReadOnly for ' + e); + return false + } +} +export function fileToWriteOnly(fpath) { + try { + let fd = fileio.openSync(fpath, 0o2) + fileio.fchmodSync(fd, 0o222) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToWriteOnly ' + e) + return false + } +} +export function fileToReadAndWrite(fpath) { + try { + let fd = fileio.openSync(fpath, 0o1) + fileio.fchmodSync(fd, 0o777) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToReadAndWrite ' + e); + return false + } +} +export function filePickerName(testName,deviceID) { + const BASE_PATH = '/data/ss/'+deviceID+'/fms_test/' + return BASE_PATH + testName +} +export function filePickerName1(testName,deviceID) { + const BASE_PATH = '/data/ss/'+ deviceID +'/fms_test/' + return BASE_PATH + testName +} +export function filePickerName2(testName,deviceID) { + const BASE_PATH = '/data/ss/'+ deviceID + return BASE_PATH + testName +} +export function appName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' + return BASE_PATH + testName +} +export function nextFileName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' + return BASE_PATH + testName +} +export function fileName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' + return BASE_PATH + testName +} +export function cacheFileName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' + return BASE_PATH + testName +} +export function differentFileName(testName) { + const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' + return BASE_PATH + testName +} +export function differentCacheName(testName) { + const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' + return BASE_PATH + testName +} +export function fmsFileName(testName) { + const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/files/" + return BASE_PATH + testName +} +export function fmsCacheName(testName) { + const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/cache/" + return BASE_PATH + testName +} +export function fmsPublic(testName) { + const BASE_PATH = '/data/ss/files/' + return BASE_PATH + testName +} + +export function getFileTextLen(fpath) { + let ss + try { + ss = fileio.Stream.createStreamSync(fpath, 'r+') + expect(ss !== null).assertTrue() + let len = ss.readSync(new ArrayBuffer(4096)) + console.log('file:' + fpath) + console.log('file lenth:' + len) + expect(ss.closeSync() !== null).assertTrue() + return len + } + catch (e) { + console.log('Failed to getFileTextLen ' + e) + expect(ss.closeSync() == null).assertTrue() + return null + } +} +export function isFileExist(fpath) { + try { + expect(fileio.accessSync(fpath) !== null).assertTrue() + console.log('file:' + fpath) + console.log('status:exist') + return true + } + catch (e) { + console.log('file:' + fpath) + console.log('status:non-existen') + return false + } +} +export function sleep(n) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > n) { + break; + } + } +} +export function randomString(num) { + let len= num; + var $chars = 'aaaabbbbcccc'; + var maxPos = $chars.length; + var pwd = ''; + for (var i = 0; i < len; i++) { + pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); + } + return pwd; +} diff --git a/storage/storagedsmjstest/src/main/js/default/test/Dsm.test.js b/storage/storagedsmjstest/src/main/js/default/test/Dsm.test.js new file mode 100644 index 000000000..9565b1d85 --- /dev/null +++ b/storage/storagedsmjstest/src/main/js/default/test/Dsm.test.js @@ -0,0 +1,544 @@ +/* + * 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 devicesmgr from '@system.devicesmgr'; +import { + describe, + beforeAll, + beforeEach, + afterEach, + afterAll, + it, + expect +} +from 'deccjsunit/index' + +describe('dsmTest', function () { + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_0000 + * @tc.name DSM_JS_Function_0000 + * @tc.desc Insert SD card to start up in shutdown state + */ + it('DSM_JS_Function_0000', 0, function () { + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_0000 call getVolumes success. data:' + JSON.stringify(data)); + expect(data.volumeInfos[2].mId !== null).assertTrue(); + expect(data.volumeInfos[2].mState == 2).assertTrue(); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0000 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_0100 + * @tc.name DSM_JS_Function_0100 + * @tc.desc Insert SD card in power on state + */ + it('DSM_JS_Function_0100', 0, function () { + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_0100 call getVolumes success. data:' + JSON.stringify(data)); + expect(data.volumeInfos[2].mId !== null).assertTrue(); + expect(data.volumeInfos[2].mState == 2).assertTrue(); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0100 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_0200 + * @tc.name DSM_JS_Function_0200 + * @tc.desc Unplug the SD card in the power on state + */ + it('DSM_JS_Function_0200', 0, function () { + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_0200 call getVolumes success. data:' + JSON.stringify(data)); + for (let i = 0; i < data.volumeInfos.length; i++) { + expect(typeof(data.volumeInfos[i].mId) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].mDiskId) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].mPartGuid) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].mFsUuid) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].mType) == 'number').assertTrue(); + expect(typeof(data.volumeInfos[i].mMountFlags) == 'number').assertTrue(); + expect(typeof(data.volumeInfos[i].mMountUserId) == 'number').assertTrue(); + expect(typeof(data.volumeInfos[i].mState) == 'number').assertTrue(); + expect(typeof(data.volumeInfos[i].mPath) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].mInternalPath) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].mFsLabel) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].Description) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].IsVisibleForUser) == 'boolean').assertTrue(); + expect(typeof(data.volumeInfos[i].IsEmulated) == 'boolean').assertTrue(); + expect(typeof(data.volumeInfos[i].IsPrimaryEmulatedForUser) == 'boolean').assertTrue(); + expect(typeof(data.volumeInfos[i].IsRemovable) == 'boolean').assertTrue(); + expect(typeof(data.volumeInfos[i].IsPrimary) == 'boolean').assertTrue(); + } + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0200 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_0300 + * @tc.name DSM_JS_Function_0300 + * @tc.desc Uninstall SD card. + */ + it('DSM_JS_Function_0300', 0, function () { + let mId = 0; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_0300 call getVolumes success.' + JSON.stringify(data)); + mId = data.volumeInfos[2].mId; + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0300 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.unMount({ + volId: mId, + success: function () { + console.log('DSM_JS_Function_0300 call unMount success.'); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0300 call unMount fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + } + }) + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_0300 call getVolumes success.' + JSON.stringify(data)); + for (let i = 0; i < data.getDisks.length; i++) { + expect(data.volumeInfos[i].mId !== 'public:179,33').assertTrue(); + expect(data.volumeInfos[i].mState !== 2).assertTrue(); + } + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0300 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_0400 + * @tc.name DSM_JS_Function_0400 + * @tc.desc Mount SD card. + */ + it('DSM_JS_Function_0400', 0, function () { + devicesmgr.mount({ + volId: 'public:179,33', + success: function () { + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_0400 call getVolumes success. data:' + JSON.stringify(data)); + expect(data.volumeInfos[2].mState == 2).assertTure() + expect(data.volumeInfos[2].mInternalPath !== null).assertTure() + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0400 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_0700 + * @tc.name DSM_JS_Function_0700 + * @tc.desc Obtain disk information and check whether it is successful. + */ + it('DSM_JS_Function_0700', 0, function () { + devicesmgr.getDisks({ + success: function (data) { + console.log('DSM_JS_Function_0700 call getDisks success.' + JSON.stringify(data)); + expect(data.getDisks[2].Description == 'SD card').assertTrue() + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0700 call getDisks fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_0800 + * @tc.name DSM_JS_Function_0800 + * @tc.desc Find the corresponding volume information through the volume ID + */ + it('DSM_JS_Function_0800', 0, function () { + let mId; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_0800 call getVolumes success' + JSON.stringify(data)); + mId = data.volumeInfos[2].mId; + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0800 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.findVolumeById({ + volId: mId, + success: function (vol) { + console.log('DSM_JS_Function_0800 call findVolumeById success' + JSON.stringify(vol)) + expect(vol.volumeInfos[2].mId !== null).assertTrue(); + expect(vol.volumeInfos[2].mState == 2).assertTrue(); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0800 call findVolumeById fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_0900 + * @tc.name DSM_JS_Function_0900 + * @tc.desc Find the corresponding volume information through the volume ID + */ + it('DSM_JS_Function_0900', 0, function () { + let mId; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_0900 call getVolumes success' + JSON.stringify(data)); + mId = data.volumeInfos[0].mId; + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0900 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.findVolumeById({ + volId: mId, + success: function (vol) { + console.log('DSM_JS_Function_0900 call findVolumeById success' + JSON.stringify(vol)) + expect(vol.volumeInfos[0].mId == 'emulated;0').assertTrue(); + expect(vol.volumeInfos[0].mInternalPath !== null).assertTrue(); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0900 call findVolumeById fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_1000 + * @tc.name DSM_JS_Function_1000 + * @tc.desc Find the corresponding volume information through the volume ID + */ + it('DSM_JS_Function_1000', 0, function () { + let mId; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_0900 call getVolumes success' + JSON.stringify(data)); + mId = data.volumeInfos[1].mId; + }, + fail: function (data, code) { + console.log('DSM_JS_Function_0900 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.findVolumeById({ + volId: mId, + success: function (vol) { + console.log('DSM_JS_Function_1000 call findVolumeById success' + JSON.stringify(vol)) + expect(vol.volumeInfos[1].mId == 'private').assertTrue(); + expect(vol.volumeInfos[1].mState == 2).assertTrue(); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1000 call findVolumeById fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_1100 + * @tc.name DSM_JS_Function_1100 + * @tc.desc Obtain the corresponding volume information through the UUID of the volume + */ + it('DSM_JS_Function_1100', 0, function () { + let mFsUuid; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_1100 call getVolumes success' + JSON.stringify(data)); + mFsUuid = data.volumeInfos[2].mFsUuid; + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1100 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.findVolumeByUuid({ + volumeUuid: mFsUuid, + success: function (vol) { + console.log('DSM_JS_Function_1100 call findVolumeByUuid success' + JSON.stringify(vol)) + expect(vol.volumeInfos[2].mId !== null).assertTrue(); + expect(vol.volumeInfos[2].mState == 2).assertTrue(); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1100 call findVolumeByUuid fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_1200 + * @tc.name DSM_JS_Function_1200 + * @tc.desc Get information about writable volumes + */ + it('DSM_JS_Function_1200', 0, function () { + devicesmgr.getWritableVolumes({ + success: function (data) { + console.log('DSM_JS_Function_1200 call getWritableVolumes success. data:' + JSON.stringify(data)); + for (let i = 0; i < data.volumeInfos.length; i++) { + expect(typeof(data.volumeInfos[i].mId) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].mDiskId) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].mPartGuid) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].mFsUuid) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].mType) == 'number').assertTrue(); + expect(typeof(data.volumeInfos[i].mMountFlags) == 'number').assertTrue(); + expect(typeof(data.volumeInfos[i].mMountUserId) == 'number').assertTrue(); + expect(typeof(data.volumeInfos[i].mState) == 'number').assertTrue(); + expect(typeof(data.volumeInfos[i].mPath) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].mInternalPath) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].mFsLabel) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].Description) == 'string').assertTrue(); + expect(typeof(data.volumeInfos[i].IsVisibleForUser) == 'boolean').assertTrue(); + expect(typeof(data.volumeInfos[i].IsEmulated) == 'boolean').assertTrue(); + expect(typeof(data.volumeInfos[i].IsPrimaryEmulatedForUser) == 'boolean').assertTrue(); + expect(typeof(data.volumeInfos[i].IsRemovable) == 'boolean').assertTrue(); + expect(typeof(data.volumeInfos[i].IsPrimary) == 'boolean').assertTrue(); + } + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1200 call getWritableVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_1300 + * @tc.name DSM_JS_Function_1300 + * @tc.desc Obtain the corresponding disk information through the disk ID + */ + it('DSM_JS_Function_1300', 0, function () { + let mDiskId; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_1300 call getVolumes success' + data); + mDiskId = data.volumeInfos[2].mDiskId; + console.log('DSM_JS_Function_1300---' + data.volumeInfos[2].mDiskId); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1300 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.findDiskById({ + diskId: mDiskId, + success: function (disk) { + console.log('DSM_JS_Function_1300 call findDiskById success' + JSON.stringify(disk)) + expect(disk.findDiskById[0].mId == mDiskId).assertTrue(); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1300 call findDiskById fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_1400 + * @tc.name DSM_JS_Function_1400 + * @tc.desc Get UUID of primary storage + */ + it('DSM_JS_Function_1400', 0, function () { + devicesmgr.getPrimaryStorageUuid({ + success: function (primaryUuid) { + console.log('DSM_JS_Function_1400 call getPrimaryStorageUuid success.' + JSON.stringify(primaryUuid)); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1400 call getPrimaryStorageUuid fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_1500 + * @tc.name DSM_JS_Function_1500 + * @tc.desc Find its corresponding private volume through simulate volume + */ + it('DSM_JS_Function_1500', 0, function () { + let emuVol; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_1500 call getVolumes success' + data); + emuVol = data.volumeInfos[0] + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1500 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.findPrivateForEmulate({ + emuVol: emuVol, + success: function (priVol) { + console.log('DSM_JS_Function_1500 call findPrivateForEmulate success' + JSON.stringify(priVol)) + expect(priVol.volumeInfos[1].mId == 'private').assertTrue(); + expect(priVol.volumeInfos[1].mState == 2).assertTrue(); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1500 call findPrivateForEmulate fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_1600 + * @tc.name DSM_JS_Function_1600 + * @tc.desc Find its corresponding emulated volume through private volume + */ + it('DSM_JS_Function_1600', 0, function () { + var priVol; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_1600 call getVolumes success' + data); + priVol = data.volumeInfos[1] + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1600 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.findEmulateForPrivate({ + priVol: priVol, + success: function (emuVol) { + console.log('DSM_JS_Function_1600 call findEmulateForPrivate success' + JSON.stringify(emuVol)) + expect(priVol.volumeInfos[0].mId == 'emulated;0').assertTrue(); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1600 call findEmulateForPrivate fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_1700 + * @tc.name DSM_JS_Function_1700 + * @tc.desc Get the name of the volume (SD card) + */ + it('DSM_JS_Function_1700', 0, function () { + var vol; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_1700 call getVolumes success' + data); + vol = data.volumeInfos[2] + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1700 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.getBestVolumeDescription({ + vol: vol, + success: function (desCription) { + console.log('DSM_JS_Function_1700 call getBestVolumeDescription success' +JSON.stringify(desCription)) + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1700 call getBestVolumeDescription fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_1800 + * @tc.name DSM_JS_Function_1800 + * @tc.desc Get the name of the volume (Internal storage public) + */ + it('DSM_JS_Function_1800', 0, function () { + var vol; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_1800 call getVolumes success' + data); + vol = data.volumeInfos[0] + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1800 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.getBestVolumeDescription({ + vol: vol, + success: function (desCription) { + console.log('DSM_JS_Function_1800 call getBestVolumeDescription success' + JSON.stringify(desCription)) + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1800 call getBestVolumeDescription fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_Function_1900 + * @tc.name DSM_JS_Function_1900 + * @tc.desc Get the name of the volume (Internal storage private) + */ + it('DSM_JS_Function_1900', 0, function () { + var vol; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_Function_1900 call getVolumes success' + data); + vol = data.volumeInfos[1] + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1900 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.getBestVolumeDescription({ + vol: vol, + success: function (desCription) { + console.log('DSM_JS_Function_1900 call getBestVolumeDescription success' + JSON.stringify(desCription)) + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1900 call getBestVolumeDescription fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + +}) diff --git a/storage/storagedsmjstest/src/main/js/default/test/DsmError.test.js b/storage/storagedsmjstest/src/main/js/default/test/DsmError.test.js new file mode 100644 index 000000000..69f810373 --- /dev/null +++ b/storage/storagedsmjstest/src/main/js/default/test/DsmError.test.js @@ -0,0 +1,514 @@ +/* + * 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 devicesmgr from '@system.devicesmgr'; +import { + describe, + beforeAll, + beforeEach, + afterEach, + afterAll, + it, + expect +} +from 'deccjsunit/index' + +describe('dsmErrorTest', function () { + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_0100 + * @tc.name DSM_JS_ERROR_0100 + * @tc.desc Verify that the mount volume ID is null successfully. + */ + it('DSM_JS_ERROR_0100', 0, function () { + devicesmgr.mount({ + volId: '', + success: function () { + console.log('DSM_JS_ERROR_0100 call mount success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_0100 call mount pass, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_0200 + * @tc.name DSM_JS_ERROR_0200 + * @tc.desc Verify that the mount does not exist and the volume ID is successful. + */ + it('DSM_JS_ERROR_0200', 0, function () { + devicesmgr.mount({ + volId: '123', + success: function () { + console.log('DSM_JS_ERROR_0200 call mount success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_0200 call mount pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_0300 + * @tc.name DSM_JS_ERROR_0300 + * @tc.desc Verify that the unmount does not exist and the volume ID is successful. + */ + it('DSM_JS_ERROR_0300', 0, function () { + devicesmgr.unMount({ + volId: '123', + success: function () { + console.log('DSM_JS_ERROR_0300 call unMount success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_0300 call unMount pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_0400 + * @tc.name DSM_JS_ERROR_0400 + * @tc.desc Verify that the unmount volume ID is null successfully. + */ + it('DSM_JS_ERROR_0400', 0, function () { + devicesmgr.unMount({ + volId: '', + success: function () { + console.log('DSM_JS_ERROR_0400 call unMount success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_0400 call unMount pass, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_0500 + * @tc.name DSM_JS_ERROR_0500 + * @tc.desc Verify that the format does not exist and whether the volume ID is successful. + */ + it('DSM_JS_ERROR_0500', 0, function () { + devicesmgr.format({ + volId: '123', + success: function () { + console.log('DSM_JS_ERROR_0500 call format success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_0500 call format pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_0600 + * @tc.name DSM_JS_ERROR_0600 + * @tc.desc Verify that the ID of the formatted volume is null successfully. + */ + it('DSM_JS_ERROR_0600', 0, function () { + devicesmgr.format({ + volId: '', + success: function () { + console.log('DSM_JS_ERROR_0600 call format success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_0600 call format pass, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_0700 + * @tc.name DSM_JS_ERROR_0700 + * @tc.desc Verify that the SD card is successfully copied and mounted.. + */ + it('DSM_JS_ERROR_0700', 0, function () { + let mId; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_JS_ERROR_0900 call getVolumes success. data:' + JSON.stringify(data)); + for (let i = 0; i < data.volumeInfos.length; i++) { + if (data.volumeInfos[i].mState == 2 && data.volumeInfos[i].mId.indexOf('public:179') != -1) { + mId = data.volumeInfos[i].mId; + break; + } + } + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_0700 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.mount({ + volId: mId, + success: function () { + console.log('DSM_JS_ERROR_0700 call mount success'); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_0700 call mount fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_0800 + * @tc.name DSM_JS_ERROR_0800 + * @tc.desc Verify that volId is empty + */ + it('DSM_JS_ERROR_0800', 0, function () { + devicesmgr.findVolumeById({ + volId: '', + success: function () { + console.log('DSM_JS_ERROR_0800 call findVolumeById success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_0800 call findVolumeById pass, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_0900 + * @tc.name DSM_JS_ERROR_0900 + * @tc.desc Invalid volId validation + */ + it('DSM_JS_ERROR_0900', 0, function () { + devicesmgr.findVolumeById({ + volId: '1234', + success: function () { + console.log('DSM_JS_ERROR_0900 call findVolumeById success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_0900 call findVolumeById pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_1000 + * @tc.name DSM_JS_ERROR_1000 + * @tc.desc Verify that volumeUuid is null + */ + it('DSM_JS_ERROR_1000', 0, function () { + devicesmgr.findVolumeByUuid({ + volumeUuid: '', + success: function () { + console.log('DSM_JS_ERROR_1000 call findVolumeByUuid success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_1000 call findVolumeByUuid pass, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_1100 + * @tc.name DSM_JS_ERROR_1100 + * @tc.desc Invalid volumeUuid validation + */ + it('DSM_JS_ERROR_1100', 0, function () { + devicesmgr.findVolumeByUuid({ + volumeUuid: '321', + success: function () { + console.log('DSM_JS_ERROR_1100 call findVolumeByUuid success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_1100 call findVolumeByUuid pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_1200 + * @tc.name DSM_JS_ERROR_1200 + * @tc.desc Verify that diskId is empty + */ + it('DSM_JS_ERROR_1200', 0, function () { + devicesmgr.findDiskById({ + diskId: '', + success: function () { + console.log('DSM_JS_ERROR_1200 call findDiskById success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_1200 call findDiskById pass, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_1300 + * @tc.name DSM_JS_ERROR_1300 + * @tc.desc Invalid DiskID verified + */ + it('DSM_JS_ERROR_1300', 0, function () { + devicesmgr.findDiskById({ + diskId: '789', + success: function () { + console.log('DSM_JS_ERROR_1300 call findDiskById success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_1300 call findDiskById pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_1400 + * @tc.name DSM_JS_ERROR_1400 + * @tc.desc Verify that the value of the incoming simulate collection is null + */ + it('DSM_JS_ERROR_1400', 0, function () { + devicesmgr.findPrivateForEmulate({ + emuVol: { + mId: '', + mDiskId: '', + mPartGuid: '', + mFsUuid: '', + mType: '', + mMountFlags: '', + mMountUserId: '', + mState: '', + mPath: '', + mInternalPath: '', + mFsLabel: '', + Description: '', + IsVisibleForUser: '', + IsEmulated: '', + IsPrimaryEmulatedForUser: '', + IsRemovable: '', + IsPrimary: '' + }, + success: function () { + console.log('DSM_JS_ERROR_1400 call findPrivateForEmulate success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_1400 call findPrivateForEmulate pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_1500 + * @tc.name DSM_JS_ERROR_1500 + * @tc.desc Verify that an invalid simulate set value was passed in + */ + it('DSM_JS_ERROR_1500', 0, function () { + devicesmgr.findPrivateForEmulate({ + emuVol: { + mId: '1234', + mDiskId: '321', + mPartGuid: '1357', + mFsUuid: '7890', + mType: 2, + mMountFlags: 3, + mMountUserId: 0, + mState: 6, + mPath: '/storage/emulated', + mInternalPath: '/data/media', + mFsLabel: '123', + Description: true, + IsVisibleForUser: true, + IsEmulated: true, + IsPrimaryEmulatedForUser: true, + IsRemovable: true, + IsPrimary: true + }, + success: function () { + console.log('DSM_JS_ERROR_1500 call findPrivateForEmulate success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_1500 call findPrivateForEmulate pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_1600 + * @tc.name DSM_JS_ERROR_1600 + * @tc.desc Verify that the value of the incoming private collection is empty + */ + it('DSM_JS_ERROR_1600', 0, function () { + devicesmgr.findEmulateForPrivate({ + priVol: { + mId: '', + mDiskId: '', + mPartGuid: '', + mFsUuid: '', + mType: '', + mMountFlags: '', + mMountUserId: '', + mState: '', + mPath: '', + mInternalPath: '', + mFsLabel: '', + Description: '', + IsVisibleForUser: '', + IsEmulated: '', + IsPrimaryEmulatedForUser: '', + IsRemovable: '', + IsPrimary: '' + }, + success: function () { + console.log('DSM_JS_ERROR_1600 call findEmulateForPrivate success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_1600 call findEmulateForPrivate pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_1700 + * @tc.name DSM_JS_ERROR_1700 + * @tc.desc Verify that an invalid private collection value was passed in + */ + it('DSM_JS_ERROR_1700', 0, function () { + devicesmgr.findEmulateForPrivate({ + priVol: { + mId: '1234', + mDiskId: '321', + mPartGuid: '456', + mFsUuid: '789', + mType: 1, + mMountFlags: 0, + mMountUserId: 0, + mState: 2, + mPath: 'data', + mInternalPath: '', + mFsLabel: '', + Description: true, + IsVisibleForUser: true, + IsEmulated: true, + IsPrimaryEmulatedForUser: true, + IsRemovable: true, + IsPrimary: true + }, + success: function () { + console.log('DSM_JS_ERROR_1700 call findEmulateForPrivate success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_1700 call findEmulateForPrivate pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_1800 + * @tc.name DSM_JS_ERROR_1800 + * @tc.desc Verify that the vol set value is empty + */ + it('DSM_JS_ERROR_1800', 0, function () { + devicesmgr.getBestVolumeDescription({ + vol: { + mId: '', + mDiskId: '', + mPartGuid: '', + mFsUuid: '', + mType: '', + mMountFlags: '', + mMountUserId: '', + mState: '', + mPath: '', + mInternalPath: '', + mFsLabel: '', + Description: '', + IsVisibleForUser: '', + IsEmulated: '', + IsPrimaryEmulatedForUser: '', + IsRemovable: '', + IsPrimary: '' + }, + success: function () { + console.log('DSM_JS_ERROR_1800 call getBestVolumeDescription success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_1800 call getBestVolumeDescription pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_DSM_JS_ERROR_1900 + * @tc.name DSM_JS_ERROR_1900 + * @tc.desc Validate invalid vol set value + */ + it('DSM_JS_ERROR_1900', 0, function () { + devicesmgr.getBestVolumeDescription({ + vol: { + mId: 'public:177,25', + mDiskId: 'disk:178,24', + mPartGuid: '', + mFsUuid: 'd87ba2fe-828f-4237-8006-c6dc6c2910e7', + mType: 0, + mMountFlags: 2, + mMountUserId: 0, + mState: 2, + mPath: '/storage/d87ba2fe-828f-4237-8006-c6dc6c2910e7', + mInternalPath: '/data/ss/d87ba2fe-828f-4237-8006-c6dc6c2910e7', + mFsLabel: '', + Description: true, + IsVisibleForUser: true, + IsEmulated: true, + IsPrimaryEmulatedForUser: true, + IsRemovable: true, + IsPrimary: true + }, + success: function () { + console.log('DSM_JS_ERROR_1900 call getBestVolumeDescription success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('DSM_JS_ERROR_1900 call getBestVolumeDescription pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }) + }) + +}) diff --git a/storage/storagedsmjstest/src/main/js/default/test/List.test.js b/storage/storagedsmjstest/src/main/js/default/test/List.test.js new file mode 100644 index 000000000..8435a4c99 --- /dev/null +++ b/storage/storagedsmjstest/src/main/js/default/test/List.test.js @@ -0,0 +1,17 @@ +/* + * 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. + */ + +require('./Dsm.test.js') +require('./DsmError.test.js') diff --git a/storage/storagedsmjstest/src/main/resources/base/element/string.json b/storage/storagedsmjstest/src/main/resources/base/element/string.json new file mode 100644 index 000000000..4b5a8bbc0 --- /dev/null +++ b/storage/storagedsmjstest/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "storagefilestabilityjstest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/storage/storagedsmjstest/src/main/resources/base/media/icon.png b/storage/storagedsmjstest/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6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!+MN=Ds}>1hRma4`uCIz9%p3O77839E{xf z4c_I?**|1`K2tg4!Hvyrou4BsJQuv*UfF)<%CelYIS>D^o?X)3+MK%la6kooW8&G@BU)Y0hT`+mOm$Z_%rB=a%o>I z!2c6lHyKQN)VjiFwa!eE^p8jc$sy$vB+8i25lI~6KPFFh$!o$avA~rj#L6xvR|Z83 z*WD6T9e+5Pyy=F+)pNTf{ny3cy>7Rkd3o*TS?TZJ`NS^NF2%HMkyS{?uJ$`!P4_L^ z1`NFDUbNyg_qREifgktnp1_v{Jbb`7m}2PTyUdOmtJj~m z9bB=ecw4_^rw1IW=of+>nrW5=d3k`3qHCxsIN_F{T1A545};;+fsyC&qChi+YV zr~M63H8ZLCPYmsjY>ls9cL%I)F|JIW-#+48$+lD4k*(P*kDM%zx_fvu4u5ZYUnI}5 zdrycFq>xFU)&X3p@pP2u%$o}}YcRn(MhJ&B2o?KS@cIVz>Ye%o^xV?CB{_Qhu z;}_q1bvO^g{8<3!gYbo4Di{8qzV+(9 zdlmksohQmRTs@qB;(Wo?dER_ux6XQb@q$tQPW?CMu6GVQd;R=iR;-S{Kr%Zks7>b1 zNs{|-+jhObYE}NR&`TGGr^h^4bjh%c>R#@=8nM&Md>_a+zVulsl;){flFekV1t9ob z+SqfV_Pv3$2f)bQ8%Ul2>fdYR^1zs0BQF~olsOj5AodC&Q_7SMFzsz2 z9newxE&jodk~tNHwl%LBMMDbrk=(^b literal 0 HcmV?d00001 diff --git a/storage/storagedsmstabilityjstest/src/main/config.json b/storage/storagedsmstabilityjstest/src/main/config.json new file mode 100644 index 000000000..9b7cfe5d0 --- /dev/null +++ b/storage/storagedsmstabilityjstest/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "ohos.acts.stroage.fileio", + "vendor": "example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.stroage.fileio", + "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.stroage.fileio.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/storagedsmstabilityjstest/src/main/js/default/app.js b/storage/storagedsmstabilityjstest/src/main/js/default/app.js new file mode 100644 index 000000000..60ee141c8 --- /dev/null +++ b/storage/storagedsmstabilityjstest/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.distributeddatamgr.distributedfile onCreate'); + }, + onDestroy() { + console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); + } +}; diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/i18n/en-US.json b/storage/storagedsmstabilityjstest/src/main/js/default/i18n/en-US.json new file mode 100644 index 000000000..ead52ed2e --- /dev/null +++ b/storage/storagedsmstabilityjstest/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/storagedsmstabilityjstest/src/main/js/default/i18n/zh-CN.json b/storage/storagedsmstabilityjstest/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 000000000..3f48f2585 --- /dev/null +++ b/storage/storagedsmstabilityjstest/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/storagedsmstabilityjstest/src/main/js/default/pages/index/index.css b/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.css new file mode 100644 index 000000000..6fda79275 --- /dev/null +++ b/storage/storagedsmstabilityjstest/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/storagedsmstabilityjstest/src/main/js/default/pages/index/index.hml b/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.hml new file mode 100644 index 000000000..f64b040a5 --- /dev/null +++ b/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.js b/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.js new file mode 100644 index 000000000..f7894a722 --- /dev/null +++ b/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.js @@ -0,0 +1,40 @@ +/* + * 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/storagedsmstabilityjstest/src/main/js/default/test/Common.js b/storage/storagedsmstabilityjstest/src/main/js/default/test/Common.js new file mode 100644 index 000000000..e94e7f404 --- /dev/null +++ b/storage/storagedsmstabilityjstest/src/main/js/default/test/Common.js @@ -0,0 +1,180 @@ +/* + * 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 fileio from '@system.fileio' +export const FILE_CONTENT = 'hello world' +export function prepareFile(fpath, content) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o666) + fileio.ftruncateSync(fd) + fileio.writeSync(fd, content) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function prepareFile1(fpath, content) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o777) + fileio.ftruncateSync(fd) + fileio.writeSync(fd, content) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function prepareEmptyFile(fpath) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o777) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function fileToReadOnly(fpath) { + try { + let fd = fileio.openSync(fpath, 0o1) + fileio.fchmodSync(fd, 0o444) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToReadOnly for ' + e); + return false + } +} +export function fileToWriteOnly(fpath) { + try { + let fd = fileio.openSync(fpath, 0o2) + fileio.fchmodSync(fd, 0o222) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToWriteOnly ' + e) + return false + } +} +export function fileToReadAndWrite(fpath) { + try { + let fd = fileio.openSync(fpath, 0o1) + fileio.fchmodSync(fd, 0o777) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToReadAndWrite ' + e); + return false + } +} +export function filePickerName(testName,deviceID) { + const BASE_PATH = '/data/ss/'+deviceID+'/fms_test/' + return BASE_PATH + testName +} +export function appName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' + return BASE_PATH + testName +} +export function nextFileName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' + return BASE_PATH + testName +} +export function fileName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' + return BASE_PATH + testName +} +export function cacheFileName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' + return BASE_PATH + testName +} +export function differentFileName(testName) { + const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' + return BASE_PATH + testName +} +export function differentCacheName(testName) { + const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' + return BASE_PATH + testName +} +export function fmsFileName(testName) { + const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/files/" + return BASE_PATH + testName +} +export function fmsCacheName(testName) { + const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/cache/" + return BASE_PATH + testName +} + +export function getFileTextLen(fpath) { + let ss + try { + ss = fileio.Stream.createStreamSync(fpath, 'r+') + expect(ss !== null).assertTrue() + let len = ss.readSync(new ArrayBuffer(4096)) + console.log('file:' + fpath) + console.log('file lenth:' + len) + expect(ss.closeSync() !== null).assertTrue() + return len + } + catch (e) { + console.log('Failed to getFileTextLen ' + e) + expect(ss.closeSync() == null).assertTrue() + return null + } +} +export function isFileExist(fpath) { + try { + expect(fileio.accessSync(fpath) !== null).assertTrue() + console.log('file:' + fpath) + console.log('status:exist') + return true + } + catch (e) { + console.log('file:' + fpath) + console.log('status:non-existen') + return false + } +} +export function sleep(n) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > n) { + break; + } + } +} +export function randomString(num) { + let len= num; + var $chars = 'aaaabbbbcccc'; + var maxPos = $chars.length; + var pwd = ''; + for (var i = 0; i < len; i++) { + pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); + } + return pwd; +} diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/test/DsmPerformance.test.js b/storage/storagedsmstabilityjstest/src/main/js/default/test/DsmPerformance.test.js new file mode 100644 index 000000000..1a5f4dfb9 --- /dev/null +++ b/storage/storagedsmstabilityjstest/src/main/js/default/test/DsmPerformance.test.js @@ -0,0 +1,372 @@ +/* + * 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 devicesmgr from '@system.devicesmgr'; +import { + describe, + beforeAll, + beforeEach, + afterEach, + afterAll, + it, + expect +} +from 'deccjsunit/index' + +describe('dsmPerformanceTest', function () { + + /** + * @tc.number SUB_STORAGE_DSM_Performance_0000 + * @tc.name DSM_Performance_0000 + * @tc.desc getVolumes Performance test + */ + it('DSM_Performance_0000', 0, function () { + for (let i = 0; i < 1000; i++) { + var start = new Date().getTime(); + devicesmgr.getVolumes({ + success: function (data) { + var end = new Date().getTime(); + console.log('DSM_Performance_0000 call getVolumes success' + JSON.stringify(data)); + console.log('---DSM_Performance_0000---time:-' + (end - start) + '-----' + i); + }, + fail: function (data, code) { + console.log('DSM_Performance_0000 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + } + }); + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Performance_0100 + * @tc.name DSM_Performance_0100 + * @tc.desc unMount mount Performance test + */ + it('DSM_Performance_0100', 0, function () { + let mId; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_Performance_0100 call getVolumes success' + data); + mId = data.volumeInfos[2].mId; + }, + fail: function (data, code) { + console.log('DSM_Performance_0100 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + for (let i = 0; i < 1000; i++) { + var start = new Date().getTime(); + if (mId != null) { + devicesmgr.unMount({ + volId: mId, + success: function () { + console.log('DSM_Performance_0100 call unMount success.'); + var end = new Date().getTime(); + console.log('---DSM_Performance_0100---time:-' + (end - start) + '-----' + i); + }, + fail: function (data, code) { + console.log('DSM_Performance_0100 call unMount fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + } + }) + var start1 = new Date().getTime(); + devicesmgr.mount({ + volId: mId, + success: function () { + var end1 = new Date().getTime(); + console.log('---DSM_Performance_0200---time:-' + (end1 - start1) + '-----' + i); + }, + fail: function (data, code) { + console.log('DSM_Performance_0200 call mount fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + } else { + expect(null).assertFail(); + } + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Performance_0300 + * @tc.name DSM_Performance_0300 + * @tc.desc getDisks Performance test + */ + it('DSM_Performance_0300', 0, function () { + for (let i = 0; i < 1000; i++) { + var start = new Date().getTime(); + devicesmgr.getDisks({ + success: function (data) { + console.log('DSM_Performance_0300 call getDisks success.' + JSON.stringify(data)); + var end = new Date().getTime(); + console.log('---DSM_Performance_0300---time:-' + (end - start) + '-----' + i); + }, + fail: function (data, code) { + console.log('DSM_Performance_0300 call getDisks fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Performance_0400 + * @tc.name DSM_Performance_0400 + * @tc.desc findVolumeById Performance test + */ + it('DSM_Performance_0400', 0, function () { + for (let i = 0; i < 1000; i++) { + let mId; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_Performance_0400 call getVolumes success' + JSON.stringify(data)); + mId = data.volumeInfos[2].mId; + }, + fail: function (data, code) { + console.log('DSM_Performance_0400 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + var start = new Date().getTime(); + devicesmgr.findVolumeById({ + volId: mId, + success: function (data) { + console.log('DSM_Performance_0400 call findVolumeById success' + JSON.stringify(data)) + var end = new Date().getTime(); + console.log('---DSM_Performance_0400---time:-' + (end - start) + '-----' + i); + }, + fail: function (data, code) { + console.log('DSM_Performance_0400 call findVolumeById fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Performance_0500 + * @tc.name DSM_Performance_0500 + * @tc.desc findVolumeByUuid Performance test + */ + it('DSM_Performance_0500', 0, function () { + let mFsUuid; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_Performance_0500 call getVolumes success' + JSON.stringify(data)); + mFsUuid = data.volumeInfos[2].mFsUuid; + }, + fail: function (data, code) { + console.log('DSM_Performance_0500 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + for (let i = 0; i < 1000; i++) { + var start = new Date().getTime(); + devicesmgr.findVolumeByUuid({ + volumeUuid: mFsUuid, + success: function (vol) { + console.log('DSM_Performance_0500 call findVolumeByUuid success' + JSON.stringify(vol)); + var end = new Date().getTime(); + console.log('---DSM_Performance_0500---time:-' + (end - start) + '-----' + i); + }, + fail: function (data, code) { + console.log('DSM_Performance_0500 call findVolumeByUuid fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Performance_0600 + * @tc.name DSM_Performance_0600 + * @tc.desc getWritableVolumes Performance test + */ + it('DSM_Performance_0600', 0, function () { + for (let i = 0; i < 1000; i++) { + var start = new Date().getTime(); + devicesmgr.getWritableVolumes({ + success: function (data) { + console.log('DSM_Performance_0600 call getWritableVolumes success. data:' + JSON.stringify(data)); + var end = new Date().getTime(); + console.log('---DSM_Performance_0600---time:-' + (end - start) + '-----' + i); + }, + fail: function (data, code) { + console.log('DSM_Performance_0600 call getWritableVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Performance_0700 + * @tc.name DSM_Performance_0700 + * @tc.desc findDiskById Performance test + */ + it('DSM_Performance_0700', 0, function () { + let mDiskId; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_Performance_0700 call getVolumes success' + JSON.stringify(data)); + mDiskId = data.volumeInfos[2].mDiskId; + }, + fail: function (data, code) { + console.log('DSM_Performance_0700 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + for (let i = 0; i < 1000; i++) { + var start = new Date().getTime(); + devicesmgr.findDiskById({ + diskId: mDiskId, + success: function (disk) { + console.log('DSM_Performance_0700 call findDiskById success' + JSON.stringify(disk)) + var end = new Date().getTime(); + console.log('---DSM_Performance_0700---time:-' + (end - start) + '-----' + i); + }, + fail: function (data, code) { + console.log('DSM_Performance_0700 call findDiskById fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Performance_0800 + * @tc.name DSM_Performance_0800 + * @tc.desc getPrimaryStorageUuid Performance test + */ + it('DSM_Performance_0800', 0, function () { + for (let i = 0; i < 1000; i++) { + var start = new Date().getTime(); + devicesmgr.getPrimaryStorageUuid({ + success: function (primaryUuid) { + console.log('DSM_Performance_0800 call getPrimaryStorageUuid success.' + JSON.stringify(primaryUuid)); + var end = new Date().getTime(); + console.log('---DSM_Performance_0800---time:-' + (end - start) + '-----' + i); + }, + fail: function (data, code) { + console.log('DSM_Performance_0800 call getPrimaryStorageUuid fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Performance_0900 + * @tc.name DSM_Performance_0900 + * @tc.desc findPrivateForEmulate Performance test + */ + it('DSM_Performance_0900', 0, function () { + let emuVol; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_Performance_0900 call getVolumes success' + JSON.stringify(data)); + emuVol = data.volumeInfos[0] + }, + fail: function (data, code) { + console.log('DSM_Performance_0900 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + for (let i = 0; i < 1000; i++) { + var start = new Date().getTime(); + devicesmgr.findPrivateForEmulate({ + emuVol: emuVol, + success: function (priVol) { + console.log('DSM_Performance_0900 call findPrivateForEmulate success' + JSON.stringify(priVol)) + var end = new Date().getTime(); + console.log('---DSM_Performance_0900---time:-' + (end - start) + '-----' + i); + }, + fail: function (data, code) { + console.log('DSM_Performance_0900 call findPrivateForEmulate fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Performance_1000 + * @tc.name DSM_Performance_1000 + * @tc.desc findPrivateForEmulate Performance test + */ + it('DSM_Performance_1000', 0, function () { + let emuVol ; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_Performance_1000 call getVolumes success' + JSON.stringify(data)); + emuVol = data.volumeInfos[1] + }, + fail: function (data, code) { + console.log('DSM_Performance_1000 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + for (let i = 0; i < 1000; i++) { + var start = new Date().getTime(); + devicesmgr.findEmulateForPrivate({ + priVol: emuVol, + success: function (emuVol) { + console.log('DSM_Performance_1000 call findEmulateForPrivate success' + JSON.stringify(emuVol)) + var end = new Date().getTime(); + console.log('---DSM_Performance_1000---time:-' + (end - start) + '-----' + i); + }, + fail: function (data, code) { + console.log('DSM_Performance_1000 call findEmulateForPrivate fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Performance_1100 + * @tc.name DSM_Performance_1100 + * @tc.desc findPrivateForEmulate Performance test + */ + it('DSM_Performance_1100', 0, function () { + let emuVol; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_Performance_1100 call getVolumes success' + JSON.stringify(data)); + emuVol = data.volumeInfos[2] + }, + fail: function (data, code) { + console.log('DSM_Performance_1100 call getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + for (let i = 0; i < 1000; i++) { + var start = new Date().getTime(); + devicesmgr.getBestVolumeDescription({ + vol: emuVol, + success: function (desCription) { + console.log('DSM_JS_Function_1100 call getBestVolumeDescription success' + desCription) + var end = new Date().getTime(); + console.log('---DSM_Performance_1100---time:-' + (end - start) + '-----' + i); + }, + fail: function (data, code) { + console.log('DSM_JS_Function_1100 call getBestVolumeDescription fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + } + }) + +}) diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/test/DsmReliability.test.js b/storage/storagedsmstabilityjstest/src/main/js/default/test/DsmReliability.test.js new file mode 100644 index 000000000..aa6139bc7 --- /dev/null +++ b/storage/storagedsmstabilityjstest/src/main/js/default/test/DsmReliability.test.js @@ -0,0 +1,224 @@ +/* + * 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 devicesmgr from '@system.devicesmgr'; +import { + describe, + beforeAll, + beforeEach, + afterEach, + afterAll, + it, + expect +} +from 'deccjsunit/index' +describe('dsmReliabilityTest', function () { + + /** + * @tc.number SUB_STORAGE_DSM_Reliability_0000 + * @tc.name DSM_Reliability_0000 + * @tc.desc Reliability test + */ + it('DSM_Reliability_0000', 0, function () { + for (let i = 0; i < 100000; i++) { + let mId; + let mFsUuid; + let mDiskId; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_Reliability_0000 getVolumes success' + JSON.stringify(data) + i); + mId = data.volumeInfos[2].mId; + mFsUuid = data.volumeInfos[2].mFsUuid; + mDiskId = data.volumeInfos[2].mDiskId; + }, + fail: function (data, code) { + console.log('DSM_Reliability_0000 getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + } + }); + devicesmgr.getDisks({ + success: function () { + console.log('DSM_Reliability_0300 getDisks success.' + i); + }, + fail: function (data, code) { + console.log('DSM_Reliability_0300 getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.findVolumeById({ + volId: mId, + success: function () { + console.log('DSM_Reliability_0400 findVolumeById success' + i) + }, + fail: function (data, code) { + console.log('DSM_Reliability_0400 findVolumeById fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + devicesmgr.findVolumeByUuid({ + volumeUuid: mFsUuid, + success: function () { + console.log('DSM_Reliability_0500 findVolumeByUuid success' + i); + }, + fail: function (data, code) { + console.log('DSM_Reliability_0500 findVolumeByUuid fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + devicesmgr.getWritableVolumes({ + success: function () { + console.log('DSM_Reliability_0600 getWritableVolumes success. data:' + i); + }, + fail: function (data, code) { + console.log('DSM_Reliability_0600 getWritableVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.findDiskById({ + diskId: mDiskId, + success: function () { + console.log('DSM_Reliability_0700 findDiskById success' + i) + }, + fail: function (data, code) { + console.log('DSM_Reliability_0700 findDiskById fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + devicesmgr.getPrimaryStorageUuid({ + success: function () { + console.log('DSM_Reliability_0800 getPrimaryStorageUuid success.' + i); + }, + fail: function (data, code) { + console.log('DSM_Reliability_0800 getPrimaryStorageUuid fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + devicesmgr.unMount({ + volId: mId, + success: function () { + console.log('DSM_Reliability_0100 unMount success.' + i); + }, + fail: function (data, code) { + console.log('DSM_Reliability_0100 unMount fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + } + }) + devicesmgr.mount({ + volId: mId, + success: function () { + console.log('DSM_Reliability_0200 mount success.' + i); + }, + fail: function (data, code) { + console.log('DSM_Reliability_0200 mount fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Reliability_0900 + * @tc.name DSM_Reliability_0900 + * @tc.desc Reliability test + */ + it('DSM_Reliability_0900', 0, function () { + let emuVol; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_Reliability_0900 getVolumes success'); + emuVol = data.volumeInfos[0] + }, + fail: function (data, code) { + console.log('DSM_Reliability_0900 getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + for (let i = 0; i < 100000; i++) { + devicesmgr.findPrivateForEmulate({ + emuVol: emuVol, + success: function () { + console.log('DSM_Reliability_0900 findPrivateForEmulate success' + i) + }, + fail: function (data, code) { + console.log('DSM_Reliability_0900 findPrivateForEmulate fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Reliability_1000 + * @tc.name DSM_Reliability_1000 + * @tc.desc Reliability test + */ + it('DSM_Reliability_1000', 0, function () { + let emuVol; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_Reliability_1000 getVolumes success'); + emuVol = data.volumeInfos[1] + }, + fail: function (data, code) { + console.log('DSM_Reliability_1000 getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + for (let i = 0; i < 100000; i++) { + devicesmgr.findEmulateForPrivate({ + emuVol: emuVol, + success: function () { + console.log('DSM_Reliability_1000 findPrivateForEmulate success' + i) + }, + fail: function (data, code) { + console.log('DSM_Reliability_1000 findPrivateForEmulate fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + } + }) + + /** + * @tc.number SUB_STORAGE_DSM_Reliability_1100 + * @tc.name DSM_Reliability_1100 + * @tc.desc Reliability test + */ + it('DSM_Reliability_1100', 0, function () { + let vol; + devicesmgr.getVolumes({ + success: function (data) { + console.log('DSM_Reliability_1100 getVolumes success'); + vol = data.volumeInfos[0] + }, + fail: function (data, code) { + console.log('DSM_Reliability_1100 getVolumes fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + for (let i = 0; i < 100000; i++) { + devicesmgr.getBestVolumeDescription({ + vol: vol, + success: function (desCription) { + console.log('DSM_Reliability_1100 call getBestVolumeDescription success' + desCription) + }, + fail: function (data, code) { + console.log('DSM_Reliability_1100 call getBestVolumeDescription fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + } + }) + +}) diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/test/List.test.js b/storage/storagedsmstabilityjstest/src/main/js/default/test/List.test.js new file mode 100644 index 000000000..79bcbec42 --- /dev/null +++ b/storage/storagedsmstabilityjstest/src/main/js/default/test/List.test.js @@ -0,0 +1,17 @@ +/* + * 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. + */ + +require('./DsmPerformance.test.js') +require('./DsmReliability.test.js') diff --git a/storage/storagedsmstabilityjstest/src/main/resources/base/element/string.json b/storage/storagedsmstabilityjstest/src/main/resources/base/element/string.json new file mode 100644 index 000000000..4b5a8bbc0 --- /dev/null +++ b/storage/storagedsmstabilityjstest/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "storagefilestabilityjstest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/storage/storagedsmstabilityjstest/src/main/resources/base/media/icon.png b/storage/storagedsmstabilityjstest/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+YLHm~|L~ z7$0v5mkobriU!H<@mVJHLlmQqzQ3d6Rh_-|%Yy2li*tHO>_vcnuZ7OR_xkAIuIU&x z-|8Y0wj|6|a6_I(v91y%k_kNw6pnkNdxjqG8!%Vz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L;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y pass, call readText success. data.text: ' ); done(); }, @@ -116,7 +106,7 @@ describe('fileconcurrent', function () { }); file.readText({ uri: 'internal://app/file_test_001', - success: function (data) { + success: function () { console.log('file_test_001 => pass, call readText success. data.text: ' ); done(); }, @@ -127,7 +117,7 @@ describe('fileconcurrent', function () { }); file.readText({ uri: 'internal://app/file_test_001', - success: function (data) { + success: function () { console.log('file_test_001 => pass, call readText success. data.text: ' ); done(); }, @@ -162,7 +152,7 @@ describe('fileconcurrent', function () { file.copy({ srcUri: 'internal://app/file_test_002', dstUri: 'internal://app/file_test_002', - success: function (uri) { + success: function () { console.log('file_test_002 => pass,call copy success. uri:' ); done(); }, @@ -174,7 +164,7 @@ describe('fileconcurrent', function () { file.copy({ srcUri: 'internal://app/file_test_002', dstUri: 'internal://app/file_test_002' + '100', - success: function (uri) { + success: function () { console.log('file_test_002 => pass,call copy success. uri:' ); done(); }, @@ -186,7 +176,7 @@ describe('fileconcurrent', function () { file.copy({ srcUri: 'internal://app/file_test_002', dstUri: 'internal://app/file_test_002' + '200', - success: function (uri) { + success: function () { console.log('file_test_002 => pass,call copy success. uri:' ); done(); }, @@ -221,7 +211,7 @@ describe('fileconcurrent', function () { file.move({ srcUri: 'internal://app/file_test_003', dstUri: 'internal://file_test_003', - success: function (uri) { + success: function () { console.log('file_test_003 => pass,call move success. uri:' ); done(); }, @@ -255,7 +245,7 @@ describe('fileconcurrent', function () { for (let i = 0; i < 10; i++) { file.readArrayBuffer({ uri: 'internal://app/file_test_004', - success: function (data) { + success: function () { console.log('file_test_004 => pass,call readArrayBuffer success. '); done(); }, @@ -266,7 +256,7 @@ describe('fileconcurrent', function () { }); file.readArrayBuffer({ uri: 'internal://app/file_test_004', - success: function (data) { + success: function () { console.log('file_test_004 => pass,call readArrayBuffer success. '); done(); }, @@ -277,7 +267,7 @@ describe('fileconcurrent', function () { }); file.readArrayBuffer({ uri: 'internal://app/file_test_004', - success: function (data) { + success: function () { console.log('file_test_004 => pass,call readArrayBuffer success. '); done(); }, @@ -357,7 +347,7 @@ describe('fileconcurrent', function () { }); file.readText({ uri: 'internal://app/file_test_006', - success: function (data) { + success: function () { console.log('file_test_006 => pass,call readText success: '); done(); }, @@ -391,7 +381,7 @@ describe('fileconcurrent', function () { }); file.readArrayBuffer({ uri: 'internal://app/file_test_007', - success: function (data) { + success: function () { console.log('file_test_007 => pass,call readArrayBuffer success: '); done(); }, @@ -425,7 +415,7 @@ describe('fileconcurrent', function () { file.copy({ srcUri: 'internal://app/file_test_008', dstUri: 'internal://app/file_test_008', - success: function (uri) { + success: function () { console.log('file_test_008 => pass,call copy success. uri:'); done(); }, diff --git a/storage/storagefileioerrorjstest/BUILD.gn b/storage/storagefileioerrorjstest/BUILD.gn index 14b6b8a97..f5ff1f948 100644 --- a/storage/storagefileioerrorjstest/BUILD.gn +++ b/storage/storagefileioerrorjstest/BUILD.gn @@ -18,14 +18,16 @@ ohos_js_hap_suite("storagefileioerror_js_test") { ":storagefileioerror_js_assets", ":storagefileioerror_js_resources", ] -# shared_libraries = [ -# "//third_party/giflib:libgif", -# "//third_party/libpng:libpng", -# ] + + # shared_libraries = [ + # "//third_party/giflib:libgif", + # "//third_party/libpng:libpng", + # ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "storagefileioerrorjstest" -# part_name = "prebuilt_hap" -# subsystem_name = "xts" + + # part_name = "prebuilt_hap" + # subsystem_name = "xts" } ohos_js_assets("storagefileioerror_js_assets") { source_dir = "./src/main/js/default" @@ -33,4 +35,4 @@ ohos_js_assets("storagefileioerror_js_assets") { ohos_resources("storagefileioerror_js_resources") { sources = [ "./src/main/resources" ] hap_profile = "./src/main/config.json" -} \ No newline at end of file +} diff --git a/storage/storagefileioerrorjstest/src/main/js/default/test/FileError.test.js b/storage/storagefileioerrorjstest/src/main/js/default/test/FileError.test.js index 9d10bce6f..a1c847c8a 100644 --- a/storage/storagefileioerrorjstest/src/main/js/default/test/FileError.test.js +++ b/storage/storagefileioerrorjstest/src/main/js/default/test/FileError.test.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import fileio from '@system.fileio' import file from '@system.file'; import { @@ -145,11 +146,11 @@ describe('FileError', function () { uri: 'internal://app/file_test_error_005', success: function (data) { console.log('file_test_error_005 pass, Content:' + data.text); - done(); + expect(null).assertFail(); }, fail: function (data, code) { console.log('file_test_error_005 call readText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); + done(); }, }); }); @@ -165,11 +166,11 @@ describe('FileError', function () { uri: 'internal://app/file_test_error_006', success: function (data) { console.log('file_test_error_006 pass, Content:' + data.buffer); - done(); + expect(null).assertFail(); }, fail: function (data, code) { console.log('file_test_error_006 call readArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); + done(); }, }); }); @@ -187,11 +188,11 @@ describe('FileError', function () { recursive: true, success: function () { console.log('file_test_error_007 call rmdir success.'); - done(); + expect(null).assertFail(); }, fail: function (data, code) { console.log('file_test_error_007 call rmdir fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); + done(); }, }); }); @@ -242,11 +243,11 @@ describe('FileError', function () { recursive: true, success: function () { console.log('file_test_error_009 call rmdir success.'); - done(); + expect(null).assertFail(); }, fail: function (data, code) { console.log('file_test_error_009 call rmdir fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); + done(); }, }); }); diff --git a/storage/storagefileioerrorjstest/src/main/js/default/test/FileIOError.test.js b/storage/storagefileioerrorjstest/src/main/js/default/test/FileIOError.test.js index f9039f7ea..17b0d6ed0 100644 --- a/storage/storagefileioerrorjstest/src/main/js/default/test/FileIOError.test.js +++ b/storage/storagefileioerrorjstest/src/main/js/default/test/FileIOError.test.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import fileio from '@system.fileio' import { describe, @@ -59,10 +60,10 @@ describe('FileIOError', function () { let dpath = nextFileName('fileio_test_error_001d'); try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); + expect(null).assertFail(); } catch (e) { console.log('fileio_test_error_001 has failed for ' + e); - expect(null).assertFail(); } }); @@ -105,7 +106,7 @@ describe('FileIOError', function () { * @tc.number SUB_STORAGE_FileIo_test_error_0400 * @tc.name FileIo_test_error_004 * @tc.desc Function of API, When the disk space is full, - * verify synchronization and write the buffer data back to the disk for data synchronization + * verify synchronization and write the buffer data back to the disk for data synchronization */ it('FileIo_test_error_004', 0, function () { let fpath = nextFileName('fileio_test_error_004'); @@ -134,10 +135,10 @@ describe('FileIOError', function () { let fd = fileio.openSync(fpath); expect(fd !== null).assertTrue(); expect(fileio.closeSync(fd) !== null).assertTrue(); + expect(null).assertFail(); } catch (e) { console.log('fileio_test_error_005 has failed for ' + e); - expect(null).assertFail(); } }); @@ -156,17 +157,18 @@ describe('FileIOError', function () { let rlen = fileio.readSync(fd, new ArrayBuffer(209715200)); expect(rlen == 209715200).assertTrue(); expect(fileio.closeSync(fd) !== null).assertTrue(); + expect(null).assertFail(); } catch (e) { console.log('fileio_test_error_006 has failed for ' + e); - expect(null).assertFail(); } }); /** * @tc.number SUB_STORAGE_FileIo_test_error_0700 * @tc.name FileIo_test_error_007 - * @tc.desc Function of API, Verify the function of obtaining 200m file stream synchronously when 100m ram is left + * @tc.desc Function of API, Verify the function of obtaining + * 200m file stream synchronously when 100m ram is left * Create a 200m file (fileio_test_error_005) and grant 777 permissions, * path:/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/fileio_test_error_005 */ @@ -176,10 +178,10 @@ describe('FileIOError', function () { let ss = fileio.createStreamSync(fpath, 'r+'); expect(ss !== null).assertTrue(); expect(ss.closeSync() !== null).assertTrue(); + expect(null).assertFail(); } catch (e) { console.log('fileio_test_error_007 has failed for ' + e); - expect(null).assertFail(); } }); @@ -198,10 +200,10 @@ describe('FileIOError', function () { let rlen = ss.readSync(new ArrayBuffer(209715200)); expect(rlen == 209715200).assertTrue(); expect(ss.closeSync() !== null).assertTrue(); + expect(null).assertFail(); } catch (e) { console.log('fileio_test_error_008 has failed for ' + e); - expect(null).assertFail(); } }); @@ -247,7 +249,8 @@ describe('FileIOError', function () { /** * @tc.number SUB_STORAGE_FileIo_test_error_1100 * @tc.name FileIo_test_error_011 - * @tc.desc Function of API, Pass in a path that exceeds 4096 bytes to copy the file + * @tc.desc Function of API, Pass in a + * path that exceeds 4096 bytes to copy the file */ it('FileIo_test_error_011', 0, function () { let fpath = nextFileName('fileio_test_error_011'); diff --git a/storage/storagefileioerrorjstest/src/main/js/default/test/FileVirtualPath.test.js b/storage/storagefileioerrorjstest/src/main/js/default/test/FileVirtualPath.test.js index dcffe7165..26beeb262 100644 --- a/storage/storagefileioerrorjstest/src/main/js/default/test/FileVirtualPath.test.js +++ b/storage/storagefileioerrorjstest/src/main/js/default/test/FileVirtualPath.test.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import fileio from '@system.fileio'; import file from '@system.file'; import { @@ -24,6 +25,7 @@ import { FILE_CONTENT, prepareFile, fileName, + nextFileName } from './Common' @@ -525,4 +527,47 @@ describe('fileVirtualPath', function () { }); }); + /** + * @tc.number SUB_STORAGE_fileioPerformance_prop_copyFile + * @tc.name fileioPerformance_prop_copyFile + * @tc.desc 0.5G Synchronous opening performance test of test files + * The path needs to be manually placed in advance + * data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile/cache/p1'的0.5g文件) + */ + it('fileioPerformance_prop_copyFile', 0, function () { + console.log('---fileioPerformance_prop_copyFile 0.5G---start---'); + let fpath = nextFileName('p1'); + let fpathTarget = nextFileName('p2'); + for (let i = 0; i < 1000; i++) { + let start2 = new Date().getTime(); + let copyFileSync = fileio.copyFileSync(fpath, fpathTarget); + let end2 = new Date().getTime(); + let time2 = end2 - start2 + console.log('fileioPerformance_prop_copyFileSync,copyFileSync:' + copyFileSync + ', time2:' + time2 + ',' + i); + fileio.unlinkSync(fpathTarget); + } + fileio.closeSync(fd); + }); + + /** + * @tc.number SUB_STORAGE_fileioPerformance_prop_openSync + * @tc.name fileioPerformance_prop_openSync + * @tc.desc 0.5G Synchronous opening performance test of test files + * The path needs to be manually placed in advance + * data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile/cache/p1'的0.5g文件) + */ + it('fileioPerformance_prop_openSync', 0, function () { + console.log('---fileioPerformance_prop_openSync 0.5G---start---'); + let fpath = nextFileName('p1'); + let fd + for (let i = 0; i < 1000; i++) { + let start = new Date().getTime(); + fd = fileio.openSync(fpath, 0o2002); + let end = new Date().getTime(); + let time = end - start + console.log('fileioPerformance_prop_openSync,openSync:' + fd + ', time:' + time + ',' + i); + } + fileio.closeSync(fd); + }); + }); diff --git a/storage/storagefileiojstest/BUILD.gn b/storage/storagefileiojstest/BUILD.gn index 73cfe90e5..740c32ca7 100644 --- a/storage/storagefileiojstest/BUILD.gn +++ b/storage/storagefileiojstest/BUILD.gn @@ -18,14 +18,16 @@ ohos_js_hap_suite("storagefileio_js_test") { ":storagefileio_js_assets", ":storagefileio_js_resources", ] -# shared_libraries = [ -# "//third_party/giflib:libgif", -# "//third_party/libpng:libpng", -# ] + + # shared_libraries = [ + # "//third_party/giflib:libgif", + # "//third_party/libpng:libpng", + # ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "Storagefileiojstest" -# part_name = "prebuilt_hap" -# subsystem_name = "xts" + + # part_name = "prebuilt_hap" + # subsystem_name = "xts" } ohos_js_assets("storagefileio_js_assets") { source_dir = "./src/main/js/default" @@ -33,4 +35,4 @@ ohos_js_assets("storagefileio_js_assets") { ohos_resources("storagefileio_js_resources") { sources = [ "./src/main/resources" ] hap_profile = "./src/main/config.json" -} \ No newline at end of file +} diff --git a/storage/storagefileiojstest/src/main/js/default/app.js b/storage/storagefileiojstest/src/main/js/default/app.js index 5fefaead8..60ee141c8 100644 --- a/storage/storagefileiojstest/src/main/js/default/app.js +++ b/storage/storagefileiojstest/src/main/js/default/app.js @@ -1,3 +1,18 @@ +/* + * 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.distributeddatamgr.distributedfile onCreate'); diff --git a/storage/storagefileiojstest/src/main/js/default/test/File.test.js b/storage/storagefileiojstest/src/main/js/default/test/File.test.js index 789800a33..fbb550e73 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/File.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/File.test.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import fileio from '@system.fileio'; import bundle_mgr from '@ohos.bundle_mgr' import file from '@system.file'; @@ -606,7 +607,7 @@ describe('fileTest', function () { done(); }, fail: function (data, code) { - console.log('File_writeText_010 fail'); + console.log('File_writeText_010 fail code: ' + code + ', data: ' + data); expect(null).assertFail(); }, }); @@ -633,7 +634,7 @@ describe('fileTest', function () { uri: 'internal://app/../files/File_writeText_011', text: 'sawyerwang', success: function () { - console.log('File_writeText_011 mkdif success'); + console.log('File_writeText_011 mkdir success '); done(); }, fail: function (data, code) { @@ -933,7 +934,7 @@ describe('fileTest', function () { }); file.readArrayBuffer({ uri: 'internal://cache/File_writeArrayBuffer_006', - success: function (data) { + success: function () { console.log('File_writeArrayBuffer_006 pass'); done(); }, diff --git a/storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js b/storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js index b4f52731e..413469d89 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js @@ -14,6 +14,7 @@ */ import fileio from '@ohos.fileio'; +import file from '@system.file'; import bundle_mgr from '@ohos.bundle_mgr' import { describe, @@ -1356,7 +1357,7 @@ describe('fileIOTest', function () { expect(null).assertFail(); } catch (e) { - console.log('fileio_test_unlink_sync_003 has failed for ' + e); + console.log('fileio_test_unlink_sync_002 has failed for ' + e); } }); @@ -1609,6 +1610,7 @@ describe('fileIOTest', function () { success: function (data) { console.log('call readText success: ' + data.text); expect(text == data.text).assertTrue(); + expect(fileio.unlinkSync(fpath) !== null).assertTrue(); done(); }, fail: function (data, code) { @@ -1616,8 +1618,7 @@ describe('fileIOTest', function () { expect(null).assertFail(); }, }); - expect(fileio.unlinkSync(fpath) !== null).assertTrue(); - } + } catch (e) { console.log('fileio_test_read_sync_000 has failed for ' + e); expect(null).assertFail(); diff --git a/storage/storagefileioperformancejstest/BUILD.gn b/storage/storagefileioperformancejstest/BUILD.gn index adfc3de27..d89efc741 100644 --- a/storage/storagefileioperformancejstest/BUILD.gn +++ b/storage/storagefileioperformancejstest/BUILD.gn @@ -18,14 +18,16 @@ ohos_js_hap_suite("storagefileioperformance_js_test") { ":storagefileioperformance_js_assets", ":storagefileioperformance_js_resources", ] -# shared_libraries = [ -# "//third_party/giflib:libgif", -# "//third_party/libpng:libpng", -# ] + + # shared_libraries = [ + # "//third_party/giflib:libgif", + # "//third_party/libpng:libpng", + # ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "storagefileioperformancejstest" -# part_name = "prebuilt_hap" -# subsystem_name = "xts" + + # part_name = "prebuilt_hap" + # subsystem_name = "xts" } ohos_js_assets("storagefileioperformance_js_assets") { source_dir = "./src/main/js/default" @@ -33,4 +35,4 @@ ohos_js_assets("storagefileioperformance_js_assets") { ohos_resources("storagefileioperformance_js_resources") { sources = [ "./src/main/resources" ] hap_profile = "./src/main/config.json" -} \ No newline at end of file +} diff --git a/storage/storagefileioperformancejstest/src/main/js/default/app.js b/storage/storagefileioperformancejstest/src/main/js/default/app.js index 5fefaead8..60ee141c8 100644 --- a/storage/storagefileioperformancejstest/src/main/js/default/app.js +++ b/storage/storagefileioperformancejstest/src/main/js/default/app.js @@ -1,3 +1,18 @@ +/* + * 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.distributeddatamgr.distributedfile onCreate'); diff --git a/storage/storagefileioperformancejstest/src/main/js/default/test/FileIOPerformance.js b/storage/storagefileioperformancejstest/src/main/js/default/test/FileIOPerformance.js index ba0281b42..46903945c 100644 --- a/storage/storagefileioperformancejstest/src/main/js/default/test/FileIOPerformance.js +++ b/storage/storagefileioperformancejstest/src/main/js/default/test/FileIOPerformance.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import fileio from '@system.fileio' import { describe, diff --git a/storage/storagefileioperformancejstest/src/main/js/default/test/FilePerformance.js b/storage/storagefileioperformancejstest/src/main/js/default/test/FilePerformance.js index c7eef3f2a..b71a9411a 100644 --- a/storage/storagefileioperformancejstest/src/main/js/default/test/FilePerformance.js +++ b/storage/storagefileioperformancejstest/src/main/js/default/test/FilePerformance.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import file from '@system.file'; import fileio from '@ohos.fileio'; import { diff --git a/storage/storagefileioreliabilityjstest/BUILD.gn b/storage/storagefileioreliabilityjstest/BUILD.gn index 6d4ba99da..d328a15f1 100644 --- a/storage/storagefileioreliabilityjstest/BUILD.gn +++ b/storage/storagefileioreliabilityjstest/BUILD.gn @@ -18,14 +18,16 @@ ohos_js_hap_suite("storagefileioreliability_js_test") { ":storagefileioreliability_js_assets", ":storagefileioreliability_js_resources", ] -# shared_libraries = [ -# "//third_party/giflib:libgif", -# "//third_party/libpng:libpng", -# ] + + # shared_libraries = [ + # "//third_party/giflib:libgif", + # "//third_party/libpng:libpng", + # ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "storagefileioreliabilityjstest" -# part_name = "prebuilt_hap" -# subsystem_name = "xts" + + # part_name = "prebuilt_hap" + # subsystem_name = "xts" } ohos_js_assets("storagefileioreliability_js_assets") { source_dir = "./src/main/js/default" @@ -33,4 +35,4 @@ ohos_js_assets("storagefileioreliability_js_assets") { ohos_resources("storagefileioreliability_js_resources") { sources = [ "./src/main/resources" ] hap_profile = "./src/main/config.json" -} \ No newline at end of file +} diff --git a/storage/storagefileioreliabilityjstest/src/main/js/default/app.js b/storage/storagefileioreliabilityjstest/src/main/js/default/app.js index 5fefaead8..60ee141c8 100644 --- a/storage/storagefileioreliabilityjstest/src/main/js/default/app.js +++ b/storage/storagefileioreliabilityjstest/src/main/js/default/app.js @@ -1,3 +1,18 @@ +/* + * 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.distributeddatamgr.distributedfile onCreate'); diff --git a/storage/storagefileioreliabilityjstest/src/main/js/default/test/FileIOReliability.js b/storage/storagefileioreliabilityjstest/src/main/js/default/test/FileIOReliability.js index 102751321..73fd508a5 100644 --- a/storage/storagefileioreliabilityjstest/src/main/js/default/test/FileIOReliability.js +++ b/storage/storagefileioreliabilityjstest/src/main/js/default/test/FileIOReliability.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import fileio from '@system.fileio' import { describe, diff --git a/storage/storagefileiostabilityjstest/BUILD.gn b/storage/storagefileiostabilityjstest/BUILD.gn index bc553e2f6..4a98bb031 100644 --- a/storage/storagefileiostabilityjstest/BUILD.gn +++ b/storage/storagefileiostabilityjstest/BUILD.gn @@ -18,14 +18,16 @@ ohos_js_hap_suite("storagefileiostability_js_test") { ":storagefileiostability_js_assets", ":storagefileiostability_js_resources", ] -# shared_libraries = [ -# "//third_party/giflib:libgif", -# "//third_party/libpng:libpng", -# ] + + # shared_libraries = [ + # "//third_party/giflib:libgif", + # "//third_party/libpng:libpng", + # ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "storagefileiostabilityjstest" -# part_name = "prebuilt_hap" -# subsystem_name = "xts" + + # part_name = "prebuilt_hap" + # subsystem_name = "xts" } ohos_js_assets("storagefileiostability_js_assets") { source_dir = "./src/main/js/default" @@ -33,4 +35,4 @@ ohos_js_assets("storagefileiostability_js_assets") { ohos_resources("storagefileiostability_js_resources") { sources = [ "./src/main/resources" ] hap_profile = "./src/main/config.json" -} \ No newline at end of file +} diff --git a/storage/storagefileiostabilityjstest/src/main/js/default/app.js b/storage/storagefileiostabilityjstest/src/main/js/default/app.js index 5fefaead8..60ee141c8 100644 --- a/storage/storagefileiostabilityjstest/src/main/js/default/app.js +++ b/storage/storagefileiostabilityjstest/src/main/js/default/app.js @@ -1,3 +1,18 @@ +/* + * 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.distributeddatamgr.distributedfile onCreate'); diff --git a/storage/storagefileiostabilityjstest/src/main/js/default/test/FileIOStability.js b/storage/storagefileiostabilityjstest/src/main/js/default/test/FileIOStability.js index 882dcdc18..003c0351c 100644 --- a/storage/storagefileiostabilityjstest/src/main/js/default/test/FileIOStability.js +++ b/storage/storagefileiostabilityjstest/src/main/js/default/test/FileIOStability.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import fileio from '@system.fileio' import { describe, @@ -55,8 +56,8 @@ describe('fileIOStability', function () { }); /** - * @tc.number SUB_STORAGE_fileIOStability_dir - * @tc.name fileIOStability_dir + * @tc.number SUB_STORAGE_fileIOStability_dirent + * @tc.name fileIOStability_dirent * @tc.desc Function of API, 7*24 */ it('fileIOStability_dirent', 0, function () { diff --git a/storage/storagefilestabilityjstest/BUILD.gn b/storage/storagefilestabilityjstest/BUILD.gn index 15d538767..c04dc8c1b 100644 --- a/storage/storagefilestabilityjstest/BUILD.gn +++ b/storage/storagefilestabilityjstest/BUILD.gn @@ -18,14 +18,16 @@ ohos_js_hap_suite("storagefilestability_js_test") { ":storagefilestability_js_assets", ":storagefilestability_js_resources", ] -# shared_libraries = [ -# "//third_party/giflib:libgif", -# "//third_party/libpng:libpng", -# ] + + # shared_libraries = [ + # "//third_party/giflib:libgif", + # "//third_party/libpng:libpng", + # ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "storagefilestabilityjstest" -# part_name = "prebuilt_hap" -# subsystem_name = "xts" + + # part_name = "prebuilt_hap" + # subsystem_name = "xts" } ohos_js_assets("storagefilestability_js_assets") { source_dir = "./src/main/js/default" @@ -33,4 +35,4 @@ ohos_js_assets("storagefilestability_js_assets") { ohos_resources("storagefilestability_js_resources") { sources = [ "./src/main/resources" ] hap_profile = "./src/main/config.json" -} \ No newline at end of file +} diff --git a/storage/storagefilestabilityjstest/src/main/js/default/app.js b/storage/storagefilestabilityjstest/src/main/js/default/app.js index 5fefaead8..60ee141c8 100644 --- a/storage/storagefilestabilityjstest/src/main/js/default/app.js +++ b/storage/storagefilestabilityjstest/src/main/js/default/app.js @@ -1,3 +1,18 @@ +/* + * 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.distributeddatamgr.distributedfile onCreate'); diff --git a/storage/storagefilestabilityjstest/src/main/js/default/test/FileReliability.js b/storage/storagefilestabilityjstest/src/main/js/default/test/FileReliability.js index febc53ebd..db2cfa80a 100644 --- a/storage/storagefilestabilityjstest/src/main/js/default/test/FileReliability.js +++ b/storage/storagefilestabilityjstest/src/main/js/default/test/FileReliability.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import fileio from '@system.fileio' import file from '@system.file'; import { diff --git a/storage/storagefilestabilityjstest/src/main/js/default/test/FileStability.js b/storage/storagefilestabilityjstest/src/main/js/default/test/FileStability.js index d19730c86..548f02ae0 100644 --- a/storage/storagefilestabilityjstest/src/main/js/default/test/FileStability.js +++ b/storage/storagefilestabilityjstest/src/main/js/default/test/FileStability.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import fileio from '@system.fileio' import file from '@system.file'; import { @@ -51,6 +52,7 @@ describe('FileReliability', function () { }); setTimeout(function () { resolve('mkdir success!'); + done() }, 250); }); promiseMkdir.then(function () { @@ -75,6 +77,7 @@ describe('FileReliability', function () { }); promiseWriteText.then(function () { console.log('writeText success'); + done(); }); let promiseReadText = new Promise(function (resolve, reject) { file.readText({ @@ -94,6 +97,7 @@ describe('FileReliability', function () { }); promiseReadText.then(function () { console.log('readText success'); + done(); }); let promiseAccess = new Promise(function (resolve, reject) { file.access({ @@ -113,6 +117,7 @@ describe('FileReliability', function () { }); promiseAccess.then(function () { console.log('access success'); + done(); }); let promiseGet = new Promise(function (resolve, reject) { file.get({ @@ -132,6 +137,7 @@ describe('FileReliability', function () { }); promiseGet.then(function () { console.log('get success'); + done(); }); let promiseList = new Promise(function (resolve, reject) { file.list({ @@ -151,6 +157,7 @@ describe('FileReliability', function () { }); promiseList.then(function () { console.log('list success'); + done(); }); let promiseCopy = new Promise(function (resolve, reject) { file.copy({ @@ -171,6 +178,7 @@ describe('FileReliability', function () { }); promiseCopy.then(function () { console.log('copy success'); + done(); }); let promiseMove = new Promise(function (resolve, reject) { file.move({ @@ -191,6 +199,7 @@ describe('FileReliability', function () { }); promiseMove.then(function () { console.log('move success'); + done(); }); file.delete({ uri: 'internal://app/fileStability01' + i, @@ -234,6 +243,7 @@ describe('FileReliability', function () { }); promiseWriteArrayBuffer.then(function () { console.log('writeArrayBuffer success'); + done(); }); let promiseReadArrayBuffer = new Promise(function (resolve, reject) { file.readArrayBuffer({ @@ -252,6 +262,7 @@ describe('FileReliability', function () { }, 250); }); promiseReadArrayBuffer.then(function () { + done(); console.log('readArrayBuffer success'); }); file.delete({ @@ -284,6 +295,7 @@ describe('FileReliability', function () { }); promiseRmdir.then(function () { console.log('rmdir success'); + done(); }); } diff --git a/storage/storagefmspublicjstest/BUILD.gn b/storage/storagefmspublicjstest/BUILD.gn new file mode 100644 index 000000000..805b53e22 --- /dev/null +++ b/storage/storagefmspublicjstest/BUILD.gn @@ -0,0 +1,38 @@ +# 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("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("storagefmspublic_js_test") { + hap_profile = "./src/main/config.json" + deps = [ + ":storagefmspublic_js_assets", + ":storagefmspublic_js_resources", + ] + + # shared_libraries = [ + # "//third_party/giflib:libgif", + # "//third_party/libpng:libpng", + # ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "storagefmspublicjstest" + + # part_name = "prebuilt_hap" + # subsystem_name = "xts" +} +ohos_js_assets("storagefmspublic_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("storagefmspublic_js_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/storage/storagefmspublicjstest/Test.json b/storage/storagefmspublicjstest/Test.json new file mode 100644 index 000000000..4d5073412 --- /dev/null +++ b/storage/storagefmspublicjstest/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for storage file and fileio Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "60000", + "package": "ohos.acts.stroage.fileio", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "storagefmspublicjstest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/storage/storagefmspublicjstest/signature/openharmony_sx.p7b b/storage/storagefmspublicjstest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 GIT binary patch literal 3437 zcmcgvX>b$g8MY4FF(5FQyMT=#m||qU)nQ9cId-MBB-<-lvSdq&snM}IENNF>t+bK| zgowuF2vC|SxSZxNN5eHhV%(WPpbeB9Fc3;JDMtzMBv1-XAc2N~c2_tCXW&OCGw6qQ z-s9VS-tT?h=bI0tMS+~WDXqHJyCPmLzdbE-fV8Nd&*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ma4`uCIz9%p3O77839E{xf z4c_I?**|1`K2tg4!Hvyrou4BsJQuv*UfF)<%CelYIS>D^o?X)3+MK%la6kooW8&G@BU)Y0hT`+mOm$Z_%rB=a%o>I z!2c6lHyKQN)VjiFwa!eE^p8jc$sy$vB+8i25lI~6KPFFh$!o$avA~rj#L6xvR|Z83 z*WD6T9e+5Pyy=F+)pNTf{ny3cy>7Rkd3o*TS?TZJ`NS^NF2%HMkyS{?uJ$`!P4_L^ z1`NFDUbNyg_qREifgktnp1_v{Jbb`7m}2PTyUdOmtJj~m z9bB=ecw4_^rw1IW=of+>nrW5=d3k`3qHCxsIN_F{T1A545};;+fsyC&qChi+YV zr~M63H8ZLCPYmsjY>ls9cL%I)F|JIW-#+48$+lD4k*(P*kDM%zx_fvu4u5ZYUnI}5 zdrycFq>xFU)&X3p@pP2u%$o}}YcRn(MhJ&B2o?KS@cIVz>Ye%o^xV?CB{_Qhu z;}_q1bvO^g{8<3!gYbo4Di{8qzV+(9 zdlmksohQmRTs@qB;(Wo?dER_ux6XQb@q$tQPW?CMu6GVQd;R=iR;-S{Kr%Zks7>b1 zNs{|-+jhObYE}NR&`TGGr^h^4bjh%c>R#@=8nM&Md>_a+zVulsl;){flFekV1t9ob z+SqfV_Pv3$2f)bQ8%Ul2>fdYR^1zs0BQF~olsOj5AodC&Q_7SMFzsz2 z9newxE&jodk~tNHwl%LBMMDbrk=(^b literal 0 HcmV?d00001 diff --git a/storage/storagefmspublicjstest/src/main/config.json b/storage/storagefmspublicjstest/src/main/config.json new file mode 100644 index 000000000..9b7cfe5d0 --- /dev/null +++ b/storage/storagefmspublicjstest/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "ohos.acts.stroage.fileio", + "vendor": "example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.stroage.fileio", + "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.stroage.fileio.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/storagefmspublicjstest/src/main/js/default/app.js b/storage/storagefmspublicjstest/src/main/js/default/app.js new file mode 100644 index 000000000..60ee141c8 --- /dev/null +++ b/storage/storagefmspublicjstest/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.distributeddatamgr.distributedfile onCreate'); + }, + onDestroy() { + console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); + } +}; diff --git a/storage/storagefmspublicjstest/src/main/js/default/i18n/en-US.json b/storage/storagefmspublicjstest/src/main/js/default/i18n/en-US.json new file mode 100644 index 000000000..ead52ed2e --- /dev/null +++ b/storage/storagefmspublicjstest/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/storagefmspublicjstest/src/main/js/default/i18n/zh-CN.json b/storage/storagefmspublicjstest/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 000000000..3f48f2585 --- /dev/null +++ b/storage/storagefmspublicjstest/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/storagefmspublicjstest/src/main/js/default/pages/index/index.css b/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.css new file mode 100644 index 000000000..6fda79275 --- /dev/null +++ b/storage/storagefmspublicjstest/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/storagefmspublicjstest/src/main/js/default/pages/index/index.hml b/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.hml new file mode 100644 index 000000000..f64b040a5 --- /dev/null +++ b/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.js b/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.js new file mode 100644 index 000000000..f7894a722 --- /dev/null +++ b/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.js @@ -0,0 +1,40 @@ +/* + * 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/storagefmspublicjstest/src/main/js/default/test/Common.js b/storage/storagefmspublicjstest/src/main/js/default/test/Common.js new file mode 100644 index 000000000..c7b15f7ce --- /dev/null +++ b/storage/storagefmspublicjstest/src/main/js/default/test/Common.js @@ -0,0 +1,192 @@ +/* + * 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 fileio from '@system.fileio' +export const FILE_CONTENT = 'hello world' +export function prepareFile(fpath, content) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o666) + fileio.ftruncateSync(fd) + fileio.writeSync(fd, content) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function prepareFile1(fpath, content) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o777) + fileio.ftruncateSync(fd) + fileio.writeSync(fd, content) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function prepareEmptyFile(fpath) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o777) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function fileToReadOnly(fpath) { + try { + let fd = fileio.openSync(fpath, 0o1) + fileio.fchmodSync(fd, 0o444) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToReadOnly for ' + e); + return false + } +} +export function fileToWriteOnly(fpath) { + try { + let fd = fileio.openSync(fpath, 0o2) + fileio.fchmodSync(fd, 0o222) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToWriteOnly ' + e) + return false + } +} +export function fileToReadAndWrite(fpath) { + try { + let fd = fileio.openSync(fpath, 0o1) + fileio.fchmodSync(fd, 0o777) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToReadAndWrite ' + e); + return false + } +} +export function filePickerName(testName,deviceID) { + const BASE_PATH = '/data/ss/'+deviceID+'/fms_test/' + return BASE_PATH + testName +} +export function filePickerName1(testName,deviceID) { + const BASE_PATH = '/data/ss/'+ deviceID +'/fms_test/' + return BASE_PATH + testName +} +export function filePickerName2(testName,deviceID) { + const BASE_PATH = '/data/ss/'+ deviceID + return BASE_PATH + testName +} +export function appName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' + return BASE_PATH + testName +} +export function nextFileName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' + return BASE_PATH + testName +} +export function fileName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' + return BASE_PATH + testName +} +export function cacheFileName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' + return BASE_PATH + testName +} +export function differentFileName(testName) { + const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' + return BASE_PATH + testName +} +export function differentCacheName(testName) { + const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' + return BASE_PATH + testName +} +export function fmsFileName(testName) { + const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/files/" + return BASE_PATH + testName +} +export function fmsCacheName(testName) { + const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/cache/" + return BASE_PATH + testName +} +export function fmsPublic(testName) { + const BASE_PATH = '/data/ss/files/' + return BASE_PATH + testName +} + +export function getFileTextLen(fpath) { + let ss + try { + ss = fileio.Stream.createStreamSync(fpath, 'r+') + expect(ss !== null).assertTrue() + let len = ss.readSync(new ArrayBuffer(4096)) + console.log('file:' + fpath) + console.log('file lenth:' + len) + expect(ss.closeSync() !== null).assertTrue() + return len + } + catch (e) { + console.log('Failed to getFileTextLen ' + e) + expect(ss.closeSync() == null).assertTrue() + return null + } +} +export function isFileExist(fpath) { + try { + expect(fileio.accessSync(fpath) !== null).assertTrue() + console.log('file:' + fpath) + console.log('status:exist') + return true + } + catch (e) { + console.log('file:' + fpath) + console.log('status:non-existen') + return false + } +} +export function sleep(n) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > n) { + break; + } + } +} +export function randomString(num) { + let len= num; + var $chars = 'aaaabbbbcccc'; + var maxPos = $chars.length; + var pwd = ''; + for (var i = 0; i < len; i++) { + pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); + } + return pwd; +} diff --git a/storage/storagefmspublicjstest/src/main/js/default/test/FmsPublic.test.js b/storage/storagefmspublicjstest/src/main/js/default/test/FmsPublic.test.js new file mode 100644 index 000000000..4802049d2 --- /dev/null +++ b/storage/storagefmspublicjstest/src/main/js/default/test/FmsPublic.test.js @@ -0,0 +1,400 @@ +/* + * 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 fileio from '@ohos.fileio'; +import filepicker from '@ohos.filepicker' +import { + describe, + beforeAll, + beforeEach, + afterEach, + afterAll, + it, + expect +} +from 'deccjsunit/index' +import { + FILE_CONTENT, + prepareFile, + fileName, + filePickerName, + randomString, + cacheFileName, + prepareEmptyFile, + nextFileName +} +from './Common' +describe('FmsTest', function () { + let deviceID = 0; + + /** + * @tc.number SUB_STORAGE_FMS_Function_0000 + * @tc.name FMS_Function_0000 + * @tc.desc Function of API,Get current device information + */ + it('FMS_Function_0000', 0, function (done) { + let progetDeviceInfo = new Promise(function (resolve, reject) { + filepicker.getDeviceInfo({ + success: function (data) { + console.log('FMS_Function_0000 success.' + JSON.stringify(data)); + if (data.deviceList.length == 0) { + console.log('FMS_Function_0000 fail'); + expect(null).assertFail(); + } else { + deviceID = data.deviceList[0].deviceID; + console.log("---FMS_Function_0000------" + deviceID); + done(); + } + }, + fail: function (data, code) { + console.log('FMS_Function_0000 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + progetDeviceInfo.then(function () { + console.log('FMS_Function_0000 success'); + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_0100 + * @tc.name FMS_Function_0100 + * @tc.desc Function of API, Creates the specified directory recursively + */ + it('FMS_Function_0100', 0, function (done) { + let proMkdir = new Promise(function (resolve, reject) { + filepicker.mkdir({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf', + success: function () { + console.log('FMS_Function_0100 mkdir success.'); + done() + }, + fail: function (data, code) { + console.log('FMS_Function_0100 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + proMkdir.catch(function () { + console.log('FMS_Function_0100 success'); + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_0200 + * @tc.name FMS_Function_0200 + * @tc.desc Function of API, Creates the specified directory recursively + */ + it('FMS_Function_0200', 0, function (done) { + let proMkdir = new Promise(function (resolve, reject) { + filepicker.mkdir({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/document/你好/leaf', + success: function () { + console.log('FMS_Function_0200 mkdir success.'); + done() + }, + fail: function (data, code) { + console.log('FMS_Function_0200 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + proMkdir.then(function () { + console.log('FMS_Function_0200 success'); + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_0300 + * @tc.name FMS_Function_0300 + * @tc.desc Function of API, Creates the specified directory recursively + */ + it('FMS_Function_0300', 0, function (done) { + let proMkdir = new Promise(function (resolve, reject) { + filepicker.mkdir({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/document/a/b/c/leaf', + success: function () { + console.log('FMS_Function_0300 mkdir success.'); + done() + }, + fail: function (data, code) { + console.log('FMS_Function_0300 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + proMkdir.then(function () { + console.log('FMS_Function_0300 success'); + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_0400 + * @tc.name FMS_Function_0400 + * @tc.desc Function of API, + */ + it('FMS_Function_0400', 0, function (done) { + let proMkdir = new Promise(function (resolve, reject) { + filepicker.mkdir({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/root/files', + success: function () { + console.log('FMS_Function_0400 success.'); + done() + }, + fail: function (data, code) { + console.log('call fail callback fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + proMkdir.then(function () { + console.log('FMS_Function_0400 success'); + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_0500 + * @tc.name FMS_Function_0500 + * @tc.desc Function of API, save file.The test file is exist. + */ + it('FMS_Function_0500', 0, function (done) { + let fpath = filePickerName("a.txt", deviceID); + expect(prepareFile(fpath, FILE_CONTENT) !== null).assertTrue(); + let proMkdir = new Promise(function (resolve, reject) { + filepicker.saveFile({ + srcUri: ['dataability:///public.storage.ability/' + deviceID + '/document/fms_test/a.txt/leaf'], + dstUri: 'dataability:///public.storage.ability/' + deviceID + '/root', + success: function (data) { + console.log('FMS_Function_0500 success.' + data.saveFileList[0].status); + done() + }, + fail: function (data, code) { + console.log('FMS_Function_0500 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + proMkdir.then(function () { + console.log('FMS_Function_0500 success'); + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_0600 + * @tc.name FMS_Function_0600 + * @tc.desc Function of API, save file.The test file is exist. + */ + it('FMS_Function_0600', 0, async function (done) { + let fpath = filePickerName("b.txt", deviceID); + expect(prepareFile(fpath, FILE_CONTENT) !== null).assertTrue(); + let proMkdir = new Promise(function (resolve, reject) { + filepicker.saveFile({ + srcUri: ['dataability:///public.storage.ability/' + deviceID + '/document/fms_test/a.txt/leaf', + 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/b.txt/leaf'], + dstUri: 'dataability:///public.storage.ability/' + deviceID + '/root', + success: function (data) { + console.log('FMS_Function_0600 success.' + data.saveFileList[0].status); + done() + }, + fail: function (data, code) { + console.log('FMS_Function_0600 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + proMkdir.then(function () { + console.log('FMS_Function_0600 success'); + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_0700 + * @tc.name FMS_Function_0700 + * @tc.desc Function of API, save file.The test file is exist. + */ + it('FMS_Function_0700', 0, async function (done) { + let proMkdir = new Promise(function (resolve, reject) { + filepicker.saveFile({ + srcUri: ['dataability:///public.storage.ability/' + deviceID + '/document/fms_test/a.txt/leaf'], + dstUri: 'dataability:///public.storage.ability/' + deviceID + '/root/files', + success: function (data) { + console.log('FMS_Function_0700 success.' + data.saveFileList[0].status); + done() + }, + fail: function (data, code) { + console.log('FMS_Function_0700 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + proMkdir.then(function () { + console.log('FMS_Function_0700 success'); + }); + + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_0800 + * @tc.name FMS_Function_0800 + * @tc.desc Function of API, save file.The test file is exist. + */ + it('FMS_Function_0800', 0, async function (done) { + let proMkdir = new Promise(function (resolve, reject) { + filepicker.saveFile({ + srcUri: ['dataability:///public.storage.ability/' + deviceID + '/document/fms_test/a.txt/leaf', + 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/b.txt/leaf'], + dstUri: 'dataability:///public.storage.ability/' + deviceID + '/root/files', + success: function (data) { + console.log('FMS_Function_0800 success.' + data.saveFileList[0].status); + done() + }, + fail: function (data, code) { + console.log('FMS_Function_0800 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + proMkdir.then(function () { + console.log('FMS_Function_0800 success'); + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_0900 + * @tc.name FMS_Function_0900 + * @tc.desc Function of API, search file.The test file is exist. + */ + it('FMS_Function_0900', 0, async function (done) { + let proMkdir = new Promise(function (resolve, reject) { + filepicker.searchFile({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf', + name: 'a.txt', + success: function (data) { + console.log('FMS_Function_0900 success.' + data.fileList[0].uri); + done() + }, + fail: function (data, code) { + console.log('FMS_Function_0900 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + proMkdir.then(function () { + console.log('FMS_Function_0900 success'); + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_1000 + * @tc.name FMS_Function_1000 + * @tc.desc Function of API, search file.The test file is exist. + */ + it('FMS_Function_1000', 0, async function (done) { + let proMkdir = new Promise(function (resolve, reject) { + filepicker.searchFile({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf', + name: 'b.txt', + success: function (data) { + console.log('FMS_Function_1000 success.' + data.fileList[0].uri); + done() + }, + fail: function (data, code) { + console.log('FMS_Function_1000 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + proMkdir.then(function () { + console.log('FMS_Function_1000 success'); + }); + + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_1100 + * @tc.name FMS_Function_1100 + * @tc.desc Function of API, search file.The test file is exist. + */ + it('FMS_Function_1100', 0, async function (done) { + let proMkdir = new Promise(function (resolve, reject) { + filepicker.searchFile({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/root/files', + name: 'a.txt', + success: function (data) { + console.log('FMS_Function_1100 success.' + data.fileList[0].uri); + done() + }, + fail: function (data, code) { + console.log('FMS_Function_1100 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + proMkdir.then(function () { + console.log('FMS_Function_1100 success'); + }); + + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_1200 + * @tc.name FMS_Function_1200 + * @tc.desc Function of API, Get all file information in the specified directory + */ + it('FMS_Function_1200', 0, async function (done) { + let proMkdir = new Promise(function (resolve, reject) { + filepicker.list({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf', + success: function (data) { + console.log('FMS_Function_1200 success.' + data.fileList[0].uri); + done() + }, + fail: function (data, code) { + console.log('FMS_Function_1200 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + proMkdir.then(function () { + console.log('FMS_Function_1200 success'); + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_Function_1300 + * @tc.name FMS_Function_1300 + * @tc.desc Function of API, Get all file information in the specified directory + */ + it('FMS_Function_1300', 0, async function (done) { + let proMkdir = new Promise(function (resolve, reject) { + filepicker.list({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/root', + success: function (data) { + console.log('FMS_Function_1300 success.' + data.fileList[0].uri); + done() + }, + fail: function (data, code) { + console.log('FMS_Function_1300 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }); + }) + proMkdir.then(function () { + console.log('FMS_Function_1300 success'); + }); + }) + +}) diff --git a/storage/storagefmspublicjstest/src/main/js/default/test/FmsPublicError.test.js b/storage/storagefmspublicjstest/src/main/js/default/test/FmsPublicError.test.js new file mode 100644 index 000000000..dcdedfcb2 --- /dev/null +++ b/storage/storagefmspublicjstest/src/main/js/default/test/FmsPublicError.test.js @@ -0,0 +1,520 @@ +/* + * 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 filepicker from '@ohos.filepicker'; +import { + describe, + it, + expect +} +from 'deccjsunit/index' +import { + prepareFile, + fmsPublic, +} +from './Common' + +describe('FilepickerTest', function () { + + let deviceID = 0; + + /** + * @tc.number SUB_STORAGE_File_Test_Error_0000 + * @tc.name File_Test_Error_0000 + * @tc.desc Error of API, Move files when disk space is full. + */ + it('File_Test_Error_0000', 0, function (done) { + try { + filepicker.getDeviceInfo({ + success: function (data) { + console.log('File_Test_Error_0000_start call mkdir success.' + data.deviceList[0].deviceID); + deviceID = data.deviceList[2].deviceID; + if(deviceID == 0){ + console.log('SD card not mounted') + done() + }else{ + expect(null).assertFail() + } + }, + fail: function (data, code) { + console.error('File_Test_Error_0000_start call fail callback fail, code: ' + code + ', data: ' + data); + }, + }); + } catch (e) { + console.log('File_Test_Error_0000 has failed for ' + e); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_0100 + * @tc.name File_Test_Error_0100 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/dataability:///public.storage.ability/deviceID/udocument/files/leaf + */ + it('File_Test_Error_0100', 0, function (done) { + try { + filepicker.mkdir({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/udocument/files/leaf', + success: function () { + console.log('File_Test_Error_0100 call mkdir success.'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_0100 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue(); + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_0100 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_0200 + * @tc.name File_Test_Error_0200 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/data123ability:///public.storage.ability/deviceID/document/files.txt/leaf + */ + it('File_Test_Error_0200', 0, function (done) { + try { + filepicker.mkdir({ + uri: 'data123ability:///public.storage.ability/' + deviceID + '/document/files/leaf', + success: function () { + console.log('File_Test_Error_0200 call mkdir success.'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_0200 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 302).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_0200 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_0300 + * @tc.name File_Test_Error_0300 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/dataability:///public.storage.ability/deviceID/document/files/lea + */ + it('File_Test_Error_0300', 0, function (done) { + try { + filepicker.mkdir({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/document/files/lea', + success: function () { + console.log('File_Test_Error_0300 call mkdir success.'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_0300 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_0300 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_0400 + * @tc.name File_Test_Error_0400 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/dataability:///public.storage.ability/‘’/document/files/leaf + */ + it('File_Test_Error_0400', 0, function (done) { + try { + filepicker.mkdir({ + uri: '/data/ss/files' + }); + let fpath = fmsPublic('File_Test_Error_0400'); + prepareFile(fpath, 'hello'); + filepicker.saveFile({ + srcUri: ['dataability:///public.storage.ability/data/ss/files/File_Test_Error_0400'], + dstUri: 'dataability:///public.storage.ability/‘’/document/files/leaf', + success: function (data) { + console.log('File_Test_Error_0400 call mkdir success.' + data.saveFileList[0].status); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_0400 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_0400 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_0500 + * @tc.name File_Test_Error_0500 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/dataability:///public.storage.ability/deviceID/document/files/leaf + */ + it('File_Test_Error_0500', 0, function (done) { + try { + let fpath = fmsPublic('File_Test_Error_0500'); + prepareFile(fpath, 'hello'); + filepicker.saveFile({ + srcUri: ['dataability:///public.storage.ability/data/ss/file/File_Test_Error_0500'], + dstUri: 'dataability:///public.storage.ability/' + deviceID + '/document/files/leaf', + success: function (data) { + console.log('File_Test_Error_0500 call mkdir success.' + data.saveFileList[0].status); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_0500 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_0500 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_0600 + * @tc.name File_Test_Error_0600 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/dataability:///public.storage.ability/deviceID/document/files/leaf + */ + it('File_Test_Error_0600', 0, function (done) { + try { + filepicker.saveFile({ + srcUri: ['dataability:///public.storage.ability/data/ss/file/A.txt'], + dstUri: 'dataability:///public.storage.ability/' + deviceID + '/document/files/leaf', + success: function (data) { + console.log('File_Test_Error_0600 call mkdir success.' + data.saveFileList[0].status); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_0600 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_0600 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_0700 + * @tc.name File_Test_Error_0700 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/dataability:///public.storage.ability/deviceID/document/files/lea + */ + it('File_Test_Error_0700', 0, function (done) { + try { + filepicker.saveFile({ + srcUri: ['dataability:///public.storage.ability/data/ss/files/a.txt'], + dstUri: 'dataability:///public.storage.ability/' + deviceID + '/document/files/lea', + success: function (data) { + console.log('File_Test_Error_0700 call mkdir success.' + data.saveFileList[0].status); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_0700 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_0700 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_0800 + * @tc.name File_Test_Error_0800 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/dataability:///public.storage.ability/deviceID/document/bb/aa/files/leaf + */ + it('File_Test_Error_0800', 0, function (done) { + try { + filepicker.saveFile({ + srcUri: ['dataability:///public.storage.ability/data/ss/files/a.txt'], + dstUri: 'dataability:///public.storage.ability/' + deviceID + '/document/bb/aa/files/leaf', + success: function (data) { + console.log('File_Test_Error_0800 call mkdir success.' + data.saveFileList[0].status); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_0800 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_0800 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_0900 + * @tc.name File_Test_Error_0900 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/data123ability:///public.storage.ability/' + deviceID + '/document/files/leaf + */ + it('File_Test_Error_0900', 0, function (done) { + try { + filepicker.saveFile({ + srcUri: ['dataability:///public.storage.ability/data/ss/files/a.txt'], + dstUri: 'data123ability:///public.storage.ability/' + deviceID + '/document/files/leaf', + success: function (data) { + console.log('File_Test_Error_0900 call mkdir success.' + data.saveFileList[0].status); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_0900 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 302).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_0900 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_1000 + * @tc.name File_Test_Error_1000 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/dataability:///public.storage.ability/deviceID/document/files/leaf + */ + it('File_Test_Error_1000', 0, function (done) { + try { + filepicker.saveFile({ + srcUri: ['dataability:///public.storage.ability/data/ss/files/a.txt'], + srcUri1: ['dataability:///public.storage.ability/data/ss/files/a.txt'], + dstUri: 'dataability:///public.storage.ability/' + deviceID + '/document/files/leaf', + success: function (data) { + console.log('File_Test_Error_1000 call mkdir success.' + data.saveFileList[0].status); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_1000 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_1000 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_1100 + * @tc.name File_Test_Error_1100 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/dataability:///public.storage.ability/deviceID/document/files/leaf + */ + it('File_Test_Error_1100', 0, function (done) { + try { + filepicker.searchFile({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/document/files/leaf', + name: 'test', + success: function (data) { + console.log('File_Test_Error_1100 call mkdir success.' + data.fileList[0].uri); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_1100 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_1100 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_1200 + * @tc.name File_Test_Error_1200 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/dataability:///public.storage.ability/deviceID/document/a/b/files/leaf + */ + it('File_Test_Error_1200', 0, function (done) { + try { + filepicker.searchFile({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/document/a/b/files/leaf', + name: 'test', + success: function (data) { + console.log('File_Test_Error_1200 call mkdir success.' + data.fileList[0].uri); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_1200 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_1200 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_1300 + * @tc.name File_Test_Error_1300 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:'' + */ + it('File_Test_Error_1300', 0, function (done) { + try { + filepicker.searchFile({ + uri: '', + name: 'a', + success: function (data) { + console.log('File_Test_Error_1300 call mkdir success.' + data.fileList[0].uri); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_1300 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 302).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_1300 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_1400 + * @tc.name File_Test_Error_1400 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:'dataability:///public.storage.ability/device_id/udocument/files/leaf' + */ + it('File_Test_Error_1400', 0, function (done) { + try { + filepicker.list({ + uri: 'dataability:///public.storage.ability/device_id/udocument/files/leaf', + success: function (data) { + console.log('File_Test_Error_1400 call mkdir success.' + data.fileList[0].uri); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_1400 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_1400 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_1400 + * @tc.name File_Test_Error_1400 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:'' + */ + it('File_Test_Error_1500', 0, function (done) { + try { + filepicker.list({ + uri: '', + success: function (data) { + console.log('File_Test_Error_1500 call mkdir success.' + data.fileList[0].uri); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_1500 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 302).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_1500 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_1500 + * @tc.name File_Test_Error_1500 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/dataability:///public.storage.ability/deviceID/document/file/leaf + */ + it('File_Test_Error_1600', 0, function (done) { + try { + filepicker.list({ + uri: 'dataability:///public.storage.ability/' + deviceID + '/document/file/leaf', + success: function (data) { + console.log('File_Test_Error_1600 call mkdir success.' + data.fileList[0].uri); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_1600 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_1600 has failed for ' + e); + } + }); + + /** + * @tc.number SUB_STORAGE_File_Test_Error_1700 + * @tc.name File_Test_Error_1700 + * @tc.desc Error of API, Move files when disk space is full. + * Create the file in advance and give 777 permission, + * path:/data123ability:///public.storage.ability/deviceID/document/file/leaf + */ + it('File_Test_Error_1700', 0, function (done) { + try { + filepicker.list({ + uri: 'data123ability:///public.storage.ability/' + deviceID + '/document/file/leaf', + success: function (data) { + console.log('File_Test_Error_1700 call mkdir success.' + data.fileList[0].uri); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.error('File_Test_Error_1700 call fail callback fail, code: ' + code + ', data: ' + data); + expect(code == 302).assertTrue() + done() + }, + }); + } catch (e) { + console.log('File_Test_Error_1700 has failed for ' + e); + } + }); +}); diff --git a/storage/storagefmspublicjstest/src/main/js/default/test/List.test.js b/storage/storagefmspublicjstest/src/main/js/default/test/List.test.js new file mode 100644 index 000000000..74e71d858 --- /dev/null +++ b/storage/storagefmspublicjstest/src/main/js/default/test/List.test.js @@ -0,0 +1,17 @@ +/* + * 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. + */ + +require('./FmsPublic.test.js') +require('./FmsPublicError.test.js') diff --git a/storage/storagefmspublicjstest/src/main/resources/base/element/string.json b/storage/storagefmspublicjstest/src/main/resources/base/element/string.json new file mode 100644 index 000000000..4b5a8bbc0 --- /dev/null +++ b/storage/storagefmspublicjstest/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "storagefilestabilityjstest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/storage/storagefmspublicjstest/src/main/resources/base/media/icon.png b/storage/storagefmspublicjstest/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78Z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Jbb`7m}2PTyUdOmtJj~m z9bB=ecw4_^rw1IW=of+>nrW5=d3k`3qHCxsIN_F{T1A545};;+fsyC&qChi+YV zr~M63H8ZLCPYmsjY>ls9cL%I)F|JIW-#+48$+lD4k*(P*kDM%zx_fvu4u5ZYUnI}5 zdrycFq>xFU)&X3p@pP2u%$o}}YcRn(MhJ&B2o?KS@cIVz>Ye%o^xV?CB{_Qhu z;}_q1bvO^g{8<3!gYbo4Di{8qzV+(9 zdlmksohQmRTs@qB;(Wo?dER_ux6XQb@q$tQPW?CMu6GVQd;R=iR;-S{Kr%Zks7>b1 zNs{|-+jhObYE}NR&`TGGr^h^4bjh%c>R#@=8nM&Md>_a+zVulsl;){flFekV1t9ob z+SqfV_Pv3$2f)bQ8%Ul2>fdYR^1zs0BQF~olsOj5AodC&Q_7SMFzsz2 z9newxE&jodk~tNHwl%LBMMDbrk=(^b literal 0 HcmV?d00001 diff --git a/storage/storagefmssharejstest/src/main/config.json b/storage/storagefmssharejstest/src/main/config.json new file mode 100644 index 000000000..3b243aeb3 --- /dev/null +++ b/storage/storagefmssharejstest/src/main/config.json @@ -0,0 +1,72 @@ +{ + "app": { + "bundleName": "ohos.acts.test", + "vendor": "example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Release" + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "installationFree": true, + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "ohos.acts.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "visible": true, + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": "default2", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/storage/storagefmssharejstest/src/main/js/default/app.js b/storage/storagefmssharejstest/src/main/js/default/app.js new file mode 100644 index 000000000..60ee141c8 --- /dev/null +++ b/storage/storagefmssharejstest/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.distributeddatamgr.distributedfile onCreate'); + }, + onDestroy() { + console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); + } +}; diff --git a/storage/storagefmssharejstest/src/main/js/default/i18n/en-US.json b/storage/storagefmssharejstest/src/main/js/default/i18n/en-US.json new file mode 100644 index 000000000..ead52ed2e --- /dev/null +++ b/storage/storagefmssharejstest/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/storagefmssharejstest/src/main/js/default/i18n/zh-CN.json b/storage/storagefmssharejstest/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 000000000..3f48f2585 --- /dev/null +++ b/storage/storagefmssharejstest/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/storagefmssharejstest/src/main/js/default/pages/index/index.css b/storage/storagefmssharejstest/src/main/js/default/pages/index/index.css new file mode 100644 index 000000000..6fda79275 --- /dev/null +++ b/storage/storagefmssharejstest/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/storagefmssharejstest/src/main/js/default/pages/index/index.hml b/storage/storagefmssharejstest/src/main/js/default/pages/index/index.hml new file mode 100644 index 000000000..f64b040a5 --- /dev/null +++ b/storage/storagefmssharejstest/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/storage/storagefmssharejstest/src/main/js/default/pages/index/index.js b/storage/storagefmssharejstest/src/main/js/default/pages/index/index.js new file mode 100644 index 000000000..f7894a722 --- /dev/null +++ b/storage/storagefmssharejstest/src/main/js/default/pages/index/index.js @@ -0,0 +1,40 @@ +/* + * 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/storagefmssharejstest/src/main/js/default/test/Common.js b/storage/storagefmssharejstest/src/main/js/default/test/Common.js new file mode 100644 index 000000000..e94e7f404 --- /dev/null +++ b/storage/storagefmssharejstest/src/main/js/default/test/Common.js @@ -0,0 +1,180 @@ +/* + * 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 fileio from '@system.fileio' +export const FILE_CONTENT = 'hello world' +export function prepareFile(fpath, content) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o666) + fileio.ftruncateSync(fd) + fileio.writeSync(fd, content) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function prepareFile1(fpath, content) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o777) + fileio.ftruncateSync(fd) + fileio.writeSync(fd, content) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function prepareEmptyFile(fpath) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o777) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function fileToReadOnly(fpath) { + try { + let fd = fileio.openSync(fpath, 0o1) + fileio.fchmodSync(fd, 0o444) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToReadOnly for ' + e); + return false + } +} +export function fileToWriteOnly(fpath) { + try { + let fd = fileio.openSync(fpath, 0o2) + fileio.fchmodSync(fd, 0o222) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToWriteOnly ' + e) + return false + } +} +export function fileToReadAndWrite(fpath) { + try { + let fd = fileio.openSync(fpath, 0o1) + fileio.fchmodSync(fd, 0o777) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToReadAndWrite ' + e); + return false + } +} +export function filePickerName(testName,deviceID) { + const BASE_PATH = '/data/ss/'+deviceID+'/fms_test/' + return BASE_PATH + testName +} +export function appName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' + return BASE_PATH + testName +} +export function nextFileName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' + return BASE_PATH + testName +} +export function fileName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' + return BASE_PATH + testName +} +export function cacheFileName(testName) { + const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' + return BASE_PATH + testName +} +export function differentFileName(testName) { + const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' + return BASE_PATH + testName +} +export function differentCacheName(testName) { + const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' + return BASE_PATH + testName +} +export function fmsFileName(testName) { + const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/files/" + return BASE_PATH + testName +} +export function fmsCacheName(testName) { + const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/cache/" + return BASE_PATH + testName +} + +export function getFileTextLen(fpath) { + let ss + try { + ss = fileio.Stream.createStreamSync(fpath, 'r+') + expect(ss !== null).assertTrue() + let len = ss.readSync(new ArrayBuffer(4096)) + console.log('file:' + fpath) + console.log('file lenth:' + len) + expect(ss.closeSync() !== null).assertTrue() + return len + } + catch (e) { + console.log('Failed to getFileTextLen ' + e) + expect(ss.closeSync() == null).assertTrue() + return null + } +} +export function isFileExist(fpath) { + try { + expect(fileio.accessSync(fpath) !== null).assertTrue() + console.log('file:' + fpath) + console.log('status:exist') + return true + } + catch (e) { + console.log('file:' + fpath) + console.log('status:non-existen') + return false + } +} +export function sleep(n) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > n) { + break; + } + } +} +export function randomString(num) { + let len= num; + var $chars = 'aaaabbbbcccc'; + var maxPos = $chars.length; + var pwd = ''; + for (var i = 0; i < len; i++) { + pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); + } + return pwd; +} diff --git a/storage/storagefmssharejstest/src/main/js/default/test/FmsShare.test.js b/storage/storagefmssharejstest/src/main/js/default/test/FmsShare.test.js new file mode 100644 index 000000000..93847ddc8 --- /dev/null +++ b/storage/storagefmssharejstest/src/main/js/default/test/FmsShare.test.js @@ -0,0 +1,463 @@ +/* + * 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 fileio from '@system.fileio'; +import fileShareAbility from '@ohos.fileshare'; +import { + describe, + beforeAll, + it, + expect +} +from 'deccjsunit/index' +import { + prepareFile, + fmsFileName, + fmsCacheName +} +from './Common' + +describe('fileTest', function () { + beforeAll(() => { + prepareFile(fmsFileName('music.mp3'), 'content'); + prepareFile(fmsFileName('f0.txt'), 'content'); + prepareFile(fmsFileName('picture.jpg'), 'content'); + prepareFile(fmsFileName('picture2.jpg'), 'content'); + prepareFile(fmsFileName('文件.doc'), 'content'); + prepareFile(fmsFileName('cross Fire.apk'), 'content'); + prepareFile(fmsCacheName('video.mp4'), 'content'); + prepareFile(fmsFileName('file.xlsx'), 'content'); + prepareFile(fmsFileName('f2.ppt'), 'content'); + prepareFile(fmsFileName('f3.doc'), 'content'); + fileio.mkdirSync(fmsFileName('folder')); + let text = '[{"type": "files-path", "name": "primary_leaf", "path": "/music.mp3"},' + + '{"type": "files-path", "name": "primary_leaf2", "path": "/f0.txt"},' + + '{"type": "files-path", "name": "primary_leaf3", "path": "/picture.jpg"},' + + '{"type": "files-path", "name": "primary_leaf4", "path": "/picture2.jpg"},' + + '{"type": "files-path", "name": "primary_leaf5", "path": "/文件.doc"},' + + '{"type": "files-path", "name": "primary_leaf6", "path": "/cross Fire.apk"},' + + '{"type": "cache-path", "name": "cacheprimary_leaf", "path": "/video.mp4"},' + + '{"type": "files-path", "name": "primary_leaf7", "path": "/file.xlsx"},' + + '{"type": "files-path", "name": "primary_leaf8", "path": "/f3.doc"},' + + '{"type": "files-path", "name": "primary_leaf9", "path": "/folder"' + + '}]'; + prepareFile(fmsFileName('test.json'), text); + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_100 + * @tc.name FMS_fuzzyFileToUri_100 + * @tc.desc Verify device ID,Call fuzzyfiletouri to + * judge whether the return value is correct. + */ + it('FMS_fuzzyFileToUri_100', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/f0.txt', + displayName: 'f1.txt', + success: function (uri) { + console.log('FMS_fuzzyFileToUri_100 call fuzzyFileToUri success. uri:' + uri); + expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/files' + +'/primary_leaf2/f0.txt/leaf?displayName=f1.txt#').assertTrue(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_100 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + complete: function () { + console.log('FMS_fuzzyFileToUri_100 call fuzzyFileToUri in complete'); + } + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_200 + * @tc.name FMS_fuzzyFileToUri_200 + * @tc.desc Verify app path,Call fuzzyfiletouri to + * judge whether the return value is correct. + */ + it('FMS_fuzzyFileToUri_200', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/picture.jpg', + displayName: 'picture.png', + success: function (uri) { + console.log('FMS_fuzzyFileToUri_200 call fuzzyFileToUri success. uri:' + uri); + expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/files' + +'/primary_leaf3/picture.jpg/leaf?displayName=picture.png#').assertTrue(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_200 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_300 + * @tc.name FMS_fuzzyFileToUri_300 + * @tc.desc Verify that the app path virtual path is an in package file,Call fuzzyfiletouri + * to judge whether the return value is correct. + */ + it('FMS_fuzzyFileToUri_300', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/../files/picture2.jpg', + displayName: 'picture2.png', + success: function (uri) { + console.log('FMS_fuzzyFileToUri_300 call fuzzyFileToUri success. uri:' + uri); + expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/files' + +'/primary_leaf4/picture2.jpg/leaf?displayName=picture2.png#').assertTrue(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_300 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_400 + * @tc.name FMS_fuzzyFileToUri_400 + * @tc.desc Verify the Chinese file name under the app path,Call fuzzyfiletouri + * to judge whether the return value is correct. + */ + it('FMS_fuzzyFileToUri_400', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/文件.doc', + displayName: 'file', + success: function (uri) { + console.log('FMS_fuzzyFileToUri_400 call fuzzyFileToUri success. uri:' + uri); + expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/files' + +'/primary_leaf5/文件.doc/leaf?displayName=file#').assertTrue(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_400 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_500 + * @tc.name FMS_fuzzyFileToUri_500 + * @tc.desc Verify the blurred Chinese file name,Call fuzzyfiletouri + * to judge whether the return value is correct. + */ + it('FMS_fuzzyFileToUri_500', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/cross Fire.apk', + displayName: '你好,世界', + success: function (uri) { + console.log('FMS_fuzzyFileToUri_500 call fuzzyFileToUri success. uri:' + uri); + expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/files' + +'/primary_leaf6/cross Fire.apk/leaf?displayName=你好,世界#').assertTrue(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_500 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_600 + * @tc.name FMS_fuzzyFileToUri_600 + * @tc.desc Verify cache path,Call fuzzyfiletouri + * to judge whether the return value is correct. + */ + it('FMS_fuzzyFileToUri_600', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://cache/video.mp4', + displayName: 'v1.mp4', + success: function (uri) { + console.log('FMS_fuzzyFileToUri_600 call fuzzyFileToUri success. uri:' + uri); + expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/cache' + +'/cacheprimary_leaf/video.mp4/leaf?displayName=v1.mp4#').assertTrue(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_600 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_700 + * @tc.name FMS_fuzzyFileToUri_700 + * @tc.desc Verify that displayName does not exist,Call fuzzyfiletouri + * to judge whether the return value is correct. + */ + it('FMS_fuzzyFileToUri_700', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/file.xlsx', + success: function (uri) { + console.log('FMS_fuzzyFileToUri_700 call fuzzyFileToUri success. uri:' + uri); + expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/files' + +'/primary_leaf7/file.xlsx/leaf').assertTrue(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_700 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_800 + * @tc.name FMS_fuzzyFileToUri_800 + * @tc.desc Verify that authority = null,Call the interface fuzzyfiletouri + * to check whether the interface call fails. + */ + it('FMS_fuzzyFileToUri_800', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: '', + uri: 'internal://app/f2.ppt', + success: function () { + console.log('FMS_fuzzyFileToUri_800 call fuzzyFileToUri success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_800 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_900 + * @tc.name FMS_fuzzyFileToUri_900 + * @tc.desc Verify that authority is a different value,Call the interface fuzzyfiletouri + * to check whether the interface call fails. + */ + it('FMS_fuzzyFileToUri_900', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'com.abc.test.ability', + uri: 'internal://app/f3.doc', + success: function () { + console.log('FMS_fuzzyFileToUri_900 call fuzzyFileToUri success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_900 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_1000 + * @tc.name FMS_fuzzyFileToUri_1000 + * @tc.desc Verify that uri = null,Call the interface fuzzyfiletouri + * to check whether the interface call fails. + */ + it('FMS_fuzzyFileToUri_1000', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: '', + success: function () { + console.log('FMS_fuzzyFileToUri_1000 call fuzzyFileToUri success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_1000 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); + expect(code == 302).assertTrue(); + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_1100 + * @tc.name FMS_fuzzyFileToUri_1100 + * @tc.desc Verify that there is no file under the app path,Call the interface fuzzyfiletouri + * to check whether the interface call fails. + */ + it('FMS_fuzzyFileToUri_1100', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/f4', + success: function () { + console.log('FMS_fuzzyFileToUri_1100 call fuzzyFileToUri success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_1100 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); + expect(code == 301).assertTrue(); + + }, + }) + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_1200 + * @tc.name FMS_fuzzyFileToUri_1200 + * @tc.desc Verify device ID=null,Call the interface fuzzyfiletouri + * to check whether the interface call fails. + */ + it('FMS_fuzzyFileToUri_1200', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/music.mp3', + displayName: 'helloworld', + success: function () { + console.log('FMS_fuzzyFileToUri_1200 call fuzzyFileToUri success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_1200 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); + expect(code == 202).assertTrue(); + }, + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_1300 + * @tc.name FMS_fuzzyFileToUri_1300 + * @tc.desc Verify the virtual path to an out of package file,Call the interface fuzzyfiletouri + * to check whether the interface call fails. + */ + it('FMS_fuzzyFileToUri_1300', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/../../../applications/com.ohos.settings/com.ohos.settings/config.json', + displayName: 'helloworld', + success: function () { + console.log('FMS_fuzzyFileToUri_1300 call fuzzyFileToUri success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_1300 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); + expect(code == 302).assertTrue(); + }, + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_1400 + * @tc.name FMS_fuzzyFileToUri_1400 + * @tc.desc Verify that the folder exists under the app path,Call the interface + * fuzzyfiletouri to check whether the interface call fails. + */ + it('FMS_fuzzyFileToUri_1400', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/folder', + displayName: 'helloworld', + success: function () { + console.log('FMS_fuzzyFileToUri_1400 call fuzzyFileToUri success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_1400 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_1500 + * @tc.name FMS_fuzzyFileToUri_1500 + * @tc.desc The shared file is not configured in JSON + */ + it('FMS_fuzzyFileToUri_1500', 0, function () { + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/f2.ppt', + success: function () { + console.log('FMS_fuzzyFileToUri_1500 call fuzzyFileToUri success, fail!'); + expect(null).assertFail(); + }, + fail: function (data, code) { + console.log('FMS_fuzzyFileToUri_1500 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); + expect(code == 300).assertTrue(); + }, + }); + }) + + /** + * @tc.number SUB_STORAGE_FMS_Performance_0000 + * @tc.name FMS_Performance_0000 + * @tc.desc Performance test + */ + it('FMS_Performance_0000', 0, function () { + let start = new Date().getTime(); + for(let i = 0; i < 1000;i++){ + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/f0.txt', + displayName: 'f1.txt', + success: function () { + let end = new Date().getTime(); + let time = end - start ; + console.log('FMS_Performance_0000 call fuzzyFileToUri success. time:' +time+','+i); + }, + fail: function (data, code) { + console.log('FMS_Performance_0000 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + complete: function () { + console.log('FMS_Performance_0000 call fuzzyFileToUri in complete'); + } + }); + } + }) + + /** + * @tc.number SUB_STORAGE_FMS_Performance_0000 + * @tc.name FMS_Performance_0000 + * @tc.desc stability test + */ + it('FMS_stability_0000', 0, function () { + for(let i = 0; i < 100000;i++){ + fileShareAbility.fuzzyFileToUri({ + deviceId: '440E-0906', + authority: 'ohos.acts.test.ability', + uri: 'internal://app/f0.txt', + displayName: 'f1.txt', + success: function () { + console.log('FMS_stability_0000 success. '+i); + }, + fail: function (data, code) { + console.log('FMS_stability_0000 fail, code: ' + code + ', data: ' + data); + expect(null).assertFail(); + }, + complete: function () { + console.log('FMS_stability_0000 call fuzzyFileToUri in complete'); + } + }); + } + }) + +}) diff --git a/storage/storagefmssharejstest/src/main/js/default/test/List.test.js b/storage/storagefmssharejstest/src/main/js/default/test/List.test.js new file mode 100644 index 000000000..971a7603a --- /dev/null +++ b/storage/storagefmssharejstest/src/main/js/default/test/List.test.js @@ -0,0 +1,16 @@ +/* + * 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. + */ + +require('./FmsShare.test.js') diff --git a/storage/storagefmssharejstest/src/main/resources/base/element/string.json b/storage/storagefmssharejstest/src/main/resources/base/element/string.json new file mode 100644 index 000000000..4b5a8bbc0 --- /dev/null +++ b/storage/storagefmssharejstest/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "storagefilestabilityjstest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/storage/storagefmssharejstest/src/main/resources/base/media/icon.png b/storage/storagefmssharejstest/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+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