summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGabriel Ivascu <gabrielivascu@gnome.org>2017-10-19 00:16:15 +0300
committerGabriel Ivascu <gabrielivascu@gnome.org>2017-10-19 00:16:15 +0300
commit1a71dfaf99f7665551148468d35e23f0eeab86c5 (patch)
tree4d69dc28d21a19b9e1854045f3f5a8866fb32776 /tests
parent22c6aec089ff440f05fe3cdf3b668942d12bab6c (diff)
downloadepiphany-1a71dfaf99f7665551148468d35e23f0eeab86c5.tar.gz
gsb-service: Do URL verification in a separate thread
This way the UI thread won't get blocked when database lookups tend to be too slow.
Diffstat (limited to 'tests')
-rw-r--r--tests/ephy-gsb-service-test.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/ephy-gsb-service-test.c b/tests/ephy-gsb-service-test.c
index 4be5690f1..516cb11de 100644
--- a/tests/ephy-gsb-service-test.c
+++ b/tests/ephy-gsb-service-test.c
@@ -199,14 +199,18 @@ static GMainLoop *test_verify_url_loop;
static int test_verify_url_counter;
static void
-test_verify_url_cb (GHashTable *threats,
- gpointer user_data)
+test_verify_url_cb (EphyGSBService *service,
+ GAsyncResult *result,
+ gpointer user_data)
{
gboolean is_threat = GPOINTER_TO_UINT (user_data);
+ GList *threats = ephy_gsb_service_verify_url_finish (service, result);
- g_assert_true ((g_hash_table_size (threats) > 0) == is_threat);
+ g_assert_true ((threats != NULL) == is_threat);
- if (--test_verify_url_counter == 0)
+ g_list_free_full (threats, g_free);
+
+ if (g_atomic_int_dec_and_test (&test_verify_url_counter))
g_main_loop_quit (test_verify_url_loop);
}
@@ -219,7 +223,7 @@ gsb_service_update_finished_cb (EphyGSBService *service,
ephy_gsb_service_verify_url (service,
test.url,
- test_verify_url_cb,
+ (GAsyncReadyCallback)test_verify_url_cb,
GUINT_TO_POINTER (test.is_threat));
}
}