未验证 提交 5aa1b7d6 编写于 作者: O openharmony_ci 提交者: Gitee

!5091 【OpenHarmony-3.1-Release】【powermgr】match for system api

Merge pull request !5091 from kangqiao/OpenHarmony-3.1-Release
......@@ -14,7 +14,6 @@
*/
import app from '@system.app'
import Context from '@ohos.napi_context'
import batteryInfo from '@ohos.batteryInfo';
import brightness from '@ohos.brightness';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
......
......@@ -14,10 +14,8 @@
*/
import app from '@system.app'
import Context from '@ohos.napi_context'
import runningLock from '@ohos.runningLock';
import power from '@ohos.power';
import '@ohos.permission.RUNNING_LOCK'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
......@@ -39,24 +37,25 @@ describe('appInfoTest_battery3', function () {
})
//createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback<RunningLock>)
it('create_running_lock_callback_test', 0, async function (done) {
runningLock.createRunningLock("running_lock_test_2", runningLock.RunningLockType.BACKGROUND, (error, runninglock) => {
if (typeof error === "undefined") {
console.info('create_running_lock_callback_test: runningLock is ' + runninglock);
expect(runninglock !== null).assertTrue();
let used = runninglock.isUsed();
console.info('create_running_lock_callback_test is used: ' + used);
expect(used).assertFalse();
runninglock.lock(500);
used = runninglock.isUsed();
console.info('after lock create_running_lock_callback_test is used: ' + used);
expect(used).assertTrue();
console.info('create_running_lock_callback_test success');
done();
} else {
console.log('create_running_lock_callback_test: ' + error);
expect().assertFail();
done();
}
runningLock.createRunningLock("running_lock_test_2", runningLock.RunningLockType.BACKGROUND,
(error, runninglock) => {
if (typeof error === "undefined") {
console.info('create_running_lock_callback_test: runningLock is ' + runninglock);
expect(runninglock !== null).assertTrue();
let used = runninglock.isUsed();
console.info('create_running_lock_callback_test is used: ' + used);
expect(used).assertFalse();
runninglock.lock(500);
used = runninglock.isUsed();
console.info('after lock create_running_lock_callback_test is used: ' + used);
expect(used).assertTrue();
console.info('create_running_lock_callback_test success');
done();
} else {
console.log('create_running_lock_callback_test: ' + error);
expect().assertFail();
done();
}
})
})
//lock(timeout: number)
......
......@@ -14,10 +14,8 @@
*/
import app from '@system.app'
import Context from '@ohos.napi_context'
import runningLock from '@ohos.runningLock';
import power from '@ohos.power';
import '@ohos.permission.RUNNING_LOCK'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
......
......@@ -17,8 +17,8 @@ import brightness from '@system.brightness';
import { describe } from 'deccjsunit/index';
const INPUT_ERROR_CODE_CODE = 202;
const SET_VALUE_MSG = "value is not an available number";
const SET_MODE_MSG = "value is not an available number";
const SET_VALUE_MSG = "setMode: value is not an available number";
const SET_MODE_MSG = "setMode: value is not an available number";
function sleep(time){
return new Promise((resolve) => setTimeout(resolve, time));
......
......@@ -14,7 +14,6 @@
*/
import runningLock from '@ohos.runningLock';
import '@ohos.permission.RUNNING_LOCK'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册