~online-accounts/libaccounts-glib/13.10

« back to all changes in this revision

Viewing changes to debian/patches/0001-Tests-allow-some-time-for-D-Bus-signals-to-arrive.patch

  • Committer: Tarmac
  • Author(s): Alberto Mardegan
  • Date: 2013-10-10 14:06:21 UTC
  • mfrom: (176.1.5 packaging)
  • Revision ID: tarmac-20131010140621-4g12vgdahs5ir54c
New upstream release.

Approved by Ken VanDine, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From b49c2dedde474eb9a00d8106c711f44d4e4a2707 Mon Sep 17 00:00:00 2001
2
 
From: Alberto Mardegan <alberto.mardegan@canonical.com>
3
 
Date: Mon, 9 Sep 2013 15:41:26 +0300
4
 
Subject: [PATCH] Tests: allow some time for D-Bus signals to arrive
5
 
 
6
 
The unit test test_signals_other_manager() sends one signal over D-Bus
7
 
and expects to read it back as soon as the main loop is re-entered, but
8
 
this is not a given.
9
 
Modify the test to wait for up to two seconds for the signal to arrive.
10
 
---
11
 
 tests/check_ag.c | 14 +++++++++++---
12
 
 1 file changed, 11 insertions(+), 3 deletions(-)
13
 
 
14
 
diff --git a/tests/check_ag.c b/tests/check_ag.c
15
 
index d8dd7d1..b8b8ccd 100644
16
 
--- a/tests/check_ag.c
17
 
+++ b/tests/check_ag.c
18
 
@@ -87,7 +87,7 @@ on_enabled (AgAccount *account, const gchar *service, gboolean enabled,
19
 
 }
20
 
 
21
 
 static gboolean
22
 
-quit_loop_on_timeout(gpointer user_data)
23
 
+quit_loop (gpointer user_data)
24
 
 {
25
 
     GMainLoop *loop = user_data;
26
 
     g_main_loop_quit (loop);
27
 
@@ -98,7 +98,7 @@ static void
28
 
 run_main_loop_for_n_seconds(guint seconds)
29
 
 {
30
 
     GMainLoop *loop = g_main_loop_new (NULL, FALSE);
31
 
-    g_timeout_add_seconds (seconds, quit_loop_on_timeout, loop);
32
 
+    g_timeout_add_seconds (seconds, quit_loop, loop);
33
 
     g_main_loop_run (loop);
34
 
     g_main_loop_unref (loop);
35
 
 }
36
 
@@ -1731,6 +1731,14 @@ START_TEST(test_signals_other_manager)
37
 
     run_main_loop_for_n_seconds(0);
38
 
     fail_unless (data_stored, "Callback not invoked immediately");
39
 
 
40
 
+    main_loop = g_main_loop_new (NULL, FALSE);
41
 
+    g_timeout_add_seconds (2, quit_loop, main_loop);
42
 
+    g_signal_connect_swapped (account2, "enabled",
43
 
+                              G_CALLBACK (quit_loop), main_loop);
44
 
+    g_main_loop_run (main_loop);
45
 
+    g_main_loop_unref (main_loop);
46
 
+    main_loop = NULL;
47
 
+
48
 
     fail_unless (ecd.called);
49
 
     fail_unless (g_strcmp0 (ecd.service, "MyService") == 0);
50
 
     g_free (ecd.service);
51
 
@@ -3098,7 +3106,7 @@ START_TEST(test_duplicate_create_regression)
52
 
     ag_account_store_blocking (account, NULL);
53
 
 
54
 
     main_loop = g_main_loop_new (NULL, FALSE);
55
 
-    source_id = g_timeout_add_seconds (2, quit_loop_on_timeout, main_loop);
56
 
+    source_id = g_timeout_add_seconds (2, quit_loop, main_loop);
57
 
     g_debug ("Running loop");
58
 
     g_main_loop_run (main_loop);
59
 
 
60
 
1.8.3.2
61