test: Replace the C++ MOCK_METHOD<n> macros with the new MOCK_METHOD

Change-Id: I5099c727e9e918f19fa61acc91ef75250ebc6fa6
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/bmc/firmware-handler/test/crc_mock.hpp b/bmc/firmware-handler/test/crc_mock.hpp
index 293ec24..c33188d 100644
--- a/bmc/firmware-handler/test/crc_mock.hpp
+++ b/bmc/firmware-handler/test/crc_mock.hpp
@@ -18,6 +18,6 @@
 {
   public:
     virtual ~CrcMock() = default;
-    MOCK_CONST_METHOD1(generateCrc,
-                       std::uint16_t(const std::vector<std::uint8_t>&));
+    MOCK_METHOD(std::uint16_t, generateCrc, (const std::vector<std::uint8_t>&),
+                (const, override));
 };
diff --git a/bmc/firmware-handler/test/data_mock.hpp b/bmc/firmware-handler/test/data_mock.hpp
index c8109ad..ad41e63 100644
--- a/bmc/firmware-handler/test/data_mock.hpp
+++ b/bmc/firmware-handler/test/data_mock.hpp
@@ -12,11 +12,13 @@
   public:
     virtual ~DataHandlerMock() = default;
 
-    MOCK_METHOD0(open, bool());
-    MOCK_METHOD0(close, bool());
-    MOCK_METHOD1(copyFrom, std::vector<std::uint8_t>(std::uint32_t));
-    MOCK_METHOD1(writeMeta, bool(const std::vector<std::uint8_t>&));
-    MOCK_METHOD0(readMeta, std::vector<std::uint8_t>());
+    MOCK_METHOD(bool, open, (), (override));
+    MOCK_METHOD(bool, close, (), (override));
+    MOCK_METHOD(std::vector<std::uint8_t>, copyFrom, (std::uint32_t),
+                (override));
+    MOCK_METHOD(bool, writeMeta, (const std::vector<std::uint8_t>&),
+                (override));
+    MOCK_METHOD(std::vector<std::uint8_t>, readMeta, (), (override));
 };
 
 } // namespace ipmi_flash
diff --git a/bmc/firmware-handler/test/window_mapper_mock.hpp b/bmc/firmware-handler/test/window_mapper_mock.hpp
index dd3a89b..3983943 100644
--- a/bmc/firmware-handler/test/window_mapper_mock.hpp
+++ b/bmc/firmware-handler/test/window_mapper_mock.hpp
@@ -16,9 +16,10 @@
   public:
     virtual ~HardwareInterfaceMock() = default;
 
-    MOCK_METHOD0(open, MemorySet());
-    MOCK_METHOD0(close, ());
-    MOCK_METHOD2(mapWindow, WindowMapResult(std::uint32_t, std::uint32_t));
+    MOCK_METHOD(MemorySet, open, (), (override));
+    MOCK_METHOD(void, close, (), (override));
+    MOCK_METHOD(WindowMapResult, mapWindow, (std::uint32_t, std::uint32_t),
+                (override));
 };
 
 } // namespace ipmi_flash
diff --git a/bmc/test/image_mock.hpp b/bmc/test/image_mock.hpp
index 1d4f726..9999f58 100644
--- a/bmc/test/image_mock.hpp
+++ b/bmc/test/image_mock.hpp
@@ -13,12 +13,14 @@
 {
   public:
     virtual ~ImageHandlerMock() = default;
-    MOCK_METHOD2(open, bool(const std::string&, std::ios_base::openmode));
-    MOCK_METHOD0(close, void());
-    MOCK_METHOD2(write, bool(std::uint32_t, const std::vector<std::uint8_t>&));
-    MOCK_METHOD2(read, std::optional<std::vector<std::uint8_t>>(std::uint32_t,
-                                                                std::uint32_t));
-    MOCK_METHOD0(getSize, int());
+    MOCK_METHOD(bool, open, (const std::string&, std::ios_base::openmode),
+                (override));
+    MOCK_METHOD(void, close, (), (override));
+    MOCK_METHOD(bool, write, (std::uint32_t, const std::vector<std::uint8_t>&),
+                (override));
+    MOCK_METHOD(std::optional<std::vector<std::uint8_t>>, read,
+                (std::uint32_t, std::uint32_t), (override));
+    MOCK_METHOD(int, getSize, (), (override));
 };
 
 std::unique_ptr<ImageHandlerMock> CreateImageMock()
diff --git a/bmc/test/triggerable_mock.hpp b/bmc/test/triggerable_mock.hpp
index de2b025..0db90ee 100644
--- a/bmc/test/triggerable_mock.hpp
+++ b/bmc/test/triggerable_mock.hpp
@@ -15,9 +15,10 @@
 class TriggerMock : public TriggerableActionInterface
 {
   public:
-    MOCK_METHOD0(trigger, bool());
-    MOCK_METHOD0(abort, void());
-    MOCK_METHOD0(status, ActionStatus());
+    MOCK_METHOD(bool, trigger, (), (override));
+    MOCK_METHOD(void, abort, (), (override));
+    MOCK_METHOD(ActionStatus, status, (), (override));
+
     using TriggerableActionInterface::cb;
 };
 
diff --git a/cleanup/test/filesystem_mock.hpp b/cleanup/test/filesystem_mock.hpp
index 76a45c1..1ce9109 100644
--- a/cleanup/test/filesystem_mock.hpp
+++ b/cleanup/test/filesystem_mock.hpp
@@ -12,6 +12,6 @@
 class FileSystemMock : public FileSystemInterface
 {
   public:
-    MOCK_CONST_METHOD1(remove, void(const std::string&));
+    MOCK_METHOD(void, remove, (const std::string&), (const, override));
 };
 } // namespace ipmi_flash
diff --git a/tools/test/data_interface_mock.hpp b/tools/test/data_interface_mock.hpp
index 0ee799b..c69de72 100644
--- a/tools/test/data_interface_mock.hpp
+++ b/tools/test/data_interface_mock.hpp
@@ -13,8 +13,10 @@
   public:
     virtual ~DataInterfaceMock() = default;
 
-    MOCK_METHOD2(sendContents, bool(const std::string&, std::uint16_t));
-    MOCK_CONST_METHOD0(supportedType, ipmi_flash::FirmwareFlags::UpdateFlags());
+    MOCK_METHOD(bool, sendContents, (const std::string&, std::uint16_t),
+                (override));
+    MOCK_METHOD(ipmi_flash::FirmwareFlags::UpdateFlags, supportedType, (),
+                (const, override));
 };
 
 } // namespace host_tool
diff --git a/tools/test/internal_sys_mock.hpp b/tools/test/internal_sys_mock.hpp
index 97f95bf..fcd68bb 100644
--- a/tools/test/internal_sys_mock.hpp
+++ b/tools/test/internal_sys_mock.hpp
@@ -16,24 +16,29 @@
   public:
     virtual ~InternalSysMock() = default;
 
-    MOCK_CONST_METHOD2(open, int(const char*, int));
-    MOCK_CONST_METHOD3(read, int(int, void*, std::size_t));
-    MOCK_CONST_METHOD4(pread, int(int, void*, std::size_t, off_t));
-    MOCK_CONST_METHOD4(pwrite, int(int, const void*, std::size_t, off_t));
-    MOCK_CONST_METHOD1(close, int(int));
-    MOCK_CONST_METHOD6(mmap, void*(void*, std::size_t, int, int, int, off_t));
-    MOCK_CONST_METHOD2(munmap, int(void*, std::size_t));
-    MOCK_CONST_METHOD0(getpagesize, int());
-    MOCK_CONST_METHOD3(ioctl, int(int, unsigned long, void*));
-    MOCK_CONST_METHOD3(poll, int(struct pollfd*, nfds_t, int));
-    MOCK_CONST_METHOD3(socket, int(int, int, int));
-    MOCK_CONST_METHOD3(connect, int(int, const struct sockaddr*, socklen_t));
-    MOCK_CONST_METHOD4(sendfile, ssize_t(int, int, off_t*, size_t));
-    MOCK_CONST_METHOD4(getaddrinfo,
-                       int(const char*, const char*, const struct addrinfo*,
-                           struct addrinfo**));
-    MOCK_CONST_METHOD1(freeaddrinfo, void(struct addrinfo*));
-    MOCK_CONST_METHOD1(getSize, std::int64_t(const char*));
+    MOCK_METHOD(int, open, (const char*, int), (const override));
+    MOCK_METHOD(int, read, (int, void*, std::size_t), (const override));
+    MOCK_METHOD(int, pread, (int, void*, std::size_t, off_t), (const override));
+    MOCK_METHOD(int, pwrite, (int, const void*, std::size_t, off_t),
+                (const override));
+    MOCK_METHOD(int, close, (int), (const override));
+    MOCK_METHOD(void*, mmap, (void*, std::size_t, int, int, int, off_t),
+                (const override));
+    MOCK_METHOD(int, munmap, (void*, std::size_t), (const override));
+    MOCK_METHOD(int, getpagesize, (), (const override));
+    MOCK_METHOD(int, ioctl, (int, unsigned long, void*), (const override));
+    MOCK_METHOD(int, poll, (struct pollfd*, nfds_t, int), (const override));
+    MOCK_METHOD(int, socket, (int, int, int), (const override));
+    MOCK_METHOD(int, connect, (int, const struct sockaddr*, socklen_t),
+                (const override));
+    MOCK_METHOD(ssize_t, sendfile, (int, int, off_t*, size_t),
+                (const override));
+    MOCK_METHOD(int, getaddrinfo,
+                (const char*, const char*, const struct addrinfo*,
+                 struct addrinfo**),
+                (const override));
+    MOCK_METHOD(void, freeaddrinfo, (struct addrinfo*), (const override));
+    MOCK_METHOD(std::int64_t, getSize, (const char*), (const override));
 };
 
 } // namespace internal
diff --git a/tools/test/io_mock.hpp b/tools/test/io_mock.hpp
index eddd6ff..f7d25c5 100644
--- a/tools/test/io_mock.hpp
+++ b/tools/test/io_mock.hpp
@@ -12,10 +12,11 @@
   public:
     ~HostIoInterfaceMock() = default;
 
-    MOCK_METHOD3(read, bool(const std::size_t, const std::size_t, void* const));
-
-    MOCK_METHOD3(write,
-                 bool(const std::size_t, const std::size_t, const void* const));
+    MOCK_METHOD(bool, read, (const std::size_t, const std::size_t, void* const),
+                (override));
+    MOCK_METHOD(bool, write,
+                (const std::size_t, const std::size_t, const void* const),
+                (override));
 };
 
 } // namespace host_tool
diff --git a/tools/test/pciaccess_mock.hpp b/tools/test/pciaccess_mock.hpp
index 738a1b1..f93e1fd 100644
--- a/tools/test/pciaccess_mock.hpp
+++ b/tools/test/pciaccess_mock.hpp
@@ -10,23 +10,26 @@
 class PciAccessMock : public PciAccess
 {
   public:
-    MOCK_CONST_METHOD1(pci_id_match_iterator_create,
-                       struct pci_device_iterator*(const struct pci_id_match*));
-    MOCK_CONST_METHOD1(pci_iterator_destroy, void(struct pci_device_iterator*));
-    MOCK_CONST_METHOD1(pci_device_enable, void(struct pci_device*));
-    MOCK_CONST_METHOD1(pci_device_next,
-                       struct pci_device*(struct pci_device_iterator*));
-    MOCK_CONST_METHOD1(pci_device_probe, int(struct pci_device*));
-    MOCK_CONST_METHOD3(pci_device_cfg_read_u8,
-                       int(struct pci_device* dev, std::uint8_t* data,
-                           pciaddr_t offset));
-    MOCK_CONST_METHOD3(pci_device_cfg_write_u8,
-                       int(struct pci_device* dev, std::uint8_t data,
-                           pciaddr_t offset));
-    MOCK_CONST_METHOD5(pci_device_map_range, int(struct pci_device*, pciaddr_t,
-                                                 pciaddr_t, unsigned, void**));
-    MOCK_CONST_METHOD3(pci_device_unmap_range,
-                       int(struct pci_device*, void*, pciaddr_t));
+    MOCK_METHOD(struct pci_device_iterator*, pci_id_match_iterator_create,
+                (const struct pci_id_match*), (const, override));
+    MOCK_METHOD(void, pci_iterator_destroy, (struct pci_device_iterator*),
+                (const, override));
+    MOCK_METHOD(void, pci_device_enable, (struct pci_device*),
+                (const, override));
+    MOCK_METHOD(struct pci_device*, pci_device_next,
+                (struct pci_device_iterator*), (const, override));
+    MOCK_METHOD(int, pci_device_probe, (struct pci_device*), (const, override));
+    MOCK_METHOD(int, pci_device_cfg_read_u8,
+                (struct pci_device * dev, std::uint8_t* data, pciaddr_t offset),
+                (const, override));
+    MOCK_METHOD(int, pci_device_cfg_write_u8,
+                (struct pci_device * dev, std::uint8_t data, pciaddr_t offset),
+                (const, override));
+    MOCK_METHOD(int, pci_device_map_range,
+                (struct pci_device*, pciaddr_t, pciaddr_t, unsigned, void**),
+                (const, override));
+    MOCK_METHOD(int, pci_device_unmap_range,
+                (struct pci_device*, void*, pciaddr_t), (const, override));
 };
 
 } // namespace host_tool
diff --git a/tools/test/updater_mock.hpp b/tools/test/updater_mock.hpp
index 05527b2..70fc91a 100644
--- a/tools/test/updater_mock.hpp
+++ b/tools/test/updater_mock.hpp
@@ -14,11 +14,13 @@
 class UpdateHandlerMock : public UpdateHandlerInterface
 {
   public:
-    MOCK_METHOD1(checkAvailable, bool(const std::string&));
-    MOCK_METHOD1(readVersion, std::vector<uint8_t>(const std::string&));
-    MOCK_METHOD2(sendFile, void(const std::string&, const std::string&));
-    MOCK_METHOD2(verifyFile, bool(const std::string&, bool));
-    MOCK_METHOD0(cleanArtifacts, void());
+    MOCK_METHOD(bool, checkAvailable, (const std::string&), (override));
+    MOCK_METHOD(std::vector<uint8_t>, readVersion, (const std::string&),
+                (override));
+    MOCK_METHOD(void, sendFile, (const std::string&, const std::string&),
+                (override));
+    MOCK_METHOD(bool, verifyFile, (const std::string&, bool), (override));
+    MOCK_METHOD(void, cleanArtifacts, (), (override));
 };
 
 } // namespace host_tool