diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-06-01 08:48:42 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-06-01 09:24:28 (GMT) |
commit | 2812bddd81f8a1b804c7460f4e14cd0aa393d129 (patch) | |
tree | d46294f35150c4f0f43deaf2d31fceaf945ae715 /Swiften/QA/NetworkTest/BoostConnectionTest.cpp | |
download | swift-contrib-2812bddd81f8a1b804c7460f4e14cd0aa393d129.zip swift-contrib-2812bddd81f8a1b804c7460f4e14cd0aa393d129.tar.bz2 |
Import.
Diffstat (limited to 'Swiften/QA/NetworkTest/BoostConnectionTest.cpp')
-rw-r--r-- | Swiften/QA/NetworkTest/BoostConnectionTest.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp new file mode 100644 index 0000000..639097a --- /dev/null +++ b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp @@ -0,0 +1,51 @@ +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/extensions/TestFactoryRegistry.h> + +#include "Swiften/Base/String.h" +#include "Swiften/Base/sleep.h" +#include "Swiften/Network/BoostConnection.h" +#include "Swiften/EventLoop/DummyEventLoop.h" + +using namespace Swift; + +class BoostConnectionTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(BoostConnectionTest); + CPPUNIT_TEST(testDestructor); + CPPUNIT_TEST(testDestructor_PendingEvents); + CPPUNIT_TEST_SUITE_END(); + + public: + BoostConnectionTest() {} + + void setUp() { + eventLoop_ = new DummyEventLoop(); + } + + void tearDown() { + delete eventLoop_; + } + + void testDestructor() { + { + std::string domain("el-tramo.be"); + std::auto_ptr<BoostConnection> testling(new BoostConnection(domain)); + testling->connect(); + } + } + + void testDestructor_PendingEvents() { + { + std::auto_ptr<BoostConnection> testling(new BoostConnection("el-tramo.be")); + testling->connect(); + while (!eventLoop_->hasEvents()) { + Swift::sleep(10); + } + } + eventLoop_->processEvents(); + } + + private: + DummyEventLoop* eventLoop_; +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(BoostConnectionTest); |