• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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,
38               GetVirtualAbCompressionXorFeatureFlag,
39               (),
40               (override));
41   MOCK_METHOD(FeatureFlag,
42               GetVirtualAbUserspaceSnapshotsFeatureFlag,
43               (),
44               (override));
45   MOCK_METHOD(FeatureFlag, GetVirtualAbFeatureFlag, (), (override));
46   MOCK_METHOD(bool, FinishUpdate, (bool), (override));
47   MOCK_METHOD(std::unique_ptr<FileDescriptor>,
48               OpenCowFd,
49               (const std::string& unsuffixed_partition_name,
50                const std::optional<std::string>& source_path,
51                bool is_append),
52               (override));
53   MOCK_METHOD(bool, MapAllPartitions, (), (override));
54   MOCK_METHOD(bool, UnmapAllPartitions, (), (override));
55 
56   MOCK_METHOD(bool,
57               OptimizeOperation,
58               (const std::string&, const InstallOperation&, InstallOperation*),
59               (override));
60 
61   MOCK_METHOD(std::unique_ptr<android::snapshot::ISnapshotWriter>,
62               OpenCowWriter,
63               (const std::string&, const std::optional<std::string>&, bool),
64               (override));
65 
66   MOCK_METHOD(
67       bool,
68       PreparePartitionsForUpdate,
69       (uint32_t, uint32_t, const DeltaArchiveManifest&, bool, uint64_t*),
70       (override));
71 
72   MOCK_METHOD(bool, ResetUpdate, (PrefsInterface*), (override));
73   MOCK_METHOD(std::unique_ptr<AbstractAction>,
74               GetCleanupPreviousUpdateAction,
75               (BootControlInterface*,
76                PrefsInterface*,
77                CleanupPreviousUpdateActionDelegateInterface*),
78               (override));
79   MOCK_METHOD(bool,
80               ListDynamicPartitionsForSlot,
81               (uint32_t, uint32_t, std::vector<std::string>*),
82               (override));
83 
84   MOCK_METHOD(bool,
85               VerifyExtentsForUntouchedPartitions,
86               (uint32_t, uint32_t, const std::vector<std::string>&),
87               (override));
88   MOCK_METHOD(bool,
89               IsDynamicPartition,
90               (const std::string&, uint32_t slot),
91               (override));
92   MOCK_METHOD(bool, UpdateUsesSnapshotCompression, (), (override));
93 };
94 
95 }  // namespace chromeos_update_engine
96