Tue, 19 Mar 2024 01:04:58 -0500
Add a subtitle property to PurpleNotification
Also clean up a bunch of gchar and gint stuff and removed a bunch of
unnecessary G_PARAM_CONSTRUCT's.
Testing Done:
Ran the unit tests under valgrind and verified that the notification list was still functional in Pidgin.
Reviewed at https://reviews.imfreedom.org/r/3037/
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This library is free software; you can redistribute it and/or |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU Lesser General Public |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * License as published by the Free Software Foundation; either |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * version 2 of the License, or (at your option) any later version. |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This library is distributed in the hope that it will be useful, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * Lesser General Public License for more details. |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU Lesser General Public |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib.h> |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #include <purple.h> |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "test_ui.h" |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | /****************************************************************************** |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | * Globals |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | *****************************************************************************/ |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | /* Since we're using GTask to test asynchronous functions, we need to use a |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | * main loop. |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | */ |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | static GMainLoop *loop = NULL; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | #define TEST_PROTOCOL_DOMAIN (g_quark_from_static_string("test-protocol")) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | /****************************************************************************** |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | * TestPurpleProtocol |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | *****************************************************************************/ |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | #define TEST_PURPLE_TYPE_PROTOCOL (test_purple_protocol_get_type()) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | G_DECLARE_FINAL_TYPE(TestPurpleProtocol, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | test_purple_protocol, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | TEST_PURPLE, PROTOCOL, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | PurpleProtocol) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | struct _TestPurpleProtocol { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | PurpleProtocol parent; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | gboolean result; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | GError *error; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | gboolean can_connect_async; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | gboolean can_connect_finish; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | }; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | |
|
42576
ab1ca778ddb2
Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
55 | G_DEFINE_FINAL_TYPE(TestPurpleProtocol, test_purple_protocol, |
|
ab1ca778ddb2
Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
56 | PURPLE_TYPE_PROTOCOL) |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | test_purple_protocol_can_connect_async(PurpleProtocol *protocol, |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41884
diff
changeset
|
60 | G_GNUC_UNUSED PurpleAccount *account, |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | GCancellable *cancellable, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | GAsyncReadyCallback callback, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | gpointer data) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | TestPurpleProtocol *test_protocol = TEST_PURPLE_PROTOCOL(protocol); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | GTask *task = NULL; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | task = g_task_new(protocol, cancellable, callback, data); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | if(test_protocol->error != NULL) { |
|
42182
3fc2d2b7b7a8
Fix leaked errors
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42089
diff
changeset
|
70 | g_task_return_error(task, g_error_copy(test_protocol->error)); |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | } else { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | g_task_return_boolean(task, test_protocol->result); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | g_clear_object(&task); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | test_protocol->can_connect_async = TRUE; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | static gboolean |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | test_purple_protocol_can_connect_finish(PurpleProtocol *protocol, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | GAsyncResult *result, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | GError **error) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | TestPurpleProtocol *test_protocol = TEST_PURPLE_PROTOCOL(protocol); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | test_protocol->can_connect_finish = TRUE; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | return g_task_propagate_boolean(G_TASK(result), error); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | test_purple_protocol_finalize(GObject *obj) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | TestPurpleProtocol *protocol = TEST_PURPLE_PROTOCOL(obj); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | g_clear_error(&protocol->error); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | G_OBJECT_CLASS(test_purple_protocol_parent_class)->finalize(obj); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | test_purple_protocol_init(G_GNUC_UNUSED TestPurpleProtocol *provider) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | test_purple_protocol_class_init(TestPurpleProtocolClass *klass) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | obj_class->finalize = test_purple_protocol_finalize; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | protocol_class->can_connect_async = test_purple_protocol_can_connect_async; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | protocol_class->can_connect_finish = test_purple_protocol_can_connect_finish; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | static TestPurpleProtocol * |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | test_purple_protocol_new(gboolean result, GError *error) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | TestPurpleProtocol *test_protocol = NULL; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | test_protocol = g_object_new( |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | TEST_PURPLE_TYPE_PROTOCOL, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | "id", "test-provider", |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | "name", "Test Provider", |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | NULL); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | test_protocol->result = result; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | test_protocol->error = error; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | return test_protocol; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | /****************************************************************************** |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | * TestPurpleProtocol->can_connect Tests |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | *****************************************************************************/ |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | static gboolean |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | test_purple_protocol_timeout_cb(gpointer data) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | g_main_loop_quit((GMainLoop *)data); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | g_warning("timed out waiting for the callback function to be called"); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | return FALSE; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | test_purple_protocol_can_connect_cb(GObject *obj, GAsyncResult *res, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | gpointer data) |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | PurpleProtocol *protocol = PURPLE_PROTOCOL(obj); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | TestPurpleProtocol *test_protocol = TEST_PURPLE_PROTOCOL(protocol); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | GError *error = NULL; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | gboolean result = FALSE; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | result = purple_protocol_can_connect_finish(protocol, res, &error); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | g_main_loop_quit(loop); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | if(test_protocol->error != NULL) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | g_assert_error(error, TEST_PROTOCOL_DOMAIN, 0); |
|
42182
3fc2d2b7b7a8
Fix leaked errors
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42089
diff
changeset
|
159 | g_clear_error(&error); |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | } else { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | g_assert_no_error(error); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | g_assert_true(result == test_protocol->result); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | /* This is the account that we need to unref. */ |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | g_object_unref(data); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | static gboolean |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | test_purple_protocol_can_connect_idle(gpointer data) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | PurpleProtocol *p = PURPLE_PROTOCOL(data); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | PurpleAccount *account = NULL; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | account = purple_account_new("test", "test"); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | purple_protocol_can_connect_async(p, account, NULL, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | test_purple_protocol_can_connect_cb, |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | account); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | return G_SOURCE_REMOVE; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | test_purple_protocol_can_connect(TestPurpleProtocol *test_protocol) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | g_idle_add(test_purple_protocol_can_connect_idle, test_protocol); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | g_timeout_add_seconds(100, test_purple_protocol_timeout_cb, loop); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | g_main_loop_run(loop); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | g_assert_true(test_protocol->can_connect_async); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | g_assert_true(test_protocol->can_connect_finish); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | g_object_unref(test_protocol); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | test_purple_protocol_can_connect_error(void) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | TestPurpleProtocol *protocol = NULL; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | GError *error = NULL; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | error = g_error_new(TEST_PROTOCOL_DOMAIN, 0, "no network"); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | protocol = test_purple_protocol_new(FALSE, error); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | test_purple_protocol_can_connect(protocol); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | test_purple_protocol_can_connect_false(void) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | TestPurpleProtocol *test_protocol = test_purple_protocol_new(FALSE, NULL); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | test_purple_protocol_can_connect(test_protocol); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | static void |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | test_purple_protocol_can_connect_true(void) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | TestPurpleProtocol *test_protocol = test_purple_protocol_new(TRUE, NULL); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | test_purple_protocol_can_connect(test_protocol); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | } |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | /****************************************************************************** |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | * Main |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | *****************************************************************************/ |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | gint |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | main(gint argc, gchar *argv[]) { |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | gint ret = 0; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | g_test_init(&argc, &argv, NULL); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | test_ui_purple_init(); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | loop = g_main_loop_new(NULL, FALSE); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | g_test_add_func("/protocol/can-connect/error", |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | test_purple_protocol_can_connect_error); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | g_test_add_func("/protocol/can-connect/false", |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | test_purple_protocol_can_connect_false); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | g_test_add_func("/protocol/can-connect/true", |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | test_purple_protocol_can_connect_true); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | ret = g_test_run(); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | g_main_loop_unref(loop); |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | |
|
42184
4e1bf25f5575
Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42182
diff
changeset
|
246 | test_ui_purple_uninit(); |
|
4e1bf25f5575
Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42182
diff
changeset
|
247 | |
|
41884
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | return ret; |
|
36684da1e60d
Add async function to PurpleProtocol for testing whether or not connections are possible
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | } |