Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
816b2fae
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
816b2fae
编写于
11月 25, 2021
作者:
S
Storage sandboxing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
删除storagefileiojstest没有用到的方法
Signed-off-by:
N
Storage sandboxing
<
raoxian050@chinasoftinc.com
>
上级
fca27e66
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
6 addition
and
82 deletion
+6
-82
storage/storagefileiojstest/src/main/config.json
storage/storagefileiojstest/src/main/config.json
+3
-3
storage/storagefileiojstest/src/main/js/default/test/Common.js
...ge/storagefileiojstest/src/main/js/default/test/Common.js
+3
-77
storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js
...oragefileiojstest/src/main/js/default/test/FileIO.test.js
+0
-1
storage/storagefileiojstest/src/main/js/default/test/FileIOStream.test.js
...ileiojstest/src/main/js/default/test/FileIOStream.test.js
+0
-1
未找到文件。
storage/storagefileiojstest/src/main/config.json
浏览文件 @
816b2fae
{
{
"app"
:
{
"app"
:
{
"bundleName"
:
"ohos.acts.st
ro
age.fileio"
,
"bundleName"
:
"ohos.acts.st
or
age.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.st
ro
age.fileio"
,
"package"
:
"ohos.acts.st
or
age.fileio"
,
"name"
:
".MyApplication"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"deviceType"
:
[
"phone"
"phone"
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
]
]
}
}
],
],
"name"
:
"ohos.acts.st
ro
age.fileio.MainAbility"
,
"name"
:
"ohos.acts.st
or
age.fileio.MainAbility"
,
"icon"
:
"$media:icon"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"label"
:
"$string:app_name"
,
...
...
storage/storagefileiojstest/src/main/js/default/test/Common.js
浏览文件 @
816b2fae
...
@@ -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.st
ro
age.fileio/cache/
'
const
BASE_PATH
=
'
/data/accounts/account_0/appdata/ohos.acts.st
or
age.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.st
ro
age.fileio/files/
'
const
BASE_PATH
=
'
/data/accounts/account_0/appdata/ohos.acts.st
or
age.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
)
{
...
...
storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js
浏览文件 @
816b2fae
...
@@ -29,7 +29,6 @@ import {
...
@@ -29,7 +29,6 @@ import {
prepareFile
,
prepareFile
,
nextFileName
,
nextFileName
,
prepareEmptyFile
,
prepareEmptyFile
,
differentFileName
,
randomString
,
randomString
,
fileName
,
fileName
,
sleep
sleep
...
...
storage/storagefileiojstest/src/main/js/default/test/FileIOStream.test.js
浏览文件 @
816b2fae
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录