Shawn McCarney | 76c14c3 | 2020-07-15 10:10:20 -0500 | [diff] [blame] | 1 | /** |
| 2 | * Copyright © 2020 IBM Corporation |
| 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 | #pragma once |
| 17 | |
| 18 | #include "error_logging.hpp" |
Shawn McCarney | 5dab5d3 | 2021-08-28 11:02:14 -0500 | [diff] [blame] | 19 | #include "phase_fault.hpp" |
Shawn McCarney | 76c14c3 | 2020-07-15 10:10:20 -0500 | [diff] [blame] | 20 | |
| 21 | #include <gmock/gmock.h> |
| 22 | |
| 23 | namespace phosphor::power::regulators |
| 24 | { |
| 25 | |
| 26 | /** |
| 27 | * @class MockErrorLogging |
| 28 | * |
| 29 | * Mock implementation of the ErrorLogging interface. |
| 30 | */ |
| 31 | class MockErrorLogging : public ErrorLogging |
| 32 | { |
| 33 | public: |
| 34 | // Specify which compiler-generated methods we want |
| 35 | MockErrorLogging() = default; |
| 36 | MockErrorLogging(const MockErrorLogging&) = delete; |
| 37 | MockErrorLogging(MockErrorLogging&&) = delete; |
| 38 | MockErrorLogging& operator=(const MockErrorLogging&) = delete; |
| 39 | MockErrorLogging& operator=(MockErrorLogging&&) = delete; |
| 40 | virtual ~MockErrorLogging() = default; |
| 41 | |
Shawn McCarney | 1df5954 | 2020-09-24 18:43:18 -0500 | [diff] [blame] | 42 | MOCK_METHOD(void, logConfigFileError, |
| 43 | (Entry::Level severity, Journal& journal), (override)); |
| 44 | |
| 45 | MOCK_METHOD(void, logDBusError, (Entry::Level severity, Journal& journal), |
| 46 | (override)); |
| 47 | |
| 48 | MOCK_METHOD(void, logI2CError, |
| 49 | (Entry::Level severity, Journal& journal, |
| 50 | const std::string& bus, uint8_t addr, int errorNumber), |
| 51 | (override)); |
| 52 | |
| 53 | MOCK_METHOD(void, logInternalError, |
| 54 | (Entry::Level severity, Journal& journal), (override)); |
| 55 | |
Shawn McCarney | 5dab5d3 | 2021-08-28 11:02:14 -0500 | [diff] [blame] | 56 | MOCK_METHOD(void, logPhaseFault, |
| 57 | (Entry::Level severity, Journal& journal, PhaseFaultType type, |
| 58 | const std::string& inventoryPath, |
| 59 | (std::map<std::string, std::string> additionalData)), |
| 60 | (override)); |
| 61 | |
Shawn McCarney | 1df5954 | 2020-09-24 18:43:18 -0500 | [diff] [blame] | 62 | MOCK_METHOD(void, logPMBusError, |
| 63 | (Entry::Level severity, Journal& journal, |
| 64 | const std::string& inventoryPath), |
| 65 | (override)); |
| 66 | |
| 67 | MOCK_METHOD(void, logWriteVerificationError, |
| 68 | (Entry::Level severity, Journal& journal, |
| 69 | const std::string& inventoryPath), |
| 70 | (override)); |
Shawn McCarney | 76c14c3 | 2020-07-15 10:10:20 -0500 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | } // namespace phosphor::power::regulators |