Kaydet (Commit) 0b7f8fb6 authored tarafından Will Thompson's avatar Will Thompson Kaydeden (comit) Matúš Kukan

tubes test: fix stack corruption on test failure

We can't use CPPUNIT_ASSERT() from a callback called by C code (such as
the FileSent callback), or we'll trash the stack if it fails.
üst 1b601608
......@@ -69,6 +69,8 @@ public:
GMainLoop* mpMainLoop;
void spinMainLoop();
static void FileSent( bool success, void *user_data);
// Order is significant.
CPPUNIT_TEST_SUITE( TestTeleTubes );
CPPUNIT_TEST( testSetupManager1 );
......@@ -98,6 +100,8 @@ private:
rtl::OString maOffererIdentifier;
rtl::OString maAccepterIdentifier;
bool maFileSentSuccess;
};
// static, not members, so they actually survive cppunit test iteration
......@@ -287,11 +291,11 @@ void TestTeleTubes::testReceivePacket()
CPPUNIT_ASSERT( nReceivedPackets == nSentPackets);
}
static void TestTeleTubes_FileSent( bool success, void *user_data)
void TestTeleTubes::FileSent( bool success, void *user_data)
{
TestTeleTubes *self = reinterpret_cast<TestTeleTubes *>(user_data);
CPPUNIT_ASSERT( success);
self->maFileSentSuccess = success;
g_main_loop_quit (self->mpMainLoop);
}
......@@ -302,8 +306,10 @@ void TestTeleTubes::testSendFile()
/* This has to run after testContactList has run successfully. */
CPPUNIT_ASSERT( mpAccepterContact != 0);
mpManager1->sendFile( maTestConfigIniURL,
TestTeleTubes_FileSent, this);
&TestTeleTubes::FileSent, this);
spinMainLoop();
CPPUNIT_ASSERT( maFileSentSuccess);
}
void TestTeleTubes::testFlushLoops()
......
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