mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2024-12-22 12:48:51 +00:00
More reliable means of checking if object was finalized
Don't try to use G_IS_OBJECT() to see if an object was finalized as this segfaults in corner cases, even with our crafty check for a pointer within our memory space. https://bugzilla.gnome.org/show_bug.cgi?id=705202
This commit is contained in:
parent
5c9001ab6f
commit
9dc2f2c112
@ -66,42 +66,6 @@ egg_test_escape_data (const guchar *data,
|
|||||||
return g_string_free (result, FALSE);
|
return g_string_free (result, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
is_readable_ptr (gpointer was_object)
|
|
||||||
{
|
|
||||||
static gint test_memory_fd = -1;
|
|
||||||
|
|
||||||
/* First make sure this memory is still accessible */
|
|
||||||
if (test_memory_fd < 0)
|
|
||||||
test_memory_fd = g_open ("/dev/null", O_WRONLY, 0);
|
|
||||||
if (write (test_memory_fd, was_object, 1) > 0)
|
|
||||||
return TRUE;
|
|
||||||
return (errno != EFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
egg_assertion_not_object (const char *domain,
|
|
||||||
const char *file,
|
|
||||||
int line,
|
|
||||||
const char *func,
|
|
||||||
const char *expr,
|
|
||||||
gpointer was_object)
|
|
||||||
{
|
|
||||||
gchar *s;
|
|
||||||
|
|
||||||
if (RUNNING_ON_VALGRIND)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!is_readable_ptr (was_object))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (G_IS_OBJECT (was_object)) {
|
|
||||||
s = g_strdup_printf ("assertion failed: %s is still referenced", expr);
|
|
||||||
g_assertion_message (domain, file, line, func, s);
|
|
||||||
g_free (s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
egg_assertion_message_cmpmem (const char *domain,
|
egg_assertion_message_cmpmem (const char *domain,
|
||||||
const char *file,
|
const char *file,
|
||||||
|
@ -37,16 +37,6 @@
|
|||||||
G_STRFUNC, #a "[" #na"] " #cmp " " #b "[" #nb "]", \
|
G_STRFUNC, #a "[" #na"] " #cmp " " #b "[" #nb "]", \
|
||||||
__p1, __n1, #cmp, __p2, __n2); } while (0)
|
__p1, __n1, #cmp, __p2, __n2); } while (0)
|
||||||
|
|
||||||
#define egg_assert_not_object(p) \
|
|
||||||
(egg_assertion_not_object (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, #p, (p)))
|
|
||||||
|
|
||||||
void egg_assertion_not_object (const char *domain,
|
|
||||||
const char *file,
|
|
||||||
int line,
|
|
||||||
const char *func,
|
|
||||||
const char *expr,
|
|
||||||
gpointer was_object);
|
|
||||||
|
|
||||||
void egg_assertion_message_cmpmem (const char *domain, const char *file,
|
void egg_assertion_message_cmpmem (const char *domain, const char *file,
|
||||||
int line, const char *func,
|
int line, const char *func,
|
||||||
const char *expr, gconstpointer arg1,
|
const char *expr, gconstpointer arg1,
|
||||||
|
@ -55,6 +55,7 @@ setup (Test *test,
|
|||||||
|
|
||||||
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (test->service), (gpointer *)&test->service);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -63,7 +64,7 @@ teardown (Test *test,
|
|||||||
{
|
{
|
||||||
g_object_unref (test->service);
|
g_object_unref (test->service);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (test->service);
|
g_assert (test->service == NULL);
|
||||||
|
|
||||||
mock_service_stop ();
|
mock_service_stop ();
|
||||||
}
|
}
|
||||||
@ -103,11 +104,12 @@ test_new_sync (Test *test,
|
|||||||
collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
|
collection = secret_collection_new_for_dbus_path_sync (test->service, collection_path,
|
||||||
SECRET_COLLECTION_NONE, NULL, &error);
|
SECRET_COLLECTION_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (collection), (gpointer *)&collection);
|
||||||
|
|
||||||
g_assert_cmpstr (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), ==, collection_path);
|
g_assert_cmpstr (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), ==, collection_path);
|
||||||
|
|
||||||
g_object_unref (collection);
|
g_object_unref (collection);
|
||||||
egg_assert_not_object (collection);
|
g_assert (collection == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -128,11 +130,12 @@ test_new_async (Test *test,
|
|||||||
collection = secret_collection_new_for_dbus_path_finish (result, &error);
|
collection = secret_collection_new_for_dbus_path_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (collection), (gpointer *)&collection);
|
||||||
|
|
||||||
g_assert_cmpstr (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), ==, collection_path);
|
g_assert_cmpstr (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), ==, collection_path);
|
||||||
|
|
||||||
g_object_unref (collection);
|
g_object_unref (collection);
|
||||||
egg_assert_not_object (collection);
|
g_assert (collection == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -296,13 +299,14 @@ test_create_sync (Test *test,
|
|||||||
collection = secret_collection_create_sync (test->service, "Train", NULL,
|
collection = secret_collection_create_sync (test->service, "Train", NULL,
|
||||||
SECRET_COLLECTION_CREATE_NONE, NULL, &error);
|
SECRET_COLLECTION_CREATE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (collection), (gpointer *)&collection);
|
||||||
|
|
||||||
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection"));
|
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection"));
|
||||||
g_assert_cmpstr (secret_collection_get_label (collection), ==, "Train");
|
g_assert_cmpstr (secret_collection_get_label (collection), ==, "Train");
|
||||||
g_assert (secret_collection_get_locked (collection) == FALSE);
|
g_assert (secret_collection_get_locked (collection) == FALSE);
|
||||||
|
|
||||||
g_object_unref (collection);
|
g_object_unref (collection);
|
||||||
egg_assert_not_object (collection);
|
g_assert (collection == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -323,13 +327,14 @@ test_create_async (Test *test,
|
|||||||
collection = secret_collection_create_finish (result, &error);
|
collection = secret_collection_create_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (collection), (gpointer *)&collection);
|
||||||
|
|
||||||
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection"));
|
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (collection)), "/org/freedesktop/secrets/collection"));
|
||||||
g_assert_cmpstr (secret_collection_get_label (collection), ==, "Train");
|
g_assert_cmpstr (secret_collection_get_label (collection), ==, "Train");
|
||||||
g_assert (secret_collection_get_locked (collection) == FALSE);
|
g_assert (secret_collection_get_locked (collection) == FALSE);
|
||||||
|
|
||||||
g_object_unref (collection);
|
g_object_unref (collection);
|
||||||
egg_assert_not_object (collection);
|
g_assert (collection == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -56,6 +56,7 @@ setup (Test *test,
|
|||||||
|
|
||||||
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (test->service), (gpointer *)&test->service);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -64,7 +65,7 @@ teardown (Test *test,
|
|||||||
{
|
{
|
||||||
g_object_unref (test->service);
|
g_object_unref (test->service);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (test->service);
|
g_assert (test->service == NULL);
|
||||||
|
|
||||||
mock_service_stop ();
|
mock_service_stop ();
|
||||||
}
|
}
|
||||||
@ -192,6 +193,7 @@ test_create_sync (Test *test,
|
|||||||
item = secret_item_create_sync (collection, &MOCK_SCHEMA, attributes, "Tunnel",
|
item = secret_item_create_sync (collection, &MOCK_SCHEMA, attributes, "Tunnel",
|
||||||
value, SECRET_ITEM_CREATE_NONE, NULL, &error);
|
value, SECRET_ITEM_CREATE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (item), (gpointer *)&item);
|
||||||
|
|
||||||
g_hash_table_unref (attributes);
|
g_hash_table_unref (attributes);
|
||||||
g_object_unref (collection);
|
g_object_unref (collection);
|
||||||
@ -202,7 +204,7 @@ test_create_sync (Test *test,
|
|||||||
g_assert (secret_item_get_locked (item) == FALSE);
|
g_assert (secret_item_get_locked (item) == FALSE);
|
||||||
|
|
||||||
g_object_unref (item);
|
g_object_unref (item);
|
||||||
egg_assert_not_object (item);
|
g_assert (item == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -241,13 +243,14 @@ test_create_async (Test *test,
|
|||||||
item = secret_item_create_finish (result, &error);
|
item = secret_item_create_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (item), (gpointer *)&item);
|
||||||
|
|
||||||
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)), collection_path));
|
g_assert (g_str_has_prefix (g_dbus_proxy_get_object_path (G_DBUS_PROXY (item)), collection_path));
|
||||||
g_assert_cmpstr (secret_item_get_label (item), ==, "Tunnel");
|
g_assert_cmpstr (secret_item_get_label (item), ==, "Tunnel");
|
||||||
g_assert (secret_item_get_locked (item) == FALSE);
|
g_assert (secret_item_get_locked (item) == FALSE);
|
||||||
|
|
||||||
g_object_unref (item);
|
g_object_unref (item);
|
||||||
egg_assert_not_object (item);
|
g_assert (item == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -83,6 +83,7 @@ setup (Test *test,
|
|||||||
|
|
||||||
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (test->service), (gpointer *)&test->service);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -101,7 +102,7 @@ teardown (Test *test,
|
|||||||
|
|
||||||
g_object_unref (test->service);
|
g_object_unref (test->service);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (test->service);
|
g_assert (test->service == NULL);
|
||||||
|
|
||||||
teardown_mock (test, unused);
|
teardown_mock (test, unused);
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,7 @@ setup (Test *test,
|
|||||||
|
|
||||||
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (test->service), (gpointer *)&test->service);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -101,7 +102,7 @@ teardown (Test *test,
|
|||||||
|
|
||||||
g_object_unref (test->service);
|
g_object_unref (test->service);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (test->service);
|
g_assert (test->service == NULL);
|
||||||
|
|
||||||
teardown_mock (test, unused);
|
teardown_mock (test, unused);
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ setup (Test *test,
|
|||||||
|
|
||||||
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (test->service), (gpointer *)&test->service);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -53,7 +54,7 @@ teardown (Test *test,
|
|||||||
{
|
{
|
||||||
g_object_unref (test->service);
|
g_object_unref (test->service);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (test->service);
|
g_assert (test->service == NULL);
|
||||||
|
|
||||||
mock_service_stop ();
|
mock_service_stop ();
|
||||||
}
|
}
|
||||||
@ -97,12 +98,13 @@ test_perform_sync (Test *test,
|
|||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (retval != NULL);
|
g_assert (retval != NULL);
|
||||||
g_variant_unref (retval);
|
g_variant_unref (retval);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt);
|
||||||
|
|
||||||
g_assert_cmpuint (value, ==, 0);
|
g_assert_cmpuint (value, ==, 0);
|
||||||
g_source_remove (increment_id);
|
g_source_remove (increment_id);
|
||||||
|
|
||||||
g_object_unref (prompt);
|
g_object_unref (prompt);
|
||||||
egg_assert_not_object (prompt);
|
g_assert (prompt == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -124,6 +126,7 @@ test_perform_run (Test *test,
|
|||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (retval != NULL);
|
g_assert (retval != NULL);
|
||||||
g_variant_unref (retval);
|
g_variant_unref (retval);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt);
|
||||||
|
|
||||||
g_assert_cmpuint (value, >, 0);
|
g_assert_cmpuint (value, >, 0);
|
||||||
g_source_remove (increment_id);
|
g_source_remove (increment_id);
|
||||||
@ -132,7 +135,7 @@ test_perform_run (Test *test,
|
|||||||
egg_test_wait_idle ();
|
egg_test_wait_idle ();
|
||||||
|
|
||||||
g_object_unref (prompt);
|
g_object_unref (prompt);
|
||||||
egg_assert_not_object (prompt);
|
g_assert (prompt == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -145,6 +148,7 @@ test_perform_async (Test *test,
|
|||||||
GVariant *retval;
|
GVariant *retval;
|
||||||
|
|
||||||
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt);
|
||||||
|
|
||||||
secret_prompt_perform (prompt, 0, NULL, NULL, on_async_result, &result);
|
secret_prompt_perform (prompt, 0, NULL, NULL, on_async_result, &result);
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
@ -161,7 +165,7 @@ test_perform_async (Test *test,
|
|||||||
egg_test_wait_idle ();
|
egg_test_wait_idle ();
|
||||||
|
|
||||||
g_object_unref (prompt);
|
g_object_unref (prompt);
|
||||||
egg_assert_not_object (prompt);
|
g_assert (prompt == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -175,6 +179,7 @@ test_perform_cancel (Test *test,
|
|||||||
GVariant *retval;
|
GVariant *retval;
|
||||||
|
|
||||||
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/delay");
|
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/delay");
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt);
|
||||||
|
|
||||||
cancellable = g_cancellable_new ();
|
cancellable = g_cancellable_new ();
|
||||||
secret_prompt_perform (prompt, 0, NULL, cancellable, on_async_result, &result);
|
secret_prompt_perform (prompt, 0, NULL, cancellable, on_async_result, &result);
|
||||||
@ -196,7 +201,7 @@ test_perform_cancel (Test *test,
|
|||||||
/* Due to GDBus threading races */
|
/* Due to GDBus threading races */
|
||||||
egg_test_wait_until (100);
|
egg_test_wait_until (100);
|
||||||
|
|
||||||
egg_assert_not_object (prompt);
|
g_assert (prompt == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -208,13 +213,14 @@ test_perform_fail (Test *test,
|
|||||||
GVariant *retval;
|
GVariant *retval;
|
||||||
|
|
||||||
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/error");
|
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/error");
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt);
|
||||||
|
|
||||||
retval = secret_prompt_perform_sync (prompt, 0, NULL, NULL, &error);
|
retval = secret_prompt_perform_sync (prompt, 0, NULL, NULL, &error);
|
||||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED);
|
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED);
|
||||||
g_assert (retval == NULL);
|
g_assert (retval == NULL);
|
||||||
|
|
||||||
g_object_unref (prompt);
|
g_object_unref (prompt);
|
||||||
egg_assert_not_object (prompt);
|
g_assert (prompt == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -226,13 +232,14 @@ test_perform_vanish (Test *test,
|
|||||||
GVariant *retval;
|
GVariant *retval;
|
||||||
|
|
||||||
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/vanish");
|
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/vanish");
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt);
|
||||||
|
|
||||||
retval = secret_prompt_perform_sync (prompt, 0, NULL, NULL, &error);
|
retval = secret_prompt_perform_sync (prompt, 0, NULL, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (retval == NULL);
|
g_assert (retval == NULL);
|
||||||
|
|
||||||
g_object_unref (prompt);
|
g_object_unref (prompt);
|
||||||
egg_assert_not_object (prompt);
|
g_assert (prompt == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -244,6 +251,7 @@ test_prompt_result (Test *test,
|
|||||||
GVariant *retval;
|
GVariant *retval;
|
||||||
|
|
||||||
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/result");
|
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/result");
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt);
|
||||||
|
|
||||||
retval = secret_prompt_perform_sync (prompt, 0, NULL, G_VARIANT_TYPE_STRING, &error);
|
retval = secret_prompt_perform_sync (prompt, 0, NULL, G_VARIANT_TYPE_STRING, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -252,7 +260,7 @@ test_prompt_result (Test *test,
|
|||||||
g_variant_unref (retval);
|
g_variant_unref (retval);
|
||||||
|
|
||||||
g_object_unref (prompt);
|
g_object_unref (prompt);
|
||||||
egg_assert_not_object (prompt);
|
g_assert (prompt == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -264,6 +272,7 @@ test_prompt_window_id (Test *test,
|
|||||||
GVariant *retval;
|
GVariant *retval;
|
||||||
|
|
||||||
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/window");
|
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/window");
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt);
|
||||||
|
|
||||||
retval = secret_prompt_perform_sync (prompt, 555, NULL, G_VARIANT_TYPE_STRING, &error);
|
retval = secret_prompt_perform_sync (prompt, 555, NULL, G_VARIANT_TYPE_STRING, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -272,7 +281,7 @@ test_prompt_window_id (Test *test,
|
|||||||
g_variant_unref (retval);
|
g_variant_unref (retval);
|
||||||
|
|
||||||
g_object_unref (prompt);
|
g_object_unref (prompt);
|
||||||
egg_assert_not_object (prompt);
|
g_assert (prompt == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -284,6 +293,7 @@ test_service_sync (Test *test,
|
|||||||
GVariant *retval;
|
GVariant *retval;
|
||||||
|
|
||||||
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt);
|
||||||
|
|
||||||
retval = secret_service_prompt_sync (test->service, prompt, NULL, NULL, &error);
|
retval = secret_service_prompt_sync (test->service, prompt, NULL, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -291,7 +301,7 @@ test_service_sync (Test *test,
|
|||||||
g_variant_unref (retval);
|
g_variant_unref (retval);
|
||||||
|
|
||||||
g_object_unref (prompt);
|
g_object_unref (prompt);
|
||||||
egg_assert_not_object (prompt);
|
g_assert (prompt == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -304,6 +314,7 @@ test_service_async (Test *test,
|
|||||||
GVariant *retval;
|
GVariant *retval;
|
||||||
|
|
||||||
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/simple");
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt);
|
||||||
|
|
||||||
secret_service_prompt (test->service, prompt, NULL, NULL, on_async_result, &result);
|
secret_service_prompt (test->service, prompt, NULL, NULL, on_async_result, &result);
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
@ -320,7 +331,7 @@ test_service_async (Test *test,
|
|||||||
egg_test_wait_idle ();
|
egg_test_wait_idle ();
|
||||||
|
|
||||||
g_object_unref (prompt);
|
g_object_unref (prompt);
|
||||||
egg_assert_not_object (prompt);
|
g_assert (prompt == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -333,6 +344,7 @@ test_service_fail (Test *test,
|
|||||||
GVariant *retval;
|
GVariant *retval;
|
||||||
|
|
||||||
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/error");
|
prompt = _secret_prompt_instance (test->service, "/org/freedesktop/secrets/prompts/error");
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (prompt), (gpointer *)&prompt);
|
||||||
|
|
||||||
secret_service_prompt (test->service, prompt, NULL, NULL, on_async_result, &result);
|
secret_service_prompt (test->service, prompt, NULL, NULL, on_async_result, &result);
|
||||||
g_assert (result == NULL);
|
g_assert (result == NULL);
|
||||||
@ -348,7 +360,7 @@ test_service_fail (Test *test,
|
|||||||
egg_test_wait_idle ();
|
egg_test_wait_idle ();
|
||||||
|
|
||||||
g_object_unref (prompt);
|
g_object_unref (prompt);
|
||||||
egg_assert_not_object (prompt);
|
g_assert (prompt == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -78,6 +78,7 @@ test_get_sync (void)
|
|||||||
|
|
||||||
service2 = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
service2 = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service2), (gpointer *)&service2);
|
||||||
|
|
||||||
g_assert (SECRET_IS_SERVICE (service1));
|
g_assert (SECRET_IS_SERVICE (service1));
|
||||||
g_assert (service1 == service2);
|
g_assert (service1 == service2);
|
||||||
@ -87,16 +88,17 @@ test_get_sync (void)
|
|||||||
|
|
||||||
g_object_unref (service2);
|
g_object_unref (service2);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (service2);
|
g_assert (service2 == NULL);
|
||||||
|
|
||||||
/* Services were disconnected, so this should create a new one */
|
/* Services were disconnected, so this should create a new one */
|
||||||
service3 = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
service3 = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert (SECRET_IS_SERVICE (service3));
|
g_assert (SECRET_IS_SERVICE (service3));
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service3), (gpointer *)&service3);
|
||||||
|
|
||||||
g_object_unref (service3);
|
g_object_unref (service3);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (service3);
|
g_assert (service3 == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -123,6 +125,7 @@ test_get_async (void)
|
|||||||
service2 = secret_service_get_finish (result, &error);
|
service2 = secret_service_get_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_clear_object (&result);
|
g_clear_object (&result);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service2), (gpointer *)&service2);
|
||||||
|
|
||||||
g_assert (SECRET_IS_SERVICE (service1));
|
g_assert (SECRET_IS_SERVICE (service1));
|
||||||
g_assert (service1 == service2);
|
g_assert (service1 == service2);
|
||||||
@ -132,7 +135,7 @@ test_get_async (void)
|
|||||||
|
|
||||||
g_object_unref (service2);
|
g_object_unref (service2);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (service2);
|
g_assert (service2 == NULL);
|
||||||
|
|
||||||
/* Services were unreffed, so this should create a new one */
|
/* Services were unreffed, so this should create a new one */
|
||||||
secret_service_get (SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
secret_service_get (SECRET_SERVICE_NONE, NULL, on_complete_get_result, &result);
|
||||||
@ -141,10 +144,11 @@ test_get_async (void)
|
|||||||
service3 = secret_service_get_finish (result, &error);
|
service3 = secret_service_get_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_clear_object (&result);
|
g_clear_object (&result);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service3), (gpointer *)&service3);
|
||||||
|
|
||||||
g_object_unref (service3);
|
g_object_unref (service3);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (service3);
|
g_assert (service3 == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -159,6 +163,7 @@ test_get_more_sync (Test *test,
|
|||||||
|
|
||||||
service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service);
|
||||||
|
|
||||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_NONE);
|
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_NONE);
|
||||||
|
|
||||||
@ -186,7 +191,7 @@ test_get_more_sync (Test *test,
|
|||||||
|
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (service);
|
g_assert (service == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -208,6 +213,7 @@ test_get_more_async (Test *test,
|
|||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
result = NULL;
|
result = NULL;
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service);
|
||||||
|
|
||||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||||
path = secret_service_get_session_dbus_path (service);
|
path = secret_service_get_session_dbus_path (service);
|
||||||
@ -219,7 +225,7 @@ test_get_more_async (Test *test,
|
|||||||
|
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (service);
|
g_assert (service == NULL);
|
||||||
|
|
||||||
/* Now get a session with just collections */
|
/* Now get a session with just collections */
|
||||||
|
|
||||||
@ -231,6 +237,7 @@ test_get_more_async (Test *test,
|
|||||||
service = secret_service_get_finish (result, &error);
|
service = secret_service_get_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service);
|
||||||
|
|
||||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS);
|
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||||
path = secret_service_get_session_dbus_path (service);
|
path = secret_service_get_session_dbus_path (service);
|
||||||
@ -242,7 +249,7 @@ test_get_more_async (Test *test,
|
|||||||
|
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (service);
|
g_assert (service == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -257,20 +264,22 @@ test_open_sync (void)
|
|||||||
service1 = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
service1 = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
||||||
SECRET_SERVICE_NONE, NULL, &error);
|
SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service1), (gpointer *)&service1);
|
||||||
|
|
||||||
service2 = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
service2 = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
||||||
SECRET_SERVICE_NONE, NULL, &error);
|
SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service2), (gpointer *)&service2);
|
||||||
|
|
||||||
g_assert (SECRET_IS_SERVICE (service1));
|
g_assert (SECRET_IS_SERVICE (service1));
|
||||||
g_assert (SECRET_IS_SERVICE (service2));
|
g_assert (SECRET_IS_SERVICE (service2));
|
||||||
g_assert (service1 != service2);
|
g_assert (service1 != service2);
|
||||||
|
|
||||||
g_object_unref (service1);
|
g_object_unref (service1);
|
||||||
egg_assert_not_object (service1);
|
g_assert (service1 == NULL);
|
||||||
|
|
||||||
g_object_unref (service2);
|
g_object_unref (service2);
|
||||||
egg_assert_not_object (service2);
|
g_assert (service2 == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -290,6 +299,7 @@ test_open_async (void)
|
|||||||
service1 = secret_service_open_finish (result, &error);
|
service1 = secret_service_open_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_clear_object (&result);
|
g_clear_object (&result);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service1), (gpointer *)&service1);
|
||||||
|
|
||||||
secret_service_open (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE, NULL,
|
secret_service_open (SECRET_TYPE_SERVICE, NULL, SECRET_SERVICE_NONE, NULL,
|
||||||
on_complete_get_result, &result);
|
on_complete_get_result, &result);
|
||||||
@ -298,16 +308,17 @@ test_open_async (void)
|
|||||||
service2 = secret_service_open_finish (result, &error);
|
service2 = secret_service_open_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_clear_object (&result);
|
g_clear_object (&result);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service2), (gpointer *)&service2);
|
||||||
|
|
||||||
g_assert (SECRET_IS_SERVICE (service1));
|
g_assert (SECRET_IS_SERVICE (service1));
|
||||||
g_assert (SECRET_IS_SERVICE (service2));
|
g_assert (SECRET_IS_SERVICE (service2));
|
||||||
g_assert (service1 != service2);
|
g_assert (service1 != service2);
|
||||||
|
|
||||||
g_object_unref (service1);
|
g_object_unref (service1);
|
||||||
egg_assert_not_object (service1);
|
g_assert (service1 == NULL);
|
||||||
|
|
||||||
g_object_unref (service2);
|
g_object_unref (service2);
|
||||||
egg_assert_not_object (service2);
|
g_assert (service2 == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -323,18 +334,20 @@ test_open_more_sync (Test *test,
|
|||||||
NULL, &error);
|
NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (SECRET_IS_SERVICE (service));
|
g_assert (SECRET_IS_SERVICE (service));
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service);
|
||||||
|
|
||||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_NONE);
|
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_NONE);
|
||||||
g_assert (secret_service_get_collections (service) == NULL);
|
g_assert (secret_service_get_collections (service) == NULL);
|
||||||
g_assert (secret_service_get_session_dbus_path (service) == NULL);
|
g_assert (secret_service_get_session_dbus_path (service) == NULL);
|
||||||
|
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
egg_assert_not_object (service);
|
g_assert (service == NULL);
|
||||||
|
|
||||||
service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
||||||
SECRET_SERVICE_LOAD_COLLECTIONS, NULL, &error);
|
SECRET_SERVICE_LOAD_COLLECTIONS, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (SECRET_IS_SERVICE (service));
|
g_assert (SECRET_IS_SERVICE (service));
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service);
|
||||||
|
|
||||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS);
|
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||||
collections = secret_service_get_collections (service);
|
collections = secret_service_get_collections (service);
|
||||||
@ -343,12 +356,13 @@ test_open_more_sync (Test *test,
|
|||||||
g_assert (secret_service_get_session_dbus_path (service) == NULL);
|
g_assert (secret_service_get_session_dbus_path (service) == NULL);
|
||||||
|
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
egg_assert_not_object (service);
|
g_assert (service == NULL);
|
||||||
|
|
||||||
service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
service = secret_service_open_sync (SECRET_TYPE_SERVICE, NULL,
|
||||||
SECRET_SERVICE_OPEN_SESSION, NULL, &error);
|
SECRET_SERVICE_OPEN_SESSION, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (SECRET_IS_SERVICE (service));
|
g_assert (SECRET_IS_SERVICE (service));
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service);
|
||||||
|
|
||||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION);
|
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION);
|
||||||
g_assert (secret_service_get_collections (service) == NULL);
|
g_assert (secret_service_get_collections (service) == NULL);
|
||||||
@ -356,7 +370,7 @@ test_open_more_sync (Test *test,
|
|||||||
g_assert (path != NULL);
|
g_assert (path != NULL);
|
||||||
|
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
egg_assert_not_object (service);
|
g_assert (service == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -379,6 +393,7 @@ test_open_more_async (Test *test,
|
|||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
result = NULL;
|
result = NULL;
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service);
|
||||||
|
|
||||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||||
path = secret_service_get_session_dbus_path (service);
|
path = secret_service_get_session_dbus_path (service);
|
||||||
@ -389,7 +404,7 @@ test_open_more_async (Test *test,
|
|||||||
g_list_free_full (collections, g_object_unref);
|
g_list_free_full (collections, g_object_unref);
|
||||||
|
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
egg_assert_not_object (service);
|
g_assert (service == NULL);
|
||||||
|
|
||||||
/* Now get a session with just collections */
|
/* Now get a session with just collections */
|
||||||
|
|
||||||
@ -402,6 +417,7 @@ test_open_more_async (Test *test,
|
|||||||
service = secret_service_open_finish (result, &error);
|
service = secret_service_open_finish (result, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service);
|
||||||
|
|
||||||
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS);
|
g_assert_cmpuint (secret_service_get_flags (service), ==, SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||||
path = secret_service_get_session_dbus_path (service);
|
path = secret_service_get_session_dbus_path (service);
|
||||||
@ -412,7 +428,7 @@ test_open_more_async (Test *test,
|
|||||||
g_list_free_full (collections, g_object_unref);
|
g_list_free_full (collections, g_object_unref);
|
||||||
|
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
egg_assert_not_object (service);
|
g_assert (service == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -434,13 +450,14 @@ test_connect_async (Test *test,
|
|||||||
g_assert (SECRET_IS_SERVICE (service));
|
g_assert (SECRET_IS_SERVICE (service));
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service);
|
||||||
|
|
||||||
path = secret_service_get_session_dbus_path (service);
|
path = secret_service_get_session_dbus_path (service);
|
||||||
g_assert (path == NULL);
|
g_assert (path == NULL);
|
||||||
|
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (service);
|
g_assert (service == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -462,13 +479,14 @@ test_connect_ensure_async (Test *test,
|
|||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (SECRET_IS_SERVICE (service));
|
g_assert (SECRET_IS_SERVICE (service));
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service);
|
||||||
|
|
||||||
path = secret_service_get_session_dbus_path (service);
|
path = secret_service_get_session_dbus_path (service);
|
||||||
g_assert (path != NULL);
|
g_assert (path != NULL);
|
||||||
|
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (service);
|
g_assert (service == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -485,6 +503,7 @@ test_ensure_sync (Test *test,
|
|||||||
SECRET_SERVICE_NONE, NULL, &error);
|
SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (service != NULL);
|
g_assert (service != NULL);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service);
|
||||||
|
|
||||||
flags = secret_service_get_flags (service);
|
flags = secret_service_get_flags (service);
|
||||||
g_assert_cmpuint (flags, ==, SECRET_SERVICE_NONE);
|
g_assert_cmpuint (flags, ==, SECRET_SERVICE_NONE);
|
||||||
@ -504,7 +523,7 @@ test_ensure_sync (Test *test,
|
|||||||
g_assert_cmpuint (flags, ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
g_assert_cmpuint (flags, ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||||
|
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
egg_assert_not_object (service);
|
g_assert (service == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -550,12 +569,13 @@ test_ensure_async (Test *test,
|
|||||||
g_assert (ret == TRUE);
|
g_assert (ret == TRUE);
|
||||||
g_object_unref (result);
|
g_object_unref (result);
|
||||||
result = NULL;
|
result = NULL;
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (service), (gpointer *)&service);
|
||||||
|
|
||||||
flags = secret_service_get_flags (service);
|
flags = secret_service_get_flags (service);
|
||||||
g_assert_cmpuint (flags, ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
g_assert_cmpuint (flags, ==, SECRET_SERVICE_OPEN_SESSION | SECRET_SERVICE_LOAD_COLLECTIONS);
|
||||||
|
|
||||||
g_object_unref (service);
|
g_object_unref (service);
|
||||||
egg_assert_not_object (service);
|
g_assert (service == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -43,6 +43,7 @@ setup (Test *test,
|
|||||||
|
|
||||||
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
test->service = secret_service_get_sync (SECRET_SERVICE_NONE, NULL, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
|
g_object_add_weak_pointer (G_OBJECT (test->service), (gpointer *)&test->service);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -51,7 +52,7 @@ teardown (Test *test,
|
|||||||
{
|
{
|
||||||
g_object_unref (test->service);
|
g_object_unref (test->service);
|
||||||
secret_service_disconnect ();
|
secret_service_disconnect ();
|
||||||
egg_assert_not_object (test->service);
|
g_assert (test->service == NULL);
|
||||||
|
|
||||||
mock_service_stop ();
|
mock_service_stop ();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user