[wing/wip/pipe-refactor: 2/2] tests/named-pipe: test multi client connection
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [wing/wip/pipe-refactor: 2/2] tests/named-pipe: test multi client connection
- Date: Thu, 14 Jul 2016 11:11:04 +0000 (UTC)
commit b09e8a566dc3bcb3f5648d9cc7daea73ced7247f
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu Jul 14 12:59:39 2016 +0200
tests/named-pipe: test multi client connection
tests/named-pipe.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
---
diff --git a/tests/named-pipe.c b/tests/named-pipe.c
index 2175b38..d2d25c0 100644
--- a/tests/named-pipe.c
+++ b/tests/named-pipe.c
@@ -319,6 +319,67 @@ test_connect_accept_cancel (void)
g_object_unref (cancellable);
}
+static void
+test_multi_client_basic (void)
+{
+ WingNamedPipeListener *listener;
+ WingNamedPipeClient *client;
+ GCancellable *cancellable;
+ gboolean success_accepted = FALSE;
+ gboolean success_connected = FALSE;
+ GError *error = NULL;
+
+ cancellable = g_cancellable_new ();
+ listener = wing_named_pipe_listener_new ();
+
+ wing_named_pipe_listener_add_named_pipe (listener,
+ "\\\\.\\pipe\\gtest-named-pipe-name-connect-then-cancel",
+ NULL,
+ &error);
+ g_assert_no_error (error);
+
+ wing_named_pipe_listener_accept_async (listener,
+ cancellable,
+ accepted_cb,
+ &success_accepted);
+
+ client = wing_named_pipe_client_new ();
+ wing_named_pipe_client_connect_async (client,
+ "\\\\.\\pipe\\gtest-named-pipe-name-connect-then-cancel",
+ NULL,
+ connected_cb,
+ &success_connected);
+
+ do
+ g_main_context_iteration (NULL, TRUE);
+ while (!success_accepted || !success_connected);
+
+ g_object_unref (client);
+
+ success_accepted = FALSE;
+ success_connected = FALSE;
+
+ wing_named_pipe_listener_accept_async (listener,
+ cancellable,
+ accepted_cb,
+ &success_accepted);
+
+ client = wing_named_pipe_client_new ();
+ wing_named_pipe_client_connect_async (client,
+ "\\\\.\\pipe\\gtest-named-pipe-name-connect-then-cancel",
+ NULL,
+ connected_cb,
+ &success_connected);
+
+ do
+ g_main_context_iteration (NULL, TRUE);
+ while (!success_accepted || !success_connected);
+
+ g_object_unref (client);
+ g_object_unref (listener);
+ g_object_unref (cancellable);
+}
+
int
main (int argc,
char *argv[])
@@ -334,6 +395,7 @@ main (int argc,
g_test_add_func ("/named-pipes/connect-sync-fails", test_connect_sync_fails);
g_test_add_func ("/named-pipes/accept-cancel", test_accept_cancel);
g_test_add_func ("/named-pipes/connect-accept-cancel", test_connect_accept_cancel);
+ g_test_add_func ("/named-pipes/multi-client-basic", test_multi_client_basic);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]