xref: /aosp_15_r20/system/core/fastboot/fastboot_driver_mock.h (revision 00c7fec1bb09f3284aad6a6f96d2f63dfc3650ad)
1 //
2 // Copyright (C) 2023 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 #pragma once
17 
18 #include <gmock/gmock.h>
19 #include "fastboot_driver_interface.h"
20 
21 namespace fastboot {
22 
23 class MockFastbootDriver : public IFastBootDriver {
24   public:
25     MOCK_METHOD(RetCode, FlashPartition, (const std::string&, android::base::borrowed_fd, uint32_t),
26                 (override));
27     MOCK_METHOD(RetCode, DeletePartition, (const std::string&), (override));
28     MOCK_METHOD(RetCode, Reboot, (std::string*, std::vector<std::string>*), (override));
29     MOCK_METHOD(RetCode, RebootTo, (std::string, std::string*, std::vector<std::string>*),
30                 (override));
31     MOCK_METHOD(RetCode, GetVar, (const std::string&, std::string*, std::vector<std::string>*),
32                 (override));
33     MOCK_METHOD(RetCode, FetchToFd,
34                 (const std::string&, android::base::borrowed_fd, int64_t offset, int64_t size,
35                  std::string*, std::vector<std::string>*),
36                 (override));
37     MOCK_METHOD(RetCode, Download,
38                 (const std::string&, android::base::borrowed_fd, size_t, std::string*,
39                  std::vector<std::string>*),
40                 (override));
41     MOCK_METHOD(RetCode, RawCommand,
42                 (const std::string&, const std::string&, std::string*, std::vector<std::string>*,
43                  int*),
44                 (override));
45     MOCK_METHOD(RetCode, ResizePartition, (const std::string&, const std::string&), (override));
46     MOCK_METHOD(RetCode, Erase, (const std::string&, std::string*, std::vector<std::string>*),
47                 (override));
48     MOCK_METHOD(RetCode, WaitForDisconnect, (), (override));
49 };
50 
51 }  // namespace fastboot