Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4645da2b
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看板
未验证
提交
4645da2b
编写于
1月 31, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 31, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7310 【Misc】request接口删除和systemTimer用例优化
Merge pull request !7310 from 何海涛/MISC_0129
上级
c4e53c48
10da7afb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
290 deletion
+46
-290
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
...st_Stage/entry/src/main/ets/test/requestDownload.test.ets
+1
-75
request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets
...Test_Stage/entry/src/main/ets/test/requestUpload.test.ets
+2
-199
time/timeTest/entry/src/main/ets/test/systemTimer.test.ets
time/timeTest/entry/src/main/ets/test/systemTimer.test.ets
+43
-16
未找到文件。
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
4645da2b
...
@@ -50,81 +50,7 @@ export default function requestDownloadJSUnit() {
...
@@ -50,81 +50,7 @@ export default function requestDownloadJSUnit() {
});
});
let downloadTask;
let downloadTask;
/**
* @tc.number SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001
* @tc.desc Starts a download session.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001', 0, async function (done) {
console.info("====>------------------SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 is starting-----------------------");
let downloadFilePath = `${globalThis.abilityContext.tempDir}/SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001.txt`
console.debug("====>downloadFileConfig:" + `${globalThis.abilityContext.tempDir}/SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001.txt`)
let downloadConfig = {
url: 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png',
header: {
headers: 'http'
},
enableMetered: false,
enableRoaming: false,
description: 'XTS download test!',
networkType: request.NETWORK_WIFI,
filePath: downloadFilePath,
title: 'XTS download test!',
background: false
}
request.download(globalThis.abilityContext, downloadConfig, async (err, data)=>{
downloadTask = data;
console.info("====>SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 downloadTask: " + downloadTask);
try {
expect(true).assertEqual(downloadTask != undefined);
await downloadTask.delete()
} catch (err) {
console.info("====>SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 error: " + err);
}
done();
});
});
/**
* @tc.number SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001
* @tc.desc Starts a download session.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001', 0, async function (done) {
console.info("====>------------------SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 is starting-----------------------");
let downloadFilePath = `${globalThis.abilityContext.tempDir}/SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001.txt`
console.debug("====>downloadFileConfig:" + `${globalThis.abilityContext.tempDir}/SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001.txt`)
let downloadConfig = {
url: 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png',
header: {
headers: 'http'
},
enableMetered: false,
enableRoaming: false,
description: 'XTS download test!',
networkType: request.NETWORK_WIFI,
filePath: downloadFilePath,
title: 'XTS download test!',
background: false
}
request.download(globalThis.abilityContext, downloadConfig).then(async (data) => {
downloadTask = data;
console.info("====>SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 downloadTask: " + downloadTask);
expect(true).assertEqual(downloadTask != undefined);
await downloadTask.delete()
done();
}).catch(err => {
console.info("====>SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 error: " + err);
done();
})
});
/**
/**
* @tc.number SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001
* @tc.number SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001
* @tc.desc Starts a download session.
* @tc.desc Starts a download session.
...
...
request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets
浏览文件 @
4645da2b
...
@@ -77,205 +77,8 @@ export default function requestUploadJSUnit() {
...
@@ -77,205 +77,8 @@ export default function requestUploadJSUnit() {
method: 'POST',
method: 'POST',
files: [File],
files: [File],
data: [RequestData]
data: [RequestData]
};
};
/**
* @tc.number SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001
* @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME
* @tc.desc Test requestUploadTest API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001', 0, async function (done) {
console.info("====>------------------SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 is starting-----------------------");
try {
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 uploadConfig = " + JSON.stringify(uploadConfig));
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
request.upload(globalThis.abilityContext, uploadConfig, (err, data) => {
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask));
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 progress uploadTask =" + uploadTask);
expect(true).assertEqual(uploadTask != undefined);
uploadTask.on('progress', function (data1, data2) {
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 on data1 =" + data1);
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 on data2 =" + data2);
});
uploadTask.off('progress', function (data1, data2) {
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 off data1 =" + data1);
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 off data2 =" + data2);
});
uploadTask.remove((err, data) => {
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 remove =" + data);
});
});
} catch (err) {
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 error: " + err);
}
setTimeout(()=>{
console.info("====>------------------SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 end-----------------------");
done();
}, 10000)
});
/*
* @tc.number : SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001
* @tc.name : Use getEntries get the value by mixing the string key
* @tc.desc : Mixed strings value can be obtained correctly
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001', 0, async function (done) {
console.info("====>------------------SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 is starting-----------------------");
try {
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 UploadConfig = " + JSON.stringify(uploadConfig));
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
request.upload(globalThis.abilityContext, uploadConfig).then((data) => {
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 uploadTask = " + uploadTask);
expect(true).assertEqual(uploadTask != undefined);
uploadTask.on('headerReceive', (header) => {
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 header = " + header);
expect(true).assertEqual((header != undefined) || (header != "") || (header != {}));
});
uploadTask.off('headerReceive', (header) => {
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 header = " + header);
expect(true).assertEqual((header != undefined) || (header != "") || (header != {}));
});
uploadTask.remove().then((result)=>{
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 remove result = " + result);
expect(result).assertEqual(true);
});
});
} catch (e) {
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 error: " + JSON.stringify(e));
}
setTimeout(()=>{
console.info("====>------------------SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 end-----------------------");
done();
}, 10000)
});
/**
* @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0002
* @tc.name : Use getEntries get the value by mixing the string key
* @tc.desc : Called when the current upload session complete or fail.
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_REQUEST_UPLOAD_API_PROMISE_0002', 0, async function (done) {
console.info("====>------------------SUB_REQUEST_UPLOAD_API_PROMISE_0002 is starting-----------------------");
try {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 UploadConfig = " + JSON.stringify(uploadConfig));
request.upload(globalThis.abilityContext, uploadConfig).then((data) => {
try{
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {}));
uploadTask.on('complete', (TaskState) => {
for(let i = 0; i < TaskState.length; i++){
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 complete TaskState = " + JSON.stringify(TaskState[i]))
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 complete TaskState.path = " + TaskState[i].path);
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 complete TaskState.responseCode = " + TaskState[i].responseCode);
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 complete TaskState.TaskState.message = " + TaskState[i].message);
expect(typeof(TaskState[i].path) == "string").assertEqual(true);
expect(typeof(TaskState[i].responseCode) == "number").assertEqual(true);
expect(typeof(TaskState[i].message) == "string").assertEqual(true);
}
done();
});
uploadTask.on('fail', (TaskState) => {
for(let i = 0; i < TaskState.length; i++){
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 fail TaskState = " + JSON.stringify(TaskState[i]))
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 fail TaskState.path = " + TaskState[i].path);
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 fail TaskState.responseCode = " + TaskState[i].responseCode);
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 fail TaskState.TaskState.message = " + TaskState[i].message);
expect(typeof(TaskState[i].path) == "string").assertEqual(true);
expect(typeof(TaskState[i].responseCode) == "number").assertEqual(true);
expect(typeof(TaskState[i].message) == "string").assertEqual(true);
}
expect(true).assertEqual(true);
});
}catch(err){
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 error: " + JSON.stringify(err));
expect(true).assertFail(true);
}
}).catch((err)=>{
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 error: " + JSON.stringify(err));
expect(true).assertFail(true);
})
} catch (e) {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0002 throw_error: " + JSON.stringify(e));
expect(true).assertFail(true);
}
setTimeout(()=>{
console.info("====>------------------SUB_REQUEST_UPLOAD_API_PROMISE_0002 end-----------------------");
done();
}, 10000)
});
/**
* @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0003
* @tc.name : Use getEntries get the value by mixing the string key
* @tc.desc : Called when the current upload session complete or fail.
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_REQUEST_UPLOAD_API_PROMISE_0003', 0, async function (done) {
console.info("====>------------------SUB_REQUEST_UPLOAD_API_PROMISE_0003 is starting-----------------------");
try {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 UploadConfig = " + JSON.stringify(uploadConfig));
request.upload(globalThis.abilityContext, uploadConfig).then((data) => {
try{
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 uploadTask = " + uploadTask);
expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {}));
uploadTask.off('complete', () => {
try{
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 TaskState success");
expect(true).assertEqual(true);
}catch(err){
console.debug("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 complete err"+ JSON.stringify(err));
done();
}
});
uploadTask.off('fail', () => {
try{
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 TaskState success");
expect(true).assertEqual(true);
}catch(err){
console.debug("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 fail err" + JSON.stringify(err));
done();
}
});
}catch(err){
expect().assertFail();
done();
}
});
} catch (e) {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 error: " + JSON.stringify(e));
expect(true).assertFail(true);
}
setTimeout(()=>{
console.info("====>------------------SUB_REQUEST_UPLOAD_API_PROMISE_0003 end-----------------------");
done();
}, 10000)
});
/**
/**
* @tc.number SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001
* @tc.number SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001
* @tc.desc Starts a upload task.
* @tc.desc Starts a upload task.
...
...
time/timeTest/entry/src/main/ets/test/systemTimer.test.ets
浏览文件 @
4645da2b
...
@@ -91,7 +91,7 @@ export default function systemTimerTest() {
...
@@ -91,7 +91,7 @@ export default function systemTimerTest() {
repeat: false
repeat: false
};
};
console.info('====>SUB_time_systemTimer_createTimer_0000 create timer.');
console.info('====>SUB_time_systemTimer_createTimer_0000 create timer.');
systemTimer.createTimer(options,
function (err, timerID)
{
systemTimer.createTimer(options,
async (err, timerID) =>
{
try {
try {
if (err) {
if (err) {
console.info('====>SUB_time_systemTimer_createTimer_0000 create fail: ' + err);
console.info('====>SUB_time_systemTimer_createTimer_0000 create fail: ' + err);
...
@@ -100,6 +100,7 @@ export default function systemTimerTest() {
...
@@ -100,6 +100,7 @@ export default function systemTimerTest() {
}
}
console.info('====>SUB_time_systemTimer_createTimer_0000 timerID: ' + timerID);
console.info('====>SUB_time_systemTimer_createTimer_0000 timerID: ' + timerID);
expect(Number.isInteger(timerID)).assertTrue();
expect(Number.isInteger(timerID)).assertTrue();
await systemTimer.destroyTimer(timerID)
done();
done();
} catch (error) {
} catch (error) {
console.info('====>SUB_time_systemTimer_createTimer_0000 catch err ' + error);
console.info('====>SUB_time_systemTimer_createTimer_0000 catch err ' + error);
...
@@ -124,7 +125,7 @@ export default function systemTimerTest() {
...
@@ -124,7 +125,7 @@ export default function systemTimerTest() {
repeat: false
repeat: false
};
};
console.info('====>SUB_time_systemTimer_createTimer_0001 create timer.');
console.info('====>SUB_time_systemTimer_createTimer_0001 create timer.');
systemTimer.createTimer(options,
function (err, timerID)
{
systemTimer.createTimer(options,
async (err, timerID) =>
{
try {
try {
if (err) {
if (err) {
console.info('====>SUB_time_systemTimer_createTimer_0001 create fail: ' + err);
console.info('====>SUB_time_systemTimer_createTimer_0001 create fail: ' + err);
...
@@ -133,6 +134,7 @@ export default function systemTimerTest() {
...
@@ -133,6 +134,7 @@ export default function systemTimerTest() {
}
}
console.info('====>SUB_time_systemTimer_createTimer_0001 timerID: ' + timerID);
console.info('====>SUB_time_systemTimer_createTimer_0001 timerID: ' + timerID);
expect(Number.isInteger(timerID)).assertTrue();
expect(Number.isInteger(timerID)).assertTrue();
await systemTimer.destroyTimer(timerID)
done();
done();
} catch (error) {
} catch (error) {
console.info('====>SUB_time_systemTimer_createTimer_0001 catch err ' + error);
console.info('====>SUB_time_systemTimer_createTimer_0001 catch err ' + error);
...
@@ -162,7 +164,7 @@ export default function systemTimerTest() {
...
@@ -162,7 +164,7 @@ export default function systemTimerTest() {
interval: interval_time
interval: interval_time
};
};
console.info('====>SUB_time_systemTimer_createTimer_0002 create timer.');
console.info('====>SUB_time_systemTimer_createTimer_0002 create timer.');
systemTimer.createTimer(options,
function (err, timerID)
{
systemTimer.createTimer(options,
async (err, timerID) =>
{
try {
try {
if (err) {
if (err) {
console.info('====>SUB_time_systemTimer_createTimer_0002 create fail: ' + err);
console.info('====>SUB_time_systemTimer_createTimer_0002 create fail: ' + err);
...
@@ -171,6 +173,7 @@ export default function systemTimerTest() {
...
@@ -171,6 +173,7 @@ export default function systemTimerTest() {
}
}
console.info('====>SUB_time_systemTimer_createTimer_0002 timerID: ' + timerID);
console.info('====>SUB_time_systemTimer_createTimer_0002 timerID: ' + timerID);
expect(Number.isInteger(timerID)).assertTrue();
expect(Number.isInteger(timerID)).assertTrue();
await systemTimer.destroyTimer(timerID)
done();
done();
} catch (error) {
} catch (error) {
console.info('====>SUB_time_systemTimer_createTimer_0002 catch err ' + error);
console.info('====>SUB_time_systemTimer_createTimer_0002 catch err ' + error);
...
@@ -195,7 +198,7 @@ export default function systemTimerTest() {
...
@@ -195,7 +198,7 @@ export default function systemTimerTest() {
repeat: false
repeat: false
};
};
console.info('====>SUB_time_systemTimer_createTimer_0003 create timer.');
console.info('====>SUB_time_systemTimer_createTimer_0003 create timer.');
systemTimer.createTimer(options,
function (err, timerID)
{
systemTimer.createTimer(options,
async (err, timerID) =>
{
try {
try {
if (err) {
if (err) {
console.info('====>SUB_time_systemTimer_createTimer_0003 create fail: ' + err);
console.info('====>SUB_time_systemTimer_createTimer_0003 create fail: ' + err);
...
@@ -204,6 +207,7 @@ export default function systemTimerTest() {
...
@@ -204,6 +207,7 @@ export default function systemTimerTest() {
}
}
console.info('====>SUB_time_systemTimer_createTimer_0003 timerID: ' + timerID);
console.info('====>SUB_time_systemTimer_createTimer_0003 timerID: ' + timerID);
expect(Number.isInteger(timerID)).assertTrue();
expect(Number.isInteger(timerID)).assertTrue();
await systemTimer.destroyTimer(timerID)
done();
done();
} catch (error) {
} catch (error) {
console.info('====>SUB_time_systemTimer_createTimer_0003 catch err ' + error);
console.info('====>SUB_time_systemTimer_createTimer_0003 catch err ' + error);
...
@@ -233,7 +237,7 @@ export default function systemTimerTest() {
...
@@ -233,7 +237,7 @@ export default function systemTimerTest() {
interval: interval_time
interval: interval_time
};
};
console.info('====>SUB_time_systemTimer_createTimer_0004 create timer.');
console.info('====>SUB_time_systemTimer_createTimer_0004 create timer.');
systemTimer.createTimer(options,
function (err, timerID)
{
systemTimer.createTimer(options,
async (err, timerID) =>
{
try {
try {
if (err) {
if (err) {
console.info('====>SUB_time_systemTimer_createTimer_0004 create fail: ' + err);
console.info('====>SUB_time_systemTimer_createTimer_0004 create fail: ' + err);
...
@@ -242,6 +246,7 @@ export default function systemTimerTest() {
...
@@ -242,6 +246,7 @@ export default function systemTimerTest() {
}
}
console.info('====>SUB_time_systemTimer_createTimer_0004 timerID: ' + timerID);
console.info('====>SUB_time_systemTimer_createTimer_0004 timerID: ' + timerID);
expect(Number.isInteger(timerID)).assertTrue();
expect(Number.isInteger(timerID)).assertTrue();
await systemTimer.destroyTimer(timerID)
done();
done();
} catch (error) {
} catch (error) {
console.info('====>SUB_time_systemTimer_createTimer_0004 catch err ' + error);
console.info('====>SUB_time_systemTimer_createTimer_0004 catch err ' + error);
...
@@ -265,16 +270,19 @@ export default function systemTimerTest() {
...
@@ -265,16 +270,19 @@ export default function systemTimerTest() {
type: systemTimer.TIMER_TYPE_REALTIME,
type: systemTimer.TIMER_TYPE_REALTIME,
repeat: false
repeat: false
};
};
let globalTimerID;
await systemTimer.createTimer(options).then((timerID) => {
await systemTimer.createTimer(options).then((timerID) => {
console.info('====>SUB_time_systemTimer_createTimer_0005 timerID: ' + timerID);
console.info('====>SUB_time_systemTimer_createTimer_0005 timerID: ' + timerID);
globalTimerID = timerID;
expect(Number.isInteger(timerID)).assertTrue();
expect(Number.isInteger(timerID)).assertTrue();
done();
}).catch(err => {
}).catch(err => {
console.info('====>SUB_time_systemTimer_createTimer_0005 createTimer fail: ' + err);
console.info('====>SUB_time_systemTimer_createTimer_0005 createTimer fail: ' + err);
expect().assertTrue();
expect().assertTrue();
done();
done();
});
});
console.info('====>SUB_time_systemTimer_createTimer_0005 end.');
console.info('====>SUB_time_systemTimer_createTimer_0005 end.');
await systemTimer.destroyTimer(globalTimerID)
done();
});
});
/**
/**
...
@@ -291,16 +299,19 @@ export default function systemTimerTest() {
...
@@ -291,16 +299,19 @@ export default function systemTimerTest() {
type: systemTimer.TIMER_TYPE_IDLE,
type: systemTimer.TIMER_TYPE_IDLE,
repeat: false
repeat: false
};
};
let globalTimerID;
await systemTimer.createTimer(options).then((timerID) => {
await systemTimer.createTimer(options).then((timerID) => {
console.info('====>SUB_time_systemTimer_createTimer_0006 timerID: ' + timerID);
console.info('====>SUB_time_systemTimer_createTimer_0006 timerID: ' + timerID);
globalTimerID = timerID;
expect(Number.isInteger(timerID)).assertTrue();
expect(Number.isInteger(timerID)).assertTrue();
done();
}).catch(err => {
}).catch(err => {
console.info('====>SUB_time_systemTimer_createTimer_0006 createTimer fail: ' + err);
console.info('====>SUB_time_systemTimer_createTimer_0006 createTimer fail: ' + err);
expect().assertTrue();
expect().assertTrue();
done();
done();
});
});
console.info('====>SUB_time_systemTimer_createTimer_0006 end.');
console.info('====>SUB_time_systemTimer_createTimer_0006 end.');
await systemTimer.destroyTimer(globalTimerID)
done();
});
});
/**
/**
...
@@ -322,16 +333,19 @@ export default function systemTimerTest() {
...
@@ -322,16 +333,19 @@ export default function systemTimerTest() {
wantAgent: wantAgent,
wantAgent: wantAgent,
interval: interval_time
interval: interval_time
};
};
let globalTimerID;
await systemTimer.createTimer(options).then((timerID) => {
await systemTimer.createTimer(options).then((timerID) => {
console.info('====>SUB_time_systemTimer_createTimer_0007 timerID: ' + timerID);
console.info('====>SUB_time_systemTimer_createTimer_0007 timerID: ' + timerID);
globalTimerID = timerID;
expect(Number.isInteger(timerID)).assertTrue();
expect(Number.isInteger(timerID)).assertTrue();
done();
}).catch(err => {
}).catch(err => {
console.info('====>SUB_time_systemTimer_createTimer_0007 createTimer fail: ' + err);
console.info('====>SUB_time_systemTimer_createTimer_0007 createTimer fail: ' + err);
expect().assertTrue();
expect().assertTrue();
done();
done();
});
});
console.info('====>SUB_time_systemTimer_createTimer_0007 end.');
console.info('====>SUB_time_systemTimer_createTimer_0007 end.');
await systemTimer.destroyTimer(globalTimerID)
done();
});
});
/**
/**
...
@@ -348,16 +362,19 @@ export default function systemTimerTest() {
...
@@ -348,16 +362,19 @@ export default function systemTimerTest() {
type: systemTimer.TIMER_TYPE_EXACT,
type: systemTimer.TIMER_TYPE_EXACT,
repeat: false
repeat: false
};
};
let globalTimerID;
await systemTimer.createTimer(options).then((timerID) => {
await systemTimer.createTimer(options).then((timerID) => {
console.info('====>SUB_time_systemTimer_createTimer_0008 timerID: ' + timerID);
console.info('====>SUB_time_systemTimer_createTimer_0008 timerID: ' + timerID);
globalTimerID = timerID;
expect(Number.isInteger(timerID)).assertTrue();
expect(Number.isInteger(timerID)).assertTrue();
done();
}).catch(err => {
}).catch(err => {
console.info('====>SUB_time_systemTimer_createTimer_0008 createTimer fail: ' + err);
console.info('====>SUB_time_systemTimer_createTimer_0008 createTimer fail: ' + err);
expect().assertTrue();
expect().assertTrue();
done();
done();
});
});
console.info('====>SUB_time_systemTimer_createTimer_0008 end.');
console.info('====>SUB_time_systemTimer_createTimer_0008 end.');
await systemTimer.destroyTimer(globalTimerID)
done();
});
});
/**
/**
...
@@ -379,16 +396,19 @@ export default function systemTimerTest() {
...
@@ -379,16 +396,19 @@ export default function systemTimerTest() {
wantAgent: wantAgent,
wantAgent: wantAgent,
interval: interval_time
interval: interval_time
};
};
let globalTimerID;
await systemTimer.createTimer(options).then((timerID) => {
await systemTimer.createTimer(options).then((timerID) => {
console.info('====>SUB_time_systemTimer_createTimer_0009 timerID: ' + timerID);
console.info('====>SUB_time_systemTimer_createTimer_0009 timerID: ' + timerID);
globalTimerID = timerID;
expect(Number.isInteger(timerID)).assertTrue();
expect(Number.isInteger(timerID)).assertTrue();
done();
}).catch(err => {
}).catch(err => {
console.info('====>SUB_time_systemTimer_createTimer_0009 createTimer fail: ' + err);
console.info('====>SUB_time_systemTimer_createTimer_0009 createTimer fail: ' + err);
expect().assertTrue();
expect().assertTrue();
done();
done();
});
});
console.info('====>SUB_time_systemTimer_createTimer_0009 end.');
console.info('====>SUB_time_systemTimer_createTimer_0009 end.');
await systemTimer.destroyTimer(globalTimerID)
done();
});
});
/**
/**
...
@@ -413,7 +433,7 @@ export default function systemTimerTest() {
...
@@ -413,7 +433,7 @@ export default function systemTimerTest() {
}).catch(err => {
}).catch(err => {
console.info('====>SUB_time_systemTimer_createTimer_0009 createTimer fail: ' + err);
console.info('====>SUB_time_systemTimer_createTimer_0009 createTimer fail: ' + err);
});
});
systemTimer.startTimer(globalTimerID, triggerTime,
function (err, data)
{
systemTimer.startTimer(globalTimerID, triggerTime,
async (err, data) =>
{
try {
try {
if (err) {
if (err) {
console.info('====>SUB_time_systemTimer_startTimer_0001 wrong since ' + err.code);
console.info('====>SUB_time_systemTimer_startTimer_0001 wrong since ' + err.code);
...
@@ -422,6 +442,7 @@ export default function systemTimerTest() {
...
@@ -422,6 +442,7 @@ export default function systemTimerTest() {
}
}
console.info("====>SUB_time_systemTimer_startTimer_0001 success to start timerID: " + globalTimerID);
console.info("====>SUB_time_systemTimer_startTimer_0001 success to start timerID: " + globalTimerID);
expect(true).assertTrue();
expect(true).assertTrue();
await systemTimer.destroyTimer(globalTimerID)
done();
done();
} catch (e) {
} catch (e) {
console.info('====>SUB_time_systemTimer_startTimer_0001 has failed for ' + e);
console.info('====>SUB_time_systemTimer_startTimer_0001 has failed for ' + e);
...
@@ -452,7 +473,7 @@ export default function systemTimerTest() {
...
@@ -452,7 +473,7 @@ export default function systemTimerTest() {
}).catch(err => {
}).catch(err => {
console.info('====>SUB_time_systemTimer_createTimer_0009 createTimer fail: ' + err);
console.info('====>SUB_time_systemTimer_createTimer_0009 createTimer fail: ' + err);
});
});
systemTimer.stopTimer(globalTimerID,
function (err, data)
{
systemTimer.stopTimer(globalTimerID,
async (err, data) =>
{
try {
try {
if (err) {
if (err) {
console.info("====>SUB_time_systemTimer_stopTimer_0001 stop fail timerID: " + globalTimerID);
console.info("====>SUB_time_systemTimer_stopTimer_0001 stop fail timerID: " + globalTimerID);
...
@@ -461,6 +482,7 @@ export default function systemTimerTest() {
...
@@ -461,6 +482,7 @@ export default function systemTimerTest() {
};
};
console.info("====>SUB_time_systemTimer_stopTimer_0001 success to stop timerID: " + globalTimerID);
console.info("====>SUB_time_systemTimer_stopTimer_0001 success to stop timerID: " + globalTimerID);
expect(true).assertTrue();
expect(true).assertTrue();
await systemTimer.destroyTimer(globalTimerID)
done();
done();
} catch (e) {
} catch (e) {
console.info('====>SUB_time_systemTimer_stopTimer_0001 has failed for ' + e);
console.info('====>SUB_time_systemTimer_stopTimer_0001 has failed for ' + e);
...
@@ -523,16 +545,19 @@ export default function systemTimerTest() {
...
@@ -523,16 +545,19 @@ export default function systemTimerTest() {
type: systemTimer.TIMER_TYPE_REALTIME,
type: systemTimer.TIMER_TYPE_REALTIME,
repeat: false
repeat: false
};
};
let globalTimerID;
console.info('====>SUB_time_systemTimer_createTimerPromise_0001 create timer.');
console.info('====>SUB_time_systemTimer_createTimerPromise_0001 create timer.');
await systemTimer.createTimer(options).then((timerID) => {
await systemTimer.createTimer(options).then((timerID) => {
console.info('====>SUB_time_systemTimer_createTimerPromise_0001 timerID:' + timerID);
console.info('====>SUB_time_systemTimer_createTimerPromise_0001 timerID:' + timerID);
globalTimerID = timerID;
expect(Number.isInteger(timerID)).assertTrue();
expect(Number.isInteger(timerID)).assertTrue();
done();
}).catch(error => {
}).catch(error => {
console.info('====>SUB_time_systemTimer_createTimerPromise_0001 failed to create timer: ' + error);
console.info('====>SUB_time_systemTimer_createTimerPromise_0001 failed to create timer: ' + error);
expect().assertTrue();
expect().assertTrue();
done();
done();
});
});
await systemTimer.destroyTimer(globalTimerID)
done();
});
});
/**
/**
...
@@ -560,13 +585,14 @@ export default function systemTimerTest() {
...
@@ -560,13 +585,14 @@ export default function systemTimerTest() {
await systemTimer.startTimer(globalTimerID, triggerTime).then(() => {
await systemTimer.startTimer(globalTimerID, triggerTime).then(() => {
console.info('====>SUB_time_systemTimer_startTimer_0002 timerID:' + globalTimerID);
console.info('====>SUB_time_systemTimer_startTimer_0002 timerID:' + globalTimerID);
expect(true).assertTrue();
expect(true).assertTrue();
done();
}).catch((err) => {
}).catch((err) => {
console.info('====>SUB_time_systemTimer_startTimer_0002 failed to start timer: ' + err);
console.info('====>SUB_time_systemTimer_startTimer_0002 failed to start timer: ' + err);
expect().assertTrue();
expect().assertTrue();
done();
done();
});
});
console.info('====>SUB_time_systemTimer_startTimer_0002 end.');
console.info('====>SUB_time_systemTimer_startTimer_0002 end.');
await systemTimer.destroyTimer(globalTimerID)
done();
});
});
/**
/**
...
@@ -593,13 +619,14 @@ export default function systemTimerTest() {
...
@@ -593,13 +619,14 @@ export default function systemTimerTest() {
await systemTimer.stopTimer(globalTimerID).then(() => {
await systemTimer.stopTimer(globalTimerID).then(() => {
console.info('====>SUB_time_systemTimer_stopTimer_0002 timerID:' + globalTimerID);
console.info('====>SUB_time_systemTimer_stopTimer_0002 timerID:' + globalTimerID);
expect(true).assertTrue();
expect(true).assertTrue();
done();
}).catch((err) => {
}).catch((err) => {
console.info('====>SUB_time_systemTimer_stopTimer_0002 failed to stop timer:' + err);
console.info('====>SUB_time_systemTimer_stopTimer_0002 failed to stop timer:' + err);
expect().assertTrue();
expect().assertTrue();
done();
done();
});
});
console.info('====>SUB_time_systemTimer_stopTimer_0002 end.');
console.info('====>SUB_time_systemTimer_stopTimer_0002 end.');
await systemTimer.destroyTimer(globalTimerID)
done();
});
});
/**
/**
...
@@ -663,7 +690,7 @@ export default function systemTimerTest() {
...
@@ -663,7 +690,7 @@ export default function systemTimerTest() {
try {
try {
systemTimer.stopTimer(timerID)
systemTimer.stopTimer(timerID)
.then(() => {
.then(() => {
systemTimer.destroyTimer(timerID,
function (err, data)
{
systemTimer.destroyTimer(timerID,
async (err, data) =>
{
console.info('====>SUB_time_systemTimer_ALL_Promise_0008 destroyTimer: ' + timerID);
console.info('====>SUB_time_systemTimer_ALL_Promise_0008 destroyTimer: ' + timerID);
done();
done();
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录