summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-04-01 17:23:49 (GMT)
committerTobias Markmann <tm@ayena.de>2016-04-04 08:28:23 (GMT)
commit741c45b74d5f634622eb5f757c49323274fb8937 (patch)
treeb9cfa6c2fe2e79e03cc8cb7c1ca1e9cf45aa5328 /Swiften/Disco/UnitTest
parenteddd92ed76ae68cb1e202602fd3ebd11b69191a2 (diff)
downloadswift-741c45b74d5f634622eb5f757c49323274fb8937.zip
swift-741c45b74d5f634622eb5f757c49323274fb8937.tar.bz2
Modernize code to use C++11 shared_ptr instead of Boost's
This change was done by applying the following 'gsed' replacement calls to all source files: 's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g' 's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g' 's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g' 's/boost::make_shared/std::make_shared/g' 's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g' 's/boost::shared_ptr/std::shared_ptr/g' 's/boost::weak_ptr/std::weak_ptr/g' 's/boost::enable_shared_from_this/std::enable_shared_from_this/g' The remaining issues have been fixed manually. Test-Information: Code builds on OS X 10.11.4 and unit tests pass. Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
Diffstat (limited to 'Swiften/Disco/UnitTest')
-rw-r--r--Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp16
-rw-r--r--Swiften/Disco/UnitTest/CapsManagerTest.cpp84
-rw-r--r--Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp12
-rw-r--r--Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp52
-rw-r--r--Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp16
5 files changed, 90 insertions, 90 deletions
diff --git a/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp b/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp
index 58c9531..8d27ec5 100644
--- a/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp
+++ b/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp
@@ -22,7 +22,7 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture {
public:
void setUp() {
- crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
}
void testGenerate_XEP0115SimpleExample() {
@@ -51,24 +51,24 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture {
discoInfo.addFeature("http://jabber.org/protocol/muc");
Form::ref extension(new Form(Form::ResultType));
- FormField::ref field = boost::make_shared<FormField>(FormField::HiddenType, "urn:xmpp:dataforms:softwareinfo");
+ FormField::ref field = std::make_shared<FormField>(FormField::HiddenType, "urn:xmpp:dataforms:softwareinfo");
field->setName("FORM_TYPE");
extension->addField(field);
- field = boost::make_shared<FormField>(FormField::ListMultiType);
+ field = std::make_shared<FormField>(FormField::ListMultiType);
field->addValue("ipv6");
field->addValue("ipv4");
field->setName("ip_version");
extension->addField(field);
- field = boost::make_shared<FormField>(FormField::TextSingleType, "Psi");
+ field = std::make_shared<FormField>(FormField::TextSingleType, "Psi");
field->setName("software");
extension->addField(field);
- field = boost::make_shared<FormField>(FormField::TextSingleType, "0.11");
+ field = std::make_shared<FormField>(FormField::TextSingleType, "0.11");
field->setName("software_version");
extension->addField(field);
- field = boost::make_shared<FormField>(FormField::TextSingleType, "Mac");
+ field = std::make_shared<FormField>(FormField::TextSingleType, "Mac");
field->setName("os");
extension->addField(field);
- field = boost::make_shared<FormField>(FormField::TextSingleType, "10.5.1");
+ field = std::make_shared<FormField>(FormField::TextSingleType, "10.5.1");
field->setName("os_version");
extension->addField(field);
discoInfo.addExtension(extension);
@@ -80,7 +80,7 @@ class CapsInfoGeneratorTest : public CppUnit::TestFixture {
}
private:
- boost::shared_ptr<CryptoProvider> crypto;
+ std::shared_ptr<CryptoProvider> crypto;
};
CPPUNIT_TEST_SUITE_REGISTRATION(CapsInfoGeneratorTest);
diff --git a/Swiften/Disco/UnitTest/CapsManagerTest.cpp b/Swiften/Disco/UnitTest/CapsManagerTest.cpp
index fe7ee7e..ca727c2 100644
--- a/Swiften/Disco/UnitTest/CapsManagerTest.cpp
+++ b/Swiften/Disco/UnitTest/CapsManagerTest.cpp
@@ -45,21 +45,21 @@ class CapsManagerTest : public CppUnit::TestFixture {
public:
void setUp() {
- crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
stanzaChannel = new DummyStanzaChannel();
iqRouter = new IQRouter(stanzaChannel);
storage = new CapsMemoryStorage();
user1 = JID("user1@bar.com/bla");
- discoInfo1 = boost::make_shared<DiscoInfo>();
+ discoInfo1 = std::make_shared<DiscoInfo>();
discoInfo1->addFeature("http://swift.im/feature1");
- capsInfo1 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im", crypto.get()).generateCapsInfo(*discoInfo1.get()));
- capsInfo1alt = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo1.get()));
+ capsInfo1 = std::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im", crypto.get()).generateCapsInfo(*discoInfo1.get()));
+ capsInfo1alt = std::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo1.get()));
user2 = JID("user2@foo.com/baz");
- discoInfo2 = boost::make_shared<DiscoInfo>();
+ discoInfo2 = std::make_shared<DiscoInfo>();
discoInfo2->addFeature("http://swift.im/feature2");
- capsInfo2 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo2.get()));
+ capsInfo2 = std::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo2.get()));
user3 = JID("user3@foo.com/baz");
- legacyCapsInfo = boost::make_shared<CapsInfo>("http://swift.im", "ver1", "");
+ legacyCapsInfo = std::make_shared<CapsInfo>("http://swift.im", "ver1", "");
}
void tearDown() {
@@ -69,17 +69,17 @@ class CapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveNewHashRequestsDisco() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::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>());
+ std::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();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
stanzaChannel->sentStanzas.clear();
sendPresenceWithCaps(user1, capsInfo1);
@@ -88,14 +88,14 @@ class CapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveLegacyCapsDoesNotRequestDisco() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, legacyCapsInfo);
CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(stanzaChannel->sentStanzas.size()));
}
void testReceiveSameHashAfterSuccesfulDiscoDoesNotRequestDisco() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
sendDiscoInfoResult(discoInfo1);
@@ -106,7 +106,7 @@ class CapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveSameHashFromSameUserAfterFailedDiscoDoesNotRequestDisco() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getID()));
@@ -117,7 +117,7 @@ class CapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveSameHashFromSameUserAfterIncorrectVerificationDoesNotRequestDisco() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
sendDiscoInfoResult(discoInfo2);
@@ -128,7 +128,7 @@ class CapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveSameHashFromDifferentUserAfterFailedDiscoRequestsDisco() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID()));
@@ -138,7 +138,7 @@ class CapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveSameHashFromDifferentUserAfterIncorrectVerificationRequestsDisco() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
sendDiscoInfoResult(discoInfo2);
@@ -148,7 +148,7 @@ class CapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveDifferentHashFromSameUserAfterFailedDiscoDoesNotRequestDisco() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getID()));
@@ -159,50 +159,50 @@ class CapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveSuccesfulDiscoStoresCaps() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
sendDiscoInfoResult(discoInfo1);
- boost::shared_ptr<DiscoInfo> discoInfo(storage->getDiscoInfo(capsInfo1->getVersion()));
+ std::shared_ptr<DiscoInfo> discoInfo(storage->getDiscoInfo(capsInfo1->getVersion()));
CPPUNIT_ASSERT(discoInfo);
CPPUNIT_ASSERT(discoInfo->hasFeature("http://swift.im/feature1"));
}
void testReceiveIncorrectVerificationDiscoDoesNotStoreCaps() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
sendDiscoInfoResult(discoInfo2);
- boost::shared_ptr<DiscoInfo> discoInfo(storage->getDiscoInfo(capsInfo1->getVersion()));
+ std::shared_ptr<DiscoInfo> discoInfo(storage->getDiscoInfo(capsInfo1->getVersion()));
CPPUNIT_ASSERT(!discoInfo);
}
void testReceiveFailingDiscoFallsBack() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
sendPresenceWithCaps(user2, capsInfo1alt);
stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID()));
CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<DiscoInfo>(1, user2, IQ::Get));
- boost::shared_ptr<DiscoInfo> discoInfo(stanzaChannel->sentStanzas[1]->getPayload<DiscoInfo>());
+ std::shared_ptr<DiscoInfo> discoInfo(stanzaChannel->sentStanzas[1]->getPayload<DiscoInfo>());
CPPUNIT_ASSERT(discoInfo);
CPPUNIT_ASSERT_EQUAL("http://node2.im#" + capsInfo1alt->getVersion(), discoInfo->getNode());
}
void testReceiveNoDiscoFallsBack() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
sendPresenceWithCaps(user2, capsInfo1alt);
- stanzaChannel->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID(), boost::shared_ptr<DiscoInfo>()));
+ stanzaChannel->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID(), std::shared_ptr<DiscoInfo>()));
CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<DiscoInfo>(1, user2, IQ::Get));
- boost::shared_ptr<DiscoInfo> discoInfo(stanzaChannel->sentStanzas[1]->getPayload<DiscoInfo>());
+ std::shared_ptr<DiscoInfo> discoInfo(stanzaChannel->sentStanzas[1]->getPayload<DiscoInfo>());
CPPUNIT_ASSERT(discoInfo);
CPPUNIT_ASSERT_EQUAL("http://node2.im#" + capsInfo1alt->getVersion(), discoInfo->getNode());
}
void testReceiveFailingFallbackDiscoFallsBack() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
sendPresenceWithCaps(user2, capsInfo1alt);
sendPresenceWithCaps(user3, capsInfo1);
@@ -213,7 +213,7 @@ class CapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveSameHashFromFailingUserAfterReconnectRequestsDisco() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID()));
stanzaChannel->setAvailable(false);
@@ -226,7 +226,7 @@ class CapsManagerTest : public CppUnit::TestFixture {
}
void testReconnectResetsFallback() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
sendPresenceWithCaps(user2, capsInfo1alt);
stanzaChannel->setAvailable(false);
@@ -239,7 +239,7 @@ class CapsManagerTest : public CppUnit::TestFixture {
}
void testReconnectResetsRequests() {
- boost::shared_ptr<CapsManager> testling = createManager();
+ std::shared_ptr<CapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
stanzaChannel->sentStanzas.clear();
stanzaChannel->setAvailable(false);
@@ -250,8 +250,8 @@ class CapsManagerTest : public CppUnit::TestFixture {
}
private:
- boost::shared_ptr<CapsManager> createManager() {
- boost::shared_ptr<CapsManager> manager(new CapsManager(storage, stanzaChannel, iqRouter, crypto.get()));
+ std::shared_ptr<CapsManager> createManager() {
+ std::shared_ptr<CapsManager> manager(new CapsManager(storage, stanzaChannel, iqRouter, crypto.get()));
manager->setWarnOnInvalidHash(false);
//manager->onCapsChanged.connect(boost::bind(&CapsManagerTest::handleCapsChanged, this, _1));
return manager;
@@ -261,14 +261,14 @@ class CapsManagerTest : public CppUnit::TestFixture {
changes.push_back(jid);
}
- void sendPresenceWithCaps(const JID& jid, boost::shared_ptr<CapsInfo> caps) {
- boost::shared_ptr<Presence> presence(new Presence());
+ void sendPresenceWithCaps(const JID& jid, std::shared_ptr<CapsInfo> caps) {
+ std::shared_ptr<Presence> presence(new Presence());
presence->setFrom(jid);
presence->addPayload(caps);
stanzaChannel->onPresenceReceived(presence);
}
- void sendDiscoInfoResult(boost::shared_ptr<DiscoInfo> discoInfo) {
+ void sendDiscoInfoResult(std::shared_ptr<DiscoInfo> discoInfo) {
stanzaChannel->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID(), discoInfo));
}
@@ -278,15 +278,15 @@ class CapsManagerTest : public CppUnit::TestFixture {
CapsStorage* storage;
std::vector<JID> changes;
JID user1;
- boost::shared_ptr<DiscoInfo> discoInfo1;
- boost::shared_ptr<CapsInfo> capsInfo1;
- boost::shared_ptr<CapsInfo> capsInfo1alt;
+ std::shared_ptr<DiscoInfo> discoInfo1;
+ std::shared_ptr<CapsInfo> capsInfo1;
+ std::shared_ptr<CapsInfo> capsInfo1alt;
JID user2;
- boost::shared_ptr<DiscoInfo> discoInfo2;
- boost::shared_ptr<CapsInfo> capsInfo2;
- boost::shared_ptr<CapsInfo> legacyCapsInfo;
+ std::shared_ptr<DiscoInfo> discoInfo2;
+ std::shared_ptr<CapsInfo> capsInfo2;
+ std::shared_ptr<CapsInfo> legacyCapsInfo;
JID user3;
- boost::shared_ptr<CryptoProvider> crypto;
+ std::shared_ptr<CryptoProvider> crypto;
};
CPPUNIT_TEST_SUITE_REGISTRATION(CapsManagerTest);
diff --git a/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp b/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp
index 907029e..45dc959 100644
--- a/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp
+++ b/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp
@@ -40,11 +40,11 @@ class DiscoInfoResponderTest : public CppUnit::TestFixture {
discoInfo.addFeature("foo");
testling.setDiscoInfo(discoInfo);
- boost::shared_ptr<DiscoInfo> query(new DiscoInfo());
+ std::shared_ptr<DiscoInfo> query(new DiscoInfo());
channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com"), "id-1", query));
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
- boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>());
+ std::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>());
CPPUNIT_ASSERT(payload);
CPPUNIT_ASSERT_EQUAL(std::string(""), payload->getNode());
CPPUNIT_ASSERT(payload->hasFeature("foo"));
@@ -62,12 +62,12 @@ class DiscoInfoResponderTest : public CppUnit::TestFixture {
discoInfoBar.addFeature("bar");
testling.setDiscoInfo("bar-node", discoInfoBar);
- boost::shared_ptr<DiscoInfo> query(new DiscoInfo());
+ std::shared_ptr<DiscoInfo> query(new DiscoInfo());
query->setNode("bar-node");
channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com"), "id-1", query));
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
- boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>());
+ std::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>());
CPPUNIT_ASSERT(payload);
CPPUNIT_ASSERT_EQUAL(std::string("bar-node"), payload->getNode());
CPPUNIT_ASSERT(payload->hasFeature("bar"));
@@ -77,13 +77,13 @@ class DiscoInfoResponderTest : public CppUnit::TestFixture {
void testHandleRequest_GetInvalidNodeInfo() {
DiscoInfoResponder testling(router_);
- boost::shared_ptr<DiscoInfo> query(new DiscoInfo());
+ std::shared_ptr<DiscoInfo> query(new DiscoInfo());
query->setNode("bar-node");
channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com"), "id-1", query));
testling.start();
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
- boost::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>());
+ std::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>());
CPPUNIT_ASSERT(payload);
testling.stop();
diff --git a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp
index 4062753..d775f6c 100644
--- a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp
+++ b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp
@@ -34,22 +34,22 @@ class EntityCapsManagerTest : public CppUnit::TestFixture {
public:
void setUp() {
- crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
stanzaChannel = new DummyStanzaChannel();
capsProvider = new DummyCapsProvider();
user1 = JID("user1@bar.com/bla");
- discoInfo1 = boost::make_shared<DiscoInfo>();
+ discoInfo1 = std::make_shared<DiscoInfo>();
discoInfo1->addFeature("http://swift.im/feature1");
- capsInfo1 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im", crypto.get()).generateCapsInfo(*discoInfo1.get()));
- capsInfo1alt = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo1.get()));
+ capsInfo1 = std::make_shared<CapsInfo>(CapsInfoGenerator("http://node1.im", crypto.get()).generateCapsInfo(*discoInfo1.get()));
+ capsInfo1alt = std::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo1.get()));
user2 = JID("user2@foo.com/baz");
- discoInfo2 = boost::make_shared<DiscoInfo>();
+ discoInfo2 = std::make_shared<DiscoInfo>();
discoInfo2->addFeature("http://swift.im/feature2");
- capsInfo2 = boost::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo2.get()));
+ capsInfo2 = std::make_shared<CapsInfo>(CapsInfoGenerator("http://node2.im", crypto.get()).generateCapsInfo(*discoInfo2.get()));
user3 = JID("user3@foo.com/baz");
- legacyCapsInfo = boost::make_shared<CapsInfo>("http://swift.im", "ver1", "");
+ legacyCapsInfo = std::make_shared<CapsInfo>("http://swift.im", "ver1", "");
}
void tearDown() {
@@ -58,7 +58,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveKnownHash() {
- boost::shared_ptr<EntityCapsManager> testling = createManager();
+ std::shared_ptr<EntityCapsManager> testling = createManager();
capsProvider->caps[capsInfo1->getVersion()] = discoInfo1;
sendPresenceWithCaps(user1, capsInfo1);
@@ -68,7 +68,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveKnownHashTwiceDoesNotTriggerChange() {
- boost::shared_ptr<EntityCapsManager> testling = createManager();
+ std::shared_ptr<EntityCapsManager> testling = createManager();
capsProvider->caps[capsInfo1->getVersion()] = discoInfo1;
sendPresenceWithCaps(user1, capsInfo1);
changes.clear();
@@ -79,14 +79,14 @@ class EntityCapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveUnknownHashDoesNotTriggerChange() {
- boost::shared_ptr<EntityCapsManager> testling = createManager();
+ std::shared_ptr<EntityCapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(changes.size()));
}
void testHashAvailable() {
- boost::shared_ptr<EntityCapsManager> testling = createManager();
+ std::shared_ptr<EntityCapsManager> testling = createManager();
sendPresenceWithCaps(user1, capsInfo1);
capsProvider->caps[capsInfo1->getVersion()] = discoInfo1;
@@ -98,7 +98,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveUnknownHashAfterKnownHashTriggersChangeAndClearsCaps() {
- boost::shared_ptr<EntityCapsManager> testling = createManager();
+ std::shared_ptr<EntityCapsManager> testling = createManager();
capsProvider->caps[capsInfo1->getVersion()] = discoInfo1;
sendPresenceWithCaps(user1, capsInfo1);
changes.clear();
@@ -110,7 +110,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture {
}
void testReceiveUnavailablePresenceAfterKnownHashTriggersChangeAndClearsCaps() {
- boost::shared_ptr<EntityCapsManager> testling = createManager();
+ std::shared_ptr<EntityCapsManager> testling = createManager();
capsProvider->caps[capsInfo1->getVersion()] = discoInfo1;
sendPresenceWithCaps(user1, capsInfo1);
changes.clear();
@@ -122,7 +122,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture {
}
void testReconnectTriggersChangeAndClearsCaps() {
- boost::shared_ptr<EntityCapsManager> testling = createManager();
+ std::shared_ptr<EntityCapsManager> testling = createManager();
capsProvider->caps[capsInfo1->getVersion()] = discoInfo1;
capsProvider->caps[capsInfo2->getVersion()] = discoInfo2;
sendPresenceWithCaps(user1, capsInfo1);
@@ -139,8 +139,8 @@ class EntityCapsManagerTest : public CppUnit::TestFixture {
}
private:
- boost::shared_ptr<EntityCapsManager> createManager() {
- boost::shared_ptr<EntityCapsManager> manager(new EntityCapsManager(capsProvider, stanzaChannel));
+ std::shared_ptr<EntityCapsManager> createManager() {
+ std::shared_ptr<EntityCapsManager> manager(new EntityCapsManager(capsProvider, stanzaChannel));
manager->onCapsChanged.connect(boost::bind(&EntityCapsManagerTest::handleCapsChanged, this, _1));
return manager;
}
@@ -149,15 +149,15 @@ class EntityCapsManagerTest : public CppUnit::TestFixture {
changes.push_back(jid);
}
- void sendPresenceWithCaps(const JID& jid, boost::shared_ptr<CapsInfo> caps) {
- boost::shared_ptr<Presence> presence(new Presence());
+ void sendPresenceWithCaps(const JID& jid, std::shared_ptr<CapsInfo> caps) {
+ std::shared_ptr<Presence> presence(new Presence());
presence->setFrom(jid);
presence->addPayload(caps);
stanzaChannel->onPresenceReceived(presence);
}
void sendUnavailablePresence(const JID& jid) {
- boost::shared_ptr<Presence> presence(new Presence());
+ std::shared_ptr<Presence> presence(new Presence());
presence->setFrom(jid);
presence->setType(Presence::Unavailable);
stanzaChannel->onPresenceReceived(presence);
@@ -180,16 +180,16 @@ class EntityCapsManagerTest : public CppUnit::TestFixture {
DummyStanzaChannel* stanzaChannel;
DummyCapsProvider* capsProvider;
JID user1;
- boost::shared_ptr<DiscoInfo> discoInfo1;
- boost::shared_ptr<CapsInfo> capsInfo1;
- boost::shared_ptr<CapsInfo> capsInfo1alt;
+ std::shared_ptr<DiscoInfo> discoInfo1;
+ std::shared_ptr<CapsInfo> capsInfo1;
+ std::shared_ptr<CapsInfo> capsInfo1alt;
JID user2;
- boost::shared_ptr<DiscoInfo> discoInfo2;
- boost::shared_ptr<CapsInfo> capsInfo2;
- boost::shared_ptr<CapsInfo> legacyCapsInfo;
+ std::shared_ptr<DiscoInfo> discoInfo2;
+ std::shared_ptr<CapsInfo> capsInfo2;
+ std::shared_ptr<CapsInfo> legacyCapsInfo;
JID user3;
std::vector<JID> changes;
- boost::shared_ptr<CryptoProvider> crypto;
+ std::shared_ptr<CryptoProvider> crypto;
};
CPPUNIT_TEST_SUITE_REGISTRATION(EntityCapsManagerTest);
diff --git a/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp b/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp
index 3c1a057..9369a04 100644
--- a/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp
+++ b/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp
@@ -41,11 +41,11 @@ class JIDDiscoInfoResponderTest : public CppUnit::TestFixture {
discoInfo.addFeature("foo");
testling.setDiscoInfo(JID("foo@bar.com/baz"), discoInfo);
- boost::shared_ptr<DiscoInfo> query(new DiscoInfo());
+ std::shared_ptr<DiscoInfo> query(new DiscoInfo());
channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com/baz"), "id-1", query));
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
- boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>());
+ std::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>());
CPPUNIT_ASSERT(payload);
CPPUNIT_ASSERT_EQUAL(std::string(""), payload->getNode());
CPPUNIT_ASSERT(payload->hasFeature("foo"));
@@ -63,12 +63,12 @@ class JIDDiscoInfoResponderTest : public CppUnit::TestFixture {
discoInfoBar.addFeature("bar");
testling.setDiscoInfo(JID("foo@bar.com/baz"), "bar-node", discoInfoBar);
- boost::shared_ptr<DiscoInfo> query(new DiscoInfo());
+ std::shared_ptr<DiscoInfo> query(new DiscoInfo());
query->setNode("bar-node");
channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com/baz"), "id-1", query));
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
- boost::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>());
+ std::shared_ptr<DiscoInfo> payload(channel_->iqs_[0]->getPayload<DiscoInfo>());
CPPUNIT_ASSERT(payload);
CPPUNIT_ASSERT_EQUAL(std::string("bar-node"), payload->getNode());
CPPUNIT_ASSERT(payload->hasFeature("bar"));
@@ -83,12 +83,12 @@ class JIDDiscoInfoResponderTest : public CppUnit::TestFixture {
testling.setDiscoInfo(JID("foo@bar.com/baz"), discoInfo);
testling.start();
- boost::shared_ptr<DiscoInfo> query(new DiscoInfo());
+ std::shared_ptr<DiscoInfo> query(new DiscoInfo());
query->setNode("bar-node");
channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com/baz"), "id-1", query));
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
- boost::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>());
+ std::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>());
CPPUNIT_ASSERT(payload);
testling.stop();
@@ -101,11 +101,11 @@ class JIDDiscoInfoResponderTest : public CppUnit::TestFixture {
testling.setDiscoInfo(JID("foo@bar.com/baz"), discoInfo);
testling.start();
- boost::shared_ptr<DiscoInfo> query(new DiscoInfo());
+ std::shared_ptr<DiscoInfo> query(new DiscoInfo());
channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com/fum"), "id-1", query));
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size()));
- boost::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>());
+ std::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>());
CPPUNIT_ASSERT(payload);
testling.stop();