summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoanna Hulboj <joanna.hulboj@isode.com>2017-04-28 13:52:47 (GMT)
committerKevin Smith <kevin.smith@isode.com>2017-07-07 16:23:08 (GMT)
commitf68d574ff04162e98e16a636c66ab6de5960e875 (patch)
tree0248d9450a8bb6aa6731067d9f921791d9d4deaa /Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
parentd89b27b8796f89c847c280dacfb1b09fd6cb6731 (diff)
downloadswift-f68d574ff04162e98e16a636c66ab6de5960e875.zip
swift-f68d574ff04162e98e16a636c66ab6de5960e875.tar.bz2
Make std:: make_unique available in gcc with c++11
Test-Information: Unit tests pass OK on Windows 10 and CentOS 7.3. Change-Id: I33c9eb6b3e6409727350a44e6d5c88c5e8907275
Diffstat (limited to 'Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp')
-rw-r--r--Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
index 290dda5..80667b6 100644
--- a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
+++ b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
@@ -32,62 +32,62 @@
#include <Swiften/EventLoop/DummyEventLoop.h>
#include <Swiften/FileTransfer/ByteArrayReadBytestream.h>
#include <Swiften/FileTransfer/ByteArrayWriteBytestream.h>
#include <Swiften/FileTransfer/SOCKS5BytestreamClientSession.h>
#include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h>
#include <Swiften/JID/JID.h>
#include <Swiften/Network/DummyConnection.h>
#include <Swiften/Network/DummyTimerFactory.h>
#include <Swiften/StringCodecs/Hexify.h>
using namespace Swift;
static boost::mt19937 randomGen;
class SOCKS5BytestreamClientSessionTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(SOCKS5BytestreamClientSessionTest);
CPPUNIT_TEST(testForSessionReady);
CPPUNIT_TEST(testErrorHandlingHello);
CPPUNIT_TEST(testErrorHandlingRequest);
CPPUNIT_TEST(testWriteBytestream);
CPPUNIT_TEST(testReadBytestream);
CPPUNIT_TEST_SUITE_END();
public:
SOCKS5BytestreamClientSessionTest() : destinationAddressPort(HostAddressPort(HostAddress::fromString("127.0.0.1").get(), 8888)) {}
void setUp() {
crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
destination = "092a44d859d19c9eed676b551ee80025903351c2";
randomGen.seed(static_cast<unsigned int>(time(nullptr)));
- eventLoop = std::unique_ptr<DummyEventLoop>(new DummyEventLoop());
- timerFactory = std::unique_ptr<DummyTimerFactory>(new DummyTimerFactory());
+ eventLoop = std::make_unique<DummyEventLoop>();
+ timerFactory = std::make_unique<DummyTimerFactory>();
connection = std::make_shared<MockeryConnection>(failingPorts, true, eventLoop.get());
//connection->onDataSent.connect(boost::bind(&SOCKS5BytestreamServerSessionTest::handleDataWritten, this, _1));
//stream1 = std::make_shared<ByteArrayReadBytestream>(createByteArray("abcdefg")));
// connection->onDataRead.connect(boost::bind(&SOCKS5BytestreamClientSessionTest::handleDataRead, this, _1));
}
void tearDown() {
//connection.reset();
}
void testForSessionReady() {
TestHelper helper;
connection->onDataSent.connect(boost::bind(&TestHelper::handleConnectionDataWritten, &helper, _1));
SOCKS5BytestreamClientSession::ref clientSession = std::make_shared<SOCKS5BytestreamClientSession>(connection, destinationAddressPort, destination, timerFactory.get());
clientSession->onSessionReady.connect(boost::bind(&TestHelper::handleSessionReady, &helper, _1));
clientSession->start();
eventLoop->processEvents();
CPPUNIT_ASSERT(createByteArray("\x05\x01\x00", 3) == helper.unprocessedInput);
helper.unprocessedInput.clear();
serverRespondHelloOK();
eventLoop->processEvents();
CPPUNIT_ASSERT_EQUAL(createByteArray("\x05\x01\x00\x03", 4), createByteArray(&helper.unprocessedInput[0], 4));
CPPUNIT_ASSERT_EQUAL(createByteArray(static_cast<char>(destination.size())), createByteArray(static_cast<char>(helper.unprocessedInput[4])));
CPPUNIT_ASSERT_EQUAL(createByteArray(destination), createByteArray(&helper.unprocessedInput[5], destination.size()));
CPPUNIT_ASSERT_EQUAL(createByteArray("\x00", 1), createByteArray(&helper.unprocessedInput[5 + destination.size()], 1));
helper.unprocessedInput.clear();