Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9166edd8
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看板
提交
9166edd8
编写于
8月 11, 2021
作者:
O
openharmony_ci
提交者:
Gitee
8月 11, 2021
浏览文件
操作
浏览文件
下载
差异文件
!371 add cancle test cases
Merge pull request !371 from 马帅/master
上级
1a83fb2e
cd55826f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
224 addition
and
18 deletion
+224
-18
updater/update_test/gradle/entry/src/main/js/test/update.test.js
.../update_test/gradle/entry/src/main/js/test/update.test.js
+112
-9
updater/update_test/gradle/entry/src/ohosTest/js/test/update.test.js
...ate_test/gradle/entry/src/ohosTest/js/test/update.test.js
+112
-9
未找到文件。
updater/update_test/gradle/entry/src/main/js/test/update.test.js
浏览文件 @
9166edd8
...
...
@@ -47,12 +47,14 @@ var updateState = {
describe
(
'
updateclient
'
,
function
()
{
beforeAll
(
function
()
{
if
(
updater
==
undefined
)
{
updater
=
client
.
getUpdater
(
'
OTA
'
);
updater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
OTA
'
);
console
.
info
(
"
beforeAll updater
"
+
updater
);
}
});
beforeEach
(
function
()
{
if
(
updater
==
undefined
)
{
updater
=
client
.
getUpdater
(
'
OTA
'
);
updater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
OTA
'
);
console
.
info
(
"
beforeEach updater
"
+
updater
);
}
});
afterEach
(
function
()
{});
...
...
@@ -71,11 +73,6 @@ describe('updateclient', function() {
}
let
tmpUpdater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
OTA
'
);
expect
(
tmpUpdater
!=
undefined
);
if
(
tmpUpdater
==
undefined
)
{
console
.
error
(
"
Fail to get updater
"
);
return
;
}
}
catch
(
e
)
{
console
.
error
(
'
[testGetUpdate] fail.
'
+
e
);
}
...
...
@@ -97,6 +94,7 @@ describe('updateclient', function() {
return
;
}
let
tmpUpdater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
44444
'
);
console
.
info
(
"
testGetUpdate3 updater
"
+
tmpUpdater
);
expect
(
tmpUpdater
==
undefined
);
}
catch
(
e
)
{
console
.
error
(
'
[testGetUpdate] fail.
'
+
e
);
...
...
@@ -119,12 +117,13 @@ describe('updateclient', function() {
return
;
}
let
tmpUpdater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
patch
'
);
console
.
info
(
"
testGetUpdate3 updater
"
+
tmpUpdater
);
expect
(
tmpUpdater
!=
undefined
);
if
(
tmpUpdater
==
undefined
)
{
console
.
error
(
"
Fail to get updater
"
);
return
;
}
}
catch
(
e
)
{
console
.
error
(
'
[testGetUpdate] fail.
'
+
e
);
}
...
...
@@ -1709,4 +1708,108 @@ describe('updateclient', function() {
console
.
info
(
'
[testOffUpgrade5] success.
'
);
console
.
info
(
'
testOffUpgrade5 END
'
);
});
});
\ No newline at end of file
/**
* @tc.number SUB_UPDATE_JS_API_0076
* @tc.name testCancelDownload
* @tc.desc Test Cancel download.
*/
it
(
'
testCancelDownload
'
,
0
,
function
()
{
console
.
info
(
'
testCancelDownload START
'
);
try
{
let
ret
=
updater
.
cancel
();
console
.
info
(
'
updater.cancelUpgrade
'
+
ret
);
expect
(
ret
==
0
);
}
catch
(
e
)
{
console
.
info
(
'
[cancel] catch
'
+
e
);
}
console
.
info
(
'
[cancel] success.
'
);
console
.
info
(
'
testCancelDownload END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0077
* @tc.name testCancelDownload2
* @tc.desc Test Cancel download.
*/
it
(
'
testCancelDownload2
'
,
0
,
function
()
{
console
.
info
(
'
testCancelDownload2 START
'
);
try
{
// Open download monitor.
updater
.
on
(
'
downloadProgress
'
,
progress
=>
{
console
.
log
(
"
downloadProgress on
"
+
progress
);
console
.
log
(
`downloadProgress status: `
+
progress
.
status
);
console
.
log
(
`downloadProgress percent: `
+
progress
.
percent
);
console
.
log
(
`downloadProgress 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
(
"
downloadProgress
"
);
}
})
let
ret
=
updater
.
download
();
expect
(
ret
==
0
);
ret
=
updater
.
cancel
();
console
.
info
(
'
updater.cancel
'
+
ret
);
expect
(
ret
==
0
);
}
catch
(
e
)
{
console
.
info
(
'
[cancel] catch
'
+
e
);
}
console
.
info
(
'
[cancel] success.
'
);
console
.
info
(
'
testCancelDownload2 END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0078
* @tc.name testCancelDownload3
* @tc.desc Test Cancel download.
*/
it
(
'
testCancelDownload3
'
,
0
,
function
()
{
console
.
info
(
'
testCancelDownload3 START
'
);
try
{
let
ret
=
updater
.
cancel
();
console
.
info
(
'
updater.cancel
'
+
ret
);
expect
(
ret
==
0
);
}
catch
(
e
)
{
console
.
info
(
'
[cancel] catch
'
+
e
);
}
console
.
info
(
'
[cancel] success.
'
);
console
.
info
(
'
testCancelDownload3 END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0079
* @tc.name testCancelDownload4
* @tc.desc Test Cancel download.
*/
it
(
'
testCancelDownload4
'
,
0
,
function
()
{
console
.
info
(
'
testCancelDownload4 START
'
);
try
{
let
ret
=
updater
.
cancel
(
""
);
console
.
info
(
'
updater.cancel
'
+
ret
);
expect
(
ret
==
undefined
);
}
catch
(
e
)
{
console
.
info
(
'
[cancel] catch
'
+
e
);
}
console
.
info
(
'
[cancel] success.
'
);
console
.
info
(
'
testCancelDownload4 END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0080
* @tc.name testCancelDownload5
* @tc.desc Test Cancel download.
*/
it
(
'
testCancelDownload5
'
,
0
,
function
()
{
console
.
info
(
'
testCancelDownload5 START
'
);
try
{
let
ret
=
updater
.
cancel
(
function
(){});
console
.
info
(
'
updater.cancel
'
+
ret
);
expect
(
ret
==
undefined
);
}
catch
(
e
)
{
console
.
info
(
'
[cancel] catch
'
+
e
);
}
console
.
info
(
'
[cancelUpgrade] success.
'
);
console
.
info
(
'
testCancelDownload5 END
'
);
});
});
updater/update_test/gradle/entry/src/ohosTest/js/test/update.test.js
浏览文件 @
9166edd8
...
...
@@ -47,12 +47,14 @@ var updateState = {
describe
(
'
updateclient
'
,
function
()
{
beforeAll
(
function
()
{
if
(
updater
==
undefined
)
{
updater
=
client
.
getUpdater
(
'
OTA
'
);
updater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
OTA
'
);
console
.
info
(
"
beforeAll updater
"
+
updater
);
}
});
beforeEach
(
function
()
{
if
(
updater
==
undefined
)
{
updater
=
client
.
getUpdater
(
'
OTA
'
);
updater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
OTA
'
);
console
.
info
(
"
beforeEach updater
"
+
updater
);
}
});
afterEach
(
function
()
{});
...
...
@@ -71,11 +73,6 @@ describe('updateclient', function() {
}
let
tmpUpdater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
OTA
'
);
expect
(
tmpUpdater
!=
undefined
);
if
(
tmpUpdater
==
undefined
)
{
console
.
error
(
"
Fail to get updater
"
);
return
;
}
}
catch
(
e
)
{
console
.
error
(
'
[testGetUpdate] fail.
'
+
e
);
}
...
...
@@ -97,6 +94,7 @@ describe('updateclient', function() {
return
;
}
let
tmpUpdater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
44444
'
);
console
.
info
(
"
testGetUpdate3 updater
"
+
tmpUpdater
);
expect
(
tmpUpdater
==
undefined
);
}
catch
(
e
)
{
console
.
error
(
'
[testGetUpdate] fail.
'
+
e
);
...
...
@@ -119,12 +117,13 @@ describe('updateclient', function() {
return
;
}
let
tmpUpdater
=
client
.
getUpdater
(
'
/data/updater/updater.zip
'
,
'
patch
'
);
console
.
info
(
"
testGetUpdate3 updater
"
+
tmpUpdater
);
expect
(
tmpUpdater
!=
undefined
);
if
(
tmpUpdater
==
undefined
)
{
console
.
error
(
"
Fail to get updater
"
);
return
;
}
}
catch
(
e
)
{
console
.
error
(
'
[testGetUpdate] fail.
'
+
e
);
}
...
...
@@ -1709,4 +1708,108 @@ describe('updateclient', function() {
console
.
info
(
'
[testOffUpgrade5] success.
'
);
console
.
info
(
'
testOffUpgrade5 END
'
);
});
});
\ No newline at end of file
/**
* @tc.number SUB_UPDATE_JS_API_0076
* @tc.name testCancelDownload
* @tc.desc Test Cancel download.
*/
it
(
'
testCancelDownload
'
,
0
,
function
()
{
console
.
info
(
'
testCancelDownload START
'
);
try
{
let
ret
=
updater
.
cancel
();
console
.
info
(
'
updater.cancelUpgrade
'
+
ret
);
expect
(
ret
==
0
);
}
catch
(
e
)
{
console
.
info
(
'
[cancel] catch
'
+
e
);
}
console
.
info
(
'
[cancel] success.
'
);
console
.
info
(
'
testCancelDownload END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0077
* @tc.name testCancelDownload2
* @tc.desc Test Cancel download.
*/
it
(
'
testCancelDownload2
'
,
0
,
function
()
{
console
.
info
(
'
testCancelDownload2 START
'
);
try
{
// Open download monitor.
updater
.
on
(
'
downloadProgress
'
,
progress
=>
{
console
.
log
(
"
downloadProgress on
"
+
progress
);
console
.
log
(
`downloadProgress status: `
+
progress
.
status
);
console
.
log
(
`downloadProgress percent: `
+
progress
.
percent
);
console
.
log
(
`downloadProgress 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
(
"
downloadProgress
"
);
}
})
let
ret
=
updater
.
download
();
expect
(
ret
==
0
);
ret
=
updater
.
cancel
();
console
.
info
(
'
updater.cancel
'
+
ret
);
expect
(
ret
==
0
);
}
catch
(
e
)
{
console
.
info
(
'
[cancel] catch
'
+
e
);
}
console
.
info
(
'
[cancel] success.
'
);
console
.
info
(
'
testCancelDownload2 END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0078
* @tc.name testCancelDownload3
* @tc.desc Test Cancel download.
*/
it
(
'
testCancelDownload3
'
,
0
,
function
()
{
console
.
info
(
'
testCancelDownload3 START
'
);
try
{
let
ret
=
updater
.
cancel
();
console
.
info
(
'
updater.cancel
'
+
ret
);
expect
(
ret
==
0
);
}
catch
(
e
)
{
console
.
info
(
'
[cancel] catch
'
+
e
);
}
console
.
info
(
'
[cancel] success.
'
);
console
.
info
(
'
testCancelDownload3 END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0079
* @tc.name testCancelDownload4
* @tc.desc Test Cancel download.
*/
it
(
'
testCancelDownload4
'
,
0
,
function
()
{
console
.
info
(
'
testCancelDownload4 START
'
);
try
{
let
ret
=
updater
.
cancel
(
""
);
console
.
info
(
'
updater.cancel
'
+
ret
);
expect
(
ret
==
undefined
);
}
catch
(
e
)
{
console
.
info
(
'
[cancel] catch
'
+
e
);
}
console
.
info
(
'
[cancel] success.
'
);
console
.
info
(
'
testCancelDownload4 END
'
);
});
/**
* @tc.number SUB_UPDATE_JS_API_0080
* @tc.name testCancelDownload5
* @tc.desc Test Cancel download.
*/
it
(
'
testCancelDownload5
'
,
0
,
function
()
{
console
.
info
(
'
testCancelDownload5 START
'
);
try
{
let
ret
=
updater
.
cancel
(
function
(){});
console
.
info
(
'
updater.cancel
'
+
ret
);
expect
(
ret
==
undefined
);
}
catch
(
e
)
{
console
.
info
(
'
[cancel] catch
'
+
e
);
}
console
.
info
(
'
[cancelUpgrade] success.
'
);
console
.
info
(
'
testCancelDownload5 END
'
);
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录