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 COOPERATE_PLUGIN_TEST_H 17 #define COOPERATE_PLUGIN_TEST_H 18 19 #include <gtest/gtest.h> 20 21 #include <fcntl.h> 22 #include <gtest/gtest.h> 23 #include <memory> 24 #include <string> 25 26 #include "nocopyable.h" 27 28 #include "cooperate_events.h" 29 #include "delegate_tasks.h" 30 #include "device_manager.h" 31 #include "devicestatus_define.h" 32 #include "devicestatus_delayed_sp_singleton.h" 33 #include "drag_manager.h" 34 #include "i_context.h" 35 #include "timer_manager.h" 36 37 #include "intention_service.h" 38 #include "socket_session_manager.h" 39 40 namespace OHOS { 41 namespace Msdp { 42 namespace DeviceStatus { 43 class ContextService final : public IContext { 44 ContextService(); 45 ~ContextService(); 46 DISALLOW_COPY_AND_MOVE(ContextService); 47 public: 48 IDelegateTasks& GetDelegateTasks() override; 49 IDeviceManager& GetDeviceManager() override; 50 ITimerManager& GetTimerManager() override; 51 IDragManager& GetDragManager() override; 52 53 IPluginManager& GetPluginManager() override; 54 ISocketSessionManager& GetSocketSessionManager() override; 55 IInputAdapter& GetInput() override; 56 IDSoftbusAdapter& GetDSoftbus() override; 57 static ContextService* GetInstance(); 58 DeviceManager devMgr_; 59 }; 60 61 class CooperatePluginTest : public testing::Test { 62 public: 63 static void SetUpTestCase(); 64 void SetUp(); 65 void TearDown(); 66 void SetIContext(IContext *context); 67 MMI::PointerEvent::PointerItem CreatePointerItem(int32_t pointerId, int32_t deviceId, 68 const std::pair<int32_t, int32_t> &displayLocation, bool isPressed); 69 void NotifyCooperate(); 70 void CheckInHot(); 71 void OnThreeStates(const Cooperate::CooperateEvent &event); 72 }; 73 } // namespace DeviceStatus 74 } // namespace Msdp 75 } // namespace OHOS 76 #endif // COOPERATE_PLUGIN_TEST_H 77