From 8df96cb367cf7e745d99ed200e81ae27c41611f3 Mon Sep 17 00:00:00 2001 From: logic42 Date: Tue, 24 May 2022 12:53:26 +0000 Subject: [PATCH] fixed bca55f9 from https://gitee.com/logic42/xts_acts/pulls/3274 change power performance testcases & screenon testcase Signed-off-by: logic42 --- powermgr/powermgrbattery/Test.json | 9 ++++- .../test/batterymanager_performance.test.js | 38 +------------------ .../js/default/test/power_performance_test.js | 34 ++--------------- 3 files changed, 13 insertions(+), 68 deletions(-) diff --git a/powermgr/powermgrbattery/Test.json b/powermgr/powermgrbattery/Test.json index b7ac14baa..fa78e7e02 100755 --- a/powermgr/powermgrbattery/Test.json +++ b/powermgr/powermgrbattery/Test.json @@ -7,6 +7,12 @@ "shell-timeout": "60000" }, "kits": [ + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup" + ] + }, { "test-file-name": [ "ActsPowerMgrBatteryTest.hap" @@ -15,5 +21,4 @@ "cleanup-apps": true } ] -} - +} \ No newline at end of file diff --git a/powermgr/powermgrbattery/src/main/js/default/test/batterymanager_performance.test.js b/powermgr/powermgrbattery/src/main/js/default/test/batterymanager_performance.test.js index a1461680a..1ed8f670c 100644 --- a/powermgr/powermgrbattery/src/main/js/default/test/batterymanager_performance.test.js +++ b/powermgr/powermgrbattery/src/main/js/default/test/batterymanager_performance.test.js @@ -14,7 +14,7 @@ */ import batteryInfo from '@ohos.batteryInfo'; -import {describe, it, expect} from 'deccjsunit/index'; +import { describe, it, expect } from 'deccjsunit/index'; describe('appInfoTest', function () { @@ -41,40 +41,6 @@ describe('appInfoTest', function () { avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue(); }) - /** - * @tc.number BatteryPerformance_002 - * @tc.name battery_chargingstatus_test - * @tc.desc Battery acquisition kit - */ - it('BatteryPerformance_002', 0, function () { - let startTime = new Date().getTime(); - for (let i = 0; i < MAXNUM; i++) { - batteryInfo.chargingStatus; - } - - let waitTime = new Date().getTime() - startTime; - let avgTime = waitTime / MAXNUM * MS_TO_US; //us - console.info(`BATTERY_Performance_002: Promise: batteryInfo.chargingStatus Average Time : ${waitTime}`); - avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue(); - }) - - /** - * @tc.number BatteryPerformance_003 - * @tc.name battery_healthstatus_test - * @tc.desc Battery acquisition kit - */ - it('BatteryPerformance_003', 0, function () { - let startTime = new Date().getTime(); - for (let i = 0; i < MAXNUM; i++) { - batteryInfo.healthStatus; - } - - let waitTime = new Date().getTime() - startTime; - let avgTime = waitTime / MAXNUM * MS_TO_US; //us - console.info(`BatteryPerformance_003: Promise: batteryInfo.healthStatus Average Time : ${waitTime}`); - avgTime < HEALTH_LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue(); - }) - /** * @tc.number BatteryPerformance_004 * @tc.name battery_pluggedtype_test @@ -92,7 +58,7 @@ describe('appInfoTest', function () { avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue(); }) - /** + /** * @tc.number BatteryPerformance_005 * @tc.name battery_technology_test * @tc.desc Battery acquisition kit diff --git a/powermgr/powermgrpower/src/main/js/default/test/power_performance_test.js b/powermgr/powermgrpower/src/main/js/default/test/power_performance_test.js index 82bcaa08b..fa4dd0e7f 100644 --- a/powermgr/powermgrpower/src/main/js/default/test/power_performance_test.js +++ b/powermgr/powermgrpower/src/main/js/default/test/power_performance_test.js @@ -16,13 +16,13 @@ import runningLock from '@ohos.runningLock'; import power from '@ohos.power'; import brightness from '@ohos.brightness'; -import {describe, it, expect} from 'deccjsunit/index'; +import { describe, it, expect } from 'deccjsunit/index'; describe('appInfoTest', function () { console.log("*************Power Performance Test Begin*************"); const MAXNUM = 1000; - const MIDNUM =100; + const MIDNUM = 100; const MS_TO_US = 1000; const LIMIT_TIME = 1500; const LIMIT_TIME_LONG = 4000; @@ -44,32 +44,6 @@ describe('appInfoTest', function () { done(); }) - /** - * @tc.number PowerPerformance_002 - * @tc.name isUsed_test - * @tc.desc Interface is called normally - */ - it('PowerPerformance_002', 0, async function (done) { - let avgTime = 0; - runningLock.createRunningLock("test", runningLock.RunningLockType.BACKGROUND, (error, runningLock) => { - if (typeof error === "undefined") { - let startTime = new Date().getTime(); - for (let i = 0; i < MAXNUM; i++) { - runningLock.isUsed(); - } - let waitTime = new Date().getTime() - startTime; - avgTime = waitTime / MAXNUM * MS_TO_US; //us - console.info(`PowerPerformance_002: Promise: runningLock.isUsed Wait Time : ${waitTime}`); - avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue(); - done(); - } else { - console.log('PowerPerformance_002: ' + error); - console.info('PowerPerformance_002: isUsed is ' + runningLock); - done(); - } - }) - }) - /** * @tc.number PowerPerformance_003 * @tc.name lock_test @@ -87,8 +61,8 @@ describe('appInfoTest', function () { avgTime = avgTime + waitTime; //us console.info(`PowerPerformance_003: Promise: runningLock.lock Wait Time : ${waitTime}`); avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue(); - runningLock.unlock(); - done(); + runningLock.unlock(); + done(); } else { console.log('PowerPerformance_003: ' + error); console.info('PowerPerformance_003: lock is ' + runningLock); -- GitLab