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 
26 namespace OHOS {
27 namespace DistributedSchedule {
28 class DMSMissionManagerTest : public testing::Test {
29 public:
30     static void SetUpTestCase();
31     static void TearDownTestCase();
32     void SetUp() override;
33     void TearDown() override;
34 protected:
35     std::string localDeviceId_;
36     std::u16string u16localDeviceId_;
37     sptr<IDistributedSched> proxy_;
38     std::set<std::string> remoteSyncDeviceSet_;
39     sptr<IDistributedSched> GetDms();
40     static bool isCaseDone_;
41     static std::mutex caseDoneLock_;
42     static std::condition_variable caseDoneCondition_;
43 
44     class DeviceInitCallBack : public OHOS::DistributedHardware::DmInitCallback {
45         void OnRemoteDied() override;
46     };
47 };
48 
49 class RemoteMissionListenerTest : public AAFwk::RemoteMissionListenerStub {
50 public:
51     void NotifyMissionsChanged(const std::string& deviceId) override;
52     void NotifySnapshot(const std::string& deviceId, int32_t missionId) override;
53     void NotifyNetDisconnect(const std::string& deviceId, int32_t state) override;
54 };
55 } // namespace DistributedSchedule
56 } // namespace OHOS
57 #endif /* SERVICES_DTBSCHEDMGR_TEST_UNITTEST_MISSION_DMS_MISSION_MANAGER_TEST_H */