summaryrefslogtreecommitdiff
path: root/tubes/qa/test_manager.cxx
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2012-03-23 08:53:21 +0000
committerMatúš Kukan <matus.kukan@gmail.com>2012-07-17 16:39:39 +0200
commite6a3874108e77d366085a4b275ac337cda5225ea (patch)
tree450026e4761086757d3f98747c8438cb800a40de /tubes/qa/test_manager.cxx
parent0b7f8fb6971ca1df6f94508e45c42cdb157e3dab (diff)
tubes: implement receiving files.
Diffstat (limited to 'tubes/qa/test_manager.cxx')
-rw-r--r--tubes/qa/test_manager.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx
index d08190d56289..540728a5fa39 100644
--- a/tubes/qa/test_manager.cxx
+++ b/tubes/qa/test_manager.cxx
@@ -70,6 +70,7 @@ public:
void spinMainLoop();
static void FileSent( bool success, void *user_data);
+ static void FileReceived( rtl::OUString& aUri, void *user_data);
// Order is significant.
CPPUNIT_TEST_SUITE( TestTeleTubes );
@@ -102,6 +103,7 @@ private:
rtl::OString maAccepterIdentifier;
bool maFileSentSuccess;
+ rtl::OUString maFileReceivedUri;
};
// static, not members, so they actually survive cppunit test iteration
@@ -299,17 +301,33 @@ void TestTeleTubes::FileSent( bool success, void *user_data)
g_main_loop_quit (self->mpMainLoop);
}
+void TestTeleTubes::FileReceived( rtl::OUString& aUri, void *user_data)
+{
+ TestTeleTubes *self = reinterpret_cast<TestTeleTubes *>(user_data);
+
+ self->maFileReceivedUri = aUri;
+ g_main_loop_quit (self->mpMainLoop);
+}
+
void TestTeleTubes::testSendFile()
{
TpAccount *pAcc1 = mpManager1->getAccount(maOffererIdentifier);
CPPUNIT_ASSERT( pAcc1 != 0);
/* This has to run after testContactList has run successfully. */
CPPUNIT_ASSERT( mpAccepterContact != 0);
+
+ mpManager1->setFileReceivedCallback(&TestTeleTubes::FileReceived, this);
+
mpManager1->sendFile( maTestConfigIniURL,
&TestTeleTubes::FileSent, this);
+ /* Waiting for two events: FileSent and FileReceived both quit the mainloop */
+ spinMainLoop();
spinMainLoop();
CPPUNIT_ASSERT( maFileSentSuccess);
+ CPPUNIT_ASSERT_MESSAGE(
+ OUStringToOString( maFileReceivedUri, RTL_TEXTENCODING_UTF8).getStr(),
+ maFileReceivedUri == "file:///tmp/fixme.ods");
}
void TestTeleTubes::testFlushLoops()