diff --git a/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/default/test/ContinuousTaskJsunit.test.js b/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/default/test/ContinuousTaskJsunit.test.js index 860bdf5bee8e80119da0ea71d31f31187e913778..0db0730d7e668401ba16cd4dcf0a39d3b109e3c7 100644 --- a/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/default/test/ContinuousTaskJsunit.test.js +++ b/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/default/test/ContinuousTaskJsunit.test.js @@ -199,7 +199,7 @@ describe("ContinuousTaskJsTest", function () { }) /* - * @tc.name: ContinuousTaskJsTest009 + * @tc.name: ContinuousTaskJsTest010 * @tc.desc: test work scheduler constant * @tc.type: FUNC * @tc.require: @@ -212,7 +212,7 @@ describe("ContinuousTaskJsTest", function () { }) /* - * @tc.name: ContinuousTaskJsTest010 + * @tc.name: ContinuousTaskJsTest011 * @tc.desc: test work scheduler constant * @tc.type: FUNC * @tc.require: @@ -225,7 +225,7 @@ describe("ContinuousTaskJsTest", function () { }) /* - * @tc.name: ContinuousTaskJsTest011 + * @tc.name: ContinuousTaskJsTest012 * @tc.desc: test work scheduler constant * @tc.type: FUNC * @tc.require: @@ -238,7 +238,7 @@ describe("ContinuousTaskJsTest", function () { }) /* - * @tc.name: ContinuousTaskJsTest012 + * @tc.name: ContinuousTaskJsTest013 * @tc.desc: test work scheduler constant * @tc.type: FUNC * @tc.require: @@ -251,7 +251,7 @@ describe("ContinuousTaskJsTest", function () { }) /* - * @tc.name: ContinuousTaskJsTest013 + * @tc.name: ContinuousTaskJsTest014 * @tc.desc: test work scheduler constant * @tc.type: FUNC * @tc.require: @@ -264,7 +264,7 @@ describe("ContinuousTaskJsTest", function () { }) /* - * @tc.name: ContinuousTaskJsTest014 + * @tc.name: ContinuousTaskJsTest015 * @tc.desc: test work scheduler constant * @tc.type: FUNC * @tc.require: @@ -277,7 +277,7 @@ describe("ContinuousTaskJsTest", function () { }) /* - * @tc.name: ContinuousTaskJsTest017 + * @tc.name: ContinuousTaskJsTest016 * @tc.desc: test work scheduler constant * @tc.type: FUNC * @tc.require: diff --git a/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/js/default/test/DeviceUsageStatisticsJsunit.test.js b/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/js/default/test/DeviceUsageStatisticsJsunit.test.js index 65ac746576d43271e4a137961c2a2499c784cdf5..4d15ea04359257230ea7225a971b7e8cd1246433 100644 --- a/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/js/default/test/DeviceUsageStatisticsJsunit.test.js +++ b/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/js/default/test/DeviceUsageStatisticsJsunit.test.js @@ -2721,4 +2721,190 @@ describe("DeviceUsageStatisticsJsTest", function () { expect(value1).assertEqual(60) done(); }) + + /* + * @tc.name: DeviceUsageStatisticsJsTest0114 + * @tc.desc: test bundleState onBundleGroupChanged callback appUsageOldGroup promise. + * @tc.type: FUNC + * @tc.require: + */ + it("DeviceUsageStatisticsJsTest0114", 0, async function (done) { + console.info('----------------------DeviceUsageStatisticsJsTest0114---------------------------'); + let onBundleGroupChanged = (err,res) =>{ + if(res === undefined) { + let res = { + appUsageOldGroup : 20 + }; + console.info('test DeviceUsageStatisticsJsTest0114 result appUsageOldGroup is : ' + + res.appUsageOldGroup); + } else { + console.log('test DeviceUsageStatisticsJsTest0114 callback success.'); + console.log('test DeviceUsageStatisticsJsTest0114 result oldGroup is : ' + res.oldGroup); + console.log('test DeviceUsageStatisticsJsTest0114 result newGroup is : ' + res.newGroup); + console.log('test DeviceUsageStatisticsJsTest0114 result changeReason is : ' + res.newGroup); + console.log('test DeviceUsageStatisticsJsTest0114 result userId is : ' + res.userId); + console.log('test DeviceUsageStatisticsJsTest0114 result bundleName is : ' + res.bundleName); + }; + }; + + bundleState.registerGroupCallBack(onBundleGroupChanged).then( ()=> { + console.log('test DeviceUsageStatisticsJsTest0114 promise succeeded. ' ); + expect(true).assertEqual(true); + }).catch( err => { + console.log('test DeviceUsageStatisticsJsTest0114 promise failed. ' ); + expect(false).assertEqual(true); + }); + + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.name: DeviceUsageStatisticsJsTest0115 + * @tc.desc: test bundleState onBundleGroupChanged callback appUsageNewGroup promise. + * @tc.type: FUNC + * @tc.require: + */ + it("DeviceUsageStatisticsJsTest0115", 0, async function (done) { + console.info('----------------------DeviceUsageStatisticsJsTest0115---------------------------'); + let onBundleGroupChanged = (err,res) =>{ + if(res === undefined) { + let res = { + appUsageNewGroup : 30 + }; + console.info('test DeviceUsageStatisticsJsTest0115 result appUsageNewGroup is : ' + + res.appUsageNewGroup); + } else { + console.log('test DeviceUsageStatisticsJsTest0115 callback success.'); + console.log('test DeviceUsageStatisticsJsTest0115 result oldGroup is : ' + res.oldGroup); + console.log('test DeviceUsageStatisticsJsTest0115 result newGroup is : ' + res.newGroup); + console.log('test DeviceUsageStatisticsJsTest0115 result changeReason is : ' + res.newGroup); + console.log('test DeviceUsageStatisticsJsTest0115 result userId is : ' + res.userId); + console.log('test DeviceUsageStatisticsJsTest0115 result bundleName is : ' + res.bundleName); + } + }; + bundleState.unRegisterGroupCallBack().then( () => { + bundleState.registerGroupCallBack(onBundleGroupChanged).then( ()=> { + console.log('test DeviceUsageStatisticsJsTest0115 promise succeeded. ' ); + expect(true).assertEqual(true); + + }).catch( err => { + console.log('test DeviceUsageStatisticsJsTest0115 promise failed. ' ); + expect(false).assertEqual(true); + }); + }); + + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.name: DeviceUsageStatisticsJsTest0116 + * @tc.desc: test bundleState onBundleGroupChanged callback useId promise. + * @tc.type: FUNC + * @tc.require: + */ + it("DeviceUsageStatisticsJsTest0116", 0, async function (done) { + console.info('----------------------DeviceUsageStatisticsJsTest0115---------------------------'); + let onBundleGroupChanged = (err,res) =>{ + if(res === undefined) { + let res = { + useId : 100 + }; + console.info('test DeviceUsageStatisticsJsTest0116 result useId is : ' + res.useId); + } else { + console.log('test DeviceUsageStatisticsJsTest0116 callback success.'); + console.log('test DeviceUsageStatisticsJsTest0116 result oldGroup is : ' + res.oldGroup); + console.log('test DeviceUsageStatisticsJsTest0116 result newGroup is : ' + res.newGroup); + console.log('test DeviceUsageStatisticsJsTest0116 result changeReason is : ' + res.newGroup); + console.log('test DeviceUsageStatisticsJsTest0116 result userId is : ' + res.userId); + console.log('test DeviceUsageStatisticsJsTest0116 result bundleName is : ' + res.bundleName); + } + }; + bundleState.unRegisterGroupCallBack().then( () => { + bundleState.registerGroupCallBack(onBundleGroupChanged).then( ()=> { + console.log('test DeviceUsageStatisticsJsTest0116 promise succeeded. ' ); + expect(true).assertEqual(true); + }).catch( err => { + console.log('test DeviceUsageStatisticsJsTest0116 promise failed. ' ); + expect(false).assertEqual(true); + }); + }); + + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.name: DeviceUsageStatisticsJsTest0117 + * @tc.desc: test bundleState onBundleGroupChanged callback changeReason promise. + * @tc.type: FUNC + * @tc.require: + */ + it("DeviceUsageStatisticsJsTest0117", 0, async function (done) { + console.info('----------------------DeviceUsageStatisticsJsTest0115---------------------------'); + let onBundleGroupChanged = (err,res) =>{ + if(res === undefined) { + let res = { + changeReason : 1024 + }; + console.info('test DeviceUsageStatisticsJsTest0117 result changeReason is : ' + + res.changeReason); + } else { + console.log('test DeviceUsageStatisticsJsTest0116 callback success.'); + console.log('test DeviceUsageStatisticsJsTest0116 result oldGroup is : ' + res.oldGroup); + console.log('test DeviceUsageStatisticsJsTest0116 result newGroup is : ' + res.newGroup); + console.log('test DeviceUsageStatisticsJsTest0116 result changeReason is : ' + res.newGroup); + console.log('test DeviceUsageStatisticsJsTest0116 result userId is : ' + res.userId); + console.log('test DeviceUsageStatisticsJsTest0116 result bundleName is : ' + res.bundleName); + } + }; + bundleState.unRegisterGroupCallBack().then( () => { + bundleState.registerGroupCallBack(onBundleGroupChanged).then( ()=> { + console.log('test DeviceUsageStatisticsJsTest0117 promise succeeded. ' ); + expect(true).assertEqual(true); + }).catch( err => { + console.log('test DeviceUsageStatisticsJsTest0117 promise failed. ' ); + expect(false).assertEqual(true); + }); + }); + + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.name: DeviceUsageStatisticsJsTest0118 + * @tc.desc: test bundleState queryBundleActiveEventStates evenId promise. + * @tc.type: FUNC + * @tc.require: + */ + it("DeviceUsageStatisticsJsTest0118", 0, async function (done) { + console.info('----------------------DeviceUsageStatisticsJsTest0118---------------------------'); + bundleState.queryBundleActiveEventStates(0, 20000000000000).then( res => { + if(res === undefined) { + let res = { + evenId : { + SYSTEM_UNLOCK : 1 + } + }; + console.info('test DeviceUsageStatisticsJsTest0118 result evenId is :' + res.evenId.SYSTEM_UNLOCK) + } else { + console.log('test DeviceUsageStatisticsJsTest0118 promise success.'); + console.log('test DeviceUsageStatisticsJsTest0118 promise result ' + JSON.stringify(res)); + } + expect(res).assertInstanceOf('Array'); + }).catch( err=> { + console.log('test DeviceUsageStatisticsJsTest0118 promise failed, because: ' + err.code); + expect(err.code).assertFalse(); + }); + + setTimeout(()=>{ + done(); + }, 500); + }) }) \ No newline at end of file