提交 01c9be2e 编写于 作者: 1 15829070344

【时间时区】setTime异常值处理

Signed-off-by: N15829070344 <hehaitao5@huawei.com>
Change-Id: I7b10522b80691bd63cd117f8ef3ea1799c9c9423
上级 3bd23b21
...@@ -19,7 +19,7 @@ import systemTime from "@ohos.systemTime"; ...@@ -19,7 +19,7 @@ import systemTime from "@ohos.systemTime";
export default function systemTimeJsunit() { export default function systemTimeJsunit() {
describe('systemTimeTest', function () { describe('systemTimeTest', function () {
console.info('--------------------systemTimeTest start-----------------------'); console.info('====>---------------systemTimeTest start-----------------------');
/** /**
* @tc.number SUB_systemTime_getCurrentTime_JS_API_0001 * @tc.number SUB_systemTime_getCurrentTime_JS_API_0001
* @tc.name Test systemTime.getCurrentTime * @tc.name Test systemTime.getCurrentTime
...@@ -29,7 +29,7 @@ export default function systemTimeJsunit() { ...@@ -29,7 +29,7 @@ export default function systemTimeJsunit() {
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it("SUB_systemTime_getCurrentTime_JS_API_0001", 0, async function (done) { it("SUB_systemTime_getCurrentTime_JS_API_0001", 0, async function (done) {
console.info("---------------UB_systemTime_getCurrentTime_JS_API_0001 start----------------"); console.info("====>----------UB_systemTime_getCurrentTime_JS_API_0001 start----------------");
systemTime.getCurrentTime(true, (error, data) => { systemTime.getCurrentTime(true, (error, data) => {
if (error) { if (error) {
console.error(`failed to systemTime.getCurrentTime because ` + JSON.stringify(error)); console.error(`failed to systemTime.getCurrentTime because ` + JSON.stringify(error));
...@@ -39,7 +39,7 @@ export default function systemTimeJsunit() { ...@@ -39,7 +39,7 @@ export default function systemTimeJsunit() {
expect(data != null).assertEqual(true); expect(data != null).assertEqual(true);
}); });
console.info("---------------SUB_systemTime_getRealActiveTime_JS_API_0100 end-----------------"); console.info("====>----------SUB_systemTime_getRealActiveTime_JS_API_0100 end-----------------");
done(); done();
}); });
...@@ -52,15 +52,15 @@ export default function systemTimeJsunit() { ...@@ -52,15 +52,15 @@ export default function systemTimeJsunit() {
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it("SUB_systemTime_getCurrentTime_JS_API_0002", 0, async function (done) { it("SUB_systemTime_getCurrentTime_JS_API_0002", 0, async function (done) {
console.info("----------SUB_systemTime_getCurrentTime_JS_API_0002 start----------------"); console.info("====>-----SUB_systemTime_getCurrentTime_JS_API_0002 start----------------");
systemTime.getCurrentTime(true).then((data) => { systemTime.getCurrentTime(true).then((data) => {
console.info(`systemTime.getCurrentTime promise success data : ` + JSON.stringify(data)); console.info(`SUB_systemTime_getCurrentTime_JS_API_0002 data : ` + JSON.stringify(data));
expect(data != null).assertEqual(true); expect(data != null).assertEqual(true);
}).catch(err => { }).catch(err => {
console.error(`failed to systemTime.getCurrentTime promise because ` + JSON.stringify(error)); console.error(`SUB_systemTime_getCurrentTime_JS_API_0002 err: ` + JSON.stringify(error));
expect().assertFail() expect().assertFail()
}); });
console.info("----------SUB_systemTime_getCurrentTime_JS_API_0002 end------------"); console.info("====>-----SUB_systemTime_getCurrentTime_JS_API_0002 end------------");
done(); done();
}); });
...@@ -73,17 +73,17 @@ export default function systemTimeJsunit() { ...@@ -73,17 +73,17 @@ export default function systemTimeJsunit() {
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it("SUB_systemTime_getRealActiveTime_JS_API_0001", 0, async function (done) { it("SUB_systemTime_getRealActiveTime_JS_API_0001", 0, async function (done) {
console.info("---------------SUB_systemTime_getRealActiveTime_JS_API_0001 start----------------"); console.info("====>----------SUB_systemTime_getRealActiveTime_JS_API_0001 start----------------");
systemTime.getRealActiveTime(true, (error, data) => { systemTime.getRealActiveTime(true, (error, data) => {
if (error) { if (error) {
console.error(`failed to systemTime.getRealActiveTime because ` + JSON.stringify(error)); console.error(`SUB_systemTime_getRealActiveTime_JS_API_0001 err: ` + JSON.stringify(error));
expect().assertFail() expect().assertFail()
}; };
console.info(`systemTime.getRealActiveTime success data : ` + JSON.stringify(data)); console.info(`SUB_systemTime_getRealActiveTime_JS_API_0001 data : ` + JSON.stringify(data));
expect(data != null).assertEqual(true); expect(data != null).assertEqual(true);
}); });
console.info("---------------SUB_systemTime_getRealActiveTime_JS_API_0001 end-----------------"); console.info("====>----------SUB_systemTime_getRealActiveTime_JS_API_0001 end-----------------");
done(); done();
}); });
...@@ -96,15 +96,15 @@ export default function systemTimeJsunit() { ...@@ -96,15 +96,15 @@ export default function systemTimeJsunit() {
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it("SUB_systemTime_getRealActiveTime_JS_API_0002", 0, async function (done) { it("SUB_systemTime_getRealActiveTime_JS_API_0002", 0, async function (done) {
console.info("----------SUB_systemTime_getRealActiveTime_JS_API_0002 start----------------"); console.info("====>-----SUB_systemTime_getRealActiveTime_JS_API_0002 start----------------");
systemTime.getRealActiveTime(true).then((data) => { systemTime.getRealActiveTime(true).then((data) => {
onsole.log(`systemTime.getRealActiveTime promise success data : ` + JSON.stringify(data)); onsole.log(`SUB_systemTime_getRealActiveTime_JS_API_0002 data : ` + JSON.stringify(data));
expect(data != null).assertEqual(true); expect(data != null).assertEqual(true);
}).catch(err => { }).catch(err => {
console.error(`failed to systemTime.getRealActiveTime promise because ` + JSON.stringify(error)); console.error(`SUB_systemTime_getRealActiveTime_JS_API_0002 err: ` + JSON.stringify(error));
expect().assertFail() expect().assertFail()
}); });
console.info("----------SUB_systemTime_getRealActiveTime_JS_API_0002 end------------"); console.info("====>-----SUB_systemTime_getRealActiveTime_JS_API_0002 end------------");
done(); done();
}); });
...@@ -117,17 +117,17 @@ export default function systemTimeJsunit() { ...@@ -117,17 +117,17 @@ export default function systemTimeJsunit() {
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it("SUB_systemTime_getRealTime_JS_API_0001", 0, async function (done) { it("SUB_systemTime_getRealTime_JS_API_0001", 0, async function (done) {
console.info("---------------SUB_systemTime_getRealTime_JS_API_0001 start----------------"); console.info("====>----------SUB_systemTime_getRealTime_JS_API_0001 start----------------");
systemTime.getRealTime(true, (error, data) => { systemTime.getRealTime(true, (error, data) => {
if (error) { if (error) {
console.error(`failed to systemTime.getRealTime because ` + JSON.stringify(error)); console.error(`SUB_systemTime_getRealTime_JS_API_0001 err: ` + JSON.stringify(error));
expect().assertFail() expect().assertFail()
}; };
console.info(`systemTime.getRealTime success data : ` + JSON.stringify(data)); console.info(`SUB_systemTime_getRealTime_JS_API_0001 data : ` + JSON.stringify(data));
expect(data != null).assertEqual(true); expect(data != null).assertEqual(true);
}); });
console.info("---------------SUB_systemTime_getRealTime_JS_API_0001 end-----------------"); console.info("====>----------SUB_systemTime_getRealTime_JS_API_0001 end-----------------");
done(); done();
}); });
...@@ -140,15 +140,15 @@ export default function systemTimeJsunit() { ...@@ -140,15 +140,15 @@ export default function systemTimeJsunit() {
* @tc.level : Level 1 * @tc.level : Level 1
*/ */
it("SUB_systemTime_getRealTime_JS_API_0002", 0, async function (done) { it("SUB_systemTime_getRealTime_JS_API_0002", 0, async function (done) {
console.info("----------SUB_systemTime_getRealTime_JS_API_0002 start----------------"); console.info("====>-----SUB_systemTime_getRealTime_JS_API_0002 start----------------");
systemTime.getRealTime(true).then((data) => { systemTime.getRealTime(true).then((data) => {
console.info(`systemTime.getRealTime promise success data : ` + JSON.stringify(data)); console.info(`SUB_systemTime_getRealTime_JS_API_0002 data : ` + JSON.stringify(data));
expect(data != null).assertEqual(true); expect(data != null).assertEqual(true);
}).catch(err => { }).catch(err => {
console.error(`failed to systemTime.getRealTime promise because ` + JSON.stringify(error)); console.error(`SUB_systemTime_getRealTime_JS_API_0002 err: ` + JSON.stringify(error));
expect().assertFail(); expect().assertFail();
}); });
console.info("----------SUB_systemTime_getRealTime_JS_API_0002 end------------"); console.info("====>-----SUB_systemTime_getRealTime_JS_API_0002 end------------");
done(); done();
}); });
...@@ -161,17 +161,17 @@ export default function systemTimeJsunit() { ...@@ -161,17 +161,17 @@ export default function systemTimeJsunit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_systemTime_setTime_JS_API_0100', 0, async function (done) { it('SUB_systemTime_setTime_JS_API_0100', 0, async function (done) {
console.info("SUB_systemTime_setTime_JS_API_0100 start"); console.info("====>SUB_systemTime_setTime_JS_API_0100 start");
systemTime.setTime(1526003846000) let currentTime = new Date().getTime() + 2000
.then(data =>{ try{
console.info("setTime ===data " + data); await systemTime.setTime(currentTime)
expect(data).assertEqual(true) expect(true).assertTrue();
}).catch(error => { done();
console.info("setTime ===error " + error); }catch(err){
expect(0).assertLarger(1) console.info("====>SUB_systemTime_setTime_JS_API_0100 error " + err);
}); expect().assertFail();
console.info('SUB_systemTime_setTime_JS_API_0100 end');
done(); done();
}
}); });
/** /**
...@@ -183,17 +183,23 @@ export default function systemTimeJsunit() { ...@@ -183,17 +183,23 @@ export default function systemTimeJsunit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_systemTime_setTime_JS_API_0200', 0, async function (done) { it('SUB_systemTime_setTime_JS_API_0200', 0, async function (done) {
console.info("SUB_systemTime_setTime_JS_API_0200 start"); console.info("====>SUB_systemTime_setTime_JS_API_0200 start");
systemTime.setTime(15222) try{
.then(data => { systemTime.setTime(15222).then(() => {
console.info("setTime ===data " + data); console.debug('SUB_systemTime_setTime_JS_API_0200 setTime fail')
expect().assertFail();
done();
}).catch((err)=>{
console.debug('SUB_systemTime_setTime_JS_API_0200 setTime err:' + JSON.stringify(err))
expect(true).assertTrue(); expect(true).assertTrue();
}).catch(error => { console.debug('SUB_systemTime_setTime_JS_API_0200 end');
console.info("setTime ===error " + error);
expect(0).assertLarger(1)
});
console.info('SUB_systemTime_setTime_JS_API_0200 end');
done(); done();
})
}catch(err){
console.debug('SUB_systemTime_setTime_JS_API_0200 setTime throw_err' + JSON.stringify(err))
expect(err.code).assertEqual('401');
done();
}
}); });
/** /**
...@@ -205,18 +211,19 @@ export default function systemTimeJsunit() { ...@@ -205,18 +211,19 @@ export default function systemTimeJsunit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_systemTime_setTime_JS_API_0300', 0, async function (done) { it('SUB_systemTime_setTime_JS_API_0300', 0, async function (done) {
console.info("SUB_systemTime_setTime_JS_API_0300 start"); console.info("====>SUB_systemTime_setTime_JS_API_0300 start");
systemTime.setTime(1597156246000, (err, data) => { let currentTime = new Date().getTime() + 2000
if (err) { systemTime.setTime(currentTime, (err) => {
console.info("setTime ===error: " + err); try{
expect().assertFail()
}else{
console.info("setTime ===data: " + data);
expect(true).assertTrue(); expect(true).assertTrue();
};
});
console.info('SUB_systemTime_setTime_JS_API_0300 end'); console.info('SUB_systemTime_setTime_JS_API_0300 end');
done(); done();
}catch(err){
console.info("====>SUB_systemTime_setTime_JS_API_0300 error: " + err);
expect().assertFail();
done();
}
});
}); });
/** /**
...@@ -228,11 +235,11 @@ export default function systemTimeJsunit() { ...@@ -228,11 +235,11 @@ export default function systemTimeJsunit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_systemTime_setTime_JS_API_0400', 0, async function (done) { it('SUB_systemTime_setTime_JS_API_0400', 0, async function (done) {
console.info("SUB_systemTime_setTime_JS_API_0400 start"); console.info("====>SUB_systemTime_setTime_JS_API_0400 start");
try{ try{
systemTime.setTime(18, (err, data) => { systemTime.setTime(18, (err, data) => {
console.info("setTime ===data: " + data); console.info("====>SUB_systemTime_setTime_JS_API_0400 data: " + data);
console.info("setTime ===error: " + err); console.info("====>SUB_systemTime_setTime_JS_API_0400 error: " + err);
expect(true).assertTrue(); expect(true).assertTrue();
})}catch(error) {error => { })}catch(error) {error => {
expect(1).assertLarger(0); expect(1).assertLarger(0);
...@@ -251,13 +258,13 @@ export default function systemTimeJsunit() { ...@@ -251,13 +258,13 @@ export default function systemTimeJsunit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_systemTime_setDate_JS_API_0100', 0, async function (done) { it('SUB_systemTime_setDate_JS_API_0100', 0, async function (done) {
console.info("SUB_systemTime_setDate_JS_API_0100 start"); console.info("====>SUB_systemTime_setDate_JS_API_0100 start");
var data = new Date("October 13, 2020 11:13:00"); var data = new Date("October 13, 2020 11:13:00");
systemTime.setDate(1).then(data => { systemTime.setDate(1).then(data => {
console.info("setTime ===data " + data); console.info("====>SUB_systemTime_setDate_JS_API_0100 data " + data);
expect(true).assertTrue(); expect(true).assertTrue();
}).catch(error => { }).catch(error => {
console.info("setTime ===error " + error); console.info("====>SUB_systemTime_setDate_JS_API_0100 error " + error);
expect().assertFail(); expect().assertFail();
}); });
done(); done();
...@@ -272,12 +279,12 @@ export default function systemTimeJsunit() { ...@@ -272,12 +279,12 @@ export default function systemTimeJsunit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_systemTime_setDate_JS_API_0200', 0, async function (done) { it('SUB_systemTime_setDate_JS_API_0200', 0, async function (done) {
console.info("SUB_systemTime_setDate_JS_API_0200 start"); console.info("====>SUB_systemTime_setDate_JS_API_0200 start");
systemTime.setDate(0).then(data => { systemTime.setDate(0).then(data => {
console.info("setTime ===data " + data); console.info("====>SUB_systemTime_setDate_JS_API_0200 data " + data);
expect(true).assertTrue(); expect(true).assertTrue();
}).catch(error => { }).catch(error => {
console.info("setTime ===error " + error); console.info("====>SUB_systemTime_setDate_JS_API_0200 error " + error);
expect().assertFail(); expect().assertFail();
}); });
done(); done();
...@@ -292,14 +299,14 @@ export default function systemTimeJsunit() { ...@@ -292,14 +299,14 @@ export default function systemTimeJsunit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_systemTime_setDate_JS_API_0300', 0, async function (done) { it('SUB_systemTime_setDate_JS_API_0300', 0, async function (done) {
console.info("SUB_systemTime_setDate_JS_API_0300 start"); console.info("====>SUB_systemTime_setDate_JS_API_0300 start");
var data = new Date("October 13, 2020 11:13:00"); var data = new Date("October 13, 2020 11:13:00");
systemTime.setDate(data, (error, data) => { systemTime.setDate(data, (error, data) => {
if(error){ if(error){
console.info("setTime ===error " + error); console.info("====>SUB_systemTime_setDate_JS_API_0300 error " + error);
expect().assertFail(); expect().assertFail();
}else{ }else{
console.info("setTime ===data " + data); console.info("====>SUB_systemTime_setDate_JS_API_0300 data " + data);
expect(true).assertTrue(); expect(true).assertTrue();
}; };
}); });
...@@ -315,12 +322,12 @@ export default function systemTimeJsunit() { ...@@ -315,12 +322,12 @@ export default function systemTimeJsunit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_systemTime_setTimezone_JS_API_0100', 0, async function (done) { it('SUB_systemTime_setTimezone_JS_API_0100', 0, async function (done) {
console.info("SUB_systemTime_setTimezone_JS_API_0100 start"); console.info("====>SUB_systemTime_setTimezone_JS_API_0100 start");
systemTime.setTimezone('Asia, Shanghai').then(data => { systemTime.setTimezone('Asia, Shanghai').then(data => {
console.info("setTime ===data " + data); console.info("====>SUB_systemTime_setTimezone_JS_API_0100 data " + data);
expect().assertFail(); expect().assertFail();
}).catch(error => { }).catch(error => {
console.info("setTime ===error " + error); console.info("====>SUB_systemTime_setTimezone_JS_API_0100 error " + error);
expect(true).assertTrue(); expect(true).assertTrue();
}); });
done(); done();
...@@ -335,12 +342,12 @@ export default function systemTimeJsunit() { ...@@ -335,12 +342,12 @@ export default function systemTimeJsunit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_systemTime_setTimezone_JS_API_0200', 0, async function (done) { it('SUB_systemTime_setTimezone_JS_API_0200', 0, async function (done) {
console.info("SUB_systemTime_setTimezone_JS_API_0200 start"); console.info("====>SUB_systemTime_setTimezone_JS_API_0200 start");
systemTime.setTimezone('Beijing,China').then(data => { systemTime.setTimezone('Beijing,China').then(data => {
console.info("setTime ===data " + data); console.info("====>SUB_systemTime_setTimezone_JS_API_0200 data " + data);
expect().assertFail(); expect().assertFail();
}).catch(error => { }).catch(error => {
console.info("setTime ===error " + error); console.info("====>SUB_systemTime_setTimezone_JS_API_0200 error " + error);
expect(true).assertTrue(); expect(true).assertTrue();
}); });
done(); done();
...@@ -355,12 +362,12 @@ export default function systemTimeJsunit() { ...@@ -355,12 +362,12 @@ export default function systemTimeJsunit() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_systemTime_setTimezone_JS_API_0300', 0, async function (done) { it('SUB_systemTime_setTimezone_JS_API_0300', 0, async function (done) {
console.info("SUB_systemTime_setTimezone_JS_API_0300 start"); console.info("====>SUB_systemTime_setTimezone_JS_API_0300 start");
systemTime.setTimezone('Baker Island, U.S.A.').then(data => { systemTime.setTimezone('Baker Island, U.S.A.').then(data => {
console.info("setTime ===data " + data); console.info("====>SUB_systemTime_setTimezone_JS_API_0300 data " + data);
expect().assertFail(); expect().assertFail();
}).catch(error => { }).catch(error => {
console.info("setTime ===error " + error); console.info("====>SUB_systemTime_setTimezone_JS_API_0300 error " + error);
expect(true).assertTrue(); expect(true).assertTrue();
}); });
done(); done();
......
...@@ -19,7 +19,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from ...@@ -19,7 +19,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
export default function systemTimerTest() { export default function systemTimerTest() {
describe('systemTimerTest', function () { describe('systemTimerTest', function () {
console.info('systemTimer Test start'); console.info('====>systemTimer Test start');
//wantAgent对象 //wantAgent对象
var wantAgent; var wantAgent;
...@@ -43,11 +43,11 @@ export default function systemTimerTest() { ...@@ -43,11 +43,11 @@ export default function systemTimerTest() {
* beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed. * beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.
*/ */
beforeAll(function () { beforeAll(function () {
console.info('beforeAll: Prerequisites are executed.'); console.info('====>beforeAll: Prerequisites are executed.');
WantAgent.getWantAgent(wantAgentInfo) WantAgent.getWantAgent(wantAgentInfo)
.then((data) => { .then((data) => {
if ( data != undefined || data != null) { if ( data != undefined || data != null) {
console.info('beforeAll: success to get wantAgent: ' + typeof(data)); console.info('====>beforeAll: success to get wantAgent: ' + typeof(data));
wantAgent = data; wantAgent = data;
} }
}) })
...@@ -60,21 +60,21 @@ export default function systemTimerTest() { ...@@ -60,21 +60,21 @@ export default function systemTimerTest() {
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
*/ */
beforeEach(function () { beforeEach(function () {
console.info('beforeEach: Prerequisites is executed.'); console.info('====>beforeEach: Prerequisites is executed.');
}); });
/** /**
* afterEach: Test case-level clearance conditions, which are executed after each test case is executed. * afterEach: Test case-level clearance conditions, which are executed after each test case is executed.
*/ */
afterEach(function () { afterEach(function () {
console.info('afterEach: Test case-level clearance conditions is executed.'); console.info('====>afterEach: Test case-level clearance conditions is executed.');
}); });
/** /**
* afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed. * afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed.
*/ */
afterAll(function () { afterAll(function () {
console.info('afterAll: Test suite-level cleanup condition is executed.'); console.info('====>afterAll: Test suite-level cleanup condition is executed.');
}); });
/** /**
...@@ -86,27 +86,27 @@ export default function systemTimerTest() { ...@@ -86,27 +86,27 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_createTimer_0000', 0, async function (done) { it('SUB_time_systemTimer_createTimer_0000', 0, async function (done) {
console.info('SUB_time_systemTimer_createTimer_0000 start.'); console.info('====>SUB_time_systemTimer_createTimer_0000 start.');
let options = { let options = {
type: systemTimer.TIMER_TYPE_REALTIME, type: systemTimer.TIMER_TYPE_REALTIME,
repeat: false repeat: false
}; };
try { try {
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, function (err, timerID) {
if (err) { if (err) {
// 处理业务逻辑错误 // 处理业务逻辑错误
expect().assertTrue(); expect().assertTrue();
done(); done();
} }
console.info('SUB_time_systemTimer_createTimer_0000 timerID: ' + timerID); console.info('====>SUB_time_systemTimer_createTimer_0000 timerID: ' + timerID);
globalTimerID = timerID; globalTimerID = timerID;
expect(Number.isInteger(timerID)).assertTrue(); expect(Number.isInteger(timerID)).assertTrue();
done(); done();
}); });
} catch (err) { } catch (err) {
// 捕获参数错误 // 捕获参数错误
console.info('SUB_time_systemTimer_createTimer_0000 has failed for ' + err); console.info('====>SUB_time_systemTimer_createTimer_0000 has failed for ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -121,7 +121,7 @@ export default function systemTimerTest() { ...@@ -121,7 +121,7 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_createTimer_0001', 0, async function (done) { it('SUB_time_systemTimer_createTimer_0001', 0, async function (done) {
console.info('SUB_time_systemTimer_createTimer_0001 start.'); console.info('====>SUB_time_systemTimer_createTimer_0001 start.');
let options = { let options = {
type: systemTimer.TIMER_TYPE_IDLE, type: systemTimer.TIMER_TYPE_IDLE,
repeat: false repeat: false
...@@ -129,16 +129,16 @@ export default function systemTimerTest() { ...@@ -129,16 +129,16 @@ export default function systemTimerTest() {
try { try {
systemTimer.createTimer(options, function (err, timerID) { systemTimer.createTimer(options, function (err, timerID) {
if (err) { if (err) {
console.info('SUB_time_systemTimer_createTimer_0001 wrong since ' + err.code); console.info('====>SUB_time_systemTimer_createTimer_0001 wrong since ' + err.code);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
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();
done(); done();
}); });
} catch (e) { } catch (e) {
console.info('SUB_time_systemTimer_createTimer_0001 arv wrong since ' + e.code); console.info('====>SUB_time_systemTimer_createTimer_0001 arv wrong since ' + e.code);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -153,9 +153,9 @@ export default function systemTimerTest() { ...@@ -153,9 +153,9 @@ export default function systemTimerTest() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_time_systemTimer_createTimer_0002', 2, async function (done) { it('SUB_time_systemTimer_createTimer_0002', 2, async function (done) {
console.info("SUB_time_systemTimer_createTimer_0002 start"); console.info("====>SUB_time_systemTimer_createTimer_0002 start");
WantAgent.getBundleName(wantAgent, (err, data)=>{ WantAgent.getBundleName(wantAgent, (err, data)=>{
console.info('SUB_time_systemTimer_createTimer_0002 BundleName: ' + data); console.info('====>SUB_time_systemTimer_createTimer_0002 BundleName: ' + data);
}) })
let options = { let options = {
type: systemTimer.TIMER_TYPE_WAKEUP, type: systemTimer.TIMER_TYPE_WAKEUP,
...@@ -164,19 +164,19 @@ export default function systemTimerTest() { ...@@ -164,19 +164,19 @@ export default function systemTimerTest() {
interval: interval_time interval: interval_time
}; };
try { try {
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, function (err, timerID) {
if (err) { if (err) {
console.info('SUB_time_systemTimer_createTimer_0002 wrong since ' + err.code); console.info('====>SUB_time_systemTimer_createTimer_0002 wrong since ' + err.code);
expect().assertTrue(); expect().assertTrue();
done(); done();
} }
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();
done(); done();
}); });
} catch (e) { } catch (e) {
console.info('SUB_time_systemTimer_createTimer_0002 arv wrong since ' + e); console.info('====>SUB_time_systemTimer_createTimer_0002 arv wrong since ' + e);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -191,16 +191,16 @@ export default function systemTimerTest() { ...@@ -191,16 +191,16 @@ export default function systemTimerTest() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_time_systemTimer_createTimer_0003', 2, async function (done) { it('SUB_time_systemTimer_createTimer_0003', 2, async function (done) {
console.info("SUB_time_systemTimer_createTimer_0003 start"); console.info("====>SUB_time_systemTimer_createTimer_0003 start");
let options = { let options = {
type: systemTimer.TIMER_TYPE_EXACT, type: systemTimer.TIMER_TYPE_EXACT,
repeat: false repeat: false
}; };
try { try {
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, function (err, timerID) {
if (err) { if (err) {
console.info('SUB_time_systemTimer_createTimer_0003 wrong since ' + err.code); console.info('====>SUB_time_systemTimer_createTimer_0003 wrong since ' + err.code);
expect().assertTrue(); expect().assertTrue();
done(); done();
} }
...@@ -208,7 +208,7 @@ export default function systemTimerTest() { ...@@ -208,7 +208,7 @@ export default function systemTimerTest() {
done(); done();
}); });
} catch (e) { } catch (e) {
console.info('SUB_time_systemTimer_createTimer_0002 arv wrong since ' + e); console.info('====>SUB_time_systemTimer_createTimer_0002 arv wrong since ' + e);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -223,9 +223,9 @@ export default function systemTimerTest() { ...@@ -223,9 +223,9 @@ export default function systemTimerTest() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_time_systemTimer_createTimer_0004', 2, async function (done) { it('SUB_time_systemTimer_createTimer_0004', 2, async function (done) {
console.info("SUB_time_systemTimer_createTimer_0004 start"); console.info("====>SUB_time_systemTimer_createTimer_0004 start");
WantAgent.getBundleName(wantAgent, (err, data)=>{ WantAgent.getBundleName(wantAgent, (err, data)=>{
console.info("SUB_time_systemTimer_createTimer_0004 BundleName: " + data); console.info("====>SUB_time_systemTimer_createTimer_0004 BundleName: " + data);
}); });
let options = { let options = {
type: systemTimer.TIMER_TYPE_REALTIME, type: systemTimer.TIMER_TYPE_REALTIME,
...@@ -234,7 +234,7 @@ export default function systemTimerTest() { ...@@ -234,7 +234,7 @@ export default function systemTimerTest() {
interval: interval_time interval: interval_time
}; };
try { try {
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, function (err, timerID) {
if (err) { if (err) {
expect().assertTrue(); expect().assertTrue();
...@@ -244,7 +244,7 @@ export default function systemTimerTest() { ...@@ -244,7 +244,7 @@ export default function systemTimerTest() {
done(); done();
}); });
} catch (e) { } catch (e) {
console.info('SUB_time_systemTimer_createTimer_0004 has failed for ' + e); console.info('====>SUB_time_systemTimer_createTimer_0004 has failed for ' + e);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -260,24 +260,24 @@ export default function systemTimerTest() { ...@@ -260,24 +260,24 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_createTimer_0005', 0, async function (done) { it('SUB_time_systemTimer_createTimer_0005', 0, async function (done) {
console.info('SUB_time_systemTimer_createTimer_0005 start.'); console.info('====>SUB_time_systemTimer_createTimer_0005 start.');
let options = { let options = {
type: systemTimer.TIMER_TYPE_REALTIME, type: systemTimer.TIMER_TYPE_REALTIME,
repeat: false repeat: false
}; };
try { try {
console.info('SUB_time_systemTimer_createTimer_0005 create timer.'); console.info('====>SUB_time_systemTimer_createTimer_0005 create timer.');
systemTimer.createTimer(options).then((timerID) =>{ systemTimer.createTimer(options).then((timerID) =>{
console.info('SUB_time_systemTimer_createTimer_0005 timerID: ' + timerID); console.info('====>SUB_time_systemTimer_createTimer_0005 timerID: ' + timerID);
expect(Number.isInteger(timerID)).assertTrue(); expect(Number.isInteger(timerID)).assertTrue();
done(); done();
}).catch(err => { }).catch(err => {
console.info('SUB_time_systemTimer_createTimer_0005 promise failed ' + err); console.info('====>SUB_time_systemTimer_createTimer_0005 promise failed ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
}); });
} catch (err) { } catch (err) {
console.info('SUB_time_systemTimer_createTimer_0005 has failed for ' + err); console.info('====>SUB_time_systemTimer_createTimer_0005 has failed for ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -292,23 +292,23 @@ export default function systemTimerTest() { ...@@ -292,23 +292,23 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_createTimer_0006', 0, async function (done) { it('SUB_time_systemTimer_createTimer_0006', 0, async function (done) {
console.info('SUB_time_systemTimer_createTimer_0006 start.'); console.info('====>SUB_time_systemTimer_createTimer_0006 start.');
let options = { let options = {
type: systemTimer.TIMER_TYPE_IDLE, type: systemTimer.TIMER_TYPE_IDLE,
repeat: false repeat: false
}; };
try { try {
systemTimer.createTimer(options).then((timerID) => { systemTimer.createTimer(options).then((timerID) => {
console.info('SUB_time_systemTimer_createTimer_0006 timerID: ' + timerID); console.info('====>SUB_time_systemTimer_createTimer_0006 timerID: ' + timerID);
expect(Number.isInteger(timerID)).assertTrue(); expect(Number.isInteger(timerID)).assertTrue();
done(); done();
}).catch(err => { }).catch(err => {
console.info('SUB_time_systemTimer_createTimer_0006 promise failed ' + err); console.info('====>SUB_time_systemTimer_createTimer_0006 promise failed ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
}); });
} catch (e) { } catch (e) {
console.info('SUB_time_systemTimer_createTimer_0006 arv wrong since ' + e.code); console.info('====>SUB_time_systemTimer_createTimer_0006 arv wrong since ' + e.code);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -323,9 +323,9 @@ export default function systemTimerTest() { ...@@ -323,9 +323,9 @@ export default function systemTimerTest() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_time_systemTimer_createTimer_0007', 2, async function (done) { it('SUB_time_systemTimer_createTimer_0007', 2, async function (done) {
console.info("SUB_time_systemTimer_createTimer_0007 start"); console.info("====>SUB_time_systemTimer_createTimer_0007 start");
WantAgent.getBundleName(wantAgent, (err, data)=>{ WantAgent.getBundleName(wantAgent, (err, data)=>{
console.info('SUB_time_systemTimer_createTimer_0007 BundleName: ' + data); console.info('====>SUB_time_systemTimer_createTimer_0007 BundleName: ' + data);
}) })
let options = { let options = {
type: systemTimer.TIMER_TYPE_WAKEUP, type: systemTimer.TIMER_TYPE_WAKEUP,
...@@ -334,18 +334,18 @@ export default function systemTimerTest() { ...@@ -334,18 +334,18 @@ export default function systemTimerTest() {
interval: interval_time interval: interval_time
}; };
try { try {
console.info("SUB_time_systemTimer_createTimer_0007 create timer"); console.info("====>SUB_time_systemTimer_createTimer_0007 create timer");
systemTimer.createTimer(options).then((timerID) => { systemTimer.createTimer(options).then((timerID) => {
console.info('SUB_time_systemTimer_createTimer_0007 timerID: ' + timerID); console.info('====>SUB_time_systemTimer_createTimer_0007 timerID: ' + timerID);
expect(Number.isInteger(timerID)).assertTrue(); expect(Number.isInteger(timerID)).assertTrue();
done(); done();
}).catch(err => { }).catch(err => {
console.info('SUB_time_systemTimer_createTimer_0007 promise failed ' + err); console.info('====>SUB_time_systemTimer_createTimer_0007 promise failed ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
}); });
} catch (e) { } catch (e) {
console.info('SUB_time_systemTimer_createTimer_0007 arv wrong since ' + e); console.info('====>SUB_time_systemTimer_createTimer_0007 arv wrong since ' + e);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -360,23 +360,23 @@ export default function systemTimerTest() { ...@@ -360,23 +360,23 @@ export default function systemTimerTest() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_time_systemTimer_createTimer_0008', 2, async function (done) { it('SUB_time_systemTimer_createTimer_0008', 2, async function (done) {
console.info("SUB_time_systemTimer_createTimer_0008 start"); console.info("====>SUB_time_systemTimer_createTimer_0008 start");
let options = { let options = {
type: systemTimer.TIMER_TYPE_EXACT, type: systemTimer.TIMER_TYPE_EXACT,
repeat: false repeat: false
}; };
try { try {
console.info("SUB_time_systemTimer_createTimer_0008 create timer") console.info("====>SUB_time_systemTimer_createTimer_0008 create timer")
systemTimer.createTimer(options).then((timerID) => { systemTimer.createTimer(options).then((timerID) => {
expect(Number.isInteger(timerID)).assertTrue(); expect(Number.isInteger(timerID)).assertTrue();
done(); done();
}).catch(err => { }).catch(err => {
console.info('SUB_time_systemTimer_createTimer_0008 promise failed ' + err); console.info('====>SUB_time_systemTimer_createTimer_0008 promise failed ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
}); });
} catch (e) { } catch (e) {
console.info('SUB_time_systemTimer_createTimer_0008 arv wrong since ' + e); console.info('====>SUB_time_systemTimer_createTimer_0008 arv wrong since ' + e);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -391,9 +391,9 @@ export default function systemTimerTest() { ...@@ -391,9 +391,9 @@ export default function systemTimerTest() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_time_systemTimer_createTimer_0009', 2, async function (done) { it('SUB_time_systemTimer_createTimer_0009', 2, async function (done) {
console.info("SUB_time_systemTimer_createTimer_0009 start"); console.info("====>SUB_time_systemTimer_createTimer_0009 start");
WantAgent.getBundleName(wantAgent, (err, data)=>{ WantAgent.getBundleName(wantAgent, (err, data)=>{
console.info("SUB_time_systemTimer_createTimer_0009 BundleName: " + data); console.info("====>SUB_time_systemTimer_createTimer_0009 BundleName: " + data);
}); });
let options = { let options = {
type: systemTimer.TIMER_TYPE_REALTIME, type: systemTimer.TIMER_TYPE_REALTIME,
...@@ -402,17 +402,17 @@ export default function systemTimerTest() { ...@@ -402,17 +402,17 @@ export default function systemTimerTest() {
interval: interval_time interval: interval_time
}; };
try { try {
console.info("SUB_time_systemTimer_createTimer_0009 create timer") console.info("====>SUB_time_systemTimer_createTimer_0009 create timer")
systemTimer.createTimer(options).then((timerID) => { systemTimer.createTimer(options).then((timerID) => {
expect(Number.isInteger(timerID)).assertTrue(); expect(Number.isInteger(timerID)).assertTrue();
done(); done();
}).catch(err => { }).catch(err => {
console.info('SUB_time_systemTimer_createTimer_0009 promise failed ' + err); console.info('====>SUB_time_systemTimer_createTimer_0009 promise failed ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
}); });
} catch (e) { } catch (e) {
console.info('SUB_time_systemTimer_createTimer_0009 has failed for ' + e); console.info('====>SUB_time_systemTimer_createTimer_0009 has failed for ' + e);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -427,21 +427,21 @@ export default function systemTimerTest() { ...@@ -427,21 +427,21 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_startTimer_0001', 0, async function (done) { it('SUB_time_systemTimer_startTimer_0001', 0, async function (done) {
console.info("SUB_time_systemTimer_startTimer_0001 start"); console.info("====>SUB_time_systemTimer_startTimer_0001 start");
try { try {
console.info("SUB_time_systemTimer_startTimer_0001 start timer, timerID: " + globalTimerID) console.info("====>SUB_time_systemTimer_startTimer_0001 start timer, timerID: " + globalTimerID)
let triggerTime = new Date().getTime() + interval_time * 1.2; let triggerTime = new Date().getTime() + interval_time * 1.2;
systemTimer.startTimer(globalTimerID, triggerTime, function (err, data) { systemTimer.startTimer(globalTimerID, triggerTime, function (err, data) {
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);
expect().assertTrue(); expect().assertTrue();
done(); done();
} }
console.info("SUB_time_systemTimer_startTimer_0001 success to start timerID: " + globalTimerID); console.info("====>SUB_time_systemTimer_startTimer_0001 success to start timerID: " + 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);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -456,19 +456,19 @@ export default function systemTimerTest() { ...@@ -456,19 +456,19 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_stopTimer_0001', 0, async function (done) { it('SUB_time_systemTimer_stopTimer_0001', 0, async function (done) {
console.info("SUB_time_systemTimer_stopTimer_0001 start"); console.info("====>SUB_time_systemTimer_stopTimer_0001 start");
try { try {
console.info("SUB_time_systemTimer_stopTimer_0001 stop timer, timerID: " + globalTimerID) console.info("====>SUB_time_systemTimer_stopTimer_0001 stop timer, timerID: " + globalTimerID)
systemTimer.stopTimer(globalTimerID, function (err, data) { systemTimer.stopTimer(globalTimerID, function (err, data) {
if (err) { if (err) {
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
console.info("SUB_time_systemTimer_stopTimer_0001 success to stop timerID: " + globalTimerID); console.info("====>SUB_time_systemTimer_stopTimer_0001 success to stop timerID: " + 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);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -483,19 +483,19 @@ export default function systemTimerTest() { ...@@ -483,19 +483,19 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_destroyTimer_0001', 0, async function (done) { it('SUB_time_systemTimer_destroyTimer_0001', 0, async function (done) {
console.info("SUB_time_systemTimer_destroyTimer_0001 start"); console.info("====>SUB_time_systemTimer_destroyTimer_0001 start");
try { try {
console.info("SUB_time_systemTimer_destroyTimer_0001 destroy timer, timerID: " + globalTimerID) console.info("====>SUB_time_systemTimer_destroyTimer_0001 destroy timer, timerID: " + globalTimerID)
systemTimer.destroyTimer(globalTimerID, function (err, data) { systemTimer.destroyTimer(globalTimerID, function (err, data) {
if (err) { if (err) {
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
console.info("SUB_time_systemTimer_destroyTimer_0001 success to destroy timerID: " + globalTimerID); console.info("====>SUB_time_systemTimer_destroyTimer_0001 success to destroy timerID: " + globalTimerID);
done(); done();
}); });
} catch (e) { } catch (e) {
console.info('SUB_time_systemTimer_destroyTimer_0001 has failed for ' + e); console.info('====>SUB_time_systemTimer_destroyTimer_0001 has failed for ' + e);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -510,27 +510,27 @@ export default function systemTimerTest() { ...@@ -510,27 +510,27 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_createTimer_0002', 0, async function (done) { it('SUB_time_systemTimer_createTimer_0002', 0, async function (done) {
console.info('SUB_time_systemTimer_createTimer_0002 start.'); console.info('====>SUB_time_systemTimer_createTimer_0002 start.');
let options = { let options = {
type: systemTimer.TIMER_TYPE_REALTIME, type: systemTimer.TIMER_TYPE_REALTIME,
repeat: false repeat: false
}; };
try { try {
console.info('SUB_time_systemTimer_createTimer_0002 create timer.'); console.info('====>SUB_time_systemTimer_createTimer_0002 create timer.');
systemTimer.createTimer(options).then((timerID)=>{ systemTimer.createTimer(options).then((timerID)=>{
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();
globalTimerID = timerID; globalTimerID = timerID;
done(); done();
}).catch( error => { }).catch( error => {
// 捕获业务逻辑错误 // 捕获业务逻辑错误
console.info('SUB_time_systemTimer_createTimer_0002 failed to create timer.'); console.info('====>SUB_time_systemTimer_createTimer_0002 failed to create timer.');
expect().assertTrue(); expect().assertTrue();
done(); done();
}); });
} catch (err) { } catch (err) {
// 捕获参数错误 // 捕获参数错误
console.info('SUB_time_systemTimer_createTimer_0002 has failed for ' + err); console.info('====>SUB_time_systemTimer_createTimer_0002 has failed for ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -545,23 +545,23 @@ export default function systemTimerTest() { ...@@ -545,23 +545,23 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_startTimer_0002', 0, async function (done) { it('SUB_time_systemTimer_startTimer_0002', 0, async function (done) {
console.info('SUB_time_systemTimer_startTimer_0002 start.'); console.info('====>SUB_time_systemTimer_startTimer_0002 start.');
try { try {
console.info('SUB_time_systemTimer_startTimer_0002 start timer, timerID: ' + globalTimerID); console.info('====>SUB_time_systemTimer_startTimer_0002 start timer, timerID: ' + globalTimerID);
let triggerTime = new Date().getTime() + interval_time * 2; let triggerTime = new Date().getTime() + interval_time * 2;
systemTimer.startTimer(globalTimerID, triggerTime) systemTimer.startTimer(globalTimerID, triggerTime)
.then(()=>{ .then(()=>{
console.info('SUB_time_systemTimer_startTimer_0002 timerID:' + globalTimerID); console.info('====>SUB_time_systemTimer_startTimer_0002 timerID:' + globalTimerID);
done(); done();
}).catch(()=>{ }).catch(()=>{
// 捕获业务逻辑错误 // 捕获业务逻辑错误
console.info('SUB_time_systemTimer_startTimer_0002 failed to start timer.'); console.info('====>SUB_time_systemTimer_startTimer_0002 failed to start timer.');
expect().assertTrue(); expect().assertTrue();
done(); done();
}); });
} catch (err) { } catch (err) {
// 捕获参数错误 // 捕获参数错误
console.info('SUB_time_systemTimer_startTimer_0002 has failed for ' + err); console.info('====>SUB_time_systemTimer_startTimer_0002 has failed for ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
} }
...@@ -576,22 +576,22 @@ export default function systemTimerTest() { ...@@ -576,22 +576,22 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_stopTimer_0002', 0, async function (done) { it('SUB_time_systemTimer_stopTimer_0002', 0, async function (done) {
console.info('SUB_time_systemTimer_stopTimer_0002 start.'); console.info('====>SUB_time_systemTimer_stopTimer_0002 start.');
try { try {
console.info('SUB_time_systemTimer_stopTimer_0002 stop timer, timerID: ' + globalTimerID); console.info('====>SUB_time_systemTimer_stopTimer_0002 stop timer, timerID: ' + globalTimerID);
systemTimer.stopTimer(globalTimerID) systemTimer.stopTimer(globalTimerID)
.then(()=>{ .then(()=>{
console.info('SUB_time_systemTimer_stopTimer_0002 timerID:' + globalTimerID); console.info('====>SUB_time_systemTimer_stopTimer_0002 timerID:' + globalTimerID);
done(); done();
}).catch(()=>{ }).catch(()=>{
// 捕获业务逻辑错误 // 捕获业务逻辑错误
console.info('SUB_time_systemTimer_stopTimer_0002 failed to stop timer.'); console.info('====>SUB_time_systemTimer_stopTimer_0002 failed to stop timer.');
expect().assertTrue(); expect().assertTrue();
done(); done();
}); });
} catch (err) { } catch (err) {
// 捕获参数错误 // 捕获参数错误
console.info('SUB_time_systemTimer_stopTimer_0002 has failed for ' + err); console.info('====>SUB_time_systemTimer_stopTimer_0002 has failed for ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -606,22 +606,22 @@ export default function systemTimerTest() { ...@@ -606,22 +606,22 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_destroyTimer_0002', 0, async function (done) { it('SUB_time_systemTimer_destroyTimer_0002', 0, async function (done) {
console.info('SUB_time_systemTimer_destroyTimer_0002 start.'); console.info('====>SUB_time_systemTimer_destroyTimer_0002 start.');
try { try {
console.info('SUB_time_systemTimer_destroyTimer_0002 destroy timer, timerID: ' + globalTimerID); console.info('====>SUB_time_systemTimer_destroyTimer_0002 destroy timer, timerID: ' + globalTimerID);
systemTimer.destroyTimer(globalTimerID) systemTimer.destroyTimer(globalTimerID)
.then(()=>{ .then(()=>{
console.info('SUB_time_systemTimer_destroyTimer_0002 timerID:' + globalTimerID); console.info('====>SUB_time_systemTimer_destroyTimer_0002 timerID:' + globalTimerID);
done(); done();
}).catch(()=>{ }).catch(()=>{
// 捕获业务逻辑错误 // 捕获业务逻辑错误
console.info('SUB_time_systemTimer_destroyTimer_0002 failed to destroy timer.'); console.info('====>SUB_time_systemTimer_destroyTimer_0002 failed to destroy timer.');
expect().assertTrue(); expect().assertTrue();
done(); done();
}); });
} catch (err) { } catch (err) {
// 捕获参数错误 // 捕获参数错误
console.info('SUB_time_systemTimer_stopTimer_0002 has failed for ' + err); console.info('====>SUB_time_systemTimer_stopTimer_0002 has failed for ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
}; };
...@@ -636,65 +636,65 @@ export default function systemTimerTest() { ...@@ -636,65 +636,65 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_ALL_Promise_0008', 0, async function (done) { it('SUB_time_systemTimer_ALL_Promise_0008', 0, async function (done) {
console.info('SUB_time_systemTimer_ALL_Promise_0008 start.'); console.info('====>SUB_time_systemTimer_ALL_Promise_0008 start.');
let options = { let options = {
type: systemTimer.TIMER_TYPE_WAKEUP, type: systemTimer.TIMER_TYPE_WAKEUP,
repeat: false repeat: false
}; };
try { try {
console.info('SUB_time_systemTimer_ALL_Promise_0008 create timer.'); console.info('====>SUB_time_systemTimer_ALL_Promise_0008 create timer.');
systemTimer.createTimer(options) systemTimer.createTimer(options)
.then((timerID)=>{ .then((timerID)=>{
console.info('SUB_time_systemTimer_ALL_Promise_0008 timerID:' + timerID); console.info('====>SUB_time_systemTimer_ALL_Promise_0008 timerID:' + timerID);
expect(Number.isInteger(timerID)).assertTrue(); expect(Number.isInteger(timerID)).assertTrue();
try { try {
let triggerTime = new Date().getTime() + interval_time * 1.2; let triggerTime = new Date().getTime() + interval_time * 1.2;
systemTimer.startTimer(timerID, triggerTime) systemTimer.startTimer(timerID, triggerTime)
.then(()=>{ .then(()=>{
console.info('SUB_time_systemTimer_ALL_Promise_0008 start timerID: ' + timerID); console.info('====>SUB_time_systemTimer_ALL_Promise_0008 start timerID: ' + timerID);
try { try {
systemTimer.stopTimer(timerID) systemTimer.stopTimer(timerID)
.then(()=>{ .then(()=>{
systemTimer.destroyTimer(timerID, function (err, data) { systemTimer.destroyTimer(timerID, function (err, data) {
console.info('SUB_time_systemTimer_ALL_Promise_0008 destroyTimer: ' + timerID); console.info('====>SUB_time_systemTimer_ALL_Promise_0008 destroyTimer: ' + timerID);
done(); done();
}); });
}) })
.catch(()=>{ .catch(()=>{
// 捕获stopTimer业务逻辑错误 // 捕获stopTimer业务逻辑错误
console.info('SUB_time_systemTimer_ALL_Promise_0008 failed to stop timer.'); console.info('====>SUB_time_systemTimer_ALL_Promise_0008 failed to stop timer.');
expect().assertTrue(); expect().assertTrue();
done(); done();
}) })
} catch (err) { } catch (err) {
// 捕获stopTimer参数错误 // 捕获stopTimer参数错误
console.info('SUB_time_systemTimer_ALL_Promise_0008 stopTimer with wrong arg: ' + err); console.info('====>SUB_time_systemTimer_ALL_Promise_0008 stopTimer with wrong arg: ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
} }
}) })
.catch(()=>{ .catch(()=>{
// 捕获startTimer业务逻辑错误 // 捕获startTimer业务逻辑错误
console.info('SUB_time_systemTimer_ALL_Promise_0008 failed to stop timer.'); console.info('====>SUB_time_systemTimer_ALL_Promise_0008 failed to stop timer.');
expect().assertTrue(); expect().assertTrue();
done(); done();
}); });
} catch (err) { } catch (err) {
// 捕获参数错误 // 捕获参数错误
console.info('SUB_time_systemTimer_ALL_Promise_0008 startTimer with wrong arg: ' + err); console.info('====>SUB_time_systemTimer_ALL_Promise_0008 startTimer with wrong arg: ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
} }
}) })
.catch(()=>{ .catch(()=>{
// 捕获业务逻辑错误 // 捕获业务逻辑错误
console.info('SUB_time_systemTimer_ALL_Promise_0008 failed to create timer.'); console.info('====>SUB_time_systemTimer_ALL_Promise_0008 failed to create timer.');
expect().assertTrue(); expect().assertTrue();
done(); done();
}); });
} catch (err) { } catch (err) {
// 捕获参数错误 // 捕获参数错误
console.info('SUB_time_systemTimer_ALL_Promise_0008 createTimer with wrong arg: ' + err); console.info('====>SUB_time_systemTimer_ALL_Promise_0008 createTimer with wrong arg: ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
} }
...@@ -709,42 +709,42 @@ export default function systemTimerTest() { ...@@ -709,42 +709,42 @@ export default function systemTimerTest() {
* @tc.level Level 0 * @tc.level Level 0
*/ */
it('SUB_time_systemTimer_ALL_Callback_0009', 0, async function (done) { it('SUB_time_systemTimer_ALL_Callback_0009', 0, async function (done) {
console.info('SUB_time_systemTimer_ALL_Callback_0009 start.'); console.info('====>SUB_time_systemTimer_ALL_Callback_0009 start.');
let options = { let options = {
type: systemTimer.TIMER_TYPE_WAKEUP, type: systemTimer.TIMER_TYPE_WAKEUP,
repeat: false repeat: false
}; };
try { try {
console.info('SUB_time_systemTimer_ALL_Callback_0009 create timer.'); console.info('====>SUB_time_systemTimer_ALL_Callback_0009 create timer.');
systemTimer.createTimer(options) systemTimer.createTimer(options)
.then((timerID)=>{ .then((timerID)=>{
console.info('SUB_time_systemTimer_ALL_Callback_0009 timerID:' + timerID); console.info('====>SUB_time_systemTimer_ALL_Callback_0009 timerID:' + timerID);
expect(Number.isInteger(timerID)).assertTrue(); expect(Number.isInteger(timerID)).assertTrue();
try { try {
let triggerTime = new Date().getTime() + interval_time * 1.2; let triggerTime = new Date().getTime() + interval_time * 1.2;
systemTimer.startTimer(timerID, triggerTime, ()=>{ systemTimer.startTimer(timerID, triggerTime, ()=>{
console.info('SUB_time_systemTimer_ALL_Callback_0009 start timerID: ' + timerID); console.info('====>SUB_time_systemTimer_ALL_Callback_0009 start timerID: ' + timerID);
try { try {
systemTimer.stopTimer(timerID, ()=>{ systemTimer.stopTimer(timerID, ()=>{
systemTimer.destroyTimer(timerID, function (err, data) { systemTimer.destroyTimer(timerID, function (err, data) {
console.info('SUB_time_systemTimer_ALL_Callback_0009 destroyTimer: ' + timerID); console.info('====>SUB_time_systemTimer_ALL_Callback_0009 destroyTimer: ' + timerID);
done(); done();
}); });
}) })
} catch (err) { } catch (err) {
console.info('SUB_time_systemTimer_ALL_Callback_0009 stopTimer with wrong arg: ' + err); console.info('====>SUB_time_systemTimer_ALL_Callback_0009 stopTimer with wrong arg: ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
} }
}) })
} catch (err) { } catch (err) {
console.info('SUB_time_systemTimer_ALL_Callback_0009 startTimer with wrong arg: ' + err); console.info('====>SUB_time_systemTimer_ALL_Callback_0009 startTimer with wrong arg: ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
} }
}) })
} catch (err) { } catch (err) {
console.info('SUB_time_systemTimer_ALL_Callback_0009 createTimer with wrong arg: ' + err); console.info('====>SUB_time_systemTimer_ALL_Callback_0009 createTimer with wrong arg: ' + err);
expect().assertTrue(); expect().assertTrue();
done(); done();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册