未验证 提交 9e061cf6 编写于 作者: 范晓兵 提交者: Gitee

【time】【master】修改SystemTimerJsunit.test.js 测试套XTS用例

Signed-off-by: N范晓兵 <fanxiaobing2@huawei.com>
上级 ea26496b
...@@ -13,906 +13,751 @@ ...@@ -13,906 +13,751 @@
* limitations under the License. * limitations under the License.
*/ */
// @ts-nocheck import {describe, it, expect} from 'deccjsunit/index'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import systemTimer from '@ohos.systemTimer';
import systemTimer from '@ohos.systemTimer' import WantAgent from '@ohos.wantAgent';
describe('TimerTest', function() { var wantAgentInfo = {
console.log('start################################start'); wants: [
{
/** deviceId: "deviceId",
* @tc.number SUB_systemTimer_Timer_JS_API_0100 bundleName: "com.neu.setResultOnAbilityResultTest1",
* @tc.name Test systemTimer.createTimer type = TIMER_TYPE_REALTIME abilityName: "com.example.test.MainAbility",
* @tc.desc Test systemTimer_Timer API functionality. action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: WantAgent.OperationType.START_ABILITIES,
requestCode: 0
}
describe('systemTimerTest', function () {
console.info('start################################start');
function isIntNum(val) {
return typeof val === 'number' && val % 1 === 0;
}
/**
* @tc.number SUB_systemTimer_createTimer_0000
* @tc.name systemTimer_createTimer_test000
* @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = false (Promise)
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('systemTimer_Timer_test1',0, async () => { it('systemTimer_createTimer_test000', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_0100 start") console.info("systemTimer_createTimer_test000 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:systemTimer.TIMER_TYPE_REALTIME,
repeat:false, repeat:false
persistent:false }
} try {
console.log("create timer") console.info("systemTimer_createTimer_test000 create timer")
let timer = systemTimer.createTimer(options) let timerID = await systemTimer.createTimer(options);
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) expect(isIntNum(timerID)).assertTrue();
console.info('systemTimer_createTimer_test000 has SUCCESS');
console.log("start timer") systemTimer.destroyTimer(timerID, function(e){
systemTimer.startTimer(timer, 100000) done();
});
console.log("stop timer") }catch (e) {
systemTimer.stopTimer(timer) console.info('systemTimer_createTimer_test000 has failed for '+e);
expect(false).assertTrue();
console.log("destroy timer") }
systemTimer.destroyTimer(timer) });
console.log('SUB_systemTimer_Timer_JS_API_0100 end');
}); /**
* @tc.number SUB_systemTimer_createTimer_0100
/** * @tc.name systemTimer_createTimer_test001
* @tc.number SUB_systemTimer_Timer_JS_API_0200 * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = false (callback)
* @tc.name Test systemTimer.createTimer type = TIMER_TYPE_REALTIME_WAKEUP
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('systemTimer_Timer_test2',0, async () => { it('systemTimer_createTimer_test001', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_0200 start") console.info("systemTimer_createTimer_test001 start")
var options = { let options = {
type:TIMER_TYPE_WAKEUP, type:systemTimer.TIMER_TYPE_REALTIME,
repeat:false, repeat:false
persistent:false }
} try {
console.log("create timer") console.info("systemTimer_createTimer_test001 create timer")
let timer = systemTimer.createTimer(options) systemTimer.createTimer(options, function(err, timerID){
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) expect(isIntNum(timerID)).assertTrue();
systemTimer.destroyTimer(timerID, function(e){
console.log("start timer") console.info('systemTimer_createTimer_test001 has SUCCESS');
systemTimer.startTimer(timer, 100000) done();
});
console.log("stop timer") });
systemTimer.stopTimer(timer) }catch (e) {
console.info('systemTimer_createTimer_test001 has failed for '+e);
console.log("destroy timer") expect(false).assertTrue();
systemTimer.destroyTimer(timer) }
console.log('SUB_systemTimer_Timer_JS_API_0200 end'); });
});
/**
/** * @tc.number SUB_systemTimer_createTimer_0200
* @tc.number SUB_systemTimer_Timer_JS_API_0300 * @tc.name systemTimer_createTimer_test002
* @tc.name Test systemTimer.createTimer type = TIMER_TYPE_EXACT * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_WAKEUP, repeat = true, interval (Promise)
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test3',0, async () => { it('systemTimer_createTimer_test002', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_0300 start") console.info("systemTimer_createTimer_test002 start")
var options = { let options = {
type:TIMER_TYPE_EXACT, type:systemTimer.TIMER_TYPE_WAKEUP,
repeat:false, repeat:true,
persistent:false interval:5001
} }
console.log("create timer") try {
let timer = systemTimer.createTimer(options) console.info("systemTimer_createTimer_test002 create timer")
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) let timerID = await systemTimer.createTimer(options);
expect(isIntNum(timerID)).assertTrue();
console.log("start timer") console.info('systemTimer_createTimer_test002 has SUCCESS');
systemTimer.startTimer(timer, 100000) systemTimer.destroyTimer(timerID, function(e){
done();
console.log("stop timer") });
systemTimer.stopTimer(timer) }catch (e) {
console.info('systemTimer_createTimer_test002 has failed for '+e);
console.log("destroy timer") expect(false).assertTrue();
systemTimer.destroyTimer(timer) }
console.log('SUB_systemTimer_Timer_JS_API_0300 end'); });
});
/**
/** * @tc.number SUB_systemTimer_createTimer_0300
* @tc.number SUB_systemTimer_Timer_JS_API_0400 * @tc.name systemTimer_createTimer_test003
* @tc.name Test systemTimer.createTimer type = TIMER_TYPE_REALTIME * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_WAKEUP, repeat = true, interval (callback)
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test4',0, async () => { it('systemTimer_createTimer_test003', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_0400 start") console.info("systemTimer_createTimer_test003 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:systemTimer.TIMER_TYPE_WAKEUP,
repeat:false, repeat:true,
persistent:false interval:5001
} }
console.log("create timer") try {
let timer = systemTimer.createTimer(options) console.info("systemTimer_createTimer_test003 create timer")
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) systemTimer.createTimer(options, function(err, timerID){
expect(isIntNum(timerID)).assertTrue();
console.log("start timer") systemTimer.destroyTimer(timerID, function(e){
systemTimer.startTimer(timer, 100000) console.info('systemTimer_createTimer_test003 has SUCCESS');
done();
console.log("stop timer") });
systemTimer.stopTimer(timer) });
}catch (e) {
console.log("destroy timer") console.info('systemTimer_createTimer_test003 has failed for '+e);
systemTimer.destroyTimer(timer) expect(false).assertTrue();
console.log('SUB_systemTimer_Timer_JS_API_0400 end'); }
}); });
/** /**
* @tc.number SUB_systemTimer_Timer_JS_API_0500 * @tc.number SUB_systemTimer_createTimer_0400
* @tc.name Test systemTimer.createTimer triggerTime = 0 * @tc.name systemTimer_createTimer_test004
* @tc.desc Test systemTimer_Timer API functionality. * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_EXACT, repeat = false (Promise)
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test5',0, async () => { it('systemTimer_createTimer_test004', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_0500 start") console.info("systemTimer_createTimer_test004 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:systemTimer.TIMER_TYPE_EXACT,
repeat:false, repeat:false
persistent:false }
} try {
console.log("create timer") console.info("systemTimer_createTimer_test004 create timer")
let timer = systemTimer.createTimer(options) let timerID = await systemTimer.createTimer(options);
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) expect(isIntNum(timerID)).assertTrue();
console.info('systemTimer_createTimer_test004 has SUCCESS');
console.log("start timer") systemTimer.destroyTimer(timerID, function(e){
systemTimer.startTimer(timer, 0) done();
});
console.log("stop timer") }catch (e) {
systemTimer.stopTimer(timer) console.info('systemTimer_createTimer_test004 has failed for '+e);
expect(false).assertTrue();
console.log("destroy timer") }
systemTimer.destroyTimer(timer) });
console.log('SUB_systemTimer_Timer_JS_API_0500 end');
}); /**
* @tc.number SUB_systemTimer_createTimer_0500
/** * @tc.name systemTimer_createTimer_test005
* @tc.number SUB_systemTimer_Timer_JS_API_0600 * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_EXACT, repeat = false (callback)
* @tc.name Test systemTimer.createTimer triggerTime = 5000
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test6',0, async () => { it('systemTimer_createTimer_test005', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_0600 start") console.info("systemTimer_createTimer_test005 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:systemTimer.TIMER_TYPE_EXACT,
repeat:false, repeat:false,
persistent:false }
} try {
console.log("create timer") console.info("systemTimer_createTimer_test005 create timer")
let timer = systemTimer.createTimer(options) systemTimer.createTimer(options, function(err, timerID){
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) expect(isIntNum(timerID)).assertTrue();
systemTimer.destroyTimer(timerID, function(e){
console.log("start timer") console.info('systemTimer_createTimer_test005 has SUCCESS');
systemTimer.startTimer(timer, 5000) done();
});
console.log("stop timer") });
systemTimer.stopTimer(timer) }catch (e) {
console.info('systemTimer_createTimer_test005 has failed for '+e);
console.log("destroy timer") expect(false).assertTrue();
systemTimer.destroyTimer(timer) }
console.log('SUB_systemTimer_Timer_JS_API_0600 end'); });
});
/**
/** * @tc.number SUB_systemTimer_createTimer_0600
* @tc.number SUB_systemTimer_Timer_JS_API_0700 * @tc.name systemTimer_createTimer_test006
* @tc.name Test systemTimer.createTimer triggerTime = Number.MAX_VALUE/2 * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_IDLE, repeat = false, wantAgent (Promise)
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test7',0, async () => { it('systemTimer_createTimer_test006', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_0700 start") console.info("systemTimer_createTimer_test006 start")
var options = { let wantAgent = await WantAgent.getWantAgent(wantAgentInfo);
type:TIMER_TYPE_REALTIME, let options = {
repeat:false, type:systemTimer.TIMER_TYPE_IDLE,
persistent:false repeat:false,
} wantAgent:wantAgent
console.log("create timer") }
let timer = systemTimer.createTimer(options) try {
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) console.info("systemTimer_createTimer_test006 create timer")
let timerID = await systemTimer.createTimer(options);
console.log("start timer") expect(isIntNum(timerID)).assertTrue();
systemTimer.startTimer(timer, Number.MAX_VALUE/2) console.info('systemTimer_createTimer_test006 has SUCCESS');
systemTimer.destroyTimer(timerID, function(e){
console.log("stop timer") done();
systemTimer.stopTimer(timer) });
}catch (e) {
console.log("destroy timer") console.info('systemTimer_createTimer_test006 has failed for '+e);
systemTimer.destroyTimer(timer) expect(false).assertTrue();
console.log('SUB_systemTimer_Timer_JS_API_0700 end'); }
}); });
/** /**
* @tc.number SUB_systemTimer_Timer_JS_API_0800 * @tc.number SUB_systemTimer_createTimer_0700
* @tc.name Test systemTimer.createTimer triggerTime = Number.MAX_VALUE-1 * @tc.name systemTimer_createTimer_test007
* @tc.desc Test systemTimer_Timer API functionality. * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_IDLE, repeat = false, wantAgent(callback)
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test8',0, async () => { it('systemTimer_createTimer_test007', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_0800 start") console.info("systemTimer_createTimer_test007 start")
var options = { let wantAgent = await WantAgent.getWantAgent(wantAgentInfo);
type:TIMER_TYPE_REALTIME, let options = {
repeat:false, type:systemTimer.TIMER_TYPE_IDLE,
persistent:false repeat:false,
} wantAgent:wantAgent
console.log("create timer") }
let timer = systemTimer.createTimer(options) try {
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) console.info("systemTimer_createTimer_test007 create timer")
systemTimer.createTimer(options, function(err, timerID){
console.log("start timer") expect(isIntNum(timerID)).assertTrue();
systemTimer.startTimer(timer, Number.MAX_VALUE-1) systemTimer.destroyTimer(timerID, function(e){
console.info('systemTimer_createTimer_test007 has SUCCESS');
console.log("stop timer") done();
systemTimer.stopTimer(timer) });
});
console.log("destroy timer") }catch (e) {
systemTimer.destroyTimer(timer) console.info('systemTimer_createTimer_test007 has failed for '+e);
console.log('SUB_systemTimer_Timer_JS_API_0800 end'); expect(false).assertTrue();
}); }
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_0900 /**
* @tc.name Test systemTimer.createTimer triggerTime = Number.MAX_VALUE * @tc.number SUB_systemTimer_createTimer_0800
* @tc.desc Test systemTimer_Timer API functionality. * @tc.name systemTimer_createTimer_test008
* @tc.desc Test createTimer() interfaces, type = 'TIMER_TYPE_REALTIME'(String)(Promise)
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test9',0, async () => { it('systemTimer_createTimer_test008', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_0900 start") console.info("systemTimer_createTimer_test008 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:'TIMER_TYPE_REALTIME',
repeat:false, repeat:false
persistent:false }
} try {
console.log("create timer") console.info("systemTimer_createTimer_test008 create timer")
let timer = systemTimer.createTimer(options) await systemTimer.createTimer(options);
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) expect(false).assertTrue();
}catch (e) {
console.log("start timer") console.info('systemTimer_createTimer_test008 has failed for '+e);
systemTimer.startTimer(timer, Number.MAX_VALUE) expect(e.toString().indexOf('Wrong argument type') != -1).assertTrue();
done();
console.log("stop timer") }
ystemTimer.stopTimer(timer) });
console.log("destroy timer") /**
systemTimer.destroyTimer(timer) * @tc.number SUB_systemTimer_createTimer_0900
console.log('SUB_systemTimer_Timer_JS_API_0900 end'); * @tc.name systemTimer_createTimer_test009
}); * @tc.desc Test createTimer() interfaces, type = 'TIMER_TYPE_REALTIME'(String)(callback)
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1000
* @tc.name Test systemTimer.createTimer repeat = true
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test10',0, async () => { it('systemTimer_createTimer_test009', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_1000 start") console.info("systemTimer_createTimer_test009 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:'TIMER_TYPE_REALTIME',
repeat:true, repeat:false
persistent:false }
} try {
console.log("create timer") console.info("systemTimer_createTimer_test009 create timer")
let timer = systemTimer.createTimer(options) systemTimer.createTimer(options, function(err, timerID){
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) console.info("systemTimer_createTimer_test009 failed")
});
console.log("start timer") expect(false).assertTrue();
systemTimer.startTimer(timer, 100000) }catch (e) {
console.info('systemTimer_createTimer_test009 has failed for '+e);
console.log("stop timer") expect(e.toString().indexOf('Wrong argument type') != -1).assertTrue();
systemTimer.stopTimer(timer) done();
}
console.log("destroy timer") });
systemTimer.destroyTimer(timer)
console.log('SUB_systemTimer_Timer_JS_API_1000 end'); /**
}); * @tc.number SUB_systemTimer_createTimer_1000
* @tc.name systemTimer_createTimer_test010
/** * @tc.desc Test createTimer() interfaces, type = null(Promise)
* @tc.number SUB_systemTimer_Timer_JS_API_1100
* @tc.name Test systemTimer.createTimer persistent = true
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test11',0, async () => { it('systemTimer_createTimer_test010', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_1100 start") console.info("systemTimer_createTimer_test010 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:null,
repeat:false, repeat:false
persistent:true }
} try {
console.log("create timer") console.info("systemTimer_createTimer_test010 create timer")
let timer = systemTimer.createTimer(options) await systemTimer.createTimer(options);
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) expect(false).assertTrue();
}catch (e) {
console.log("start timer") console.info('systemTimer_createTimer_test010 has failed for '+e);
systemTimer.startTimer(timer, 100000) expect(e.toString().indexOf('Wrong argument type') != -1).assertTrue();
done();
console.log("stop timer") }
systemTimer.stopTimer(timer) });
console.log("destroy timer") /**
systemTimer.destroyTimer(timer) * @tc.number SUB_systemTimer_createTimer_1100
console.log('SUB_systemTimer_Timer_JS_API_1100 end'); * @tc.name systemTimer_createTimer_test011
}); * @tc.desc Test createTimer() interfaces, type = null(callback)
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1200
* @tc.name Test systemTimer.createTimer repeat,persistent = true
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test12',0, async () => { it('systemTimer_createTimer_test011', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_1200 start") console.info("systemTimer_createTimer_test011 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:null,
repeat:true, repeat:false
persistent:true }
} try {
console.log("create timer") console.info("systemTimer_createTimer_test011 create timer")
let timer = systemTimer.createTimer(options) systemTimer.createTimer(options, function(err, timerID){
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) console.info("systemTimer_createTimer_test011 failed ")
});
console.log("start timer") expect(false).assertTrue();
systemTimer.startTimer(timer, 100000) }catch (e) {
console.info('systemTimer_createTimer_test011 has failed for '+e);
console.log("stop timer") expect(e.toString().indexOf('Wrong argument type') != -1).assertTrue();
systemTimer.stopTimer(timer) done();
}
console.log("destroy timer") });
systemTimer.destroyTimer(timer)
console.log('SUB_systemTimer_Timer_JS_API_1200 end'); /**
}); * @tc.number SUB_systemTimer_createTimer_1200
* @tc.name systemTimer_createTimer_test012
/** * @tc.desc Test createTimer() interfaces, type = undefined(Promise)
* @tc.number SUB_systemTimer_Timer_JS_API_1300
* @tc.name Test systemTimer.createTimer create,start,stop,destroy 1000 timers
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test13',0, async () => { it('systemTimer_createTimer_test012', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_1300 start") console.info("systemTimer_createTimer_test012 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:undefined,
repeat:false, repeat:false
persistent:false }
} try {
for (var index = 0; index < 1000; index++) console.info("systemTimer_createTimer_test012 create timer")
{ await systemTimer.createTimer(options);
console.log("create timer") expect(false).assertTrue();
let timer = systemTimer.createTimer(options) }catch (e) {
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) console.info('systemTimer_createTimer_test012 has failed for '+e);
expect(e.toString().indexOf('Wrong argument type') != -1).assertTrue();
console.log("start timer") done();
systemTimer.startTimer(timer, 100000) }
});
console.log("stop timer")
systemTimer.stopTimer(timer) /**
* @tc.number SUB_systemTimer_createTimer_1300
console.log("destroy timer") * @tc.name systemTimer_createTimer_test013
systemTimer.destroyTimer(timer) * @tc.desc Test createTimer() interfaces, type = undefined(callback)
console.log('SUB_systemTimer_Timer_JS_API_1300 end');
}
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1400
* @tc.name Test systemTimer.createTimer interval = 0
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test14',0, async () => { it('systemTimer_createTimer_test013', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_1400 start") console.info("systemTimer_createTimer_test013 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:undefined,
repeat:false, repeat:false
interval:0, }
persistent:false try {
} console.info("systemTimer_createTimer_test013 create timer")
console.log("create timer") systemTimer.createTimer(options, function(err, timerID){
let timer = systemTimer.createTimer(options) console.info("systemTimer_createTimer_test013 failed ")
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) });
expect(false).assertTrue();
console.log("start timer") }catch (e) {
systemTimer.startTimer(timer, 100000) console.info('systemTimer_createTimer_test013 has failed for '+e);
expect(e.toString().indexOf('Wrong argument type') != -1).assertTrue();
console.log("stop timer") done();
systemTimer.stopTimer(timer) }
});
console.log("destroy timer")
systemTimer.destroyTimer(timer) /**
console.log('SUB_systemTimer_Timer_JS_API_1400 end'); * @tc.number SUB_systemTimer_createTimer_1400
}); * @tc.name systemTimer_createTimer_test014
* @tc.desc Test createTimer() interfaces, no parameters(Promise)
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1500
* @tc.name Test systemTimer.createTimer interval = 5000
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test15',0, async () => { it('systemTimer_createTimer_test014', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_1500 start") console.info("systemTimer_createTimer_test014 start")
var options = { try {
type:TIMER_TYPE_REALTIME, console.info("systemTimer_createTimer_test014 create timer")
repeat:false, await systemTimer.createTimer();
interval:5000, expect(false).assertTrue();
persistent:false }catch (e) {
} console.info('systemTimer_createTimer_test014 has failed for '+e);
console.log("create timer") expect(e.toString().indexOf('Wrong number of arguments') != -1).assertTrue();
let timer = systemTimer.createTimer(options) done();
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) }
});
console.log("start timer")
systemTimer.startTimer(timer, 100000) /**
* @tc.number SUB_systemTimer_createTimer_1500
console.log("stop timer") * @tc.name systemTimer_createTimer_test015
systemTimer.stopTimer(timer) * @tc.desc Test createTimer() interfaces, repeat = 'false'(String) (Promise)
console.log("destroy timer")
systemTimer.destroyTimer(timer)
console.log('SUB_systemTimer_Timer_JS_API_1500 end');
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1600
* @tc.name Test systemTimer.createTimer interval = Number.MAX_VALUE/2
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test16',0, async () => { it('systemTimer_createTimer_test015', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_1600 start") console.info("systemTimer_createTimer_test015 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:systemTimer.TIMER_TYPE_REALTIME,
repeat:false, repeat:'false'
interval:Number.MAX_VALUE/2, }
persistent:false try {
} console.info("systemTimer_createTimer_test015 create timer")
console.log("create timer") await systemTimer.createTimer(options);
let timer = systemTimer.createTimer(options) expect(false).assertTrue();
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) }catch (e) {
console.info('systemTimer_createTimer_test015 has failed for '+e);
console.log("start timer") expect(e.toString().indexOf('Wrong argument type') != -1).assertTrue();
systemTimer.startTimer(timer, 100000) done();
}
console.log("stop timer") });
systemTimer.stopTimer(timer)
/**
console.log("destroy timer") * @tc.number SUB_systemTimer_createTimer_1600
systemTimer.destroyTimer(timer) * @tc.name systemTimer_createTimer_test016
console.log('SUB_systemTimer_Timer_JS_API_1600 end'); * @tc.desc Test createTimer() interfaces, repeat = 'false'(String)(callback)
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1700
* @tc.name Test systemTimer.createTimer interval = Number.MAX_VALUE-1
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test17',0, async () => { it('systemTimer_createTimer_test016', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_1700 start") console.info("systemTimer_createTimer_test016 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:systemTimer.TIMER_TYPE_REALTIME,
repeat:false, repeat:'false'
interval:Number.MAX_VALUE-1, }
persistent:false try {
} console.info("systemTimer_createTimer_test016 create timer")
console.log("create timer") systemTimer.createTimer(options, function(err, timerID){
let timer = systemTimer.createTimer(options) console.info("systemTimer_createTimer_test016 failed ")
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) });
expect(false).assertTrue();
console.log("start timer") }catch (e) {
systemTimer.startTimer(timer, 100000) console.info('systemTimer_createTimer_test016 has failed for '+e);
expect(e.toString().indexOf('Wrong argument type') != -1).assertTrue();
console.log("stop timer") done();
systemTimer.stopTimer(timer) }
});
console.log("destroy timer")
systemTimer.destroyTimer(timer) /**
console.log('SUB_systemTimer_Timer_JS_API_1700 end'); * @tc.number SUB_systemTimer_createTimer_1700
}); * @tc.name systemTimer_createTimer_test017
* @tc.desc Test createTimer() interfaces, repeat = 0(number) (Promise)
/** * @tc.size : MEDIUM
* @tc.number SUB_systemTimer_Timer_JS_API_1800 * @tc.type : Function
* @tc.name Test systemTimer.createTimer interval = Number.MAX_VALUE * @tc.level : Level 2
* @tc.desc Test systemTimer_Timer API functionality. */
it('systemTimer_createTimer_test017', 0, async function (done) {
console.info("systemTimer_createTimer_test017 start")
let options = {
type:systemTimer.TIMER_TYPE_REALTIME,
repeat:0
}
try {
console.info("systemTimer_createTimer_test017 create timer")
await systemTimer.createTimer(options);
expect(false).assertTrue();
}catch (e) {
console.info('systemTimer_createTimer_test017 has failed for '+e);
expect(e.toString().indexOf('Wrong argument type') != -1).assertTrue();
done();
}
});
/**
* @tc.number SUB_systemTimer_createTimer_1800
* @tc.name systemTimer_createTimer_test018
* @tc.desc Test createTimer() interfaces, repeat = 0(number)(callback)
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test18',0, async () => { it('systemTimer_createTimer_test018', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_1800 start") console.info("systemTimer_createTimer_test018 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:systemTimer.TIMER_TYPE_REALTIME,
repeat:false, repeat:0
interval:Number.MAX_VALUE, }
persistent:false try {
} console.info("systemTimer_createTimer_test018 create timer")
console.log("create timer") systemTimer.createTimer(options, function(err, timerID){
let timer = systemTimer.createTimer(options) console.info("systemTimer_createTimer_test018 failed ")
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) });
expect(false).assertTrue();
console.log("start timer") }catch (e) {
systemTimer.startTimer(timer, 100000) console.info('systemTimer_createTimer_test018 has failed for '+e);
expect(e.toString().indexOf('Wrong argument type') != -1).assertTrue();
console.log("stop timer") done();
systemTimer.stopTimer(timer) }
});
console.log("destroy timer")
systemTimer.destroyTimer(timer) /**
console.log('SUB_systemTimer_Timer_JS_API_1800 end'); * @tc.number SUB_systemTimer_startTimer_0100
}); * @tc.name systemTimer_startTimer_test001
* @tc.desc Test startTimer() interfaces, normal call(callback)
/**
* @tc.number SUB_systemTimer_Timer_JS_API_1900
* @tc.name Test systemTimer.createTimer WantAgent
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('systemTimer_Timer_test19',0, async () => { it('systemTimer_startTimer_test001', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_1900 start") console.info("systemTimer_startTimer_test001 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:systemTimer.TIMER_TYPE_IDLE,
repeat:false, repeat:false,
interval:100000, }
persistent:false let timerID = await systemTimer.createTimer(options);
} expect(isIntNum(timerID)).assertTrue();
console.log("create timer") let triggerTime = 5000;
let timer = systemTimer.createTimer(options) try {
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) console.info("systemTimer_startTimer_test001 start timer")
systemTimer.startTimer(timerID, triggerTime, function(err, data){
console.log("start timer") systemTimer.stopTimer(timerID, function(err, data){
systemTimer.startTimer(timer, 100000) systemTimer.destroyTimer(timerID, function(err, data){
console.info('systemTimer_startTimer_test001 has SUCCESS');
console.log("stop timer") done();
systemTimer.stopTimer(timer) });
});
console.log("destroy timer") });
systemTimer.destroyTimer(timer) }catch (e) {
console.log('SUB_systemTimer_Timer_JS_API_1900 end'); console.info('systemTimer_startTimer_test001 has failed for '+e);
}); expect(false).assertTrue();
}
/** });
* @tc.number SUB_systemTimer_Timer_JS_API_2000
* @tc.name Test systemTimer.createTimer Called back when the timer goes off. /**
* @tc.desc Test systemTimer_Timer API functionality. * @tc.number SUB_systemTimer_startTimer_0300
* @tc.size : MEDIUM * @tc.name systemTimer_startTimer_test003
* @tc.type : Function * @tc.desc Test startTimer() interfaces, timer = 0(callback)
* @tc.level : Level 0
*/
it('systemTimer_Timer_test20',0, async () => {
console.log("SUB_systemTimer_Timer_JS_API_2000 start")
var options = {
type:TIMER_TYPE_REALTIME,
repeat:false,
interval:100000,
persistent:false,
callback:callbackFunction
}
console.log("create timer")
let timer = systemTimer.createTimer(options)
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true)
console.log("start timer")
systemTimer.startTimer(timer, 100000)
console.log("stop timer")
systemTimer.stopTimer(timer)
console.log("destroy timer")
systemTimer.destroyTimer(timer)
console.log('SUB_systemTimer_Timer_JS_API_2000 end');
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2100
* @tc.name Test systemTimer.createTimer start a not exist timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test21',0, async () => { it('systemTimer_startTimer_test003', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_2100 start") console.info("systemTimer_startTimer_test003 start")
var options = { let timerID = 0;
type:TIMER_TYPE_REALTIME, let triggerTime = 5000;
repeat:false, try {
persistent:false console.info("systemTimer_startTimer_test003 start timer")
} systemTimer.startTimer(timerID, triggerTime, function(err, data){
console.log("create timer") systemTimer.stopTimer(timerID, function(err, data){
let timer = systemTimer.createTimer(options) systemTimer.destroyTimer(timerID, function(err, data){
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) console.info('systemTimer_startTimer_test003 has SUCCESS');
done();
console.log("start a not exist timer") });
systemTimer.startTimer(timer + 1, 100000) });
});
console.log("destroy timer") }catch (e) {
systemTimer.destroyTimer(timer) console.info('systemTimer_startTimer_test003 has failed for '+e);
console.log('SUB_systemTimer_Timer_JS_API_2100 end'); expect(false).assertTrue();
}); }
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2200 /**
* @tc.name Test systemTimer.createTimer stop a not exist timer * @tc.number SUB_systemTimer_startTimer_0500
* @tc.desc Test systemTimer_Timer API functionality. * @tc.name systemTimer_startTimer_test005
* @tc.desc Test startTimer() interfaces, triggerTime = -5000(callback)
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test22',0, async () => { it('systemTimer_startTimer_test005', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_2200 start") console.info("systemTimer_startTimer_test005 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:systemTimer.TIMER_TYPE_IDLE,
repeat:false, repeat:false,
persistent:false }
} let timerID = await systemTimer.createTimer(options);
console.log("create timer") expect(isIntNum(timerID)).assertTrue();
let timer = systemTimer.createTimer(options) let triggerTime = -5000;
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) try {
console.info("systemTimer_startTimer_test005 start timer")
console.log("start timer") systemTimer.startTimer(timerID, triggerTime, function(err, data){
systemTimer.startTimer(timer, 100000) console.info('systemTimer_startTimer_test005 failed');
});
console.log("stop a not exist timer") expect(false).assertTrue();
systemTimer.stopTimer(timer + 1) }catch (e) {
console.info('systemTimer_startTimer_test005 has failed for '+e);
console.log("stop the current timer") expect(e.toString().indexOf('Wrong argument triggerTime') != -1).assertTrue();
systemTimer.stopTimer(timer) done();
}
console.log("destroy timer") });
systemTimer.destroyTimer(timer)
console.log('SUB_systemTimer_Timer_JS_API_2200 end'); /**
}); * @tc.number SUB_systemTimer_stopTimer_0100
* @tc.name systemTimer_stopTimer_test001
/** * @tc.desc Test stopTimer() interfaces, normal call(callback)
* @tc.number SUB_systemTimer_Timer_JS_API_2300
* @tc.name Test systemTimer.createTimer destroy a not exist timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('systemTimer_Timer_test23',0, async () => { it('systemTimer_stopTimer_test001', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_2300 start") console.info("systemTimer_stopTimer_test001 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:systemTimer.TIMER_TYPE_IDLE,
repeat:false, repeat:false,
persistent:false }
} let timerID = await systemTimer.createTimer(options);
console.log("create timer") expect(isIntNum(timerID)).assertTrue();
let timer = systemTimer.createTimer(options) systemTimer.startTimer(timerID,5000);
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) try {
console.info("systemTimer_stopTimer_test001 stop timer")
console.log("start timer") systemTimer.stopTimer(timerID, function(err, data){
systemTimer.startTimer(timer, 100000) systemTimer.destroyTimer(timerID, function(err, data){
console.info('systemTimer_stopTimer_test001 has SUCCESS');
console.log("stop timer") done();
systemTimer.stopTimer(timer) });
});
console.log("destroy a not exist timer") }catch (e) {
systemTimer.destroyTimer(timer + 1) console.info('systemTimer_stopTimer_test001 has failed for '+e);
expect(false).assertTrue();
console.log("destroy timer") }
systemTimer.destroyTimer(timer) });
console.log('SUB_systemTimer_Timer_JS_API_2300 end');
}); /**
* @tc.number SUB_systemTimer_stopTimer_0400
/** * @tc.name systemTimer_stopTimer_test004
* @tc.number SUB_systemTimer_Timer_JS_API_2400 * @tc.desc Test stopTimer() interfaces, timerID is not defined(callback)
* @tc.name Test systemTimer.createTimer stop a not started timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('systemTimer_Timer_test24',0, async () => { it('systemTimer_stopTimer_test004', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_2400 start") console.info("systemTimer_stopTimer_test004 start")
var options = { try {
type:TIMER_TYPE_REALTIME, console.info("systemTimer_stopTimer_test004 stop timer")
repeat:false, systemTimer.stopTimer(timerID, function(err, data){
persistent:false console.info('systemTimer_stopTimer_test004 failed');
} });
console.log("create timer") expect(false).assertTrue();
let timer = systemTimer.createTimer(options) }catch (e) {
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) console.info('systemTimer_stopTimer_test004 has failed for '+e);
expect(e.toString().indexOf('timerID is not defined') != -1).assertTrue();
console.log("stop a not started timer") done();
systemTimer.stopTimer(timer) }
});
console.log("destroy timer")
systemTimer.destroyTimer(timer) /**
console.log('SUB_systemTimer_Timer_JS_API_2400 end'); * @tc.number SUB_systemTimer_destroyTimer_0100
}); * @tc.name systemTimer_destroyTimer_test001
* @tc.desc Test destroyTimer() interfaces, normal call(callback)
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2500
* @tc.name Test systemTimer.createTimer destroy a started timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('systemTimer_Timer_test25',0, async () => { it('systemTimer_destroyTimer_test001', 0, async function (done) {
console.log("SUB_systemTimer_Timer_JS_API_2500 start") console.info("systemTimer_destroyTimer_test001 start")
var options = { let options = {
type:TIMER_TYPE_REALTIME, type:systemTimer.TIMER_TYPE_IDLE,
repeat:false, repeat:false,
persistent:false }
} let timerID = await systemTimer.createTimer(options);
console.log("create timer") expect(isIntNum(timerID)).assertTrue();
let timer = systemTimer.createTimer(options) try {
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) console.info("systemTimer_destroyTimer_test001 destroy timer")
systemTimer.destroyTimer(timerID, function(err, data){
console.log("start timer") console.info('systemTimer_destroyTimer_test001 has SUCCESS');
systemTimer.startTimer(timer, 100000) done();
});
console.log("destroy a started timer") }catch (e) {
systemTimer.destroyTimer(timer) console.info('systemTimer_destroyTimer_test001 has failed for '+e);
console.log('SUB_systemTimer_Timer_JS_API_2500 end'); expect(false).assertTrue();
}); }
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2600 /**
* @tc.name Test systemTimer.createTimer repeat to start a timer * @tc.number SUB_systemTimer_destroyTimer_0400
* @tc.desc Test systemTimer_Timer API functionality. * @tc.name systemTimer_destroyTimer_test004
* @tc.desc Test destroyTimer() interfaces, timerID is not defined(callback)
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/
it('systemTimer_Timer_test26',0, async () => {
console.log("SUB_systemTimer_Timer_JS_API_2600 start")
var options = {
type:TIMER_TYPE_REALTIME,
repeat:false,
persistent:false
}
console.log("create timer")
let timer = systemTimer.createTimer(options)
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true)
console.log("start timer")
systemTimer.startTimer(timer, 100000)
console.log("start timer again")
systemTimer.startTimer(timer, 100000)
console.log("stop timer")
systemTimer.stopTimer(timer)
console.log("destroy timer")
systemTimer.destroyTimer(timer)
console.log('SUB_systemTimer_Timer_JS_API_2600 end');
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2700
* @tc.name Test systemTimer.createTimer repeat to stop a timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('systemTimer_Timer_test27',0, async () => {
console.log("SUB_systemTimer_Timer_JS_API_2700 start")
var options = {
type:TIMER_TYPE_REALTIME,
repeat:false,
persistent:false
}
console.log("create timer")
let timer = systemTimer.createTimer(options)
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true)
console.log("start timer")
systemTimer.startTimer(timer, 100000)
console.log("stop timer")
systemTimer.stopTimer(timer)
console.log("stop timer again")
systemTimer.stopTimer(timer)
console.log("destroy timer")
systemTimer.destroyTimer(timer)
console.log('SUB_systemTimer_Timer_JS_API_2700 end');
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2800
* @tc.name Test systemTimer.createTimer repeat to destroy a timer
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('systemTimer_Timer_test28',0, async () => {
console.log("SUB_systemTimer_Timer_JS_API_2800 start")
var options = {
type:TIMER_TYPE_REALTIME,
repeat:false,
persistent:false
}
console.log("create timer")
let timer = systemTimer.createTimer(options)
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true)
console.log("start timer")
systemTimer.startTimer(timer, 100000)
console.log("stop timer")
systemTimer.stopTimer(timer)
console.log("destroy timer")
systemTimer.destroyTimer(timer)
console.log("destroy timer again")
systemTimer.destroyTimer(timer)
console.log('SUB_systemTimer_Timer_JS_API_2800 end');
});
/**
* @tc.number SUB_systemTimer_Timer_JS_API_2900
* @tc.name Test systemTimer.createTTimer type = TIMER_TYPE_IDLE
* @tc.desc Test systemTimer_Timer API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('systemTimer_Timer_test29',0, async () => {
console.log("SUB_systemTimer_Timer_JS_API_2900 start")
var options = {
type:TIMER_TYPE_IDLE,
repeat:false,
persistent:false
}
console.log("create timer")
let timer = systemTimer.createTimer(options)
expect(parseInt(timer) == parseFloat(timer)).assertEqual(true)
console.log("start timer")
systemTimer.startTimer(timer, 100000)
console.log("stop timer")
systemTimer.stopTimer(timer)
console.log("destroy timer")
systemTimer.destroyTimer(timer)
console.log('SUB_systemTimer_Timer_JS_API_2900 end');
});
/**
* @function Used for callback functions
* @tc.name callbackFunction
*/ */
function callbackFunction() it('systemTimer_destroyTimer_test004', 0, async function (done) {
{ console.info("systemTimer_destroyTimer_test004 start")
console.log("Start to call the callback function") try {
} console.info("systemTimer_destroyTimer_test004 destroy timer")
}) systemTimer.destroyTimer(timerID, function(err, data){
\ No newline at end of file console.info('systemTimer_destroyTimer_test004 failed');
});
expect(false).assertTrue();
}catch (e) {
console.info('systemTimer_destroyTimer_test004 has failed for '+e);
expect(e.toString().indexOf('timerID is not defined') != -1).assertTrue();
done();
}
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册