mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
gio/tests: Add tests for flatpak infos
Support testing flatpak infos, we do it by faking /.flatpak-info file in case we're building in test mode.
This commit is contained in:
@@ -77,13 +77,21 @@ sandbox_info_read (void)
|
||||
case G_SANDBOX_TYPE_FLATPAK:
|
||||
{
|
||||
GKeyFile *keyfile;
|
||||
const char *keyfile_path = "/.flatpak-info";
|
||||
|
||||
use_portal = TRUE;
|
||||
network_available = FALSE;
|
||||
dconf_access = FALSE;
|
||||
|
||||
keyfile = g_key_file_new ();
|
||||
if (g_key_file_load_from_file (keyfile, "/.flatpak-info", G_KEY_FILE_NONE, NULL))
|
||||
|
||||
#ifdef G_PORTAL_SUPPORT_TEST
|
||||
char *test_key_file =
|
||||
g_build_filename (g_get_user_runtime_dir (), keyfile_path, NULL);
|
||||
keyfile_path = test_key_file;
|
||||
#endif
|
||||
|
||||
if (g_key_file_load_from_file (keyfile, keyfile_path, G_KEY_FILE_NONE, NULL))
|
||||
{
|
||||
char **shared = NULL;
|
||||
char *dconf_policy = NULL;
|
||||
@@ -104,6 +112,10 @@ sandbox_info_read (void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G_PORTAL_SUPPORT_TEST
|
||||
g_clear_pointer (&test_key_file, g_free);
|
||||
#endif
|
||||
|
||||
g_key_file_unref (keyfile);
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user