summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-08-13 17:17:40 (GMT)
committerTobias Markmann <tm@ayena.de>2013-08-13 17:40:43 (GMT)
commit437e70ff9d254b11a30a4926010a91543d7f282c (patch)
tree123ef9476d89ad32643356ea11c52d212d2d03ad /Swiften/QA
parent3eefe28a2f6cc1e33d9d2b0bad7f9c6f2146352f (diff)
downloadswift-437e70ff9d254b11a30a4926010a91543d7f282c.zip
swift-437e70ff9d254b11a30a4926010a91543d7f282c.tar.bz2
Adding basic support for Android and Unbound (No IPv6 yet).
Change-Id: I1d74324515b20e0dc3d0ef4aa2f556fea7b4bee3 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.s
Diffstat (limited to 'Swiften/QA')
-rw-r--r--Swiften/QA/NetworkTest/DomainNameResolverTest.cpp22
-rw-r--r--Swiften/QA/NetworkTest/SConscript3
2 files changed, 23 insertions, 2 deletions
diff --git a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
index 7bbb1a6..bc4f1a3 100644
--- a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
+++ b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
@@ -9,11 +9,17 @@
#include <boost/bind.hpp>
#include <algorithm>
-
#include <Swiften/Base/sleep.h>
#include <string>
#include <Swiften/Base/ByteArray.h>
+#ifdef USE_UNBOUND
+#include <Swiften/Network/UnboundDomainNameResolver.h>
+#else
#include <Swiften/Network/PlatformDomainNameResolver.h>
+#endif
+#include <Swiften/Network/BoostTimerFactory.h>
+#include <Swiften/Network/NetworkFactories.h>
+#include <Swiften/Network/BoostIOServiceThread.h>
#include <Swiften/Network/DomainNameAddressQuery.h>
#include <Swiften/Network/DomainNameServiceQuery.h>
#include <Swiften/EventLoop/DummyEventLoop.h>
@@ -32,24 +38,34 @@ class DomainNameResolverTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(DomainNameResolverTest);
CPPUNIT_TEST(testResolveAddress);
CPPUNIT_TEST(testResolveAddress_Error);
+#ifndef USE_UNBOUND
CPPUNIT_TEST(testResolveAddress_IPv6);
CPPUNIT_TEST(testResolveAddress_IPv4and6);
CPPUNIT_TEST(testResolveAddress_International);
+#endif
CPPUNIT_TEST(testResolveAddress_Localhost);
CPPUNIT_TEST(testResolveAddress_Parallel);
+#ifndef USE_UNBOUND
CPPUNIT_TEST(testResolveService);
+#endif
CPPUNIT_TEST(testResolveService_Error);
CPPUNIT_TEST_SUITE_END();
public:
void setUp() {
+ ioServiceThread = new BoostIOServiceThread();
eventLoop = new DummyEventLoop();
+#ifdef USE_UNBOUND
+ resolver = new UnboundDomainNameResolver(ioServiceThread->getIOService(), eventLoop);
+#else
idnConverter = boost::shared_ptr<IDNConverter>(PlatformIDNConverter::create());
resolver = new PlatformDomainNameResolver(idnConverter.get(), eventLoop);
+#endif
resultsAvailable = false;
}
void tearDown() {
+ delete ioServiceThread;
delete resolver;
delete eventLoop;
}
@@ -211,14 +227,16 @@ class DomainNameResolverTest : public CppUnit::TestFixture {
}
private:
+ BoostIOServiceThread* ioServiceThread;
DummyEventLoop* eventLoop;
boost::shared_ptr<IDNConverter> idnConverter;
+ boost::shared_ptr<TimerFactory> timerFactory;
bool resultsAvailable;
std::vector<HostAddress> addressQueryResult;
std::vector<HostAddress> allAddressQueryResults;
boost::optional<DomainNameResolveError> addressQueryError;
std::vector<DomainNameServiceQuery::Result> serviceQueryResult;
- PlatformDomainNameResolver* resolver;
+ DomainNameResolver* resolver;
};
CPPUNIT_TEST_SUITE_REGISTRATION(DomainNameResolverTest);
diff --git a/Swiften/QA/NetworkTest/SConscript b/Swiften/QA/NetworkTest/SConscript
index e1dea26..b090165 100644
--- a/Swiften/QA/NetworkTest/SConscript
+++ b/Swiften/QA/NetworkTest/SConscript
@@ -11,6 +11,9 @@ if env["TEST"] :
myenv.MergeFlags(myenv["SWIFTEN_DEP_FLAGS"])
myenv.MergeFlags(myenv["CPPUNIT_FLAGS"])
+ if env.get("unbound", False) :
+ myenv.Append(CPPDEFINES = ["USE_UNBOUND"])
+
tester = myenv.Program("NetworkTest", [
"BoostConnectionServerTest.cpp",
"BoostConnectionTest.cpp",