mirror of
https://github.com/openharmony/third_party_jsframework.git
synced 2026-07-23 02:45:21 -04:00
9c1a3fb6b3
Signed-off-by: sunfei <sunfei.sun@huawei.com> Change-Id: I5a1d9297c3236ecdd06304d1efcac2b37647ee14
42 lines
1.8 KiB
JavaScript
42 lines
1.8 KiB
JavaScript
import { paramMock } from "./utils"
|
|
|
|
export function mockScreenLock () {
|
|
global.systemplugin.screenLock = {
|
|
isScreenLocked: function (...args) {
|
|
console.warn("screenLock.isScreenLocked interface mocked in the Previewer. How this interface works on the" +
|
|
" Previewer may be different from that on a real device.")
|
|
const len = args.length
|
|
if (typeof args[len - 1] === 'function') {
|
|
args[len - 1].call(this, paramMock.businessErrorMock,paramMock.paramBooleanMock)
|
|
} else {
|
|
return new Promise((resolve) => {
|
|
resolve(paramMock.paramBooleanMock);
|
|
})
|
|
}
|
|
},
|
|
isSecureMode: function (...args) {
|
|
console.warn("screenLock.isSecureMode interface mocked in the Previewer. How this interface works on the" +
|
|
" Previewer may be different from that on a real device.")
|
|
const len = args.length
|
|
if (typeof args[len - 1] === 'function') {
|
|
args[len - 1].call(this, paramMock.businessErrorMock,paramMock.paramBooleanMock)
|
|
} else {
|
|
return new Promise((resolve) => {
|
|
resolve(paramMock.paramBooleanMock);
|
|
})
|
|
}
|
|
},
|
|
unlockScreen: function (...args) {
|
|
console.warn("screenLock.unlockScreen interface mocked in the Previewer. How this interface works on the" +
|
|
" Previewer may be different from that on a real device.")
|
|
const len = args.length
|
|
if (typeof args[len - 1] === 'function') {
|
|
args[len - 1].call(this, paramMock.businessErrorMock)
|
|
} else {
|
|
return new Promise((resolve) => {
|
|
resolve();
|
|
})
|
|
}
|
|
}
|
|
}
|
|
} |