summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-05-03 20:39:27 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-05-05 19:43:14 (GMT)
commit772b2ec0243d7b55d91e4027d828881d18093ed0 (patch)
tree83a58b2b97f3992165ee20c05e0630452eb50457 /Swiften/QA
parent0b3db8fd68abee7269d5a38aabd8a816e099eae5 (diff)
downloadswift-772b2ec0243d7b55d91e4027d828881d18093ed0.zip
swift-772b2ec0243d7b55d91e4027d828881d18093ed0.tar.bz2
Replace ByteArray by typedef.
Diffstat (limited to 'Swiften/QA')
-rw-r--r--Swiften/QA/NetworkTest/BoostConnectionTest.cpp19
-rw-r--r--Swiften/QA/TLSTest/CertificateTest.cpp3
2 files changed, 12 insertions, 10 deletions
diff --git a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp
index 0929974..3d3c3c4 100644
--- a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp
+++ b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp
@@ -10,6 +10,7 @@
#include <boost/smart_ptr/make_shared.hpp>
#include <string>
+#include <Swiften/Base/Algorithm.h>
#include <Swiften/Base/sleep.h>
#include <Swiften/Network/BoostConnection.h>
#include <Swiften/Network/HostAddress.h>
@@ -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(createByteArray("<stream:strea"));
+ testling->write(createByteArray("m"));
+ testling->write(createByteArray(">"));
// 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(createByteArray("<stream:stream>"));
+ connection->write(createByteArray("\r\n\r\n")); // Temporarily, while we don't have an xmpp server running on ipv6
}
void handleDataRead(const ByteArray& data) {
- receivedData += data;
+ append(receivedData, data);
}
void handleDisconnected() {
diff --git a/Swiften/QA/TLSTest/CertificateTest.cpp b/Swiften/QA/TLSTest/CertificateTest.cpp
index dff065f..67ca064 100644
--- a/Swiften/QA/TLSTest/CertificateTest.cpp
+++ b/Swiften/QA/TLSTest/CertificateTest.cpp
@@ -10,6 +10,7 @@
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <boost/bind.hpp>
+#include <QA/Checker/IO.h>
#include <Swiften/TLS/CertificateFactory.h>
#include "SwifTools/Application/PlatformApplicationPathProvider.h"
@@ -30,7 +31,7 @@ class CertificateTest : public CppUnit::TestFixture {
public:
void setUp() {
pathProvider = new PlatformApplicationPathProvider("FileReadBytestreamTest");
- certificateData.readFromFile((pathProvider->getExecutableDir() / "jabber_org.crt").string());
+ readByteArrayFromFile(certificateData, (pathProvider->getExecutableDir() / "jabber_org.crt").string());
certificateFactory = new CERTIFICATE_FACTORY();
}