• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { mockSystemParameter } from './ohos_systemparameter'
17import { mockSystemCapability } from './ohos_systemCapability'
18import { mockAbility } from './ohos_application_Ability'
19import { mockErrorCode } from './ohos_ability_errorCode'
20import { mockFeatureAbility } from './ohos_ability_featureAbility'
21import { mockDataUriUtils } from './ohos_ability_dataUriUtils'
22import { mockWantConstant } from './ohos_ability_wantConstant'
23import { mockAbilityConstant } from './ohos_application_AbilityConstant'
24import { mockAbilityDelegatorRegistry } from './ohos_application_abilityDelegatorRegistry'
25import { mockAbilityLifecycleCallback } from './ohos_application_AbilityLifecycleCallback'
26import { mockFormExtension } from './ohos_application_FormExtension'
27import { mockStaticSubscriberExtensionAbility } from './ohos_application_StaticSubscriberExtensionAbility'
28import { mockFormHost } from './ohos_application_formHost'
29import { mockFormInfo } from './ohos_application_formInfo'
30import { mockErrorManager } from './ohos_application_errorManager'
31import { mockQuickFixManager } from './ohos_application_quickFixManager'
32import { mockTestRunner } from './ohos_application_testRunner'
33import { mockWant } from './ohos_application_Want'
34import { mockServiceExtensionAbility } from './ohos_application_ServiceExtensionAbility'
35import { mockStartOptions } from './ohos_application_StartOptions'
36import { mockAbilityStage } from './ohos_application_AbilityStage'
37import { mockFormBindingData } from './ohos_application_formBindingData'
38import { mockFormError } from './ohos_application_formError'
39import { mockAbilityManager } from './ohos_application_abilityManager'
40import { mockParticleAbility } from './ohos_ability_particleAbility'
41import { mockAppManager } from './ohos_application_appManager'
42import { mockConfiguration } from './ohos_application_Configuration'
43import { mockConfigurationConstant } from './ohos_application_ConfigurationConstant'
44import { mockContext } from './ohos_application_context'
45import { mockDataShareExtensionAbility } from './ohos_application_DataShareExtensionAbility'
46import { mockEnvironmentCallback } from './ohos_application_EnvironmentCallback'
47import { mockMissionManager } from "./ohos_application_missionManager"
48import { mockUriPermissionManager } from "./ohos_application_uriPermissionManager"
49import { mockCommonEvent } from './ohos_commonEvent'
50import { mockNotification } from './ohos_notification'
51import { mockFileio } from './ohos_fileio'
52import { mockWorker } from './ohos_worker'
53import { mockUtil } from './ohos_util'
54import { mockPower } from './ohos_power'
55import { mockRunninglock } from './ohos_runninglock'
56import { mockThermal } from './ohos_thermal'
57import { mockBatteryStatistics } from './ohos_batteryStatistics'
58import { mockIntl } from './ohos_intl'
59import { mockI18N } from './ohos_i18n'
60import { mockRpc } from './ohos_rpc'
61import { mockProcess } from './ohos_process'
62import { mockUrl } from './ohos_url'
63import { mockHiAppEvent } from './ohos_hiAppEvent'
64import { mockHiChecker } from './ohos_hichecker'
65import { mockHiSysEvent } from './ohos_hiSysEvent'
66import { mockHiTraceChain } from './ohos_hiTraceChain'
67import { mockHiTraceMeter } from './ohos_hiTraceMeter'
68import { mockHidebug } from './ohos_hidebug'
69import { mockFaultLogger } from './ohos_faultLogger'
70import { mockTv } from './tv'
71import { mockDtv } from './dtv'
72import { mockDistributedAccount } from './ohos_account_distributedAccount'
73import { mockEmitter } from './ohos_events_emitter'
74import { mockDistributedObject } from './ohos_data_distributedDataObject'
75import { mockDataAbility } from './ohos_data_dataAbility'
76import { mockStorage } from './system_storage'
77import { mockDataShare } from './ohos_data_dataShare'
78import { mockDataSharePredicates } from './ohos_data_dataSharePredicates'
79import { DataShareResultSet } from './ohos_data_DataShareResultSet'
80import { mockInputDevice } from './ohos_multimodalInput_inputDevice'
81import { mockVibrator } from './ohos_vibrator'
82import { mockSensor } from './ohos_sensor'
83import { mockWifi } from './ohos_wifi'
84import { mockWifiExt } from './ohos_wifiext'
85import { mockUsb } from './ohos_usb'
86import { mockBundle } from './ohos_bundle'
87import { mockInnerBundle } from './ohos_bundle_innerBundleManager'
88import { mockUri } from './ohos_uri'
89import { mockXml } from './ohos_xml'
90import { mockConvertXml } from './ohos_convertxml'
91import { mockStatfs } from './ohos_statfs'
92import { mockFileManager } from "./ohos_fileManager"
93import { mockEnvironment } from "./ohos_environment"
94import { mockStorageStatistics } from "./ohos_storageStatistics"
95import { mockVolumeManager } from "./ohos_volumeManager"
96import { mockSettings } from './ohos_settings'
97import { mockAbilityAccessCtrl } from './ohos_abilityAccessCtrl'
98import { mockConfigPolicy } from './ohos_configPolicy'
99import { mockUpdate } from './ohos_update'
100import { mockBackgroundTaskManager } from './ohos_backgroundTaskManager'
101import { mockBundleState } from './ohos_bundleState'
102import { mockSecurityLabel } from './ohos_securitylabel'
103import { mockWorkScheduler } from './ohos_workScheduler'
104import { mockWorkSchedulerExtensionAbility } from './ohos_WorkSchedulerExtensionAbility'
105import { mockUserAuth } from './ohos_userIAM_userAuth'
106import { mockFaceAuth } from './ohos_userIAM_faceAuth'
107import { mockArrayList } from './ohos_util_Arraylist'
108import { mockDeque } from './ohos_util_Deque'
109import { mockHashMap } from './ohos_util_HashMap'
110import { mockHashSet } from './ohos_util_HashSet'
111import { mockLightWeightMap } from './ohos_util_LightWeightMap'
112import { mockLightWeightSet } from './ohos_util_LightWeightSet'
113import { mockLinkedList } from './ohos_util_LinkedList'
114import { mockList } from './ohos_util_List'
115import { mockPlainArray } from './ohos_util_PlainArray'
116import { mockQueue } from './ohos_util_Queue'
117import { mockStack } from './ohos_util_Stack'
118import { mockTreeMap } from './ohos_util_TreeMap'
119import { mockTreeSet } from './ohos_util_TreeSet'
120import { mockVector } from './ohos_util_Vector'
121import { mockMultimediaAVSession } from './ohos_multimedia_av_session'
122import { mockMultimediaCamera } from './ohos_multimedia_camera'
123import { mockMultimediaAudio } from './ohos_multimedia_audio'
124import { mockMultimediaImage } from './ohos_multimedia_image'
125import { mockMultimediaMedia } from './ohos_multimedia_media'
126import { mockMultimediaMediaLibrary } from './ohos_multimedia_mediaLibrary'
127import { mockBatteryinfo } from './ohos_batteryInfo'
128import { mockBluetooth } from './ohos_bluetooth'
129import { mockBrightness } from './ohos_brightness'
130import { mockBytrace } from './ohos_bytrace'
131import { mockCipher } from './system_cipher'
132import { mockContact } from './ohos_contact'
133import { mockDataStorage } from './ohos_data_Storage'
134import { mockDeviceInfo } from './ohos_deviceInfo'
135import { mockDeviceManager } from './ohos_distributedHardware_deviceManager'
136import { mockDistributedMissionManager } from "./ohos_distributedMissionManager"
137import { mockDisplay } from './ohos_display'
138import { mockCryptoFramework } from './ohos_security_cryptoFramework'
139import { mockHuks } from './ohos_security_huks'
140import { mockInputMethod } from './ohos_inputmethod'
141import { mockInputMethodEngine } from './ohos_inputmethodengine'
142import { mockInputMethodExtensionAbility } from "./ohos_inputmethodextensionability";
143import { mockConnection } from './ohos_net_connection'
144import { mockHttp } from './ohos_net_http'
145import { mockSocket } from './ohos_net_socket'
146import { mockWebSocket } from './ohos_net_webSocket'
147import { mockNetwork } from './ohos_network'
148import { mockNfcCardEmulation } from './ohos_nfc_cardEmulation'
149import { mockController } from './ohos_nfc_controller'
150import { mockTag } from './ohos_nfc_tag'
151import { mockPasteBoard } from './ohos_pasteboard'
152import { mockRequest } from './ohos_request'
153import { mockScreenLock } from './ohos_screenLock'
154import { mockCall } from './ohos_telephony_call'
155import { mockData } from './ohos_telephony_data'
156import { mockObserver } from './ohos_telephony_observer'
157import { mockRadio } from './ohos_telephony_radio'
158import { mockSim } from './ohos_telephony_sim'
159import { mockSMS } from './ohos_telephony_sms'
160import { mockWindow } from './ohos_window'
161import { mockAppAccount } from './ohos_account_appAccount'
162import { mockOhosGeolocation } from './ohos_geolocation'
163import { mockInputMonitor } from './ohos_multimodalInput_inputMonitor'
164import { mockPointer } from './ohos_multimodalInput_pointer'
165import { mockOsAccount } from './ohos_account_osAccount'
166import { mockReminderAgent } from './ohos_reminderAgent'
167import { mockSystemTime } from './ohos_systemTime'
168import { mockSystemTimer } from './ohos_systemTimer'
169import { mockWallpaper } from './ohos_wallpaper'
170import { mockWantAgent } from './ohos_wantAgent'
171import { mockScreenshot } from './ohos_screenshot'
172import { mockZlib } from './ohos_zlib'
173import { mockPrivacyManager } from './ohos_privacyManager'
174import { mockFormProvider } from './ohos_application_formProvider'
175import { mockScreen } from './ohos_screen'
176import { mockDistributedBundle } from './ohos_distributedBundle'
177import { mockInputConsumer } from './ohos_multimodalInput_inputConsumer'
178import { mockDocument } from './ohos_document'
179import { mockResourceManager } from './ohos_resourceManager'
180import { mockFile } from './system_file'
181import { mockEnterpriseDeviceManager } from './ohos_enterpriseDeviceManager'
182import { mockEnterpriseAdminExtensionAbility } from './ohos_EnterpriseAdminExtensionAbility'
183import { mockKeyCode } from './ohos_multimodalInput_keyCode'
184import { mockInputEventClient } from './ohos_multimodalInput_inputEventClient'
185import { mockDefaultAppManager } from './ohos_bundle_defaultAppManager'
186import { mockKeyEvent } from './ohos_multimodalInput_keyEvent'
187import { mockMouseEvent } from './ohos_multimodalInput_mouseEvent'
188import { mockTouchEvent } from './ohos_multimodalInput_touchEvent'
189import { mockContinationManager } from './ohos_continuation_continuationManager'
190import { mockUiTest } from './ohos_uitest'
191import { mockBuffer } from './ohos_buffer'
192import { mockWindowAnimationManager } from './ohos_animation_windowAnimationManager'
193import { mockAccessibility } from './ohos_accessibility'
194import { mockAccessibilityConfig } from './ohos_accessibility_config'
195import { mockAccessibilityExtensionAbility } from './ohos_application_AccessibilityExtensionAbility'
196export function mockRequireNapiFun() {
197  global.requireNapi = function (...args) {
198    switch (args[0]) {
199      case "file":
200        return mockFile();
201      case "resourceManager":
202        return mockResourceManager();
203      case "document":
204        return mockDocument();
205      case "screen":
206        return mockScreen();
207      case "zlib":
208        return mockZlib();
209      case "screenshot":
210        return mockScreenshot();
211      case "wantAgent":
212        return mockWantAgent();
213      case "wallpaper":
214        return mockWallpaper();
215      case "systemTimer":
216        return mockSystemTimer();
217      case "systemTime":
218        return mockSystemTime();
219      case "reminderAgent":
220        return mockReminderAgent();
221      case "account.osAccount":
222        return mockOsAccount();
223      case "multimodalInput.inputMonitor":
224        return mockInputMonitor();
225      case "geolocation":
226        return mockOhosGeolocation();
227      case "account.appAccount":
228        return mockAppAccount();
229      case "window":
230        return mockWindow();
231      case "telephony.call":
232        return mockCall();
233      case "telephony.data":
234        return mockData();
235      case "telephony.observer":
236        return mockObserver();
237      case "telephony.radio":
238        return mockRadio();
239      case "telephony.sim":
240        return mockSim();
241      case "telephony.sms":
242        return mockSMS();
243      case "pasteboard":
244        return mockPasteBoard();
245      case "request":
246        return mockRequest();
247      case "screenLock":
248        return mockScreenLock();
249      case "nfc.cardEmulation":
250        return mockNfcCardEmulation();
251      case "nfc.controller":
252        return mockController();
253      case "nfc.tag":
254        return mockTag();
255      case "network":
256        return mockNetwork();
257      case "net.connection":
258        return mockConnection();
259      case "net.http":
260        return mockHttp();
261      case "net.socket":
262        return mockSocket();
263      case "net.webSocket":
264        return mockWebSocket();
265      case "inputmethodengine":
266        return mockInputMethodEngine();
267      case "inputmethod":
268        return mockInputMethod();
269      case "inputmethodextensionability":
270        return mockInputMethodExtensionAbility();
271      case "security.cryptoFramework":
272        return mockCryptoFramework();
273      case "security.huks":
274        return mockHuks();
275      case "display":
276        return mockDisplay();
277      case "distributedHardware.deviceManager":
278        return mockDeviceManager();
279      case "distributedMissionManager":
280        return mockDistributedMissionManager();
281      case "deviceInfo":
282        return mockDeviceInfo();
283      case "data.storage":
284        return mockDataStorage();
285      case "contact":
286        return mockContact();
287      case "cipher":
288        return mockCipher();
289      case "bytrace":
290        return mockBytrace();
291      case "brightness":
292        return mockBrightness();
293      case "bluetooth":
294        return mockBluetooth();
295      case "batteryinfo":
296        return mockBatteryinfo();
297      case "systemCapability":
298        return mockSystemCapability();
299      case "systemParameter":
300        return mockSystemParameter();
301      case "ability.errorCode":
302        return mockErrorCode();
303      case "ability.dataUriUtils":
304        return mockDataUriUtils();
305      case "ability.particleAbility":
306        return mockParticleAbility();
307      case "ability.featureAbility":
308        return mockFeatureAbility();
309      case "ability.wantConstant":
310        return mockWantConstant();
311      case "application.Ability":
312        return mockAbility();
313      case "application.formHost":
314        return mockFormHost();
315      case "application.formInfo":
316        return mockFormInfo();
317      case "application.FormExtension":
318        return mockFormExtension();
319      case "application.ServiceExtensionAbility":
320        return mockServiceExtensionAbility();
321      case "application.StartOptions":
322        return mockStartOptions();
323      case "application.StaticSubscriberExtensionAbility":
324        return mockStaticSubscriberExtensionAbility()
325      case "application.errorManager":
326        return mockErrorManager();
327      case "application.testRunner":
328        return mockTestRunner();
329      case "application.Want":
330        return mockWant();
331      case "application.AbilityConstant":
332        return mockAbilityConstant();
333      case "application.abilityDelegatorRegistry":
334        return mockAbilityDelegatorRegistry();
335      case "application.AbilityLifecycleCallback":
336        return mockAbilityLifecycleCallback();
337      case "application.AbilityStage":
338        return mockAbilityStage();
339      case "application.formBindingData":
340        return mockFormBindingData();
341      case "application.formError":
342        return mockFormError();
343      case "application.abilityManager":
344        return mockAbilityManager();
345      case "application.appManager":
346        return mockAppManager();
347      case "application.Configuration":
348        return mockConfiguration();
349      case "application.quickFixManager":
350        return mockQuickFixManager();
351      case "application.ConfigurationConstant":
352        return mockConfigurationConstant();
353      case "application.context":
354        return mockContext();
355      case "application.DataShareExtensionAbility":
356        return mockDataShareExtensionAbility();
357      case "application.EnvironmentCallback":
358        return mockEnvironmentCallback();
359      case "application.missionManager":
360        return mockMissionManager();
361      case "application.UriPermissionManager":
362        return mockUriPermissionManager();
363      case "commonEvent":
364        return mockCommonEvent();
365      case "notification":
366        return mockNotification();
367      case "fileio":
368        return mockFileio();
369      case "worker":
370        return mockWorker();
371      case "util":
372        return mockUtil();
373      case "intl":
374        return mockIntl();
375      case "i18n":
376        return mockI18N();
377      case "power":
378        return mockPower();
379      case "runninglock":
380        return mockRunninglock();
381      case "thermal":
382        return mockThermal();
383      case "batteryStatistics":
384        return mockBatteryStatistics();
385      case "rpc":
386        return mockRpc();
387      case "process":
388        return mockProcess();
389      case "url":
390        return mockUrl();
391      case "hichecker":
392        return mockHiChecker();
393      case "hiAppEvent":
394        return mockHiAppEvent();
395      case "hiSysEvent":
396        return mockHiSysEvent();
397      case "hidebug":
398        return mockHidebug();
399      case "hiTraceChain":
400        return mockHiTraceChain();
401      case "hiTraceMeter":
402        return mockHiTraceMeter();
403      case "faultLogger":
404        return mockFaultLogger();
405      case "tv":
406        return mockTv();
407      case "dtv":
408        return mockDtv();
409      case "account.distributedAccount":
410        return mockDistributedAccount();
411      case "events.emitter":
412        return mockEmitter();
413      case "data.distributedDataObject":
414        return mockDistributedObject();
415      case "data.storage":
416        return mockStorage();
417      case "data.dataShare":
418        return mockDataShare();
419      case "data.dataSharePredicates":
420        return mockDataSharePredicates();
421      case "data.DataShareResultSet":
422        return DataShareResultSet();
423      case "data.dataAbility":
424        return mockDataAbility();
425      case "multimodalInput.inputDevice":
426        return mockInputDevice();
427      case "multimodalInput.pointer":
428        return mockPointer();
429      case "vibrator":
430        return mockVibrator();
431      case "sensor":
432        return mockSensor();
433      case "wifi":
434        return mockWifi();
435      case "wifiext":
436          return mockWifiExt();
437      case "usb":
438        return mockUsb();
439      case "bundle":
440        return mockBundle();
441      case "distributedBundle":
442        return mockDistributedBundle();
443      case "bundle.innerBundleManager":
444        return mockInnerBundle();
445      case "bundle.defaultAppManager":
446        return mockDefaultAppManager();
447      case "uri":
448        return mockUri();
449      case "xml":
450        return mockXml();
451      case "convertxml":
452        return mockConvertXml();
453      case "statfs":
454        return mockStatfs();
455      case "fileManager":
456        return mockFileManager();
457      case "environment":
458        return mockEnvironment();
459      case "storageStatistics":
460        return mockStorageStatistics();
461      case "volumeManager":
462        return mockVolumeManager();
463      case "settings":
464        return mockSettings();
465      case "abilityAccessCtrl":
466        return mockAbilityAccessCtrl();
467      case "configPolicy":
468        return mockConfigPolicy();
469      case "update":
470        return mockUpdate();
471      case "backgroundTaskManager":
472        return mockBackgroundTaskManager();
473      case "bundleState":
474        return mockBundleState();
475      case "securityLabel":
476        return mockSecurityLabel();
477      case "workScheduler":
478        return mockWorkScheduler();
479      case "WorkSchedulerExtensionAbility":
480        return mockWorkSchedulerExtensionAbility();
481      case "userIAM.userAuth":
482        return mockUserAuth();
483      case "userIAM.faceAuth":
484        return mockFaceAuth();
485      case "util.ArrayList":
486        return mockArrayList();
487      case "util.Deque":
488        return mockDeque();
489      case "util.HashMap":
490        return mockHashMap();
491      case "util.HashSet":
492        return mockHashSet();
493      case "util.LightWeightMap":
494        return mockLightWeightMap();
495      case "util.LightWeightSet":
496        return mockLightWeightSet();
497      case "util.LinkedList":
498        return mockLinkedList();
499      case "util.List":
500        return mockList();
501      case "util.PlainArray":
502        return mockPlainArray();
503      case "util.Queue":
504        return mockQueue();
505      case "util.Stack":
506        return mockStack();
507      case "util.TreeMap":
508        return mockTreeMap();
509      case "util.TreeSet":
510        return mockTreeSet();
511      case "util.Vector":
512        return mockVector();
513      case "multimedia.mediaLibrary":
514        return mockMultimediaMediaLibrary();
515      case "multimedia.media":
516        return mockMultimediaMedia();
517      case "multimedia.image":
518        return mockMultimediaImage();
519      case "multimedia.avsession":
520        return mockMultimediaAVSession();
521      case "multimedia.camera":
522        return mockMultimediaCamera();
523      case "multimedia.audio":
524        return mockMultimediaAudio();
525      case "privacyManager":
526        return mockPrivacyManager();
527      case "application.formProvider":
528        return mockFormProvider();
529      case "multimodalInput.inputConsumer":
530        return mockInputConsumer();
531      case "enterpriseDeviceManager":
532        return mockEnterpriseDeviceManager();
533      case "EnterpriseAdminExtensionAbility":
534        return mockEnterpriseAdminExtensionAbility();
535      case "multimodalInput.keyCode":
536        return mockKeyCode();
537      case "multimodalInput.inputEventClient":
538        return mockInputEventClient();
539      case "multimodalInput.keyEvent":
540        return mockKeyEvent();
541      case "multimodalInput.mouseEvent":
542        return mockMouseEvent();
543      case "multimodalInput.touchEvent":
544        return mockTouchEvent();
545      case "accessibility":
546        return mockAccessibility();
547      case "accessibility.config":
548        return mockAccessibilityConfig();
549      case "application.AccessibilityExtensionAbility":
550        return mockAccessibilityExtensionAbility();
551      case "continuation.continuationManager":
552        return mockContinationManager();
553      case "uitest":
554        return mockUiTest();
555      case "buffer":
556        return mockBuffer();
557      case "animation.windowAnimationManager":
558        return mockWindowAnimationManager();
559      default:
560        return global.requireNapiPreview(...args);
561    }
562  }
563}
564