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 EPOLL_MANAGER_TEST_H 17 #define EPOLL_MANAGER_TEST_H 18 #define private public 19 20 #include <fcntl.h> 21 22 #include <gtest/gtest.h> 23 24 #include "devicestatus_define.h" 25 #include "epoll_manager.h" 26 #include "i_epoll_event_source.h" 27 28 namespace OHOS { 29 namespace Msdp { 30 namespace DeviceStatus { 31 class MonitorEvent final : public IEpollEventSource { 32 public: 33 MonitorEvent(); 34 DISALLOW_COPY_AND_MOVE(MonitorEvent); 35 ~MonitorEvent(); 36 37 int32_t GetFd() const override; 38 void Dispatch(const struct epoll_event &ev) override; 39 int32_t SetTimer(); 40 public: 41 int32_t inotifyFd_ { -1 }; 42 }; 43 GetFd()44inline int32_t MonitorEvent::GetFd() const 45 { 46 return inotifyFd_; 47 } 48 49 class EpollManagerTest : public testing::Test { 50 public: 51 static void SetUpTestCase(); 52 static void TearDownTestCase(); 53 void SetUp(); 54 void TearDown(); 55 }; 56 } // namespace DeviceStatus 57 } // namespace Msdp 58 } // namespace OHOS 59 #endif // EPOLL_MANAGER_TEST_H