mirror of
https://gitee.com/openharmony/third_party_jsframework
synced 2024-11-23 06:40:59 +00:00
mock
Signed-off-by: cc_ggboy <chenweimin8@huawei.com>
This commit is contained in:
parent
c9e0e73d69
commit
2497ac34d7
@ -62,16 +62,20 @@ export function mockAbilityAccessCtrl() {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
})
|
||||
},
|
||||
getVersion: function (...args) {
|
||||
console.warn("AtManager.getVersion 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
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
})
|
||||
},
|
||||
on: function (...args) {
|
||||
console.warn("AtManager.on 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 (len > 0 && typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, PermStateChangeInfo);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(PermStateChangeInfo);
|
||||
})
|
||||
args[len - 1].call(this, PermissionStateChangeInfo);
|
||||
}
|
||||
},
|
||||
off: function (...args) {
|
||||
@ -79,21 +83,17 @@ export function mockAbilityAccessCtrl() {
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (len > 0 && typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, PermStateChangeInfo);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(PermStateChangeInfo);
|
||||
})
|
||||
args[len - 1].call(this, PermissionStateChangeInfo);
|
||||
}
|
||||
}
|
||||
};
|
||||
const PermStateChangeType = {
|
||||
const PermissionStateChangeType = {
|
||||
PERMISSION_REVOKED_OPER: 0,
|
||||
PERMISSION_GRANTED_OPER: 1
|
||||
};
|
||||
|
||||
const PermStateChangeInfo = {
|
||||
change: PermStateChangeType,
|
||||
const PermissionStateChangeInfo = {
|
||||
change: PermissionStateChangeType,
|
||||
tokenID: '[PC Preview] unknown tokenID',
|
||||
permissionName: '[PC Preview] unknown permissionName',
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user