| Kelvin Zhang | b4b95c2 | 2021-04-05 15:56:26 -0400 | [diff] [blame] | 1 | // | 
|  | 2 | // Copyright (C) 2021 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 UPDATE_ENGINE_COMMON_MOCK_BOOT_CONTROL_H_ | 
|  | 18 | #define UPDATE_ENGINE_COMMON_MOCK_BOOT_CONTROL_H_ | 
|  | 19 |  | 
|  | 20 | #include <memory> | 
|  | 21 | #include <string> | 
|  | 22 |  | 
|  | 23 | #include <gmock/gmock.h> | 
|  | 24 |  | 
|  | 25 | #include "update_engine/common/boot_control_stub.h" | 
|  | 26 |  | 
|  | 27 | namespace chromeos_update_engine { | 
|  | 28 |  | 
|  | 29 | class MockBootControl final : public BootControlStub { | 
|  | 30 | public: | 
|  | 31 | MOCK_METHOD(bool, | 
|  | 32 | IsSlotMarkedSuccessful, | 
|  | 33 | (BootControlInterface::Slot), | 
|  | 34 | (const override)); | 
|  | 35 | MOCK_METHOD(unsigned int, GetNumSlots, (), (const override)); | 
|  | 36 | MOCK_METHOD(BootControlInterface::Slot, GetCurrentSlot, (), (const override)); | 
|  | 37 | MOCK_METHOD(bool, | 
|  | 38 | GetPartitionDevice, | 
|  | 39 | (const std::string&, Slot, bool, std::string*, bool*), | 
|  | 40 | (const override)); | 
|  | 41 | MOCK_METHOD(bool, | 
|  | 42 | GetPartitionDevice, | 
|  | 43 | (const std::string&, BootControlInterface::Slot, std::string*), | 
|  | 44 | (const override)); | 
|  | 45 | MOCK_METHOD(std::optional<PartitionDevice>, | 
|  | 46 | GetPartitionDevice, | 
|  | 47 | (const std::string&, uint32_t, uint32_t, bool), | 
|  | 48 | (const override)); | 
|  | 49 |  | 
|  | 50 | MOCK_METHOD(bool, | 
|  | 51 | IsSlotBootable, | 
|  | 52 | (BootControlInterface::Slot), | 
|  | 53 | (const override)); | 
|  | 54 | MOCK_METHOD(bool, | 
|  | 55 | MarkSlotUnbootable, | 
|  | 56 | (BootControlInterface::Slot), | 
|  | 57 | (override)); | 
|  | 58 | MOCK_METHOD(bool, | 
|  | 59 | SetActiveBootSlot, | 
|  | 60 | (BootControlInterface::Slot), | 
|  | 61 | (override)); | 
|  | 62 | MOCK_METHOD(bool, | 
|  | 63 | MarkBootSuccessfulAsync, | 
|  | 64 | (base::Callback<void(bool)>), | 
|  | 65 | (override)); | 
|  | 66 | MOCK_METHOD(DynamicPartitionControlInterface*, | 
|  | 67 | GetDynamicPartitionControl, | 
|  | 68 | (), | 
|  | 69 | (override)); | 
|  | 70 | }; | 
|  | 71 |  | 
|  | 72 | }  // namespace chromeos_update_engine | 
|  | 73 |  | 
|  | 74 | #endif  // UPDATE_ENGINE_COMMON_MOCK_BOOT_CONTROL_H_ |