Kelvin Zhang | 4485897 | 2020-11-11 09:25:01 -0500 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2018 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 <stdint.h> |
| 18 | |
| 19 | #include <memory> |
| 20 | #include <set> |
| 21 | #include <string> |
| 22 | #include <vector> |
| 23 | |
| 24 | #include <gmock/gmock.h> |
| 25 | |
| 26 | #include "update_engine/common/dynamic_partition_control_interface.h" |
| 27 | #include "update_engine/payload_consumer/file_descriptor.h" |
| 28 | |
| 29 | namespace chromeos_update_engine { |
| 30 | |
| 31 | class MockDynamicPartitionControl : public DynamicPartitionControlInterface { |
| 32 | public: |
| 33 | MOCK_METHOD(void, Cleanup, (), (override)); |
| 34 | MOCK_METHOD(bool, GetDeviceDir, (std::string*), (override)); |
| 35 | MOCK_METHOD(FeatureFlag, GetDynamicPartitionsFeatureFlag, (), (override)); |
| 36 | MOCK_METHOD(FeatureFlag, GetVirtualAbCompressionFeatureFlag, (), (override)); |
| 37 | MOCK_METHOD(FeatureFlag, GetVirtualAbFeatureFlag, (), (override)); |
| 38 | MOCK_METHOD(bool, FinishUpdate, (bool), (override)); |
| 39 | MOCK_METHOD(FileDescriptorPtr, |
Kelvin Zhang | 21a4991 | 2021-03-12 14:28:33 -0500 | [diff] [blame] | 40 | OpenCowFd, |
Kelvin Zhang | 4485897 | 2020-11-11 09:25:01 -0500 | [diff] [blame] | 41 | (const std::string& unsuffixed_partition_name, |
| 42 | const std::optional<std::string>& source_path, |
| 43 | bool is_append), |
| 44 | (override)); |
| 45 | MOCK_METHOD(bool, MapAllPartitions, (), (override)); |
| 46 | MOCK_METHOD(bool, UnmapAllPartitions, (), (override)); |
| 47 | |
| 48 | MOCK_METHOD(bool, |
| 49 | OptimizeOperation, |
| 50 | (const std::string&, const InstallOperation&, InstallOperation*), |
| 51 | (override)); |
| 52 | |
Kelvin Zhang | 76f10b8 | 2021-06-25 18:45:46 -0400 | [diff] [blame^] | 53 | MOCK_METHOD(std::unique_ptr<android::snapshot::ISnapshotWriter>, |
| 54 | OpenCowWriter, |
| 55 | (const std::string&, const std::optional<std::string>&, bool), |
| 56 | (override)); |
Kelvin Zhang | 4485897 | 2020-11-11 09:25:01 -0500 | [diff] [blame] | 57 | |
| 58 | MOCK_METHOD( |
| 59 | bool, |
| 60 | PreparePartitionsForUpdate, |
| 61 | (uint32_t, uint32_t, const DeltaArchiveManifest&, bool, uint64_t*), |
| 62 | (override)); |
| 63 | |
| 64 | MOCK_METHOD(bool, ResetUpdate, (PrefsInterface*), (override)); |
| 65 | MOCK_METHOD(std::unique_ptr<AbstractAction>, |
| 66 | GetCleanupPreviousUpdateAction, |
| 67 | (BootControlInterface*, |
| 68 | PrefsInterface*, |
| 69 | CleanupPreviousUpdateActionDelegateInterface*), |
| 70 | (override)); |
| 71 | MOCK_METHOD(bool, |
| 72 | ListDynamicPartitionsForSlot, |
Tianjie | 3a55fc2 | 2021-02-13 16:02:22 -0800 | [diff] [blame] | 73 | (uint32_t, uint32_t, std::vector<std::string>*), |
Kelvin Zhang | 4485897 | 2020-11-11 09:25:01 -0500 | [diff] [blame] | 74 | (override)); |
Tianjie | 3a55fc2 | 2021-02-13 16:02:22 -0800 | [diff] [blame] | 75 | |
Kelvin Zhang | 4485897 | 2020-11-11 09:25:01 -0500 | [diff] [blame] | 76 | MOCK_METHOD(bool, |
| 77 | VerifyExtentsForUntouchedPartitions, |
| 78 | (uint32_t, uint32_t, const std::vector<std::string>&), |
| 79 | (override)); |
Kelvin Zhang | ebd115e | 2021-03-08 16:10:25 -0500 | [diff] [blame] | 80 | MOCK_METHOD(bool, |
| 81 | IsDynamicPartition, |
| 82 | (const std::string&, uint32_t slot), |
| 83 | (override)); |
Yifan Hong | b0cbd39 | 2021-02-04 11:11:45 -0800 | [diff] [blame] | 84 | MOCK_METHOD(bool, UpdateUsesSnapshotCompression, (), (override)); |
Kelvin Zhang | 4485897 | 2020-11-11 09:25:01 -0500 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | } // namespace chromeos_update_engine |