diff options
Diffstat (limited to 'Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp')
-rw-r--r-- | Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp index d775f6c..8c59741 100644 --- a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp +++ b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp @@ -4,6 +4,7 @@ * See the COPYING file for more information. */ +#include <memory> #include <vector> #include <boost/bind.hpp> @@ -36,8 +37,8 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { void setUp() { crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); - stanzaChannel = new DummyStanzaChannel(); - capsProvider = new DummyCapsProvider(); + stanzaChannel = std::unique_ptr<DummyStanzaChannel>(new DummyStanzaChannel()); + capsProvider = std::unique_ptr<DummyCapsProvider>(new DummyCapsProvider()); user1 = JID("user1@bar.com/bla"); discoInfo1 = std::make_shared<DiscoInfo>(); @@ -52,11 +53,6 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { legacyCapsInfo = std::make_shared<CapsInfo>("http://swift.im", "ver1", ""); } - void tearDown() { - delete capsProvider; - delete stanzaChannel; - } - void testReceiveKnownHash() { std::shared_ptr<EntityCapsManager> testling = createManager(); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; @@ -140,7 +136,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { private: std::shared_ptr<EntityCapsManager> createManager() { - std::shared_ptr<EntityCapsManager> manager(new EntityCapsManager(capsProvider, stanzaChannel)); + std::shared_ptr<EntityCapsManager> manager(new EntityCapsManager(capsProvider.get(), stanzaChannel.get())); manager->onCapsChanged.connect(boost::bind(&EntityCapsManagerTest::handleCapsChanged, this, _1)); return manager; } @@ -177,8 +173,8 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { }; private: - DummyStanzaChannel* stanzaChannel; - DummyCapsProvider* capsProvider; + std::unique_ptr<DummyStanzaChannel> stanzaChannel; + std::unique_ptr<DummyCapsProvider> capsProvider; JID user1; std::shared_ptr<DiscoInfo> discoInfo1; std::shared_ptr<CapsInfo> capsInfo1; |