# HG changeset patch
# Node ID cb9e5cc79db9
# Parent  6966466e0e43
diff --git a/gplugin/tests/meson.build b/gplugin/tests/meson.build
--- a/gplugin/tests/meson.build
+++ b/gplugin/tests/meson.build
@@ -30,6 +30,7 @@
   'id-collision': ['id-collision'],
   'id-normalize': [],
   'loader': [],
+  'loader-registration': [],
   'newest-version': ['newest-version'],
   'option-group': [],
   'plugin-manager-paths': [],
@@ -71,18 +72,6 @@
 	     depends: depends)
 endforeach
 
-# This test requires internal private API.
-e = executable('test-loader-registration', 'test-loader-registration.c',
-               dependencies: [
-                 gplugin_dep.partial_dependency(compile_args: true,
-                                                includes: true,
-                                                sources: true),
-                 GLIB,
-                 GOBJECT,
-                 GMODULE],
-               objects: gplugin.extract_all_objects(recursive: true))
-test('loader-registration', e)
-
 #######################################
 # Native Loader
 #######################################
diff --git a/gplugin/tests/test-loader-registration.c b/gplugin/tests/test-loader-registration.c
--- a/gplugin/tests/test-loader-registration.c
+++ b/gplugin/tests/test-loader-registration.c
@@ -15,11 +15,9 @@
  * License along with this library; if not, see <https://www.gnu.org/licenses/>.
  */
 
-#include <gplugin.h>
+#include <glib.h>
 
-#include "../gplugin-private.h"
-
-#include <glib.h>
+#include <gplugin.h>
 
 /******************************************************************************
  * GObject Implementation
@@ -109,7 +107,7 @@
 	G_GNUC_UNUSED GPluginLoader *loader,
 	gpointer data)
 {
-	gint *counter = data;
+	guint *counter = data;
 
 	*counter = *counter + 1;
 }
@@ -120,16 +118,15 @@
 static void
 test_gplugin_manager_loader_register_unregister(void)
 {
+	GPluginLoader *loader = NULL;
 	GPluginManager *manager = NULL;
-	GPluginLoader *loader = NULL;
 	GError *error = NULL;
 	gboolean ret;
-	gint registrations = 0, unregistrations = 0;
+	guint registrations = 0;
+	guint unregistrations = 0;
 
-	gplugin_manager_private_uninit();
-	gplugin_manager_private_init(TRUE);
+	manager = g_object_new(GPLUGIN_TYPE_MANAGER, NULL);
 
-	manager = gplugin_manager_get_default();
 	g_signal_connect(
 		manager,
 		"loader-registered",
@@ -154,22 +151,22 @@
 	g_assert_cmpuint(registrations, ==, 1);
 	g_assert_cmpuint(unregistrations, ==, 1);
 
-	g_clear_object(&loader);
+	g_assert_finalize_object(loader);
+	g_assert_finalize_object(manager);
 }
 
 static void
 test_gplugin_manager_loader_register_twice(void)
 {
+	GPluginLoader *loader = NULL;
 	GPluginManager *manager = NULL;
-	GPluginLoader *loader = NULL;
 	GError *error = NULL;
 	gboolean ret;
-	guint registrations = 0, unregistrations = 0;
+	guint registrations = 0;
+	guint unregistrations = 0;
 
-	gplugin_manager_private_uninit();
-	gplugin_manager_private_init(TRUE);
+	manager = g_object_new(GPLUGIN_TYPE_MANAGER, NULL);
 
-	manager = gplugin_manager_get_default();
 	g_signal_connect(
 		manager,
 		"loader-registered",
@@ -199,22 +196,22 @@
 	g_assert_cmpuint(registrations, ==, 1);
 	g_assert_cmpuint(unregistrations, ==, 1);
 
-	g_clear_object(&loader);
+	g_assert_finalize_object(loader);
+	g_assert_finalize_object(manager);
 }
 
 static void
 test_gplugin_manager_loader_unregister_twice(void)
 {
+	GPluginLoader *loader = NULL;
 	GPluginManager *manager = NULL;
-	GPluginLoader *loader = NULL;
 	GError *error = NULL;
 	gboolean ret;
-	guint registrations = 0, unregistrations = 0;
+	guint registrations = 0;
+	guint unregistrations = 0;
 
-	gplugin_manager_private_uninit();
-	gplugin_manager_private_init(TRUE);
+	manager = g_object_new(GPLUGIN_TYPE_MANAGER, NULL);
 
-	manager = gplugin_manager_get_default();
 	g_signal_connect(
 		manager,
 		"loader-registered",
@@ -244,7 +241,8 @@
 	g_assert_cmpuint(registrations, ==, 1);
 	g_assert_cmpuint(unregistrations, ==, 1);
 
-	g_clear_object(&loader);
+	g_assert_finalize_object(loader);
+	g_assert_finalize_object(manager);
 }
 
 /******************************************************************************
