提交 8dee81b7 编写于 作者: Y yangziyong

feat: support suspend immediately

Signed-off-by: Nyangziyong <nsyangziyong@huawei.com>
上级 e42d86d6
......@@ -16,9 +16,11 @@ import powerManagerPowerTest from './power_manager_power.test.js'
import powerManagerRebootShutTest from './power_manager_rebootshut.test.js'
import powerManagerRunningLockTest from './power_manager_running_lock.test.js'
import powerPerformanceTest from './power_performance.test.js'
import powerManagerSuspendTest from './power_manager_forcesuspend.test.js'
export default function testsuite() {
powerManagerPowerTest()
//powerManagerRebootShutTest()
powerManagerRunningLockTest()
//powerPerformanceTest()
//powerManagerSuspendTest()
}
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import power from '@ohos.power';
import { describe, it, expect } from '@ohos/hypium'
export default function powerManagerSuspendTest() {
describe('powerManagerSuspendTest', function () {
console.log("*************Power Suspend Unit Test Begin*************");
/**
* @tc.number power_js_001
* @tc.name power_Suspend_Device_JSTest001
* @tc.desc Device reboot interface verification
*/
it('power_Suspend_Device_JSTest001', 0, async function (done) {
console.info('forcesuspend start');
power.wakeupDevice("power_Suspend_Device_JSTest001");
power.suspend(true);
let isScreenOn = await power.isScreenOn();
console.info('power_Suspend_Device_JSTest001' + isScreenOn);
expect(isScreenOn).assertFalse();
done();
})
})}
......@@ -141,5 +141,50 @@ describe('PowerManagerPowerTest', function () {
console.info('MODE_EXTREME_POWER_SAVE = ' + devicePowerMode);
expect(devicePowerMode === 603).assertTrue();
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0091
* @tc.name power_Suspend_Device_JSTest091
* @tc.desc Device suspend interface verification
*/
it('power_Suspend_Device_JSTest091', 0, async function (done) {
power.wakeupDevice("power_Suspend_Device_JSTest091");
power.suspend(undefined);
let isScreenOn = await power.isScreenOn();
console.info('power_Suspend_Device_JSTest091 ' + isScreenOn);
expect(isScreenOn).assertFalse();
console.info('suspend success done');
done();
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0092
* @tc.name power_Suspend_Device_JSTest092
* @tc.desc Device suspend interface verification
*/
it('power_Suspend_Device_JSTest092', 0, async function (done) {
power.wakeupDevice("power_Suspend_Device_JSTest092");
power.suspend();
let isScreenOn = await power.isScreenOn();
console.info('power_Suspend_Device_JSTest092 ' + isScreenOn);
expect(isScreenOn).assertFalse();
console.info('suspend success done');
done();
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0093
* @tc.name power_Suspend_Device_JSTest093
* @tc.desc Device suspend interface verification
*/
it('power_Suspend_Device_JSTest093', 0, async function (done) {
power.wakeupDevice("power_Suspend_Device_JSTest093");
power.suspend(false);
let isScreenOn = await power.isScreenOn();
console.info('power_Suspend_Device_JSTest093 ' + isScreenOn);
expect(isScreenOn).assertFalse();
console.info('suspend success done');
done();
})
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册