Kaydet (Commit) 4e6907b5 authored tarafından Matúš Kukan's avatar Matúš Kukan

tubes: let's use ctor, dtor and less methods in the test

They are not independent anyway.
This way it may fail only once in constructor and avoid segmentation
faults.

Change-Id: I304f688b187f9870bf664517112550ad9a2a87c7
üst 4917f0ce
...@@ -49,25 +49,17 @@ class TestTeleTubes: public CppUnit::TestFixture ...@@ -49,25 +49,17 @@ class TestTeleTubes: public CppUnit::TestFixture
{ {
public: public:
TestTeleTubes() {} TestTeleTubes();
~TestTeleTubes() {} ~TestTeleTubes();
// This could happen in costructor wasn't there TestTeleTubes instance for each test: // This could happen in costructor wasn't there TestTeleTubes instance for each test:
void testInitialize();
void testInitTeleManager();
void testContactList(); void testContactList();
void testStartBuddySession(); void testSession();
void testSendPacket();
void testDestroyTeleTubes();
void testFailAlways(); void testFailAlways();
// Order is significant. // Order is significant.
CPPUNIT_TEST_SUITE( TestTeleTubes ); CPPUNIT_TEST_SUITE( TestTeleTubes );
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST( testInitTeleManager );
CPPUNIT_TEST( testContactList ); CPPUNIT_TEST( testContactList );
CPPUNIT_TEST( testStartBuddySession ); CPPUNIT_TEST( testSession );
CPPUNIT_TEST( testSendPacket );
CPPUNIT_TEST( testDestroyTeleTubes );
#if 0 #if 0
CPPUNIT_TEST( testFailAlways ); // test failure displays SAL_LOG, uncomment for debugging CPPUNIT_TEST( testFailAlways ); // test failure displays SAL_LOG, uncomment for debugging
#endif #endif
...@@ -105,7 +97,7 @@ static gboolean timed_out( void * ) ...@@ -105,7 +97,7 @@ static gboolean timed_out( void * )
return FALSE; return FALSE;
} }
void TestTeleTubes::testInitialize() TestTeleTubes::TestTeleTubes()
{ {
g_timeout_add_seconds (10, timed_out, NULL); g_timeout_add_seconds (10, timed_out, NULL);
try try
...@@ -135,10 +127,7 @@ void TestTeleTubes::testInitialize() ...@@ -135,10 +127,7 @@ void TestTeleTubes::testInitialize()
mpCollaboration1 = new TestCollaboration(); mpCollaboration1 = new TestCollaboration();
mpCollaboration2 = new TestCollaboration(); mpCollaboration2 = new TestCollaboration();
}
void TestTeleTubes::testInitTeleManager()
{
CPPUNIT_ASSERT( TeleManager::init( true)); CPPUNIT_ASSERT( TeleManager::init( true));
} }
...@@ -189,7 +178,7 @@ static void lcl_FileSent( bool success, void * ) ...@@ -189,7 +178,7 @@ static void lcl_FileSent( bool success, void * )
} }
*/ */
void TestTeleTubes::testStartBuddySession() void TestTeleTubes::testSession()
{ {
TeleConference* pConference = NULL; TeleConference* pConference = NULL;
CPPUNIT_ASSERT( mpOffererAccount != 0); CPPUNIT_ASSERT( mpOffererAccount != 0);
...@@ -209,17 +198,14 @@ void TestTeleTubes::testStartBuddySession() ...@@ -209,17 +198,14 @@ void TestTeleTubes::testStartBuddySession()
pConference = TeleManager::getConference(); pConference = TeleManager::getConference();
CPPUNIT_ASSERT( pConference != NULL); CPPUNIT_ASSERT( pConference != NULL);
mpCollaboration2->SetConference( pConference ); mpCollaboration2->SetConference( pConference );
}
void TestTeleTubes::testSendPacket()
{
mpCollaboration1->SendPacket( "from 1 to 2"); mpCollaboration1->SendPacket( "from 1 to 2");
while (!mbPacketReceived) while (!mbPacketReceived)
g_main_context_iteration( NULL, TRUE); g_main_context_iteration( NULL, TRUE);
} }
void TestTeleTubes::testDestroyTeleTubes() TestTeleTubes::~TestTeleTubes()
{ {
if (mpOffererAccount) { if (mpOffererAccount) {
g_object_unref(mpOffererAccount); g_object_unref(mpOffererAccount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment