diff options
Diffstat (limited to 'Swiften/Client/UnitTest')
| -rw-r--r-- | Swiften/Client/UnitTest/ClientSessionTest.cpp | 18 | 
1 files changed, 18 insertions, 0 deletions
| diff --git a/Swiften/Client/UnitTest/ClientSessionTest.cpp b/Swiften/Client/UnitTest/ClientSessionTest.cpp index 74f3376..dbed9aa 100644 --- a/Swiften/Client/UnitTest/ClientSessionTest.cpp +++ b/Swiften/Client/UnitTest/ClientSessionTest.cpp @@ -9,11 +9,13 @@  #include <deque>  #include <boost/bind.hpp>  #include <boost/optional.hpp> +#include <boost/smart_ptr/make_shared.hpp>  #include "Swiften/Session/SessionStream.h"  #include "Swiften/Client/ClientSession.h"  #include "Swiften/Elements/StartTLSRequest.h"  #include "Swiften/Elements/StreamFeatures.h" +#include "Swiften/Elements/StreamError.h"  #include "Swiften/Elements/TLSProceed.h"  #include "Swiften/Elements/StartTLSFailure.h"  #include "Swiften/Elements/AuthRequest.h" @@ -32,6 +34,7 @@ using namespace Swift;  class ClientSessionTest : public CppUnit::TestFixture {  		CPPUNIT_TEST_SUITE(ClientSessionTest);  		CPPUNIT_TEST(testStart_Error); +		CPPUNIT_TEST(testStart_StreamError);  		CPPUNIT_TEST(testStartTLS);  		CPPUNIT_TEST(testStartTLS_ServerError);  		CPPUNIT_TEST(testStartTLS_ConnectError); @@ -77,6 +80,17 @@ class ClientSessionTest : public CppUnit::TestFixture {  			CPPUNIT_ASSERT(sessionFinishedError);  		} +		void testStart_StreamError() { +			boost::shared_ptr<ClientSession> session(createSession()); +			session->start(); +			server->sendStreamStart(); +			server->sendStreamError(); + +			CPPUNIT_ASSERT_EQUAL(ClientSession::Finished, session->getState()); +			CPPUNIT_ASSERT(sessionFinishedReceived); +			CPPUNIT_ASSERT(sessionFinishedError); +		} +  		void testStartTLS() {  			boost::shared_ptr<ClientSession> session(createSession());  			session->setCertificateTrustChecker(blindCertificateTrustChecker); @@ -351,6 +365,10 @@ class ClientSessionTest : public CppUnit::TestFixture {  					onElementReceived(streamFeatures);  				} +				void sendStreamError() { +					onElementReceived(boost::make_shared<StreamError>()); +				} +  				void sendTLSProceed() {  					onElementReceived(boost::shared_ptr<TLSProceed>(new TLSProceed()));  				} | 
 Swift
 Swift