Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
afaaca4d
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看板
提交
afaaca4d
编写于
7月 27, 2023
作者:
F
fengjq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bugfix for Watcher interface, delete invalide events.
Signed-off-by:
N
fengjq
<
fengjunqing@huawei.com
>
上级
e68e9777
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
24 deletion
+9
-24
storage/storagefileiov9jstest/src/main/js/test/members/watcher.test.js
...gefileiov9jstest/src/main/js/test/members/watcher.test.js
+9
-24
未找到文件。
storage/storagefileiov9jstest/src/main/js/test/members/watcher.test.js
浏览文件 @
afaaca4d
...
...
@@ -32,8 +32,7 @@ import {
'
IN_CREATE
'
:
0x00000100
,
'
IN_DELETE
'
:
0x00000200
,
'
IN_DELETE_SELF
'
:
0x00000400
,
'
IN_MOVE_SELF
'
:
0x00000800
,
'
IN_ISDIR
'
:
0x40000000
'
IN_MOVE_SELF
'
:
0x00000800
}
const
callback
=
(
data
)
=>
{
...
...
@@ -352,7 +351,7 @@ export default function fileIOWatcher() {
* @tc.number SUB_DF_FILEIO_WATCHER_0800
* @tc.name fileIO_test_watcher_008
* @tc.desc Test watcher event '0x00000100': 'IN_CREATE'
* open a nonexistent folder on create mode, verifying the event is 'IN_
ISDIR | IN_
CREATE'.
* open a nonexistent folder on create mode, verifying the event is 'IN_CREATE'.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
...
...
@@ -365,18 +364,11 @@ export default function fileIOWatcher() {
fileIO
.
mkdirSync
(
dpath
);
try
{
let
flag
=
false
;
let
watcher
=
fileIO
.
createWatcher
(
dpath
,
watcherEvent
.
IN_CREATE
,
(
data
)
=>
{
console
.
log
(
`
${
testNum
}
:{event:
${
data
.
event
}
, fileName:
${
data
.
fileName
}
, cookie:
${
data
.
cookie
}
}`
);
if
((
watcherEvent
.
IN_ISDIR
|
watcherEvent
.
IN_CREATE
)
===
data
.
event
)
{
flag
=
true
;
}
});
watcher
.
start
();
let
resWatcher
=
startWatcher
(
testNum
,
watcherEvent
.
IN_CREATE
,
dpath
);
fileIO
.
mkdirSync
(
ddpath
);
await
sleep
(
WAIT_HALF_SECOND
);
expect
(
flag
==
true
).
assertTrue
();
watcher
.
stop
();
expect
(
resWatcher
.
flag
==
true
).
assertTrue
();
resWatcher
.
watcher
.
stop
();
fileIO
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
...
...
@@ -420,7 +412,7 @@ export default function fileIOWatcher() {
* @tc.number SUB_DF_FILEIO_WATCHER_1000
* @tc.name fileIO_test_watcher_010
* @tc.desc Test watcher event '0x00000200': 'IN_DELETE'
* delete a
file , verifying the event is 'IN_ISDIR |
IN_DELETE'.
* delete a
directory , verifying the event is '
IN_DELETE'.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
...
...
@@ -434,18 +426,11 @@ export default function fileIOWatcher() {
fileIO
.
mkdirSync
(
ddpath
);
try
{
let
flag
=
false
;
let
watcher
=
fileIO
.
createWatcher
(
dpath
,
watcherEvent
.
IN_DELETE
,
(
data
)
=>
{
console
.
log
(
`
${
testNum
}
:{event:
${
data
.
event
}
, fileName:
${
data
.
fileName
}
, cookie:
${
data
.
cookie
}
}`
);
if
((
watcherEvent
.
IN_ISDIR
|
watcherEvent
.
IN_DELETE
)
===
data
.
event
)
{
flag
=
true
;
}
});
watcher
.
start
();
let
resWatcher
=
startWatcher
(
testNum
,
watcherEvent
.
IN_DELETE
,
dpath
);
fileIO
.
rmdirSync
(
ddpath
);
await
sleep
(
WAIT_HALF_SECOND
);
expect
(
flag
==
true
).
assertTrue
();
watcher
.
stop
();
expect
(
resWatcher
.
flag
==
true
).
assertTrue
();
resWatcher
.
watcher
.
stop
();
fileIO
.
rmdirSync
(
dpath
);
done
();
}
catch
(
e
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录