mirror of
https://gitee.com/openharmony/third_party_jsframework
synced 2024-11-27 00:40:37 +00:00
commit
e484b35b99
File diff suppressed because it is too large
Load Diff
@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "./utils"
|
||||
|
||||
export function mockAI() {
|
||||
const TTSCallBackMock = {
|
||||
key: "[PC preview] unknow key"
|
||||
};
|
||||
global.systemplugin.ai = {};
|
||||
global.systemplugin.ai.TTS = {
|
||||
getTTSClient: function () {
|
||||
console.warn("ai.TTS.getTTSClient interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return TTSClient
|
||||
},
|
||||
};
|
||||
const TTSClient = {
|
||||
init: function (...args) {
|
||||
console.warn("TTSClient.init interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock
|
||||
},
|
||||
isSpeaking: function () {
|
||||
console.warn("TTSClient.isSpeaking interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock
|
||||
},
|
||||
setAudioType: function (...args) {
|
||||
console.warn("TTSClient.setAudioType interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock
|
||||
},
|
||||
setParams: function (...args) {
|
||||
console.warn("TTSClient.setParams interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock
|
||||
},
|
||||
connectService: function () {
|
||||
console.warn("TTSClient.connectService interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
setIsSaveTtsData: function (...args) {
|
||||
console.warn("TTSClient.setIsSaveTtsData interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
args[0].success()
|
||||
hasComplete(args[0].complete)
|
||||
},
|
||||
release: function () {
|
||||
console.warn("TTSClient.release interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
speakLongText: function (...args) {
|
||||
console.warn("TTSClient.speakLongText interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
args[0].success()
|
||||
hasComplete(args[0].complete)
|
||||
},
|
||||
speakText: function (...args) {
|
||||
console.warn("TTSClient.speakText interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
args[0].success()
|
||||
hasComplete(args[0].complete)
|
||||
},
|
||||
stopSpeak: function () {
|
||||
console.warn("TTSClient.stopSpeak interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
destroy: function () {
|
||||
console.warn("TTSClient.destroy interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
on: function (...args) {
|
||||
console.warn("TTSClient.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
|
||||
args[len - 1].call(this, TTSCallBackMock)
|
||||
},
|
||||
getSupportMaxLength: function () {
|
||||
console.warn("TTSClient.getSupportMaxLength interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
getVersion: function () {
|
||||
console.warn("TTSClient.getVersion interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
},
|
||||
};
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { hasComplete } from "./utils"
|
||||
|
||||
export function mockBattery() {
|
||||
global.systemplugin.battery = {
|
||||
getStatus: function (...args) {
|
||||
console.warn("battery.getStatus interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
args[0].success.call(this, {
|
||||
level: 1,
|
||||
charging: false
|
||||
})
|
||||
hasComplete(args[0].complete)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { hasComplete } from "./utils"
|
||||
|
||||
export function mockBrightness() {
|
||||
global.systemplugin.brightness = {
|
||||
argsV: {
|
||||
value: 80
|
||||
},
|
||||
argsM: {
|
||||
mode: 0
|
||||
},
|
||||
getValue: function (...args) {
|
||||
console.warn("brightness.getValue interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
args[0].success(this.argsV)
|
||||
hasComplete(args[0].complete)
|
||||
},
|
||||
setValue: function (...args) {
|
||||
console.warn("brightness.setValue interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
if (args[0].value) {
|
||||
this.argsV.value = args[0].value
|
||||
args[0].success()
|
||||
hasComplete(args[0].complete)
|
||||
}
|
||||
},
|
||||
getMode: function (...args) {
|
||||
console.warn("brightness.getMode interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
args[0].success(this.argsM)
|
||||
hasComplete(args[0].complete)
|
||||
},
|
||||
setMode: function (...args) {
|
||||
console.warn("brightness.setMode interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
this.argsM.mode = args[0].mode
|
||||
args[0].success()
|
||||
hasComplete(args[0].complete)
|
||||
},
|
||||
setKeepScreenOn: function (...args) {
|
||||
console.warn("brightness.setKeepScreenOn interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
args[0].success()
|
||||
hasComplete(args[0].complete)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,394 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from './utils';
|
||||
|
||||
export function mockCalendar() {
|
||||
const CalendarEntityClass = class CalendarEntity {
|
||||
constructor() {
|
||||
console.warn('calendar.CalendarEntity.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.id = '[PC preview] unknown id';
|
||||
}
|
||||
};
|
||||
CalendarEntityClass.ACC_TYPE_LOCAL = 'LOCAL';
|
||||
CalendarEntityClass.IS_SYNC_ADAPTER = 'caller_is_syncadapter';
|
||||
const AccountsClass = class Accounts extends CalendarEntityClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn('calendar.Accounts.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.name = '[PC preview] unknown name';
|
||||
this.accName = '[PC preview] unknown accName';
|
||||
this.accType = '[PC preview] unknown accType';
|
||||
this.accColour = '[PC preview] unknown accColour';
|
||||
this.accDisplayName = '[PC preview] unknown accDisplayName';
|
||||
this.visible = '[PC preview] unknown visible';
|
||||
this.accTimezone = '[PC preview] unknown accTimezone';
|
||||
this.isSyncEvents = '[PC preview] unknown isSyncEvents';
|
||||
this.remindersType = '[PC preview] unknown remindersType';
|
||||
this.attendeeTypes = '[PC preview] unknown attendeeTypes';
|
||||
}
|
||||
};
|
||||
AccountsClass.NAME = 'name';
|
||||
const EventsClass = class Events extends CalendarEntityClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn('calendar.Events.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.accId = '[PC preview] unknown accId';
|
||||
this.title = '[PC preview] unknown title';
|
||||
this.description = '[PC preview] unknown description';
|
||||
this.eventPosition = '[PC preview] unknown eventPosition';
|
||||
this.eventStatus = '[PC preview] unknown eventStatus';
|
||||
this.eventStartTime = '[PC preview] unknown eventStartTime';
|
||||
this.eventEndTime = '[PC preview] unknown eventEndTime';
|
||||
this.duration = '[PC preview] unknown duration';
|
||||
this.isWholeDay = '[PC preview] unknown isWholeDay';
|
||||
this.availableStatus = '[PC preview] unknown availableStatus';
|
||||
this.hasAlarm = '[PC preview] unknown hasAlarm';
|
||||
this.recurRule = '[PC preview] unknown recurRule';
|
||||
this.recurDate = '[PC preview] unknown recurDate';
|
||||
this.initialId = '[PC preview] unknown initialId';
|
||||
this.hasAttendeeInfo = '[PC preview] unknown hasAttendeeInfo';
|
||||
}
|
||||
};
|
||||
const InstancesClass = class Instances extends CalendarEntityClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn('calendar.Instances.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.instanceBegin = '[PC preview] unknown instanceBegin';
|
||||
this.instanceEnd = '[PC preview] unknown instanceEnd';
|
||||
this.eventId = '[PC preview] unknown eventId';
|
||||
this.instanceStartDay = '[PC preview] unknown instanceStartDay';
|
||||
this.instanceEndDay = '[PC preview] unknown instanceEndDay';
|
||||
this.instanceStartMinute = '[PC preview] unknown instanceStartMinute';
|
||||
this.instanceEndMinute = '[PC preview] unknown instanceEndMinute';
|
||||
}
|
||||
};
|
||||
const ParticipantsClass = class Participants extends CalendarEntityClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn('calendar.Participants.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.eventId = '[PC preview] unknown eventId';
|
||||
this.participantName = '[PC preview] unknown participantName';
|
||||
this.participantEmail = '[PC preview] unknown participantEmail';
|
||||
this.participantRoleType = '[PC preview] unknown participantRoleType';
|
||||
this.participantType = '[PC preview] unknown participantType';
|
||||
this.participantStatus = '[PC preview] unknown participantStatus';
|
||||
}
|
||||
};
|
||||
const RemindersClass = class Reminders extends CalendarEntityClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn('calendar.Reminders.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.eventId = '[PC preview] unknown eventId';
|
||||
this.remindMinutes = '[PC preview] unknown remindMinutes';
|
||||
this.remindType = '[PC preview] unknown remindType';
|
||||
this.syncId = '[PC preview] unknown syncId';
|
||||
}
|
||||
};
|
||||
const AppletEntityClass = class AppletEntity {
|
||||
constructor() {
|
||||
console.warn('calendar.AppletEntity.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.title = '[PC preview] unknown title';
|
||||
this.startTime = '[PC preview] unknown startTime';
|
||||
this.allDay = '[PC preview] unknown allDay';
|
||||
this.description = '[PC preview] unknown description';
|
||||
this.location = '[PC preview] unknown location';
|
||||
this.endTime = '[PC preview] unknown endTime';
|
||||
this.alarm = '[PC preview] unknown alarm';
|
||||
this.alarmOffset = '[PC preview] unknown alarmOffset';
|
||||
this.repeatInterval = '[PC preview] unknown repeatInterval';
|
||||
this.repeatEndTime = '[PC preview] unknown repeatEndTime';
|
||||
}
|
||||
};
|
||||
const AppletRepeatEntityClass = class AppletRepeatEntity extends AppletEntityClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn('calendar.AppletRepeatEntity.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.repeatInterval = '[PC preview] unknown repeatInterval';
|
||||
this.repeatEndTime = '[PC preview] unknown repeatEndTime';
|
||||
}
|
||||
};
|
||||
const CalendarCollectionClass = class CalendarCollection {
|
||||
constructor() {
|
||||
this.handler = '[PC preview] unknown handler';
|
||||
this.close = function (...args) {
|
||||
console.warn('calendar.CalendarCollection.close interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
};
|
||||
this.count = function (...args) {
|
||||
console.warn('calendar.CalendarCollection.count interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
return paramMock.paramNumberMock;
|
||||
};
|
||||
this.next = function (...args) {
|
||||
console.warn('calendar.CalendarCollection.next interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
return new CalendarEntityClass();
|
||||
};
|
||||
this.hasNext = function (...args) {
|
||||
console.warn('calendar.CalendarCollection.hasNext interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
return paramMock.paramBooleanMock;
|
||||
};
|
||||
}
|
||||
};
|
||||
const CalendarDataHelperClass = class CalendarDataHelper {
|
||||
constructor() {
|
||||
this.name = '[PC preview] unknown queryEntityName';
|
||||
this.query = function (...args) {
|
||||
console.warn('calendar.CalendarDataHelper.query 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, new CalendarCollectionClass());
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(new CalendarCollectionClass());
|
||||
});
|
||||
}
|
||||
};
|
||||
this.insert = function (...args) {
|
||||
console.warn('calendar.CalendarDataHelper.insert 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);
|
||||
});
|
||||
}
|
||||
};
|
||||
this.update = function (...args) {
|
||||
console.warn('calendar.CalendarDataHelper.update 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();
|
||||
});
|
||||
}
|
||||
};
|
||||
this.delete = function (...args) {
|
||||
console.warn('calendar.CalendarDataHelper.delete 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') {
|
||||
if (typeof args[0] === 'number') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else if (args[0] instanceof CalendarEntityClass) {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
|
||||
}
|
||||
} else {
|
||||
if (typeof args[0] === 'number') {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
} else if (args[0] instanceof CalendarEntityClass) {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
CalendarDataHelperClass.creator = function (...args) {
|
||||
console.warn('calendar.CalendarDataHelper.creator interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
return new CalendarDataHelperClass();
|
||||
};
|
||||
global.systemplugin.calendar = {
|
||||
BaseColumns: {
|
||||
COUNT: "_count",
|
||||
ID: "_id"
|
||||
},
|
||||
AccountColumns: {
|
||||
ACC_COLOR: "calendar_color",
|
||||
ACC_COLOR_INDEX: "calendar_color_index",
|
||||
ACC_DISPLAY_NAME: "calendar_displayName",
|
||||
VISIBLE: "visible",
|
||||
ACC_TIME_ZONE: "calendar_timezone",
|
||||
IS_SYNC_EVENTS: "sync_events",
|
||||
REMINDERS_TYPE: "allowedReminders",
|
||||
AVAILABILITY_STATUS: "allowedAvailability",
|
||||
ATTENDEE_TYPES: "allowedAttendeeTypes",
|
||||
IS_PRIMARY: "isPrimary"
|
||||
},
|
||||
AccountSyncColumns: {
|
||||
ACC_SYNC1: "cal_sync1",
|
||||
ACC_SYNC2: "cal_sync2",
|
||||
ACC_SYNC3: "cal_sync3",
|
||||
ACC_SYNC4: "cal_sync4",
|
||||
ACC_SYNC5: "cal_sync5",
|
||||
ACC_SYNC6: "cal_sync6",
|
||||
ACC_SYNC7: "cal_sync7",
|
||||
ACC_SYNC8: "cal_sync8",
|
||||
ACC_SYNC9: "cal_sync9",
|
||||
ACC_SYNC10: "cal_sync10"
|
||||
},
|
||||
EventsColumns: {
|
||||
ACC_ID: "calendar_id",
|
||||
TITLE: "title",
|
||||
DESCRIPTION: "description",
|
||||
EVENT_POSITION: "eventLocation",
|
||||
EVENT_STATUS: "eventStatus",
|
||||
EVENT_STATUS_TENTATIVE: 0,
|
||||
EVENT_STATUS_CONFIRMED: 1,
|
||||
EVENT_STATUS_CANCELED: 2,
|
||||
OWNER_ATTENDEE_STATUS: "selfAttendeeStatus",
|
||||
EXTEND_DATA1: "sync_data1",
|
||||
EXTEND_DATA2: "sync_data2",
|
||||
EXTEND_DATA3: "sync_data3",
|
||||
EXTEND_DATA4: "sync_data4",
|
||||
EXTEND_DATA5: "sync_data5",
|
||||
EXTEND_DATA6: "sync_data6",
|
||||
D_DATA7: "sync_data7",
|
||||
EXTEND_DATA8: "sync_data8",
|
||||
EXTEND_DATA9: "sync_data9",
|
||||
EXTEND_DATA10: "sync_data10",
|
||||
EVENT_START_TIME: "dtstart",
|
||||
EVENT_END_TIME: "dtend",
|
||||
DURATION: "duration",
|
||||
START_TIMEZONE: "eventTimezone",
|
||||
END_TIMEZONE: "eventEndTimezone",
|
||||
IS_WHOLE_DAY: "allDay",
|
||||
PERMISSION_LEVEL: "accessLevel",
|
||||
PERMISSION_DEFAULT: 0,
|
||||
PERMISSION_CONFIDENTIAL: 1,
|
||||
PERMISSION_PRIVATE: 2,
|
||||
PERMISSION_PUBLIC: 3,
|
||||
AVAILABLE_STATUS: "availability",
|
||||
STATUS_BUSY: 0,
|
||||
STATUS_FREE: 1,
|
||||
STATUS_TENTATIVE: 2,
|
||||
HAS_ALARM: "hasAlarm",
|
||||
HAS_EXTENDED_ATTRIBUTES: "hasExtendedProperties",
|
||||
RECUR_RULE: "rrule",
|
||||
RECUR_DATE: "rdate",
|
||||
INITIAL_ID: "original_id",
|
||||
INITIAL_SYNC_ID: "original_sync_id",
|
||||
HAS_ATTENDEE_INFO: "hasAttendeeData",
|
||||
ORGANIZER_EMAIL: "organizer"
|
||||
},
|
||||
InstancesColumns: {
|
||||
EVENT_ID: "event_id",
|
||||
INSTANCE_START: "begin",
|
||||
INSTANCE_END: "end",
|
||||
INSTANCE_START_DAY: "startDay",
|
||||
INSTANCE_END_DAY: "endDay",
|
||||
INSTANCE_START_MINUTE: "startMinute",
|
||||
INSTANCE_END_MINUTE: "endMinute"
|
||||
},
|
||||
ParticipantsColumns: {
|
||||
EVENT_ID: "event_id",
|
||||
PARTICIPANT_NAME: "attendeeName",
|
||||
PARTICIPANT_EMAIL: "attendeeEmail",
|
||||
PARTICIPANT_ROLE_TYPE: "attendeeRelationship",
|
||||
ROLE_NONE: 0,
|
||||
ROLE_ATTENDEE: 1,
|
||||
ROLE_ORGANIZER: 2,
|
||||
ROLE_PERFORMER: 3,
|
||||
ROLE_SPEAKER: 4,
|
||||
PARTICIPANT_TYPE: "attendeeType",
|
||||
TYPE_NONE: 0,
|
||||
TYPE_REQUIRED: 1,
|
||||
TYPE_OPTIONAL: 2,
|
||||
TYPE_RESOURCE: 3,
|
||||
PARTICIPANT_STATUS: "attendeeStatus",
|
||||
PARTICIPANT_STATUS_NONE: 0,
|
||||
PARTICIPANT_STATUS_ACCEPTED: 1,
|
||||
PARTICIPANT_STATUS_DECLINED: 2,
|
||||
PARTICIPANT_STATUS_INVITED: 3,
|
||||
PARTICIPANT_STATUS_TENTATIVE: 4
|
||||
},
|
||||
RemindersColumns: {
|
||||
EVENT_ID: "event_id",
|
||||
REMIND_MINUTES: "minutes",
|
||||
REMIND_MINUTES_DEFAULT: -1,
|
||||
REMIND_TYPE: "method",
|
||||
TYPE_DEFAULT: 0,
|
||||
TYPE_ALERT: 1,
|
||||
TYPE_EMAIL: 2,
|
||||
TYPE_SMS: 3,
|
||||
TYPE_ALARM: 4
|
||||
},
|
||||
SyncColumns: {
|
||||
ACC_NAME: "account_name",
|
||||
ACC_TYPE: "account_type",
|
||||
SYNC_ID: "_sync_id",
|
||||
DIRTY: "dirty",
|
||||
CALLING_BUNDLE_NAME: "mutators",
|
||||
DELETED: "deleted"
|
||||
},
|
||||
queryEntityName: {
|
||||
EVENTS: "EVENTS",
|
||||
ACCOUNTS: "ACCOUNTS",
|
||||
INSTANCES: "INSTANCES",
|
||||
PARTICIPANTS: "PARTICIPANTS",
|
||||
REMINDERS: "REMINDERS"
|
||||
},
|
||||
CalendarEntity: CalendarEntityClass,
|
||||
Accounts: AccountsClass,
|
||||
Events: EventsClass,
|
||||
Instances: InstancesClass,
|
||||
Participants: ParticipantsClass,
|
||||
Reminders: RemindersClass,
|
||||
AppletEntity: AppletEntityClass,
|
||||
AppletRepeatEntity: AppletRepeatEntityClass,
|
||||
CalendarCollection: CalendarCollectionClass,
|
||||
CalendarDataHelper: CalendarDataHelperClass,
|
||||
addPhoneCalendar: function (...args) {
|
||||
console.warn('calendar.addPhoneCalendar 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();
|
||||
});
|
||||
}
|
||||
},
|
||||
addPhoneRepeatCalendar: function (...args) {
|
||||
console.warn('calendar.addPhoneRepeatCalendar 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();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "./utils"
|
||||
|
||||
export function mockDistributedSchedule() {
|
||||
const ModuleInfoMock = {
|
||||
moduleName: "[PC Preview] unknow moduleName",
|
||||
moduleSourceDir: "[PC Preview] unknow moduleSourceDir"
|
||||
}
|
||||
const CustomizeDataMock = {
|
||||
name: "[PC Preview] unknow name",
|
||||
value: "[PC Preview] unknow values"
|
||||
}
|
||||
const ApplicationInfoMock = {
|
||||
name: "[PC Preview] unknow name",
|
||||
description: "[PC Preview] unknow description",
|
||||
descriptionId: "[PC Preview] unknow descriptionId",
|
||||
systemApp: "[PC Preview] unknow systemApp",
|
||||
enabled: "[PC Preview] unknow enabled",
|
||||
label: "[PC Preview] unknow label",
|
||||
labelId: "[PC Preview] unknow labelId",
|
||||
icon: "[PC Preview] unknow icon",
|
||||
iconId: "[PC Preview] unknow iconId",
|
||||
process: "[PC Preview] unknow process",
|
||||
supportedModes: "[PC Preview] unknow supportedModes",
|
||||
moduleSourceDirs: ["[PC Preview] unknow moduleSourceDir", "[PC Preview] unknow moduleSourceDir"],
|
||||
permissions: ["[PC Preview] unknow permission", "[PC Preview] unknow permission"],
|
||||
moduleInfo: [ModuleInfoMock],
|
||||
entryDir: "[PC Preview] unknow entryDir",
|
||||
customizeData: new Map([["[PC Preview] unknow customizeDataKey", CustomizeDataMock]])
|
||||
}
|
||||
const AbilityInfoMock = {
|
||||
bundleName: "[PC Preview] unknow bundleName",
|
||||
className: "[PC Preview] unknow name",
|
||||
label: "[PC Preview] unknow label",
|
||||
description: "[PC Preview] unknow description",
|
||||
icon: "[PC Preview] unknow icon",
|
||||
labelId: "[PC Preview] unknow labelId",
|
||||
descriptionId: "[PC Preview] unknow descriptionId",
|
||||
iconId: "[PC Preview] unknow iconId",
|
||||
moduleName: "[PC Preview] unknow moduleName",
|
||||
process: "[PC Preview] unknow process",
|
||||
targetAbility: "[PC Preview] unknow targetAbility",
|
||||
backgroundModes: "[PC Preview] unknow backgroundModes",
|
||||
isVisible: "[PC Preview] unknow isVisible",
|
||||
formEnabled: "[PC Preview] unknow formEnabled",
|
||||
type: "[PC Preview] unknow type",
|
||||
subType: "[PC Preview] unknow subType",
|
||||
orientation: "[PC Preview] unknow orientation",
|
||||
launchMode: "[PC Preview] unknow launchMode",
|
||||
permissions: ["[PC Preview] unknow permission", "[PC Preview] unknow permission"],
|
||||
deviceTypes: ["[PC Preview] unknow deviceType", "[PC Preview] unknow deviceType"],
|
||||
deviceCapabilities: ["[PC Preview] unknow deviceCapabilities", "[PC Preview] unknow deviceCapabilities"],
|
||||
readPermission: "[PC Preview] unknow readPermission",
|
||||
writePermission: "[PC Preview] unknow writePermission",
|
||||
applicationInfo: ApplicationInfoMock,
|
||||
formEntity: "[PC Preview] unknow formEntity",
|
||||
minFormHeight: "[PC Preview] unknow minFormHeight",
|
||||
defaultFormHeight: "[PC Preview] unknow defaultFormHeight",
|
||||
minFormWidth: "[PC Preview] unknow minFormWidth",
|
||||
defaultFormWidth: "[PC Preview] unknow defaultFormWidth",
|
||||
uri: "[PC Preview] unknow uri",
|
||||
customizeData: new Map([["[PC Preview] unknow customizeDataKey", CustomizeDataMock]])
|
||||
}
|
||||
global.systemplugin.distributedSchedule = {
|
||||
stopDistributedService: function (...args) {
|
||||
console.warn("distributedSchedule.stopDistributedService 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.paramStringMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramStringMock)
|
||||
})
|
||||
}
|
||||
},
|
||||
startDistributedService: function (...args) {
|
||||
console.warn("distributedSchedule.startDistributedService 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.paramStringMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramStringMock)
|
||||
})
|
||||
}
|
||||
},
|
||||
queryRemoteAbilityByWant: function (...args) {
|
||||
console.warn("distributedSchedule.queryRemoteAbilityByWant interface mocked in the Previewer. " +
|
||||
"How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
var array = new Array();
|
||||
array.push(AbilityInfoMock);
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, array)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(array)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { mockSystemPlugin } from './index';
|
||||
|
||||
mockSystemPlugin()
|
@ -1,93 +0,0 @@
|
||||
/*
|
||||
* @Author: your name
|
||||
* @Date: 2022-01-20 21:27:31
|
||||
* @LastEditTime: 2022-01-20 21:27:33
|
||||
* @LastEditors: your name
|
||||
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
* @FilePath: \third_party_jsframework\runtime\main\extend\systemplugin\featureAbility.js
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export function mockFeatureAbility() {
|
||||
let FeatureAbilityObject = {
|
||||
getFeatureAbility: function () {
|
||||
const ResultMock = {
|
||||
code: '[PC preview] unknow code',
|
||||
data: '[PC preview] unknow data'
|
||||
}
|
||||
const FeatureAbility = {
|
||||
startAbility: function (...args) {
|
||||
console.warn("Unable to use the FeatureAbility.startAbility method to start another ability in the" +
|
||||
" Previewer. Perform this operation on the emulator or a real device instead.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(ResultMock);
|
||||
})
|
||||
},
|
||||
startAbilityForResult: function (...args) {
|
||||
console.warn("Unable to use the FeatureAbility.startAbilityForResult method to start another ability in" +
|
||||
" the Previewer. Perform this operation on the emulator or a real device instead.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(ResultMock);
|
||||
})
|
||||
},
|
||||
finishWithResult: function (...args) {
|
||||
console.warn("FeatureAbility.finishWithResult interface mocked in the Previewer. How this interface works" +
|
||||
" on the Previewer may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(ResultMock);
|
||||
})
|
||||
},
|
||||
callAbility: function (...args) {
|
||||
console.warn("FeatureAbility.callAbility interface mocked in the Previewer. How this interface works on" +
|
||||
" the Previewer may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(JSON.stringify(ResultMock));
|
||||
})
|
||||
},
|
||||
continueAbility: function (...args) {
|
||||
console.warn("FeatureAbility.continueAbility interface mocked in the Previewer. How this interface works on" +
|
||||
" the Previewer may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(ResultMock);
|
||||
})
|
||||
},
|
||||
subscribeAbilityEvent: function (...args) {
|
||||
console.warn("FeatureAbility.subscribeAbilityEvent interface mocked in the Previewer. How this interface" +
|
||||
" works on the Previewer may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(JSON.stringify(ResultMock));
|
||||
})
|
||||
},
|
||||
unsubscribeAbilityEvent: function (...args) {
|
||||
console.warn("FeatureAbility.unsubscribeAbilityEvent interface mocked in the Previewer. How this interface" +
|
||||
" works on the Previewer may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(JSON.stringify(ResultMock));
|
||||
})
|
||||
}
|
||||
}
|
||||
return FeatureAbility
|
||||
}
|
||||
}
|
||||
global.createLocalParticleAbility = function (...args) {
|
||||
console.warn("createLocalParticleAbility interface mocked in the Previewer. How this interface" +
|
||||
" works on the Previewer may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramObjectMock);
|
||||
})
|
||||
}
|
||||
global.FeatureAbility = FeatureAbilityObject.getFeatureAbility();
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export function mockFetch() {
|
||||
global.sendGroupMessage = global.group.sendGroupMessage;
|
||||
let GroupMessenger = {
|
||||
create: function () {
|
||||
let messenger = {};
|
||||
messenger.send = function (groupName, functionName, ...args) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
let params = messenger.prepareArgs(...args);
|
||||
sendGroupMessage(function (result) {
|
||||
resolve(messenger.parseJsonResult(result));
|
||||
}, function (error) {
|
||||
reject(messenger.parseJsonResult(error));
|
||||
}, groupName, functionName, ...params);
|
||||
})
|
||||
};
|
||||
messenger.parseJsonResult = function (data) {
|
||||
if (data && data.constructor == String) {
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
} catch (jsonParseErr) {
|
||||
console.warn("parse result exception: " + JSON.stringify(jsonParseErr));
|
||||
}
|
||||
}
|
||||
return data;
|
||||
};
|
||||
messenger.prepareArgs = function (...args) {
|
||||
let result = [...args];
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
if (typeof result[i] === 'function') {
|
||||
result[i] = messenger.packageCallback(result[i]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
messenger.packageCallback = function (func) {
|
||||
return function (data) {
|
||||
data = messenger.parseJsonResult(data);
|
||||
if (!Array.isArray(data)) {
|
||||
func(data);
|
||||
} else {
|
||||
func(...data);
|
||||
}
|
||||
};
|
||||
};
|
||||
return messenger;
|
||||
}
|
||||
};
|
||||
|
||||
let CommonCallback = {
|
||||
commonCallback: function commonCallback(callback, flag, data, code) {
|
||||
if (typeof callback === 'function') {
|
||||
switch (flag) {
|
||||
case 'success':
|
||||
callback(data);
|
||||
break;
|
||||
case 'fail':
|
||||
callback(data, code);
|
||||
break;
|
||||
case 'cancel':
|
||||
callback(data);
|
||||
break;
|
||||
case 'complete':
|
||||
callback();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
console.warn('callback.' + flag + ' is not function or not present');
|
||||
}
|
||||
}
|
||||
};
|
||||
global.commonCallback = CommonCallback.commonCallback;
|
||||
let CommonCallbackEx = {
|
||||
commonCallbackEx: function commonCallbackEx(callback, result, pluginError) {
|
||||
if ((callback === undefined) || ((callback.success === undefined) && (callback.fail === undefined) && (callback.complete === undefined))) {
|
||||
return CommonCallbackEx.promiseMethod(result, pluginError);
|
||||
} else {
|
||||
return CommonCallbackEx.callbackMethod(callback, result, pluginError);
|
||||
}
|
||||
},
|
||||
promiseMethod: function promiseMethod(result, pluginError) {
|
||||
if (pluginError != undefined) {
|
||||
throw pluginError;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
callbackMethod: function callbackMethod(callback, result, pluginError) {
|
||||
if (pluginError != undefined) {
|
||||
commonCallback(callback.fail, 'fail', pluginError.data, pluginError.code);
|
||||
commonCallback(callback.complete, 'complete');
|
||||
throw pluginError;
|
||||
}
|
||||
commonCallback(callback.success, 'success', result.data);
|
||||
commonCallback(callback.complete, 'complete');
|
||||
return result;
|
||||
},
|
||||
catching: function catching(promise, param) {
|
||||
return promise.then(ret => commonCallbackEx(param, ret))
|
||||
.catch(err => commonCallbackEx(param, null, err));
|
||||
}
|
||||
};
|
||||
global.commonCallbackEx = CommonCallbackEx.commonCallbackEx;
|
||||
global.systemplugin.catching = CommonCallbackEx.catching;
|
||||
|
||||
let FetchObject = {
|
||||
getFetch: function () {
|
||||
let fetch = {}
|
||||
fetch.messenger = GroupMessenger.create();
|
||||
fetch.fetch = async function (param) {
|
||||
return await CommonCallbackEx.catching(this.messenger.send("groupName", "fetch", param), param);
|
||||
}
|
||||
return fetch
|
||||
}
|
||||
}
|
||||
|
||||
global.systemplugin.fetch = FetchObject.getFetch();
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { hasComplete, getRandomArbitrary } from "./utils"
|
||||
|
||||
export function mockGeolocation() {
|
||||
const data = {
|
||||
latitude: '121.61934',
|
||||
longitude: '31.257907',
|
||||
accuracy: '15',
|
||||
time: '160332896544'
|
||||
}
|
||||
global.systemplugin.geolocation = {
|
||||
getLocation: function (...args) {
|
||||
console.warn("geolocation.getLocation interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
args[0].success(data)
|
||||
hasComplete(args[0].complete)
|
||||
},
|
||||
getLocationType: function (...args) {
|
||||
console.warn("geolocation.getLocationType interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
const info = { types: ['gps', 'network'] }
|
||||
args[0].success(info)
|
||||
hasComplete(args[0].complete)
|
||||
},
|
||||
getSupportedCoordTypes() {
|
||||
console.warn("geolocation.getSupportedCoordTypes interface mocked in the Previewer. How this interface works" +
|
||||
" on the Previewer may be different from that on a real device.")
|
||||
return ["wgs84"]
|
||||
},
|
||||
subscribe: function (...args) {
|
||||
console.warn("geolocation.subscribe interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
if (!this.unsubscribeLocation) {
|
||||
this.unsubscribeLocation = setInterval(() => {
|
||||
data.latitude = getRandomArbitrary(121, 122)
|
||||
data.longitude = getRandomArbitrary(31, 32)
|
||||
data.accuracy = getRandomArbitrary(14, 18)
|
||||
args[0].success(data)
|
||||
}, 1000)
|
||||
}
|
||||
},
|
||||
unsubscribe: function () {
|
||||
console.warn("geolocation.unsubscribe interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
clearInterval(this.unsubscribeLocation)
|
||||
delete this.unsubscribeLocation
|
||||
}
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import regeneratorRuntime from 'babel-runtime/regenerator'
|
||||
|
||||
import {
|
||||
mockAbilityFeatureAbility,
|
||||
mockAbilityParticleAbility,
|
||||
mockAbilityFormManager,
|
||||
mockAbilityContinuationRegisterManager,
|
||||
mockAbilityAbilityAgent,
|
||||
mockAbilityFormBindingData
|
||||
} from './ability'
|
||||
import { mockAppAbilityManager } from './ohos/app'
|
||||
|
||||
import { mockBattery } from './battery'
|
||||
import { mockBrightness } from './brightness'
|
||||
import { mockOhosBluetooth } from './ohos/bluetooth'
|
||||
import { mockDistributedSchedule } from './distributedSchedule'
|
||||
import { mockFetch } from './fetch'
|
||||
import { mockFeatureAbility } from './featureAbility'
|
||||
import { mockGeolocation } from './geolocation'
|
||||
import { mockNotification } from './notification'
|
||||
import { mockCommonEvent } from './ohos/commonEvent'
|
||||
import { mockOhosRequest } from './ohos/request'
|
||||
import { mockSensor } from './sensor'
|
||||
import { mockStorage } from './storage'
|
||||
import { mockStorageInfoManager } from './ohos/storageInfoManager'
|
||||
import { mockSystemPackage } from './systemPackage'
|
||||
|
||||
import { mockUserauth } from './userIAM'
|
||||
import { mockVibrator } from './vibrator'
|
||||
import { mockRequireNapiFun } from './napi'
|
||||
import { mockAI } from './ai'
|
||||
import { mockUserIAMUserAuth } from './ohos/userIAMuserAuth.js'
|
||||
import { mockBundleManager } from './ohos/bundleManager'
|
||||
import { mockPackageManager } from './ohos/packageManager'
|
||||
import { mockCalendar } from "./calendar"
|
||||
|
||||
export function mockSystemPlugin() {
|
||||
global.regeneratorRuntime = regeneratorRuntime
|
||||
|
||||
global.systemplugin = {}
|
||||
global.ohosplugin = {}
|
||||
|
||||
mockNotification()
|
||||
mockCommonEvent()
|
||||
mockFetch()
|
||||
mockStorage()
|
||||
mockVibrator()
|
||||
mockSensor()
|
||||
mockGeolocation()
|
||||
mockBattery()
|
||||
mockBrightness()
|
||||
mockSystemPackage()
|
||||
mockFeatureAbility()
|
||||
mockOhosBluetooth()
|
||||
mockUserauth()
|
||||
mockDistributedSchedule()
|
||||
mockOhosRequest()
|
||||
mockAbilityFeatureAbility()
|
||||
mockAbilityContinuationRegisterManager()
|
||||
mockRequireNapiFun()
|
||||
mockAbilityParticleAbility()
|
||||
mockAbilityFormManager()
|
||||
mockAbilityAbilityAgent()
|
||||
mockAbilityFormBindingData()
|
||||
mockAI()
|
||||
mockStorageInfoManager()
|
||||
mockAppAbilityManager()
|
||||
mockUserIAMUserAuth()
|
||||
mockBundleManager()
|
||||
mockPackageManager()
|
||||
mockCalendar()
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,258 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FormBindingData } from "../ohos_application_formBindingData"
|
||||
import { FormState } from "../ohos_application_formInfo"
|
||||
import { paramMock } from "../../utils"
|
||||
import { RemoteObjectClass } from "../ohos_rpc"
|
||||
import { ResultSet, PacMapType } from "../ohos_ability_featureAbility"
|
||||
|
||||
const DataAbilityResult = {
|
||||
uri: "[PC Preview] unknow uri",
|
||||
count: "[PC Preview] unknow count",
|
||||
}
|
||||
export const LifecycleForm = {
|
||||
onCreate: function (...args) {
|
||||
console.warn("LifecycleForm.onCreate interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return FormBindingData;
|
||||
},
|
||||
onCastToNormal: function (...args) {
|
||||
console.warn("LifecycleForm.onCastToNormal interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onUpdate: function (...args) {
|
||||
console.warn("LifecycleForm.onUpdate interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onVisibilityChange: function (...args) {
|
||||
console.warn("LifecycleForm.onVisibilityChange interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onEvent: function (...args) {
|
||||
console.warn("LifecycleForm.onEvent interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onDestroy: function (...args) {
|
||||
console.warn("LifecycleForm.onDestroy interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onAcquireFormState: function (...args) {
|
||||
console.warn("LifecycleForm.onAcquireFormState interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return FormState;
|
||||
},
|
||||
onShare: function (...args) {
|
||||
console.warn("LifecycleForm.onShare interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return {"key": "unknow any"};
|
||||
},
|
||||
}
|
||||
export const LifecycleApp = {
|
||||
onShow: function () {
|
||||
console.warn("LifecycleApp.onShow interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onHide: function () {
|
||||
console.warn("LifecycleApp.onHide interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onDestroy: function () {
|
||||
console.warn("LifecycleApp.onDestroy interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onCreate: function () {
|
||||
console.warn("LifecycleApp.onCreate interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onWindowDisplayModeChanged: function (...args) {
|
||||
console.warn("LifecycleApp.onWindowDisplayModeChanged interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onStartContinuation: function () {
|
||||
console.warn("LifecycleApp.onStartContinuation interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
onSaveData: function (...args) {
|
||||
console.warn("LifecycleApp.onSaveData interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
onCompleteContinuation: function (...args) {
|
||||
console.warn("LifecycleApp.onCompleteContinuation interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onRestoreData: function (...args) {
|
||||
console.warn("LifecycleApp.onRestoreData interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onRemoteTerminated: function () {
|
||||
console.warn("LifecycleApp.onRemoteTerminated interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onSaveAbilityState: function (...args) {
|
||||
console.warn("LifecycleApp.onSaveAbilityState interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onRestoreAbilityState: function (...args) {
|
||||
console.warn("LifecycleApp.onRestoreAbilityState interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onInactive: function () {
|
||||
console.warn("LifecycleApp.onInactive interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onActive: function () {
|
||||
console.warn("LifecycleApp.onActive interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onNewWant: function (...args) {
|
||||
console.warn("LifecycleApp.onNewWant interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onMemoryLevel: function (...args) {
|
||||
console.warn("LifecycleApp.onMemoryLevel interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
}
|
||||
export const LifecycleService = {
|
||||
onStart: function () {
|
||||
console.warn("LifecycleService.onStart interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onCommand: function (...args) {
|
||||
console.warn("LifecycleService.onCommand interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onStop: function () {
|
||||
console.warn("LifecycleService.onStop interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onConnect: function (...args) {
|
||||
console.warn("LifecycleService.onConnect interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return new RemoteObjectClass();
|
||||
},
|
||||
onDisconnect: function (...args) {
|
||||
console.warn("LifecycleService.onDisconnect interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
onReconnect: function (...args) {
|
||||
console.warn("LifecycleService.onReconnect interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
}
|
||||
export const LifecycleData = {
|
||||
update: function (...args) {
|
||||
console.warn("LifecycleData.update 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.paramNumberMock);
|
||||
}
|
||||
},
|
||||
query: function (...args) {
|
||||
console.warn("LifecycleData.query 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, ResultSet);
|
||||
}
|
||||
},
|
||||
delete: function (...args) {
|
||||
console.warn("LifecycleData.delete 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.paramNumberMock);
|
||||
}
|
||||
},
|
||||
normalizeUri: function (...args) {
|
||||
console.warn("LifecycleData.normalizeUri 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.paramStringMock);
|
||||
}
|
||||
},
|
||||
batchInsert: function (...args) {
|
||||
console.warn("LifecycleData.batchInsert 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.paramNumberMock);
|
||||
}
|
||||
},
|
||||
denormalizeUri: function (...args) {
|
||||
console.warn("LifecycleData.denormalizeUri 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.paramStringMock);
|
||||
}
|
||||
},
|
||||
insert: function (...args) {
|
||||
console.warn("LifecycleData.insert 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.paramNumberMock);
|
||||
}
|
||||
},
|
||||
openFile: function (...args) {
|
||||
console.warn("LifecycleData.openFile 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.paramNumberMock);
|
||||
}
|
||||
},
|
||||
getFileTypes: function (...args) {
|
||||
console.warn("LifecycleData.getFileTypes 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.paramStringMock]);
|
||||
}
|
||||
},
|
||||
onInitialized: function (...args) {
|
||||
console.warn("LifecycleData.onInitialized interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
},
|
||||
getType: function (...args) {
|
||||
console.warn("LifecycleData.getType 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.paramStringMock);
|
||||
}
|
||||
},
|
||||
executeBatch: function (...args) {
|
||||
console.warn("LifecycleData.executeBatch 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, [DataAbilityResult]);
|
||||
}
|
||||
},
|
||||
call: function (...args) {
|
||||
console.warn("LifecycleData.call 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, PacMapType);
|
||||
}
|
||||
},
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { WantClass } from "../ohos_application_Want"
|
||||
|
||||
export const AbilityResult = {
|
||||
resultCode: "[PC Preview] unknow resultCode",
|
||||
want: new WantClass(),
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const ConnectOptions = {
|
||||
onConnect: function (...args) {
|
||||
console.warn("ConnectOptions.onConnect interface mocked in the Previewer. How this interface works" +
|
||||
" on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
onDisconnect: function (...args) {
|
||||
console.warn("ConnectOptions.onDisconnect interface mocked in the Previewer. How this interface works" +
|
||||
" on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
onFailed: function (...args) {
|
||||
console.warn("ConnectOptions.onFailed interface mocked in the Previewer. How this interface works" +
|
||||
" on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
}
|
@ -1,289 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
|
||||
const DataAbilityResult = {
|
||||
uri: "[PC Preview] unknow uri",
|
||||
count: "[PC Preview] unknow count"
|
||||
}
|
||||
const ResultSet = {
|
||||
columnNames: [paramMock.paramStringMock],
|
||||
columnCount: "[PC Preview] unknow columnCount",
|
||||
rowCount: "[PC Preview] unknow rowCount",
|
||||
rowIndex: "[PC Preview] unknow rowIndex",
|
||||
isAtFirstRow: "[PC Preview] unknow isAtFirstRow",
|
||||
isAtLastRow: "[PC Preview] unknow isAtLastRow",
|
||||
isEnded: "[PC Preview] unknow isEnded",
|
||||
isStarted: "[PC Preview] unknow isStarted",
|
||||
isClose: "[PC Preview] unknow isClose",
|
||||
getColumnIndex: function (...args) {
|
||||
console.warn("ResultSet.getColumnIndex interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
},
|
||||
getColumnName: function (...args) {
|
||||
console.warn("ResultSet.getColumnName interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock;
|
||||
},
|
||||
goTo: function (...args) {
|
||||
console.warn("ResultSet.goTo interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
goToRow: function (...args) {
|
||||
console.warn("ResultSet.goToRow interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
goToLastRow: function (...args) {
|
||||
console.warn("ResultSet.goToLastRow interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
goToFirstRow: function (...args) {
|
||||
console.warn("ResultSet.goToFirstRow interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
goToNextRow: function (...args) {
|
||||
console.warn("ResultSet.goToNextRow interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
goToPreviousRow: function (...args) {
|
||||
console.warn("ResultSet.goToPreviousRow interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
getBlob: function (...args) {
|
||||
console.warn("ResultSet.getBlob interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramArrayMock;
|
||||
},
|
||||
getString: function (...args) {
|
||||
console.warn("ResultSet.getString interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock;
|
||||
},
|
||||
getLong: function (...args) {
|
||||
console.warn("ResultSet.getLong interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
},
|
||||
getDouble: function (...args) {
|
||||
console.warn("ResultSet.getDouble interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
},
|
||||
isColumnNull: function (...args) {
|
||||
console.warn("ResultSet.isColumnNull interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
close: function () {
|
||||
console.warn("ResultSet.close interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
}
|
||||
}
|
||||
|
||||
export const PacMap = {key:{}}
|
||||
export const DataAbilityHelper = {
|
||||
openFile: function (...args) {
|
||||
console.warn("dataAbilityHelper.openFile 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.paramNumberMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
on: function (...args) {
|
||||
console.warn("dataAbilityHelper.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 (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock)
|
||||
}
|
||||
},
|
||||
off: function (...args) {
|
||||
console.warn("dataAbilityHelper.off 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)
|
||||
}
|
||||
},
|
||||
call: function (...args) {
|
||||
console.warn("dataAbilityHelper.call 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, PacMap)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(PacMap);
|
||||
})
|
||||
}
|
||||
},
|
||||
getType: function (...args) {
|
||||
console.warn("dataAbilityHelper.getType 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.paramStringMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
getFileTypes: function (...args) {
|
||||
console.warn("dataAbilityHelper.getFileTypes 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.paramStringMock])
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([paramMock.paramStringMock]);
|
||||
})
|
||||
}
|
||||
},
|
||||
normalizeUri: function (...args) {
|
||||
console.warn("dataAbilityHelper.normalizeUri 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.paramStringMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
denormalizeUri: function (...args) {
|
||||
console.warn("dataAbilityHelper.denormalizeUri 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.paramStringMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
notifyChange: function (...args) {
|
||||
console.warn("dataAbilityHelper.notifyChange 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();
|
||||
})
|
||||
}
|
||||
},
|
||||
insert: function (...args) {
|
||||
console.warn("dataAbilityHelper.insert 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.paramNumberMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
batchInsert: function (...args) {
|
||||
console.warn("dataAbilityHelper.batchInsert 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.paramNumberMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
delete: function (...args) {
|
||||
console.warn("dataAbilityHelper.delete 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.paramNumberMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
update: function (...args) {
|
||||
console.warn("dataAbilityHelper.update 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.paramNumberMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
query: function (...args) {
|
||||
console.warn("dataAbilityHelper.query 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, ResultSet)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(ResultSet);
|
||||
})
|
||||
}
|
||||
},
|
||||
call: function (...args) {
|
||||
console.warn("dataAbilityHelper.call 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, PacMap)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(PacMap);
|
||||
})
|
||||
}
|
||||
},
|
||||
executeBatch: function (...args) {
|
||||
console.warn("dataAbilityHelper.executeBatch 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, [DataAbilityResult])
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([DataAbilityResult]);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
import { mockDataAbility } from "../ohos_data_dataAbility"
|
||||
|
||||
export const DataAbilityOperation = {
|
||||
uri: "[PC Preview] unknow uri",
|
||||
type: {
|
||||
TYPE_INSERT: 1,
|
||||
TYPE_UPDATE: 2,
|
||||
TYPE_DELETE: 3,
|
||||
TYPE_ASSERT: 4
|
||||
},
|
||||
valuesBucket: {key:{}},
|
||||
valueBackReferences: {key:{}},
|
||||
predicates: mockDataAbility().DataAbilityPredicates,
|
||||
predicatesBackReferences: new Map([[paramMock.paramNumberMock, paramMock.paramNumberMock]]),
|
||||
interrupted: "[PC Preview] unknow interrupted",
|
||||
expectedCount: "[PC Preview] unknow expectedCount"
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const DataAbilityResult = {
|
||||
uri: "[PC Preview] unknow uri",
|
||||
count: "[PC Preview] unknow count",
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { WantClass } from "../ohos_application_Want"
|
||||
|
||||
export const StartAbilityParameter = {
|
||||
want: new WantClass(),
|
||||
abilityStartSetting: {},
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
|
||||
export const Want = {
|
||||
deviceId: "[PC Preview] unknow deviceId",
|
||||
bundleName: "[PC Preview] unknow bundleName",
|
||||
abilityName: "[PC Preview] unknow abilityName",
|
||||
uri: "[PC Preview] unknow uri",
|
||||
type: "[PC Preview] unknow type",
|
||||
flags: "[PC Preview] unknow flags",
|
||||
action: "[PC Preview] unknow action",
|
||||
parameters: {},
|
||||
entities: [paramMock.paramStringMock]
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const AppVersionInfo = {
|
||||
appName: "[PC Preview] unknow appName",
|
||||
versionCode: "[PC Preview] unknow versionCode",
|
||||
versionName: "[PC Preview] unknow versionName",
|
||||
}
|
@ -1,317 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
import { ProcessInfo } from "./processInfo"
|
||||
import { AppVersionInfo } from "./appVersionInfo"
|
||||
import { AbilityInfo } from "../bundle/abilityInfo"
|
||||
import { ApplicationInfo } from "../bundle/applicationInfo"
|
||||
import { ElementName } from "../bundle/elementName"
|
||||
import { HapModuleInfo } from "../bundle/hapModuleInfo"
|
||||
|
||||
const DisplayOrientation = {
|
||||
UNSPECIFIED: "[PC preview] unknown is UNSPECIFIED",
|
||||
LANDSCAPE: "[PC preview] unknown is LANDSCAPE",
|
||||
PORTRAIT: "[PC preview] unknown is PORTRAIT",
|
||||
FOLLOW_RECENT: "[PC preview] unknown is FOLLOW_RECENT",
|
||||
LANDSCAPE_INVERTED: "[PC preview] unknown is LANDSCAPE_INVERTED",
|
||||
PORTRAIT_INVERTED: "[PC preview] unknown is PORTRAIT_INVERTED",
|
||||
AUTO_ROTATION: "[PC preview] unknown is AUTO_ROTATION",
|
||||
AUTO_ROTATION_LANDSCAPE: "[PC preview] unknown is AUTO_ROTATION_LANDSCAPE",
|
||||
AUTO_ROTATION_PORTRAIT: "[PC preview] unknown is AUTO_ROTATION_PORTRAIT",
|
||||
AUTO_ROTATION_RESTRICTED: "[PC preview] unknown is AUTO_ROTATION_RESTRICTED",
|
||||
AUTO_ROTATION_LANDSCAPE_RESTRICTED: "[PC preview] unknown is AUTO_ROTATION_LANDSCAPE_RESTRICTED",
|
||||
AUTO_ROTATION_PORTRAIT_RESTRICTED: "[PC preview] unknown is AUTO_ROTATION_PORTRAIT_RESTRICTED",
|
||||
LOCKED: "[PC preview] unknown is LOCKED",
|
||||
}
|
||||
export const Context = {
|
||||
getOrCreateLocalDir: function (...args) {
|
||||
console.warn("Context.getOrCreateLocalDir 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, paramMock.businessErrorMock, paramMock.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
verifyPermission: function (...args) {
|
||||
console.warn("Context.verifyPermission 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, paramMock.businessErrorMock, paramMock.paramNumberMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
requestPermissionsFromUser: function (...args) {
|
||||
console.warn("Context.requestPermissionsFromUser 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, paramMock.businessErrorMock, PermissionRequestResult);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(PermissionRequestResult);
|
||||
})
|
||||
}
|
||||
},
|
||||
getApplicationInfo: function (...args) {
|
||||
console.warn("Context.getApplicationInfo 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, paramMock.businessErrorMock, ApplicationInfo);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(ApplicationInfo);
|
||||
})
|
||||
}
|
||||
},
|
||||
getBundleName: function (...args) {
|
||||
console.warn("Context.getBundleName 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, paramMock.businessErrorMock, paramMock.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
getDisplayOrientation: function (...args) {
|
||||
console.warn("Context.getDisplayOrientation 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, paramMock.businessErrorMock, DisplayOrientation);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(DisplayOrientation);
|
||||
})
|
||||
}
|
||||
},
|
||||
setDisplayOrientation: function (...args) {
|
||||
console.warn("Context.setDisplayOrientation 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
setShowOnLockScreen: function (...args) {
|
||||
console.warn("Context.setShowOnLockScreen 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
setWakeUpScreen: function (...args) {
|
||||
console.warn("Context.setWakeUpScreen 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
getProcessInfo: function (...args) {
|
||||
console.warn("Context.getProcessInfo 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, paramMock.businessErrorMock, ProcessInfo);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(ProcessInfo);
|
||||
})
|
||||
}
|
||||
},
|
||||
getElementName: function (...args) {
|
||||
console.warn("Context.getElementName 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, paramMock.businessErrorMock, ElementName);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(ElementName);
|
||||
})
|
||||
}
|
||||
},
|
||||
getProcessName: function (...args) {
|
||||
console.warn("Context.getProcessName 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, paramMock.businessErrorMock, paramMock.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
getCallingBundle: function (...args) {
|
||||
console.warn("Context.getCallingBundle 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, paramMock.businessErrorMock, paramMock.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
getFilesDir: function (...args) {
|
||||
console.warn("Context.getFilesDir 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, paramMock.businessErrorMock, paramMock.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
getCacheDir: function (...args) {
|
||||
console.warn("Context.getCacheDir 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, paramMock.businessErrorMock, paramMock.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
getOrCreateDistributedDir: function (...args) {
|
||||
console.warn("Context.getOrCreateDistributedDir 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, paramMock.businessErrorMock, paramMock.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
getAppType: function (...args) {
|
||||
console.warn("Context.getAppType 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, paramMock.businessErrorMock, paramMock.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
getHapModuleInfo: function (...args) {
|
||||
console.warn("Context.getHapModuleInfo 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, paramMock.businessErrorMock, HapModuleInfo);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(HapModuleInfo);
|
||||
})
|
||||
}
|
||||
},
|
||||
getAppVersionInfo: function (...args) {
|
||||
console.warn("Context.getAppVersionInfo 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, paramMock.businessErrorMock, AppVersionInfo);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(AppVersionInfo);
|
||||
})
|
||||
}
|
||||
},
|
||||
getApplicationContext: function () {
|
||||
console.warn("Context.getApplicationContext interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return Context;
|
||||
},
|
||||
getAbilityInfo: function (...args) {
|
||||
console.warn("Context.getAbilityInfo 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, paramMock.businessErrorMock, AbilityInfo);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(AbilityInfo);
|
||||
})
|
||||
}
|
||||
},
|
||||
isUpdatingConfigurations: function (...args) {
|
||||
console.warn("Context.isUpdatingConfigurations 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, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
printDrawnCompleted: function (...args) {
|
||||
console.warn("Context.printDrawnCompleted 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
export const PermissionRequestResult = {
|
||||
requestCode: "[PC Preview] unknow requestCode",
|
||||
permissions: [paramMock.paramStringMock],
|
||||
authResults: [paramMock.paramNumberMock],
|
||||
}
|
||||
export const PermissionOptions = {
|
||||
pid: "[PC Preview] unknow pid",
|
||||
uid: "[PC Preview] unknow uid",
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const ProcessInfo = {
|
||||
pid: "[PC Preview] unknow pid",
|
||||
processName: "[PC Preview] unknow processName",
|
||||
}
|
@ -1,231 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
import { ContextClass } from "./Context"
|
||||
import { Configuration } from "../ohos_application_Configuration"
|
||||
import { Caller } from "../ohos_application_Ability"
|
||||
import { AbilityInfo } from "../bundle/abilityInfo"
|
||||
import { HapModuleInfo } from "../bundle/hapModuleInfo"
|
||||
import { AbilityResult } from "../ability/abilityResult"
|
||||
import { PermissionRequestResultClass } from "./PermissionRequestResult"
|
||||
|
||||
export const AbilityContextClass = class AbilityContext extends ContextClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn('Ability.AbilityContext.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.abilityInfo = AbilityInfo;
|
||||
this.currentHapModuleInfo = HapModuleInfo;
|
||||
this.config = Configuration;
|
||||
this.startAbility = function (...args) {
|
||||
console.warn("Ability.AbilityContext.startAbility 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.startAbilityByCall = function (...args) {
|
||||
console.warn("Ability.AbilityContext.startAbilityByCall interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(Caller);
|
||||
})
|
||||
};
|
||||
this.startAbilityWithAccount = function (...args) {
|
||||
console.warn("Ability.AbilityContext.startAbilityWithAccount 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.startAbilityForResult = function (...args) {
|
||||
console.warn("Ability.AbilityContext.startAbilityForResult 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, paramMock.businessErrorMock, AbilityResult);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(AbilityResult);
|
||||
})
|
||||
}
|
||||
};
|
||||
this.startAbilityForResultWithAccount = function (...args) {
|
||||
console.warn("Ability.AbilityContext.startAbilityForResultWithAccount 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, paramMock.businessErrorMock, AbilityResult);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(AbilityResult);
|
||||
})
|
||||
}
|
||||
};
|
||||
this.startServiceExtensionAbility = function (...args) {
|
||||
console.warn("Ability.AbilityContext.startServiceExtensionAbility 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.startServiceExtensionAbilityWithAccount = function (...args) {
|
||||
console.warn("Ability.AbilityContext.startServiceExtensionAbilityWithAccount 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.stopServiceExtensionAbility = function (...args) {
|
||||
console.warn("Ability.AbilityContext.stopServiceExtensionAbility 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.stopServiceExtensionAbilityWithAccount = function (...args) {
|
||||
console.warn("Ability.AbilityContext.stopServiceExtensionAbilityWithAccount 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.terminateSelf = function (...args) {
|
||||
console.warn("Ability.AbilityContext.terminateSelf 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.terminateSelfWithResult = function (...args) {
|
||||
console.warn("Ability.AbilityContext.terminateSelfWithResult 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.connectAbility = function (...args) {
|
||||
console.warn("Ability.AbilityContext.connectAbility interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
};
|
||||
this.connectAbilityWithAccount = function (...args) {
|
||||
console.warn("Ability.AbilityContext.connectAbilityWithAccount interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
};
|
||||
this.disconnectAbility = function (...args) {
|
||||
console.warn("Ability.AbilityContext.disconnectAbility 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.setMissionLabel = function (...args) {
|
||||
console.warn("Ability.AbilityContext.setMissionLabel 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.setMissionIcon = function (...args) {
|
||||
console.warn("Ability.AbilityContext.setMissionIcon 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.requestPermissionsFromUser = function (...args) {
|
||||
console.warn("Ability.AbilityContext.requestPermissionsFromUser 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, paramMock.businessErrorMock, new PermissionRequestResultClass());
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve( new PermissionRequestResultClass());
|
||||
})
|
||||
}
|
||||
};
|
||||
this.restoreWindowStage = function (...args) {
|
||||
console.warn("Ability.AbilityContext.restoreWindowStage interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.isTerminating = function () {
|
||||
console.warn("Ability.AbilityContext.isTerminating interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock
|
||||
};
|
||||
}
|
||||
}
|
||||
export function mockAbilityContext() {
|
||||
return new AbilityContextClass();
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const ElementName = {
|
||||
deviceId: '[PC preview] unknow deviceId',
|
||||
bundleName: '[PC preview] unknow bundleName',
|
||||
abilityName: '[PC preview] unknow abilityName',
|
||||
uri: '[PC preview] unknow uri',
|
||||
shortName: '[PC preview] unknow shortName',
|
||||
moduleName: '[PC preview] unknow moduleName'
|
||||
}
|
||||
const AbilityState = {
|
||||
INITIAL: 0,
|
||||
FOREGROUND: 9,
|
||||
BACKGROUND: 10,
|
||||
FOREGROUNDING: 11,
|
||||
BACKGROUNDING: 12
|
||||
}
|
||||
|
||||
export const AbilityRunningInfo = {
|
||||
ability: ElementName,
|
||||
pid: '[PC preview] unknow pid',
|
||||
uid: '[PC preview] unknow uid',
|
||||
processName: '[PC preview] unknow processName',
|
||||
startTime: '[PC preview] unknow startTime',
|
||||
abilityState: AbilityState
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ContextClass } from "./Context"
|
||||
import { HapModuleInfo } from "../bundle/hapModuleInfo"
|
||||
import { Configuration } from "../ohos_application_Configuration"
|
||||
|
||||
export const AbilityStageContextClass = class AbilityStageContext extends ContextClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn("AbilityStageContext.constructor interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
this.currentHapModuleInfo = HapModuleInfo;
|
||||
this.config = Configuration;
|
||||
}
|
||||
};
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const AbilityStateDataClass = class AbilityStateData {
|
||||
constructor() {
|
||||
console.warn("AbilityStateData.constructor interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
this.moduleName = "[PC Preview] unknow moduleName",
|
||||
this.bundleName = "[PC Preview] unknow bundleName",
|
||||
this.abilityName = "[PC Preview] unknow abilityName",
|
||||
this.pid = "[PC Preview] unknow pid",
|
||||
this.uid = "[PC Preview] unknow uid",
|
||||
this.state = "[PC Preview] unknow state",
|
||||
this.abilityType = "[PC Preview] unknow abilityType"
|
||||
}
|
||||
};
|
@ -1,199 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from '../../utils'
|
||||
import { ExtensionContextClass } from './ExtensionContext'
|
||||
|
||||
const ElementAttributeNameMock = '[PC Preview] unknown element attribute name';
|
||||
|
||||
const ElementAttributeValuesMock = '[PC Preview] unknown element attribute value';
|
||||
|
||||
const Rect = {
|
||||
left: '[PC Preview] unknown element left',
|
||||
top: '[PC Preview] unknown element top',
|
||||
width: '[PC Preview] unknown element width',
|
||||
height: '[PC Preview] unknown element height'
|
||||
};
|
||||
|
||||
const AccessibilityElement = {
|
||||
attributeNames: function (...args) {
|
||||
console.warn('AccessibilityElement.attributeNames 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, [ElementAttributeNameMock]);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve([ElementAttributeNameMock]);
|
||||
});
|
||||
}
|
||||
},
|
||||
attributeValue: function (...args) {
|
||||
console.warn('AccessibilityElement.attributeValue interface mocked in the Previewer.' +
|
||||
' How this interface works on the Previewer may be different from that on a real device.');
|
||||
let value = null;
|
||||
switch (args[0]) {
|
||||
case 'contents':
|
||||
value = [ElementAttributeValuesMock];
|
||||
break;
|
||||
case 'rect':
|
||||
case 'screenRect':
|
||||
value = Rect;
|
||||
break;
|
||||
case 'parent':
|
||||
case 'rootElement':
|
||||
value = AccessibilityElement;
|
||||
break;
|
||||
case 'children':
|
||||
value = [AccessibilityElement];
|
||||
break;
|
||||
default:
|
||||
value = ElementAttributeValuesMock;
|
||||
break;
|
||||
}
|
||||
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, value);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(value);
|
||||
});
|
||||
}
|
||||
},
|
||||
actionNames: function (...args) {
|
||||
console.warn('AccessibilityElement.actionNames 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, [param.paramStringMock]);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve([param.paramStringMock]);
|
||||
});
|
||||
}
|
||||
},
|
||||
performAction: function (...args) {
|
||||
console.warn('AccessibilityElement.performAction 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, reject) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
findElement: function (...args) {
|
||||
console.warn('AccessibilityElement.findElement interface mocked in the Previewer.' +
|
||||
' How this interface works on the Previewer may be different from that on a real device.');
|
||||
const result = (args[0] === 'content') ? [AccessibilityElement] : AccessibilityElement;
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, result);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export class AccessibilityExtensionContext extends ExtensionContextClass {
|
||||
constructor(...args) {
|
||||
super();
|
||||
console.warn('AccessibilityExtensionContext.constructor interface mocked in the Previewer.' +
|
||||
' How this interface works on the Previewer may be different from that on a real device.');
|
||||
|
||||
this.setEventTypeFilter = function (...args) {
|
||||
console.warn('AccessibilityExtensionContext.setEventTypeFilter 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, reject) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.setTargetBundleName = function (...args) {
|
||||
console.warn('AccessibilityExtensionContext.setTargetBundleName 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, reject) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.getFocusElement = function (...args) {
|
||||
console.warn('AccessibilityExtensionContext.getFocusElement 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, AccessibilityElement);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(AccessibilityElement);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.getWindowRootElement = function (...args) {
|
||||
console.warn('AccessibilityExtensionContext.getWindowRootElement 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, AccessibilityElement);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(AccessibilityElement);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.getWindows = function (...args) {
|
||||
console.warn('AccessibilityExtensionContext.getWindows 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, [AccessibilityElement]);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve([AccessibilityElement]);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.injectGesture = function (...args) {
|
||||
console.warn('AccessibilityExtensionContext.injectGesture 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, reject) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const AppStateDataClass = class AppStateData {
|
||||
constructor() {
|
||||
console.warn("AppStateData.constructor interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.");
|
||||
this.bundleName = "[PC Preview] unknow bundleName";
|
||||
this.uid = "[PC Preview] unknow uid";
|
||||
this.state = "[PC Preview] unknow state";
|
||||
}
|
||||
};
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
import { ContextClass } from "./Context"
|
||||
|
||||
export const ApplicationContextClass = class ApplicationContext extends ContextClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn('ApplicationContext.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.registerAbilityLifecycleCallback = function (...args) {
|
||||
console.warn("ApplicationContext.registerAbilityLifecycleCallback interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
};
|
||||
this.unregisterAbilityLifecycleCallback = function (...args) {
|
||||
console.warn("ApplicationContext.unregisterAbilityLifecycleCallback 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.registerEnvironmentCallback = function (...args) {
|
||||
console.warn("ApplicationContext.registerEnvironmentCallback interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
};
|
||||
this.unregisterEnvironmentCallback = function (...args) {
|
||||
console.warn("ApplicationContext.unregisterEnvironmentCallback 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const ApplicationStateObserverClass = class ApplicationStateObserver {
|
||||
constructor() {
|
||||
console.warn('ApplicationStateObserver.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.onForegroundApplicationChanged = function (...args) {
|
||||
console.warn("ApplicationStateObserver.onForegroundApplicationChanged interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
};
|
||||
this.onAbilityStateChanged = function (...args) {
|
||||
console.warn("ApplicationStateObserver.onAbilityStateChanged interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
};
|
||||
this.onProcessCreated = function (...args) {
|
||||
console.warn("ApplicationStateObserver.onProcessCreated interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
};
|
||||
this.onProcessDied = function (...args) {
|
||||
console.warn("ApplicationStateObserver.onProcessDied interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
};
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export const BaseContextClass = class BaseContext {
|
||||
constructor() {
|
||||
console.warn("BaseContext.constructor interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.");
|
||||
this.stageMode = "[PC Preview] unknow stageMode";
|
||||
}
|
||||
};
|
@ -1,314 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { ApplicationInfo } from "../bundle/applicationInfo"
|
||||
import { BaseContextClass as BaseContext } from "./BaseContext"
|
||||
|
||||
const ResourceManager = {
|
||||
getString: function(...args) {
|
||||
console.warn("ResourceManager.getString 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.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getStringArray: function(...args) {
|
||||
console.warn("ResourceManager.getStringArray 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.paramStringMock]);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve([paramMock.paramStringMock]);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getMedia: function(...args) {
|
||||
console.warn("ResourceManager.getMedia 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.paramArrayMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramArrayMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getMediaBase64: function(...args) {
|
||||
console.warn("ResourceManager.getMediaBase64 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.paramArrayMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramArrayMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getPluralString: function(...args) {
|
||||
console.warn("ResourceManager.getPluralString 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.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getConfiguration: function(...args) {
|
||||
console.warn("ResourceManager.getConfiguration 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, new ConfigurationClass());
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(new ConfigurationClass());
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getDeviceCapability: function(...args) {
|
||||
console.warn("ResourceManager.getDeviceCapability 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, new DeviceCapabilityClass());
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(new DeviceCapabilityClass());
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
release: function() {
|
||||
console.warn("ResourceManager.release interface mocked in the Previewer. " +
|
||||
"How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
|
||||
getRawFile: function(...args) {
|
||||
console.warn("ResourceManager.getRawFile 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.paramArrayMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramArrayMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getRawFileDescriptor: function(...args) {
|
||||
console.warn("ResourceManager.getRawFileDescriptor 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, RawFileDescriptor);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(RawFileDescriptor);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
closeRawFileDescriptor: function(...args) {
|
||||
console.warn("ResourceManager.closeRawFileDescriptor 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.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getStringByName: function(...args) {
|
||||
console.warn("ResourceManager.getStringByName 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.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getStringArrayByName: function(...args) {
|
||||
console.warn("ResourceManager.getStringArrayByName 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.paramStringMock]);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve([paramMock.paramStringMock]);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getMediaByName: function(...args) {
|
||||
console.warn("ResourceManager.getMediaByName 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.paramArrayMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramArrayMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getMediaBase64ByName: function(...args) {
|
||||
console.warn("ResourceManager.getMediaBase64ByName 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.paramArrayMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramArrayMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getPluralStringByName: function(...args) {
|
||||
console.warn("ResourceManager.getPluralStringByName 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.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getStringSync: function(...args) {
|
||||
console.warn("ResourceManager.getStringSync interface mocked in the Previewer. " +
|
||||
"How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramStringMock;
|
||||
},
|
||||
|
||||
getStringByNameSync: function(...args) {
|
||||
console.warn("ResourceManager.getStringByNameSync interface mocked in the Previewer. " +
|
||||
"How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramStringMock;
|
||||
},
|
||||
|
||||
getBoolean: function(...args) {
|
||||
console.warn("ResourceManager.getBoolean interface mocked in the Previewer. " +
|
||||
"How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
|
||||
getBooleanByName: function(...args) {
|
||||
console.warn("ResourceManager.getBooleanByName interface mocked in the Previewer. " +
|
||||
"How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
|
||||
getNumber: function(...args) {
|
||||
console.warn("ResourceManager.getNumber interface mocked in the Previewer. " +
|
||||
"How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
},
|
||||
|
||||
getNumberByName: function(...args) {
|
||||
console.warn("ResourceManager.getNumberByName interface mocked in the Previewer. " +
|
||||
"How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
}
|
||||
}
|
||||
const EventHubClass = class EventHub {
|
||||
constructor() {
|
||||
console.warn('EventHub.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.on = function (...args) {
|
||||
console.warn("EventHub.on interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.off = function (...args) {
|
||||
console.warn("EventHub.off interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.emit = function (...args) {
|
||||
console.warn("EventHub.emit interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
}
|
||||
}
|
||||
export const ContextClass = class Context extends BaseContext {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn('Context.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.resourceManager = ResourceManager;
|
||||
this.applicationInfo = ApplicationInfo;
|
||||
this.cacheDir = "[PC Preview] unknow cacheDir";
|
||||
this.tempDir = "[PC Preview] unknow tempDir";
|
||||
this.filesDir = "[PC Preview] unknow filesDir";
|
||||
this.databaseDir = "[PC Preview] unknow databaseDir";
|
||||
this.preferencesDir = "[PC Preview] unknow preferencesDir";
|
||||
this.storageDir = "[PC Preview] unknow storageDir";
|
||||
this.bundleCodeDir = "[PC Preview] unknow bundleCodeDir";
|
||||
this.distributedFilesDir = "[PC Preview] unknow distributedFilesDir";
|
||||
this.eventHub = new EventHubClass();
|
||||
this.area = AreaMode;
|
||||
this.createBundleContext = function (...args) {
|
||||
console.warn("Context.createBundleContext interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return new ContextClass();
|
||||
};
|
||||
this.createModuleContext = function (...args) {
|
||||
console.warn("Context.createModuleContext interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return new ContextClass();
|
||||
};
|
||||
this.getApplicationContext = function () {
|
||||
console.warn("Context.getApplicationContext interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return new ContextClass();
|
||||
};
|
||||
this.switchArea = function (...args) {
|
||||
console.warn("Context.switchArea interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
}
|
||||
}
|
||||
export const AreaMode = {
|
||||
EL1: 0,
|
||||
EL2: 1
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const ErrorObserverClass = class ErrorObserver {
|
||||
constructor() {
|
||||
console.warn("ErrorObserver.constructor interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
this.onUnhandledException = function (...args) {
|
||||
console.warn("ErrorObserver.onUnhandledException interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
}
|
||||
};
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const EventHubClass = class EventHub {
|
||||
constructor() {
|
||||
console.warn("EventHub.constructor interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
this.on = function (...args) {
|
||||
console.warn("EventHub.on interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.off = function (...args) {
|
||||
console.warn("EventHub.off interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.emit = function (...args) {
|
||||
console.warn("EventHub.emit interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
}
|
||||
};
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { HapModuleInfo } from "../bundle/hapModuleInfo";
|
||||
import { Configuration } from "../ohos_application_Configuration"
|
||||
import { ExtensionAbilityInfo } from "../bundle/extensionAbilityInfo"
|
||||
import { ContextClass } from "./Context"
|
||||
|
||||
export const ExtensionContextClass = class ExtensionContext extends ContextClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn("ExtensionContext.constructor interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
this.currentHapModuleInfo = HapModuleInfo;
|
||||
this.config = Configuration;
|
||||
this.extensionAbilityInfo = ExtensionAbilityInfo;
|
||||
}
|
||||
};
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
|
||||
const ElementName = {
|
||||
deviceId: '[PC preview] unknow deviceId',
|
||||
bundleName: '[PC preview] unknow bundleName',
|
||||
abilityName: '[PC preview] unknow abilityName',
|
||||
uri: '[PC preview] unknow uri',
|
||||
shortName: '[PC preview] unknow shortName',
|
||||
moduleName: '[PC preview] unknow moduleName'
|
||||
}
|
||||
const ExtensionAbilityType = {
|
||||
FORM: 0,
|
||||
WORK_SCHEDULER: 1,
|
||||
INPUT_METHOD: 2,
|
||||
SERVICE: 3,
|
||||
ACCESSIBILITY: 4,
|
||||
DATA_SHARE: 5,
|
||||
FILE_SHARE: 6,
|
||||
STATIC_SUBSCRIBER: 7,
|
||||
WALLPAPER: 8,
|
||||
BACKUP: 9,
|
||||
WINDOW: 10,
|
||||
ENTERPRISE_ADMIN: 11,
|
||||
UNSPECIFIED: 20
|
||||
}
|
||||
|
||||
export const ExtensionRunningInfo = {
|
||||
extension: ElementName,
|
||||
pid: '[PC preview] unknow pid',
|
||||
uid: '[PC preview] unknow uid',
|
||||
processName: '[PC preview] unknow processName',
|
||||
startTime: '[PC preview] unknow startTime',
|
||||
clientPackage: [paramMock.paramStringMock],
|
||||
abilityState: ExtensionAbilityType
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { ExtensionContextClass } from "./ExtensionContext"
|
||||
export const FormExtensionContextClass = class FormExtensionContext extends ExtensionContextClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn('FormExtensionContext.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.startAbility = function (...args) {
|
||||
console.warn("FormExtensionContext.startAbility 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { WantClass } from "../ohos_application_Want"
|
||||
|
||||
export const MissionInfo = {
|
||||
missionId: '[PC preview] unknow missionId',
|
||||
runningState: '[PC preview] unknow runningState',
|
||||
lockedState: '[PC preview] unknow lockedState',
|
||||
timestamp: '[PC preview] unknow timestamp',
|
||||
want: new WantClass(),
|
||||
label: '[PC preview] unknow label',
|
||||
iconPath: '[PC preview] unknow iconPath',
|
||||
continuable: '[PC preview] unknow continuable'
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const MissionListener = {
|
||||
onMissionCreated: function(...args) {
|
||||
console.warn("MissionListener.onMissionCreated interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
onMissionDestroyed: function(...args) {
|
||||
console.warn("MissionListener.onMissionDestroyed interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
onMissionSnapshotChanged: function(...args) {
|
||||
console.warn("MissionListener.onMissionSnapshotChanged interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
onMissionMovedToFront: function(...args) {
|
||||
console.warn("MissionListener.onMissionMovedToFront interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
onMissionIconUpdated: function(...args) {
|
||||
console.warn("MissionListener.onMissionIconUpdated interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { PixelMapMock } from "../../multimedia"
|
||||
|
||||
const ElementName = {
|
||||
deviceId: '[PC preview] unknown deviceId',
|
||||
bundleName: '[PC preview] unknown bundleName',
|
||||
abilityName: '[PC preview] unknown abilityName',
|
||||
uri: '[PC preview] unknown uri',
|
||||
shortName: '[PC preview] unknown shortName',
|
||||
moduleName: '[PC preview] unknown moduleName'
|
||||
}
|
||||
|
||||
export const MissionSnapshot = {
|
||||
abality: ElementName,
|
||||
snapshot: PixelMapMock
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
|
||||
export const PermissionRequestResultClass = class PermissionRequestResult {
|
||||
constructor() {
|
||||
console.warn("PermissionRequestResult.constructor interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
this.permissions = [paramMock.paramStringMock]
|
||||
this.authResults = [paramMock.paramNumberMock]
|
||||
}
|
||||
};
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const ProcessDataClass = class ProcessData {
|
||||
constructor() {
|
||||
console.warn("ProcessData.constructor interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
this.bundleName = "[PC Preview] unknow bundleName"
|
||||
this.pid = "[PC Preview] unknow pid"
|
||||
this.uid = "[PC Preview] unknow uid"
|
||||
}
|
||||
};
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
|
||||
export const ProcessRunningInfo = {
|
||||
pid: "[PC Preview] unknow pid",
|
||||
uid: "[PC Preview] unknow uid",
|
||||
processName: "[PC Preview] unknow processName",
|
||||
bundleNames: [paramMock.paramStringMock]
|
||||
}
|
@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
import { Caller } from "../ohos_application_Ability";
|
||||
import { ExtensionContextClass } from "./ExtensionContext"
|
||||
|
||||
export const ServiceExtensionContextClass = class ServiceExtensionContext extends ExtensionContextClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn("ServiceExtensionContext.constructor interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
this.startAbility = function (...args) {
|
||||
console.warn("ServiceExtensionContext.startAbility 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.startAbilityWithAccount = function (...args) {
|
||||
console.warn("ServiceExtensionContext.startAbilityWithAccount 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.startServiceExtensionAbility = function (...args) {
|
||||
console.warn("ServiceExtensionContext.startServiceExtensionAbility 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.startServiceExtensionAbilityWithAccount = function (...args) {
|
||||
console.warn("ServiceExtensionContext.startServiceExtensionAbilityWithAccount 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.stopServiceExtensionAbility = function (...args) {
|
||||
console.warn("ServiceExtensionContext.stopServiceExtensionAbility 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.stopServiceExtensionAbilityWithAccount = function (...args) {
|
||||
console.warn("ServiceExtensionContext.stopServiceExtensionAbilityWithAccount 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.terminateSelf = function (...args) {
|
||||
console.warn("ServiceExtensionContext.terminateSelf 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.connectAbility = function (...args) {
|
||||
console.warn("ServiceExtensionContext.connectAbility interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
};
|
||||
this.connectAbilityWithAccount = function (...args) {
|
||||
console.warn("ServiceExtensionContext.connectAbilityWithAccount interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
};
|
||||
this.disconnectAbility = function (...args) {
|
||||
console.warn("ServiceExtensionContext.disconnectAbility 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.startAbilityByCall = function (...args) {
|
||||
console.warn("ServiceExtensionContext.startAbilityByCall interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(Caller);
|
||||
})
|
||||
};
|
||||
}
|
||||
};
|
@ -1,155 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
import { AbilityClass } from "../ohos_application_Ability"
|
||||
import { ContextClass } from "./Context"
|
||||
import { ShellCmdResult } from "./shellCmdResult"
|
||||
|
||||
export const AbilityDelegator = {
|
||||
addAbilityMonitor: function (...args) {
|
||||
console.warn("AbilityDelegator.addAbilityMonitor 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
removeAbilityMonitor: function (...args) {
|
||||
console.warn("AbilityDelegator.removeAbilityMonitor 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
waitAbilityMonitor: function (...args) {
|
||||
console.warn("AbilityDelegator.waitAbilityMonitor 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, paramMock.businessErrorMock, new AbilityClass());
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(new AbilityClass());
|
||||
})
|
||||
}
|
||||
},
|
||||
getAppContext: function (...args) {
|
||||
console.warn('AbilityDelegator.getAppContext interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
return new ContextClass();
|
||||
},
|
||||
getAbilityState: function (...args) {
|
||||
console.warn('AbilityDelegator.getAbilityState interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
return paramMock.paramNumberMock;
|
||||
},
|
||||
getCurrentTopAbility: function (...args) {
|
||||
console.warn("AbilityDelegator.getCurrentTopAbility 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, paramMock.businessErrorMock, new AbilityClass());
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(new AbilityClass());
|
||||
})
|
||||
}
|
||||
},
|
||||
startAbility: function (...args) {
|
||||
console.warn("AbilityDelegator.startAbility 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
doAbilityForeground: function (...args) {
|
||||
console.warn("AbilityDelegator.doAbilityForeground 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, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
doAbilityBackground: function (...args) {
|
||||
console.warn("AbilityDelegator.doAbilityBackground 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, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
print: function (...args) {
|
||||
console.warn("AbilityDelegator.print 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
printSync: function (...args) {
|
||||
console.warn('AbilityDelegator.printSync interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
},
|
||||
executeShellCommand: function (...args) {
|
||||
console.warn("AbilityDelegator.executeShellCommand 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, paramMock.businessErrorMock, ShellCmdResult);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(ShellCmdResult);
|
||||
})
|
||||
}
|
||||
},
|
||||
finishTest: function (...args) {
|
||||
console.warn("AbilityDelegator.finishTest 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const AbilityDelegatorArgs = {
|
||||
bundleName: "[PC Preview] unknow bundleName",
|
||||
parameters: {},
|
||||
testCaseNames: "[PC Preview] unknow testCaseNames",
|
||||
testRunnerClassName: "[PC Preview] unknow testRunnerClassName",
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export const AbilityMonitor = {
|
||||
abilityName: "[PC Preview] unknow abilityName",
|
||||
onAbilityCreate: function (...args) {
|
||||
console.warn("AbilityMonitor.onAbilityCreate interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
onAbilityForeground: function (...args) {
|
||||
console.warn("AbilityMonitor.onAbilityForeground interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
onAbilityBackground: function (...args) {
|
||||
console.warn("AbilityMonitor.onAbilityBackground interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
onAbilityDestroy: function (...args) {
|
||||
console.warn("AbilityMonitor.onAbilityDestroy interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
onWindowStageCreate: function (...args) {
|
||||
console.warn("AbilityMonitor.onWindowStageCreate interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
onWindowStageRestore: function (...args) {
|
||||
console.warn("AbilityMonitor.onWindowStageRestore interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
onWindowStageDestroy: function (...args) {
|
||||
console.warn("AbilityMonitor.onWindowStageDestroy interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const ShellCmdResult = {
|
||||
stdResult: "[PC Preview] unknow stdResult",
|
||||
exitCode: "[PC Preview] unknow exitCode",
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const PermissionDef = {
|
||||
permissionName: "[PC preview] unknown permissionName",
|
||||
grantMode: "[PC preview] unknown grantMode",
|
||||
labelId: "[PC preview] unknown labelId",
|
||||
descriptionId: "[PC preview] unknown descriptionId",
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
import { AbilityType, AbilitySubType, DisplayOrientation, LaunchMode, SupportWindowMode } from "./../ohos_bundle"
|
||||
import { ApplicationInfo } from "./applicationInfo"
|
||||
import { CustomizeData } from "./customizeData"
|
||||
import { Metadata } from "./metadata"
|
||||
|
||||
|
||||
export const AbilityInfo = {
|
||||
name: "[PC preview] unknown name",
|
||||
bundleName: "[PC preview] unknown bundleName",
|
||||
moduleName: "[PC preview] unknown moduleName",
|
||||
process: "[PC preview] unknown process",
|
||||
targetAbility: "[PC preview] unknown targetAbility",
|
||||
backgroundModes: "[PC preview] unknown backgroundModes",
|
||||
isVisible: "[PC preview] unknown isVisible",
|
||||
formEnabled: "[PC preview] unknown formEnabled",
|
||||
type: AbilityType,
|
||||
subType: AbilitySubType,
|
||||
orientation: DisplayOrientation,
|
||||
launchMode: LaunchMode,
|
||||
permissions: [paramMock.paramStringMock],
|
||||
deviceTypes: [paramMock.paramStringMock],
|
||||
deviceCapabilities: [paramMock.paramNumberMock],
|
||||
readPermission: '[PC Preview] unknow readPermission',
|
||||
writePermission: '[PC Preview] unknow writePermission',
|
||||
appId: '[PC Preview] unknow appId',
|
||||
label: "[PC preview] unknown label",
|
||||
description: "[PC preview] unknown description",
|
||||
icon: "[PC preview] unknown icon",
|
||||
labelId: "[PC preview] unknown labelId",
|
||||
iconId: "[PC preview] unknown iconId",
|
||||
uid: '[PC Preview] unknow uid',
|
||||
installTime: '[PC Preview] unknow installTime',
|
||||
updateTime: '[PC Preview] unknow updateTime',
|
||||
descriptionId: '[PC Preview] unknow descriptionId',
|
||||
applicationInfo: ApplicationInfo,
|
||||
metaData: [CustomizeData],
|
||||
uri: "[PC preview] unknown uri",
|
||||
metadata: [Metadata],
|
||||
enabled: "[PC preview] unknown enabled",
|
||||
supportWindowMode: [SupportWindowMode],
|
||||
maxWindowRatio: "[PC preview] unknown maxWindowRatio",
|
||||
minWindowRatio: "[PC preview] unknown minWindowRatio",
|
||||
maxWindowWidth: "[PC preview] unknown maxWindowWidth",
|
||||
minWindowWidth: "[PC preview] unknown minWindowWidth",
|
||||
maxWindowHeight: "[PC preview] unknown maxWindowHeight",
|
||||
minWindowHeight: "[PC preview] unknown minWindowHeight",
|
||||
formEntity: "[PC preview] unknown formEntity",
|
||||
minFormHeight: "[PC preview] unknown minFormHeight",
|
||||
defaultFormHeight: "[PC preview] unknown defaultFormHeight",
|
||||
minFormWidth: "[PC preview] unknown minFormWidth",
|
||||
defaultFormWidth: "[PC preview] unknown defaultFormWidth",
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
import { ModuleInfo } from './moduleInfo';
|
||||
import { CustomizeData } from './customizeData';
|
||||
import { Metadata } from './metadata';
|
||||
import { Resource } from './../global/resource';
|
||||
|
||||
export const ApplicationInfo = {
|
||||
name: "[PC preview] unknown name",
|
||||
description: "[PC preview] unknown description",
|
||||
descriptionId: "[PC preview] unknown descriptionId",
|
||||
systemApp: "[PC preview] unknown systemApp",
|
||||
enabled: "[PC preview] unknown enabled",
|
||||
label: "[PC preview] unknown label",
|
||||
labelId: "[PC preview] unknown labelId",
|
||||
icon: "[PC preview] unknown icon",
|
||||
iconId: "[PC preview] unknown iconId",
|
||||
process: "[PC preview] unknown process",
|
||||
supportedModes: "[PC preview] unknown supportedModes",
|
||||
moduleSourceDirs: [paramMock.paramNumberMock],
|
||||
permissions: [paramMock.paramNumberMock],
|
||||
moduleInfos: [ModuleInfo],
|
||||
entryDir: "[PC preview] unknown entryDir",
|
||||
codePath: "[PC preview] unknown codePath",
|
||||
metaData: [CustomizeData],
|
||||
metadata: [Metadata],
|
||||
removable: "[PC preview] unknown removable",
|
||||
accessTokenId: "[PC preview] unknown accessTokenId",
|
||||
uid: "[PC preview] unknown uid",
|
||||
entityType: "[PC preview] unknown entityType",
|
||||
fingerprint: "[PC preview] unknown fingerprint",
|
||||
iconResource: Resource,
|
||||
labelResource: Resource,
|
||||
descriptionResource: Resource,
|
||||
appDistributionType: "[PC preview] unknown appDistributionType",
|
||||
appProvisionType: "[PC preview] unknown appProvisionType",
|
||||
}
|
||||
|
||||
export const Want = {
|
||||
deviceId: "[PC Preview] unknow deviceId",
|
||||
bundleName: "[PC Preview] unknow bundleName",
|
||||
abilityName: "[PC Preview] unknow abilityName",
|
||||
uri: "[PC Preview] unknow uri",
|
||||
type: "[PC Preview] unknow type",
|
||||
flag: "[PC Preview] unknow flag",
|
||||
action: "[PC Preview] unknow action",
|
||||
parameters: [paramMock.paramStringMock],
|
||||
entities: [paramMock.paramStringMock],
|
||||
moduleName: "[PC Preview] unknow moduleName",
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
import { AbilityInfo } from './abilityInfo';
|
||||
import { ApplicationInfo } from './applicationInfo';
|
||||
import { ExtensionAbilityInfo } from './extensionAbilityInfo';
|
||||
import { HapModuleInfo } from './hapModuleInfo';
|
||||
|
||||
export const UsedScene = {
|
||||
abilities: [paramMock.paramStringMock],
|
||||
when: "[PC preview] unknown when",
|
||||
}
|
||||
|
||||
export const ReqPermissionDetail = {
|
||||
name: "[PC preview] unknown name",
|
||||
reason: "[PC preview] unknown reason",
|
||||
reasonId: "[PC preview] unknown reasonId",
|
||||
usedScene: UsedScene,
|
||||
}
|
||||
|
||||
export const BundleInfo = {
|
||||
name: "[PC preview] unknown name",
|
||||
type: "[PC preview] unknown type",
|
||||
appId: "[PC preview] unknown appId",
|
||||
uid: "[PC preview] unknown uid",
|
||||
installTime: "[PC preview] unknown installTime",
|
||||
updateTime: "[PC preview] unknown updateTime",
|
||||
appInfo: ApplicationInfo,
|
||||
abilityInfos: [AbilityInfo],
|
||||
reqPermissions: [paramMock.paramStringMock],
|
||||
reqPermissionDetails: [ReqPermissionDetail],
|
||||
vendor: "[PC preview] unknown vendor",
|
||||
versionCode: "[PC preview] unknown versionCode",
|
||||
versionName: "[PC preview] unknown versionName",
|
||||
compatibleVersion: "[PC preview] unknown compatibleVersion",
|
||||
targetVersion: "[PC preview] unknown targetVersion",
|
||||
isCompressNativeLibs: "[PC preview] unknown isCompressNativeLibs",
|
||||
hapModuleInfos: [HapModuleInfo],
|
||||
entryModuleName: "[PC preview] unknown entryModuleName",
|
||||
cpuAbi: "[PC preview] unknown cpuAbi",
|
||||
isSilentInstallation: "[PC preview] unknown isSilentInstallation",
|
||||
minCompatibleVersionCode: "[PC preview] unknown minCompatibleVersionCode",
|
||||
entryInstallationFree: "[PC preview] unknown entryInstallationFree",
|
||||
reqPermissionStates: [paramMock.paramStringMock],
|
||||
extensionAbilityInfo: [ExtensionAbilityInfo],
|
||||
};
|
||||
|
||||
export const PixelMapFormat = {
|
||||
UNKNOWN: 0,
|
||||
RGB_565: 2,
|
||||
RGBA_8888: 3,
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
import { InstallErrorCode } from '../ohos_bundle.js'
|
||||
|
||||
export const HashParam = {
|
||||
moduleName: "[PC preview] unknown moduleName",
|
||||
hashValue: "[PC preview] unknown hashValue",
|
||||
}
|
||||
|
||||
export const InstallParam = {
|
||||
userId: "[PC preview] unknown userId",
|
||||
installFlag: "[PC preview] unknown installFlag",
|
||||
isKeepData: "[PC preview] unknown isKeepData",
|
||||
hashParams: [HashParam],
|
||||
crowdtestDeadline: "[PC preview] unknown crowdtestDeadline",
|
||||
}
|
||||
|
||||
export const InstallStatus = {
|
||||
status: InstallErrorCode,
|
||||
statusMessage: "[PC preview] unknown statusMessage",
|
||||
}
|
||||
|
||||
export const BundleInstaller = {
|
||||
moduleName: "[PC preview] unknown moduleName",
|
||||
hashValue: "[PC preview] unknown hashValue",
|
||||
}
|
||||
|
||||
export function mockBundleInstaller() {
|
||||
const bundleInstaller = {
|
||||
install: function(...args){
|
||||
console.warn("bundleInstaller.install 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;
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, InstallStatus);
|
||||
},
|
||||
uninstall: function(...args){
|
||||
console.warn("bundleInstaller.uninstall 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;
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, InstallStatus);
|
||||
},
|
||||
recover: function(...args){
|
||||
console.warn("bundleInstaller.recover 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;
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, InstallStatus);
|
||||
}
|
||||
};
|
||||
return bundleInstaller;
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export function mockBundleStatusCallback() {
|
||||
const bundleStatusCallback = {
|
||||
add: function(){
|
||||
console.warn("bundleStatusCallback.add interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
},
|
||||
update: function(){
|
||||
console.warn("bundleStatusCallback.update interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
},
|
||||
remove: function(){
|
||||
console.warn("bundleStatusCallback.remove interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
}
|
||||
};
|
||||
return bundleStatusCallback;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const CustomizeData = {
|
||||
name: "[PC preview] unknown name",
|
||||
value: "[PC preview] unknown value",
|
||||
extra: "[PC preview] unknown extra",
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const DefaultAppManager = {
|
||||
BROWSER: "[PC preview] unknown BROWSER",
|
||||
IMAGE: "[PC preview] unknown IMAGE",
|
||||
AUDIO: "[PC preview] unknown AUDIO",
|
||||
VIDEO: "[PC preview] unknown VIDEO",
|
||||
PDF: "[PC preview] unknown PDF",
|
||||
WORD: "[PC preview] unknown WORD",
|
||||
EXCEL: "[PC preview] unknown EXCEL",
|
||||
PPT: "[PC preview] unknown PPT",
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const DispatchInfo = {
|
||||
version: "[PC preview] unknown version",
|
||||
dispatchAPI: "[PC preview] unknown dispatchAPI",
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const ElementName = {
|
||||
deviceId: "[PC preview] unknown deviceId",
|
||||
bundleName: "[PC preview] unknown bundleName",
|
||||
abilityName: "[PC preview] unknown abilityName",
|
||||
uri: "[PC preview] unknown uri",
|
||||
shortName: "[PC preview] unknown shortName",
|
||||
moduleName: "[PC preview] unknown moduleName",
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
import { ApplicationInfo } from './applicationInfo';
|
||||
import { Metadata } from './metadata'
|
||||
import { ExtensionAbilityType } from "./../ohos_bundle"
|
||||
|
||||
|
||||
export const ExtensionAbilityInfo = {
|
||||
bundleName: "[PC preview] unknown bundleName",
|
||||
moduleName: "[PC preview] unknown moduleName",
|
||||
name: "[PC preview] unknown name",
|
||||
labelId: "[PC preview] unknown labelId",
|
||||
descriptionId: "[PC preview] unknown descriptionId",
|
||||
iconId: "[PC preview] unknown iconId",
|
||||
isVisible: "[PC preview] unknown isVisible",
|
||||
extensionAbilityType: ExtensionAbilityType,
|
||||
metadata: [Metadata],
|
||||
permissions: [paramMock.paramStringMock],
|
||||
applicationInfo: ApplicationInfo,
|
||||
enabled: "[PC preview] unknown enabled",
|
||||
readPermission: "[PC preview] unknown readPermission",
|
||||
writePermission: "[PC preview] unknown writePermission",
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
import { AbilityInfo } from './abilityInfo';
|
||||
import { ExtensionAbilityInfo } from './extensionAbilityInfo';
|
||||
import { Metadata } from './metadata';
|
||||
|
||||
|
||||
export const HapModuleInfo = {
|
||||
name: "[PC preview] unknown name",
|
||||
description: "[PC preview] unknown description",
|
||||
descriptionId: "[PC preview] unknown descriptionId",
|
||||
icon: "[PC preview] unknown icon",
|
||||
label: "[PC preview] unknown label",
|
||||
labelId: "[PC preview] unknown labelId",
|
||||
iconId: "[PC preview] unknown iconId",
|
||||
backgroundImg: "[PC preview] unknown backgroundImg",
|
||||
supportedModes: "[PC preview] unknown supportedModes",
|
||||
reqCapabilities: [paramMock.paramStringMock],
|
||||
deviceTypes: [paramMock.paramStringMock],
|
||||
abilityInfo: [AbilityInfo],
|
||||
moduleName: "[PC preview] unknown moduleName",
|
||||
mainAbilityName: "[PC preview] unknown mainAbilityName",
|
||||
installationFree: "[PC preview] unknown installationFree",
|
||||
mainElementName: "[PC preview] unknown mainElementName",
|
||||
extensionAbilityInfo: [ExtensionAbilityInfo],
|
||||
metadata: [Metadata],
|
||||
hashValue: "[PC preview] unknown mainElementName",
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
import { ApplicationInfo } from './applicationInfo';
|
||||
import { ElementName } from './elementName'
|
||||
|
||||
export const LauncherAbilityInfo = {
|
||||
applicationInfo: ApplicationInfo,
|
||||
elementName: ElementName,
|
||||
labelId: "[PC preview] unknown labelId",
|
||||
iconId: "[PC preview] unknown iconId",
|
||||
userId: "[PC preview] unknown userId",
|
||||
installTime: "[PC preview] unknown installTime",
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const Metadata = {
|
||||
name: "[PC preview] unknown name",
|
||||
value: "[PC preview] unknown value",
|
||||
resource: "[PC preview] unknown resource",
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const ModuleInfo = {
|
||||
moduleName: "[PC preview] unknown moduleName",
|
||||
moduleSourceDir: "[PC preview] unknown moduleSourceDir",
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
|
||||
export const PackageConfig = {
|
||||
deviceType: [paramMock.paramStringMock],
|
||||
name: "[PC preview] unknown name",
|
||||
moduleType: "[PC preview] unknown moduleType",
|
||||
deliveryWithInstall: "[PC preview] unknown deliveryWithInstall",
|
||||
}
|
||||
|
||||
export const ModuleDistroInfo = {
|
||||
mainAbility: "[PC preview] unknown mainAbility",
|
||||
deliveryWithInstall: "[PC preview] unknown deliveryWithInstall",
|
||||
installationFree: "[PC preview] unknown installationFree",
|
||||
moduleName: "[PC preview] unknown moduleName",
|
||||
moduleType: "[PC preview] unknown moduleType",
|
||||
}
|
||||
|
||||
export const AbilityFormInfo = {
|
||||
name: "[PC preview] unknown name",
|
||||
type: "[PC preview] unknown type",
|
||||
updateEnabled: "[PC preview] unknown updateEnabled",
|
||||
scheduledUpdateTime: "[PC preview] unknown scheduledUpdateTime",
|
||||
updateDuration: "[PC preview] unknown updateDuration",
|
||||
supportDimensions: [paramMock.paramNumberMock],
|
||||
defaultDimension: "[PC preview] unknown defaultDimension",
|
||||
}
|
||||
|
||||
export const ApiVersion = {
|
||||
releaseType: "[PC preview] unknown releaseType",
|
||||
compatible: "[PC preview] unknown compatible",
|
||||
target: "[PC preview] unknown target",
|
||||
}
|
||||
|
||||
export const Version = {
|
||||
minCompatibleVersionCode: "[PC preview] unknown minCompatibleVersionCode",
|
||||
name: "[PC preview] unknown name",
|
||||
code: "[PC preview] unknown code",
|
||||
}
|
||||
|
||||
export const ModuleAbilityInfo = {
|
||||
name: "[PC preview] unknown name",
|
||||
label: "[PC preview] unknown label",
|
||||
visible: "[PC preview] unknown visible",
|
||||
forms: [AbilityFormInfo],
|
||||
}
|
||||
|
||||
export const ExtensionAbilities = {
|
||||
name: "[PC preview] unknown name",
|
||||
forms: [AbilityFormInfo],
|
||||
}
|
||||
|
||||
export const ModuleConfigInfo = {
|
||||
apiVersion: ApiVersion,
|
||||
deviceType: [paramMock.paramStringMock],
|
||||
distro: [paramMock.paramStringMock],
|
||||
abilities: [ModuleAbilityInfo],
|
||||
extensionAbilities: [ExtensionAbilities],
|
||||
}
|
||||
|
||||
export const BundleConfigInfo = {
|
||||
bundleName: "[PC preview] unknown bundleName",
|
||||
version: Version,
|
||||
}
|
||||
|
||||
export const PackageSummary = {
|
||||
app: BundleConfigInfo,
|
||||
modules: [ModuleConfigInfo]
|
||||
}
|
||||
|
||||
export const BundlePackFlag = {
|
||||
GET_PACK_INFO_ALL: 0x00000000,
|
||||
GET_PACKAGES: 0x00000001,
|
||||
GET_BUNDLE_SUMMARY: 0x00000002,
|
||||
GET_MODULE_SUMMARY: 0x00000004,
|
||||
}
|
||||
|
||||
export const BundlePackInfo = {
|
||||
packages: [PackageConfig],
|
||||
summary: PackageSummary
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ElementName } from './elementName';
|
||||
|
||||
export const RemoteAbilityInfo = {
|
||||
elementName: ElementName,
|
||||
label: "[PC preview] unknown IMAGE",
|
||||
icon: "[PC preview] unknown AUDIO",
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const ShortcutWant = {
|
||||
targetBundle: "[PC preview] unknown targetBundle",
|
||||
targetModule: "[PC preview] unknown targetModule",
|
||||
targetClass: "[PC preview] unknown targetClass",
|
||||
}
|
||||
|
||||
export const ShortcutInfo = {
|
||||
id: "[PC preview] unknown id",
|
||||
bundleName: "[PC preview] unknown bundleName",
|
||||
hostAbility: "[PC preview] unknown hostAbility",
|
||||
icon: "[PC preview] unknown icon",
|
||||
iconId: "[PC preview] unknown iconId",
|
||||
label: "[PC preview] unknown label",
|
||||
labelId: "[PC preview] unknown labelId",
|
||||
disableMessage: "[PC preview] unknown disableMessage",
|
||||
wants: [ShortcutWant],
|
||||
isStatic: "[PC preview] unknown isStatic",
|
||||
isHomeShortcut: "[PC preview] unknown isHomeShortcut",
|
||||
isEnabled: "[PC preview] unknown isEnabled",
|
||||
moduleName: "[PC preview] unknown moduleName",
|
||||
}
|
@ -1,156 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../../utils"
|
||||
export const Result = {
|
||||
code: "[PC Preview] unknow code",
|
||||
data: "[PC Preview] unknow data",
|
||||
}
|
||||
export const SubscribeMessageResponse = {
|
||||
deviceId: "[PC Preview] unknow deviceId",
|
||||
bundleName: "[PC Preview] unknow bundleName",
|
||||
abilityName: "[PC Preview] unknow abilityName",
|
||||
message: "[PC Preview] unknow message",
|
||||
}
|
||||
export const CallAbilityParam = {
|
||||
bundleName: "[PC Preview] unknow bundleName",
|
||||
abilityName: "[PC Preview] unknow abilityName",
|
||||
messageCode: "[PC Preview] unknow messageCode",
|
||||
abilityType: "[PC Preview] unknow abilityType",
|
||||
data: "[PC Preview] unknow data",
|
||||
syncOption: "[PC Preview] unknow syncOption",
|
||||
}
|
||||
export const SubscribeAbilityEventParam = {
|
||||
bundleName: "[PC Preview] unknow bundleName",
|
||||
abilityName: "[PC Preview] unknow abilityName",
|
||||
messageCode: "[PC Preview] unknow messageCode",
|
||||
abilityType: "[PC Preview] unknow abilityType",
|
||||
syncOption: "[PC Preview] unknow syncOption",
|
||||
}
|
||||
export const SendMessageOptions = {
|
||||
deviceId: "[PC Preview] unknow deviceId",
|
||||
bundleName: "[PC Preview] unknow bundleName",
|
||||
abilityName: "[PC Preview] unknow abilityName",
|
||||
message: "[PC Preview] unknow message",
|
||||
success: function () {
|
||||
console.warn("SendMessageOptions.success interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
fail: function (...args) {
|
||||
console.warn("SendMessageOptions.fail interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
complete: function () {
|
||||
console.warn("SendMessageOptions.complete interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
}
|
||||
}
|
||||
export const SubscribeMessageOptions = {
|
||||
success: function (...args) {
|
||||
console.warn("SubscribeMessageOptions.success interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
fail: function (...args) {
|
||||
console.warn("SubscribeMessageOptions.fail interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
},
|
||||
}
|
||||
export const RequestParams = {
|
||||
bundleName: "[PC Preview] unknow bundleName",
|
||||
abilityName: "[PC Preview] unknow abilityName",
|
||||
entities: [paramMock.paramStringMock],
|
||||
action: "[PC Preview] unknow action",
|
||||
deviceType: "[PC Preview] unknow deviceType",
|
||||
data: "[PC Preview] unknow data",
|
||||
flag: "[PC Preview] unknow flag",
|
||||
url: "[PC Preview] unknow url",
|
||||
}
|
||||
export const FinishWithResultParams = {
|
||||
code: "[PC Preview] unknow code",
|
||||
result: "[PC Preview] unknow result",
|
||||
}
|
||||
export const FeatureAbilityClass = class FeatureAbility {
|
||||
constructor() {
|
||||
console.warn('FeatureAbility.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.startAbility = function (...args) {
|
||||
console.warn("FeatureAbility.startAbility interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(Result);
|
||||
})
|
||||
};
|
||||
this.startAbilityForResult = function (...args) {
|
||||
console.warn("FeatureAbility.startAbilityForResult interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(Result);
|
||||
})
|
||||
};
|
||||
this.finishWithResult = function (...args) {
|
||||
console.warn("FeatureAbility.finishWithResult interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(Result);
|
||||
})
|
||||
};
|
||||
this.getDeviceList = function (...args) {
|
||||
console.warn("FeatureAbility.getDeviceList interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(Result);
|
||||
})
|
||||
};
|
||||
this.callAbility = function (...args) {
|
||||
console.warn("FeatureAbility.callAbility interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
};
|
||||
this.continueAbility = function () {
|
||||
console.warn("FeatureAbility.continueAbility interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(Result);
|
||||
})
|
||||
};
|
||||
this.subscribeAbilityEvent = function (...args) {
|
||||
console.warn("FeatureAbility.subscribeAbilityEvent interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
};
|
||||
this.unsubscribeAbilityEvent = function (...args) {
|
||||
console.warn("FeatureAbility.unsubscribeAbilityEvent interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
})
|
||||
};
|
||||
this.sendMsg = function (...args) {
|
||||
console.warn("FeatureAbility.sendMsg interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.subscribeMsg = function (...args) {
|
||||
console.warn("FeatureAbility.subscribeMsg interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.unsubscribeMsg = function () {
|
||||
console.warn("FeatureAbility.unsubscribeMsg interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const CommonEventData = {
|
||||
event: '[PC preview] unknow event',
|
||||
bundleName: '[PC preview] unknow bundleName',
|
||||
code: '[PC preview] unknow code',
|
||||
data: '[PC preview] unknow data',
|
||||
parameters: {"key": "unknown any"},
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
|
||||
export const CommonEventPublishData = {
|
||||
bundleName: '[PC preview] unknow bundleName',
|
||||
code: '[PC preview] unknow code',
|
||||
data: '[PC preview] unknow data',
|
||||
subscriberPermissions: [paramMock.paramStringMock],
|
||||
isOrdered: '[PC preview] unknow isOrdered',
|
||||
isSticky: '[PC preview] unknow isSticky',
|
||||
parameters: {"key": "unknown any"},
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
|
||||
export const CommonEventSubscribeInfo = {
|
||||
events: [paramMock.paramStringMock],
|
||||
publisherPermission: '[PC preview] unknow publisherPermission',
|
||||
publisherDeviceId: '[PC preview] unknow publisherDeviceId',
|
||||
userId: '[PC preview] unknow userId',
|
||||
priority: '[PC preview] unknow priority'
|
||||
}
|
@ -1,163 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
import { CommonEventSubscribeInfo } from "./commonEventSubscribeInfo"
|
||||
|
||||
export const CommonEventSubscriber = {
|
||||
getCode: function (...args) {
|
||||
console.warn('CommonEventSubscriber.getCode 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.paramNumberMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
setCode: function (...args) {
|
||||
console.warn('CommonEventSubscriber.setCode 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();
|
||||
});
|
||||
}
|
||||
},
|
||||
getData: function (...args) {
|
||||
console.warn('CommonEventSubscriber.getData 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.paramStringMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramStringMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
setData: function (...args) {
|
||||
console.warn('CommonEventSubscriber.setData 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();
|
||||
});
|
||||
}
|
||||
},
|
||||
setCodeAndData: function (...args) {
|
||||
console.warn('CommonEventSubscriber.setCodeAndData 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();
|
||||
});
|
||||
}
|
||||
},
|
||||
isOrderedCommonEvent: function (...args) {
|
||||
console.warn('CommonEventSubscriber.isOrderedCommonEvent 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);
|
||||
});
|
||||
}
|
||||
},
|
||||
isStickyCommonEvent: function (...args) {
|
||||
console.warn('CommonEventSubscriber.isStickyCommonEvent 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);
|
||||
});
|
||||
}
|
||||
},
|
||||
abortCommonEvent: function (...args) {
|
||||
console.warn('CommonEventSubscriber.abortCommonEvent 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();
|
||||
});
|
||||
}
|
||||
},
|
||||
clearAbortCommonEvent: function (...args) {
|
||||
console.warn('CommonEventSubscriber.clearAbortCommonEvent 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();
|
||||
});
|
||||
}
|
||||
},
|
||||
getAbortCommonEvent: function (...args) {
|
||||
console.warn('CommonEventSubscriber.getAbortCommonEvent 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);
|
||||
});
|
||||
}
|
||||
},
|
||||
getSubscribeInfo: function (...args) {
|
||||
console.warn('CommonEventSubscriber.getSubscribeInfo 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, CommonEventSubscribeInfo);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(CommonEventSubscribeInfo);
|
||||
});
|
||||
}
|
||||
},
|
||||
finishCommonEvent: function (...args) {
|
||||
console.warn('CommonEventSubscriber.finishCommonEvent 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, reject) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
const ContinuationMode = {
|
||||
COLLABORATION_SINGLE: 0,
|
||||
COLLABORATION_MULTIPLE: 1
|
||||
}
|
||||
export const ContinuationExtraParams = {
|
||||
deviceType: [paramMock.paramStringMock],
|
||||
targetBundle: "[PC Preview] unknow targetBundle",
|
||||
description: "[PC Preview] unknow description",
|
||||
filter: "[PC Preview] unknow filter",
|
||||
continuationMode: ContinuationMode,
|
||||
authInfo: {"key":"unknow any"}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export const ContinuationResult = {
|
||||
id: "[PC Preview] unknow id",
|
||||
type: "[PC Preview] unknow type",
|
||||
name: "[PC Preview] unknow name",
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../../utils"
|
||||
|
||||
export const resultSet = {
|
||||
columnNames: [paramMock.paramStringMock],
|
||||
columnCount: "[PC Preview] unknow columnCount",
|
||||
rowCount: "[PC Preview] unknow rowCount",
|
||||
rowIndex: "[PC Preview] unknow rowIndex",
|
||||
isAtFirstRow: "[PC Preview] unknow isAtFirstRow",
|
||||
isAtLastRow: "[PC Preview] unknow isAtLastRow",
|
||||
isEnded: "[PC Preview] unknow isEnded",
|
||||
isStarted: "[PC Preview] unknow isStarted",
|
||||
isClosed: "[PC Preview] unknow isClosed",
|
||||
getColumnIndex: function (...args) {
|
||||
console.warn("ResultSet.getColumnIndex interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
},
|
||||
getColumnName: function (...args) {
|
||||
console.warn("ResultSet.getColumnName interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramStringMock;
|
||||
},
|
||||
goTo: function (...args) {
|
||||
console.warn("ResultSet.goTo interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
goToRow: function (...args) {
|
||||
console.warn("ResultSet.goToRow interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
goToFirstRow: function (...args) {
|
||||
console.warn("ResultSet.goToFirstRow interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
goToLastRow: function (...args) {
|
||||
console.warn("ResultSet.goToLastRow interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
goToNextRow: function (...args) {
|
||||
console.warn("ResultSet.goToNextRow interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
goToPreviousRow: function (...args) {
|
||||
console.warn("ResultSet.goToPreviousRow interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
getBlob: function (...args) {
|
||||
console.warn("ResultSet.getBlob interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramObjectMock;
|
||||
},
|
||||
getString: function (...args) {
|
||||
console.warn("ResultSet.getString interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramStringMock;
|
||||
},
|
||||
getLong: function (...args) {
|
||||
console.warn("ResultSet.getLong interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
},
|
||||
getDouble: function (...args) {
|
||||
console.warn("ResultSet.getDouble interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
},
|
||||
isColumnNull: function (...args) {
|
||||
console.warn("ResultSet.isColumnNull interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
close: function (...args) {
|
||||
console.warn("ResultSet.close interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
},
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const RawFileDescriptor = {
|
||||
fd : '[PC Preview] unknow number',
|
||||
offset : '[PC Preview] unknow number',
|
||||
length : '[PC Preview] unknow number'
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const Resource = {
|
||||
bundleName : '[PC Preview] unknow string',
|
||||
moduleName : '[PC Preview] unknow string',
|
||||
id : '[PC Preview] unknow number'
|
||||
}
|
@ -1,563 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { mockSystemParameter } from './ohos_systemparameter'
|
||||
import { mockSystemCapability } from './ohos_systemCapability'
|
||||
import { mockAbility } from './ohos_application_Ability'
|
||||
import { mockErrorCode } from './ohos_ability_errorCode'
|
||||
import { mockFeatureAbility } from './ohos_ability_featureAbility'
|
||||
import { mockDataUriUtils } from './ohos_ability_dataUriUtils'
|
||||
import { mockWantConstant } from './ohos_ability_wantConstant'
|
||||
import { mockAbilityConstant } from './ohos_application_AbilityConstant'
|
||||
import { mockAbilityDelegatorRegistry } from './ohos_application_abilityDelegatorRegistry'
|
||||
import { mockAbilityLifecycleCallback } from './ohos_application_AbilityLifecycleCallback'
|
||||
import { mockFormExtension } from './ohos_application_FormExtension'
|
||||
import { mockStaticSubscriberExtensionAbility } from './ohos_application_StaticSubscriberExtensionAbility'
|
||||
import { mockFormHost } from './ohos_application_formHost'
|
||||
import { mockFormInfo } from './ohos_application_formInfo'
|
||||
import { mockErrorManager } from './ohos_application_errorManager'
|
||||
import { mockQuickFixManager } from './ohos_application_quickFixManager'
|
||||
import { mockTestRunner } from './ohos_application_testRunner'
|
||||
import { mockWant } from './ohos_application_Want'
|
||||
import { mockServiceExtensionAbility } from './ohos_application_ServiceExtensionAbility'
|
||||
import { mockStartOptions } from './ohos_application_StartOptions'
|
||||
import { mockAbilityStage } from './ohos_application_AbilityStage'
|
||||
import { mockFormBindingData } from './ohos_application_formBindingData'
|
||||
import { mockFormError } from './ohos_application_formError'
|
||||
import { mockAbilityManager } from './ohos_application_abilityManager'
|
||||
import { mockParticleAbility } from './ohos_ability_particleAbility'
|
||||
import { mockAppManager } from './ohos_application_appManager'
|
||||
import { mockConfiguration } from './ohos_application_Configuration'
|
||||
import { mockConfigurationConstant } from './ohos_application_ConfigurationConstant'
|
||||
import { mockContext } from './ohos_application_context'
|
||||
import { mockDataShareExtensionAbility } from './ohos_application_DataShareExtensionAbility'
|
||||
import { mockEnvironmentCallback } from './ohos_application_EnvironmentCallback'
|
||||
import { mockMissionManager } from "./ohos_application_missionManager"
|
||||
import { mockUriPermissionManager } from "./ohos_application_uriPermissionManager"
|
||||
import { mockCommonEvent } from './ohos_commonEvent'
|
||||
import { mockNotification } from './ohos_notification'
|
||||
import { mockFileio } from './ohos_fileio'
|
||||
import { mockWorker } from './ohos_worker'
|
||||
import { mockUtil } from './ohos_util'
|
||||
import { mockPower } from './ohos_power'
|
||||
import { mockRunninglock } from './ohos_runninglock'
|
||||
import { mockThermal } from './ohos_thermal'
|
||||
import { mockBatteryStatistics } from './ohos_batteryStatistics'
|
||||
import { mockIntl } from './ohos_intl'
|
||||
import { mockI18N } from './ohos_i18n'
|
||||
import { mockRpc } from './ohos_rpc'
|
||||
import { mockProcess } from './ohos_process'
|
||||
import { mockUrl } from './ohos_url'
|
||||
import { mockHiAppEvent } from './ohos_hiAppEvent'
|
||||
import { mockHiChecker } from './ohos_hichecker'
|
||||
import { mockHiSysEvent } from './ohos_hiSysEvent'
|
||||
import { mockHiTraceChain } from './ohos_hiTraceChain'
|
||||
import { mockHiTraceMeter } from './ohos_hiTraceMeter'
|
||||
import { mockHidebug } from './ohos_hidebug'
|
||||
import { mockFaultLogger } from './ohos_faultLogger'
|
||||
import { mockTv } from './tv'
|
||||
import { mockDtv } from './dtv'
|
||||
import { mockDistributedAccount } from './ohos_account_distributedAccount'
|
||||
import { mockEmitter } from './ohos_events_emitter'
|
||||
import { mockDistributedObject } from './ohos_data_distributedDataObject'
|
||||
import { mockDataAbility } from './ohos_data_dataAbility'
|
||||
import { mockStorage } from './system_storage'
|
||||
import { mockDataShare } from './ohos_data_dataShare'
|
||||
import { mockDataSharePredicates } from './ohos_data_dataSharePredicates'
|
||||
import { DataShareResultSet } from './ohos_data_DataShareResultSet'
|
||||
import { mockInputDevice } from './ohos_multimodalInput_inputDevice'
|
||||
import { mockVibrator } from './ohos_vibrator'
|
||||
import { mockSensor } from './ohos_sensor'
|
||||
import { mockWifi } from './ohos_wifi'
|
||||
import { mockWifiExt } from './ohos_wifiext'
|
||||
import { mockUsb } from './ohos_usb'
|
||||
import { mockBundle } from './ohos_bundle'
|
||||
import { mockInnerBundle } from './ohos_bundle_innerBundleManager'
|
||||
import { mockUri } from './ohos_uri'
|
||||
import { mockXml } from './ohos_xml'
|
||||
import { mockConvertXml } from './ohos_convertxml'
|
||||
import { mockStatfs } from './ohos_statfs'
|
||||
import { mockFileManager } from "./ohos_fileManager"
|
||||
import { mockEnvironment } from "./ohos_environment"
|
||||
import { mockStorageStatistics } from "./ohos_storageStatistics"
|
||||
import { mockVolumeManager } from "./ohos_volumeManager"
|
||||
import { mockSettings } from './ohos_settings'
|
||||
import { mockAbilityAccessCtrl } from './ohos_abilityAccessCtrl'
|
||||
import { mockConfigPolicy } from './ohos_configPolicy'
|
||||
import { mockUpdate } from './ohos_update'
|
||||
import { mockBackgroundTaskManager } from './ohos_backgroundTaskManager'
|
||||
import { mockBundleState } from './ohos_bundleState'
|
||||
import { mockSecurityLabel } from './ohos_securitylabel'
|
||||
import { mockWorkScheduler } from './ohos_workScheduler'
|
||||
import { mockWorkSchedulerExtensionAbility } from './ohos_WorkSchedulerExtensionAbility'
|
||||
import { mockUserAuth } from './ohos_userIAM_userAuth'
|
||||
import { mockFaceAuth } from './ohos_userIAM_faceAuth'
|
||||
import { mockArrayList } from './ohos_util_Arraylist'
|
||||
import { mockDeque } from './ohos_util_Deque'
|
||||
import { mockHashMap } from './ohos_util_HashMap'
|
||||
import { mockHashSet } from './ohos_util_HashSet'
|
||||
import { mockLightWeightMap } from './ohos_util_LightWeightMap'
|
||||
import { mockLightWeightSet } from './ohos_util_LightWeightSet'
|
||||
import { mockLinkedList } from './ohos_util_LinkedList'
|
||||
import { mockList } from './ohos_util_List'
|
||||
import { mockPlainArray } from './ohos_util_PlainArray'
|
||||
import { mockQueue } from './ohos_util_Queue'
|
||||
import { mockStack } from './ohos_util_Stack'
|
||||
import { mockTreeMap } from './ohos_util_TreeMap'
|
||||
import { mockTreeSet } from './ohos_util_TreeSet'
|
||||
import { mockVector } from './ohos_util_Vector'
|
||||
import { mockMultimediaAVSession } from './ohos_multimedia_av_session'
|
||||
import { mockMultimediaCamera } from './ohos_multimedia_camera'
|
||||
import { mockMultimediaAudio } from './ohos_multimedia_audio'
|
||||
import { mockMultimediaImage } from './ohos_multimedia_image'
|
||||
import { mockMultimediaMedia } from './ohos_multimedia_media'
|
||||
import { mockMultimediaMediaLibrary } from './ohos_multimedia_mediaLibrary'
|
||||
import { mockBatteryinfo } from './ohos_batteryInfo'
|
||||
import { mockBluetooth } from './ohos_bluetooth'
|
||||
import { mockBrightness } from './ohos_brightness'
|
||||
import { mockBytrace } from './ohos_bytrace'
|
||||
import { mockCipher } from './system_cipher'
|
||||
import { mockContact } from './ohos_contact'
|
||||
import { mockDataStorage } from './ohos_data_Storage'
|
||||
import { mockDeviceInfo } from './ohos_deviceInfo'
|
||||
import { mockDeviceManager } from './ohos_distributedHardware_deviceManager'
|
||||
import { mockDistributedMissionManager } from "./ohos_distributedMissionManager"
|
||||
import { mockDisplay } from './ohos_display'
|
||||
import { mockCryptoFramework } from './ohos_security_cryptoFramework'
|
||||
import { mockHuks } from './ohos_security_huks'
|
||||
import { mockInputMethod } from './ohos_inputmethod'
|
||||
import { mockInputMethodEngine } from './ohos_inputmethodengine'
|
||||
import { mockInputMethodExtensionAbility } from "./ohos_inputmethodextensionability";
|
||||
import { mockConnection } from './ohos_net_connection'
|
||||
import { mockHttp } from './ohos_net_http'
|
||||
import { mockSocket } from './ohos_net_socket'
|
||||
import { mockWebSocket } from './ohos_net_webSocket'
|
||||
import { mockNetwork } from './ohos_network'
|
||||
import { mockNfcCardEmulation } from './ohos_nfc_cardEmulation'
|
||||
import { mockController } from './ohos_nfc_controller'
|
||||
import { mockTag } from './ohos_nfc_tag'
|
||||
import { mockPasteBoard } from './ohos_pasteboard'
|
||||
import { mockRequest } from './ohos_request'
|
||||
import { mockScreenLock } from './ohos_screenLock'
|
||||
import { mockCall } from './ohos_telephony_call'
|
||||
import { mockData } from './ohos_telephony_data'
|
||||
import { mockObserver } from './ohos_telephony_observer'
|
||||
import { mockRadio } from './ohos_telephony_radio'
|
||||
import { mockSim } from './ohos_telephony_sim'
|
||||
import { mockSMS } from './ohos_telephony_sms'
|
||||
import { mockWindow } from './ohos_window'
|
||||
import { mockAppAccount } from './ohos_account_appAccount'
|
||||
import { mockOhosGeolocation } from './ohos_geolocation'
|
||||
import { mockInputMonitor } from './ohos_multimodalInput_inputMonitor'
|
||||
import { mockPointer } from './ohos_multimodalInput_pointer'
|
||||
import { mockOsAccount } from './ohos_account_osAccount'
|
||||
import { mockReminderAgent } from './ohos_reminderAgent'
|
||||
import { mockSystemTime } from './ohos_systemTime'
|
||||
import { mockSystemTimer } from './ohos_systemTimer'
|
||||
import { mockWallpaper } from './ohos_wallpaper'
|
||||
import { mockWantAgent } from './ohos_wantAgent'
|
||||
import { mockScreenshot } from './ohos_screenshot'
|
||||
import { mockZlib } from './ohos_zlib'
|
||||
import { mockPrivacyManager } from './ohos_privacyManager'
|
||||
import { mockFormProvider } from './ohos_application_formProvider'
|
||||
import { mockScreen } from './ohos_screen'
|
||||
import { mockDistributedBundle } from './ohos_distributedBundle'
|
||||
import { mockInputConsumer } from './ohos_multimodalInput_inputConsumer'
|
||||
import { mockDocument } from './ohos_document'
|
||||
import { mockResourceManager } from './ohos_resourceManager'
|
||||
import { mockFile } from './system_file'
|
||||
import { mockEnterpriseDeviceManager } from './ohos_enterpriseDeviceManager'
|
||||
import { mockEnterpriseAdminExtensionAbility } from './ohos_EnterpriseAdminExtensionAbility'
|
||||
import { mockKeyCode } from './ohos_multimodalInput_keyCode'
|
||||
import { mockInputEventClient } from './ohos_multimodalInput_inputEventClient'
|
||||
import { mockDefaultAppManager } from './ohos_bundle_defaultAppManager'
|
||||
import { mockKeyEvent } from './ohos_multimodalInput_keyEvent'
|
||||
import { mockMouseEvent } from './ohos_multimodalInput_mouseEvent'
|
||||
import { mockTouchEvent } from './ohos_multimodalInput_touchEvent'
|
||||
import { mockContinationManager } from './ohos_continuation_continuationManager'
|
||||
import { mockUiTest } from './ohos_uitest'
|
||||
import { mockBuffer } from './ohos_buffer'
|
||||
import { mockWindowAnimationManager } from './ohos_animation_windowAnimationManager'
|
||||
import { mockAccessibility } from './ohos_accessibility'
|
||||
import { mockAccessibilityConfig } from './ohos_accessibility_config'
|
||||
import { mockAccessibilityExtensionAbility } from './ohos_application_AccessibilityExtensionAbility'
|
||||
export function mockRequireNapiFun() {
|
||||
global.requireNapi = function (...args) {
|
||||
switch (args[0]) {
|
||||
case "file":
|
||||
return mockFile();
|
||||
case "resourceManager":
|
||||
return mockResourceManager();
|
||||
case "document":
|
||||
return mockDocument();
|
||||
case "screen":
|
||||
return mockScreen();
|
||||
case "zlib":
|
||||
return mockZlib();
|
||||
case "screenshot":
|
||||
return mockScreenshot();
|
||||
case "wantAgent":
|
||||
return mockWantAgent();
|
||||
case "wallpaper":
|
||||
return mockWallpaper();
|
||||
case "systemTimer":
|
||||
return mockSystemTimer();
|
||||
case "systemTime":
|
||||
return mockSystemTime();
|
||||
case "reminderAgent":
|
||||
return mockReminderAgent();
|
||||
case "account.osAccount":
|
||||
return mockOsAccount();
|
||||
case "multimodalInput.inputMonitor":
|
||||
return mockInputMonitor();
|
||||
case "geolocation":
|
||||
return mockOhosGeolocation();
|
||||
case "account.appAccount":
|
||||
return mockAppAccount();
|
||||
case "window":
|
||||
return mockWindow();
|
||||
case "telephony.call":
|
||||
return mockCall();
|
||||
case "telephony.data":
|
||||
return mockData();
|
||||
case "telephony.observer":
|
||||
return mockObserver();
|
||||
case "telephony.radio":
|
||||
return mockRadio();
|
||||
case "telephony.sim":
|
||||
return mockSim();
|
||||
case "telephony.sms":
|
||||
return mockSMS();
|
||||
case "pasteboard":
|
||||
return mockPasteBoard();
|
||||
case "request":
|
||||
return mockRequest();
|
||||
case "screenLock":
|
||||
return mockScreenLock();
|
||||
case "nfc.cardEmulation":
|
||||
return mockNfcCardEmulation();
|
||||
case "nfc.controller":
|
||||
return mockController();
|
||||
case "nfc.tag":
|
||||
return mockTag();
|
||||
case "network":
|
||||
return mockNetwork();
|
||||
case "net.connection":
|
||||
return mockConnection();
|
||||
case "net.http":
|
||||
return mockHttp();
|
||||
case "net.socket":
|
||||
return mockSocket();
|
||||
case "net.webSocket":
|
||||
return mockWebSocket();
|
||||
case "inputmethodengine":
|
||||
return mockInputMethodEngine();
|
||||
case "inputmethod":
|
||||
return mockInputMethod();
|
||||
case "inputmethodextensionability":
|
||||
return mockInputMethodExtensionAbility();
|
||||
case "security.cryptoFramework":
|
||||
return mockCryptoFramework();
|
||||
case "security.huks":
|
||||
return mockHuks();
|
||||
case "display":
|
||||
return mockDisplay();
|
||||
case "distributedHardware.deviceManager":
|
||||
return mockDeviceManager();
|
||||
case "distributedMissionManager":
|
||||
return mockDistributedMissionManager();
|
||||
case "deviceInfo":
|
||||
return mockDeviceInfo();
|
||||
case "data.storage":
|
||||
return mockDataStorage();
|
||||
case "contact":
|
||||
return mockContact();
|
||||
case "cipher":
|
||||
return mockCipher();
|
||||
case "bytrace":
|
||||
return mockBytrace();
|
||||
case "brightness":
|
||||
return mockBrightness();
|
||||
case "bluetooth":
|
||||
return mockBluetooth();
|
||||
case "batteryinfo":
|
||||
return mockBatteryinfo();
|
||||
case "systemCapability":
|
||||
return mockSystemCapability();
|
||||
case "systemParameter":
|
||||
return mockSystemParameter();
|
||||
case "ability.errorCode":
|
||||
return mockErrorCode();
|
||||
case "ability.dataUriUtils":
|
||||
return mockDataUriUtils();
|
||||
case "ability.particleAbility":
|
||||
return mockParticleAbility();
|
||||
case "ability.featureAbility":
|
||||
return mockFeatureAbility();
|
||||
case "ability.wantConstant":
|
||||
return mockWantConstant();
|
||||
case "application.Ability":
|
||||
return mockAbility();
|
||||
case "application.formHost":
|
||||
return mockFormHost();
|
||||
case "application.formInfo":
|
||||
return mockFormInfo();
|
||||
case "application.FormExtension":
|
||||
return mockFormExtension();
|
||||
case "application.ServiceExtensionAbility":
|
||||
return mockServiceExtensionAbility();
|
||||
case "application.StartOptions":
|
||||
return mockStartOptions();
|
||||
case "application.StaticSubscriberExtensionAbility":
|
||||
return mockStaticSubscriberExtensionAbility()
|
||||
case "application.errorManager":
|
||||
return mockErrorManager();
|
||||
case "application.testRunner":
|
||||
return mockTestRunner();
|
||||
case "application.Want":
|
||||
return mockWant();
|
||||
case "application.AbilityConstant":
|
||||
return mockAbilityConstant();
|
||||
case "application.abilityDelegatorRegistry":
|
||||
return mockAbilityDelegatorRegistry();
|
||||
case "application.AbilityLifecycleCallback":
|
||||
return mockAbilityLifecycleCallback();
|
||||
case "application.AbilityStage":
|
||||
return mockAbilityStage();
|
||||
case "application.formBindingData":
|
||||
return mockFormBindingData();
|
||||
case "application.formError":
|
||||
return mockFormError();
|
||||
case "application.abilityManager":
|
||||
return mockAbilityManager();
|
||||
case "application.appManager":
|
||||
return mockAppManager();
|
||||
case "application.Configuration":
|
||||
return mockConfiguration();
|
||||
case "application.quickFixManager":
|
||||
return mockQuickFixManager();
|
||||
case "application.ConfigurationConstant":
|
||||
return mockConfigurationConstant();
|
||||
case "application.context":
|
||||
return mockContext();
|
||||
case "application.DataShareExtensionAbility":
|
||||
return mockDataShareExtensionAbility();
|
||||
case "application.EnvironmentCallback":
|
||||
return mockEnvironmentCallback();
|
||||
case "application.missionManager":
|
||||
return mockMissionManager();
|
||||
case "application.UriPermissionManager":
|
||||
return mockUriPermissionManager();
|
||||
case "commonEvent":
|
||||
return mockCommonEvent();
|
||||
case "notification":
|
||||
return mockNotification();
|
||||
case "fileio":
|
||||
return mockFileio();
|
||||
case "worker":
|
||||
return mockWorker();
|
||||
case "util":
|
||||
return mockUtil();
|
||||
case "intl":
|
||||
return mockIntl();
|
||||
case "i18n":
|
||||
return mockI18N();
|
||||
case "power":
|
||||
return mockPower();
|
||||
case "runninglock":
|
||||
return mockRunninglock();
|
||||
case "thermal":
|
||||
return mockThermal();
|
||||
case "batteryStatistics":
|
||||
return mockBatteryStatistics();
|
||||
case "rpc":
|
||||
return mockRpc();
|
||||
case "process":
|
||||
return mockProcess();
|
||||
case "url":
|
||||
return mockUrl();
|
||||
case "hichecker":
|
||||
return mockHiChecker();
|
||||
case "hiAppEvent":
|
||||
return mockHiAppEvent();
|
||||
case "hiSysEvent":
|
||||
return mockHiSysEvent();
|
||||
case "hidebug":
|
||||
return mockHidebug();
|
||||
case "hiTraceChain":
|
||||
return mockHiTraceChain();
|
||||
case "hiTraceMeter":
|
||||
return mockHiTraceMeter();
|
||||
case "faultLogger":
|
||||
return mockFaultLogger();
|
||||
case "tv":
|
||||
return mockTv();
|
||||
case "dtv":
|
||||
return mockDtv();
|
||||
case "account.distributedAccount":
|
||||
return mockDistributedAccount();
|
||||
case "events.emitter":
|
||||
return mockEmitter();
|
||||
case "data.distributedDataObject":
|
||||
return mockDistributedObject();
|
||||
case "data.storage":
|
||||
return mockStorage();
|
||||
case "data.dataShare":
|
||||
return mockDataShare();
|
||||
case "data.dataSharePredicates":
|
||||
return mockDataSharePredicates();
|
||||
case "data.DataShareResultSet":
|
||||
return DataShareResultSet();
|
||||
case "data.dataAbility":
|
||||
return mockDataAbility();
|
||||
case "multimodalInput.inputDevice":
|
||||
return mockInputDevice();
|
||||
case "multimodalInput.pointer":
|
||||
return mockPointer();
|
||||
case "vibrator":
|
||||
return mockVibrator();
|
||||
case "sensor":
|
||||
return mockSensor();
|
||||
case "wifi":
|
||||
return mockWifi();
|
||||
case "wifiext":
|
||||
return mockWifiExt();
|
||||
case "usb":
|
||||
return mockUsb();
|
||||
case "bundle":
|
||||
return mockBundle();
|
||||
case "distributedBundle":
|
||||
return mockDistributedBundle();
|
||||
case "bundle.innerBundleManager":
|
||||
return mockInnerBundle();
|
||||
case "bundle.defaultAppManager":
|
||||
return mockDefaultAppManager();
|
||||
case "uri":
|
||||
return mockUri();
|
||||
case "xml":
|
||||
return mockXml();
|
||||
case "convertxml":
|
||||
return mockConvertXml();
|
||||
case "statfs":
|
||||
return mockStatfs();
|
||||
case "fileManager":
|
||||
return mockFileManager();
|
||||
case "environment":
|
||||
return mockEnvironment();
|
||||
case "storageStatistics":
|
||||
return mockStorageStatistics();
|
||||
case "volumeManager":
|
||||
return mockVolumeManager();
|
||||
case "settings":
|
||||
return mockSettings();
|
||||
case "abilityAccessCtrl":
|
||||
return mockAbilityAccessCtrl();
|
||||
case "configPolicy":
|
||||
return mockConfigPolicy();
|
||||
case "update":
|
||||
return mockUpdate();
|
||||
case "backgroundTaskManager":
|
||||
return mockBackgroundTaskManager();
|
||||
case "bundleState":
|
||||
return mockBundleState();
|
||||
case "securityLabel":
|
||||
return mockSecurityLabel();
|
||||
case "workScheduler":
|
||||
return mockWorkScheduler();
|
||||
case "WorkSchedulerExtensionAbility":
|
||||
return mockWorkSchedulerExtensionAbility();
|
||||
case "userIAM.userAuth":
|
||||
return mockUserAuth();
|
||||
case "userIAM.faceAuth":
|
||||
return mockFaceAuth();
|
||||
case "util.ArrayList":
|
||||
return mockArrayList();
|
||||
case "util.Deque":
|
||||
return mockDeque();
|
||||
case "util.HashMap":
|
||||
return mockHashMap();
|
||||
case "util.HashSet":
|
||||
return mockHashSet();
|
||||
case "util.LightWeightMap":
|
||||
return mockLightWeightMap();
|
||||
case "util.LightWeightSet":
|
||||
return mockLightWeightSet();
|
||||
case "util.LinkedList":
|
||||
return mockLinkedList();
|
||||
case "util.List":
|
||||
return mockList();
|
||||
case "util.PlainArray":
|
||||
return mockPlainArray();
|
||||
case "util.Queue":
|
||||
return mockQueue();
|
||||
case "util.Stack":
|
||||
return mockStack();
|
||||
case "util.TreeMap":
|
||||
return mockTreeMap();
|
||||
case "util.TreeSet":
|
||||
return mockTreeSet();
|
||||
case "util.Vector":
|
||||
return mockVector();
|
||||
case "multimedia.mediaLibrary":
|
||||
return mockMultimediaMediaLibrary();
|
||||
case "multimedia.media":
|
||||
return mockMultimediaMedia();
|
||||
case "multimedia.image":
|
||||
return mockMultimediaImage();
|
||||
case "multimedia.avsession":
|
||||
return mockMultimediaAVSession();
|
||||
case "multimedia.camera":
|
||||
return mockMultimediaCamera();
|
||||
case "multimedia.audio":
|
||||
return mockMultimediaAudio();
|
||||
case "privacyManager":
|
||||
return mockPrivacyManager();
|
||||
case "application.formProvider":
|
||||
return mockFormProvider();
|
||||
case "multimodalInput.inputConsumer":
|
||||
return mockInputConsumer();
|
||||
case "enterpriseDeviceManager":
|
||||
return mockEnterpriseDeviceManager();
|
||||
case "EnterpriseAdminExtensionAbility":
|
||||
return mockEnterpriseAdminExtensionAbility();
|
||||
case "multimodalInput.keyCode":
|
||||
return mockKeyCode();
|
||||
case "multimodalInput.inputEventClient":
|
||||
return mockInputEventClient();
|
||||
case "multimodalInput.keyEvent":
|
||||
return mockKeyEvent();
|
||||
case "multimodalInput.mouseEvent":
|
||||
return mockMouseEvent();
|
||||
case "multimodalInput.touchEvent":
|
||||
return mockTouchEvent();
|
||||
case "accessibility":
|
||||
return mockAccessibility();
|
||||
case "accessibility.config":
|
||||
return mockAccessibilityConfig();
|
||||
case "application.AccessibilityExtensionAbility":
|
||||
return mockAccessibilityExtensionAbility();
|
||||
case "continuation.continuationManager":
|
||||
return mockContinationManager();
|
||||
case "uitest":
|
||||
return mockUiTest();
|
||||
case "buffer":
|
||||
return mockBuffer();
|
||||
case "animation.windowAnimationManager":
|
||||
return mockWindowAnimationManager();
|
||||
default:
|
||||
return global.requireNapiPreview(...args);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { NotificationUserInput } from "./notificationUserInput"
|
||||
|
||||
export const NotificationActionButton = {
|
||||
title: '[PC preview] unknow title',
|
||||
wantAgent: '[PC preview] unknow wantAgent',
|
||||
extras: {"key": "unknown any"},
|
||||
userInput: NotificationUserInput,
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
import { ContentType } from "../ohos_notification"
|
||||
import { PixelMapMock } from "../ohos_multimedia_image"
|
||||
|
||||
export const NotificationBasicContent = {
|
||||
title: '[PC preview] unknow title',
|
||||
text: '[PC preview] unknow text',
|
||||
additionalText: '[PC preview] unknow additionalText',
|
||||
}
|
||||
export const NotificationLongTextContent = {
|
||||
longText: '[PC preview] unknow longText',
|
||||
briefText: '[PC preview] unknow briefText',
|
||||
expandedTitle: '[PC preview] unknow expandedTitle',
|
||||
}
|
||||
export const NotificationMultiLineContent = {
|
||||
briefText: '[PC preview] unknow briefText',
|
||||
longTitle: '[PC preview] unknow longTitle',
|
||||
lines: [paramMock.paramStringMock],
|
||||
}
|
||||
export const NotificationPictureContent = {
|
||||
briefText: '[PC preview] unknow briefText',
|
||||
expandedTitle: '[PC preview] unknow expandedTitle',
|
||||
picture: PixelMapMock,
|
||||
}
|
||||
export const NotificationContent = {
|
||||
contentType: ContentType,
|
||||
normal: NotificationBasicContent,
|
||||
longText: NotificationLongTextContent,
|
||||
multiLine: NotificationMultiLineContent,
|
||||
picture: NotificationPictureContent,
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export const NotificationFlagStatus = {
|
||||
TYPE_NONE: 0,
|
||||
TYPE_OPEN: 1,
|
||||
TYPE_CLOSE: 2,
|
||||
}
|
||||
export const NotificationFlags = {
|
||||
soundEnabled: NotificationFlagStatus,
|
||||
vibrationEnabled: NotificationFlagStatus,
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
import { SlotType } from "../ohos_notification"
|
||||
import { NotificationActionButton } from "./notificationActionButton"
|
||||
import { PixelMapMock } from "../ohos_multimedia_image"
|
||||
import { NotificationTemplate } from "./notificationTemplate"
|
||||
import { NotificationFlags } from "./notificationFlags"
|
||||
import { NotificationContent } from "./notificationContent"
|
||||
|
||||
export const NotificationRequest = {
|
||||
content: NotificationContent,
|
||||
id: '[PC preview] unknow id',
|
||||
slotType: SlotType,
|
||||
isOngoing: '[PC preview] unknow isOngoing',
|
||||
isUnremovable: '[PC preview] unknow isUnremovable',
|
||||
deliveryTime: '[PC preview] unknow deliveryTime',
|
||||
tapDismissed: '[PC preview] unknow tapDismissed',
|
||||
autoDeletedTime: '[PC preview] unknow autoDeletedTime',
|
||||
wantAgent: '[PC preview] unknow wantAgent',
|
||||
extraInfo: {"key": "unknown any"},
|
||||
color: '[PC preview] unknow color',
|
||||
colorEnabled: '[PC preview] unknow colorEnabled',
|
||||
isAlertOnce: '[PC preview] unknow isAlertOnce',
|
||||
isStopwatch: '[PC preview] unknow isStopwatch',
|
||||
isCountDown: '[PC preview] unknow isCountDown',
|
||||
isFloatingIcon: '[PC preview] unknow isFloatingIcon',
|
||||
label: '[PC preview] unknow label',
|
||||
badgeIconStyle: '[PC preview] unknow badgeIconStyle',
|
||||
showDeliveryTime: '[PC preview] unknow showDeliveryTime',
|
||||
actionButtons: [NotificationActionButton],
|
||||
smallIcon: PixelMapMock,
|
||||
largeIcon: PixelMapMock,
|
||||
groupName: '[PC preview] unknow groupName',
|
||||
creatorBundleName: '[PC preview] unknow creatorBundleName',
|
||||
creatorUid: '[PC preview] unknow creatorUid',
|
||||
creatorPid: '[PC preview] unknow creatorPid',
|
||||
creatorUserId: '[PC preview] unknow creatorUserId',
|
||||
classification: '[PC preview] unknow classification',
|
||||
hashCode: '[PC preview] unknow hashCode',
|
||||
isRemoveAllowed: '[PC preview] unknow isRemveAllowd',
|
||||
source: '[PC preview] unknow source',
|
||||
template: NotificationTemplate,
|
||||
distributedOption: DistributedOptions,
|
||||
deviceId: '[PC preview] unknow deviceId',
|
||||
notificationFlags: NotificationFlags,
|
||||
removalWantAgent: '[PC preview] unknow removalWantAgent',
|
||||
badgeNumber: '[PC preview] unknow badgeNumber',
|
||||
}
|
||||
export const DistributedOptions = {
|
||||
isDistributed: '[PC preview] unknow isDistributed',
|
||||
supportDisplayDevices: [paramMock.paramStringMock],
|
||||
supportOperateDevices: [paramMock.paramStringMock],
|
||||
remindType: '[PC preview] unknow remindType',
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
import { SlotType, SlotLevel } from "../ohos_notification"
|
||||
|
||||
export const NotificationSlot = {
|
||||
type: SlotType,
|
||||
level: SlotLevel,
|
||||
desc: '[PC preview] unknow desc',
|
||||
badgeFlag: '[PC preview] unknow badgeFlag',
|
||||
bypassDnd: '[PC preview] unknow bypassDnd',
|
||||
lockscreenVisibility: '[PC preview] unknow lockscreenVisibility',
|
||||
vibrationEnabled: '[PC preview] unknow vibrationEnabled',
|
||||
sound: '[PC preview] unknow sound',
|
||||
lightEnabled: '[PC preview] unknow lightEnabled',
|
||||
lightColor: '[PC preview] unknow lightColor',
|
||||
vibrationValues: [paramMock.paramNumberMock],
|
||||
enabled: '[PC preview] unknow enabled',
|
||||
};
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { NotificationSlot } from "./notificationSlot"
|
||||
|
||||
export const NotificationSorting = {
|
||||
slot: NotificationSlot,
|
||||
hashCode: '[PC preview] unknow hashCode',
|
||||
ranking: '[PC preview] unknow ranking',
|
||||
};
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
|
||||
export const NotificationSortingMap = {
|
||||
sortings: {"key": "unknown any"},
|
||||
sortedHashCode: [paramMock.paramStringMock],
|
||||
};
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
|
||||
export const NotificationSubscribeInfo = {
|
||||
bundleNames: [paramMock.paramStringMock],
|
||||
userId: '[PC preview] unknow userId',
|
||||
};
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { paramMock } from "../../utils"
|
||||
import { NotificationRequest } from "./notificationRequest"
|
||||
import { NotificationSortingMap } from "./notificationSortingMap"
|
||||
|
||||
export const NotificationSubscriber = {
|
||||
onConsume: function (...args) {
|
||||
console.warn("NotificationSubscriber.onConsume interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
},
|
||||
onCancel: function (...args) {
|
||||
console.warn("NotificationSubscriber.onCancel interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
},
|
||||
onUpdate: function (...args) {
|
||||
console.warn("NotificationSubscriber.onUpdate interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
},
|
||||
onConnect: function () {
|
||||
console.warn("NotificationSubscriber.onConnect interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
},
|
||||
onDisconnect: function () {
|
||||
console.warn("NotificationSubscriber.onDisconnect interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
},
|
||||
onDestroy: function () {
|
||||
console.warn("NotificationSubscriber.onDestroy interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
},
|
||||
onDoNotDisturbDateChange: function (...args) {
|
||||
console.warn("NotificationSubscriber.onDoNotDisturbDateChange interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
},
|
||||
onEnabledNotificationChanged: function (...args) {
|
||||
console.warn("NotificationSubscriber.onEnabledNotificationChanged interface mocked in the Previewer. How this interface works on the" +
|
||||
" Previewer may be different from that on a real device.")
|
||||
}
|
||||
}
|
||||
export const SubscribeCallbackData = {
|
||||
request: NotificationRequest,
|
||||
sortingMap: NotificationSortingMap,
|
||||
reason: '[PC preview] unknow reason',
|
||||
sound: '[PC preview] unknow sound',
|
||||
vibrationValues: [paramMock.paramNumberMock],
|
||||
}
|
||||
export const EnabledNotificationCallbackData = {
|
||||
bundle: '[PC preview] unknow bundle',
|
||||
uid: '[PC preview] unknow uid',
|
||||
enable: '[PC preview] unknow enable',
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export const NotificationTemplate = {
|
||||
name: '[PC preview] unknow name',
|
||||
data: {"key": "unknown any"},
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export const NotificationUserInput = {
|
||||
inputKey: '[PC preview] unknow inputKey',
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export function mockEnterpriseAdminExtensionAbility() {
|
||||
const EnterpriseAdminExtensionAbilityClass = class EnterpriseAdminExtensionAbility {
|
||||
constructor() {
|
||||
console.warn('EnterpriseAdminExtensionAbility.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.onAdminEnabled = function (...args) {
|
||||
console.warn("EnterpriseAdminExtensionAbility.onAdminEnabled interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.onAdminDisabled = function (...args) {
|
||||
console.warn("EnterpriseAdminExtensionAbility.onAdminDisabled interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
}
|
||||
}
|
||||
return EnterpriseAdminExtensionAbilityClass;
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export function mockWorkSchedulerExtensionAbility() {
|
||||
const WorkSchedulerExtensionAbilityClass = class WorkSchedulerExtensionAbility {
|
||||
constructor() {
|
||||
this.onWorkStart = function () {
|
||||
console.warn("WorkSchedulerExtensionAbility.onWorkStart interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.onWorkStop = function () {
|
||||
console.warn("WorkSchedulerExtensionAbility.onWorkStop interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
}
|
||||
}
|
||||
return new WorkSchedulerExtensionAbilityClass();
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../utils"
|
||||
|
||||
export function mockAbilityAccessCtrl() {
|
||||
const GrantStatus = "[PC preview] unknow GrantStatus";
|
||||
|
||||
const AtManager = {
|
||||
verifyAccessToken: function (...args) {
|
||||
console.warn("AtManager.verifyAccessToken interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(GrantStatus);
|
||||
})
|
||||
},
|
||||
verifyAccessTokenSync: function (...args) {
|
||||
console.warn("AtManager.verifyAccessTokenSync interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return GrantStatus;
|
||||
},
|
||||
grantUserGrantedPermission: function (...args) {
|
||||
console.warn("AtManager.grantUserGrantedPermission 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, paramMock.businessErrorMock, paramMock.paramNumberMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
revokeUserGrantedPermission: function (...args) {
|
||||
console.warn("AtManager.revokeUserGrantedPermission 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, paramMock.businessErrorMock, paramMock.paramNumberMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
getPermissionFlags: function (...args) {
|
||||
console.warn("AtManager.getPermissionFlags interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
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, PermissionStateChangeInfo);
|
||||
}
|
||||
},
|
||||
off: function (...args) {
|
||||
console.warn("AtManager.off 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, PermissionStateChangeInfo);
|
||||
}
|
||||
}
|
||||
};
|
||||
const PermissionStateChangeType = {
|
||||
PERMISSION_REVOKED_OPER: 0,
|
||||
PERMISSION_GRANTED_OPER: 1
|
||||
};
|
||||
|
||||
const PermissionStateChangeInfo = {
|
||||
change: PermissionStateChangeType,
|
||||
tokenID: '[PC Preview] unknown tokenID',
|
||||
permissionName: '[PC Preview] unknown permissionName',
|
||||
|
||||
};
|
||||
const abilityAccessCtrl = {
|
||||
createAtManager : function (...args) {
|
||||
console.warn("abilityAccessCtrl.createAtManager interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return AtManager;
|
||||
},
|
||||
};
|
||||
|
||||
return abilityAccessCtrl;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../utils"
|
||||
|
||||
export function mockDataUriUtils() {
|
||||
const dataUriUtils = {
|
||||
getId: function (...args) {
|
||||
console.warn("dataUriUtils.getId interface mocked in the Previewer. How this interface works" +
|
||||
" on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
},
|
||||
attachId: function (...args) {
|
||||
console.warn("dataUriUtils.attachId interface mocked in the Previewer. How this interface works" +
|
||||
" on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
},
|
||||
deleteId: function (...args) {
|
||||
console.warn("dataUriUtils.deleteId interface mocked in the Previewer. How this interface works" +
|
||||
" on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
},
|
||||
updateId: function (...args) {
|
||||
console.warn("dataUriUtils.updateId interface mocked in the Previewer. How this interface works" +
|
||||
" on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramStringMock
|
||||
}
|
||||
}
|
||||
return dataUriUtils;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export const ErrorCode = {
|
||||
PERMISSION_DENY: -3,
|
||||
ABILITY_NOT_FOUND: -2,
|
||||
INVALID_PARAMETER: -1,
|
||||
NO_ERROR: 0,
|
||||
}
|
||||
export function mockErrorCode() {
|
||||
return ErrorCode;
|
||||
}
|
@ -1,171 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../utils"
|
||||
import { WantClass } from "./ohos_application_Want"
|
||||
import { Context as _Context } from "./app/context"
|
||||
import { AbilityResult } from "./ability/abilityResult"
|
||||
import { windowMock } from "./ohos_window"
|
||||
import { DataAbilityHelper } from "./ability/dataAbilityHelper"
|
||||
import { AppVersionInfo as _AppVersionInfo } from "./app/appVersionInfo"
|
||||
import { ProcessInfo as _ProcessInfo } from "./app/processInfo"
|
||||
|
||||
export function mockFeatureAbility() {
|
||||
const featureAbility = {
|
||||
getWant: function (...args) {
|
||||
console.warn("featureAbility.getWant 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, paramMock.businessErrorMock, new WantClass());
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(new WantClass());
|
||||
})
|
||||
}
|
||||
},
|
||||
startAbility: function (...args) {
|
||||
console.warn("featureAbility.startAbility 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, paramMock.businessErrorMock, paramMock.paramNumberMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramNumberMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
getContext: function () {
|
||||
console.warn("featureAbility.getContext interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return _Context;
|
||||
},
|
||||
startAbilityForResult: function (...args) {
|
||||
console.warn("featureAbility.startAbilityForResult 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, paramMock.businessErrorMock, AbilityResult);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(AbilityResult);
|
||||
})
|
||||
}
|
||||
},
|
||||
terminateSelfWithResult: function (...args) {
|
||||
console.warn("featureAbility.terminateSelfWithResult 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
terminateSelf: function () {
|
||||
console.warn("featureAbility.terminateSelf 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
acquireDataAbilityHelper: function (...args) {
|
||||
console.warn("featureAbility.acquireDataAbilityHelper interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return DataAbilityHelper;
|
||||
},
|
||||
hasWindowFocus: function (...args) {
|
||||
console.warn("featureAbility.hasWindowFocus 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, paramMock.businessErrorMock, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
connectAbility: function (...args) {
|
||||
console.warn("featureAbility.connectAbility interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
},
|
||||
disconnectAbility: function (...args) {
|
||||
console.warn("featureAbility.disconnectAbility 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, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
},
|
||||
getWindow: function (...args) {
|
||||
console.warn("featureAbility.getWindow 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, paramMock.businessErrorMock, windowMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(windowMock);
|
||||
})
|
||||
}
|
||||
},
|
||||
AbilityWindowConfiguration,
|
||||
AbilityStartSetting,
|
||||
ErrorCode,
|
||||
DataAbilityOperationType,
|
||||
Context: _Context,
|
||||
AppVersionInfo: _AppVersionInfo,
|
||||
ProcessInfo: _ProcessInfo
|
||||
}
|
||||
return featureAbility;
|
||||
}
|
||||
export const AbilityWindowConfiguration = {
|
||||
WINDOW_MODE_UNDEFINED: 0,
|
||||
WINDOW_MODE_FULLSCREEN: 1,
|
||||
WINDOW_MODE_SPLIT_PRIMARY: 100,
|
||||
WINDOW_MODE_SPLIT_SECONDARY: 101,
|
||||
WINDOW_MODE_FLOATING: 102
|
||||
}
|
||||
export const AbilityStartSetting = {
|
||||
BOUNDS_KEY: "abilityBounds",
|
||||
WINDOW_MODE_KEY: "windowMode",
|
||||
DISPLAY_ID_KEY: "displayId"
|
||||
}
|
||||
export const ErrorCode = {
|
||||
NO_ERROR: 0,
|
||||
INVALID_PARAMETER: -1,
|
||||
ABILITY_NOT_FOUND: -2,
|
||||
PERMISSION_DENY: -3
|
||||
}
|
||||
export const DataAbilityOperationType = {
|
||||
TYPE_INSERT: 1,
|
||||
TYPE_UPDATE: 2,
|
||||
TYPE_DELETE: 3,
|
||||
TYPE_ASSERT: 4,
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../utils"
|
||||
import { DataAbilityHelper } from "./ability/dataAbilityHelper"
|
||||
|
||||
export function mockParticleAbility() {
|
||||
const particleAbility = {
|
||||
startAbility: function (...args) {
|
||||
console.warn("ability.particleAbility.startAbility 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()
|
||||
})
|
||||
}
|
||||
},
|
||||
terminateSelf: function (...args) {
|
||||
console.warn("ability.particleAbility.terminateSelf 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()
|
||||
})
|
||||
}
|
||||
},
|
||||
acquireDataAbilityHelper: function (...args) {
|
||||
console.warn("ability.particleAbility.acquireDataAbilityHelper interface mocked in the Previewer. How this interface works" +
|
||||
" on the Previewer may be different from that on a real device.")
|
||||
return DataAbilityHelper;
|
||||
},
|
||||
connectAbility: function (...args) {
|
||||
console.warn("ability.particleAbility.connectAbility interface mocked in the Previewer. How this interface works" +
|
||||
" on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
},
|
||||
disconnectAbility: function (...args) {
|
||||
console.warn("ability.particleAbility.disconnectAbility 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()
|
||||
})
|
||||
}
|
||||
},
|
||||
startBackgroundRunning: function (...args) {
|
||||
console.warn("ability.particleAbility.startBackgroundRunning 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()
|
||||
})
|
||||
}
|
||||
},
|
||||
cancelBackgroundRunning: function (...args) {
|
||||
console.warn("ability.particleAbility.cancelBackgroundRunning 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()
|
||||
})
|
||||
}
|
||||
},
|
||||
ErrorCode : {
|
||||
INVALID_PARAMETER: -1,
|
||||
}
|
||||
}
|
||||
return particleAbility;
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export const Action = {
|
||||
ACTION_HOME: "ohos.want.action.home",
|
||||
ACTION_DIAL: "ohos.want.action.dial",
|
||||
ACTION_SEARCH: "ohos.want.action.search",
|
||||
ACTION_WIRELESS_SETTINGS: "ohos.settings.wireless",
|
||||
ACTION_MANAGE_APPLICATIONS_SETTINGS: "ohos.settings.manage.applications",
|
||||
ACTION_APPLICATION_DETAILS_SETTINGS: "ohos.settings.application.details",
|
||||
ACTION_SET_ALARM: "ohos.want.action.setAlarm",
|
||||
ACTION_SHOW_ALARMS: "ohos.want.action.showAlarms",
|
||||
ACTION_SNOOZE_ALARM: "ohos.want.action.snoozeAlarm",
|
||||
ACTION_DISMISS_ALARM: "ohos.want.action.dismissAlarm",
|
||||
ACTION_DISMISS_TIMER: "ohos.want.action.dismissTimer",
|
||||
ACTION_SEND_SMS: "ohos.want.action.sendSms",
|
||||
ACTION_CHOOSE: "ohos.want.action.choose",
|
||||
ACTION_IMAGE_CAPTURE: "ohos.want.action.imageCapture",
|
||||
ACTION_VIDEO_CAPTURE: "ohos.want.action.videoCapture",
|
||||
ACTION_SELECT: "ohos.want.action.select",
|
||||
ACTION_SEND_DATA: "ohos.want.action.sendData",
|
||||
ACTION_SEND_MULTIPLE_DATA: "ohos.want.action.sendMultipleData",
|
||||
ACTION_SCAN_MEDIA_FILE: "ohos.want.action.scanMediaFile",
|
||||
ACTION_VIEW_DATA: "ohos.want.action.viewData",
|
||||
ACTION_EDIT_DATA: "ohos.want.action.editData",
|
||||
INTENT_PARAMS_INTENT: "ability.want.params.INTENT",
|
||||
INTENT_PARAMS_TITLE: "ability.want.params.TITLE",
|
||||
ACTION_FILE_SELECT: "ohos.action.fileSelect",
|
||||
PARAMS_STREAM: "ability.params.stream",
|
||||
ACTION_APP_ACCOUNT_OAUTH: "ohos.account.appAccount.action.oauth",
|
||||
ACTION_MARKER_DOWNLOAD: "ohos.want.action.marketDownload"
|
||||
}
|
||||
export const Entity = {
|
||||
ENTITY_DEFAULT: "entity.system.default",
|
||||
ENTITY_HOME: "entity.system.home",
|
||||
ENTITY_VOICE: "entity.system.voice",
|
||||
ENTITY_BROWSABLE: "entity.system.browsable",
|
||||
ENTITY_VIDEO: "entity.system.video"
|
||||
}
|
||||
export const Flags = {
|
||||
FLAG_AUTH_READ_URI_PERMISSION: 0x00000001,
|
||||
FLAG_AUTH_WRITE_URI_PERMISSION: 0x00000002,
|
||||
FLAG_ABILITY_FORWARD_RESULT: 0x00000004,
|
||||
FLAG_ABILITY_CONTINUATION: 0x00000008,
|
||||
FLAG_NOT_OHOS_COMPONENT: 0x00000010,
|
||||
FLAG_ABILITY_FORM_ENABLED: 0x00000020,
|
||||
FLAG_AUTH_PERSISTABLE_URI_PERMISSION: 0x00000040,
|
||||
FLAG_AUTH_PREFIX_URI_PERMISSION: 0x00000080,
|
||||
FLAG_ABILITYSLICE_MULTI_DEVICE: 0x00000100,
|
||||
FLAG_START_FOREGROUND_ABILITY: 0x00000200,
|
||||
FLAG_ABILITY_CONTINUATION_REVERSIBLE: 0x00000400,
|
||||
FLAG_INSTALL_ON_DEMAND: 0x00000800,
|
||||
FLAG_INSTALL_WITH_BACKGROUND_MODE: 0x80000000,
|
||||
FLAG_ABILITY_CLEAR_MISSION: 0x00008000,
|
||||
FLAG_ABILITY_NEW_MISSION: 0x10000000,
|
||||
FLAG_ABILITY_MISSION_TOP: 0x20000000
|
||||
}
|
||||
export function mockWantConstant() {
|
||||
const wantConstant = {
|
||||
Action,
|
||||
Entity,
|
||||
Flags
|
||||
}
|
||||
return wantConstant;
|
||||
}
|
@ -1,189 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from '../utils';
|
||||
|
||||
export function mockAccessibility() {
|
||||
const AbilityTypeMock = '[PC Preview] unknown AbilityType';
|
||||
|
||||
const CapabilityMock = '[PC Preview] unknown Capability';
|
||||
|
||||
const EventTypeMock = '[PC Preview] unknown EventType';
|
||||
|
||||
const AccessibilityAbilityInfo = {
|
||||
id: '[PC Preview] unknown id',
|
||||
name: '[PC Preview] unknown name',
|
||||
bundleName: '[PC Preview] unknown bundleName',
|
||||
TargetBundleName: ['[PC Preview] unknown TargetBundleName'],
|
||||
abilityTypes: [AbilityTypeMock],
|
||||
capabilities: [CapabilityMock],
|
||||
description: '[PC Preview] unknown description',
|
||||
eventTypes: [EventTypeMock]
|
||||
};
|
||||
|
||||
const CaptionsFontEdgeTypeMock = '[PC Preview] unknown CaptionsFontEdgeType';
|
||||
|
||||
const CaptionsFontFamilyMock = '[PC Preview] unknown CaptionsFontFamily';
|
||||
|
||||
const CaptionStyle = {
|
||||
fontFamily: CaptionsFontFamilyMock,
|
||||
fontScale: '[PC Preview] unknown fontScale',
|
||||
fontColor: '[PC Preview] unknown fontColor',
|
||||
fontEdgeType: CaptionsFontEdgeTypeMock,
|
||||
backgroundColor: '[PC Preview] unknown backgroundColor',
|
||||
windowColor: '[PC Preview] unknown windowColor'
|
||||
};
|
||||
|
||||
const CaptionsManagerMock = {
|
||||
enabled: '[PC Preview] unknown enabled',
|
||||
style: CaptionStyle,
|
||||
on: function (...args) {
|
||||
console.warn('CaptionsManager.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 > 1 && typeof args[len - 1] === 'function') {
|
||||
if (args[0] === 'enableChange') {
|
||||
args[len - 1].call(this, paramMock.paramBooleanMock);
|
||||
} else if (args[0] === 'styleChange') {
|
||||
args[len - 1].call(this, CaptionStyle);
|
||||
}
|
||||
}
|
||||
},
|
||||
off: function (...args) {
|
||||
console.warn('CaptionsManager.off 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 > 1 && typeof args[len - 1] === 'function') {
|
||||
if (args[0] === 'enableChange') {
|
||||
args[len - 1].call(this, paramMock.paramBooleanMock);
|
||||
} else if (args[0] === 'styleChange') {
|
||||
args[len - 1].call(this, CaptionStyle);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const WindowUpdateTypeMock = '[PC Preview] unknown WindowUpdateType';
|
||||
|
||||
const ActionMock = '[PC Preview] unknown Action';
|
||||
|
||||
const TextMoveUnitMock = '[PC Preview] unknown TextMoveUnit';
|
||||
|
||||
const EventInfoClass = class EventInfo {
|
||||
constructor(...args) {
|
||||
console.warn('accessibility.EventInfoClass.constructor interface mocked in the Previewer.' +
|
||||
' How this interface works on the Previewer may be different from that on a real device.');
|
||||
this.type = EventTypeMock;
|
||||
this.windowUpdateType = WindowUpdateTypeMock;
|
||||
this.bundleName = '[PC Preview] unknown bundleName';
|
||||
this.componentType = '[PC Preview] unknown componentType';
|
||||
this.pageId = '[PC Preview] unknown pageId';
|
||||
this.description = '[PC Preview] unknown description';
|
||||
this.triggerAction = ActionMock;
|
||||
this.textMoveUnit = TextMoveUnitMock;
|
||||
this.contents = ['[PC Preview] unknown content'];
|
||||
this.lastContent = '[PC Preview] unknown lastContent';
|
||||
this.beginIndex = '[PC Preview] unknown beginIndex';
|
||||
this.currentIndex = '[PC Preview] unknown currentIndex';
|
||||
this.endIndex = '[PC Preview] unknown endIndex';
|
||||
this.itemCount = '[PC Preview] unknown itemCount';
|
||||
}
|
||||
};
|
||||
|
||||
const accessibility = {
|
||||
EventInfo: EventInfoClass,
|
||||
isOpenAccessibility: function (...args) {
|
||||
console.warn('accessibility.isOpenAccessibility 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, reject) => {
|
||||
resolve(paramMock.paramBooleanMock);
|
||||
});
|
||||
}
|
||||
},
|
||||
isOpenTouchGuide: function (...args) {
|
||||
console.warn('accessibility.isOpenTouchGuide 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);
|
||||
});
|
||||
}
|
||||
},
|
||||
on: function (...args) {
|
||||
console.warn('accessibility.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 (typeof args[len - 1] === 'function') {
|
||||
if (args[0] == 'accessibilityStateChange') {
|
||||
args[len - 1].call(this, this, paramMock.paramBooleanMock);
|
||||
} else if (args[0] == 'touchGuideStateChange') {
|
||||
args[len - 1].call(this, paramMock.paramBooleanMock);
|
||||
} else {
|
||||
args[len - 1].call(this, this, paramMock.paramBooleanMock);
|
||||
}
|
||||
}
|
||||
},
|
||||
off: function (...args) {
|
||||
console.warn('accessibility.off 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 > 1 && typeof args[len - 1] === 'function') {
|
||||
if (args[0] === 'accessibilityStateChange') {
|
||||
args[len - 1].call(this, paramMock.paramBooleanMock);
|
||||
} else if (args[0] === 'touchGuideStateChange') {
|
||||
args[len - 1].call(this, paramMock.paramBooleanMock);
|
||||
}
|
||||
}
|
||||
},
|
||||
getAbilityLists: function (...args) {
|
||||
console.warn('accessibility.getAbilityLists 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, [AccessibilityAbilityInfo]);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve([AccessibilityAbilityInfo]);
|
||||
});
|
||||
}
|
||||
},
|
||||
sendEvent: function (...args) {
|
||||
console.warn('accessibility.sendEvent 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, reject) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
getCaptionsManager: function () {
|
||||
console.warn('accessibility.getCaptionsManager interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
return CaptionsManagerMock;
|
||||
}
|
||||
};
|
||||
|
||||
return accessibility;
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from '../utils';
|
||||
|
||||
export function mockAccessibilityConfig() {
|
||||
const config = {
|
||||
enableAbility: function (...args) {
|
||||
console.warn('accessibilityConfig config.enableAbility 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, reject) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
disableAbility: function (...args) {
|
||||
console.warn('accessibilityConfig config.disableAbility 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();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
return config;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user