Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9a636b14
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看板
未验证
提交
9a636b14
编写于
8月 01, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 01, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9548 Bugfix for Watcher interface, delete invalide events.
Merge pull request !9548 from 冯俊青/master
上级
d157a891
afaaca4d
变更
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
浏览文件 @
9a636b14
...
@@ -32,8 +32,7 @@ import {
...
@@ -32,8 +32,7 @@ import {
'
IN_CREATE
'
:
0x00000100
,
'
IN_CREATE
'
:
0x00000100
,
'
IN_DELETE
'
:
0x00000200
,
'
IN_DELETE
'
:
0x00000200
,
'
IN_DELETE_SELF
'
:
0x00000400
,
'
IN_DELETE_SELF
'
:
0x00000400
,
'
IN_MOVE_SELF
'
:
0x00000800
,
'
IN_MOVE_SELF
'
:
0x00000800
'
IN_ISDIR
'
:
0x40000000
}
}
const
callback
=
(
data
)
=>
{
const
callback
=
(
data
)
=>
{
...
@@ -352,7 +351,7 @@ export default function fileIOWatcher() {
...
@@ -352,7 +351,7 @@ export default function fileIOWatcher() {
* @tc.number SUB_DF_FILEIO_WATCHER_0800
* @tc.number SUB_DF_FILEIO_WATCHER_0800
* @tc.name fileIO_test_watcher_008
* @tc.name fileIO_test_watcher_008
* @tc.desc Test watcher event '0x00000100': 'IN_CREATE'
* @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.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level 0
* @tc.level Level 0
...
@@ -365,18 +364,11 @@ export default function fileIOWatcher() {
...
@@ -365,18 +364,11 @@ export default function fileIOWatcher() {
fileIO
.
mkdirSync
(
dpath
);
fileIO
.
mkdirSync
(
dpath
);
try
{
try
{
let
flag
=
false
;
let
resWatcher
=
startWatcher
(
testNum
,
watcherEvent
.
IN_CREATE
,
dpath
);
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
();
fileIO
.
mkdirSync
(
ddpath
);
fileIO
.
mkdirSync
(
ddpath
);
await
sleep
(
WAIT_HALF_SECOND
);
await
sleep
(
WAIT_HALF_SECOND
);
expect
(
flag
==
true
).
assertTrue
();
expect
(
resWatcher
.
flag
==
true
).
assertTrue
();
watcher
.
stop
();
resWatcher
.
watcher
.
stop
();
fileIO
.
rmdirSync
(
dpath
);
fileIO
.
rmdirSync
(
dpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -420,7 +412,7 @@ export default function fileIOWatcher() {
...
@@ -420,7 +412,7 @@ export default function fileIOWatcher() {
* @tc.number SUB_DF_FILEIO_WATCHER_1000
* @tc.number SUB_DF_FILEIO_WATCHER_1000
* @tc.name fileIO_test_watcher_010
* @tc.name fileIO_test_watcher_010
* @tc.desc Test watcher event '0x00000200': 'IN_DELETE'
* @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.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level 0
* @tc.level Level 0
...
@@ -434,18 +426,11 @@ export default function fileIOWatcher() {
...
@@ -434,18 +426,11 @@ export default function fileIOWatcher() {
fileIO
.
mkdirSync
(
ddpath
);
fileIO
.
mkdirSync
(
ddpath
);
try
{
try
{
let
flag
=
false
;
let
resWatcher
=
startWatcher
(
testNum
,
watcherEvent
.
IN_DELETE
,
dpath
);
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
();
fileIO
.
rmdirSync
(
ddpath
);
fileIO
.
rmdirSync
(
ddpath
);
await
sleep
(
WAIT_HALF_SECOND
);
await
sleep
(
WAIT_HALF_SECOND
);
expect
(
flag
==
true
).
assertTrue
();
expect
(
resWatcher
.
flag
==
true
).
assertTrue
();
watcher
.
stop
();
resWatcher
.
watcher
.
stop
();
fileIO
.
rmdirSync
(
dpath
);
fileIO
.
rmdirSync
(
dpath
);
done
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录