Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
266fd36f
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看板
提交
266fd36f
编写于
10月 24, 2022
作者:
Z
zwx1016320
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add request API and screenlock
Signed-off-by:
N
zwx1016320
<
zhangyushuai1@huawei-partners.com
>
上级
7f1b16a9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
424 addition
and
1 deletion
+424
-1
request/RequestTest_ets/entry/src/main/ets/TestAbility/app.ets
...st/RequestTest_ets/entry/src/main/ets/TestAbility/app.ets
+1
-1
request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets
...Test_ets/entry/src/main/ets/test/requestDownload.test.ets
+308
-0
request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets
...stTest_ets/entry/src/main/ets/test/requestUpload.test.ets
+62
-0
theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
...screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
+53
-0
未找到文件。
request/RequestTest_ets/entry/src/main/ets/TestAbility/app.ets
浏览文件 @
266fd36f
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '
hypium/index
'
import { Hypium } from '
@ohos/hypium
'
import testsuite from '../test/List.test'
export default {
...
...
request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
266fd36f
...
...
@@ -673,5 +673,313 @@ export default function requestDownloadJSUnit() {
done();
});
/**
* @tc.number SUB_REQUEST_DOWNLOAD_API_DELETE_0001
* @tc.desc Delete the download task.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_DOWNLOAD_API_DELETE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_delete_0001 is starting-----------------------");
try {
request.download(downloadConfig, (data) => {
downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DELETE_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true);
downloadTask.delete((err, data) => {
if (err) {
console.error('SUB_REQUEST_DOWNLOAD_API_DELETE_0001 Failed to delete the download task.');
expect().assertFail();
}
console.info('SUB_REQUEST_DOWNLOAD_API_DELETE_0001 Download task delete success.');
expect(typeof data == "boolean").assertTrue();
});
})
} catch (error) {
console.error('SUB_REQUEST_DOWNLOAD_API_DELETE_0001 delete catch error' + error);
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DELETE_0001 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_DOWNLOAD_API_DELETE_0002
* @tc.desc Delete the download task.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_DOWNLOAD_API_DELETE_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DELETE_0002 is starting-----------------------");
try {
request.download(downloadConfig, (data) => {
downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_DELETE_0002 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true);
downloadTask.delete().then(data => {
console.info('SUB_REQUEST_DOWNLOAD_API_DELETE_0002 Download task delete success.');
expect(data == true).assertTrue();
}).catch((err) => {
console.info('SUB_REQUEST_DOWNLOAD_API_DELETE_0002 Failed to delete the download task.');
expect().assertFail();
})
})
} catch (error) {
console.error('SUB_REQUEST_DOWNLOAD_API_DELETE_0002 delete catch error');
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DELETE_0002 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001
* @tc.desc Suspend the download task
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 is starting-----------------------");
try {
request.download(downloadConfig, (data) => {
downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true);
downloadTask.suspend((err, data) => {
if (err) {
console.error('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 Failed to suspend the download task.');
expect().assertFail();
}
console.info('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 Download task suspend success.');
expect(data == true).assertTrue();
});
})
}
catch(error) {
console.error('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 suspend catch error' + error);
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002
* @tc.desc Suspend the download task
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002 is starting-----------------------");
try {
request.download(downloadConfig, (data) => {
downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true);
downloadTask.suspend().then(data => {
console.info('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 Download task suspend success.');
expect(data == true).assertTrue();
}).catch((err) => {
console.info('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002 Failed to suspend the download task.');
expect().assertFail();
})
})
}
catch(error){
console.error('SUB_REQUEST_DOWNLOAD_API_SUSPEND_0001 suspend catch error' + error);
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_SUSPEND_0002 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_DOWNLOAD_API_RESTORE_0001
* @tc.desc Restore the download task
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 is starting-----------------------");
try{
request.download(downloadConfig, (data) => {
downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true);
downloadTask.restore((err, data) => {
if (err) {
console.error('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 Failed to restore the download task.');
expect().assertFail();
}
console.info('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 Download restore success.');
expect(data == true).assertTrue();
});
});
}catch(error){
console.error('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 restore catch error' + error);
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_DOWNLOAD_API_RESTORE_0002
* @tc.desc Restore the download task
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_DOWNLOAD_API_RESTORE_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 is starting-----------------------");
try{
request.download(downloadConfig, (data) => {
downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true);
downloadTask.restore().then(data => {
console.info('SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 Download task restore.');
expect(data == true).assertTrue();
}).catch((err) => {
console.info('SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 Failed to restore the download task.');
expect().assertFail();
});
});
}catch(error){
console.error('SUB_REQUEST_DOWNLOAD_API_RESTORE_0001 restore catch error' + error);
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_RESTORE_0002 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001
* @tc.desc Get the download task info
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001', 0, async function (done) {
console.info("---------------------SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 is starting---------------------");
try{
request.download(downloadConfig, (data) => {
downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true);
downloadTask.getTaskInfo((err, data) => {
if (err) {
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 Failed to getTaskInfo the download task.');
expect().assertFail();
}
console.info('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 Download getTaskInfo success.');
expect(typeof data == "object").assertTrue();
});
});
}catch(error){
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 getTaskInfo catch error' + error);
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002
* @tc.desc Get the download task info
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002', 0, async function (done) {
console.info("-------------------SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 is starting----------------------");
try{
request.download(downloadConfig, (data) => {
downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true);
downloadTask.getTaskInfo().then(data => {
console.info('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 Download task getTaskInfo success.');
expect(typeof data == "object").assertTrue();
}).catch((err) => {
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 Failed to getTaskInfo the download task.');
expect().assertFail();
});
});
}catch(error){
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0001 getTaskInfo catch error' + error);
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_GETTASKINFO_0002 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001
* @tc.desc Get mimetype of the download task
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001', 0, async function (done) {
console.info("---------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 is starting---------------------");
try{
request.download(downloadConfig, (data) => {
downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true);
downloadTask.getTaskMimeType((err, data) => {
if (err) {
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 Failed to getTaskMimeType the download task.');
expect().assertFail();
}
console.info('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 Download task getTaskMimeType success.');
expect(typeof data == "string").assertTrue();
});
});
}catch(error){
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 getTaskMimeType catch error' + error);
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002
* @tc.desc Get mimetype of the download task
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002', 0, async function (done) {
console.info("-------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 is starting----------------------");
try{
request.download(downloadConfig, (data) => {
downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 downloadTask: " + downloadTask);
expect(downloadTask != undefined).assertEqual(true);
downloadTask.getTaskMimeType().then(data => {
console.info('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 Download getTaskMimeType success.');
expect(typeof data == "string").assertTrue();
}).catch((err) => {
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 Failed to getTaskMimeType the download task.');
expect().assertFail();
});
});
}catch(error){
console.error('SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0001 getTaskMimeType catch error' + error);
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_GETTASKMIMETYPE_0002 end-----------------------");
done();
});
})
}
request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets
浏览文件 @
266fd36f
...
...
@@ -376,5 +376,67 @@ export default function requestUploadJSUnit() {
done();
});
/**
* @tc.number SUB_REQUEST_UPLOAD_API_DELETE_0001
* @tc.desc Delete the upload task.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_UPLOAD_API_DELETE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0001 is starting-----------------------");
try {
request.upload(uploadConfig, (data) => {
uploadTask = data;
console.info("SUB_REQUEST_UPLOAD_API_DELETE_0001 uploadTask: " + uploadTask);
expect(uploadTask != undefined).assertEqual(true);
uploadTask.delete((err, data) => {
if (err) {
console.error('SUB_REQUEST_UPLOAD_API_DELETE_0001 Failed to delete the uploadTask task.');
expect().assertFail();
}
console.info('SUB_REQUEST_UPLOAD_API_DELETE_0001 uploadTask task delete success.');
expect(typeof data == "boolean").assertTrue();
});
})
} catch (error) {
console.error('SUB_REQUEST_UPLOAD_API_DELETE_0001 delete catch error' + error);
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0001 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_UPLOAD_API_DELETE_0002
* @tc.desc Delete the upload task.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_UPLOAD_API_DELETE_0002', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0002 is starting-----------------------");
try {
request.upload(uploadConfig, (data) => {
uploadTask = data;
console.info("SUB_REQUEST_UPLOAD_API_DELETE_0002 uploadTask: " + uploadTask);
expect(uploadTask != undefined).assertEqual(true);
uploadTask.delete().then(data => {
console.info('SUB_REQUEST_UPLOAD_API_DELETE_0002 uploadTask task delete success.');
expect(data == true).assertTrue();
}).catch((err) => {
console.info('SUB_REQUEST_UPLOAD_API_DELETE_0002 Failed to delete the uploadTask task.');
expect().assertFail();
})
})
} catch (error) {
console.error('SUB_REQUEST_UPLOAD_API_DELETE_0002 delete catch error');
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0002 end-----------------------");
done();
});
})
}
theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
浏览文件 @
266fd36f
...
...
@@ -33,6 +33,59 @@ export default function screenLockJSUnit() {
return;
}
}
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0012
* @tc.name Test unlock() to Unlocks the screen.
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_MISC_THEME_screenLock_API_0012', 0, async function (done) {
console.info('------------------SUB_MISC_THEME_screenLock_API_0012 start----------------------');
try{
screenLock.unlock((error, data) => {
if (error) {
console.error(`SUB_MISC_THEME_screenLock_API_0012 failed because: ` + JSON.stringify(error));
expect().assertFail();
done();
}
console.log(`SUB_MISC_THEME_screenLock_API_0012 success.`);
expect(true).assertTrue();
done();
});
}catch(err){
console.info('SUB_MISC_THEME_screenLock_API_0012 catch err : ' + JSON.stringify(err));
expect().assertFail();
done();
}
console.info('------------------SUB_MISC_THEME_screenLock_API_0012 end----------------------');
})
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0013
* @tc.name Test unlock() to Unlocks the screen.
* @tc.desc Function test
* @tc.level 0
*/
it('SUB_MISC_THEME_screenLock_API_0013', 0, async function (done) {
console.info('------------------SUB_MISC_THEME_screenLock_API_0013 start----------------------');
try{
screenLock.unlock().then((data) => {
console.log(`SUB_MISC_THEME_screenLock_API_0013 success.`);
expect(true).assertTrue();
done();
}).catch( err => {
console.error(`SUB_MISC_THEME_screenLock_API_0013 failed because: ` + JSON.stringify(err));
expect().assertFail();
done();
});
}catch(err){
console.info('SUB_MISC_THEME_screenLock_API_0013 catch err : ' + JSON.stringify(err));
expect().assertFail();
done();
}
console.info('------------------SUB_MISC_THEME_screenLock_API_0013 end----------------------');
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_0001
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录