| #pragma once | |
| #include "boot_manager.hpp" | |
| #include "utils.hpp" | |
| #include <cstdint> | |
| #include <memory> | |
| #include <optional> | |
| #include <string_view> | |
| #include <gmock/gmock.h> | |
| namespace boot_time_monitor | |
| { | |
| class MockUtil : public UtilIface | |
| { | |
| public: | |
| MOCK_METHOD(std::optional<int64_t>, getUpTimeInMs, (), (override)); | |
| MOCK_METHOD(int64_t, getWallTimeInMs, (), (override)); | |
| MOCK_METHOD(bool, isValidName, (std::string_view), (override)); | |
| MOCK_METHOD(std::string, getCPPath, (std::string_view, bool), (override)); | |
| MOCK_METHOD(std::string, getDurPath, (std::string_view, bool), (override)); | |
| MOCK_METHOD(std::optional<uint32_t>, readMem4Bytes, (uint32_t), (override)); | |
| }; | |
| class MockFileUtil : public FileUtilIface | |
| { | |
| public: | |
| MOCK_METHOD(void, addCheckpoint, | |
| (std::string_view name, int64_t wallTimeInMs, | |
| int64_t monoTimeInMs), | |
| (override)); | |
| MOCK_METHOD(void, addDuration, | |
| (std::string_view name, int64_t durationInMs), (override)); | |
| MOCK_METHOD(void, completeCurrent, (), (override)); | |
| MOCK_METHOD(std::unique_ptr<std::vector<Checkpoint>>, loadCheckpoints, | |
| (bool), (override)); | |
| MOCK_METHOD(std::unique_ptr<std::vector<Duration>>, loadDurations, (bool), | |
| (override)); | |
| MOCK_METHOD(bool, isEmpty, (), (override)); | |
| }; | |
| class MockBootManager : public BootManagerIface | |
| { | |
| MOCK_METHOD(void, setCheckpoint, | |
| (std::string_view cpName, int64_t externalWallTime, | |
| int64_t duration), | |
| (override)); | |
| MOCK_METHOD(void, setDuration, (std::string_view durName, int64_t duration), | |
| (override)); | |
| MOCK_METHOD(void, notifyComplete, (), (override)); | |
| MOCK_METHOD(bool, isRebooting, (), (override)); | |
| MOCK_METHOD((const std::vector<Checkpoint>&), getCheckpoints, (), | |
| (const, override)); | |
| MOCK_METHOD((const std::vector<Duration>&), getDurations, (), | |
| (const, override)); | |
| MOCK_METHOD((const std::vector<Checkpoint>&), getPreCheckpoints, (), | |
| (const, override)); | |
| MOCK_METHOD((const std::vector<Duration>&), getPreDurations, (), | |
| (const, override)); | |
| }; | |
| } // namespace boot_time_monitor |