summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/QA/NetworkTest')
-rw-r--r--Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp6
-rw-r--r--Swiften/QA/NetworkTest/BoostConnectionTest.cpp33
-rw-r--r--Swiften/QA/NetworkTest/DomainNameResolverTest.cpp12
3 files changed, 26 insertions, 25 deletions
diff --git a/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp b/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp
index 82a8be2..14da358 100644
--- a/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp
+++ b/Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp
@@ -9,9 +9,9 @@
#include <boost/shared_ptr.hpp>
#include <string>
-#include "Swiften/Network/BoostConnectionServer.h"
-#include "Swiften/Network/BoostIOServiceThread.h"
-#include "Swiften/EventLoop/DummyEventLoop.h"
+#include <Swiften/Network/BoostConnectionServer.h>
+#include <Swiften/Network/BoostIOServiceThread.h>
+#include <Swiften/EventLoop/DummyEventLoop.h>
using namespace Swift;
diff --git a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp
index 928e3db..335f2d2 100644
--- a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp
+++ b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp
@@ -10,12 +10,13 @@
#include <boost/smart_ptr/make_shared.hpp>
#include <string>
-#include "Swiften/Base/sleep.h"
-#include "Swiften/Network/BoostConnection.h"
-#include "Swiften/Network/HostAddress.h"
-#include "Swiften/Network/HostAddressPort.h"
-#include "Swiften/Network/BoostIOServiceThread.h"
-#include "Swiften/EventLoop/DummyEventLoop.h"
+#include <Swiften/Base/Algorithm.h>
+#include <Swiften/Base/sleep.h>
+#include <Swiften/Network/BoostConnection.h>
+#include <Swiften/Network/HostAddress.h>
+#include <Swiften/Network/HostAddressPort.h>
+#include <Swiften/Network/BoostIOServiceThread.h>
+#include <Swiften/EventLoop/DummyEventLoop.h>
const unsigned char* address = reinterpret_cast<const unsigned char*>("\x41\x63\xde\x89");
@@ -70,7 +71,7 @@ class BoostConnectionTest : public CppUnit::TestFixture {
testling->onDataRead.connect(boost::bind(&BoostConnectionTest::handleDataRead, this, _1));
testling->onDisconnected.connect(boost::bind(&BoostConnectionTest::handleDisconnected, this));
testling->connect(HostAddressPort(HostAddress("65.99.222.137"), 5222));
- while (receivedData.isEmpty()) {
+ while (receivedData.empty()) {
Swift::sleep(10);
eventLoop_->processEvents();
}
@@ -83,7 +84,7 @@ class BoostConnectionTest : public CppUnit::TestFixture {
testling->onDataRead.connect(boost::bind(&BoostConnectionTest::handleDataRead, this, _1));
testling->onDisconnected.connect(boost::bind(&BoostConnectionTest::handleDisconnected, this));
testling->connect(HostAddressPort(HostAddress("2001:470:1f0e:852::2"), 80));
- while (receivedData.isEmpty()) {
+ while (receivedData.empty()) {
Swift::sleep(10);
eventLoop_->processEvents();
}
@@ -102,9 +103,9 @@ class BoostConnectionTest : public CppUnit::TestFixture {
eventLoop_->processEvents();
}
- testling->write(ByteArray("<stream:strea"));
- testling->write(ByteArray("m"));
- testling->write(ByteArray(">"));
+ testling->write(createSafeByteArray("<stream:strea"));
+ testling->write(createSafeByteArray("m"));
+ testling->write(createSafeByteArray(">"));
// Check that we only did one write event, the others are queued
/*int runHandlers = */boostIOService->poll();
@@ -112,7 +113,7 @@ class BoostConnectionTest : public CppUnit::TestFixture {
// this test doesn't really work any more. We'll have to trust that things are queued.
//CPPUNIT_ASSERT_EQUAL(1, runHandlers);
// Process the other events
- while (receivedData.isEmpty()) {
+ while (receivedData.empty()) {
boostIOService->run_one();
eventLoop_->processEvents();
}
@@ -126,12 +127,12 @@ class BoostConnectionTest : public CppUnit::TestFixture {
}
void doWrite(BoostConnection* connection) {
- connection->write(ByteArray("<stream:stream>"));
- connection->write(ByteArray("\r\n\r\n")); // Temporarily, while we don't have an xmpp server running on ipv6
+ connection->write(createSafeByteArray("<stream:stream>"));
+ connection->write(createSafeByteArray("\r\n\r\n")); // Temporarily, while we don't have an xmpp server running on ipv6
}
- void handleDataRead(const ByteArray& data) {
- receivedData += data;
+ void handleDataRead(boost::shared_ptr<SafeByteArray> data) {
+ append(receivedData, *data);
}
void handleDisconnected() {
diff --git a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
index a0a7e7b..7cb9ed3 100644
--- a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
+++ b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp
@@ -10,13 +10,13 @@
#include <algorithm>
-#include "Swiften/Base/sleep.h"
+#include <Swiften/Base/sleep.h>
#include <string>
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/Network/PlatformDomainNameResolver.h"
-#include "Swiften/Network/DomainNameAddressQuery.h"
-#include "Swiften/Network/DomainNameServiceQuery.h"
-#include "Swiften/EventLoop/DummyEventLoop.h"
+#include <Swiften/Base/ByteArray.h>
+#include <Swiften/Network/PlatformDomainNameResolver.h>
+#include <Swiften/Network/DomainNameAddressQuery.h>
+#include <Swiften/Network/DomainNameServiceQuery.h>
+#include <Swiften/EventLoop/DummyEventLoop.h>
using namespace Swift;