提交 ff578d75 编写于 作者: O openharmony_ci 提交者: Gitee

!834 修复storage中一部分无法执行的用例

Merge pull request !834 from XTStarry/master
......@@ -26,7 +26,7 @@ import {
from 'deccjsunit/index'
describe('dsmTest', function () {
let mid = 0;
/**
* @tc.number SUB_STORAGE_DSM_JS_Function_0000
* @tc.name DSM_JS_Function_0000
......@@ -36,6 +36,7 @@ describe('dsmTest', function () {
devicesmgr.getVolumes({
success: function (data) {
console.log('DSM_JS_Function_0000 call getVolumes success. data:' + JSON.stringify(data));
mid = data.volumeInfos[2].mId;
expect(data.volumeInfos[2].mId !== null).assertTrue();
expect(data.volumeInfos[2].mState == 2).assertTrue();
},
......@@ -150,7 +151,7 @@ describe('dsmTest', function () {
*/
it('DSM_JS_Function_0400', 0, function () {
devicesmgr.mount({
volId: 'public:179,33',
volId: mid,
success: function () {
devicesmgr.getVolumes({
success: function (data) {
......@@ -167,24 +168,6 @@ describe('dsmTest', function () {
})
})
/**
* @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
......
......@@ -72,6 +72,11 @@ describe('fileconcurrent', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -127,6 +132,11 @@ describe('fileconcurrent', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -186,6 +196,11 @@ describe('fileconcurrent', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -221,6 +236,11 @@ describe('fileconcurrent', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -277,6 +297,11 @@ describe('fileconcurrent', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -324,6 +349,11 @@ describe('fileconcurrent', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -357,6 +387,11 @@ describe('fileconcurrent', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -391,6 +426,11 @@ describe('fileconcurrent', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -425,5 +465,10 @@ describe('fileconcurrent', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
});
......@@ -51,6 +51,11 @@ describe('FileError', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -73,6 +78,11 @@ describe('FileError', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -82,7 +92,7 @@ describe('FileError', function () {
*/
it('File_test_error_002', 0, async function (done) {
file.writeText({
uri: 'internal://app/file_test_error',
uri: 'internal://app../file_test_error',
text: FILE_CONTENT,
success: function () {
console.log('file_test_error_002 call writeText success.');
......@@ -93,6 +103,11 @@ describe('FileError', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -114,6 +129,11 @@ describe('FileError', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -133,6 +153,11 @@ describe('FileError', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -153,6 +178,11 @@ describe('FileError', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -173,6 +203,11 @@ describe('FileError', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -195,6 +230,11 @@ describe('FileError', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -226,6 +266,11 @@ describe('FileError', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -250,6 +295,11 @@ describe('FileError', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -274,6 +324,11 @@ describe('FileError', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -295,6 +350,11 @@ describe('FileError', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -338,5 +398,10 @@ describe('FileError', function () {
});
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
});
......@@ -62,6 +62,11 @@ describe('fileVirtualPath', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -83,6 +88,11 @@ describe('fileVirtualPath', function () {
done();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -127,6 +137,11 @@ describe('fileVirtualPath', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -165,6 +180,11 @@ describe('fileVirtualPath', function () {
file.delete({
uri: 'internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_writeArrayBuffer_011'
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -201,6 +221,11 @@ describe('fileVirtualPath', function () {
file.delete({
uri: 'internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_readText_008'
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -221,6 +246,11 @@ describe('fileVirtualPath', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -260,6 +290,11 @@ describe('fileVirtualPath', function () {
file.delete({
uri: 'internal://cache/../../ohos.acts.distributeddatamgr.distributedfile/File_read_array_buffer_010'
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -282,6 +317,11 @@ describe('fileVirtualPath', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -326,6 +366,11 @@ describe('fileVirtualPath', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -347,6 +392,11 @@ describe('fileVirtualPath', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -379,6 +429,11 @@ describe('fileVirtualPath', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -411,6 +466,11 @@ describe('fileVirtualPath', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -435,6 +495,11 @@ describe('fileVirtualPath', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -459,6 +524,11 @@ describe('fileVirtualPath', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -504,6 +574,11 @@ describe('fileVirtualPath', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -525,6 +600,11 @@ describe('fileVirtualPath', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -547,6 +627,11 @@ describe('fileVirtualPath', function () {
fileio.unlinkSync(fpathTarget);
}
fileio.closeSync(fd);
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -568,6 +653,11 @@ describe('fileVirtualPath', function () {
console.log('fileioPerformance_prop_openSync,openSync:' + fd + ', time:' + time + ',' + i);
}
fileio.closeSync(fd);
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
});
......@@ -14,5 +14,3 @@
*/
require('./FileIOError.test.js')
require('./FileError.test.js')
require('./FileVirtualPath.test.js')
......@@ -33,7 +33,8 @@ import {
prepareEmptyFile,
differentFileName,
randomString,
fileName
fileName,
sleep
}
from './Common'
......@@ -1600,6 +1601,7 @@ describe('fileIOTest', function () {
let fpath = nextFileName('fileio_test_read_sync_000');
let text = '0123456789abcdefg';
expect(prepareFile(fpath, text)).assertTrue();
sleep(10)
try {
let fd = fileio.openSync(fpath, 0o2);
let len = fileio.readSync(fd, new ArrayBuffer(4096));
......
......@@ -46,7 +46,7 @@ describe('fileIOTestStream', function () {
*/
it('fileio_test_stream_create_stream_sync_000', 0, function () {
let fpath = nextFileName('fileio_test_stream_create_stream_sync_000');
expect(prepareFile(fpath, '')).assertTrue();
expect(prepareFile(fpath, 'hello')).assertTrue();
expect(fileToReadOnly(fpath)).assertTrue();
try {
let ss = fileio.createStreamSync(fpath, 'r');
......@@ -69,7 +69,7 @@ describe('fileIOTestStream', function () {
it('fileio_test_stream_create_stream_sync_001', 0, function () {
let fpath = nextFileName('fileio_test_stream_create_stream_sync_001');
try {
expect(fileio.createStreamSync(fpath, 'r') == null).assertTrue();
fileio.createStreamSync(fpath, 'r');
expect(null).assertFail();
}
catch (e) {
......
......@@ -51,6 +51,11 @@ describe('fileTest', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -76,6 +81,11 @@ describe('fileTest', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -101,6 +111,11 @@ describe('fileTest', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -150,6 +165,11 @@ describe('fileTest', function () {
expect(null).assertFail();
},
});
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -175,6 +195,11 @@ describe('fileTest', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -212,6 +237,11 @@ describe('fileTest', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -251,6 +281,11 @@ describe('fileTest', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -288,6 +323,11 @@ describe('fileTest', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -328,6 +368,11 @@ describe('fileTest', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -355,6 +400,11 @@ describe('fileTest', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -380,6 +430,11 @@ describe('fileTest', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -411,6 +466,11 @@ describe('fileTest', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
/**
......@@ -436,5 +496,10 @@ describe('fileTest', function () {
},
});
}
setTimeout(
function(){
expect(null).assertFail();
done();
},30)
});
});
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* 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,
* 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.
......
......@@ -12,7 +12,6 @@
* 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 {
......
/*
* 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,
filePickerName2,
sleep,
randomString,
cacheFileName,
prepareEmptyFile,
nextFileName
}
from './Common'
describe('FmsPerformanceTest', function () {
let deviceID = 0;
/**
* @tc.number SUB_STORAGE_FMS_Stability_0000
* @tc.name FMS_Stability_0000
* @tc.desc Function of API,Performance Test
*/
it('FMS_Performance_0000', 0, function (done) {
let start = new Date().getTime();
for (let i = 0; i < 1000; i++){
let progetDeviceInfo = new Promise(function (resolve, reject) {
for (let i = 0; i < 1000; i++){}
filepicker.getDeviceInfo({
success: function (data) {
let end = new Date().getTime();
let time = end - start;
console.log('-------FMS_Performance_0000 success, time:' + time + ',' + i);
start = new Date().getTime();
console.log('FMS_Function_0000 success.' + JSON.stringify(data));
deviceID = data.deviceList[0].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_Performance_0100
* @tc.name FMS_Performance_0100
* @tc.desc Function of API,Performance Test
*/
it('FMS_Performance_0100', 0, function (done) {
let start = new Date().getTime();
for (let i = 0; i < 1000; i++){
let proMkdir = new Promise(function (resolve, reject) {
filepicker.mkdir({
uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf',
success: function () {
let end = new Date().getTime();
let time = end - start;
console.log('-------FMS_Performance_0100 success, time:' + time + ',' + i);
start = new Date().getTime();
console.log('FMS_Performance_0100 success.');
done()
},
fail: function (data, code) {
console.log('FMS_Performance_0100 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
})
})
proMkdir.catch(function () {
console.log('FMS_Performance_0100 success');
});
}
})
/**
* @tc.number SUB_STORAGE_FMS_Performance_0200
* @tc.name FMS_Performance_0200
* @tc.desc Function of API,Performance Test
*/
it('FMS_Performance_0200', 0, function (done) {
let start = new Date().getTime();
for (let i = 0; i < 1000; i++){
let proMkdir = new Promise(function (resolve, reject) {
filepicker.mkdir({
uri: 'dataability:///public.storage.ability/' + deviceID + '/document/a/b/c/leaf',
success: function () {
let end = new Date().getTime();
let time = end - start;
console.log('-------FMS_Performance_0200 success, time:' + time + ',' + i);
start = new Date().getTime();
console.log('FMS_Performance_0200 success.');
done()
},
fail: function (data, code) {
console.log('FMS_Performance_0200 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
})
})
proMkdir.catch(function () {
console.log('FMS_Performance_0200 success');
});
}
})
/**
* @tc.number SUB_STORAGE_FMS_Performance_0300
* @tc.name FMS_Performance_0300
* @tc.desc Function of API,Performance Test
*/
it('FMS_Performance_0300', 0, function (done) {
let fpath = filePickerName("a.txt", deviceID);
prepareFile(fpath, FILE_CONTENT)
let start = new Date().getTime();
for (let i = 0; i < 1000; i++){
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) {
let end = new Date().getTime();
let time = end - start;
console.log('-------FMS_Performance_0300 success, time:' + time + ',' + i);
start = new Date().getTime();
console.log('FMS_Performance_0300 success.' + data.saveFileList[0].status);
done()
},
fail: function (data, code) {
console.log('FMS_Performance_0300 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
setTimeout(function () {
resolve('mkdir success!');
done()
}, 250);
})
proMkdir.then(function () {
console.log('FMS_Performance_0300 success');
});
}
})
/**
* @tc.number SUB_STORAGE_FMS_Performance_0400
* @tc.name FMS_Performance_0400
* @tc.desc Function of API,Performance Test
*/
it('FMS_Performance_0400', 0, function (done) {
let start = new Date().getTime();
for (let i = 0; i < 1000; i++){
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) {
let end = new Date().getTime();
let time = end - start;
console.log('-------FMS_Performance_0400 success, time:' + time + ',' + i);
start = new Date().getTime();
console.log('FMS_Performance_0400 success.' + data.fileList[0].uri);
done()
},
fail: function (data, code) {
console.log('FMS_Performance_0400 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
})
proMkdir.then(function () {
console.log('FMS_Performance_0400 success');
});
}
})
/**
* @tc.number SUB_STORAGE_FMS_Performance_0500
* @tc.name FMS_Performance_0500
* @tc.desc Function of API,Performance Test
*/
it('FMS_Performance_0500', 0, function (done) {
let start = new Date().getTime();
for (let i = 0; i < 1000; i++){
let proMkdir = new Promise(function (resolve, reject) {
filepicker.list({
uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf',
success: function (data) {
let end = new Date().getTime();
let time = end - start;
console.log('-------FMS_Performance_0500 success, time:' + time + ',' + i);
start = new Date().getTime();
console.log('FMS_Performance_0500 success.' + data.fileList[0].uri);
done()
},
fail: function (data, code) {
console.log('FMS_Performance_0500 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
})
proMkdir.then(function () {
console.log('FMS_Performance_0500 success');
});
}
})
})
\ No newline at end of file
......@@ -44,7 +44,7 @@ describe('FmsTest', function () {
* @tc.name FMS_Function_0000
* @tc.desc Function of API,Get current device information
*/
it('FMS_Function_0000', 0, function (done) {
it('FMS_Function_0000', 0, async function (done) {
let progetDeviceInfo = new Promise(function (resolve, reject) {
filepicker.getDeviceInfo({
success: function (data) {
......@@ -74,7 +74,7 @@ describe('FmsTest', function () {
* @tc.name FMS_Function_0100
* @tc.desc Function of API, Creates the specified directory recursively
*/
it('FMS_Function_0100', 0, function (done) {
it('FMS_Function_0100', 0, async function (done) {
let proMkdir = new Promise(function (resolve, reject) {
filepicker.mkdir({
uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf',
......@@ -88,7 +88,7 @@ describe('FmsTest', function () {
},
})
})
proMkdir.catch(function () {
proMkdir.then(function () {
console.log('FMS_Function_0100 success');
});
})
......@@ -98,7 +98,7 @@ describe('FmsTest', function () {
* @tc.name FMS_Function_0200
* @tc.desc Function of API, Creates the specified directory recursively
*/
it('FMS_Function_0200', 0, function (done) {
it('FMS_Function_0200', 0, async function (done) {
let proMkdir = new Promise(function (resolve, reject) {
filepicker.mkdir({
uri: 'dataability:///public.storage.ability/' + deviceID + '/document/你好/leaf',
......@@ -122,7 +122,7 @@ describe('FmsTest', function () {
* @tc.name FMS_Function_0300
* @tc.desc Function of API, Creates the specified directory recursively
*/
it('FMS_Function_0300', 0, function (done) {
it('FMS_Function_0300', 0,async function (done) {
let proMkdir = new Promise(function (resolve, reject) {
filepicker.mkdir({
uri: 'dataability:///public.storage.ability/' + deviceID + '/document/a/b/c/leaf',
......@@ -146,7 +146,7 @@ describe('FmsTest', function () {
* @tc.name FMS_Function_0400
* @tc.desc Function of API,
*/
it('FMS_Function_0400', 0, function (done) {
it('FMS_Function_0400', 0, async function (done) {
let proMkdir = new Promise(function (resolve, reject) {
filepicker.mkdir({
uri: 'dataability:///public.storage.ability/' + deviceID + '/root/files',
......@@ -170,7 +170,7 @@ describe('FmsTest', function () {
* @tc.name FMS_Function_0500
* @tc.desc Function of API, save file.The test file is exist.
*/
it('FMS_Function_0500', 0, function (done) {
it('FMS_Function_0500', 0, async function (done) {
let fpath = filePickerName("a.txt", deviceID);
expect(prepareFile(fpath, FILE_CONTENT) !== null).assertTrue();
let proMkdir = new Promise(function (resolve, reject) {
......
......@@ -14,4 +14,4 @@
*/
require('./FmsPublic.test.js')
require('./FmsPublicError.test.js')
......@@ -29,7 +29,7 @@ import {
}
from './Common'
describe('fileTest', function () {
describe('fmsShareTest', function () {
beforeAll(() => {
prepareFile(fmsFileName('music.mp3'), 'content');
prepareFile(fmsFileName('f0.txt'), 'content');
......@@ -405,59 +405,4 @@ describe('fileTest', function () {
});
})
/**
* @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');
}
});
}
})
})
/*
* 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('fmsPerformanceTest', 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_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 ;
start = new Date().getTime()
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');
}
});
}
})
})
/*
* 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('fmsStabilityTest', 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_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');
}
});
}
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册