[neon/backports-focal/xdg-desktop-portal/Neon/unstable] tests: tests: Make sure http2 test always runs

Bastien Nocera null at kde.org
Wed Jan 13 06:32:43 GMT 2021


Git commit a41a189f3290b6a03ce98f844697e45a327852d0 by Bastien Nocera.
Committed on 22/04/2020 at 14:15.
Pushed by ash into branch 'Neon/unstable'.

tests: Make sure http2 test always runs

By installing our own handler for the http scheme.

M  +6    -0    tests/Makefile.am.inc
M  +3    -7    tests/openuri.c
A  +13   -0    tests/share/applications/furrfix.desktop
A  +9    -0    tests/share/applications/mimeinfo.cache

https://invent.kde.org/neon/backports-focal/xdg-desktop-portal/commit/a41a189f3290b6a03ce98f844697e45a327852d0

diff --git a/tests/Makefile.am.inc b/tests/Makefile.am.inc
index 981c8d5..e4ea3de 100644
--- a/tests/Makefile.am.inc
+++ b/tests/Makefile.am.inc
@@ -2,6 +2,7 @@ test_programs =
 
 TESTS_ENVIRONMENT = \
 	PATH=$$(cd $(top_builddir) && pwd):$${PATH} \
+	XDG_DATA_DIRS=$(top_srcdir)/tests/share/:$${XDG_DATA_DIRS} \
 	XDP_UNINSTALLED=1 \
 	$(NULL)
 
@@ -120,6 +121,11 @@ dist_test_scripts = \
 	tests/test-document-fuse.sh \
 	$(NULL)
 
+dist_test_apps = \
+	tests/share/applications/furrfix.desktop \
+	tests/share/applications/mimeinfo.cache \
+	$(NULL)
+
 test_programs += \
 	testdb \
 	test-doc-portal \
diff --git a/tests/openuri.c b/tests/openuri.c
index df3a754..88ae738 100644
--- a/tests/openuri.c
+++ b/tests/openuri.c
@@ -157,13 +157,9 @@ test_open_uri_http2 (void)
   g_autoptr(GAppInfo) app = NULL;
   g_autofree char *app_id = NULL;
 
-  app = g_app_info_get_default_for_type ("x-scheme-handler/http", FALSE);
-
-  if (app == NULL)
-    {
-      g_test_skip ("No default handler for x-scheme-handler/http set");
-      return;
-    }
+  /* get furrfix.desktop as an app */
+  app = g_app_info_get_default_for_type ("x-scheme-handler/xdg-desktop-portal-test", FALSE);
+  g_assert_nonnull (app);
 
   app_id = g_strndup (g_app_info_get_id (app), strlen (g_app_info_get_id (app)) - strlen (".desktop"));
 
diff --git a/tests/share/applications/furrfix.desktop b/tests/share/applications/furrfix.desktop
new file mode 100644
index 0000000..f35caf0
--- /dev/null
+++ b/tests/share/applications/furrfix.desktop
@@ -0,0 +1,13 @@
+[Desktop Entry]
+Version=1.0
+Name=Furrfix
+GenericName=Not a Web Browser
+Comment=Don't Browse the Web
+Exec=true %u
+Icon=furrfix
+Terminal=false
+Type=Application
+MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/xdg-desktop-portal-test;
+StartupNotify=true
+Categories=Network;WebBrowser;
+Keywords=web;browser;internet;
diff --git a/tests/share/applications/mimeinfo.cache b/tests/share/applications/mimeinfo.cache
new file mode 100644
index 0000000..7881f39
--- /dev/null
+++ b/tests/share/applications/mimeinfo.cache
@@ -0,0 +1,9 @@
+[MIME Cache]
+application/vnd.mozilla.xul+xml=furrfix.desktop;
+application/xhtml+xml=furrfix.desktop;
+text/html=furrfix.desktop;
+text/mml=furrfix.desktop;
+text/xml=furrfix.desktop;
+x-scheme-handler/http=furrfix.desktop;
+x-scheme-handler/https=furrfix.desktop;
+x-scheme-handler/xdg-desktop-portal-test=furrfix.desktop;



More information about the Neon-commits mailing list