1 /* 2 * Copyright (C) 2021 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 #ifndef MOCK_SYSTEM_UI_H 16 #define MOCK_SYSTEM_UI_H 17 #include <any> 18 #include "wifi_log.h" 19 20 #ifdef INCLUDE_SYSTEMUI_MODULE 21 std::any &GetVerityModuleV2(); 22 #endif 23 24 namespace OHOS { 25 namespace Wifi { 26 class AlertDialog { 27 public: AlertDialog()28 AlertDialog() 29 {} ~AlertDialog()30 virtual ~AlertDialog() 31 {} SetTitle(const std::string value)32 virtual void SetTitle(const std::string value) 33 { 34 LOGI("value:%{public}s", value.c_str()); 35 } SetMessage(const std::string msg)36 virtual void SetMessage(const std::string msg) 37 { 38 LOGI("value:%{private}s", msg.c_str()); 39 } SetInputBox(const std::string txt)40 virtual void SetInputBox(const std::string txt) 41 { 42 LOGI("value:%{private}s", txt.c_str()); 43 } GetInputBox(const std::string txt)44 virtual std::string GetInputBox(const std::string txt) 45 { 46 LOGI("value:%{private}s", txt.c_str()); 47 return ""; 48 } SetButton(const std::string txt,std::function<void (AlertDialog &,std::any)> & buttonEvent,std::any ctx)49 virtual void SetButton( 50 const std::string txt, std::function<void(AlertDialog &, std::any)> &buttonEvent, std::any ctx) 51 { 52 LOGI("value:%{public}s", txt.c_str()); 53 AlertDialog log; 54 buttonEvent(log, ctx); 55 } 56 }; 57 58 class AbstractUI { 59 public: AbstractUI()60 AbstractUI() 61 {} ~AbstractUI()62 virtual ~AbstractUI() 63 {} GetInstance()64 static AbstractUI &GetInstance() 65 { 66 #ifdef INCLUDE_SYSTEMUI_MODULE 67 static AbstractUI &instance = reinterpret_cast<AbstractUI &>(GetVerityModuleV2()); 68 instance.StartInit(); 69 #else 70 static AbstractUI instance; 71 #endif 72 return instance; 73 } StartInit()74 virtual void StartInit() 75 {} Build()76 virtual AlertDialog &Build() 77 { 78 static AlertDialog p; 79 return p; 80 } ShowAlerDialog(AlertDialog & alertDialog)81 virtual void ShowAlerDialog(AlertDialog &alertDialog) 82 { 83 alertDialog.SetTitle("value"); 84 } DestroyAlerDialog(AlertDialog & alertDialog)85 virtual void DestroyAlerDialog(AlertDialog &alertDialog) 86 { 87 alertDialog.SetTitle("value"); 88 } UnInit()89 virtual void UnInit(){}; 90 }; 91 } // namespace Wifi 92 } // namespace OHOS 93 #endif // MOCK_SYSTEM_UI_H