summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-09-03 18:40:34 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-09-03 18:40:50 (GMT)
commitfde15d66a75334b23ca8bbd56b44e33893c813c4 (patch)
treea0d94a612ed82b8c06a0e48dfa6ae5369089258c /Swiften/Client/UnitTest
parentbc3b2a2e7a70e597390a464ed19a564512f96e69 (diff)
downloadswift-contrib-fde15d66a75334b23ca8bbd56b44e33893c813c4.zip
swift-contrib-fde15d66a75334b23ca8bbd56b44e33893c813c4.tar.bz2
Establish stream management after resource bind.
Diffstat (limited to 'Swiften/Client/UnitTest')
-rw-r--r--Swiften/Client/UnitTest/ClientSessionTest.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/Swiften/Client/UnitTest/ClientSessionTest.cpp b/Swiften/Client/UnitTest/ClientSessionTest.cpp
index e27f130..2762188 100644
--- a/Swiften/Client/UnitTest/ClientSessionTest.cpp
+++ b/Swiften/Client/UnitTest/ClientSessionTest.cpp
@@ -182,12 +182,14 @@ class ClientSessionTest : public CppUnit::TestFixture {
server->receiveStreamStart();
server->sendStreamStart();
server->sendStreamFeaturesWithBindAndStreamManagement();
+ server->receiveBind();
+ server->sendBindResult();
server->receiveStreamManagementEnable();
server->sendStreamManagementEnabled();
CPPUNIT_ASSERT(session->getStreamManagementEnabled());
- server->receiveBind();
// TODO: Test if the requesters & responders do their work
+ CPPUNIT_ASSERT_EQUAL(ClientSession::Initialized, session->getState());
}
void testStreamManagement_Failed() {
@@ -202,11 +204,13 @@ class ClientSessionTest : public CppUnit::TestFixture {
server->receiveStreamStart();
server->sendStreamStart();
server->sendStreamFeaturesWithBindAndStreamManagement();
+ server->receiveBind();
+ server->sendBindResult();
server->receiveStreamManagementEnable();
server->sendStreamManagementFailed();
CPPUNIT_ASSERT(!session->getStreamManagementEnabled());
- server->receiveBind();
+ CPPUNIT_ASSERT_EQUAL(ClientSession::Initialized, session->getState());
}
@@ -347,6 +351,13 @@ class ClientSessionTest : public CppUnit::TestFixture {
onElementReceived(boost::shared_ptr<StreamManagementFailed>(new StreamManagementFailed()));
}
+ void sendBindResult() {
+ boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind());
+ resourceBind->setJID(JID("foo@bar.com/bla"));
+ boost::shared_ptr<IQ> iq = IQ::createResult(JID("foo@bar.com"), bindID, resourceBind);
+ onElementReceived(iq);
+ }
+
void receiveStreamStart() {
Event event = popEvent();
CPPUNIT_ASSERT(event.header);
@@ -378,6 +389,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(event.element);
CPPUNIT_ASSERT(iq);
CPPUNIT_ASSERT(iq->getPayload<ResourceBind>());
+ bindID = iq->getID();
}
Event popEvent() {
@@ -392,6 +404,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
bool tlsEncrypted;
bool compressed;
bool whitespacePingEnabled;
+ String bindID;
int resetCount;
std::deque<Event> receivedEvents;
};