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 "delegate_tasks.h"
29 #include "device_manager.h"
30 #include "devicestatus_define.h"
31 #include "devicestatus_delayed_sp_singleton.h"
32 #include "drag_manager.h"
33 #include "i_context.h"
34 #include "timer_manager.h"
35 
36 #include "intention_service.h"
37 #include "socket_session_manager.h"
38 
39 namespace OHOS {
40 namespace Msdp {
41 namespace DeviceStatus {
42 class ContextService final : public IContext {
43     ContextService();
44     ~ContextService();
45     DISALLOW_COPY_AND_MOVE(ContextService);
46 public:
47     IDelegateTasks& GetDelegateTasks() override;
48     IDeviceManager& GetDeviceManager() override;
49     ITimerManager& GetTimerManager() override;
50     IDragManager& GetDragManager() override;
51 
52     IPluginManager& GetPluginManager() override;
53     ISocketSessionManager& GetSocketSessionManager() override;
54     IInputAdapter& GetInput() override;
55     IDSoftbusAdapter& GetDSoftbus() override;
56     static ContextService* GetInstance();
57 };
58 
59 class MockPluginManager : public IPluginManager {
60 public:
61     explicit MockPluginManager(IContext *context);
62     ICooperate* LoadCooperate() override;
63     void UnloadCooperate() override;
64     IMotionDrag* LoadMotionDrag() override;
65     void UnloadMotionDrag() override;
66 private:
67     std::unique_ptr<IPluginManager> pluginMgr_;
68 };
69 
70 class CooperateTest : public testing::Test {
71 public:
72     static void SetUpTestCase();
73     void SetUp();
74     void TearDown();
75     static void TearDownTestCase(void);
76 };
77 } // namespace DeviceStatus
78 } // namespace Msdp
79 } // namespace OHOS
80 #endif // COOPERATE_PLUGIN_TEST_H
81