From ea7bbf99f9630534c8168b76d1da7af307a5f7bb Mon Sep 17 00:00:00 2001 From: qiuxiangdong Date: Tue, 19 Apr 2022 11:44:05 +0800 Subject: [PATCH] feat: Supports hibernation interfaces for devices such as PC Signed-off-by: qiuxiangdong --- .../test/power_manager_running_lock.test.js | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/powermgr/powermgrbattery_rk3568/src/main/js/default/test/power_manager_running_lock.test.js b/powermgr/powermgrbattery_rk3568/src/main/js/default/test/power_manager_running_lock.test.js index be9f5aa4b..ae59cc858 100755 --- a/powermgr/powermgrbattery_rk3568/src/main/js/default/test/power_manager_running_lock.test.js +++ b/powermgr/powermgrbattery_rk3568/src/main/js/default/test/power_manager_running_lock.test.js @@ -210,4 +210,63 @@ describe('appInfoTest', function () { } }) }) + it('power_wakeupDevice_test_string', 0, async function (done) {//wakeupDevice(detail: string): void + power.isScreenOn() + .then(screenOn => { + console.info('power_wakeupDevice_test_string: The current screenOn is ' + screenOn); + if (screenOn) { + power.suspendDevice(); + } + }) + .catch(error => { + console.log('power_wakeupDevice_test_string error: ' + error); + expect().assertFail(); + done(); + }) + setTimeout(function(){ + power.wakeupDevice("power_wakeupDevice_test_string"); + power.isScreenOn() + .then(screenOn => { + console.info('power_wakeupDevice_test_string: The current screenOn is ' + screenOn); + expect(screenOn).assertTrue(); + console.info('power_wakeupDevice_test_string success'); + done(); + }) + .catch(error => { + console.log('power_wakeupDevice_test_string error: ' + error); + expect().assertFail(); + done(); + }) + }, 2000); + }) + it('power_suspendDevice_test', 0, async function (done) {//function suspendDevice(): void; + power.isScreenOn() + .then(screenOn => { + console.info('power_suspendDevice_test: The current screenOn is ' + screenOn); + if (!screenOn) { + power.wakeupDevice("power_suspendDevice_test"); + } + }) + .catch(error => { + console.log('power_suspendDevice_test error: ' + error); + expect().assertFail(); + done(); + }) + setTimeout(function(){ + power.suspendDevice(); + console.info('power_suspendDevice_test: SuspendDevice end'); + power.isScreenOn() + .then(screenOn => { + console.info('power_suspendDevice_test: The current screenOn is ' + screenOn); + expect(screenOn).assertFalse(); + console.info('power_suspendDevice_test success'); + done(); + }) + .catch(error => { + console.log('power_suspendDevice_test error: ' + error); + expect().assertFail(); + done(); + }) + }, 2000); + }) }) -- GitLab