提交 816b2fae 编写于 作者: S Storage sandboxing

删除storagefileiojstest没有用到的方法

Signed-off-by: NStorage sandboxing <raoxian050@chinasoftinc.com>
上级 fca27e66
{ {
"app": { "app": {
"bundleName": "ohos.acts.stroage.fileio", "bundleName": "ohos.acts.storage.fileio",
"vendor": "example", "vendor": "example",
"version": { "version": {
"code": 1000000, "code": 1000000,
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "ohos.acts.stroage.fileio", "package": "ohos.acts.storage.fileio",
"name": ".MyApplication", "name": ".MyApplication",
"deviceType": [ "deviceType": [
"phone" "phone"
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
] ]
} }
], ],
"name": "ohos.acts.stroage.fileio.MainAbility", "name": "ohos.acts.storage.fileio.MainAbility",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:mainability_description", "description": "$string:mainability_description",
"label": "$string:app_name", "label": "$string:app_name",
......
...@@ -17,11 +17,6 @@ import fileio from '@ohos.fileio'; ...@@ -17,11 +17,6 @@ import fileio from '@ohos.fileio';
export const FILE_CONTENT = 'hello world'; export const FILE_CONTENT = 'hello world';
import {
expect
}
from 'deccjsunit/index'
export function prepareFile(fpath, content) { export function prepareFile(fpath, content) {
try { try {
let fd = fileio.openSync(fpath, 0o102, 0o666) let fd = fileio.openSync(fpath, 0o102, 0o666)
...@@ -36,20 +31,6 @@ export function prepareFile(fpath, content) { ...@@ -36,20 +31,6 @@ export function prepareFile(fpath, content) {
return false 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) { export function prepareEmptyFile(fpath) {
try { try {
let fd = fileio.openSync(fpath, 0o102, 0o777) let fd = fileio.openSync(fpath, 0o102, 0o777)
...@@ -87,74 +68,19 @@ export function fileToWriteOnly(fpath) { ...@@ -87,74 +68,19 @@ export function fileToWriteOnly(fpath) {
return false 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 appName(testName) {
const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/'
return BASE_PATH + testName + '_' + randomString(testName.length);
}
export function nextFileName(testName) { export function nextFileName(testName) {
const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.storage.fileio/cache/'
return BASE_PATH + testName + '_' + randomString(testName.length); return BASE_PATH + testName + '_' + randomString(testName.length);
} }
export function fileName(testName) { export function fileName(testName) {
const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.storage.fileio/files/'
return BASE_PATH + testName + '_' + randomString(testName.length); return BASE_PATH + testName + '_' + randomString(testName.length);
} }
export function cacheFileName(testName) { export function cacheFileName(testName) {
const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.storage.fileio/files/cache/'
return BASE_PATH + testName + '_' + randomString(testName.length);
}
export function differentFileName(testName) {
const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/'
return BASE_PATH + testName + '_' + randomString(testName.length);
}
export function differentCacheName(testName) {
const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/'
return BASE_PATH + testName + '_' + randomString(testName.length); return BASE_PATH + testName + '_' + randomString(testName.length);
} }
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) { export function sleep(n) {
var start = new Date().getTime(); var start = new Date().getTime();
while (true) { while (true) {
......
...@@ -29,7 +29,6 @@ import { ...@@ -29,7 +29,6 @@ import {
prepareFile, prepareFile,
nextFileName, nextFileName,
prepareEmptyFile, prepareEmptyFile,
differentFileName,
randomString, randomString,
fileName, fileName,
sleep sleep
......
...@@ -30,7 +30,6 @@ import { ...@@ -30,7 +30,6 @@ import {
fileToReadOnly, fileToReadOnly,
fileToWriteOnly, fileToWriteOnly,
sleep, sleep,
fileToReadAndWrite,
nextFileName, nextFileName,
randomString randomString
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册