From b7e748007bbe0b16fa8a8a089c6cc8fe43bc7aac Mon Sep 17 00:00:00 2001 From: christian mueller Date: Wed, 28 Dec 2011 15:55:32 +0100 Subject: * assert on empty busname (routinginterface) * added busname for DbusroutingSender * rework of sockethandlertests * small changes on compilerflags * new default error messages on dummy controller plugin * new plugin Asynchronous including tests --- .../test/sockethandler/sockethandlerTest.cpp | 80 ++++++++++++++++++---- 1 file changed, 68 insertions(+), 12 deletions(-) (limited to 'AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp') diff --git a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp index 69af391..87b2751 100644 --- a/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp +++ b/AudioManagerDaemon/test/sockethandler/sockethandlerTest.cpp @@ -84,11 +84,54 @@ void am::timerCallBack::timer4Callback(sh_timerHandle_t, void* userData) void* playWithSocketServer(void* data) { SocketHandler myHandler; - SamplePlugin myplugin(&myHandler); + SamplePlugin::sockType_e type=SamplePlugin::INET; + SamplePlugin myplugin(&myHandler,type); myHandler.start_listenting(); } +void* playWithUnixSocketServer(void* data) +{ + SocketHandler myHandler; + SamplePlugin::sockType_e type=SamplePlugin::UNIX; + SamplePlugin myplugin(&myHandler,type); + myHandler.start_listenting(); +} + +TEST(sockethandlerTest,playWithUNIXSockets) +{ + pthread_t serverThread; + char buffer[3000]; + struct sockaddr_un servAddr; + int socket_; + + //creates a thread that handles the serverpart + pthread_create(&serverThread,NULL,playWithUnixSocketServer,NULL); + + sleep(1); //we need that here because the port needs to be opened + if ((socket_ = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) + { + std::cout<<"socket problem"<