Index: uspace/lib/dispcfg/test/dispcfg.c
===================================================================
--- uspace/lib/dispcfg/test/dispcfg.c	(revision c0757e1f444227a4a7447e0004af74bd7026104d)
+++ uspace/lib/dispcfg/test/dispcfg.c	(revision cdf53614e69dd176ed18ae75864449fefe9d5816)
@@ -35,4 +35,5 @@
 #include <pcut/pcut.h>
 #include <str.h>
+#include <testdc.h>
 #include "../private/dispcfg.h"
 
@@ -43,85 +44,4 @@
 static const char *test_dispcfg_server = "test-dispcfg";
 static const char *test_dispcfg_svc = "test/dispcfg";
-
-static void test_dispcfg_conn(ipc_call_t *, void *);
-
-static errno_t test_get_seat_list(void *, dispcfg_seat_list_t **);
-static errno_t test_get_seat_info(void *, sysarg_t, dispcfg_seat_info_t **);
-static errno_t test_seat_create(void *, const char *, sysarg_t *);
-static errno_t test_seat_delete(void *, sysarg_t);
-static errno_t test_dev_assign(void *, sysarg_t, sysarg_t);
-static errno_t test_dev_unassign(void *, sysarg_t);
-static errno_t test_get_asgn_dev_list(void *, sysarg_t, dispcfg_dev_list_t **);
-static errno_t test_get_event(void *, dispcfg_ev_t *);
-
-static void test_seat_added(void *, sysarg_t);
-static void test_seat_removed(void *, sysarg_t);
-
-static dispcfg_ops_t test_dispcfg_srv_ops = {
-	.get_seat_list = test_get_seat_list,
-	.get_seat_info = test_get_seat_info,
-	.seat_create = test_seat_create,
-	.seat_delete = test_seat_delete,
-	.dev_assign = test_dev_assign,
-	.dev_unassign = test_dev_unassign,
-	.get_asgn_dev_list = test_get_asgn_dev_list,
-	.get_event = test_get_event
-};
-
-static dispcfg_cb_t test_dispcfg_cb = {
-	.seat_added = test_seat_added,
-	.seat_removed = test_seat_removed
-};
-
-/** Describes to the server how to respond to our request and pass tracking
- * data back to the client.
- */
-typedef struct {
-	errno_t rc;
-	sysarg_t seat_id;
-	dispcfg_ev_t event;
-	dispcfg_ev_t revent;
-	int event_cnt;
-
-	bool get_seat_list_called;
-	dispcfg_seat_list_t *get_seat_list_rlist;
-
-	bool get_seat_info_called;
-	sysarg_t get_seat_info_seat_id;
-	dispcfg_seat_info_t *get_seat_info_rinfo;
-
-	bool seat_create_called;
-	char *seat_create_name;
-	sysarg_t seat_create_seat_id;
-
-	bool seat_delete_called;
-	sysarg_t seat_delete_seat_id;
-
-	bool dev_assign_called;
-	sysarg_t dev_assign_svc_id;
-	sysarg_t dev_assign_seat_id;
-
-	bool dev_unassign_called;
-	sysarg_t dev_unassign_svc_id;
-
-	bool get_asgn_dev_list_called;
-	sysarg_t get_asgn_dev_list_seat_id;
-	dispcfg_dev_list_t *get_asgn_dev_list_rlist;
-
-	bool get_event_called;
-
-	bool seat_added_called;
-	sysarg_t seat_added_seat_id;
-
-	bool seat_removed_called;
-	sysarg_t seat_removed_seat_id;
-
-	bool seat_changed_called;
-	sysarg_t seat_changed_seat_id;
-
-	fibril_condvar_t event_cv;
-	fibril_mutex_t event_lock;
-	dispcfg_srv_t *srv;
-} test_response_t;
 
 /** dispcfg_open(), dispcfg_close() work for valid seat management service */
@@ -790,142 +710,3 @@
 }
 
-/** Test seat management service connection. */
-static void test_dispcfg_conn(ipc_call_t *icall, void *arg)
-{
-	test_response_t *resp = (test_response_t *) arg;
-	dispcfg_srv_t srv;
-
-	/* Set up protocol structure */
-	dispcfg_srv_initialize(&srv);
-	srv.ops = &test_dispcfg_srv_ops;
-	srv.arg = arg;
-	resp->srv = &srv;
-
-	/* Handle connection */
-	dispcfg_conn(icall, &srv);
-
-	resp->srv = NULL;
-}
-
-static void test_seat_added(void *arg, sysarg_t seat_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->revent.etype = dcev_seat_added;
-
-	fibril_mutex_lock(&resp->event_lock);
-	resp->seat_added_called = true;
-	resp->seat_added_seat_id = seat_id;
-	fibril_condvar_broadcast(&resp->event_cv);
-	fibril_mutex_unlock(&resp->event_lock);
-}
-
-static void test_seat_removed(void *arg, sysarg_t seat_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->revent.etype = dcev_seat_removed;
-
-	fibril_mutex_lock(&resp->event_lock);
-	resp->seat_removed_called = true;
-	resp->seat_removed_seat_id = seat_id;
-	fibril_condvar_broadcast(&resp->event_cv);
-	fibril_mutex_unlock(&resp->event_lock);
-}
-
-static errno_t test_get_seat_list(void *arg, dispcfg_seat_list_t **rlist)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_seat_list_called = true;
-
-	if (resp->rc != EOK)
-		return resp->rc;
-
-	*rlist = resp->get_seat_list_rlist;
-	return EOK;
-}
-
-static errno_t test_get_seat_info(void *arg, sysarg_t seat_id,
-    dispcfg_seat_info_t **rinfo)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_seat_info_called = true;
-	resp->get_seat_info_seat_id = seat_id;
-
-	if (resp->rc != EOK)
-		return resp->rc;
-
-	*rinfo = resp->get_seat_info_rinfo;
-	return EOK;
-}
-
-static errno_t test_seat_create(void *arg, const char *name, sysarg_t *rseat_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->seat_create_called = true;
-	resp->seat_create_name = str_dup(name);
-	*rseat_id = resp->seat_create_seat_id;
-	return resp->rc;
-}
-
-static errno_t test_seat_delete(void *arg, sysarg_t seat_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->seat_delete_called = true;
-	resp->seat_delete_seat_id = seat_id;
-	return resp->rc;
-}
-
-static errno_t test_dev_assign(void *arg, sysarg_t svc_id, sysarg_t seat_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->dev_assign_called = true;
-	resp->dev_assign_svc_id = svc_id;
-	resp->dev_assign_seat_id = seat_id;
-	return resp->rc;
-}
-
-static errno_t test_dev_unassign(void *arg, sysarg_t svc_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->dev_unassign_called = true;
-	resp->dev_unassign_svc_id = svc_id;
-	return resp->rc;
-}
-
-static errno_t test_get_asgn_dev_list(void *arg, sysarg_t seat_id,
-    dispcfg_dev_list_t **rlist)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_asgn_dev_list_called = true;
-	resp->get_asgn_dev_list_seat_id = seat_id;
-
-	if (resp->rc != EOK)
-		return resp->rc;
-
-	*rlist = resp->get_asgn_dev_list_rlist;
-	return EOK;
-}
-
-static errno_t test_get_event(void *arg, dispcfg_ev_t *event)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_event_called = true;
-	if (resp->event_cnt > 0) {
-		--resp->event_cnt;
-		*event = resp->event;
-		return EOK;
-	}
-
-	return ENOENT;
-}
-
 PCUT_EXPORT(dispcfg);
