AC_SUBST(CHECK_CFLAGS)
AC_SUBST(CHECK_LIBS)
-PKG_CHECK_MODULES(GTestDBus, glib-2.0 >= 2.34, [gtestdbus=yes], [gtestdbus=no])
-AM_CONDITIONAL(HAVE_GTESTDBUS, [test x$gtestdbus = xyes])
-if test "x$gtestdbus" = xyes; then
- AC_DEFINE(HAVE_GTESTDBUS, [1], [Define if GTestDBus exists.])
-fi
-
PKG_CHECK_MODULES([LIBSMACK], libsmack >= 1.0, [libsmack=yes], [libsmack=no])
AM_CONDITIONAL(HAVE_LIBSMACK, [test x$libsmack = xyes])
if test "x$libsmack" = xyes; then
elif test "x$enable_dbus_type" = "xsession" ; then
AC_DEFINE(GSIGNOND_BUS_TYPE, [G_BUS_TYPE_SESSION], [Use session bus])
DBUS_SERVICES_DIR="`pkg-config --variable session_bus_services_dir dbus-1`"
+
+ PKG_CHECK_MODULES(GTestDBus, gio-2.0 >= 2.34, [gtestdbus=yes], [gtestdbus=no])
+ if test "x$gtestdbus" = xyes; then
+ AC_DEFINE(HAVE_GTESTDBUS, [1], [Define if GTestDBus exists.])
+ fi
elif test "x$enable_dbus_type" = "xsystem" ; then
AC_DEFINE(GSIGNOND_BUS_TYPE, [G_BUS_TYPE_SYSTEM], [Use system bus])
DBUS_SERVICES_DIR="`pkg-config --variable system_bus_services_dir dbus-1`"
fi
+AM_CONDITIONAL(USE_GTESTDBUS, [test x$gtestdbus = xyes])
+
AC_SUBST(DBUS_SERVICES_DIR)
DBUS_INTERFACES_DIR="`pkg-config --variable interfaces_dir dbus-1`"
AC_SUBST(DBUS_INTERFACES_DIR)
test/common/Makefile
test/db/Makefile
test/daemon/Makefile
-test/daemon/services/com.google.code.AccountsSSO.gSingleSignOn.service
test/plugins/Makefile
])
+
+if test x$gtestdbus = xyes; then
+ AC_OUTPUT([
+ test/daemon/services/com.google.code.AccountsSSO.gSingleSignOn.service
+ ])
+fi
* 02110-1301 USA
*/
-#include <config.h>
+#include "config.h"
#include <check.h>
#include <stdlib.h>
#include <gio/gio.h>
#include <gsignond/gsignond-identity-info.h>
#include <gsignond/gsignond-log.h>
+#ifdef USE_P2P
+# ifdef GSIGNOND_SERVICE
+# undef GSIGNOND_SERVICE
+# endif
+# define GSIGNOND_SERVICE NULL
+#endif
+
struct IdentityData {
gchar *key;
gchar *type;
return TRUE;
}
+GDBusConnection * _get_bus_connection (GError **error)
+{
+#if USE_P2P
+ return g_dbus_connection_new_for_address_sync (
+ GSIGNOND_DBUS_ADDRESS,
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+ NULL,
+ NULL,
+ error);
+#else
+ return g_bus_get_sync (GSIGNOND_BUS_TYPE, NULL, error);
+#endif
+}
+
START_TEST (test_register_new_identity)
{
GError *error = 0;
gboolean res;
+ GDBusConnection *connection = NULL;
GSignondDbusAuthService *auth_service = 0;
gchar *identity_path = 0;
-
- auth_service = gsignond_dbus_auth_service_proxy_new_for_bus_sync (
- G_BUS_TYPE_SESSION,
+
+ connection = _get_bus_connection (&error);
+ fail_if (connection == NULL, "failed to get bus connection : %s", error ? error->message : "(null)");
+
+ auth_service = gsignond_dbus_auth_service_proxy_new_sync (
+ connection,
G_DBUS_PROXY_FLAGS_NONE,
GSIGNOND_SERVICE,
GSIGNOND_DAEMON_OBJECTPATH,
NULL, &error);
- fail_if (auth_service == NULL);
+ fail_if (auth_service == NULL, "failed to get auth_service : %s", error ? error->message : "");
res = gsignond_dbus_auth_service_call_register_new_identity_sync (
auth_service,
g_object_unref (auth_service);
- fail_if (res == FALSE, "Failed to register identity");
+ fail_if (res == FALSE, "Failed to register identity : %s", error ? error->message : "");
fail_if (identity_path == NULL);
g_free (identity_path);
}
gboolean res;
GSignondDbusAuthService *auth_service = 0;
gchar *identity_path = NULL;
+ GDBusConnection *connection = _get_bus_connection (&error);
+ fail_if (connection == NULL, "failed to get bus connection : %s", error ? error->message : "(null)");
+ fail_if (error != NULL, "failed to get bus connection : %s", error ? error->message : "(null)");
- auth_service = gsignond_dbus_auth_service_proxy_new_for_bus_sync (
- G_BUS_TYPE_SESSION,
+ auth_service = gsignond_dbus_auth_service_proxy_new_sync (
+ connection,
G_DBUS_PROXY_FLAGS_NONE,
GSIGNOND_SERVICE,
GSIGNOND_DAEMON_OBJECTPATH,
int i;
gchar* mechanisms [] = {"password", NULL};
- auth_service = gsignond_dbus_auth_service_proxy_new_for_bus_sync (
- G_BUS_TYPE_SESSION,
+ GDBusConnection *connection = _get_bus_connection (&error);
+ fail_if (connection == NULL, "failed to get bus connection : %s", error ? error->message : "(null)");
+ fail_if (error != NULL, "failed to get bus connection : %s", error ? error->message : "(null)");
+
+ auth_service = gsignond_dbus_auth_service_proxy_new_sync (
+ connection,
G_DBUS_PROXY_FLAGS_NONE,
GSIGNOND_SERVICE,
GSIGNOND_DAEMON_OBJECTPATH,
fail_if (identity_info == NULL);
- identity = gsignond_dbus_identity_proxy_new_for_bus_sync (
- G_BUS_TYPE_SESSION,
+ identity = gsignond_dbus_identity_proxy_new_sync (
+ connection,
G_DBUS_PROXY_FLAGS_NONE,
GSIGNOND_SERVICE,
identity_path,
gint id = 1 ; /* identity id created in test_identity_store */
GVariant *identity_info = NULL;
gchar *identity_path = 0;
+ GDBusConnection *connection = _get_bus_connection (&error);
+ fail_if (connection == NULL, "failed to get bus connection : %s", error ? error->message : "(null)");
+ fail_if (error != NULL, "failed to get bus connection : %s", error ? error->message : "(null)");
- auth_service = gsignond_dbus_auth_service_proxy_new_for_bus_sync (
- G_BUS_TYPE_SESSION,
+ auth_service = gsignond_dbus_auth_service_proxy_new_sync (
+ connection,
G_DBUS_PROXY_FLAGS_NONE,
GSIGNOND_SERVICE,
GSIGNOND_DAEMON_OBJECTPATH,
GError *error = 0;
gboolean res, ret;
GSignondDbusAuthService *auth_service = 0;
+ GDBusConnection *connection = _get_bus_connection (&error);
+ fail_if (connection == NULL, "failed to get bus connection : %s", error ? error->message : "(null)");
+ fail_if (error != NULL, "failed to get bus connection : %s", error ? error->message : "(null)");
- auth_service = gsignond_dbus_auth_service_proxy_new_for_bus_sync (
- G_BUS_TYPE_SESSION,
+ auth_service = gsignond_dbus_auth_service_proxy_new_sync (
+ connection,
G_DBUS_PROXY_FLAGS_NONE,
GSIGNOND_SERVICE,
GSIGNOND_DAEMON_OBJECTPATH,
static void _on_sign_out_reply (GSignondDbusIdentity *sender, GAsyncResult *reply, gpointer data)
{
GError *error = NULL;
- g_warning ("_on_sign_out_reply");
gboolean res = FALSE, ret = FALSE;
gboolean identity_signed_out = FALSE;
gboolean session_unregistered = FALSE;
GMainLoop *loop = NULL;
+ GDBusConnection *connection = _get_bus_connection (&error);
+ fail_if (connection == NULL, "failed to get bus connection : %s", error ? error->message : "(null)");
+ fail_if (error != NULL, "failed to get bus connection : %s", error ? error->message : "(null)");
loop = g_main_loop_new (NULL, FALSE);
- auth_service = gsignond_dbus_auth_service_proxy_new_for_bus_sync (
- G_BUS_TYPE_SESSION,
+ auth_service = gsignond_dbus_auth_service_proxy_new_sync (
+ connection,
G_DBUS_PROXY_FLAGS_NONE,
GSIGNOND_SERVICE,
GSIGNOND_DAEMON_OBJECTPATH,
fail_if (identity_info == NULL);
- identity = gsignond_dbus_identity_proxy_new_for_bus_sync (
- G_BUS_TYPE_SESSION,
+ identity = gsignond_dbus_identity_proxy_new_sync (
+ connection,
G_DBUS_PROXY_FLAGS_NONE,
GSIGNOND_SERVICE,
identity_path,
error ? error->message : "");
fail_if (session_path == NULL, "(null) session_path");
- auth_session = gsignond_dbus_auth_session_proxy_new_for_bus_sync (
- G_BUS_TYPE_SESSION,
+ auth_session = gsignond_dbus_auth_session_proxy_new_sync (
+ connection,
G_DBUS_PROXY_FLAGS_NONE,
GSIGNOND_SERVICE,
session_path,
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
-