void UT_CMceStateIdle::UT_CMceStateIdle_AcceptLL() { TMceIds ids; CMceMsgBase* msg = NULL; TMceStateTransitionEvent event1( *iSipSession, EMceItcEstablishSession, ids, *msg ); EUNIT_ASSERT ( iState->AcceptL( event1 ) ); TMceStateTransitionEvent event2( *iSipSession, EMceInvite ); EUNIT_ASSERT ( iState->AcceptL( event2 ) ); TMceStateTransitionEvent event3( *iSipSession, EMceMediaUpdated ); TRAPD( e1, iState->AcceptL( event3 ) ); EUNIT_ASSERT ( e1 == KErrTotalLossOfPrecision ); TMceStateTransitionEvent event4( *iSipSession, EMceItcUpdate, ids, *msg ); TRAPD( e2, iState->AcceptL( event4 ) ); EUNIT_ASSERT ( e2 == KErrTotalLossOfPrecision ); TMceStateTransitionEvent event5( *iSipSession, EMceCancel, KErrNotFound ); TRAPD( e3, iState->AcceptL( event5 ) ); EUNIT_ASSERT ( e3 == KErrTotalLossOfPrecision ); TMceStateTransitionEvent event8( *iSipSession, EMceMediaUpdated ); TRAPD( e6, iState->AcceptL( event8 ) ); EUNIT_ASSERT ( e6 == KErrTotalLossOfPrecision ); }
void ComponentEventTest::testConvertValue() { std::map<std::string, std::string> attributes; attributes["id"] = "1"; attributes["name"] = "DataItemTest1"; attributes["type"] = "ACCELERATION"; attributes["category"] = "SAMPLE"; std::string time("NOW"), value("2.0"); attributes["nativeUnits"] = "REVOLUTION/MINUTE"; DataItem data1 (attributes); ComponentEvent event1(data1, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f, event1.getFValue()); CPPUNIT_ASSERT(event1.getSValue().empty()); attributes["nativeUnits"] = "REVOLUTION/SECOND"; DataItem data2 (attributes); ComponentEvent event2 (data2, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f * 60.0f, event2.getFValue()); CPPUNIT_ASSERT(event2.getSValue().empty()); attributes["nativeUnits"] = "GRAM/INCH"; DataItem data3 (attributes); ComponentEvent event3 (data3, 123, time, value); CPPUNIT_ASSERT_EQUAL((2.0f / 1000.0f) / 25.4f, event3.getFValue()); CPPUNIT_ASSERT(event3.getSValue().empty()); attributes["nativeUnits"] = "MILLIMETER/MINUTE^3"; DataItem data4 (attributes); ComponentEvent event4 (data4, 123, time, value); CPPUNIT_ASSERT_EQUAL((2.0f) / (60.0f * 60.0f * 60.0f), event4.getFValue()); CPPUNIT_ASSERT(event4.getSValue().empty()); attributes["nativeUnits"] = "MILLIMETER/MINUTE^3"; attributes["nativeScale"] = "0.5"; DataItem data5 (attributes); ComponentEvent event5 (data5, 123, time, value); CPPUNIT_ASSERT_EQUAL((2.0f) / (60.0f * 60.0f * 60.0f * 0.5f), event5.getFValue()); CPPUNIT_ASSERT(event5.getSValue().empty()); }
void TestEITFixups::testUKFixups5() { EITFixUp fixup; DBEventEIT event5(7940, "The World at War", "12/26. Whirlwind: Acclaimed documentary series about World War II. This episode focuses on the Allied bombing campaign which inflicted grievous damage upon Germany, both day and night. [S]", QDateTime::fromString("2015-03-03T13:50:00Z", Qt::ISODate), QDateTime::fromString("2015-03-03T14:45:00Z", Qt::ISODate), EITFixUp::kFixGenericDVB | EITFixUp::kFixUK, SUB_UNKNOWN, AUD_STEREO, VID_HDTV | VID_WIDESCREEN | VID_AVC); fixup.Fix(event5); PRINT_EVENT(event5); QCOMPARE(event5.episode, 12u); QCOMPARE(event5.totalepisodes, 26u); QCOMPARE(event5.subtitleType, (unsigned char)SUB_NORMAL); QCOMPARE(event5.subtitle, QString("Whirlwind")); QCOMPARE(event5.description, QString("Acclaimed documentary series about World War II. This episode focuses on the Allied bombing campaign which inflicted grievous damage upon Germany, both day and night.")); }
int main() { EventQueue event = *EventQueue::getInstance(); Event event1("H1"), event2("H2"), event3("H3"), event4("H4"), event5("H5"); event1.time = 0.5; event2.time = 0.6; event3.time = 0.3; event.push(&event1); event.push(&event2); event.push(&event3); //the order now should be 0.3/0.5/0.6 assert(event.pop()->time == 0.3); event4.time = 1; event5.time = 0.1; event.push(&event4); event.push(&event5); //the order should now be 0.1/0.5/0.6/1 assert(event.pop()->time == 0.1); assert(event.pop()->time == 0.5); assert(event.pop()->time == 0.6); assert(event.pop()->time == 1); //if nothing is in the event, return "-1" assert(event.pop()->time == -1); assert(event.pop()->time == -1); printf("Test Success - event queue\n"); return EXIT_SUCCESS; }
void ComponentEventTest::testConvertSimpleUnits() { std::map<std::string, std::string> attributes; attributes["id"] = "1"; attributes["name"] = "DataItemTest1"; attributes["type"] = "ACCELERATION"; attributes["category"] = "SAMPLE"; std::string time("NOW"), value("2.0"); attributes["nativeUnits"] = "INCH"; DataItem data1 (attributes); ComponentEvent event1 (data1, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f * 25.4f, event1.getFValue()); CPPUNIT_ASSERT(event1.getSValue().empty()); attributes["nativeUnits"] = "FOOT"; DataItem data2 (attributes); ComponentEvent event2 (data2, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f * 304.8f, event2.getFValue()); CPPUNIT_ASSERT(event2.getSValue().empty()); attributes["nativeUnits"] = "CENTIMETER"; DataItem data3 (attributes); ComponentEvent event3 (data3, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f * 10.0f, event3.getFValue()); CPPUNIT_ASSERT(event3.getSValue().empty()); attributes["nativeUnits"] = "DECIMETER"; DataItem data4 (attributes); ComponentEvent event4 (data4, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f * 100.0f, event4.getFValue()); CPPUNIT_ASSERT(event4.getSValue().empty()); attributes["nativeUnits"] = "METER"; DataItem data5 (attributes); ComponentEvent event5 (data5, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f * 1000.0f, event5.getFValue()); CPPUNIT_ASSERT(event5.getSValue().empty()); attributes["nativeUnits"] = "FAHRENHEIT"; DataItem data6 (attributes); ComponentEvent event6 (data6, 123, "NOW", "2.0"); CPPUNIT_ASSERT_EQUAL((2.0f - 32.0f) * (5.0f / 9.0f), event6.getFValue()); CPPUNIT_ASSERT(event6.getSValue().empty()); attributes["nativeUnits"] = "POUND"; DataItem data7 (attributes); ComponentEvent event7 (data7, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f * 0.45359237f, event7.getFValue()); CPPUNIT_ASSERT(event7.getSValue().empty()); attributes["nativeUnits"] = "GRAM"; DataItem data8 (attributes); ComponentEvent event8 (data8, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f / 1000.0f, event8.getFValue()); CPPUNIT_ASSERT(event8.getSValue().empty()); attributes["nativeUnits"] = "RADIAN"; DataItem data9 (attributes); ComponentEvent event9 (data9, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f * 57.2957795f, event9.getFValue()); CPPUNIT_ASSERT(event9.getSValue().empty()); attributes["nativeUnits"] = "MINUTE"; DataItem data10 (attributes); ComponentEvent event10 (data10, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f * 60.0f, event10.getFValue()); CPPUNIT_ASSERT(event10.getSValue().empty()); attributes["nativeUnits"] = "HOUR"; DataItem data11 (attributes); ComponentEvent event11 (data11, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f * 3600.0f, event11.getFValue()); CPPUNIT_ASSERT(event11.getSValue().empty()); attributes["nativeUnits"] = "MILLIMETER"; DataItem data12 (attributes); ComponentEvent event12 (data12, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f, event12.getFValue()); CPPUNIT_ASSERT(event12.getSValue().empty()); attributes["nativeUnits"] = "PERCENT"; DataItem data13 (attributes); ComponentEvent event13 (data13, 123, time, value); CPPUNIT_ASSERT_EQUAL(2.0f, event13.getFValue()); CPPUNIT_ASSERT(event13.getSValue().empty()); }
void UT_CMceStateOffering::UT_CMceStateOffering_ExitLL() { CMceMsgBase* msg = NULL; iSipSession->iSubState = CMceSipSession::EOffering; TMceIds ids; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); TMceStateTransitionEvent event1( *iSipSession, EMceMediaUpdated ); iState->ExitL( event1 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateEstablished ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EEstablished ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EOffering; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); TMceStateTransitionEvent event2( *iSipSession, EMceItcCancel, ids, *msg ); iState->ExitL( event2 ); //Ringing Case 1: Not Reliable iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EOffering; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipRinging, SipStrConsts::EPhraseRinging ); TMceStateTransitionEvent event3( *iSipSession, EMceProvisionalResponse ); iState->ExitL( event3 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EOffering ); //Ringing Case 2: Reliable Provisional Response iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EOffering; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); MCETestHelper::SetResponseL( *iSipSession->iResponse, KMceSipRinging, SipStrConsts::EPhraseRinging, EFalse, ETrue, 500); TMceStateTransitionEvent event3_1( *iSipSession, EMceProvisionalResponse ); iState->ExitL( event3_1 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EOffering ); EUNIT_ASSERT ( iSipSession->RSeq() == 500 ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EOffering; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipQueued, SipStrConsts::EEmpty ); TMceStateTransitionEvent event4( *iSipSession, EMceProvisionalResponse ); iState->ExitL( event4 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EOffering ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EOffering; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); TMceStateTransitionEvent event5( *iSipSession, EMceErrorResponse ); iState->ExitL( event5 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateTerminated ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::ETerminated ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EOffering; iSipSession->Dialog()->Dialog().iState = CSIPDialog::ETerminated; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipSessionIntervalTooSmall, SipStrConsts::EPhraseIntervalTooBrief ); TMceStateTransitionEvent event6( *iSipSession, EMceErrorResponse ); iState->ExitL( event6 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EOffering; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipBadRequest, SipStrConsts::EPhraseBadRequest ); TMceStateTransitionEvent event7( *iSipSession, EMceErrorResponse ); iState->ExitL( event7 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateTerminated ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::ETerminated ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EUpdating; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipBadRequest, SipStrConsts::EPhraseBadRequest ); TMceStateTransitionEvent event7_1( *iSipSession, EMceErrorResponse ); iState->ExitL( event7_1 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateEstablished ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EEstablished ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EUpdating; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipCallOrTransactionDoesNotExist, SipStrConsts::EPhraseCallTransactionDoesNotExist ); TMceStateTransitionEvent event7_2( *iSipSession, EMceErrorResponse ); iState->ExitL( event7_2 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateTerminating ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::ETerminating ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EUpdating; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipRequestTimeout, SipStrConsts::EPhraseRequestTimeout ); TMceStateTransitionEvent event7_3( *iSipSession, EMceErrorResponse ); iState->ExitL( event7_3 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateTerminating ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::ETerminating ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EOffering; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EOffering; MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipMovedTemporarily, SipStrConsts::EPhraseOk ); TMceStateTransitionEvent event8( *iSipSession, EMceRedirectionResponse ); iState->ExitL( event8 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EUpdating; TMceStateTransitionEvent event9( *iSipSession, EMceRedirectionResponse ); iState->ExitL( event9 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateServerEstablishing ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EOffering; MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipMultipleChoices, SipStrConsts::EPhraseOk ); TMceStateTransitionEvent event10( *iSipSession, EMceRedirectionResponse ); iState->ExitL( event10 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateTerminated ); iSipSession->NextState( KMceStateOffering ); iSipSession->iSubState = CMceSipSession::EAnswering; TMceStateTransitionEvent event11( *iSipSession, EMceRedirectionResponse ); iState->ExitL( event11 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); // Hanlding of Extension Request / Response does not change the session state //EMceItcReplySend TMceStateTransitionEvent event12( *iSipSession, EMceItcReplySend, ids, *msg ); iState->ExitL( event12 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); //EMceRequest TMceStateTransitionEvent event13( *iSipSession, EMceRequest ); iState->ExitL( event13 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); //EMceProvisionalResponse CSIPClientTransaction* clitransaction = MCETestHelper::ClientTransactionLC( SipStrConsts::EInfo, KMceSipSessionProgress, SipStrConsts::EPhraseSessionProgress, ETrue ); iSipSession->SetPendingTransactionL( clitransaction ); CleanupStack::Pop( clitransaction ); iSipSession->iResponse = clitransaction; TMceStateTransitionEvent event14( *iSipSession, EMceProvisionalResponse ); iState->ExitL( event14 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); //EMceResponse CSIPClientTransaction* clitransaction1 = MCETestHelper::ClientTransactionLC( SipStrConsts::EInfo, KMceSipOK, SipStrConsts::EPhraseOk, ETrue ); iSipSession->SetPendingTransactionL( clitransaction1 ); CleanupStack::Pop( clitransaction1 ); iSipSession->iResponse = clitransaction1; TMceStateTransitionEvent event15( *iSipSession, EMceResponse ); iState->ExitL( event15 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); //EMceRedirectionResponse CSIPClientTransaction* clitransaction2 = MCETestHelper::ClientTransactionLC( SipStrConsts::EInfo, KMceSipMovedTemporarily, SipStrConsts::EPhraseOk, ETrue ); iSipSession->SetPendingTransactionL( clitransaction2 ); CleanupStack::Pop( clitransaction2 ); iSipSession->iResponse = clitransaction2; TMceStateTransitionEvent event16( *iSipSession, EMceRedirectionResponse ); iState->ExitL( event16 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); //EMceErrorResponse CSIPClientTransaction* clitransaction3 = MCETestHelper::ClientTransactionLC( SipStrConsts::EInfo, KMceSipBadExtension, SipStrConsts::EPhraseBadExtension, ETrue ); iSipSession->SetPendingTransactionL( clitransaction3 ); CleanupStack::Pop( clitransaction3 ); iSipSession->iResponse = clitransaction3; TMceStateTransitionEvent event17( *iSipSession, EMceErrorResponse ); iState->ExitL( event17 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); //EMceMediaUpdated, IMS flow TMceStateTransitionEvent event1_1( *iSipSession, EMceMediaUpdated ); CSIPClientTransaction* response = &iSipSession->Response(); CSIPCSeqHeader* cSeqHeader = CSIPCSeqHeader::DecodeL( _L8("1 UPDATE") ); CSIPMessageElements* messageElements = const_cast<CSIPMessageElements*>( &response->ResponseElements()->MessageElements() ); messageElements->AddHeaderL( cSeqHeader ); iState->ExitL( event1_1 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); }
void UT_CMceStateOffering::UT_CMceStateOffering_AcceptLL() { TMceIds ids; CMceMsgBase* msg = NULL; TMceStateTransitionEvent event0( *iSipSession, EMceUpdate ); EUNIT_ASSERT ( iState->AcceptL( event0 ) ); TMceStateTransitionEvent event1( *iSipSession, EMceItcCancel, ids, *msg ); EUNIT_ASSERT ( iState->AcceptL( event1 ) ); TMceStateTransitionEvent event2( *iSipSession, EMceResponse ); EUNIT_ASSERT ( iState->AcceptL( event2 ) ); TMceStateTransitionEvent event3( *iSipSession, EMceProvisionalResponse ); EUNIT_ASSERT ( iState->AcceptL( event3 ) ); TMceStateTransitionEvent event4( *iSipSession, EMceErrorResponse ); EUNIT_ASSERT ( iState->AcceptL( event4 ) ); TMceStateTransitionEvent event5( *iSipSession, EMceMediaUpdated ); EUNIT_ASSERT ( iState->AcceptL( event5 ) ); TMceStateTransitionEvent event6( *iSipSession, EMceRedirectionResponse ); EUNIT_ASSERT ( iState->AcceptL( event6 ) ); TMceStateTransitionEvent event7( *iSipSession, EMceMediaSessionStopped ); TRAPD( e1, iState->AcceptL( event7 ) ); EUNIT_ASSERT ( e1 == KErrTotalLossOfPrecision ); // Following Events will be accepted for Extenssion Requests CSIPClientTransaction* clitransaction2 = MCETestHelper::ClientTransactionLC( SipStrConsts::EInfo, KMceSipSessionProgress, SipStrConsts::EPhraseSessionProgress, ETrue ); iSipSession->SetPendingTransactionL( clitransaction2 ); CleanupStack::Pop( clitransaction2 ); iSipSession->iResponse = clitransaction2; TMceStateTransitionEvent event2a( *iSipSession, EMceResponse ); TRAPD( e2a, iState->AcceptL( event2a ) ); EUNIT_ASSERT ( e2a == KErrNone ); TMceStateTransitionEvent event2b( *iSipSession, EMceProvisionalResponse ); TRAPD( e2b, iState->AcceptL( event2b ) ); EUNIT_ASSERT ( e2b == KErrNone ); TMceStateTransitionEvent event2c( *iSipSession, EMceRedirectionResponse ); TRAPD( e2c, iState->AcceptL( event2c ) ); EUNIT_ASSERT ( e2c == KErrNone ); TMceStateTransitionEvent event2d( *iSipSession, EMceErrorResponse ); TRAPD( e2d, iState->AcceptL( event2d ) ); EUNIT_ASSERT ( e2d == KErrNone ); TMceStateTransitionEvent event2e( *iSipSession, EMceItcReplySend, ids, *msg ); TRAPD( e2e, iState->AcceptL( event2e ) ); EUNIT_ASSERT ( e2e == KErrNone ); TMceStateTransitionEvent event2f( *iSipSession, EMceRequest ); TRAPD( e2f, iState->AcceptL( event2f ) ); EUNIT_ASSERT ( e2f == KErrNone ); }
void UT_CMceStateServerEstablishing::UT_CMceStateServerEstablishing_ExitLL() { CMceMsgBase* msg = NULL; iSipSession->iBody = CMceComSession::NewL( CMceComSession::EInSession ); iSipSession->iSubState = CMceSipSession::EAnswering; TMceIds ids; EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateServerEstablishing ); ids.iState = KMceNotAssigned; TMceStateTransitionEvent event1( *iSipSession, EMceItcUpdate, ids, *msg ); iSipSession->iSubState = CMceSipSession::EAnswering; event1.ParamStatus() = KMceReady; iState->ExitL( event1 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateUpdated ); EUNIT_ASSERT ( ids.iState == CMceSession::EReserving ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EProceeding ); TMceStateTransitionEvent event1_2( *iSipSession, EMceItcUpdate, ids, *msg ); iSipSession->iSubState = CMceSipSession::EUpdating; event1.ParamStatus() = KMceReady; iState->ExitL( event1_2 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateAnswering ); EUNIT_ASSERT ( ids.iState == CMceSession::EAnswering ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EAnswering ); TMceStateTransitionEvent event1_3( *iSipSession, EMceItcUpdate, ids, *msg ); iSipSession->iSubState = CMceSipSession::EUpdating; event1.ParamStatus() = KMceReady; CSIPServerTransaction* update = MCETestHelper::ServerTransactionL( SipStrConsts::EUpdate ); CleanupStack::PushL( update ); iSipSession->iPendingReceivedRequests.AppendL( update ); CleanupStack::Pop( update ); iState->ExitL( event1_3 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateEstablished ); EUNIT_ASSERT ( ids.iState == CMceSession::EEstablished ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EEstablished ); delete iSipSession->PopRequest(); ids.iState = KMceNotAssigned; TMceStateTransitionEvent event2( *iSipSession, EMceItcUpdate, ids, *msg ); iSipSession->iSubState = CMceSipSession::EAnswering; event2.ParamStatus() = KMceAsync; iState->ExitL( event2 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateUpdating ); EUNIT_ASSERT ( ids.iState == CMceSession::EReserving ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EReserving ); ids.iState = KMceNotAssigned; TMceStateTransitionEvent event3( *iSipSession, EMceItcUpdate, ids, *msg ); iSipSession->iSubState = CMceSipSession::EUpdating; event3.ParamStatus() = KErrGeneral; iState->ExitL( event3 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateEstablished ); EUNIT_ASSERT ( ids.iState == CMceSession::EEstablished ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EEstablished ); ids.iState = KMceNotAssigned; TMceStateTransitionEvent event4( *iSipSession, EMceItcRejectSession, ids ); iSipSession->iSubState = CMceSipSession::EAnswering; iState->ExitL( event4 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateTerminated ); EUNIT_ASSERT ( ids.iState == CMceSession::ETerminated ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::ETerminated ); ids.iState = KMceNotAssigned; TMceStateTransitionEvent event5( *iSipSession, EMceItcRejectSession, ids ); iSipSession->iSubState = CMceSipSession::EUpdating; iState->ExitL( event5 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateEstablished ); EUNIT_ASSERT ( ids.iState == CMceSession::EEstablished ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EEstablished ); TMceStateTransitionEvent event6( *iSipSession, EMceItcRing, ids ); iState->ExitL( event6 ); }
void UT_CMceStateServerEstablishing::UT_CMceStateServerEstablishing_EntryLL() { CSIPServerTransaction* invite = MCETestHelper::ServerTransactionL( SipStrConsts::EInvite ); CleanupStack::PushL( invite ); iSipSession->iPendingReceivedRequests.AppendL( invite ); CleanupStack::Pop( invite ); TMceIds ids; CMceMsgBase* msg = NULL; iSipSession->iBody = CMceComSession::NewL( CMceComSession::EInSession ); iSipSession->iBody->iID = 1; iSipSession->iNewBodyCandidate = CMceComSession::NewL( CMceComSession::EInSession ); iSipSession->iNewBodyCandidate->iID = 1; ids.iAppUID = 10; ids.iSessionID = 1; CMceComSession* clientSession = CMceComSession::NewL( CMceComSession::EInSession ); clientSession->iID = 1; ids.iSessionID = clientSession->iID; CleanupStack::PushL( clientSession ); CMceMsgObject<CMceComSession>* clientSessionMsg = new (ELeave) CMceMsgObject<CMceComSession>( *clientSession, EMceItcMsgTypeSession ); CleanupStack::Pop( clientSession ); clientSessionMsg->PushL(); CleanupStack::PushL( clientSessionMsg ); iSipSession->iSubState = CMceSipSession::EAnswering; MCE_RESET_STUBS(); iStorage->iMediaManagerUpdateStatus = KMceAsync; delete iStorage->iSipSentResponse; iStorage->iSipSentResponse = NULL; TMceStateTransitionEvent event1( *iSipSession, EMceItcUpdate, ids, *clientSessionMsg ); iState->EntryL( event1 ); MCE_ENTRYL_POSTCONDITION MCE_ASSERT_STUBS( CMCETls::EUpdate /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/); EUNIT_ASSERT ( event1.Code() == EMceItcUpdate ); EUNIT_ASSERT ( event1.ParamStatus() == KMceAsync ); MCE_RESET_STUBS(); CleanupStack::PopAndDestroy( clientSessionMsg ); // --- clientSession = CMceComSession::NewL( CMceComSession::EInSession ); clientSession->iID = 1; ids.iSessionID = clientSession->iID; CleanupStack::PushL( clientSession ); clientSessionMsg = new (ELeave) CMceMsgObject<CMceComSession>( *clientSession, EMceItcMsgTypeSession ); CleanupStack::Pop( clientSession ); clientSessionMsg->PushL(); CleanupStack::PushL( clientSessionMsg ); iSipSession->iSubState = CMceSipSession::EAnswering; iStorage->iMediaManagerUpdateStatus = KErrGeneral; delete iStorage->iSipSentResponse; iStorage->iSipSentResponse = NULL; TMceStateTransitionEvent event2( *iSipSession, EMceItcUpdate, ids, *clientSessionMsg ); iState->EntryL( event2 ); MCE_ENTRYL_POSTCONDITION_2( KMceSipServerInternalError ) MCE_ASSERT_STUBS( CMCETls::ECloseSession /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KMceSipServerInternalError /*sentResponse*/); EUNIT_ASSERT ( event2.Code() == EMceItcRejectSession ); EUNIT_ASSERT ( event2.ParamStatus() == KErrGeneral ); MCE_RESET_STUBS(); CleanupStack::PopAndDestroy( clientSessionMsg ); // --- clientSession = CMceComSession::NewL( CMceComSession::EInSession ); clientSession->iID = 1000;//wrong ids.iSessionID = clientSession->iID; CleanupStack::PushL( clientSession ); clientSessionMsg = new (ELeave) CMceMsgObject<CMceComSession>( *clientSession, EMceItcMsgTypeSession ); CleanupStack::Pop( clientSession ); clientSessionMsg->PushL(); CleanupStack::PushL( clientSessionMsg ); iSipSession->iSubState = CMceSipSession::EAnswering; iStorage->iMediaManagerUpdateStatus = KMceAsync; delete iStorage->iSipSentResponse; iStorage->iSipSentResponse = NULL; TMceStateTransitionEvent event2_1( *iSipSession, EMceItcUpdate, ids, *clientSessionMsg ); MCE_EUNIT_ASSERT_LEAVE( iState->EntryL( event2_1 ) ); MCE_RESET_STUBS(); CleanupStack::PopAndDestroy( clientSessionMsg ); // --- clientSession = CMceComSession::NewL( CMceComSession::EInSession ); clientSession->iID = 1; ids.iSessionID = clientSession->iID; CleanupStack::PushL( clientSession ); clientSessionMsg = new (ELeave) CMceMsgObject<CMceComSession>( *clientSession, EMceItcMsgTypeSession ); CleanupStack::Pop( clientSession ); clientSessionMsg->PushL(); CleanupStack::PushL( clientSessionMsg ); iSipSession->iSubState = CMceSipSession::EUpdating; iStorage->iMediaManagerUpdateStatus = KMceAsync; delete iStorage->iSipSentResponse; iStorage->iSipSentResponse = NULL; TMceStateTransitionEvent event3( *iSipSession, EMceItcUpdate, ids, *clientSessionMsg ); iState->EntryL( event3 ); MCE_ENTRYL_POSTCONDITION MCE_ASSERT_STUBS( CMCETls::EUpdate /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/); EUNIT_ASSERT ( iStorage->iSipSentResponse == NULL ); EUNIT_ASSERT ( event3.Code() == EMceItcUpdate ); EUNIT_ASSERT ( event3.ParamStatus() == KMceAsync ); MCE_RESET_STUBS(); CleanupStack::PopAndDestroy( clientSessionMsg ); // --- // EMceItcUpdate, update ready, directly 200 clientSession = CMceComSession::NewL( CMceComSession::EInSession ); clientSession->iID = 1; ids.iSessionID = clientSession->iID; CleanupStack::PushL( clientSession ); clientSessionMsg = new (ELeave) CMceMsgObject<CMceComSession>( *clientSession, EMceItcMsgTypeSession ); CleanupStack::Pop( clientSession ); clientSessionMsg->PushL(); CleanupStack::PushL( clientSessionMsg ); iSipSession->iSubState = CMceSipSession::EUpdating; iStorage->iMediaManagerUpdateStatus = KMceReady; iStorage->iMediaManagerNeedToNegotiate = EFalse; delete iStorage->iSipSentResponse; iStorage->iSipSentResponse = NULL; TMceStateTransitionEvent event4( *iSipSession, EMceItcUpdate, ids, *clientSessionMsg ); iState->EntryL( event4 ); MCE_ENTRYL_POSTCONDITION_2( KMceSipOK ) MCE_ASSERT_STUBS( CMCETls::ECloseSession /*mmaction*/, CMCETls::EEncode /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KMceSipOK /*sentResponse*/); EUNIT_ASSERT ( event4.Code() == EMceItcUpdate ); EUNIT_ASSERT ( event4.ParamStatus() == KMceReady ); EUNIT_ASSERT ( iSipSession->BodyCandidate() == NULL ); MCE_RESET_STUBS(); CleanupStack::PopAndDestroy( clientSessionMsg ); iSipSession->iNewBodyCandidate = CMceComSession::NewL( CMceComSession::EInSession ); iSipSession->iNewBodyCandidate->iID = 1; // --- // EMceItcUpdate, update ready, need 183 clientSession = CMceComSession::NewL( CMceComSession::EInSession ); clientSession->iID = 1; ids.iSessionID = clientSession->iID; CleanupStack::PushL( clientSession ); clientSessionMsg = new (ELeave) CMceMsgObject<CMceComSession>( *clientSession, EMceItcMsgTypeSession ); CleanupStack::Pop( clientSession ); clientSessionMsg->PushL(); CleanupStack::PushL( clientSessionMsg ); iSipSession->iSubState = CMceSipSession::EUpdating; iStorage->iMediaManagerUpdateStatus = KMceReady; iStorage->iMediaManagerNeedToNegotiate = ETrue; delete iStorage->iSipSentResponse; iStorage->iSipSentResponse = NULL; iSipSession->Extensions().SetRemote( CMceSipExtensions::E100rel, CMceSipExtensions::ESupported ); TMceStateTransitionEvent event4_2( *iSipSession, EMceItcUpdate, ids, *clientSessionMsg ); iState->EntryL( event4_2 ); MCE_ENTRYL_POSTCONDITION_2( KMceSipSessionProgress ) MCE_ASSERT_STUBS( CMCETls::EUpdate /*mmaction*/, CMCETls::EEncode /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KMceSipSessionProgress /*sentResponse*/); EUNIT_ASSERT ( event4_2.Code() == EMceItcUpdate ); EUNIT_ASSERT ( event4_2.ParamStatus() == KMceReady ); EUNIT_ASSERT ( iSipSession->BodyCandidate() != NULL ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateAcknowledgementRequired ); MCE_RESET_STUBS(); CleanupStack::PopAndDestroy( clientSessionMsg ); MCE_DELETE( iSipSession->iNewBodyCandidate ); iSipSession->iNewBodyCandidate = CMceComSession::NewL( CMceComSession::EInSession ); iSipSession->iNewBodyCandidate->iID = 1; // --- clientSession = CMceComSession::NewL( CMceComSession::EInSession ); clientSession->iID = 1; ids.iSessionID = clientSession->iID; CleanupStack::PushL( clientSession ); clientSessionMsg = new (ELeave) CMceMsgObject<CMceComSession>( *clientSession, EMceItcMsgTypeSession ); CleanupStack::Pop( clientSession ); clientSessionMsg->PushL(); CleanupStack::PushL( clientSessionMsg ); iSipSession->iSubState = CMceSipSession::EUpdating; iStorage->iMediaManagerUpdateStatus = KErrGeneral; delete iStorage->iSipSentResponse; iStorage->iSipSentResponse = NULL; TMceStateTransitionEvent event5( *iSipSession, EMceItcUpdate, ids, *clientSessionMsg ); iState->EntryL( event5 ); MCE_ENTRYL_POSTCONDITION_2( KMceSipServerInternalError ) MCE_ASSERT_STUBS( CMCETls::ECloseSession /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KMceSipServerInternalError /*sentResponse*/); EUNIT_ASSERT ( event5.Code() == EMceItcUpdate ); EUNIT_ASSERT ( event5.ParamStatus() == KErrGeneral ); EUNIT_ASSERT ( iSipSession->BodyCandidate() == NULL ); MCE_RESET_STUBS(); CleanupStack::PopAndDestroy( clientSessionMsg ); iSipSession->iNewBodyCandidate = CMceComSession::NewL( CMceComSession::EInSession ); iSipSession->iNewBodyCandidate->iID = 1; // --- clientSession = CMceComSession::NewL( CMceComSession::EInSession ); clientSession->iID = 1000;//wrong ids.iSessionID = clientSession->iID; CleanupStack::PushL( clientSession ); clientSessionMsg = new (ELeave) CMceMsgObject<CMceComSession>( *clientSession, EMceItcMsgTypeSession ); CleanupStack::Pop( clientSession ); clientSessionMsg->PushL(); CleanupStack::PushL( clientSessionMsg ); iSipSession->iSubState = CMceSipSession::EUpdating; iStorage->iMediaManagerUpdateStatus = KMceAsync; delete iStorage->iSipSentResponse; iStorage->iSipSentResponse = NULL; TMceStateTransitionEvent event5_1( *iSipSession, EMceItcUpdate, ids, *clientSessionMsg ); MCE_EUNIT_ASSERT_LEAVE( iState->EntryL( event5_1 ) ); MCE_RESET_STUBS(); CleanupStack::PopAndDestroy( clientSessionMsg ); // --- reject iSipSession->iSubState = CMceSipSession::EOffering; iStorage->iMediaManagerAction = CMCETls::ENone; iStorage->iSipSentMethod = SIPStrings::StringF( SipStrConsts::EEmpty ); delete iStorage->iSipSentResponse; iStorage->iSipSentResponse = NULL; TMceStateTransitionEvent event6( *iSipSession, EMceItcRejectSession, ids ); iState->EntryL( event6 ); MCE_ASSERT_STUBS( CMCETls::ECloseSession /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KMceSipDecline /*sentResponse*/); EUNIT_ASSERT ( event6.Code() == EMceItcRejectSession ); EUNIT_ASSERT ( event6.ParamStatus() == KErrNone ); MCE_RESET_STUBS(); // --- reject iSipSession->iSubState = CMceSipSession::EUpdating; iStorage->iMediaManagerAction = CMCETls::ENone; iStorage->iSipSentMethod = SIPStrings::StringF( SipStrConsts::EEmpty ); delete iStorage->iSipSentResponse; iStorage->iSipSentResponse = NULL; TMceStateTransitionEvent event7( *iSipSession, EMceItcRejectSession, ids ); iState->EntryL( event7 ); MCE_ASSERT_STUBS( CMCETls::ECloseSession /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KMceSipDecline /*sentResponse*/); EUNIT_ASSERT ( event7.Code() == EMceItcRejectSession ); EUNIT_ASSERT ( event7.ParamStatus() == KErrNone ); // --- default TMceStateTransitionEvent event8( *iSipSession, EMceItcRing, ids ); iState->EntryL( event8 ); MCE_RESET_STUBS(); // --- Enable & disable MCE_ASSERT_ENDPOINT_ENABLE_AND_DISABLE(); }