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