!659 bgtask能效资源申请API mock

Merge pull request !659 from 朱天怡/master
This commit is contained in:
openharmony_ci 2022-09-05 13:31:20 +00:00 committed by Gitee
commit 0106ab1cbf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -32,6 +32,23 @@ export function mockBackgroundTaskManager() {
VOIP: 8,
TASK_KEEPING: 9
},
ResourceType : {
CPU: 1,
COMMON_EVENT: 1 << 1,
TIMER: 1 << 2,
WORK_SCHEDULER: 1 << 3,
BLUETOOTH: 1 << 4,
GPS: 1 << 5,
AUDIO: 1 << 6,
},
EfficiencyResourcesRequest : {
resourceTypes: '[PC preview] unknown resourceTypes',
isApply: '[PC preview] unknown isApply',
timeOut: '[PC preview] unknown timeOut',
isPersist: '[PC preview] unknown isPersist',
isProcess: '[PC preview] unknown isProcess',
reason: '[PC preview] unknown reason',
},
requestSuspendDelay: function (...args) {
console.warn("backgroundTaskManager.requestSuspendDelay interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
@ -80,6 +97,15 @@ export function mockBackgroundTaskManager() {
resolve();
});
}
},
applyEfficiencyResources: function(...args) {
console.warn("backgroundTaskManager.applyEfficiencyResources interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
return paramMock.paramBooleanMock;
},
resetAllEfficiencyResources: function(...args) {
console.warn("backgroundTaskManager.resetAllEfficiencyResources interface mocked in the Previewer. How this interface works on the" +
" Previewer may be different from that on a real device.")
}
};
return backgroundTaskManager;