1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef TESTS_MOCK_OS_H_ 18 #define TESTS_MOCK_OS_H_ 19 20 #include <string> 21 #include <tuple> 22 23 #include "android-base/macros.h" 24 #include "gmock/gmock.h" 25 26 #include "wifilogd/os.h" 27 28 namespace android { 29 namespace wifilogd { 30 31 class MockOs : public Os { 32 public: 33 MockOs(); 34 ~MockOs() override; 35 36 MOCK_CONST_METHOD1(GetTimestamp, Timestamp(clockid_t clock_id)); 37 MOCK_METHOD1(GetControlSocket, 38 std::tuple<int, Errno>(const std::string& socket_name)); 39 MOCK_METHOD1(Nanosleep, void(uint32_t sleep_time_nsec)); 40 MOCK_METHOD3(ReceiveDatagram, 41 std::tuple<size_t, Errno>(int fd, void* buf, size_t buflen)); 42 MOCK_METHOD3(Write, std::tuple<size_t, Os::Errno>(int fd, const void* buf, 43 size_t buflen)); 44 45 private: 46 DISALLOW_COPY_AND_ASSIGN(MockOs); 47 }; 48 49 } // namespace wifilogd 50 } // namespace android 51 52 #endif // TESTS_MOCK_OS_H_ 53