}
TEST_F(EventSystemTest, eventsystem_send_user_event) {
- GDBusProxy* _proxy = (GDBusProxy*)g_object_new(G_TYPE_OBJECT, nullptr);
- GDBusConnection* _conn = (GDBusConnection*)g_object_new(G_TYPE_OBJECT, nullptr);
-
- EXPECT_CALL(GetMock<GioMock>(), g_bus_get_sync(_, _, _))
- .WillRepeatedly(Return(_conn));
-
+ EXPECT_CALL(GetMock<GioMock>(), g_bus_get_sync(_, _, _)).
+ WillRepeatedly(
+ Invoke([&](GBusType type,
+ GCancellable* cancellable, GError** error)
+ -> GDBusConnection* {
+ GDBusConnection* con =
+ (GDBusConnection*)g_object_new(G_TYPE_DBUS_CONNECTION, nullptr);
+ return con;
+ }));
EXPECT_CALL(GetMock<GioMock>(),
g_bus_own_name_on_connection(_, _, _, _, _, _, _)).
WillRepeatedly(Return(1));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_proxy_new_sync(_, _, _, _, _, _, _, _)).
- WillRepeatedly(Return(_proxy));
+ WillRepeatedly(
+ Invoke([&](GDBusConnection* con,
+ GDBusProxyFlags flag, GDBusInterfaceInfo* info, const gchar* name,
+ const gchar* path, const gchar* interface, GCancellable* cancellable,
+ GError** error)
+ -> GDBusProxy* {
+ GDBusProxy* proxy =
+ (GDBusProxy*)g_object_new(G_TYPE_OBJECT, nullptr);
+ return proxy;
+ }));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_proxy_call_sync(_, _, _, _, _, _, _)).
WillRepeatedly(
}
TEST_F(EventSystemTest, eventsystem_request_sending_system_event) {
- GDBusProxy* _proxy = (GDBusProxy*)g_object_new(G_TYPE_OBJECT, nullptr);
-
EXPECT_CALL(GetMock<GioMock>(),
g_bus_own_name_on_connection(_, _, _, _, _, _, _)).
WillRepeatedly(Return(1));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_proxy_new_sync(_, _, _, _, _, _, _, _)).
- WillRepeatedly(Return(_proxy));
+ WillRepeatedly(
+ Invoke([&](GDBusConnection* con,
+ GDBusProxyFlags flag, GDBusInterfaceInfo* info, const gchar* name,
+ const gchar* path, const gchar* interface, GCancellable* cancellable,
+ GError** error)
+ -> GDBusProxy* {
+ GDBusProxy* proxy =
+ (GDBusProxy*)g_object_new(G_TYPE_OBJECT, nullptr);
+ return proxy;
+ }));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_proxy_call_sync(_, _, _, _, _, _, _)).
WillRepeatedly(
}
TEST_F(EventSystemTest, eventsystem_register_application_event) {
- GDBusProxy* _proxy = (GDBusProxy*)g_object_new(G_TYPE_OBJECT, nullptr);
-
+ EXPECT_CALL(GetMock<GioMock>(), g_bus_get_sync(_, _, _)).
+ WillRepeatedly(
+ Invoke([&](GBusType type,
+ GCancellable* cancellable, GError** error)
+ -> GDBusConnection* {
+ GDBusConnection* con =
+ (GDBusConnection*)g_object_new(G_TYPE_DBUS_CONNECTION, nullptr);
+ return con;
+ }));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_is_interface_name(_)).
WillOnce(Return(true));
WillRepeatedly(Return(1));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_proxy_new_sync(_, _, _, _, _, _, _, _)).
- WillRepeatedly(Return(_proxy));
+ WillRepeatedly(
+ Invoke([&](GDBusConnection* con,
+ GDBusProxyFlags flag, GDBusInterfaceInfo* info, const gchar* name,
+ const gchar* path, const gchar* interface, GCancellable* cancellable,
+ GError** error)
+ -> GDBusProxy* {
+ GDBusProxy* proxy =
+ (GDBusProxy*)g_object_new(G_TYPE_OBJECT, nullptr);
+ return proxy;
+ }));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_proxy_call_sync(_, _, _, _, _, _, _)).
WillOnce(
}
TEST_F(EventSystemTest, eventsystem_unregister_application_event) {
- GDBusProxy* _proxy = (GDBusProxy*)g_object_new(G_TYPE_OBJECT, nullptr);
-
+ EXPECT_CALL(GetMock<GioMock>(), g_bus_get_sync(_, _, _)).
+ WillRepeatedly(
+ Invoke([&](GBusType type,
+ GCancellable* cancellable, GError** error)
+ -> GDBusConnection* {
+ GDBusConnection* con =
+ (GDBusConnection*)g_object_new(G_TYPE_DBUS_CONNECTION, nullptr);
+ return con;
+ }));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_is_interface_name(_)).
WillOnce(Return(true));
WillRepeatedly(Return(1));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_proxy_new_sync(_, _, _, _, _, _, _, _)).
- WillRepeatedly(Return(_proxy));
+ WillRepeatedly(
+ Invoke([&](GDBusConnection* con,
+ GDBusProxyFlags flag, GDBusInterfaceInfo* info, const gchar* name,
+ const gchar* path, const gchar* interface, GCancellable* cancellable,
+ GError** error)
+ -> GDBusProxy* {
+ GDBusProxy* proxy =
+ (GDBusProxy*)g_object_new(G_TYPE_OBJECT, nullptr);
+ return proxy;
+ }));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_proxy_call_sync(_, _, _, _, _, _, _)).
WillOnce(
}
TEST_F(EventSystemTest, eventsystem_keep_last_event_data) {
- GDBusProxy* _proxy = (GDBusProxy*)g_object_new(G_TYPE_OBJECT, nullptr);
-
+ EXPECT_CALL(GetMock<GioMock>(), g_bus_get_sync(_, _, _)).
+ WillRepeatedly(
+ Invoke([&](GBusType type,
+ GCancellable* cancellable, GError** error)
+ -> GDBusConnection* {
+ GDBusConnection* con =
+ (GDBusConnection*)g_object_new(G_TYPE_DBUS_CONNECTION, nullptr);
+ return con;
+ }));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_is_interface_name(_)).
WillOnce(Return(true));
WillRepeatedly(Return(1));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_proxy_new_sync(_, _, _, _, _, _, _, _)).
- WillRepeatedly(Return(_proxy));
+ WillRepeatedly(
+ Invoke([&](GDBusConnection* con,
+ GDBusProxyFlags flag, GDBusInterfaceInfo* info, const gchar* name,
+ const gchar* path, const gchar* interface, GCancellable* cancellable,
+ GError** error)
+ -> GDBusProxy* {
+ GDBusProxy* proxy =
+ (GDBusProxy*)g_object_new(G_TYPE_OBJECT, nullptr);
+ return proxy;
+ }));
EXPECT_CALL(GetMock<GioMock>(),
g_dbus_proxy_call_sync(_, _, _, _, _, _, _)).
WillRepeatedly(