summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp')
-rw-r--r--Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp b/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp
index 85ae537..59cf996 100644
--- a/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp
+++ b/Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp
@@ -1,11 +1,11 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <boost/bind.hpp>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -47,19 +47,19 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture {
querier->setAddress("rabbithole.local", HostAddress::fromString("192.168.1.1").get());
testling->connect();
eventLoop->processEvents();
CPPUNIT_ASSERT(connectFinished);
CPPUNIT_ASSERT(!connectError);
CPPUNIT_ASSERT(connection->connectedTo);
CPPUNIT_ASSERT_EQUAL(std::string(connection->connectedTo->getAddress().toString()), std::string("192.168.1.1"));
- CPPUNIT_ASSERT_EQUAL(connection->connectedTo->getPort(), 1234);
+ CPPUNIT_ASSERT_EQUAL(connection->connectedTo->getPort(), static_cast<unsigned short>(1234));
}
void testConnect_UnableToResolve() {
std::shared_ptr<LinkLocalConnector>
testling(createConnector("rabbithole.local", 1234));
querier->setAddress("rabbithole.local", boost::optional<HostAddress>());
testling->connect();
eventLoop->processEvents();
@@ -108,24 +108,26 @@ class LinkLocalConnectorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT(FakeConnection::Connecting == connection->state);
testling->cancel();
eventLoop->processEvents();
CPPUNIT_ASSERT(FakeConnection::Disconnected == connection->state);
}
private:
- std::shared_ptr<LinkLocalConnector> createConnector(const std::string& hostname, int port) {
+ std::shared_ptr<LinkLocalConnector> createConnector(const std::string& hostname, unsigned short port) {
+ auto txtRecord = LinkLocalServiceInfo().toTXTRecord();
+ CPPUNIT_ASSERT(txtRecord);
LinkLocalService service(
DNSSDServiceID("myname", "local."),
DNSSDResolveServiceQuery::Result(
"myname._presence._tcp.local", hostname, port,
- LinkLocalServiceInfo().toTXTRecord()));
+ *txtRecord));
std::shared_ptr<LinkLocalConnector> result(
new LinkLocalConnector(service, querier, connection));
result->onConnectFinished.connect(
boost::bind(&LinkLocalConnectorTest::handleConnected, this, _1));
return result;
}
void handleConnected(bool e) {
connectFinished = true;