mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2024-12-22 20:58:52 +00:00
Make sure notifications come in for new objects before waiting
* In tests make sure notifications settle down before waiting on new notifications. This fixes random test crashes. * Using async here means all signals are delivered by the time we get the new object.
This commit is contained in:
parent
600021a30b
commit
3cb0d8047d
@ -436,14 +436,18 @@ test_set_label_prop (Test *test,
|
|||||||
gconstpointer unused)
|
gconstpointer unused)
|
||||||
{
|
{
|
||||||
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
const gchar *collection_path = "/org/freedesktop/secrets/collection/english";
|
||||||
|
GAsyncResult *result = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
SecretCollection *collection;
|
SecretCollection *collection;
|
||||||
guint sigs = 2;
|
guint sigs = 2;
|
||||||
gchar *label;
|
gchar *label;
|
||||||
|
|
||||||
collection = secret_collection_new_sync (test->service, collection_path,
|
secret_collection_new (test->service, collection_path, SECRET_COLLECTION_NONE, NULL, on_async_result, &result);
|
||||||
SECRET_COLLECTION_NONE, NULL, &error);
|
g_assert (result == NULL);
|
||||||
|
egg_test_wait ();
|
||||||
|
collection = secret_collection_new_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_unref (result);
|
||||||
|
|
||||||
label = secret_collection_get_label (collection);
|
label = secret_collection_get_label (collection);
|
||||||
g_assert_cmpstr (label, ==, "Collection One");
|
g_assert_cmpstr (label, ==, "Collection One");
|
||||||
|
@ -367,13 +367,18 @@ test_set_label_prop (Test *test,
|
|||||||
gconstpointer unused)
|
gconstpointer unused)
|
||||||
{
|
{
|
||||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||||
|
GAsyncResult *result = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
SecretItem *item;
|
SecretItem *item;
|
||||||
guint sigs = 2;
|
guint sigs = 2;
|
||||||
gchar *label;
|
gchar *label;
|
||||||
|
|
||||||
item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error);
|
secret_item_new (test->service, item_path, SECRET_ITEM_NONE, NULL, on_async_result, &result);
|
||||||
|
g_assert (result == NULL);
|
||||||
|
egg_test_wait ();
|
||||||
|
item = secret_item_new_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_unref (result);
|
||||||
|
|
||||||
label = secret_item_get_label (item);
|
label = secret_item_get_label (item);
|
||||||
g_assert_cmpstr (label, ==, "Item One");
|
g_assert_cmpstr (label, ==, "Item One");
|
||||||
@ -477,13 +482,18 @@ test_set_attributes_prop (Test *test,
|
|||||||
gconstpointer unused)
|
gconstpointer unused)
|
||||||
{
|
{
|
||||||
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
const gchar *item_path = "/org/freedesktop/secrets/collection/english/1";
|
||||||
|
GAsyncResult *result = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
SecretItem *item;
|
SecretItem *item;
|
||||||
GHashTable *attributes;
|
GHashTable *attributes;
|
||||||
guint sigs = 2;
|
guint sigs = 2;
|
||||||
|
|
||||||
item = secret_item_new_sync (test->service, item_path, SECRET_ITEM_NONE, NULL, &error);
|
secret_item_new (test->service, item_path, SECRET_ITEM_NONE, NULL, on_async_result, &result);
|
||||||
|
g_assert (result == NULL);
|
||||||
|
egg_test_wait ();
|
||||||
|
item = secret_item_new_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_unref (result);
|
||||||
|
|
||||||
attributes = secret_item_get_attributes (item);
|
attributes = secret_item_get_attributes (item);
|
||||||
g_assert_cmpstr (g_hash_table_lookup (attributes, "string"), ==, "one");
|
g_assert_cmpstr (g_hash_table_lookup (attributes, "string"), ==, "one");
|
||||||
|
Loading…
Reference in New Issue
Block a user