diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-02-05 15:56:47 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-02-05 15:56:47 (GMT) |
commit | 374ebf0f8c32c4fd8758af4b8381ac5cff0d151c (patch) | |
tree | c89be053096b0025f3839d97b5ae08b102335054 /Swiften/Roster/UnitTest | |
parent | d18f20669671991825230fe956acd472cca999fc (diff) | |
download | swift-contrib-374ebf0f8c32c4fd8758af4b8381ac5cff0d151c.zip swift-contrib-374ebf0f8c32c4fd8758af4b8381ac5cff0d151c.tar.bz2 |
Don't crash when receiving null roster payload.
Diffstat (limited to 'Swiften/Roster/UnitTest')
-rw-r--r-- | Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp b/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp index debbd50..22a55d4 100644 --- a/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp +++ b/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp @@ -6,12 +6,13 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> +#include <boost/smart_ptr/make_shared.hpp> #include "Swiften/Roster/XMPPRosterController.h" #include "Swiften/Elements/Payload.h" #include "Swiften/Elements/RosterItemPayload.h" #include "Swiften/Elements/RosterPayload.h" -#include "Swiften/Queries/DummyIQChannel.h" +#include "Swiften/Client/DummyStanzaChannel.h" #include "Swiften/Queries/IQRouter.h" #include "Swiften/Roster/XMPPRosterImpl.h" @@ -19,6 +20,7 @@ using namespace Swift; class XMPPRosterControllerTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(XMPPRosterControllerTest); + CPPUNIT_TEST(testGet_EmptyResponse); CPPUNIT_TEST(testAdd); CPPUNIT_TEST(testModify); CPPUNIT_TEST(testRemove); @@ -26,7 +28,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { public: void setUp() { - channel_ = new DummyIQChannel(); + channel_ = new DummyStanzaChannel(); router_ = new IQRouter(channel_); xmppRoster_ = new XMPPRosterImpl(); } @@ -37,6 +39,14 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { delete channel_; } + void testGet_EmptyResponse() { + XMPPRosterController controller(router_, xmppRoster_); + + controller.requestRoster(); + + channel_->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), channel_->sentStanzas[0]->getID(), boost::shared_ptr<RosterPayload>())); + } + void testAdd() { XMPPRosterController controller(router_, xmppRoster_); @@ -74,7 +84,7 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture { } private: - DummyIQChannel* channel_; + DummyStanzaChannel* channel_; IQRouter* router_; XMPPRosterImpl* xmppRoster_; }; |