summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp')
-rw-r--r--Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp
index 9d5e745..bb0ce61 100644
--- a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp
+++ b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp
@@ -9,13 +9,13 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Elements/ProtocolHeader.h"
-#include "Swiften/Elements/Presence.h"
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/StreamStack/XMPPLayer.h"
-#include "Swiften/StreamStack/LowLayer.h"
-#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
-#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h"
+#include <Swiften/Elements/ProtocolHeader.h>
+#include <Swiften/Elements/Presence.h>
+#include <Swiften/Base/ByteArray.h>
+#include <Swiften/StreamStack/XMPPLayer.h>
+#include <Swiften/StreamStack/LowLayer.h>
+#include <Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h>
+#include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h>
using namespace Swift;
@@ -46,7 +46,7 @@ class XMPPLayerTest : public CppUnit::TestFixture {
void testParseData_Error() {
testling_->onError.connect(boost::bind(&XMPPLayerTest::handleError, this));
- testling_->handleDataRead("<iq>");
+ testling_->handleDataRead(createSafeByteArray("<iq>"));
CPPUNIT_ASSERT_EQUAL(1, errorReceived_);
}
@@ -55,10 +55,10 @@ class XMPPLayerTest : public CppUnit::TestFixture {
testling_->onElement.connect(boost::bind(&XMPPLayerTest::handleElement, this, _1));
testling_->onError.connect(boost::bind(&XMPPLayerTest::handleError, this));
- testling_->handleDataRead("<stream:stream to=\"example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" >");
+ testling_->handleDataRead(createSafeByteArray("<stream:stream to=\"example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" >"));
testling_->resetParser();
- testling_->handleDataRead("<stream:stream to=\"example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" >");
- testling_->handleDataRead("<presence/>");
+ testling_->handleDataRead(createSafeByteArray("<stream:stream to=\"example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" >"));
+ testling_->handleDataRead(createSafeByteArray("<presence/>"));
CPPUNIT_ASSERT_EQUAL(1, elementsReceived_);
CPPUNIT_ASSERT_EQUAL(0, errorReceived_);
@@ -66,8 +66,8 @@ class XMPPLayerTest : public CppUnit::TestFixture {
void testResetParser_FromSlot() {
testling_->onElement.connect(boost::bind(&XMPPLayerTest::handleElementAndReset, this, _1));
- testling_->handleDataRead("<stream:stream to=\"example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" ><presence/>");
- testling_->handleDataRead("<stream:stream to=\"example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" ><presence/>");
+ testling_->handleDataRead(createSafeByteArray("<stream:stream to=\"example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" ><presence/>"));
+ testling_->handleDataRead(createSafeByteArray("<stream:stream to=\"example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" ><presence/>"));
CPPUNIT_ASSERT_EQUAL(2, elementsReceived_);
CPPUNIT_ASSERT_EQUAL(0, errorReceived_);
@@ -120,8 +120,8 @@ class XMPPLayerTest : public CppUnit::TestFixture {
class DummyLowLayer : public LowLayer {
public:
- virtual void writeData(const ByteArray& data) {
- writtenData += data.toString();
+ virtual void writeData(const SafeByteArray& data) {
+ writtenData += byteArrayToString(ByteArray(data.begin(), data.end()));
}
std::string writtenData;