From 8fc5e0d7e5b3dd990663d9dbfdcb3affb48072bd Mon Sep 17 00:00:00 2001 From: Jussi Laako Date: Mon, 11 Feb 2013 16:28:58 +0200 Subject: [PATCH] generic: fix internal APIs and tests for rebase --- libsignon-glib/signon-auth-session.c | 8 +++---- libsignon-glib/signon-auth-session.h | 1 - libsignon-glib/signon-identity-info.c | 2 ++ libsignon-glib/signon-identity-info.h | 2 ++ libsignon-glib/signon-identity.c | 1 - tests/check_signon.c | 33 +++++++++++++++++++-------- 6 files changed, 31 insertions(+), 16 deletions(-) diff --git a/libsignon-glib/signon-auth-session.c b/libsignon-glib/signon-auth-session.c index 6349012..20fed1b 100644 --- a/libsignon-glib/signon-auth-session.c +++ b/libsignon-glib/signon-auth-session.c @@ -123,7 +123,7 @@ typedef struct _AuthSessionProcessCbData static void auth_session_state_changed_cb (GDBusProxy *proxy, gint state, gchar *message, gpointer user_data); static void auth_session_remote_object_destroyed_cb (GDBusProxy *proxy, gpointer user_data); -static gboolean auth_session_priv_init (SignonAuthSession *self, guint id, const gchar *method_name, GError **err); +static gboolean auth_session_priv_init (SignonAuthSession *self, const gchar *method_name, GError **err); static void auth_session_query_available_mechanisms_ready_cb (gpointer object, const GError *error, gpointer user_data); static void auth_session_cancel_ready_cb (gpointer object, const GError *error, gpointer user_data); @@ -421,7 +421,6 @@ signon_auth_session_class_init (SignonAuthSessionClass *klass) */ SignonAuthSession * signon_auth_session_new (gpointer identity_proxy, - gint id, const gchar *method_name, GError **err) { @@ -433,7 +432,7 @@ signon_auth_session_new (gpointer identity_proxy, NULL)); g_return_val_if_fail (self != NULL, NULL); - if (!auth_session_priv_init(self, id, method_name, err)) + if (!auth_session_priv_init(self, method_name, err)) { if (*err) g_warning ("%s returned error: %s", G_STRFUNC, (*err)->message); @@ -792,14 +791,13 @@ static void auth_session_remote_object_destroyed_cb (GDBusProxy *proxy, } static gboolean -auth_session_priv_init (SignonAuthSession *self, guint id, +auth_session_priv_init (SignonAuthSession *self, const gchar *method_name, GError **err) { g_return_val_if_fail (SIGNON_IS_AUTH_SESSION (self), FALSE); SignonAuthSessionPrivate *priv = SIGNON_AUTH_SESSION_PRIV (self); g_return_val_if_fail (priv, FALSE); - priv->id = id; priv->method_name = g_strdup (method_name); priv->registering = TRUE; diff --git a/libsignon-glib/signon-auth-session.h b/libsignon-glib/signon-auth-session.h index d937904..c828b8a 100644 --- a/libsignon-glib/signon-auth-session.h +++ b/libsignon-glib/signon-auth-session.h @@ -145,7 +145,6 @@ struct _SignonAuthSessionClass { GType signon_auth_session_get_type (void) G_GNUC_CONST; SignonAuthSession *signon_auth_session_new(gpointer identity_proxy, - gint id, const gchar *method_name, GError **err); diff --git a/libsignon-glib/signon-identity-info.c b/libsignon-glib/signon-identity-info.c index 29064d5..5839736 100644 --- a/libsignon-glib/signon-identity-info.c +++ b/libsignon-glib/signon-identity-info.c @@ -5,8 +5,10 @@ * * Copyright (C) 2009-2010 Nokia Corporation. * Copyright (C) 2011-2012 Canonical Ltd. + * Copyright (C) 2012-2013 Intel Corporation. * * Contact: Alberto Mardegan + * Contact: Jussi Laako * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/libsignon-glib/signon-identity-info.h b/libsignon-glib/signon-identity-info.h index fc35dfe..2dcd744 100644 --- a/libsignon-glib/signon-identity-info.h +++ b/libsignon-glib/signon-identity-info.h @@ -5,8 +5,10 @@ * * Copyright (C) 2009-2010 Nokia Corporation. * Copyright (C) 2011 Canonical Ltd. + * Copyright (C) 2012-2013 Intel Corporation. * * Contact: Alberto Mardegan + * Contact: Jussi Laako * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License diff --git a/libsignon-glib/signon-identity.c b/libsignon-glib/signon-identity.c index 77a8b7a..295e015 100644 --- a/libsignon-glib/signon-identity.c +++ b/libsignon-glib/signon-identity.c @@ -693,7 +693,6 @@ signon_identity_create_session(SignonIdentity *self, } SignonAuthSession *session = signon_auth_session_new (priv->proxy, - priv->id, method, error); if (session) diff --git a/tests/check_signon.c b/tests/check_signon.c index 3873f6c..8f15b4f 100644 --- a/tests/check_signon.c +++ b/tests/check_signon.c @@ -261,7 +261,7 @@ START_TEST(test_auth_session_query_mechanisms) GError *err = NULL; g_debug("%s", G_STRFUNC); - SignonIdentity *idty = signon_identity_new(NULL, NULL); + SignonIdentity *idty = signon_identity_new(NULL); fail_unless (idty != NULL, "Cannot create Iddentity object"); SignonAuthSession *auth_session = signon_identity_create_session(idty, @@ -336,7 +336,7 @@ START_TEST(test_auth_session_query_mechanisms_nonexisting) GError *err = NULL; g_debug("%s", G_STRFUNC); - SignonIdentity *idty = signon_identity_new(NULL, NULL); + SignonIdentity *idty = signon_identity_new(NULL); fail_unless (idty != NULL, "Cannot create Iddentity object"); SignonAuthSession *auth_session = signon_identity_create_session(idty, @@ -419,7 +419,7 @@ START_TEST(test_auth_session_creation) GError *err = NULL; g_debug("%s", G_STRFUNC); - SignonIdentity *idty = signon_identity_new(NULL, NULL); + SignonIdentity *idty = signon_identity_new(NULL); fail_unless (idty != NULL, "Cannot create Iddentity object"); SignonAuthSession *auth_session = signon_identity_create_session(idty, @@ -446,7 +446,7 @@ START_TEST(test_auth_session_process) GError *err = NULL; g_debug("%s", G_STRFUNC); - SignonIdentity *idty = signon_identity_new(NULL, NULL); + SignonIdentity *idty = signon_identity_new(NULL); fail_unless (idty != NULL, "Cannot create Iddentity object"); SignonAuthSession *auth_session = signon_identity_create_session(idty, @@ -548,6 +548,7 @@ test_auth_session_process_failure_cb (GObject *source_object, START_TEST(test_auth_session_process_failure) { + SignonIdentity *identity; SignonAuthSession *auth_session; GVariantBuilder builder; GVariant *session_data; @@ -557,7 +558,11 @@ START_TEST(test_auth_session_process_failure) g_type_init (); - auth_session = signon_auth_session_new (0, "nonexisting-method", &error); + identity = signon_identity_new_from_db (0, NULL); + fail_unless (identity != NULL, "Cannot create Identity object"); + auth_session = signon_auth_session_new (identity, + "nonexisting-method", + &error); fail_unless (auth_session != NULL, "Cannot create AuthSession object"); fail_unless (error == NULL); @@ -581,6 +586,7 @@ START_TEST(test_auth_session_process_failure) fail_unless (error->code == SIGNON_ERROR_METHOD_NOT_KNOWN); g_object_unref (auth_session); + g_object_unref (identity); end_test (); } @@ -736,7 +742,7 @@ new_identity() if (main_loop == NULL) main_loop = g_main_loop_new (NULL, FALSE); - identity = signon_identity_new (NULL, NULL); + identity = signon_identity_new (NULL); fail_unless (SIGNON_IS_IDENTITY (identity)); methods = g_hash_table_new (g_str_hash, g_str_equal); signon_identity_store_credentials_with_args (identity, @@ -747,6 +753,7 @@ new_identity() "caption", NULL, NULL, + NULL, 0, new_identity_store_credentials_cb, &id); @@ -847,7 +854,7 @@ START_TEST(test_store_credentials_identity) { g_type_init (); g_debug("%s", G_STRFUNC); - SignonIdentity *idty = signon_identity_new(NULL, NULL); + SignonIdentity *idty = signon_identity_new(NULL); fail_unless (idty != NULL); fail_unless (SIGNON_IS_IDENTITY (idty), "Failed to initialize the Identity."); @@ -864,6 +871,7 @@ START_TEST(test_store_credentials_identity) "caption", NULL, NULL, + NULL, 0, store_credentials_identity_cb, &last_id); @@ -904,7 +912,7 @@ START_TEST(test_verify_secret_identity) { g_type_init (); g_debug("%s", G_STRFUNC); - SignonIdentity *idty = signon_identity_new(NULL, NULL); + SignonIdentity *idty = signon_identity_new(NULL); fail_unless (idty != NULL); fail_unless (SIGNON_IS_IDENTITY (idty), "Failed to initialize the Identity."); @@ -923,6 +931,7 @@ START_TEST(test_verify_secret_identity) caption, NULL, NULL, + NULL, 0, store_credentials_identity_cb, NULL); @@ -1418,6 +1427,7 @@ test_regression_unref_process_cb (SignonAuthSession *self, START_TEST(test_regression_unref) { + SignonIdentity *identity; SignonAuthSession *auth_session; GHashTable *session_data; GError *error = NULL; @@ -1428,7 +1438,9 @@ START_TEST(test_regression_unref) g_type_init (); main_loop = g_main_loop_new (NULL, FALSE); - auth_session = signon_auth_session_new (0, "ssotest", &error); + identity = signon_identity_new_from_db (0, NULL); + fail_unless (identity != NULL); + auth_session = signon_auth_session_new (identity, "ssotest", &error); fail_unless (auth_session != NULL); session_data = g_hash_table_new (g_str_hash, g_str_equal); @@ -1443,6 +1455,9 @@ START_TEST(test_regression_unref) g_strdup ("Hi there!")); g_main_loop_run (main_loop); + g_object_unref (auth_session); + g_object_unref (identity); + end_test (); } END_TEST -- 2.34.1