113fd8722SBrad Bishop #pragma once
213fd8722SBrad Bishop #include "data_types.hpp"
313fd8722SBrad Bishop #include "sdbusplus/bus/match.hpp"
413fd8722SBrad Bishop 
53d6d3182SPatrick Venture #include <string>
63d6d3182SPatrick Venture 
73d6d3182SPatrick Venture #include <gmock/gmock.h>
83d6d3182SPatrick Venture #include <gtest/gtest.h>
93d6d3182SPatrick Venture 
1013fd8722SBrad Bishop namespace phosphor
1113fd8722SBrad Bishop {
1213fd8722SBrad Bishop namespace dbus
1313fd8722SBrad Bishop {
1413fd8722SBrad Bishop namespace monitoring
1513fd8722SBrad Bishop {
1613fd8722SBrad Bishop 
1713fd8722SBrad Bishop /** @class CallMethodAndRead
1813fd8722SBrad Bishop  *  @brief GMock template member forwarding helper.
1913fd8722SBrad Bishop  *
2013fd8722SBrad Bishop  *  The code under test calls callMethodAndRead, which is a templated,
2113fd8722SBrad Bishop  *  free function.  Enable this under GMock by forwarding calls to it
2213fd8722SBrad Bishop  *  to functions that can be mocked.
2313fd8722SBrad Bishop  *
2413fd8722SBrad Bishop  *  @tparam DBusInterfaceType - The mock object type.
2513fd8722SBrad Bishop  *  @tparam Ret - The return type of the method being called.
2613fd8722SBrad Bishop  *  @tparam Args - The argument types of the method being called.
2713fd8722SBrad Bishop  *
2813fd8722SBrad Bishop  *  Specialize to implement new forwards.
2913fd8722SBrad Bishop  */
30d1eac88dSBrad Bishop template <typename DBusInterfaceType, typename Ret, typename... Args>
3113fd8722SBrad Bishop struct CallMethodAndRead
3213fd8722SBrad Bishop {
opphosphor::dbus::monitoring::CallMethodAndRead33d1eac88dSBrad Bishop     static Ret op(DBusInterfaceType& dbus, const std::string& busName,
34d1eac88dSBrad Bishop                   const std::string& path, const std::string& interface,
35d1eac88dSBrad Bishop                   const std::string& method, Args&&... args)
3613fd8722SBrad Bishop     {
3713fd8722SBrad Bishop         static_assert(true, "Missing CallMethodAndRead definition.");
3813fd8722SBrad Bishop         return Ret();
3913fd8722SBrad Bishop     }
4013fd8722SBrad Bishop };
4113fd8722SBrad Bishop 
4213fd8722SBrad Bishop /** @brief CallMethodAndRead specialization for
4313fd8722SBrad Bishop  *     xyz.openbmc_project.ObjectMapper.GetObject. */
4413fd8722SBrad Bishop template <typename DBusInterfaceType>
45d1eac88dSBrad Bishop struct CallMethodAndRead<DBusInterfaceType, GetObject, const MapperPath&,
4613fd8722SBrad Bishop                          const std::vector<std::string>&>
4713fd8722SBrad Bishop {
opphosphor::dbus::monitoring::CallMethodAndRead48d1eac88dSBrad Bishop     static GetObject op(DBusInterfaceType& dbus, const std::string& busName,
49d1eac88dSBrad Bishop                         const std::string& path, const std::string& interface,
50d1eac88dSBrad Bishop                         const std::string& method, const MapperPath& objectPath,
5113fd8722SBrad Bishop                         const std::vector<std::string>& interfaces)
5213fd8722SBrad Bishop     {
53d1eac88dSBrad Bishop         return dbus.mapperGetObject(busName, path, interface, method,
54d1eac88dSBrad Bishop                                     objectPath, interfaces);
5513fd8722SBrad Bishop     }
5613fd8722SBrad Bishop };
5713fd8722SBrad Bishop 
5813fd8722SBrad Bishop /** @brief CallMethodAndRead specialization for
5913fd8722SBrad Bishop  *     org.freedesktop.DBus.Properties.GetAll(uint64_t). */
6013fd8722SBrad Bishop template <typename DBusInterfaceType>
61d1eac88dSBrad Bishop struct CallMethodAndRead<DBusInterfaceType, PropertiesChanged<uint64_t>,
6213fd8722SBrad Bishop                          const std::string&>
6313fd8722SBrad Bishop {
64d1eac88dSBrad Bishop     static PropertiesChanged<uint64_t>
opphosphor::dbus::monitoring::CallMethodAndRead65d1eac88dSBrad Bishop         op(DBusInterfaceType& dbus, const std::string& busName,
66d1eac88dSBrad Bishop            const std::string& path, const std::string& interface,
67d1eac88dSBrad Bishop            const std::string& method, const std::string& propertiesInterface)
6813fd8722SBrad Bishop     {
69d1eac88dSBrad Bishop         return dbus.getPropertiesU64(busName, path, interface, method,
7013fd8722SBrad Bishop                                      propertiesInterface);
7113fd8722SBrad Bishop     }
7213fd8722SBrad Bishop };
7313fd8722SBrad Bishop 
7413fd8722SBrad Bishop /** @brief CallMethodAndRead specialization for
7513fd8722SBrad Bishop  *     org.freedesktop.DBus.Properties.GetAll(uint32_t). */
7613fd8722SBrad Bishop template <typename DBusInterfaceType>
77d1eac88dSBrad Bishop struct CallMethodAndRead<DBusInterfaceType, PropertiesChanged<uint32_t>,
7813fd8722SBrad Bishop                          const std::string&>
7913fd8722SBrad Bishop {
80d1eac88dSBrad Bishop     static PropertiesChanged<uint32_t>
opphosphor::dbus::monitoring::CallMethodAndRead81d1eac88dSBrad Bishop         op(DBusInterfaceType& dbus, const std::string& busName,
82d1eac88dSBrad Bishop            const std::string& path, const std::string& interface,
83d1eac88dSBrad Bishop            const std::string& method, const std::string& propertiesInterface)
8413fd8722SBrad Bishop     {
85d1eac88dSBrad Bishop         return dbus.getPropertiesU32(busName, path, interface, method,
8613fd8722SBrad Bishop                                      propertiesInterface);
8713fd8722SBrad Bishop     }
8813fd8722SBrad Bishop };
8913fd8722SBrad Bishop 
9013fd8722SBrad Bishop /** @brief CallMethodAndRead specialization for
9113fd8722SBrad Bishop  *     org.freedesktop.DBus.Properties.GetAll(uint16_t). */
9213fd8722SBrad Bishop template <typename DBusInterfaceType>
93d1eac88dSBrad Bishop struct CallMethodAndRead<DBusInterfaceType, PropertiesChanged<uint16_t>,
9413fd8722SBrad Bishop                          const std::string&>
9513fd8722SBrad Bishop {
96d1eac88dSBrad Bishop     static PropertiesChanged<uint16_t>
opphosphor::dbus::monitoring::CallMethodAndRead97d1eac88dSBrad Bishop         op(DBusInterfaceType& dbus, const std::string& busName,
98d1eac88dSBrad Bishop            const std::string& path, const std::string& interface,
99d1eac88dSBrad Bishop            const std::string& method, const std::string& propertiesInterface)
10013fd8722SBrad Bishop     {
101d1eac88dSBrad Bishop         return dbus.getPropertiesU16(busName, path, interface, method,
10213fd8722SBrad Bishop                                      propertiesInterface);
10313fd8722SBrad Bishop     }
10413fd8722SBrad Bishop };
10513fd8722SBrad Bishop 
10613fd8722SBrad Bishop /** @brief CallMethodAndRead specialization for
10713fd8722SBrad Bishop  *     org.freedesktop.DBus.Properties.GetAll(uint8_t). */
10813fd8722SBrad Bishop template <typename DBusInterfaceType>
109d1eac88dSBrad Bishop struct CallMethodAndRead<DBusInterfaceType, PropertiesChanged<uint8_t>,
11013fd8722SBrad Bishop                          const std::string&>
11113fd8722SBrad Bishop {
112d1eac88dSBrad Bishop     static PropertiesChanged<uint8_t>
opphosphor::dbus::monitoring::CallMethodAndRead113d1eac88dSBrad Bishop         op(DBusInterfaceType& dbus, const std::string& busName,
114d1eac88dSBrad Bishop            const std::string& path, const std::string& interface,
115d1eac88dSBrad Bishop            const std::string& method, const std::string& propertiesInterface)
11613fd8722SBrad Bishop     {
117d1eac88dSBrad Bishop         return dbus.getPropertiesU8(busName, path, interface, method,
11813fd8722SBrad Bishop                                     propertiesInterface);
11913fd8722SBrad Bishop     }
12013fd8722SBrad Bishop };
12113fd8722SBrad Bishop 
12213fd8722SBrad Bishop /** @brief CallMethodAndRead specialization for
12313fd8722SBrad Bishop  *     org.freedesktop.DBus.Properties.GetAll(int64_t). */
12413fd8722SBrad Bishop template <typename DBusInterfaceType>
125d1eac88dSBrad Bishop struct CallMethodAndRead<DBusInterfaceType, PropertiesChanged<int64_t>,
12613fd8722SBrad Bishop                          const std::string&>
12713fd8722SBrad Bishop {
128d1eac88dSBrad Bishop     static PropertiesChanged<int64_t>
opphosphor::dbus::monitoring::CallMethodAndRead129d1eac88dSBrad Bishop         op(DBusInterfaceType& dbus, const std::string& busName,
130d1eac88dSBrad Bishop            const std::string& path, const std::string& interface,
131d1eac88dSBrad Bishop            const std::string& method, const std::string& propertiesInterface)
13213fd8722SBrad Bishop     {
133d1eac88dSBrad Bishop         return dbus.getPropertiesU64(busName, path, interface, method,
13413fd8722SBrad Bishop                                      propertiesInterface);
13513fd8722SBrad Bishop     }
13613fd8722SBrad Bishop };
13713fd8722SBrad Bishop 
13813fd8722SBrad Bishop /** @brief CallMethodAndRead specialization for
13913fd8722SBrad Bishop  *     org.freedesktop.DBus.Properties.GetAll(int32_t). */
14013fd8722SBrad Bishop template <typename DBusInterfaceType>
141d1eac88dSBrad Bishop struct CallMethodAndRead<DBusInterfaceType, PropertiesChanged<int32_t>,
14213fd8722SBrad Bishop                          const std::string&>
14313fd8722SBrad Bishop {
144d1eac88dSBrad Bishop     static PropertiesChanged<int32_t>
opphosphor::dbus::monitoring::CallMethodAndRead145d1eac88dSBrad Bishop         op(DBusInterfaceType& dbus, const std::string& busName,
146d1eac88dSBrad Bishop            const std::string& path, const std::string& interface,
147d1eac88dSBrad Bishop            const std::string& method, const std::string& propertiesInterface)
14813fd8722SBrad Bishop     {
149d1eac88dSBrad Bishop         return dbus.getPropertiesU32(busName, path, interface, method,
15013fd8722SBrad Bishop                                      propertiesInterface);
15113fd8722SBrad Bishop     }
15213fd8722SBrad Bishop };
15313fd8722SBrad Bishop 
15413fd8722SBrad Bishop /** @brief CallMethodAndRead specialization for
15513fd8722SBrad Bishop  *     org.freedesktop.DBus.Properties.GetAll(int16_t). */
15613fd8722SBrad Bishop template <typename DBusInterfaceType>
157d1eac88dSBrad Bishop struct CallMethodAndRead<DBusInterfaceType, PropertiesChanged<int16_t>,
15813fd8722SBrad Bishop                          const std::string&>
15913fd8722SBrad Bishop {
160d1eac88dSBrad Bishop     static PropertiesChanged<int16_t>
opphosphor::dbus::monitoring::CallMethodAndRead161d1eac88dSBrad Bishop         op(DBusInterfaceType& dbus, const std::string& busName,
162d1eac88dSBrad Bishop            const std::string& path, const std::string& interface,
163d1eac88dSBrad Bishop            const std::string& method, const std::string& propertiesInterface)
16413fd8722SBrad Bishop     {
165d1eac88dSBrad Bishop         return dbus.getPropertiesU16(busName, path, interface, method,
16613fd8722SBrad Bishop                                      propertiesInterface);
16713fd8722SBrad Bishop     }
16813fd8722SBrad Bishop };
16913fd8722SBrad Bishop 
17013fd8722SBrad Bishop /** @brief CallMethodAndRead specialization for
17113fd8722SBrad Bishop  *     org.freedesktop.DBus.Properties.GetAll(int8_t). */
17213fd8722SBrad Bishop template <typename DBusInterfaceType>
173d1eac88dSBrad Bishop struct CallMethodAndRead<DBusInterfaceType, PropertiesChanged<int8_t>,
17413fd8722SBrad Bishop                          const std::string&>
17513fd8722SBrad Bishop {
176d1eac88dSBrad Bishop     static PropertiesChanged<int8_t>
opphosphor::dbus::monitoring::CallMethodAndRead177d1eac88dSBrad Bishop         op(DBusInterfaceType& dbus, const std::string& busName,
178d1eac88dSBrad Bishop            const std::string& path, const std::string& interface,
179d1eac88dSBrad Bishop            const std::string& method, const std::string& propertiesInterface)
18013fd8722SBrad Bishop     {
181d1eac88dSBrad Bishop         return dbus.getPropertiesU8(busName, path, interface, method,
18213fd8722SBrad Bishop                                     propertiesInterface);
18313fd8722SBrad Bishop     }
18413fd8722SBrad Bishop };
18513fd8722SBrad Bishop 
18613fd8722SBrad Bishop /** @brief CallMethodAndRead specialization for
18713fd8722SBrad Bishop  *     org.freedesktop.DBus.Properties.GetAll(std::string). */
18813fd8722SBrad Bishop template <typename DBusInterfaceType>
189d1eac88dSBrad Bishop struct CallMethodAndRead<DBusInterfaceType, PropertiesChanged<std::string>,
19013fd8722SBrad Bishop                          const std::string&>
19113fd8722SBrad Bishop {
192d1eac88dSBrad Bishop     static PropertiesChanged<std::string>
opphosphor::dbus::monitoring::CallMethodAndRead193d1eac88dSBrad Bishop         op(DBusInterfaceType& dbus, const std::string& busName,
194d1eac88dSBrad Bishop            const std::string& path, const std::string& interface,
195d1eac88dSBrad Bishop            const std::string& method, const std::string& propertiesInterface)
19613fd8722SBrad Bishop     {
197d1eac88dSBrad Bishop         return dbus.getPropertiesString(busName, path, interface, method,
19813fd8722SBrad Bishop                                         propertiesInterface);
19913fd8722SBrad Bishop     }
20013fd8722SBrad Bishop };
20113fd8722SBrad Bishop 
20213fd8722SBrad Bishop /** @class MockDBusInterface
20313fd8722SBrad Bishop  *  @brief DBus access delegate implementation for the property watch test
20413fd8722SBrad Bishop  *  suite.
20513fd8722SBrad Bishop  */
20613fd8722SBrad Bishop struct MockDBusInterface
20713fd8722SBrad Bishop {
208d1eac88dSBrad Bishop     MOCK_METHOD6(mapperGetObject,
209d1eac88dSBrad Bishop                  GetObject(const std::string&, const std::string&,
210d1eac88dSBrad Bishop                            const std::string&, const std::string&,
211d1eac88dSBrad Bishop                            const MapperPath&, const std::vector<std::string>&));
21213fd8722SBrad Bishop 
213d1eac88dSBrad Bishop     MOCK_METHOD5(getPropertiesU64,
21413fd8722SBrad Bishop                  PropertiesChanged<uint64_t>(
215d1eac88dSBrad Bishop                      const std::string&, const std::string&, const std::string&,
216d1eac88dSBrad Bishop                      const std::string&, const std::string&));
21713fd8722SBrad Bishop 
218d1eac88dSBrad Bishop     MOCK_METHOD5(getPropertiesU32,
21913fd8722SBrad Bishop                  PropertiesChanged<uint32_t>(
220d1eac88dSBrad Bishop                      const std::string&, const std::string&, const std::string&,
221d1eac88dSBrad Bishop                      const std::string&, const std::string&));
22213fd8722SBrad Bishop 
223d1eac88dSBrad Bishop     MOCK_METHOD5(getPropertiesU16,
22413fd8722SBrad Bishop                  PropertiesChanged<uint16_t>(
225d1eac88dSBrad Bishop                      const std::string&, const std::string&, const std::string&,
226d1eac88dSBrad Bishop                      const std::string&, const std::string&));
22713fd8722SBrad Bishop 
228d1eac88dSBrad Bishop     MOCK_METHOD5(getPropertiesU8,
22913fd8722SBrad Bishop                  PropertiesChanged<uint8_t>(
230d1eac88dSBrad Bishop                      const std::string&, const std::string&, const std::string&,
231d1eac88dSBrad Bishop                      const std::string&, const std::string&));
23213fd8722SBrad Bishop 
233d1eac88dSBrad Bishop     MOCK_METHOD5(getPropertiesS64,
23413fd8722SBrad Bishop                  PropertiesChanged<int64_t>(
235d1eac88dSBrad Bishop                      const std::string&, const std::string&, const std::string&,
236d1eac88dSBrad Bishop                      const std::string&, const std::string&));
23713fd8722SBrad Bishop 
238d1eac88dSBrad Bishop     MOCK_METHOD5(getPropertiesS32,
23913fd8722SBrad Bishop                  PropertiesChanged<int32_t>(
240d1eac88dSBrad Bishop                      const std::string&, const std::string&, const std::string&,
241d1eac88dSBrad Bishop                      const std::string&, const std::string&));
24213fd8722SBrad Bishop 
243d1eac88dSBrad Bishop     MOCK_METHOD5(getPropertiesS16,
24413fd8722SBrad Bishop                  PropertiesChanged<int16_t>(
245d1eac88dSBrad Bishop                      const std::string&, const std::string&, const std::string&,
246d1eac88dSBrad Bishop                      const std::string&, const std::string&));
24713fd8722SBrad Bishop 
248d1eac88dSBrad Bishop     MOCK_METHOD5(getPropertiesS8,
24913fd8722SBrad Bishop                  PropertiesChanged<int8_t>(
250d1eac88dSBrad Bishop                      const std::string&, const std::string&, const std::string&,
251d1eac88dSBrad Bishop                      const std::string&, const std::string&));
25213fd8722SBrad Bishop 
253d1eac88dSBrad Bishop     MOCK_METHOD5(getPropertiesString,
25413fd8722SBrad Bishop                  PropertiesChanged<std::string>(
255d1eac88dSBrad Bishop                      const std::string&, const std::string&, const std::string&,
256d1eac88dSBrad Bishop                      const std::string&, const std::string&));
25713fd8722SBrad Bishop 
258*413a4857SPatrick Williams     MOCK_METHOD2(fwdAddMatch, void(const std::string&,
259*413a4857SPatrick Williams                                    const sdbusplus::bus::match_t::callback_t&));
26013fd8722SBrad Bishop 
26113fd8722SBrad Bishop     static MockDBusInterface* ptr;
instancephosphor::dbus::monitoring::MockDBusInterface26213fd8722SBrad Bishop     static MockDBusInterface& instance()
26313fd8722SBrad Bishop     {
26413fd8722SBrad Bishop         return *ptr;
26513fd8722SBrad Bishop     }
instancephosphor::dbus::monitoring::MockDBusInterface26613fd8722SBrad Bishop     static void instance(MockDBusInterface& p)
26713fd8722SBrad Bishop     {
26813fd8722SBrad Bishop         ptr = &p;
26913fd8722SBrad Bishop     }
27013fd8722SBrad Bishop 
27113fd8722SBrad Bishop     /** @brief GMock member template/free function forward. */
27213fd8722SBrad Bishop     template <typename Ret, typename... Args>
callMethodAndReadphosphor::dbus::monitoring::MockDBusInterface273d1eac88dSBrad Bishop     static auto callMethodAndRead(const std::string& busName,
27413fd8722SBrad Bishop                                   const std::string& path,
27513fd8722SBrad Bishop                                   const std::string& interface,
276d1eac88dSBrad Bishop                                   const std::string& method, Args&&... args)
27713fd8722SBrad Bishop     {
27813fd8722SBrad Bishop         return CallMethodAndRead<MockDBusInterface, Ret, Args...>::op(
279d1eac88dSBrad Bishop             instance(), busName, path, interface, method,
28013fd8722SBrad Bishop             std::forward<Args>(args)...);
28113fd8722SBrad Bishop     }
28213fd8722SBrad Bishop 
28313fd8722SBrad Bishop     /** @brief GMock free function forward. */
addMatchphosphor::dbus::monitoring::MockDBusInterface284*413a4857SPatrick Williams     static auto addMatch(const std::string& match,
285*413a4857SPatrick Williams                          const sdbusplus::bus::match_t::callback_t& callback)
28613fd8722SBrad Bishop     {
28713fd8722SBrad Bishop         instance().fwdAddMatch(match, callback);
28813fd8722SBrad Bishop     }
28913fd8722SBrad Bishop };
29013fd8722SBrad Bishop 
29113fd8722SBrad Bishop /** @class Expect
29213fd8722SBrad Bishop  *  @brief Enable use of EXPECT_CALL from a C++ template.
29313fd8722SBrad Bishop  */
2943d6d3182SPatrick Venture template <typename T>
2953d6d3182SPatrick Venture struct Expect
2963fe976ccSGeorge Liu {};
29713fd8722SBrad Bishop 
2983d6d3182SPatrick Venture template <>
2993d6d3182SPatrick Venture struct Expect<uint64_t>
30013fd8722SBrad Bishop {
30113fd8722SBrad Bishop     template <typename MockObjType>
getPropertiesphosphor::dbus::monitoring::Expect302d1eac88dSBrad Bishop     static auto& getProperties(MockObjType&& mockObj, const std::string& path,
30313fd8722SBrad Bishop                                const std::string& interface)
30413fd8722SBrad Bishop     {
305d1eac88dSBrad Bishop         return EXPECT_CALL(std::forward<MockObjType>(mockObj),
306d1eac88dSBrad Bishop                            getPropertiesU64(::testing::_, path,
30713fd8722SBrad Bishop                                             "org.freedesktop.DBus.Properties",
308d1eac88dSBrad Bishop                                             "GetAll", interface));
30913fd8722SBrad Bishop     }
31013fd8722SBrad Bishop };
31113fd8722SBrad Bishop 
3123d6d3182SPatrick Venture template <>
3133d6d3182SPatrick Venture struct Expect<uint32_t>
31413fd8722SBrad Bishop {
31513fd8722SBrad Bishop     template <typename MockObjType>
getPropertiesphosphor::dbus::monitoring::Expect316d1eac88dSBrad Bishop     static auto& getProperties(MockObjType&& mockObj, const std::string& path,
31713fd8722SBrad Bishop                                const std::string& interface)
31813fd8722SBrad Bishop     {
319d1eac88dSBrad Bishop         return EXPECT_CALL(std::forward<MockObjType>(mockObj),
320d1eac88dSBrad Bishop                            getPropertiesU32(::testing::_, path,
32113fd8722SBrad Bishop                                             "org.freedesktop.DBus.Properties",
322d1eac88dSBrad Bishop                                             "GetAll", interface));
32313fd8722SBrad Bishop     }
32413fd8722SBrad Bishop };
32513fd8722SBrad Bishop 
3263d6d3182SPatrick Venture template <>
3273d6d3182SPatrick Venture struct Expect<uint16_t>
32813fd8722SBrad Bishop {
32913fd8722SBrad Bishop     template <typename MockObjType>
getPropertiesphosphor::dbus::monitoring::Expect330d1eac88dSBrad Bishop     static auto& getProperties(MockObjType&& mockObj, const std::string& path,
33113fd8722SBrad Bishop                                const std::string& interface)
33213fd8722SBrad Bishop     {
333d1eac88dSBrad Bishop         return EXPECT_CALL(std::forward<MockObjType>(mockObj),
334d1eac88dSBrad Bishop                            getPropertiesU16(::testing::_, path,
33513fd8722SBrad Bishop                                             "org.freedesktop.DBus.Properties",
336d1eac88dSBrad Bishop                                             "GetAll", interface));
33713fd8722SBrad Bishop     }
33813fd8722SBrad Bishop };
33913fd8722SBrad Bishop 
3403d6d3182SPatrick Venture template <>
3413d6d3182SPatrick Venture struct Expect<uint8_t>
34213fd8722SBrad Bishop {
34313fd8722SBrad Bishop     template <typename MockObjType>
getPropertiesphosphor::dbus::monitoring::Expect344d1eac88dSBrad Bishop     static auto& getProperties(MockObjType&& mockObj, const std::string& path,
34513fd8722SBrad Bishop                                const std::string& interface)
34613fd8722SBrad Bishop     {
347d1eac88dSBrad Bishop         return EXPECT_CALL(std::forward<MockObjType>(mockObj),
348d1eac88dSBrad Bishop                            getPropertiesU8(::testing::_, path,
34913fd8722SBrad Bishop                                            "org.freedesktop.DBus.Properties",
350d1eac88dSBrad Bishop                                            "GetAll", interface));
35113fd8722SBrad Bishop     }
35213fd8722SBrad Bishop };
35313fd8722SBrad Bishop 
3543d6d3182SPatrick Venture template <>
3553d6d3182SPatrick Venture struct Expect<int64_t>
35613fd8722SBrad Bishop {
35713fd8722SBrad Bishop     template <typename MockObjType>
getPropertiesphosphor::dbus::monitoring::Expect358d1eac88dSBrad Bishop     static auto& getProperties(MockObjType&& mockObj, const std::string& path,
35913fd8722SBrad Bishop                                const std::string& interface)
36013fd8722SBrad Bishop     {
361d1eac88dSBrad Bishop         return EXPECT_CALL(std::forward<MockObjType>(mockObj),
362d1eac88dSBrad Bishop                            getPropertiesS64(::testing::_, path,
36313fd8722SBrad Bishop                                             "org.freedesktop.DBus.Properties",
364d1eac88dSBrad Bishop                                             "GetAll", interface));
36513fd8722SBrad Bishop     }
36613fd8722SBrad Bishop };
36713fd8722SBrad Bishop 
3683d6d3182SPatrick Venture template <>
3693d6d3182SPatrick Venture struct Expect<int32_t>
37013fd8722SBrad Bishop {
37113fd8722SBrad Bishop     template <typename MockObjType>
getPropertiesphosphor::dbus::monitoring::Expect372d1eac88dSBrad Bishop     static auto& getProperties(MockObjType&& mockObj, const std::string& path,
37313fd8722SBrad Bishop                                const std::string& interface)
37413fd8722SBrad Bishop     {
375d1eac88dSBrad Bishop         return EXPECT_CALL(std::forward<MockObjType>(mockObj),
376d1eac88dSBrad Bishop                            getPropertiesS32(::testing::_, path,
37713fd8722SBrad Bishop                                             "org.freedesktop.DBus.Properties",
378d1eac88dSBrad Bishop                                             "GetAll", interface));
37913fd8722SBrad Bishop     }
38013fd8722SBrad Bishop };
38113fd8722SBrad Bishop 
3823d6d3182SPatrick Venture template <>
3833d6d3182SPatrick Venture struct Expect<int16_t>
38413fd8722SBrad Bishop {
38513fd8722SBrad Bishop     template <typename MockObjType>
getPropertiesphosphor::dbus::monitoring::Expect386d1eac88dSBrad Bishop     static auto& getProperties(MockObjType&& mockObj, const std::string& path,
38713fd8722SBrad Bishop                                const std::string& interface)
38813fd8722SBrad Bishop     {
389d1eac88dSBrad Bishop         return EXPECT_CALL(std::forward<MockObjType>(mockObj),
390d1eac88dSBrad Bishop                            getPropertiesS16(::testing::_, path,
39113fd8722SBrad Bishop                                             "org.freedesktop.DBus.Properties",
392d1eac88dSBrad Bishop                                             "GetAll", interface));
39313fd8722SBrad Bishop     }
39413fd8722SBrad Bishop };
39513fd8722SBrad Bishop 
3963d6d3182SPatrick Venture template <>
3973d6d3182SPatrick Venture struct Expect<int8_t>
39813fd8722SBrad Bishop {
39913fd8722SBrad Bishop     template <typename MockObjType>
getPropertiesphosphor::dbus::monitoring::Expect400d1eac88dSBrad Bishop     static auto& getProperties(MockObjType&& mockObj, const std::string& path,
40113fd8722SBrad Bishop                                const std::string& interface)
40213fd8722SBrad Bishop     {
403d1eac88dSBrad Bishop         return EXPECT_CALL(std::forward<MockObjType>(mockObj),
404d1eac88dSBrad Bishop                            getPropertiesS8(::testing::_, path,
40513fd8722SBrad Bishop                                            "org.freedesktop.DBus.Properties",
406d1eac88dSBrad Bishop                                            "GetAll", interface));
40713fd8722SBrad Bishop     }
40813fd8722SBrad Bishop };
40913fd8722SBrad Bishop 
4103d6d3182SPatrick Venture template <>
4113d6d3182SPatrick Venture struct Expect<std::string>
41213fd8722SBrad Bishop {
41313fd8722SBrad Bishop     template <typename MockObjType>
getPropertiesphosphor::dbus::monitoring::Expect414d1eac88dSBrad Bishop     static auto& getProperties(MockObjType&& mockObj, const std::string& path,
41513fd8722SBrad Bishop                                const std::string& interface)
41613fd8722SBrad Bishop     {
41713fd8722SBrad Bishop         return EXPECT_CALL(
41813fd8722SBrad Bishop             std::forward<MockObjType>(mockObj),
419d1eac88dSBrad Bishop             getPropertiesString(::testing::_, path,
420d1eac88dSBrad Bishop                                 "org.freedesktop.DBus.Properties", "GetAll",
42113fd8722SBrad Bishop                                 interface));
42213fd8722SBrad Bishop     }
42313fd8722SBrad Bishop };
42413fd8722SBrad Bishop 
42513fd8722SBrad Bishop } // namespace monitoring
42613fd8722SBrad Bishop } // namespace dbus
42713fd8722SBrad Bishop } // namespace phosphor
428