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