summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-12-24 14:27:33 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-12-24 14:44:44 (GMT)
commitc060049e759571ae02a3a970c6a3088e099e5c9f (patch)
tree8512e2ca0ae0fba16238651b9d0edbb74e085b16 /Swiften/Network/UnitTest
parentb453b3bf94dcd40d71c30fd0053f7110cb52b211 (diff)
downloadswift-c060049e759571ae02a3a970c6a3088e099e5c9f.zip
swift-c060049e759571ae02a3a970c6a3088e099e5c9f.tar.bz2
Some BOSH refactoring.
Diffstat (limited to 'Swiften/Network/UnitTest')
-rw-r--r--Swiften/Network/UnitTest/BOSHConnectionTest.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp
index 9215725..8062bea 100644
--- a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp
+++ b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp
@@ -45,6 +45,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
connectionFactory = new MockConnectionFactory(eventLoop);
connectFinished = false;
disconnected = false;
+ disconnectedError = false;
dataRead.clear();
}
@@ -56,7 +57,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
void testHeader() {
BOSHConnection::ref testling = createTestling();
- testling->connect(HostAddressPort(HostAddress("127.0.0.1"), 5280));
+ testling->connect();
eventLoop->processEvents();
testling->startStream("wonderland.lit", 1);
std::string initial("<body wait='60' "
@@ -76,7 +77,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
void testReadiness_ok() {
BOSHConnection::ref testling = createTestling();
- testling->connect(HostAddressPort(HostAddress("127.0.0.1"), 5280));
+ testling->connect();
eventLoop->processEvents();
testling->setSID("blahhhhh");
CPPUNIT_ASSERT(testling->isReadyToSend());
@@ -84,7 +85,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
void testReadiness_pending() {
BOSHConnection::ref testling = createTestling();
- testling->connect(HostAddressPort(HostAddress("127.0.0.1"), 5280));
+ testling->connect();
eventLoop->processEvents();
testling->setSID("mySID");
CPPUNIT_ASSERT(testling->isReadyToSend());
@@ -96,7 +97,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
void testReadiness_disconnect() {
BOSHConnection::ref testling = createTestling();
- testling->connect(HostAddressPort(HostAddress("127.0.0.1"), 5280));
+ testling->connect();
eventLoop->processEvents();
testling->setSID("mySID");
CPPUNIT_ASSERT(testling->isReadyToSend());
@@ -107,14 +108,14 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
void testReadiness_noSID() {
BOSHConnection::ref testling = createTestling();
- testling->connect(HostAddressPort(HostAddress("127.0.0.1"), 5280));
+ testling->connect();
eventLoop->processEvents();
CPPUNIT_ASSERT(!testling->isReadyToSend());
}
void testWrite_Receive() {
BOSHConnection::ref testling = createTestling();
- testling->connect(HostAddressPort(HostAddress("127.0.0.1"), 5280));
+ testling->connect();
eventLoop->processEvents();
testling->setSID("mySID");
testling->write(createSafeByteArray("<mypayload/>"));
@@ -125,7 +126,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
void testWrite_ReceiveTwice() {
BOSHConnection::ref testling = createTestling();
- testling->connect(HostAddressPort(HostAddress("127.0.0.1"), 5280));
+ testling->connect();
eventLoop->processEvents();
testling->setSID("mySID");
testling->write(createSafeByteArray("<mypayload/>"));
@@ -139,7 +140,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
void testRead_Fragment() {
BOSHConnection::ref testling = createTestling();
- testling->connect(HostAddressPort(HostAddress("127.0.0.1"), 5280));
+ testling->connect();
eventLoop->processEvents();
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), connectionFactory->connections.size());
boost::shared_ptr<MockConnection> connection = connectionFactory->connections[0];
@@ -198,7 +199,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
connectFinishedWithError = error;
}
- void handleDisconnected(const boost::optional<Connection::Error>& e) {
+ void handleDisconnected(bool e) {
disconnected = true;
disconnectedError = e;
}
@@ -280,7 +281,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture {
bool connectFinished;
bool connectFinishedWithError;
bool disconnected;
- boost::optional<Connection::Error> disconnectedError;
+ bool disconnectedError;
ByteArray dataRead;
PlatformXMLParserFactory parserFactory;
std::string sid;