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 
16 #ifndef SERVICES_DTBSCHEDMGR_TEST_UNITTEST_MISSION_DMS_MISSION_MANAGER_TEST_H
17 #define SERVICES_DTBSCHEDMGR_TEST_UNITTEST_MISSION_DMS_MISSION_MANAGER_TEST_H
18 
19 #include "gtest/gtest.h"
20 
21 #include "device_manager.h"
22 #include "remote_mission_listener_stub.h"
23 
24 #include "distributed_sched_interface.h"
25 #include "mock_distributed_sched_adapter.h"
26 
27 namespace OHOS {
28 namespace DistributedSchedule {
29 class DMSMissionManagerTest : public testing::Test {
30 public:
31     static void SetUpTestCase();
32     static void TearDownTestCase();
33     void SetUp() override;
34     void TearDown() override;
35 protected:
36     std::string localDeviceId_;
37     std::u16string u16localDeviceId_;
38     sptr<IDistributedSched> proxy_;
39     std::set<std::string> remoteSyncDeviceSet_;
40     sptr<IDistributedSched> GetDms();
41     static bool isCaseDone_;
42     static std::mutex caseDoneLock_;
43     static std::condition_variable caseDoneCondition_;
44     static inline std::shared_ptr<MockAdapter> mockDmsAdapter = nullptr;
45 
46     class DeviceInitCallBack : public OHOS::DistributedHardware::DmInitCallback {
47         void OnRemoteDied() override;
48     };
49 };
50 
51 class RemoteMissionListenerTest : public AAFwk::RemoteMissionListenerStub {
52 public:
53     void NotifyMissionsChanged(const std::string& deviceId) override;
54     void NotifySnapshot(const std::string& deviceId, int32_t missionId) override;
55     void NotifyNetDisconnect(const std::string& deviceId, int32_t state) override;
56 };
57 } // namespace DistributedSchedule
58 } // namespace OHOS
59 #endif /* SERVICES_DTBSCHEDMGR_TEST_UNITTEST_MISSION_DMS_MISSION_MANAGER_TEST_H */