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 #include <gmock/gmock.h> 18 #include <libsnapshot/cow_writer.h> 19 20 namespace android::snapshot { 21 22 class MockCowWriter : public ICowWriter { 23 public: 24 using FileDescriptor = chromeos_update_engine::FileDescriptor; 25 26 MOCK_METHOD(bool, Finalize, (), (override)); 27 MOCK_METHOD(CowSizeInfo, GetCowSizeInfo, (), (const, override)); 28 29 MOCK_METHOD(bool, AddCopy, (uint64_t, uint64_t, uint64_t), (override)); 30 MOCK_METHOD(bool, AddRawBlocks, (uint64_t, const void*, size_t), (override)); 31 MOCK_METHOD(bool, AddXorBlocks, (uint32_t, const void*, size_t, uint32_t, uint16_t), 32 (override)); 33 MOCK_METHOD(bool, AddZeroBlocks, (uint64_t, uint64_t), (override)); 34 MOCK_METHOD(bool, AddLabel, (uint64_t), (override)); 35 MOCK_METHOD(bool, AddSequenceData, (size_t, const uint32_t*), (override)); 36 MOCK_METHOD(uint32_t, GetBlockSize, (), (override, const)); 37 MOCK_METHOD(std::optional<uint32_t>, GetMaxBlocks, (), (override, const)); 38 39 MOCK_METHOD(std::unique_ptr<ICowReader>, OpenReader, (), (override)); 40 MOCK_METHOD(std::unique_ptr<FileDescriptor>, OpenFileDescriptor, 41 (const std::optional<std::string>&), (override)); 42 }; 43 44 } // namespace android::snapshot 45