Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test failures on non gnome-terminal in GNOME #1279

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ static int got_info;

extern XdpDbusImplPermissionStore *permission_store;
extern XdpDbusImplLockdown *lockdown;
extern gchar *appid;

static void
set_camera_permissions (const char *permission)
Expand All @@ -26,7 +27,7 @@ set_camera_permissions (const char *permission)
"devices",
TRUE,
"camera",
"",
appid,
permissions,
NULL,
&error);
Expand Down
3 changes: 2 additions & 1 deletion tests/inhibit.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
extern char outdir[];

extern XdpDbusImplPermissionStore *permission_store;
extern gchar *appid;

static void
set_inhibit_permissions (const char **permissions)
Expand All @@ -18,7 +19,7 @@ set_inhibit_permissions (const char **permissions)
"inhibit",
TRUE,
"inhibit",
"",
appid,
permissions,
NULL,
&error);
Expand Down
7 changes: 7 additions & 0 deletions tests/limited-portals.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static GDBusConnection *session_bus;
static GList *test_procs = NULL;
XdpDbusImplPermissionStore *permission_store;
XdpDbusImplLockdown *lockdown;
gchar *appid;

int
xdup (int oldfd)
Expand Down Expand Up @@ -137,6 +138,7 @@ global_setup (void)
g_autofree gchar *argv0 = NULL;
g_autoptr(GSubprocessLauncher) launcher = NULL;
g_autoptr(GSubprocess) subprocess = NULL;
g_autoptr(XdpAppInfo) appinfo = NULL;
guint name_timeout;
const char *argv[4];
GQuark portal_errors G_GNUC_UNUSED;
Expand Down Expand Up @@ -318,6 +320,10 @@ global_setup (void)
&error);
g_assert_no_error (error);

appinfo = xdp_get_app_info_from_pid (getpid (), &error);
g_assert_no_error (error);
appid = g_strdup (xdp_app_info_get_id (appinfo));

/* make sure errors are registered */
portal_errors = XDG_DESKTOP_PORTAL_ERROR;
}
Expand Down Expand Up @@ -374,6 +380,7 @@ global_teardown (void)

g_object_unref (lockdown);
g_object_unref (permission_store);
g_free (appid);

g_object_unref (session_bus);

Expand Down
7 changes: 7 additions & 0 deletions tests/test-portals.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static GDBusConnection *session_bus;
static GList *test_procs = NULL;
XdpDbusImplPermissionStore *permission_store;
XdpDbusImplLockdown *lockdown;
gchar *appid;

int
xdup (int oldfd)
Expand Down Expand Up @@ -136,6 +137,7 @@ global_setup (void)
g_autofree gchar *argv0 = NULL;
g_autoptr(GSubprocessLauncher) launcher = NULL;
g_autoptr(GSubprocess) subprocess = NULL;
g_autoptr(XdpAppInfo) appinfo = NULL;
guint name_timeout;
const char *argv[4];
GQuark portal_errors G_GNUC_UNUSED;
Expand Down Expand Up @@ -331,6 +333,10 @@ global_setup (void)
&error);
g_assert_no_error (error);

appinfo = xdp_get_app_info_from_pid (getpid (), &error);
g_assert_no_error (error);
appid = g_strdup (xdp_app_info_get_id (appinfo));

/* make sure errors are registered */
portal_errors = XDG_DESKTOP_PORTAL_ERROR;
}
Expand Down Expand Up @@ -387,6 +393,7 @@ global_teardown (void)

g_object_unref (lockdown);
g_object_unref (permission_store);
g_free (appid);

g_object_unref (session_bus);

Expand Down
4 changes: 2 additions & 2 deletions tests/test_globalshortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_global_shortcuts_create_close_session(self, portal_mock):
assert len(method_calls) > 0
_, args = method_calls[-1]
assert args[1] == session.handle
assert args[2] == "" # appid
# assert args[2] == "" # appid, not necessary empty

session.close()

Expand Down Expand Up @@ -67,7 +67,7 @@ def test_global_shortcuts_create_session_signal_closed(self, portal_mock):
assert len(method_calls) > 0
_, args = method_calls[-1]
assert args[1] == session.handle
assert args[2] == "" # appid
# assert args[2] == "" # appid, not necessary empty

# Now expect the backend to close it

Expand Down
4 changes: 2 additions & 2 deletions tests/test_remotedesktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_remote_desktop_create_close_session(self, portal_mock):
assert len(method_calls) > 0
_, args = method_calls[-1]
assert args[1] == session.handle
assert args[2] == "" # appid
# assert args[2] == "" # appid, not necessary empty

session.close()

Expand Down Expand Up @@ -67,7 +67,7 @@ def test_remote_desktop_create_session_signal_closed(self, portal_mock):
assert len(method_calls) > 0
_, args = method_calls[-1]
assert args[1] == session.handle
assert args[2] == "" # appid
# assert args[2] == "" # appid, not necessary empty

# Now expect the backend to close it

Expand Down
3 changes: 2 additions & 1 deletion tests/wallpaper.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ extern char outdir[];
static int got_info = 0;

extern XdpDbusImplPermissionStore *permission_store;
extern gchar *appid;

static void
set_wallpaper_permissions (const char *permission)
Expand All @@ -22,7 +23,7 @@ set_wallpaper_permissions (const char *permission)
"wallpaper",
TRUE,
"wallpaper",
"",
appid,
permissions,
NULL,
&error);
Expand Down
Loading