未验证 提交 137eae1d 编写于 作者: O openharmony_ci 提交者: Gitee

!3275 【Power】电源测试用例调整--同步Beta1

Merge pull request !3275 from logic42/cherry-pick-1653397775
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
"shell-timeout": "60000" "shell-timeout": "60000"
}, },
"kits": [ "kits": [
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup"
]
},
{ {
"test-file-name": [ "test-file-name": [
"ActsPowerMgrBatteryTest.hap" "ActsPowerMgrBatteryTest.hap"
...@@ -15,5 +21,4 @@ ...@@ -15,5 +21,4 @@
"cleanup-apps": true "cleanup-apps": true
} }
] ]
} }
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import batteryInfo from '@ohos.batteryInfo'; import batteryInfo from '@ohos.batteryInfo';
import {describe, it, expect} from 'deccjsunit/index'; import { describe, it, expect } from 'deccjsunit/index';
describe('appInfoTest', function () { describe('appInfoTest', function () {
...@@ -41,40 +41,6 @@ describe('appInfoTest', function () { ...@@ -41,40 +41,6 @@ describe('appInfoTest', function () {
avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue(); 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.number BatteryPerformance_004
* @tc.name battery_pluggedtype_test * @tc.name battery_pluggedtype_test
...@@ -92,7 +58,7 @@ describe('appInfoTest', function () { ...@@ -92,7 +58,7 @@ describe('appInfoTest', function () {
avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue(); avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
}) })
/** /**
* @tc.number BatteryPerformance_005 * @tc.number BatteryPerformance_005
* @tc.name battery_technology_test * @tc.name battery_technology_test
* @tc.desc Battery acquisition kit * @tc.desc Battery acquisition kit
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
import runningLock from '@ohos.runningLock'; import runningLock from '@ohos.runningLock';
import power from '@ohos.power'; import power from '@ohos.power';
import brightness from '@ohos.brightness'; import brightness from '@ohos.brightness';
import {describe, it, expect} from 'deccjsunit/index'; import { describe, it, expect } from 'deccjsunit/index';
describe('appInfoTest', function () { describe('appInfoTest', function () {
console.log("*************Power Performance Test Begin*************"); console.log("*************Power Performance Test Begin*************");
const MAXNUM = 1000; const MAXNUM = 1000;
const MIDNUM =100; const MIDNUM = 100;
const MS_TO_US = 1000; const MS_TO_US = 1000;
const LIMIT_TIME = 1500; const LIMIT_TIME = 1500;
const LIMIT_TIME_LONG = 4000; const LIMIT_TIME_LONG = 4000;
...@@ -44,32 +44,6 @@ describe('appInfoTest', function () { ...@@ -44,32 +44,6 @@ describe('appInfoTest', function () {
done(); 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.number PowerPerformance_003
* @tc.name lock_test * @tc.name lock_test
...@@ -87,8 +61,8 @@ describe('appInfoTest', function () { ...@@ -87,8 +61,8 @@ describe('appInfoTest', function () {
avgTime = avgTime + waitTime; //us avgTime = avgTime + waitTime; //us
console.info(`PowerPerformance_003: Promise: runningLock.lock Wait Time : ${waitTime}`); console.info(`PowerPerformance_003: Promise: runningLock.lock Wait Time : ${waitTime}`);
avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue(); avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
runningLock.unlock(); runningLock.unlock();
done(); done();
} else { } else {
console.log('PowerPerformance_003: ' + error); console.log('PowerPerformance_003: ' + error);
console.info('PowerPerformance_003: lock is ' + runningLock); console.info('PowerPerformance_003: lock is ' + runningLock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册