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/FileTransfer/UnitTest/OutgoingJingleFileTransferTest.cpp
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/FileTransfer/UnitTest/OutgoingJingleFileTransferTest.cpp')
-rw-r--r--Swiften/FileTransfer/UnitTest/OutgoingJingleFileTransferTest.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/Swiften/FileTransfer/UnitTest/OutgoingJingleFileTransferTest.cpp b/Swiften/FileTransfer/UnitTest/OutgoingJingleFileTransferTest.cpp
index 401463c..3f4d20f 100644
--- a/Swiften/FileTransfer/UnitTest/OutgoingJingleFileTransferTest.cpp
+++ b/Swiften/FileTransfer/UnitTest/OutgoingJingleFileTransferTest.cpp
@@ -11,10 +11,10 @@
*/
#include <iostream>
+#include <memory>
#include <boost/bind.hpp>
#include <boost/optional.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -81,16 +81,16 @@ class OutgoingJingleFileTransferTest : public CppUnit::TestFixture {
public:
- boost::shared_ptr<OutgoingJingleFileTransfer> createTestling(const FileTransferOptions& options = FileTransferOptions().withAssistedAllowed(false).withDirectAllowed(false).withProxiedAllowed(false)) {
+ std::shared_ptr<OutgoingJingleFileTransfer> createTestling(const FileTransferOptions& options = FileTransferOptions().withAssistedAllowed(false).withDirectAllowed(false).withProxiedAllowed(false)) {
JID to("test@foo.com/bla");
JingleFileTransferFileInfo fileInfo;
fileInfo.setDescription("some file");
fileInfo.setName("test.bin");
fileInfo.addHash(HashElement("sha-1", ByteArray()));
fileInfo.setSize(1024 * 1024);
- return boost::shared_ptr<OutgoingJingleFileTransfer>(new OutgoingJingleFileTransfer(
+ return std::shared_ptr<OutgoingJingleFileTransfer>(new OutgoingJingleFileTransfer(
to,
- boost::shared_ptr<JingleSession>(fakeJingleSession),
+ std::shared_ptr<JingleSession>(fakeJingleSession),
stream,
ftTransportFactory,
timerFactory,
@@ -107,9 +107,9 @@ public:
}
void setUp() {
- crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
fakeJingleSession = new FakeJingleSession("foo@bar.com/baz", "mysession");
- jingleContentPayload = boost::make_shared<JingleContentPayload>();
+ jingleContentPayload = std::make_shared<JingleContentPayload>();
stanzaChannel = new DummyStanzaChannel();
iqRouter = new IQRouter(stanzaChannel);
eventLoop = new DummyEventLoop();
@@ -126,7 +126,7 @@ public:
data.push_back(34);
}
- stream = boost::make_shared<ByteArrayReadBytestream>(data);
+ stream = std::make_shared<ByteArrayReadBytestream>(data);
idGen = new IDGenerator();
s5bProxy = new SOCKS5BytestreamProxiesManager(connectionFactory, timerFactory, resolver, iqRouter, "bar.com");
@@ -151,29 +151,29 @@ public:
void test_SendSessionInitiateOnStart() {
- boost::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling();
+ std::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling();
transfer->start();
FakeJingleSession::InitiateCall call = getCall<FakeJingleSession::InitiateCall>(0);
- JingleFileTransferDescription::ref description = boost::dynamic_pointer_cast<JingleFileTransferDescription>(call.description);
+ JingleFileTransferDescription::ref description = std::dynamic_pointer_cast<JingleFileTransferDescription>(call.description);
CPPUNIT_ASSERT(description);
CPPUNIT_ASSERT(static_cast<size_t>(1048576) == description->getFileInfo().getSize());
- JingleIBBTransportPayload::ref transport = boost::dynamic_pointer_cast<JingleIBBTransportPayload>(call.payload);
+ JingleIBBTransportPayload::ref transport = std::dynamic_pointer_cast<JingleIBBTransportPayload>(call.payload);
CPPUNIT_ASSERT(transport);
}
void test_FallbackToIBBAfterFailingS5B() {
- boost::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling(FileTransferOptions().withAssistedAllowed(true).withDirectAllowed(true).withProxiedAllowed(true));
+ std::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling(FileTransferOptions().withAssistedAllowed(true).withDirectAllowed(true).withProxiedAllowed(true));
transfer->start();
FakeJingleSession::InitiateCall call = getCall<FakeJingleSession::InitiateCall>(0);
- CPPUNIT_ASSERT(boost::dynamic_pointer_cast<JingleS5BTransportPayload>(call.payload));
+ CPPUNIT_ASSERT(std::dynamic_pointer_cast<JingleS5BTransportPayload>(call.payload));
fakeJingleSession->handleSessionAcceptReceived(call.id, call.description, call.payload);
// send candidate failure
- JingleS5BTransportPayload::ref candidateFailurePayload = boost::make_shared<JingleS5BTransportPayload>();
+ JingleS5BTransportPayload::ref candidateFailurePayload = std::make_shared<JingleS5BTransportPayload>();
candidateFailurePayload->setCandidateError(true);
candidateFailurePayload->setSessionID(call.payload->getSessionID());
fakeJingleSession->handleTransportInfoReceived(call.id, candidateFailurePayload);
@@ -193,7 +193,7 @@ public:
}
void test_ReceiveSessionTerminateAfterSessionInitiate() {
- boost::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling();
+ std::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling();
transfer->start();
getCall<FakeJingleSession::InitiateCall>(0);
@@ -207,7 +207,7 @@ public:
}
void test_DeclineEmitsFinishedStateCanceled() {
- boost::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling();
+ std::shared_ptr<OutgoingJingleFileTransfer> transfer = createTestling();
transfer->start();
getCall<FakeJingleSession::InitiateCall>(0);
@@ -227,20 +227,20 @@ public:
private:
void addFileTransferDescription() {
- boost::shared_ptr<JingleFileTransferDescription> desc = boost::make_shared<JingleFileTransferDescription>();
+ std::shared_ptr<JingleFileTransferDescription> desc = std::make_shared<JingleFileTransferDescription>();
desc->setFileInfo(JingleFileTransferFileInfo());
jingleContentPayload->addDescription(desc);
}
- boost::shared_ptr<JingleS5BTransportPayload> addJingleS5BPayload() {
- JingleS5BTransportPayload::ref payLoad = boost::make_shared<JingleS5BTransportPayload>();
+ std::shared_ptr<JingleS5BTransportPayload> addJingleS5BPayload() {
+ JingleS5BTransportPayload::ref payLoad = std::make_shared<JingleS5BTransportPayload>();
payLoad->setSessionID("mysession");
jingleContentPayload->addTransport(payLoad);
return payLoad;
}
- boost::shared_ptr<JingleIBBTransportPayload> addJingleIBBPayload() {
- JingleIBBTransportPayload::ref payLoad = boost::make_shared<JingleIBBTransportPayload>();
+ std::shared_ptr<JingleIBBTransportPayload> addJingleIBBPayload() {
+ JingleIBBTransportPayload::ref payLoad = std::make_shared<JingleIBBTransportPayload>();
payLoad->setSessionID("mysession");
jingleContentPayload->addTransport(payLoad);
return payLoad;
@@ -260,9 +260,9 @@ private:
private:
std::vector<unsigned char> data;
- boost::shared_ptr<ByteArrayReadBytestream> stream;
+ std::shared_ptr<ByteArrayReadBytestream> stream;
FakeJingleSession* fakeJingleSession;
- boost::shared_ptr<JingleContentPayload> jingleContentPayload;
+ std::shared_ptr<JingleContentPayload> jingleContentPayload;
FileTransferTransporterFactory* ftTransportFactory;
SOCKS5BytestreamServerManager* bytestreamServerManager;
DummyStanzaChannel* stanzaChannel;
@@ -274,7 +274,7 @@ private:
DummyTimerFactory* timerFactory;
DummyConnectionFactory* connectionFactory;
DummyConnectionServerFactory* serverConnectionFactory;
- boost::shared_ptr<CryptoProvider> crypto;
+ std::shared_ptr<CryptoProvider> crypto;
NetworkEnvironment* networkEnvironment;
NATTraverser* natTraverser;
DomainNameResolver* resolver;