From 7d376ec5570f6732f90a52e7fc448285c80c5ddb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 28 Mar 2012 23:13:48 -0500 Subject: Making the json test signal based instead of timeout based --- tests/test-json-client.c | 4 +++- tests/test-json-server.c | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/test-json-client.c b/tests/test-json-client.c index 55d2ede..8900902 100644 --- a/tests/test-json-client.c +++ b/tests/test-json-client.c @@ -44,6 +44,8 @@ timeout_func (gpointer user_data) g_file_replace_contents(ofile, output, g_utf8_strlen(output, -1), NULL, FALSE, 0, NULL, NULL, NULL); } + g_spawn_command_line_sync("gdbus call --session --dest org.dbusmenu.test --object-path /org/test --method com.canonical.dbusmenu.Event 0 clicked \"<0>\" 0", NULL, NULL, NULL, NULL); + g_main_loop_quit(mainloop); return TRUE; } @@ -53,7 +55,7 @@ main (int argc, char ** argv) { g_type_init(); - g_timeout_add_seconds(2, timeout_func, argv); + g_timeout_add_seconds(1, timeout_func, argv); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-json-server.c b/tests/test-json-server.c index 6a53aec..7165838 100644 --- a/tests/test-json-server.c +++ b/tests/test-json-server.c @@ -30,14 +30,14 @@ with this program. If not, see . static GMainLoop * mainloop = NULL; -static gboolean -timer_func (gpointer data) +static void +root_activate (void) { g_debug("Dumping callgrind data"); CALLGRIND_DUMP_STATS_AT("exported"); CALLGRIND_STOP_INSTRUMENTATION; g_main_loop_quit(mainloop); - return FALSE; + return; } static void @@ -54,14 +54,14 @@ on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) return; } + g_signal_connect(G_OBJECT(root), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(root_activate), NULL); + g_debug("Starting Callgrind"); CALLGRIND_START_INSTRUMENTATION; CALLGRIND_ZERO_STATS; CALLGRIND_TOGGLE_COLLECT; dbusmenu_server_set_root(server, root); - g_timeout_add_seconds(100, timer_func, NULL); - return; } -- cgit v1.2.3