Signed-off-by: cc_ggboy <chenweimin8@huawei.com>
This commit is contained in:
cc_ggboy 2022-08-02 15:17:34 +08:00
parent c9e0e73d69
commit 2497ac34d7

View File

@ -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',