blob: 79909b4dd93516e750b580b92ae849e3309e5f6f [file] [log] [blame]
Kelvin Zhang44858972020-11-11 09:25:01 -05001//
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>
David Andersona4b7ba62023-05-10 21:41:37 -070025#include <libsnapshot/cow_writer.h>
Kelvin Zhang44858972020-11-11 09:25:01 -050026
27#include "update_engine/common/dynamic_partition_control_interface.h"
28#include "update_engine/payload_consumer/file_descriptor.h"
29
30namespace chromeos_update_engine {
31
32class MockDynamicPartitionControl : public DynamicPartitionControlInterface {
33 public:
34 MOCK_METHOD(void, Cleanup, (), (override));
35 MOCK_METHOD(bool, GetDeviceDir, (std::string*), (override));
36 MOCK_METHOD(FeatureFlag, GetDynamicPartitionsFeatureFlag, (), (override));
37 MOCK_METHOD(FeatureFlag, GetVirtualAbCompressionFeatureFlag, (), (override));
Kelvin Zhang1c4b9812022-04-06 17:29:00 -070038 MOCK_METHOD(FeatureFlag,
39 GetVirtualAbCompressionXorFeatureFlag,
40 (),
41 (override));
David Andersone35b4382022-03-08 23:18:29 -080042 MOCK_METHOD(FeatureFlag,
43 GetVirtualAbUserspaceSnapshotsFeatureFlag,
44 (),
45 (override));
Kelvin Zhang44858972020-11-11 09:25:01 -050046 MOCK_METHOD(FeatureFlag, GetVirtualAbFeatureFlag, (), (override));
47 MOCK_METHOD(bool, FinishUpdate, (bool), (override));
Kelvin Zhang1a0ed712022-01-26 16:09:05 -080048 MOCK_METHOD(std::unique_ptr<FileDescriptor>,
Kelvin Zhang21a49912021-03-12 14:28:33 -050049 OpenCowFd,
Kelvin Zhang44858972020-11-11 09:25:01 -050050 (const std::string& unsuffixed_partition_name,
51 const std::optional<std::string>& source_path,
52 bool is_append),
53 (override));
54 MOCK_METHOD(bool, MapAllPartitions, (), (override));
55 MOCK_METHOD(bool, UnmapAllPartitions, (), (override));
56
57 MOCK_METHOD(bool,
58 OptimizeOperation,
59 (const std::string&, const InstallOperation&, InstallOperation*),
60 (override));
61
David Andersona4b7ba62023-05-10 21:41:37 -070062 MOCK_METHOD(std::unique_ptr<android::snapshot::ICowWriter>,
Kelvin Zhang76f10b82021-06-25 18:45:46 -040063 OpenCowWriter,
David Andersona4b7ba62023-05-10 21:41:37 -070064 (const std::string&,
65 const std::optional<std::string>&,
66 std::optional<uint64_t> label),
Kelvin Zhang76f10b82021-06-25 18:45:46 -040067 (override));
Kelvin Zhang44858972020-11-11 09:25:01 -050068
69 MOCK_METHOD(
70 bool,
71 PreparePartitionsForUpdate,
72 (uint32_t, uint32_t, const DeltaArchiveManifest&, bool, uint64_t*),
73 (override));
74
75 MOCK_METHOD(bool, ResetUpdate, (PrefsInterface*), (override));
76 MOCK_METHOD(std::unique_ptr<AbstractAction>,
77 GetCleanupPreviousUpdateAction,
78 (BootControlInterface*,
79 PrefsInterface*,
80 CleanupPreviousUpdateActionDelegateInterface*),
81 (override));
82 MOCK_METHOD(bool,
83 ListDynamicPartitionsForSlot,
Tianjie3a55fc22021-02-13 16:02:22 -080084 (uint32_t, uint32_t, std::vector<std::string>*),
Kelvin Zhang44858972020-11-11 09:25:01 -050085 (override));
Tianjie3a55fc22021-02-13 16:02:22 -080086
Kelvin Zhang44858972020-11-11 09:25:01 -050087 MOCK_METHOD(bool,
88 VerifyExtentsForUntouchedPartitions,
89 (uint32_t, uint32_t, const std::vector<std::string>&),
90 (override));
Kelvin Zhangebd115e2021-03-08 16:10:25 -050091 MOCK_METHOD(bool,
92 IsDynamicPartition,
93 (const std::string&, uint32_t slot),
94 (override));
Yifan Hongb0cbd392021-02-04 11:11:45 -080095 MOCK_METHOD(bool, UpdateUsesSnapshotCompression, (), (override));
Kelvin Zhang44858972020-11-11 09:25:01 -050096};
97
98} // namespace chromeos_update_engine