diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-15 18:07:44 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-15 18:07:44 (GMT) |
commit | f061668e3c1d5eac01b85303e2c81df2bc560e9a (patch) | |
tree | de56afe6d93cb36425f7c2e458575d27bd9105a4 /Swiften/EventLoop/UnitTest/EventLoopTest.cpp | |
parent | 0930cd940963be0edfe7c80b4925babca0e01443 (diff) | |
download | swift-contrib-f061668e3c1d5eac01b85303e2c81df2bc560e9a.zip swift-contrib-f061668e3c1d5eac01b85303e2c81df2bc560e9a.tar.bz2 |
Make stream stack layers reference counted.
Diffstat (limited to 'Swiften/EventLoop/UnitTest/EventLoopTest.cpp')
-rw-r--r-- | Swiften/EventLoop/UnitTest/EventLoopTest.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Swiften/EventLoop/UnitTest/EventLoopTest.cpp b/Swiften/EventLoop/UnitTest/EventLoopTest.cpp index c64d1ad..9475ac9 100644 --- a/Swiften/EventLoop/UnitTest/EventLoopTest.cpp +++ b/Swiften/EventLoop/UnitTest/EventLoopTest.cpp @@ -3,6 +3,7 @@ #include <boost/thread.hpp> #include <boost/bind.hpp> +#include "Swiften/EventLoop/EventOwner.h" #include "Swiften/EventLoop/SimpleEventLoop.h" #include "Swiften/Base/sleep.h" @@ -25,8 +26,8 @@ class EventLoopTest : public CppUnit::TestFixture void testPost() { SimpleEventLoop testling; - testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 1), 0); - testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 2), 0); + testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 1)); + testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 2)); testling.stop(); testling.run(); @@ -37,12 +38,14 @@ class EventLoopTest : public CppUnit::TestFixture void testRemove() { SimpleEventLoop testling; + boost::shared_ptr<MyEventOwner> eventOwner1(new MyEventOwner()); + boost::shared_ptr<MyEventOwner> eventOwner2(new MyEventOwner()); - testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 1), &testling); - testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 2), this); - testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 3), &testling); - testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 4), this); - testling.removeEventsFromOwner(this); + testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 1), eventOwner1); + testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 2), eventOwner2); + testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 3), eventOwner1); + testling.postEvent(boost::bind(&EventLoopTest::logEvent, this, 4), eventOwner2); + testling.removeEventsFromOwner(eventOwner2); testling.stop(); testling.run(); @@ -52,6 +55,7 @@ class EventLoopTest : public CppUnit::TestFixture } private: + struct MyEventOwner : public EventOwner {}; void logEvent(int i) { events_.push_back(i); } |