• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 
16 #ifndef FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_MOCK_H
17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_MOCK_H
18 
19 #include "bridge/declarative_frontend/engine/bindings.h"
20 #include "bridge/declarative_frontend/engine/bindings_defines.h"
21 #include "bridge/declarative_frontend/engine/functions/js_function.h"
22 #include "bridge/declarative_frontend/engine/js_types.h"
23 
24 namespace OHOS::Ace::Framework {
25 class JSMock {
26 public:
27     static void JSBind(BindingTarget globalObj);
28     static void JSBind(BindingTarget globalObj, const shared_ptr<JsRuntime> runtime,
29         const shared_ptr<JsValue> globalPtr);
30     static bool PreloadWorkerRequireNative(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& global);
31     static bool InitModule(const shared_ptr<JsRuntime>& runtime, shared_ptr<JsValue>& thisObj,
32         const std::string& moduleName);
33 };
34 
35 class JSMockBaseNode {
36 public:
37     JSMockBaseNode() = default;
38     ~JSMockBaseNode() = default;
39 
40     static void JSBind(BindingTarget globalObj);
ConstructorCallback(const JSCallbackInfo & info)41     static void ConstructorCallback(const JSCallbackInfo& info) {}
DestructorCallback(JSMockBaseNode * node)42     static void DestructorCallback(JSMockBaseNode* node) {}
FinishUpdateFunc(const JSCallbackInfo & info)43     void FinishUpdateFunc(const JSCallbackInfo& info) {}
Create(const JSCallbackInfo & info)44     void Create(const JSCallbackInfo& info) {}
PostTouchEvent(const JSCallbackInfo & info)45     void PostTouchEvent(const JSCallbackInfo& info) {}
UpdateStart(const JSCallbackInfo & info)46     void UpdateStart(const JSCallbackInfo& info) {}
UpdateEnd(const JSCallbackInfo & info)47     void UpdateEnd(const JSCallbackInfo& info) {}
Dispose(const JSCallbackInfo & info)48     void Dispose(const JSCallbackInfo& info) {}
49 };
50 
51 class JSMockViewPU {
52 public:
53     JSMockViewPU() = default;
54     ~JSMockViewPU() = default;
55 
56     static void JSBind(BindingTarget globalObj, std::string name);
Id(const JSCallbackInfo & info)57     void Id(const JSCallbackInfo& info) {}
UpdateStateVars(const JSCallbackInfo & info)58     void UpdateStateVars(const JSCallbackInfo& info) {}
AboutToReuseInternal(const JSCallbackInfo & info)59     void AboutToReuseInternal(const JSCallbackInfo& info) {}
AboutToRecycleInternal(const JSCallbackInfo & info)60     void AboutToRecycleInternal(const JSCallbackInfo& info) {}
UpdateDirtyElements(const JSCallbackInfo & info)61     void UpdateDirtyElements(const JSCallbackInfo& info) {}
62 };
63 
64 class JSMockScopeUtil {
65 public:
66     JSMockScopeUtil() = default;
67     ~JSMockScopeUtil() = default;
68 
69     static void JSBind(BindingTarget globalObj);
SyncInstanceId(const JSCallbackInfo & info)70     static void SyncInstanceId(const JSCallbackInfo& info) {}
RestoreInstanceId(const JSCallbackInfo & info)71     static void RestoreInstanceId(const JSCallbackInfo& info) {}
72 };
73 
74 class MockCustomDialogController {
75 public:
76     MockCustomDialogController() = default;
77     ~MockCustomDialogController() = default;
78 
79     static void JSBind(BindingTarget globalObj);
Open(const JSCallbackInfo & info)80     void Open(const JSCallbackInfo& info) {}
Close(const JSCallbackInfo & info)81     void Close(const JSCallbackInfo& info) {}
82 };
83 
84 class JSMockNativeCustomSpan {
85 public:
86     JSMockNativeCustomSpan() = default;
87     ~JSMockNativeCustomSpan() = default;
88 
89     static void JSBind(BindingTarget globalObj);
Invalidate(const JSCallbackInfo & info)90     void Invalidate(const JSCallbackInfo& info) {}
91 };
92 
93 class JSMockLocalStorage {
94 public:
95     JSMockLocalStorage() = default;
96     ~JSMockLocalStorage() = default;
97 
98     static void JSBind(BindingTarget globalObj);
99     Local<JSValueRef> ref(panda::JsiRuntimeCallInfo* runtimeCallInfo);
100     Local<JSValueRef> setAndRef(panda::JsiRuntimeCallInfo* runtimeCallInfo);
101     Local<JSValueRef> link(panda::JsiRuntimeCallInfo* runtimeCallInfo);
102     Local<JSValueRef> setAndLink(panda::JsiRuntimeCallInfo* runtimeCallInfo);
103     Local<JSValueRef> prop(panda::JsiRuntimeCallInfo* runtimeCallInfo);
104     Local<JSValueRef> setAndProp(panda::JsiRuntimeCallInfo* runtimeCallInfo);
has(const JSCallbackInfo & info)105     void has(const JSCallbackInfo& info) {}
get(const JSCallbackInfo & info)106     void get(const JSCallbackInfo& info) {}
set(const JSCallbackInfo & info)107     void set(const JSCallbackInfo& info) {}
setOrCreate(const JSCallbackInfo & info)108     void setOrCreate(const JSCallbackInfo& info) {}
deleteKeys(const JSCallbackInfo & info)109     void deleteKeys(const JSCallbackInfo& info) {}
keys(const JSCallbackInfo & info)110     void keys(const JSCallbackInfo& info) {}
size(const JSCallbackInfo & info)111     void size(const JSCallbackInfo& info) {}
clear(const JSCallbackInfo & info)112     void clear(const JSCallbackInfo& info) {}
113 };
114 
115 class JSMockAbstractProperty {
116 public:
get(panda::JsiRuntimeCallInfo * runtimeCallInfo)117     static panda::Local<panda::JSValueRef> get(panda::JsiRuntimeCallInfo* runtimeCallInfo)
118     {
119         EcmaVM *vm = runtimeCallInfo->GetVM();
120         return panda::JSValueRef::Undefined(vm);
121     }
set(panda::JsiRuntimeCallInfo * runtimeCallInfo)122     static panda::Local<panda::JSValueRef> set(panda::JsiRuntimeCallInfo* runtimeCallInfo)
123     {
124         EcmaVM *vm = runtimeCallInfo->GetVM();
125         return panda::JSValueRef::Undefined(vm);
126     }
info(panda::JsiRuntimeCallInfo * runtimeCallInfo)127     static panda::Local<panda::JSValueRef> info(panda::JsiRuntimeCallInfo* runtimeCallInfo)
128     {
129         EcmaVM *vm = runtimeCallInfo->GetVM();
130         return panda::JSValueRef::Undefined(vm);
131     }
132 };
133 
134 class JSMockSubAbstractProperty {
135 public:
get(panda::JsiRuntimeCallInfo * runtimeCallInfo)136     static panda::Local<panda::JSValueRef> get(panda::JsiRuntimeCallInfo* runtimeCallInfo)
137     {
138         EcmaVM *vm = runtimeCallInfo->GetVM();
139         return panda::JSValueRef::Undefined(vm);
140     }
set(panda::JsiRuntimeCallInfo * runtimeCallInfo)141     static panda::Local<panda::JSValueRef> set(panda::JsiRuntimeCallInfo* runtimeCallInfo)
142     {
143         EcmaVM *vm = runtimeCallInfo->GetVM();
144         return panda::JSValueRef::Undefined(vm);
145     }
info(panda::JsiRuntimeCallInfo * runtimeCallInfo)146     static panda::Local<panda::JSValueRef> info(panda::JsiRuntimeCallInfo* runtimeCallInfo)
147     {
148         EcmaVM *vm = runtimeCallInfo->GetVM();
149         return panda::JSValueRef::Undefined(vm);
150     }
aboutToBeDeleted(panda::JsiRuntimeCallInfo * runtimeCallInfo)151     static panda::Local<panda::JSValueRef> aboutToBeDeleted(panda::JsiRuntimeCallInfo* runtimeCallInfo)
152     {
153         EcmaVM *vm = runtimeCallInfo->GetVM();
154         return panda::JSValueRef::Undefined(vm);
155     }
156 };
157 
158 class JSMockDecorator {
159 public:
160     // @Entry
RegisterNamedRoute(panda::JsiRuntimeCallInfo * runtimeCallInfo)161     static panda::Local<panda::JSValueRef> RegisterNamedRoute(panda::JsiRuntimeCallInfo* runtimeCallInfo)
162     {
163         EcmaVM *vm = runtimeCallInfo->GetVM();
164         return panda::JSValueRef::Undefined(vm);
165     }
166     // V1 Decorator
Observed(panda::JsiRuntimeCallInfo * runtimeCallInfo)167     static panda::Local<panda::JSValueRef> Observed(panda::JsiRuntimeCallInfo* runtimeCallInfo)
168     {
169         EcmaVM *vm = runtimeCallInfo->GetVM();
170         return panda::JSValueRef::Undefined(vm);
171     }
Track(panda::JsiRuntimeCallInfo * runtimeCallInfo)172     static panda::Local<panda::JSValueRef> Track(panda::JsiRuntimeCallInfo* runtimeCallInfo)
173     {
174         EcmaVM *vm = runtimeCallInfo->GetVM();
175         return panda::JSValueRef::Undefined(vm);
176     }
Reusable(panda::JsiRuntimeCallInfo * runtimeCallInfo)177     static panda::Local<panda::JSValueRef> Reusable(panda::JsiRuntimeCallInfo* runtimeCallInfo)
178     {
179         EcmaVM *vm = runtimeCallInfo->GetVM();
180         return panda::JSValueRef::Undefined(vm);
181     }
182     // V2 Decorator
ObservedV2(panda::JsiRuntimeCallInfo * runtimeCallInfo)183     static panda::Local<panda::JSValueRef> ObservedV2(panda::JsiRuntimeCallInfo* runtimeCallInfo)
184     {
185         EcmaVM *vm = runtimeCallInfo->GetVM();
186         return panda::JSValueRef::Undefined(vm);
187     }
Trace(panda::JsiRuntimeCallInfo * runtimeCallInfo)188     static panda::Local<panda::JSValueRef> Trace(panda::JsiRuntimeCallInfo* runtimeCallInfo)
189     {
190         EcmaVM *vm = runtimeCallInfo->GetVM();
191         return panda::JSValueRef::Undefined(vm);
192     }
Local(panda::JsiRuntimeCallInfo * runtimeCallInfo)193     static panda::Local<panda::JSValueRef> Local(panda::JsiRuntimeCallInfo* runtimeCallInfo)
194     {
195         EcmaVM *vm = runtimeCallInfo->GetVM();
196         return panda::JSValueRef::Undefined(vm);
197     }
Param(panda::JsiRuntimeCallInfo * runtimeCallInfo)198     static panda::Local<panda::JSValueRef> Param(panda::JsiRuntimeCallInfo* runtimeCallInfo)
199     {
200         EcmaVM *vm = runtimeCallInfo->GetVM();
201         return panda::JSValueRef::Undefined(vm);
202     }
Once(panda::JsiRuntimeCallInfo * runtimeCallInfo)203     static panda::Local<panda::JSValueRef> Once(panda::JsiRuntimeCallInfo* runtimeCallInfo)
204     {
205         EcmaVM *vm = runtimeCallInfo->GetVM();
206         return panda::JSValueRef::Undefined(vm);
207     }
Event(panda::JsiRuntimeCallInfo * runtimeCallInfo)208     static panda::Local<panda::JSValueRef> Event(panda::JsiRuntimeCallInfo* runtimeCallInfo)
209     {
210         EcmaVM *vm = runtimeCallInfo->GetVM();
211         return panda::JSValueRef::Undefined(vm);
212     }
Computed(panda::JsiRuntimeCallInfo * runtimeCallInfo)213     static panda::Local<panda::JSValueRef> Computed(panda::JsiRuntimeCallInfo* runtimeCallInfo)
214     {
215         EcmaVM *vm = runtimeCallInfo->GetVM();
216         return panda::JSValueRef::Undefined(vm);
217     }
ReusableV2(panda::JsiRuntimeCallInfo * runtimeCallInfo)218     static panda::Local<panda::JSValueRef> ReusableV2(panda::JsiRuntimeCallInfo* runtimeCallInfo)
219     {
220         EcmaVM *vm = runtimeCallInfo->GetVM();
221         return panda::JSValueRef::Undefined(vm);
222     }
223 };
224 
225 class JsMockFunc {
226 public:
CreatFunction(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)227     static shared_ptr<JsValue> CreatFunction(const shared_ptr<JsRuntime>& runtime,
228         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
229     {
230         auto lamdaFunc = [](const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
231             const std::vector<shared_ptr<JsValue>>& argv, int32_t argc) -> shared_ptr<JsValue> {
232             return runtime->NewUndefined();
233         };
234         return runtime->NewFunction(lamdaFunc);
235     }
236 };
237 
238 class JSMockPersistStorage {
239 public:
persistProp(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)240     static shared_ptr<JsValue> persistProp(const shared_ptr<JsRuntime>& runtime,
241         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
242     {
243         return runtime->NewUndefined();
244     }
deleteProp(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)245     static shared_ptr<JsValue> deleteProp(const shared_ptr<JsRuntime>& runtime,
246         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
247     {
248         return runtime->NewUndefined();
249     }
persistProps(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)250     static shared_ptr<JsValue> persistProps(const shared_ptr<JsRuntime>& runtime,
251         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
252     {
253         return runtime->NewUndefined();
254     }
keys(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)255     static shared_ptr<JsValue> keys(const shared_ptr<JsRuntime>& runtime,
256         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
257     {
258         return runtime->NewUndefined();
259     }
260 };
261 
262 class JSMockAppStorage {
263 public:
264     static shared_ptr<JsValue> ref(const shared_ptr<JsRuntime>& runtime,
265         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
266     static shared_ptr<JsValue> setAndRef(const shared_ptr<JsRuntime>& runtime,
267         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
268     static shared_ptr<JsValue> link(const shared_ptr<JsRuntime>& runtime,
269         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
270     static shared_ptr<JsValue> setAndLink(const shared_ptr<JsRuntime>& runtime,
271         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
272     static shared_ptr<JsValue> prop(const shared_ptr<JsRuntime>& runtime,
273         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
274     static shared_ptr<JsValue> setAndProp(const shared_ptr<JsRuntime>& runtime,
275         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
has(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)276     static shared_ptr<JsValue> has(const shared_ptr<JsRuntime>& runtime,
277         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
278     {
279         return runtime->NewUndefined();
280     }
get(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)281     static shared_ptr<JsValue> get(const shared_ptr<JsRuntime>& runtime,
282         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
283     {
284         return runtime->NewUndefined();
285     }
set(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)286     static shared_ptr<JsValue> set(const shared_ptr<JsRuntime>& runtime,
287         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
288     {
289         return runtime->NewUndefined();
290     }
info(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)291     static shared_ptr<JsValue> info(const shared_ptr<JsRuntime>& runtime,
292         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
293     {
294         return runtime->NewUndefined();
295     }
aboutToBeDeleted(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)296     static shared_ptr<JsValue> aboutToBeDeleted(const shared_ptr<JsRuntime>& runtime,
297         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
298     {
299         return runtime->NewUndefined();
300     }
setOrCreate(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)301     static shared_ptr<JsValue> setOrCreate(const shared_ptr<JsRuntime>& runtime,
302         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
303     {
304         return runtime->NewUndefined();
305     }
deleteKeys(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)306     static shared_ptr<JsValue> deleteKeys(const shared_ptr<JsRuntime>& runtime,
307         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
308     {
309         return runtime->NewUndefined();
310     }
keys(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)311         static shared_ptr<JsValue> keys(const shared_ptr<JsRuntime>& runtime,
312         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
313     {
314         return runtime->NewUndefined();
315     }
clear(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)316     static shared_ptr<JsValue> clear(const shared_ptr<JsRuntime>& runtime,
317         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
318     {
319         return runtime->NewUndefined();
320     }
size(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)321     static shared_ptr<JsValue> size(const shared_ptr<JsRuntime>& runtime,
322         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
323     {
324         return runtime->NewUndefined();
325     }
326 };
327 
328 class JSMockEnvironment {
329 public:
envProp(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)330     static shared_ptr<JsValue> envProp(const shared_ptr<JsRuntime>& runtime,
331         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
332     {
333         return runtime->NewUndefined();
334     }
envProps(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)335     static shared_ptr<JsValue> envProps(const shared_ptr<JsRuntime>& runtime,
336         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
337     {
338         return runtime->NewUndefined();
339     }
keys(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)340     static shared_ptr<JsValue> keys(const shared_ptr<JsRuntime>& runtime,
341         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
342     {
343         return runtime->NewUndefined();
344     }
345 };
346 
347 class JSMockPersistenceV2 {
348 public:
connect(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)349     static shared_ptr<JsValue> connect(const shared_ptr<JsRuntime>& runtime,
350         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
351     {
352         return runtime->NewUndefined();
353     }
globalConnect(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)354     static shared_ptr<JsValue> globalConnect(const shared_ptr<JsRuntime>& runtime,
355         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
356     {
357         return runtime->NewUndefined();
358     }
remove(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)359     static shared_ptr<JsValue> remove(const shared_ptr<JsRuntime>& runtime,
360         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
361     {
362         return runtime->NewUndefined();
363     }
keys(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)364     static shared_ptr<JsValue> keys(const shared_ptr<JsRuntime>& runtime,
365         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
366     {
367         return runtime->NewUndefined();
368     }
save(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)369     static shared_ptr<JsValue> save(const shared_ptr<JsRuntime>& runtime,
370         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
371     {
372         return runtime->NewUndefined();
373     }
notifyOnError(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)374     static shared_ptr<JsValue> notifyOnError(const shared_ptr<JsRuntime>& runtime,
375         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
376     {
377         return runtime->NewUndefined();
378     }
379     static shared_ptr<JsValue> instanceFunc(const shared_ptr<JsRuntime>& runtime,
380         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
381 };
382 
383 class JSMockAppStorageV2 {
384 public:
connect(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)385     static shared_ptr<JsValue> connect(const shared_ptr<JsRuntime>& runtime,
386         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
387     {
388         return runtime->NewUndefined();
389     }
remove(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)390     static shared_ptr<JsValue> remove(const shared_ptr<JsRuntime>& runtime,
391         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
392     {
393         return runtime->NewUndefined();
394     }
getMemoryKeys(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)395     static shared_ptr<JsValue> getMemoryKeys(const shared_ptr<JsRuntime>& runtime,
396         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
397     {
398         return runtime->NewUndefined();
399     }
400     static shared_ptr<JsValue> instanceFunc(const shared_ptr<JsRuntime>& runtime,
401         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
402 };
403 
404 class JSMockUIUtils {
405 public:
getTarget(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)406     static shared_ptr<JsValue> getTarget(const shared_ptr<JsRuntime>& runtime,
407         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
408     {
409         return runtime->NewUndefined();
410     }
makeObserved(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)411     static shared_ptr<JsValue> makeObserved(const shared_ptr<JsRuntime>& runtime,
412         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
413     {
414         return runtime->NewUndefined();
415     }
makeV1Observed(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)416     static shared_ptr<JsValue> makeV1Observed(const shared_ptr<JsRuntime>& runtime,
417         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
418     {
419         return runtime->NewUndefined();
420     }
enableV2Compatibility(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)421     static shared_ptr<JsValue> enableV2Compatibility(const shared_ptr<JsRuntime>& runtime,
422         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
423     {
424         return runtime->NewUndefined();
425     }
426     static shared_ptr<JsValue> instanceFunc(const shared_ptr<JsRuntime>& runtime,
427         const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc);
428 };
429 class JSMockViewBuildNodeBase {
430 public:
431     JSMockViewBuildNodeBase() = default;
432     ~JSMockViewBuildNodeBase() = default;
433 
434     static void JSBind(BindingTarget globalObj);
ConstructorCallback(const JSCallbackInfo & info)435     static void ConstructorCallback(const JSCallbackInfo& info) {}
DestructorCallback(JSMockViewBuildNodeBase * node)436     static void DestructorCallback(JSMockViewBuildNodeBase* node) {}
SetArkThemeScopeManager(const JSCallbackInfo & info)437     static void SetArkThemeScopeManager(const JSCallbackInfo& info) {}
Id(const JSCallbackInfo & info)438     void Id(const JSCallbackInfo& info) {}
DebugInfo(const JSCallbackInfo & info)439     void DebugInfo(const JSCallbackInfo& info) {}
DebugInfoElmtId(const JSCallbackInfo & info)440     void DebugInfoElmtId(const JSCallbackInfo& info) {}
GetChildById(const JSCallbackInfo & info)441     void GetChildById(const JSCallbackInfo& info) {}
AddChild(const JSCallbackInfo & info)442     void AddChild(const JSCallbackInfo& info) {}
PurgeDeletedElmtIds(const JSCallbackInfo & info)443     void PurgeDeletedElmtIds(const JSCallbackInfo& info) {}
UpdateStateVarsOfChildByElmtId(const JSCallbackInfo & info)444     void UpdateStateVarsOfChildByElmtId(const JSCallbackInfo& info) {}
CreateOrGetNode(const JSCallbackInfo & info)445     void CreateOrGetNode(const JSCallbackInfo& info) {}
IfElseBranchUpdateFunction(const JSCallbackInfo & info)446     void IfElseBranchUpdateFunction(const JSCallbackInfo& info) {}
OnWillApplyThemeInternally(const JSCallbackInfo & info)447     void OnWillApplyThemeInternally(const JSCallbackInfo& info) {}
OnWillApplyTheme(const JSCallbackInfo & info)448     void OnWillApplyTheme(const JSCallbackInfo& info) {}
OnGlobalThemeChanged(const JSCallbackInfo & info)449     void OnGlobalThemeChanged(const JSCallbackInfo& info) {}
450 };
451 } // namespace OHOS::Ace::Framework
452 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_MOCK_H
453