# HG changeset patch
# Node ID 60e70ccf6681
# Parent  8920a8452aea
diff --git a/libpurple/tests/test_credential_provider.c b/libpurple/tests/test_credential_provider.c
--- a/libpurple/tests/test_credential_provider.c
+++ b/libpurple/tests/test_credential_provider.c
@@ -34,7 +34,6 @@
 /******************************************************************************
  * TestCredentialProviderEmpty
  *****************************************************************************/
-#define TEST_PURPLE_TYPE_CREDENTIAL_PROVIDER_EMPTY (test_purple_credential_provider_empty_get_type())
 G_DECLARE_FINAL_TYPE(TestPurpleCredentialProviderEmpty,
                      test_purple_credential_provider_empty,
                      TEST_PURPLE, CREDENTIAL_PROVIDER_EMPTY,
@@ -102,7 +101,7 @@
 	GError *error = NULL;
 
 	provider = g_object_new(
-		TEST_PURPLE_TYPE_CREDENTIAL_PROVIDER_EMPTY,
+		test_purple_credential_provider_empty_get_type(),
 		"name", "name",
 		NULL);
 
@@ -119,7 +118,7 @@
 	GError *error = NULL;
 
 	provider = g_object_new(
-		TEST_PURPLE_TYPE_CREDENTIAL_PROVIDER_EMPTY,
+		test_purple_credential_provider_empty_get_type(),
 		"id", "id",
 		NULL);
 
@@ -137,7 +136,7 @@
 	GError *error = NULL;
 
 	provider = g_object_new(
-		TEST_PURPLE_TYPE_CREDENTIAL_PROVIDER_EMPTY,
+		test_purple_credential_provider_empty_get_type(),
 		"id", "id",
 		"name", "name",
 		NULL);
@@ -162,7 +161,7 @@
 	GError *error = NULL;
 
 	provider = g_object_new(
-		TEST_PURPLE_TYPE_CREDENTIAL_PROVIDER_EMPTY,
+		test_purple_credential_provider_empty_get_type(),
 		"id", "id",
 		"name", "name",
 		NULL);
@@ -188,7 +187,7 @@
 	gboolean ret = FALSE;
 
 	provider = g_object_new(
-		TEST_PURPLE_TYPE_CREDENTIAL_PROVIDER_EMPTY,
+		test_purple_credential_provider_empty_get_type(),
 		"id", "id",
 		"name", "name",
 		NULL);
@@ -209,7 +208,6 @@
 /******************************************************************************
  * TestPurpleCredentialProvider
  *****************************************************************************/
-#define TEST_PURPLE_TYPE_CREDENTIAL_PROVIDER (test_purple_credential_provider_get_type())
 G_DECLARE_FINAL_TYPE(TestPurpleCredentialProvider,
                      test_purple_credential_provider,
                      TEST_PURPLE, CREDENTIAL_PROVIDER,
@@ -249,14 +247,14 @@
 
 static gchar *
 test_purple_credential_provider_read_password_finish(PurpleCredentialProvider *p,
-                                                     G_GNUC_UNUSED GAsyncResult *result,
-                                                     G_GNUC_UNUSED GError **error)
+                                                     GAsyncResult *result,
+                                                     GError **error)
 {
 	TestPurpleCredentialProvider *provider = TEST_PURPLE_CREDENTIAL_PROVIDER(p);
 
 	provider->read_password_finish = TRUE;
 
-	return NULL;
+	return g_task_propagate_pointer(G_TASK(result), error);
 }
 
 static void
@@ -279,14 +277,14 @@
 
 static gboolean
 test_purple_credential_provider_write_password_finish(PurpleCredentialProvider *p,
-                                                      G_GNUC_UNUSED GAsyncResult *result,
-                                                      G_GNUC_UNUSED GError **error)
+                                                      GAsyncResult *result,
+                                                      GError **error)
 {
 	TestPurpleCredentialProvider *provider = TEST_PURPLE_CREDENTIAL_PROVIDER(p);
 
 	provider->write_password_finish = TRUE;
 
-	return FALSE;
+	return g_task_propagate_boolean(G_TASK(result), error);
 }
 
 static void
@@ -308,14 +306,14 @@
 
 static gboolean
 test_purple_credential_provider_clear_password_finish(PurpleCredentialProvider *p,
-                                                      G_GNUC_UNUSED GAsyncResult *result,
-                                                      G_GNUC_UNUSED GError **error)
+                                                      GAsyncResult *result,
+                                                      GError **error)
 {
 	TestPurpleCredentialProvider *provider = TEST_PURPLE_CREDENTIAL_PROVIDER(p);
 
 	provider->clear_password_finish = TRUE;
 
-	return FALSE;
+	return g_task_propagate_boolean(G_TASK(result), error);
 }
 
 static void
@@ -338,7 +336,7 @@
 static PurpleCredentialProvider *
 test_purple_credential_provider_new(void) {
 	return g_object_new(
-		TEST_PURPLE_TYPE_CREDENTIAL_PROVIDER,
+		test_purple_credential_provider_get_type(),
 		"id", "test-provider",
 		"name", "Test Provider",
 		NULL);
@@ -349,29 +347,30 @@
  *****************************************************************************/
 static gboolean
 test_purple_credential_provider_timeout_cb(gpointer data) {
-	g_main_loop_quit((GMainLoop *)data);
+	g_main_loop_quit(data);
 
 	g_warning("timed out waiting for the callback function to be called");
 
-	return FALSE;
+	return G_SOURCE_REMOVE;
 }
 
 static void
 test_purple_credential_provider_test_read_cb(GObject *obj, GAsyncResult *res,
-                                             gpointer d)
+                                             gpointer data)
 {
 	PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj);
-	PurpleAccount *account = PURPLE_ACCOUNT(d);
+	PurpleAccount *account = data;
+	GError *error = NULL;
 	gchar *password = NULL;
 
 	password = purple_credential_provider_read_password_finish(provider, res,
-	                                                           NULL);
+	                                                           &error);
+	g_assert_no_error(error);
+	g_assert_null(password);
 
-	g_object_unref(G_OBJECT(account));
+	g_clear_object(&account);
 
 	g_main_loop_quit(loop);
-
-	g_assert_null(password);
 }
 
 static gboolean
@@ -385,7 +384,7 @@
 	                                               test_purple_credential_provider_test_read_cb,
 	                                               account);
 
-	return FALSE;
+	return G_SOURCE_REMOVE;
 }
 
 static void
@@ -405,7 +404,7 @@
 	g_assert_false(tp->clear_password_async);
 	g_assert_false(tp->clear_password_finish);
 
-	g_object_unref(p);
+	g_clear_object(&p);
 }
 
 static void
@@ -414,10 +413,15 @@
 {
 	PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj);
 	PurpleAccount *account = PURPLE_ACCOUNT(d);
+	GError *error = NULL;
+	gboolean ret = FALSE;
 
-	test_purple_credential_provider_write_password_finish(provider, res, NULL);
+	ret = purple_credential_provider_write_password_finish(provider, res,
+	                                                       &error);
+	g_assert_no_error(error);
+	g_assert_true(ret);
 
-	g_object_unref(G_OBJECT(account));
+	g_clear_object(&account);
 
 	g_main_loop_quit(loop);
 }
@@ -433,7 +437,7 @@
 	                                                test_purple_credential_provider_test_write_cb,
 	                                                account);
 
-	return FALSE;
+	return G_SOURCE_REMOVE;
 }
 
 static void
@@ -453,19 +457,24 @@
 	g_assert_false(tp->clear_password_async);
 	g_assert_false(tp->clear_password_finish);
 
-	g_object_unref(G_OBJECT(p));
+	g_clear_object(&p);
 }
 
 static void
 test_purple_credential_provider_test_clear_cb(GObject *obj, GAsyncResult *res,
-                                              gpointer d)
+                                              gpointer data)
 {
 	PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj);
-	PurpleAccount *account = PURPLE_ACCOUNT(d);
+	PurpleAccount *account = data;
+	GError *error = NULL;
+	gboolean ret = FALSE;
 
-	test_purple_credential_provider_clear_password_finish(provider, res, NULL);
+	ret = purple_credential_provider_clear_password_finish(provider, res,
+	                                                       &error);
+	g_assert_no_error(error);
+	g_assert_true(ret);
 
-	g_object_unref(G_OBJECT(account));
+	g_clear_object(&account);
 
 	g_main_loop_quit(loop);
 }
@@ -481,7 +490,7 @@
 	                                                test_purple_credential_provider_test_clear_cb,
 	                                                account);
 
-	return FALSE;
+	return G_SOURCE_REMOVE;
 }
 
 static void
@@ -501,7 +510,7 @@
 	g_assert_true(tp->clear_password_async);
 	g_assert_true(tp->clear_password_finish);
 
-	g_object_unref(p);
+	g_clear_object(&p);
 }
 
 /******************************************************************************
