diff options
author | Tobias Markmann <tm@ayena.de> | 2012-03-20 00:05:55 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-03-20 19:13:43 (GMT) |
commit | 3d6694b0c698fff63d11f8bb4aa995c1df882315 (patch) | |
tree | a46ccace647f23a65100cf69c951345aa6dea7ab /Swiften/Disco/UnitTest/CapsManagerTest.cpp | |
parent | 3d27d98ccc232ae7bfacfd5a3f85f44b6c2e9cc9 (diff) | |
download | swift-contrib-3d6694b0c698fff63d11f8bb4aa995c1df882315.zip swift-contrib-3d6694b0c698fff63d11f8bb4aa995c1df882315.tar.bz2 |
boost::shared_ptr<?>(new ?(...)) -> boost::make_shared<?>(...) transformation where possible.
License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swiften/Disco/UnitTest/CapsManagerTest.cpp')
-rw-r--r-- | Swiften/Disco/UnitTest/CapsManagerTest.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Swiften/Disco/UnitTest/CapsManagerTest.cpp b/Swiften/Disco/UnitTest/CapsManagerTest.cpp index 0681569..ca55c48 100644 --- a/Swiften/Disco/UnitTest/CapsManagerTest.cpp +++ b/Swiften/Disco/UnitTest/CapsManagerTest.cpp @@ -13,80 +13,80 @@ #include <Swiften/Disco/CapsMemoryStorage.h> #include <Swiften/Disco/CapsInfoGenerator.h> #include <Swiften/Queries/IQRouter.h> #include <Swiften/Elements/CapsInfo.h> #include <Swiften/Elements/DiscoInfo.h> #include <Swiften/Client/DummyStanzaChannel.h> using namespace Swift; class CapsManagerTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(CapsManagerTest); CPPUNIT_TEST(testReceiveNewHashRequestsDisco); CPPUNIT_TEST(testReceiveSameHashDoesNotRequestDisco); CPPUNIT_TEST(testReceiveLegacyCapsDoesNotRequestDisco); CPPUNIT_TEST(testReceiveSameHashFromSameUserAfterFailedDiscoDoesNotRequestDisco); CPPUNIT_TEST(testReceiveSameHashFromDifferentUserAfterFailedDiscoRequestsDisco); CPPUNIT_TEST(testReceiveSameHashFromDifferentUserAfterIncorrectVerificationRequestsDisco); CPPUNIT_TEST(testReceiveDifferentHashFromSameUserAfterFailedDiscoDoesNotRequestDisco); CPPUNIT_TEST(testReceiveSameHashAfterSuccesfulDiscoDoesNotRequestDisco); CPPUNIT_TEST(testReceiveSuccesfulDiscoStoresCaps); CPPUNIT_TEST(testReceiveIncorrectVerificationDiscoDoesNotStoreCaps); CPPUNIT_TEST(testReceiveFailingDiscoFallsBack); CPPUNIT_TEST(testReceiveNoDiscoFallsBack); CPPUNIT_TEST(testReceiveFailingFallbackDiscoFallsBack); CPPUNIT_TEST(testReceiveSameHashFromFailingUserAfterReconnectRequestsDisco); CPPUNIT_TEST(testReconnectResetsFallback); CPPUNIT_TEST(testReconnectResetsRequests); CPPUNIT_TEST_SUITE_END(); public: void setUp() { stanzaChannel = new DummyStanzaChannel(); iqRouter = new IQRouter(stanzaChannel); storage = new CapsMemoryStorage(); user1 = JID("user1@bar.com/bla"); - discoInfo1 = boost::shared_ptr<DiscoInfo>(new DiscoInfo()); + discoInfo1 = boost::make_shared<DiscoInfo>(); discoInfo1->addFeature("http://swift.im/feature1"); - capsInfo1 = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get()))); - capsInfo1alt = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get()))); + capsInfo1 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im").generateCapsInfo(*discoInfo1.get())); + capsInfo1alt = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo1.get())); user2 = JID("user2@foo.com/baz"); - discoInfo2 = boost::shared_ptr<DiscoInfo>(new DiscoInfo()); + discoInfo2 = boost::make_shared<DiscoInfo>(); discoInfo2->addFeature("http://swift.im/feature2"); - capsInfo2 = boost::shared_ptr<CapsInfo>(new CapsInfo(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get()))); + capsInfo2 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im").generateCapsInfo(*discoInfo2.get())); user3 = JID("user3@foo.com/baz"); - legacyCapsInfo = boost::shared_ptr<CapsInfo>(new CapsInfo("http://swift.im", "ver1", "")); + legacyCapsInfo = boost::make_shared<CapsInfo>("http://swift.im", "ver1", ""); } void tearDown() { delete storage; delete iqRouter; delete stanzaChannel; } void testReceiveNewHashRequestsDisco() { boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<DiscoInfo>(0, user1, IQ::Get)); boost::shared_ptr<DiscoInfo> discoInfo(stanzaChannel->sentStanzas[0]->getPayload<DiscoInfo>()); CPPUNIT_ASSERT(discoInfo); CPPUNIT_ASSERT_EQUAL("http://node1.im#" + capsInfo1->getVersion(), discoInfo->getNode()); } void testReceiveSameHashDoesNotRequestDisco() { boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->sentStanzas.clear(); sendPresenceWithCaps(user1, capsInfo1); CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(stanzaChannel->sentStanzas.size())); } void testReceiveLegacyCapsDoesNotRequestDisco() { boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, legacyCapsInfo); CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(stanzaChannel->sentStanzas.size())); } void testReceiveSameHashAfterSuccesfulDiscoDoesNotRequestDisco() { |