Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
682b115b
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
682b115b
编写于
8月 23, 2021
作者:
O
openharmony_ci
提交者:
Gitee
8月 23, 2021
浏览文件
操作
浏览文件
下载
差异文件
!467 add testCase
Merge pull request !467 from lihuanrui/update03
上级
e969a100
a0320fa6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
258 addition
and
0 deletion
+258
-0
updater/update_test/gradle/entry/src/main/js/test/update.test.js
.../update_test/gradle/entry/src/main/js/test/update.test.js
+129
-0
updater/update_test/gradle/entry/src/ohosTest/js/test/update.test.js
...ate_test/gradle/entry/src/ohosTest/js/test/update.test.js
+129
-0
未找到文件。
updater/update_test/gradle/entry/src/main/js/test/update.test.js
浏览文件 @
682b115b
...
...
@@ -1818,5 +1818,134 @@ describe('updateclient', function() {
}
console
.
info
(
'
[cancelUpgrade] success.
'
);
console
.
info
(
'
testCancelDownload5 END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0081
* @tc.name testVerifyVersion
* @tc.desc Unsubscribe from monitoring.
*/
it
(
'
testVerifyVersion
'
,
0
,
function
()
{
console
.
info
(
'
testVerifyVersion START
'
);
try
{
updater
.
on
(
'
verifyProgress
'
,
progress
=>
{
console
.
log
(
"
verifyProgress on
"
+
progress
);
console
.
log
(
`verifyProgress status: `
+
progress
.
status
);
console
.
log
(
`verifyProgress percent: `
+
progress
.
percent
);
console
.
log
(
`verifyProgress endReason: `
+
progress
.
endReason
);
if
(
progress
.
status
===
updateState
.
UPDATE_STATE_DOWNLOAD_SUCCESS
||
progress
.
status
===
updateState
.
UPDATE_STATE_VERIFY_SUCCESS
)
{
expect
(
progress
.
percent
).
assertEqual
(
expect_value
);
updater
.
off
(
"
verifyProgress
"
);
}
})
let
ret
=
updater
.
verifyUpdatePackage
(
'
/data/updater/updater.zip
'
,
'
/data/updater/HwOUC/update_auth.sa
'
);
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
info
(
'
[testVerifyVersion] catch
'
+
e
);
}
console
.
info
(
'
[verifyVersion] success.
'
);
console
.
info
(
'
testVerifyVersion END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0082
* @tc.name testVerifyVersion02
* @tc.desc Unsubscribe out of monitoring.
*/
it
(
'
testVerifyVersion02
'
,
0
,
function
()
{
console
.
info
(
'
testVerifyVersion02 START
'
);
try
{
updater
.
on
(
'
verifyProgress
'
,
progress
=>
{
console
.
log
(
"
verifyProgress on
"
+
progress
);
console
.
log
(
`verifyProgress status: `
+
progress
.
status
);
console
.
log
(
`verifyProgress percent: `
+
progress
.
percent
);
console
.
log
(
`verifyProgress endReason: `
+
progress
.
endReason
);
if
(
progress
.
status
===
updateState
.
UPDATE_STATE_DOWNLOAD_SUCCESS
||
progress
.
status
===
updateState
.
UPDATE_STATE_VERIFY_SUCCESS
)
{
expect
(
progress
.
percent
).
assertEqual
(
expect_value
);
}
})
let
ret
=
updater
.
verifyUpdatePackage
(
'
/data/updater/updater.zip
'
,
'
/data/updater/HwOUC/update_auth.sa
'
);
updater
.
off
(
"
verifyProgress
"
);
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
info
(
'
[testVerifyVersion02] catch
'
+
e
);
}
console
.
info
(
'
[verifyVersion] success.
'
);
console
.
info
(
'
testVerifyVersion END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0083
* @tc.name testVerifyVersion03
* @tc.desc Test verify parameter, callback is not supported.
*/
it
(
'
testVerifyVersion03
'
,
0
,
function
()
{
console
.
info
(
'
testVerifyVersion03 START
'
);
try
{
let
ret
=
updater
.
verifyUpdatePackage
(
'
/data/updater/updater.zip
'
,
'
/data/updater/HwOUC/update_auth.sa
'
,
progress
=>
{
console
.
log
(
"
verifyProgress on
"
+
progress
);
console
.
log
(
`verifyProgress status: `
+
progress
.
status
);
console
.
log
(
`verifyProgress percent: `
+
progress
.
percent
);
console
.
log
(
`verifyProgress endReason: `
+
progress
.
endReason
);
if
(
progress
.
status
===
updateState
.
UPDATE_STATE_DOWNLOAD_SUCCESS
||
progress
.
status
===
updateState
.
UPDATE_STATE_VERIFY_SUCCESS
)
{
expect
(
progress
.
percent
).
assertEqual
(
expect_value
);
}
})
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
info
(
'
[testVerifyVersion03] catch
'
+
e
);
}
console
.
info
(
'
[verifyVersion] success.
'
);
console
.
info
(
'
testVerifyVersion END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0084
* @tc.name testVerifyVersion04
* @tc.desc Test subscription without parameters, return error.
*/
it
(
'
testVerifyVersion04
'
,
0
,
function
()
{
console
.
info
(
'
testVerifyVersion04 START
'
);
try
{
let
ret
=
updater
.
on
(
'
verifyProgress
'
);
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
let
ret_verify
=
updater
.
verifyUpdatePackage
();
expect
(
ret_verify
).
assertInstanceOf
(
'
Number
'
);
let
ret_off
=
updater
.
off
(
"
verifyProgress
"
);
expect
(
ret_off
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
info
(
'
[testVerifyVersion04] catch
'
+
e
);
}
console
.
info
(
'
[verifyVersion] success.
'
);
console
.
info
(
'
testVerifyVersion04 END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0085
* @tc.name testVerifyVersion05
* @tc.desc Take function to subscribe.
*/
it
(
'
testVerifyVersion05
'
,
0
,
function
()
{
function
testFunction
(
progress
)
{
console
.
log
(
"
verifyProgress on
"
+
progress
);
console
.
log
(
`verifyProgress status: `
+
progress
.
status
);
console
.
log
(
`verifyProgress percent: `
+
progress
.
percent
);
console
.
log
(
`verifyProgress endReason: `
+
progress
.
endReason
);
}
console
.
info
(
'
testVerifyVersion05 START
'
);
try
{
let
ret
=
updater
.
on
(
'
verifyProgress
'
,
testFunction
);
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
let
ret_verify
=
updater
.
verifyUpdatePackage
(
'
/data/updater/updater.zip
'
,
'
/data/updater/HwOUC/update_auth.sa
'
);
expect
(
ret_verify
).
assertInstanceOf
(
'
Number
'
);
let
ret_off
=
updater
.
off
(
"
verifyProgress
"
,
testFunction
);
expect
(
ret_off
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
info
(
'
[testVerifyVersion05] catch
'
+
e
);
}
console
.
info
(
'
[verifyVersion] success.
'
);
console
.
info
(
'
testVerifyVersion05 END
'
);
});
});
updater/update_test/gradle/entry/src/ohosTest/js/test/update.test.js
浏览文件 @
682b115b
...
...
@@ -1818,5 +1818,134 @@ describe('updateclient', function() {
}
console
.
info
(
'
[cancelUpgrade] success.
'
);
console
.
info
(
'
testCancelDownload5 END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0081
* @tc.name testVerifyVersion
* @tc.desc Unsubscribe from monitoring.
*/
it
(
'
testVerifyVersion
'
,
0
,
function
()
{
console
.
info
(
'
testVerifyVersion START
'
);
try
{
updater
.
on
(
'
verifyProgress
'
,
progress
=>
{
console
.
log
(
"
verifyProgress on
"
+
progress
);
console
.
log
(
`verifyProgress status: `
+
progress
.
status
);
console
.
log
(
`verifyProgress percent: `
+
progress
.
percent
);
console
.
log
(
`verifyProgress endReason: `
+
progress
.
endReason
);
if
(
progress
.
status
===
updateState
.
UPDATE_STATE_DOWNLOAD_SUCCESS
||
progress
.
status
===
updateState
.
UPDATE_STATE_VERIFY_SUCCESS
)
{
expect
(
progress
.
percent
).
assertEqual
(
expect_value
);
updater
.
off
(
"
verifyProgress
"
);
}
})
let
ret
=
updater
.
verifyUpdatePackage
(
'
/data/updater/updater.zip
'
,
'
/data/updater/HwOUC/update_auth.sa
'
);
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
info
(
'
[testVerifyVersion] catch
'
+
e
);
}
console
.
info
(
'
[verifyVersion] success.
'
);
console
.
info
(
'
testVerifyVersion END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0082
* @tc.name testVerifyVersion02
* @tc.desc Unsubscribe out of monitoring.
*/
it
(
'
testVerifyVersion02
'
,
0
,
function
()
{
console
.
info
(
'
testVerifyVersion02 START
'
);
try
{
updater
.
on
(
'
verifyProgress
'
,
progress
=>
{
console
.
log
(
"
verifyProgress on
"
+
progress
);
console
.
log
(
`verifyProgress status: `
+
progress
.
status
);
console
.
log
(
`verifyProgress percent: `
+
progress
.
percent
);
console
.
log
(
`verifyProgress endReason: `
+
progress
.
endReason
);
if
(
progress
.
status
===
updateState
.
UPDATE_STATE_DOWNLOAD_SUCCESS
||
progress
.
status
===
updateState
.
UPDATE_STATE_VERIFY_SUCCESS
)
{
expect
(
progress
.
percent
).
assertEqual
(
expect_value
);
}
})
let
ret
=
updater
.
verifyUpdatePackage
(
'
/data/updater/updater.zip
'
,
'
/data/updater/HwOUC/update_auth.sa
'
);
updater
.
off
(
"
verifyProgress
"
);
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
info
(
'
[testVerifyVersion02] catch
'
+
e
);
}
console
.
info
(
'
[verifyVersion] success.
'
);
console
.
info
(
'
testVerifyVersion END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0083
* @tc.name testVerifyVersion03
* @tc.desc Test verify parameter, callback is not supported.
*/
it
(
'
testVerifyVersion03
'
,
0
,
function
()
{
console
.
info
(
'
testVerifyVersion03 START
'
);
try
{
let
ret
=
updater
.
verifyUpdatePackage
(
'
/data/updater/updater.zip
'
,
'
/data/updater/HwOUC/update_auth.sa
'
,
progress
=>
{
console
.
log
(
"
verifyProgress on
"
+
progress
);
console
.
log
(
`verifyProgress status: `
+
progress
.
status
);
console
.
log
(
`verifyProgress percent: `
+
progress
.
percent
);
console
.
log
(
`verifyProgress endReason: `
+
progress
.
endReason
);
if
(
progress
.
status
===
updateState
.
UPDATE_STATE_DOWNLOAD_SUCCESS
||
progress
.
status
===
updateState
.
UPDATE_STATE_VERIFY_SUCCESS
)
{
expect
(
progress
.
percent
).
assertEqual
(
expect_value
);
}
})
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
info
(
'
[testVerifyVersion03] catch
'
+
e
);
}
console
.
info
(
'
[verifyVersion] success.
'
);
console
.
info
(
'
testVerifyVersion END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0084
* @tc.name testVerifyVersion04
* @tc.desc Test subscription without parameters, return error.
*/
it
(
'
testVerifyVersion04
'
,
0
,
function
()
{
console
.
info
(
'
testVerifyVersion04 START
'
);
try
{
let
ret
=
updater
.
on
(
'
verifyProgress
'
);
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
let
ret_verify
=
updater
.
verifyUpdatePackage
();
expect
(
ret_verify
).
assertInstanceOf
(
'
Number
'
);
let
ret_off
=
updater
.
off
(
"
verifyProgress
"
);
expect
(
ret_off
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
info
(
'
[testVerifyVersion04] catch
'
+
e
);
}
console
.
info
(
'
[verifyVersion] success.
'
);
console
.
info
(
'
testVerifyVersion04 END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0085
* @tc.name testVerifyVersion05
* @tc.desc Take function to subscribe.
*/
it
(
'
testVerifyVersion05
'
,
0
,
function
()
{
function
testFunction
(
progress
)
{
console
.
log
(
"
verifyProgress on
"
+
progress
);
console
.
log
(
`verifyProgress status: `
+
progress
.
status
);
console
.
log
(
`verifyProgress percent: `
+
progress
.
percent
);
console
.
log
(
`verifyProgress endReason: `
+
progress
.
endReason
);
}
console
.
info
(
'
testVerifyVersion05 START
'
);
try
{
let
ret
=
updater
.
on
(
'
verifyProgress
'
,
testFunction
);
expect
(
ret
).
assertInstanceOf
(
'
Number
'
);
let
ret_verify
=
updater
.
verifyUpdatePackage
(
'
/data/updater/updater.zip
'
,
'
/data/updater/HwOUC/update_auth.sa
'
);
expect
(
ret_verify
).
assertInstanceOf
(
'
Number
'
);
let
ret_off
=
updater
.
off
(
"
verifyProgress
"
,
testFunction
);
expect
(
ret_off
).
assertInstanceOf
(
'
Number
'
);
}
catch
(
e
)
{
console
.
info
(
'
[testVerifyVersion05] catch
'
+
e
);
}
console
.
info
(
'
[verifyVersion] success.
'
);
console
.
info
(
'
testVerifyVersion05 END
'
);
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录