From 9ae8165cd583b52c03ad382e653e4fc92caf13fb Mon Sep 17 00:00:00 2001 From: qigongming Date: Fri, 18 Mar 2022 16:47:18 +0800 Subject: [PATCH] new user code Signed-off-by: qigongming Change-Id: I171fe9034b170d010776b958c8d56c446866785c --- .../test/DeviceUsageStatisticsJsunit.test.js | 14 +++--- .../js/default/test/WorkScheduler.test.js | 46 +++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) 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 bff7ce582..b0a84e203 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 @@ -54,7 +54,7 @@ describe("DeviceUsageStatisticsJsTest", function () { */ it("DeviceUsageStatisticsJsTest001", 0, async function (done) { console.info('----------------------DeviceUsageStatisticsJsTest001---------------------------'); - let bundleName = 'com.example.deviceUsageStatistics'; + let bundleName = 'com.explace.deviceUsageStatistics'; bundleState.isIdleState(bundleName).then((res) => { console.info('BUNDLE_ACTIVE isIdleState promise success.'); expect(true).assertEqual(true); @@ -76,7 +76,7 @@ describe("DeviceUsageStatisticsJsTest", function () { */ it("DeviceUsageStatisticsJsTest002", 0, async function (done) { console.info('----------------------DeviceUsageStatisticsJsTest002---------------------------'); - let bundleName = 'com.example.deviceUsageStatistics'; + let bundleName = 'com.explace.deviceUsageStatistics'; bundleState.isIdleState(bundleName, (err, res) => { if(err.code === 0) { console.info('BUNDLE_ACTIVE isIdleState callback success.'); @@ -438,7 +438,7 @@ describe("DeviceUsageStatisticsJsTest", function () { if(err.code === 0) { expect(true).assertEqual(true); if(res === undefined) { - res = [{bundleName: 'www.example.com'}]; + res = [{bundleName: 'www.explace.com'}]; } console.log('test BundleStateInfo bundleName :' + res[0].bundleName) } else { @@ -850,7 +850,7 @@ describe("DeviceUsageStatisticsJsTest", function () { bundleState.queryCurrentBundleActiveStates(beginTime, endTime).then((res) => { expect(true).assertEqual(true); let bundleStateInfo1 = { - bundleName: 'www.example.com', + bundleName: 'www.explace.com', abilityPrevAccessTime: 0, abilityInFgTotalTime: 0 }; @@ -861,7 +861,7 @@ describe("DeviceUsageStatisticsJsTest", function () { }; if(res === undefined) { res = []; - res['www.example.com'] = bundleStateInfo1; + res['www.explace.com'] = bundleStateInfo1; res['www.baidu.com'] = bundleStateInfo2; for(let k in res) { console.log('test BundleStateInfo key :' + k + ',value is :' + JSON.stringify(res[k])); @@ -891,12 +891,12 @@ describe("DeviceUsageStatisticsJsTest", function () { expect(true).assertEqual(true); if(res === undefined) { let bundleStateInfo = { - bundleName: 'www.example.com', + bundleName: 'www.explace.com', abilityPrevAccessTime: 0, abilityInFgTotalTime: 0 }; res = [{ - bundleName: 'www.baidu.com', + bundleName: 'www.explace.com', abilityPrevAccessTime: 0, abilityInFgTotalTime: 0, merge : function (toMerge) { diff --git a/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/default/test/WorkScheduler.test.js b/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/default/test/WorkScheduler.test.js index c14aa9cd4..04ed304c9 100644 --- a/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/default/test/WorkScheduler.test.js +++ b/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/default/test/WorkScheduler.test.js @@ -849,7 +849,7 @@ describe("WorkSchedulerJsTest", function () { done(); }) - /* + /* * @tc.name: WorkSchedulerJsTest044 * @tc.desc: test work scheduler without conditions. * @tc.type: FUNC @@ -870,7 +870,7 @@ describe("WorkSchedulerJsTest", function () { done(); }) - /* + /* * @tc.name: WorkSchedulerJsTest045 * @tc.desc: test work scheduler without conditions. * @tc.type: FUNC @@ -901,11 +901,11 @@ describe("WorkSchedulerJsTest", function () { workId: 7, bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", abilityName: "com.mytest.abilityName", - networkType: workScheduler.NetworkType.NETWORK_TYPE_ANY + networkType: NETWORK_TYPE_ANY } let res = workScheduler.startWork(workInfo); - expect(res).assertEqual(true) - console.info("workschedulerLog workInfo networkType :" + workInfo.networkType) + expect(res).assertEqual(true); + console.info("workSchedulerLog workInfo networkType :" + workInfo.networkType) done(); }) @@ -921,11 +921,11 @@ describe("WorkSchedulerJsTest", function () { workId: 5, bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", abilityName: "com.mytest.abilityName", - ChargingType: workScheduler.ChargingType.CHARGING_PLUGGED_AC + chargerType: workScheduler.ChargingType.CHARGING_PLUGGED_AC } let res = workScheduler.startWork(workInfo); - expect(res).assertEqual(true) - console.info("workschedulerLog workInfo ChargingType :" + workInfo.ChargingType.CHARGING_PLUGGED_AC) + expect(res).assertEqual(true); + console.info("workSchedulerLog workInfo ChargingType :" + workScheduler.ChargingType.CHARGING_PLUGGED_AC) done(); }) @@ -944,14 +944,14 @@ describe("WorkSchedulerJsTest", function () { batteryStatus: workScheduler.BatteryStatus.BATTERY_STATUS_LOW } let res = workScheduler.startWork(workInfo); - expect(res).assertEqual(true) - console.info("workschedulerLog workInfo BatteryStatus :" + workInfo.BatteryStatus.BATTERY_STATUS_LOW) + expect(res).assertEqual(true); + console.info("workSchedulerLog workInfo BatteryStatus :" + workScheduler.BatteryStatus.BATTERY_STATUS_LOW) done(); }) /* * @tc.name: WorkSchedulerJsTest049 - * @tc.desc: test workSchedulerExtensionAbility onWorkStart + * @tc.desc: test WorkSchedulerExtensoinAbility onWorkStart * @tc.type: FUNC * @tc.require: */ @@ -962,14 +962,14 @@ describe("WorkSchedulerJsTest", function () { bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", abilityName: "com.mytest.abilityName", } - var res = workScheduler.onWorkStart(workInfo); - expect(res).assertEqual(true) + let res = workScheduler.onWorkStart(workInfo); + expect(res).assertEqual(true); done(); }) /* * @tc.name: WorkSchedulerJsTest050 - * @tc.desc: test workSchedulerExtensionAbility onWorkStop + * @tc.desc: test WorkSchedulerExtensoinAbility onWorkStop * @tc.type: FUNC * @tc.require: */ @@ -980,12 +980,12 @@ describe("WorkSchedulerJsTest", function () { bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", abilityName: "com.mytest.abilityName", } - var res = workSchedulerCallback.onWorkStart(workInfo); + let res = workSchedulerCallback.onWorkStop(workInfo); if(res === true) { - let stopRes = workSchedulerCallback.onWorkStop(workInfo, false); - except(stopRes).assertEqual(true) + let stopRes = WorkSchedulerCallback.onWorkStop(workInfo,false); + expect(stopRes).assertEqual(true); } else { - expect(false).assertEqual(true) + expect(false).assertEqual(true); } done(); }) @@ -1004,8 +1004,8 @@ describe("WorkSchedulerJsTest", function () { abilityName: "com.mytest.abilityName", } var res = workScheduler.startWork(workInfo); - expect(res).assertEqual(true) - console.log('test workScheduler workInfo bundleName :' + info.bundleName); + expect(res).assertEqual(true); + console.log("workScheduler workInfo bundleName :" + info.bundleName) done(); }) @@ -1018,13 +1018,13 @@ describe("WorkSchedulerJsTest", function () { it("WorkSchedulerJsTest052", 0, async function (done) { console.info('----------------------WorkSchedulerJsTest052---------------------------'); let workInfo = { - workId: 8, + workId: 4, bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", abilityName: "com.mytest.abilityName", } var res = workScheduler.startWork(workInfo); - expect(res).assertEqual(true) - console.log('test workScheduler workInfo abilityName :' + info.abilityName); + expect(res).assertEqual(true); + console.log("workScheduler workInfo abilityName :" + info.abilityName) done(); }) }) \ No newline at end of file -- GitLab