void UT_CMceStateError::UT_CMceStateError_AcceptLL() { TMceIds ids; CMceMsgBase* msg = NULL; TMceStateTransitionEvent event1( *iSipSession, EMceItcEstablishSession, ids, *msg ); TRAPD( error, iState->AcceptL( event1 ) ); EUNIT_ASSERT ( error != KErrNone ); TMceStateTransitionEvent event2( *iSipSession, EMceAck ); EUNIT_ASSERT ( iState->AcceptL( event2 ) ); TMceStateTransitionEvent event3( *iSipSession, EMceMediaSessionStopped ); EUNIT_ASSERT ( iState->AcceptL( event3 ) ); //state terminated tests iSipSession->NextState( KMceStateTerminated ); CMceStateTerminated* stateTerminated = static_cast<CMceStateTerminated*>(&iSipSession->CurrentState()); TMceStateTransitionEvent event4( *iSipSession, EMceItcEstablishSession, ids, *msg ); TRAPD( error1, stateTerminated->AcceptL( event4 ) ); EUNIT_ASSERT ( error1 != KErrNone ); }
void control::event2() { setA(false); setC(true); qDebug() << "Plastic Bottling Size Reached"; qDebug() << "Molding Bottle"; QTimer::singleShot(500, this, SLOT(event3())); }
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 ); }
/*! * Test style in preedit mode. */ void Ut_MRichTextEdit::testStyleOnPreedit() { QString htmlText = "<b>bold </b><i>italic </i>"; m_subject->document()->setHtml(htmlText); QString text("preedit mode text"); QInputMethodEvent event1(text, QList<QInputMethodEvent::Attribute>()); m_subject->inputMethodEvent(&event1); QFont curFont = m_subject->currentFont(); bool curItalicStyle = curFont.italic(); QCOMPARE(curItalicStyle, true); event1.setCommitString("Test preedit style"); m_subject->inputMethodEvent(&event1); curFont = m_subject->currentFont(); curItalicStyle = curFont.italic(); QCOMPARE(curItalicStyle, true); m_subject->setText("text"); text = QString("preedit mode"); QInputMethodEvent event2(text, QList<QInputMethodEvent::Attribute>()); int eventCursorPosition = 1; QGraphicsSceneMouseEvent *mouseEvent = new QGraphicsSceneMouseEvent(); m_subject->handleMouseRelease(eventCursorPosition, mouseEvent); m_subject->setFontUnderline(true); m_subject->inputMethodEvent(&event2); text = QString("a"); QInputMethodEvent event3(text, QList<QInputMethodEvent::Attribute>()); m_subject->inputMethodEvent(&event3); curFont = m_subject->currentFont(); bool curUnderlineStyle = curFont.underline(); QCOMPARE(curUnderlineStyle, true); m_subject->setText("text"); text = QString("preedit mode"); QInputMethodEvent event4(text, QList<QInputMethodEvent::Attribute>()); m_subject->handleMouseRelease(eventCursorPosition, mouseEvent); m_subject->setFontUnderline(true); m_subject->inputMethodEvent(&event4); event4.setCommitString(" "); m_subject->inputMethodEvent(&event4); QTextCursor cursor = m_subject->textCursor(); cursor.setPosition(0); curFont = m_subject->currentFont(); curUnderlineStyle = curFont.underline(); QCOMPARE(curUnderlineStyle, true); delete mouseEvent; mouseEvent = 0; }
void EventSender::contextClick() { QMouseEvent event(QEvent::MouseButtonPress, m_mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier); QApplication::sendEvent(m_page, &event); QMouseEvent event2(QEvent::MouseButtonRelease, m_mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier); QApplication::sendEvent(m_page, &event2); QContextMenuEvent event3(QContextMenuEvent::Mouse, m_mousePos); QApplication::sendEvent(m_page->view(), &event3); }
//Begin ClientCode int main(int argc, char ** argv) { #ifdef CSEC_VERIFY assume_string("clientID"); assume_string("serverID"); assume_string("port_ascii"); // Assumption that the corresponding argv fields indeed contains the correct ids: readenvL(argv[1], strlen(argv[1]), "clientID"); readenvL(argv[2], strlen(argv[2]), "serverID"); readenvL(argv[3], strlen(argv[3]), "port_ascii"); #endif RPCstate clState; clState.end = CLIENT; if (parseargs(argc,argv,&clState)) { #ifdef VERBOSE fprintf(stdout, "Usage: client clientAddress serverAddress [port] request\n"); #endif exit(-1); } #ifdef VERBOSE printf("Client: Now connecting to "); print_text_buffer(clState.other,clState.other_len); printf(", port %d.\n", clState.port); fflush(stdout); #endif // Getting arguments if (socket_connect(&(clState.conn_fd),(char*) clState.other, clState.other_len, clState.port)) return -1; clState.k_ab = get_shared_key(clState.self, clState.self_len, clState.other, clState.other_len, &(clState.k_ab_len)); clState.k = mk_session_key(&(clState.k_len)); clState.response = NULL; #ifdef CSEC_VERIFY event3("client_begin", clState.self, clState.self_len, clState.other, clState.other_len, clState.request, clState.request_len); #endif /* Send request */ if (send_request(&clState) < 0) return -1; /* Receive response */ if (recv_response(&clState) < 0) return -1; #ifdef CSEC_VERIFY event4("client_accept", clState.self, clState.self_len, clState.other, clState.other_len, clState.request, clState.request_len, clState.response, clState.response_len); #endif return 0; }
void TestEITFixups::testHTMLFixup() { // Make sure we correctly strip HTML tags from EIT data EITFixUp fixup; DBEventEIT event(9311, "<EM>CSI: Crime Scene Investigation</EM>", "Double-Cross: Las Vegas-based forensic drama. The team investigates when two nuns find a woman crucified in the rafters of their church - and clues implicate the priest. (S7 Ep 5)", QDateTime::fromString("2015-02-28T19:40:00Z", Qt::ISODate), QDateTime::fromString("2015-02-28T20:00:00Z", Qt::ISODate), EITFixUp::kFixHTML | EITFixUp::kFixUK, SUB_UNKNOWN, AUD_STEREO, VID_UNKNOWN); fixup.Fix(event); PRINT_EVENT(event); QCOMPARE(event.title, QString("CSI: Crime Scene Investigation")); QCOMPARE(event.subtitle, QString("Double-Cross")); // FIXME: Need to fix the capturing of (S7 Ep 5) for this to properly validate. // QCOMPARE(event.description, QString("Las Vegas-based forensic drama. The team investigates when two nuns find a woman crucified in the rafters of their church - and clues implicate the priest.")); DBEventEIT event2(9311, "<EM>New: Redneck Island</EM>", "Twelve rednecks are stranded on a tropical island with 'Stone Cold' Steve Austin, but this is no holiday, they're here to compete for $100,000. S4, Ep4", QDateTime::fromString("2015-02-28T19:40:00Z", Qt::ISODate), QDateTime::fromString("2015-02-28T20:00:00Z", Qt::ISODate), EITFixUp::kFixHTML | EITFixUp::kFixUK, SUB_UNKNOWN, AUD_STEREO, VID_UNKNOWN); fixup.Fix(event2); PRINT_EVENT(event2); QCOMPARE(event2.title, QString("Redneck Island")); DBEventEIT event3(14101, "New: Jericho", "Drama set in 1870s Yorkshire. In her desperation to protect her son, Annie unwittingly opens the door for Bamford the railway detective, who has returned to Jericho. [AD,S]", QDateTime::fromString("2015-02-28T19:40:00Z", Qt::ISODate), QDateTime::fromString("2015-02-28T20:00:00Z", Qt::ISODate), EITFixUp::kFixHTML | EITFixUp::kFixUK, SUB_UNKNOWN, AUD_STEREO, VID_UNKNOWN); fixup.Fix(event3); PRINT_EVENT(event3); QCOMPARE(event3.title, QString("Jericho")); QCOMPARE(event3.description, QString("Drama set in 1870s Yorkshire. In her desperation to protect her son, Annie unwittingly opens the door for Bamford the railway detective, who has returned to Jericho.")); }
void UT_CMceStateIdle::UT_CMceStateIdle_ExitLL() { TMceIds ids; CMceMsgBase* msg = NULL; iSipSession->iBody = CMceComSession::NewL( CMceComSession::EOutSession ); TMceStateTransitionEvent event1( *iSipSession, EMceItcEstablishSession, ids, *msg ); event1.ParamStatus() = KMceAsync; iState->ExitL( event1 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateClientEstablishing ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EOffering ); EUNIT_ASSERT ( ids.iState == CMceSession::EOffering ); MCE_SET_STATES( iSipSession /*session*/, CMceSession::EIdle /*clientState*/, KMceStateIdle /*serverState*/ ); TMceStateTransitionEvent event1_1( *iSipSession, EMceItcEstablishSession, ids, *msg ); event1_1.ParamStatus() = KMceReady; iState->ExitL( event1_1 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateOffering ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EOffering ); EUNIT_ASSERT ( ids.iState == CMceSession::EOffering ); MCE_SET_STATES( iSipSession /*session*/, CMceSession::EIdle /*clientState*/, KMceStateIdle /*serverState*/ ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateIdle ); MCE_TH_SET( iSipSession->iBody, NULL ); iSipSession->iBody = CMceComSession::NewL( CMceComSession::EInSession ); TMceStateTransitionEvent event2( *iSipSession, EMceInvite ); iState->ExitL( event2 ); EUNIT_ASSERT ( iSipSession->CurrentState().Id() == KMceStateServerEstablishing ); EUNIT_ASSERT ( iSipSession->iBody->iState == CMceSession::EIncoming ); MCE_SET_STATES( iSipSession /*session*/, CMceSession::EIdle /*clientState*/, KMceStateIdle /*serverState*/ ); TMceStateTransitionEvent event3( *iSipSession, EMceCancel ); iState->ExitL( event3 ); MCE_SET_STATES( iSipSession /*session*/, CMceSession::EIdle /*clientState*/, KMceStateIdle /*serverState*/ ); }
void UT_CMceStateOffering::UT_CMceStateOffering_EntryL_WithUpdateL() { MCE_RESET_STUBS(); // EMceUpdate // update fails TMceStateTransitionEvent event1( *iSipSession, EMceUpdate); iStorage->iMediaManagerUpdateStatus = KErrGeneral; iState->EntryL(event1); MCE_ASSERT_STUBS(CMCETls::EUpdate /*mmaction*/, CMCETls::EDecode /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/); MCE_ASSERT_EVENT(event1 /*event*/, EMceUpdate /*code*/, KErrGeneral /*status*/); MCE_RESET_STUBS(); // async TMceStateTransitionEvent event2( *iSipSession, EMceUpdate); iStorage->iMediaManagerUpdateStatus = KMceAsync; iState->EntryL(event2); MCE_ASSERT_STUBS(CMCETls::EUpdate /*mmaction*/, CMCETls::EDecode /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/); MCE_ASSERT_EVENT(event2 /*event*/, EMceUpdate /*code*/, KMceAsync /*status*/); MCE_RESET_STUBS(); // ready, reserve async TMceStateTransitionEvent event3( *iSipSession, EMceUpdate); iStorage->iMediaManagerUpdateStatus = KMceReady; iStorage->iMediaManagerReserveStatus = KMceAsync; iState->EntryL(event3); MCE_ASSERT_STUBS(CMCETls::EReserve /*mmaction*/, CMCETls::EDecode /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/); MCE_ASSERT_EVENT(event3 /*event*/, EMceMediaUpdated /*code*/, KMceAsync /*status*/); // ready, reserve ready TMceStateTransitionEvent event4( *iSipSession, EMceUpdate); iStorage->iMediaManagerUpdateStatus = KMceReady; iStorage->iMediaManagerReserveStatus = KMceReady; iState->EntryL(event4); MCE_ASSERT_STUBS(CMCETls::EReserve /*mmaction*/, CMCETls::EEncode /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KMceSipOK /*sentResponse*/); MCE_ASSERT_EVENT(event4 /*event*/, EMceMediaUpdated /*code*/, KMceReady /*status*/); MCE_RESET_STUBS(); }
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 UT_CMceStateServerEstablishing::UT_CMceStateServerEstablishing_AcceptLL() { TMceIds ids; CMceMsgBase* msg = NULL; TMceStateTransitionEvent event1( *iSipSession, EMceItcUpdate, ids, *msg ); EUNIT_ASSERT ( iState->AcceptL( event1 ) ); TMceStateTransitionEvent event2( *iSipSession, EMceItcRejectSession, ids, *msg ); EUNIT_ASSERT ( iState->AcceptL( event2 ) ); TMceStateTransitionEvent event3( *iSipSession, EMceMediaSessionStopped ); TRAPD( e1, iState->AcceptL( event3 ) ); EUNIT_ASSERT ( e1 == KErrTotalLossOfPrecision ); TMceStateTransitionEvent event4( *iSipSession, EMceResponse ); TRAPD( e2, iState->AcceptL( event4 ) ); EUNIT_ASSERT ( e2 == KErrTotalLossOfPrecision ); }
void TestEITFixups::testUKFixups3() { EITFixUp fixup; DBEventEIT event3(54340, "Yu-Gi-Oh! ZEXAL", "It's a duelling disaster for Yuma when Astral, a mysterious visitor from another galaxy, suddenly appears, putting his duel with Shark in serious jeopardy! S01 Ep02 (Part 2 of 2)", QDateTime::fromString("2015-02-28T17:30:00Z", Qt::ISODate), QDateTime::fromString("2015-02-28T18:00:00Z", Qt::ISODate), EITFixUp::kFixGenericDVB | EITFixUp::kFixUK, SUB_UNKNOWN, AUD_STEREO, VID_UNKNOWN); fixup.Fix(event3); PRINT_EVENT(event3); QCOMPARE(event3.season, 1u); QCOMPARE(event3.episode, 2u); QCOMPARE(event3.partnumber, (uint16_t)2u); QCOMPARE(event3.parttotal, (uint16_t)2u); }
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()); }
//************************************************************************************************* //Main part of the macro //************************************************************************************************* void CreateTrainingAndTestSamples(const string InputFilename, Double_t TestSampleFraction) { TTree* HwwTree = getTreeFromFile(InputFilename.c_str()); assert(HwwTree); MitNtupleEvent event(HwwTree); //************************************************************************************************* //Create randomized list of indices //************************************************************************************************* vector<Int_t> indices; for (Int_t i=0; i<HwwTree->GetEntries(); ++i) { indices.push_back(i); } random_shuffle(indices.begin(),indices.end()); if ( TestSampleFraction > 1.0 || TestSampleFraction < 0.0 ) { cerr << "TestSampleFraction = " << TestSampleFraction << " is not in the range [0,1]. " << endl; assert( TestSampleFraction >= 1.0 && TestSampleFraction <= 0.0 ); } cout << "Input Tree Size : " << HwwTree->GetEntries() << endl; //Remove the '.root' from end of filename size_t p; p = InputFilename.find(".root"); string tmpInputFilename = InputFilename.substr(0,p); //change 'unrandomized' to 'randomized' in the file name. p = tmpInputFilename.find("_unrandomized"); if (p != string::npos) { tmpInputFilename = tmpInputFilename.substr(0,p) + "_randomized" ; } //************************************************************************************************* //Create Randomized Sample Tree //************************************************************************************************* TFile *allSampleFile = new TFile((tmpInputFilename+".all.root").c_str(), "RECREATE"); allSampleFile->cd(); TTree *allSampleTree = HwwTree->CloneTree(0); for (Int_t n=0;n<HwwTree->GetEntries();n++) { event.GetEntry(indices[n]); allSampleTree->Fill(); } allSampleTree->Write(); cout << "All Tree Size: " << allSampleTree->GetEntries() << endl; allSampleFile->Close(); //************************************************************************************************* //Create Test Sample Tree //************************************************************************************************* //For some reason I need to make another TTree, otherwise when I try to clone it, root crashes. TTree* HwwTree2 = getTreeFromFile(InputFilename.c_str()); assert(HwwTree2); assert(HwwTree2->GetEntries() == HwwTree->GetEntries()); MitNtupleEvent event2(HwwTree2); TFile *testSampleFile = new TFile((tmpInputFilename+".test.root").c_str(), "RECREATE"); testSampleFile->cd(); Int_t testSampleSize = Int_t(TestSampleFraction * double(HwwTree->GetEntries())); TTree *testSampleTree = HwwTree2->CloneTree(0); for (Int_t n=0;n<testSampleSize;n++) { event2.GetEntry(indices[n]); event2.H_weight = event2.H_weight / (TestSampleFraction); testSampleTree->Fill(); } testSampleTree->Write(); cout << "Test Tree Size: " << testSampleTree->GetEntries() << endl; testSampleFile->Close(); //************************************************************************************************* //Create Training Sample Tree //************************************************************************************************* //For some reason I need to make another TTree, otherwise when I try to clone it, root crashes. TTree* HwwTree3 = getTreeFromFile(InputFilename.c_str()); assert(HwwTree3); assert(HwwTree3->GetEntries() == HwwTree->GetEntries()); MitNtupleEvent event3(HwwTree3); TFile *trainingSampleFile = new TFile((tmpInputFilename+".training.root").c_str(), "RECREATE"); trainingSampleFile->cd(); TTree *trainingSampleTree = HwwTree3->CloneTree(0); for (Int_t n=testSampleSize;n<HwwTree->GetEntries();n++) { event3.GetEntry(indices[n]); event3.H_weight = event3.H_weight / (1 - TestSampleFraction); trainingSampleTree->Fill(); } trainingSampleTree->Write(); cout << "Training Tree Size: " << trainingSampleTree->GetEntries() << endl; trainingSampleFile->Close(); }
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(); }
static ibool MGLAPI wxWindowMouseHandler(window_t *wnd, event_t *e) { wxWindowMGL *win = (wxWindowMGL*)MGL_wmGetWindowUserData(wnd); wxPoint orig(win->GetClientAreaOrigin()); wxPoint where; g_buttonState = e->modifiers; MGL_wmCoordGlobalToLocal(win->GetHandle(), e->where_x, e->where_y, &where.x, &where.y); for (wxWindowMGL *w = win; w; w = w->GetParent()) { if ( !w->IsEnabled() ) return FALSE; if ( w->IsTopLevel() ) break; } wxEventType type = wxEVT_NULL; wxMouseEvent event; event.SetEventObject(win); event.SetTimestamp(e->when); event.m_x = where.x - orig.x; event.m_y = where.y - orig.y; event.m_shiftDown = ( e->modifiers & EVT_SHIFTKEY ) != 0; event.m_controlDown = ( e->modifiers & EVT_CTRLSTATE ) != 0; event.m_altDown = ( e->modifiers & EVT_LEFTALT ) != 0; event.m_metaDown = ( e->modifiers & EVT_RIGHTALT ) != 0; event.m_leftDown = ( e->modifiers & EVT_LEFTBUT ) != 0; event.m_middleDown = ( e->modifiers & EVT_MIDDLEBUT ) != 0; event.m_rightDown = ( e->modifiers & EVT_RIGHTBUT ) != 0; switch (e->what) { case EVT_MOUSEDOWN: // Change focus if the user clicks outside focused window: if ( win->CanAcceptFocus() && wxWindow::FindFocus() != win ) win->SetFocus(); if ( e->message & EVT_DBLCLICK ) { if ( e->message & EVT_LEFTBMASK ) type = wxEVT_LEFT_DCLICK; else if ( e->message & EVT_MIDDLEBMASK ) type = wxEVT_MIDDLE_DCLICK; else if ( e->message & EVT_RIGHTBMASK ) type = wxEVT_RIGHT_DCLICK; } else { if ( e->message & EVT_LEFTBMASK ) type = wxEVT_LEFT_DOWN; else if ( e->message & EVT_MIDDLEBMASK ) type = wxEVT_MIDDLE_DOWN; else if ( e->message & EVT_RIGHTBMASK ) type = wxEVT_RIGHT_DOWN; } break; case EVT_MOUSEUP: if ( e->message & EVT_LEFTBMASK ) type = wxEVT_LEFT_UP; else if ( e->message & EVT_MIDDLEBMASK ) type = wxEVT_MIDDLE_UP; else if ( e->message & EVT_RIGHTBMASK ) type = wxEVT_RIGHT_UP; break; case EVT_MOUSEMOVE: if ( !gs_mouseCapture ) { if ( win != gs_windowUnderMouse ) { if ( gs_windowUnderMouse ) { wxMouseEvent event2(event); MGL_wmCoordGlobalToLocal(gs_windowUnderMouse->GetHandle(), e->where_x, e->where_y, &event2.m_x, &event2.m_y); wxPoint orig(gs_windowUnderMouse->GetClientAreaOrigin()); event2.m_x -= orig.x; event2.m_y -= orig.y; event2.SetEventObject(gs_windowUnderMouse); event2.SetEventType(wxEVT_LEAVE_WINDOW); gs_windowUnderMouse->HandleWindowEvent(event2); } wxMouseEvent event3(event); event3.SetEventType(wxEVT_ENTER_WINDOW); win->HandleWindowEvent(event3); gs_windowUnderMouse = win; } } else // gs_mouseCapture { bool inside = (where.x >= 0 && where.y >= 0 && where.x < win->GetSize().x && where.y < win->GetSize().y); if ( (inside && gs_windowUnderMouse != win) || (!inside && gs_windowUnderMouse == win) ) { wxMouseEvent evt(inside ? wxEVT_ENTER_WINDOW : wxEVT_LEAVE_WINDOW); evt.SetEventObject(win); win->HandleWindowEvent(evt); gs_windowUnderMouse = inside ? win : NULL; } } type = wxEVT_MOTION; break; default: break; } if ( type == wxEVT_NULL ) { return FALSE; } else { event.SetEventType(type); return win->HandleWindowEvent(event); } }
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_EntryL_WithErrorResponsesL() { TMceIds ids; CMceMsgBase* msg = NULL; // 302 Redirect Response MCE_RESET_STUBS(); iSipSession->iSubState = CMceSipSession::EOffering; iSipSession->iResponse = iSipSession->PendingTransactions()[0]; MCETestHelper::SetResponseL( *iSipSession->iResponse, KMceSipMovedTemporarily, SipStrConsts::EPhraseOk, ETrue ); TMceStateTransitionEvent event11( *iSipSession, EMceRedirectionResponse ); iState->EntryL( event11 ); MCE_ASSERT_STUBS( CMCETls::ENone /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EInvite /*sentMethod*/, KErrNotFound /*sentResponse*/); MCE_RESET_STUBS(); // 302 response for updating iSipSession->iSubState = CMceSipSession::EUpdating; iStorage->iMediaManagerUpdateStatus = KMceAsync; MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipMovedTemporarily, SipStrConsts::EPhraseOk ); TMceStateTransitionEvent event12( *iSipSession, EMceRedirectionResponse ); iState->EntryL( event12 ); MCE_ASSERT_STUBS( CMCETls::ENone /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/); MCE_RESET_STUBS(); // 300 Redirect Response MCE_RESET_STUBS(); iSipSession->iSubState = CMceSipSession::EOffering; iSipSession->iResponse = iSipSession->PendingTransactions()[0]; iSipSession->iSentSdpCount = 2; iSipSession->iReceivedSdpCount = 1; MCETestHelper::SetResponseL( *iSipSession->iResponse, KMceSipMultipleChoices, SipStrConsts::EPhraseOk, ETrue ); TMceStateTransitionEvent event13( *iSipSession, EMceRedirectionResponse ); iState->EntryL( event13 ); // error response resets the received and sent SDP counts EUNIT_ASSERT_EQUALS( 0, iSipSession->iSentSdpCount ) EUNIT_ASSERT_EQUALS( 0, iSipSession->iReceivedSdpCount ) MCE_ASSERT_STUBS( CMCETls::ENone /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/); MCE_RESET_STUBS(); // 300 response for updating iSipSession->iSubState = CMceSipSession::EUpdating; iStorage->iMediaManagerUpdateStatus = KMceAsync; MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipMovedTemporarily, SipStrConsts::EPhraseOk ); TMceStateTransitionEvent event14( *iSipSession, EMceRedirectionResponse ); iState->EntryL( event14 ); MCE_ASSERT_STUBS( CMCETls::ENone /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/); // KMceSipDecline iStorage->iMediaManagerUpdateStatus = KMceAsync; iSipSession->iSentSdpCount = 2; iSipSession->iReceivedSdpCount = 1; MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipDecline, SipStrConsts::EPhraseDecline ); TMceStateTransitionEvent event3( *iSipSession, EMceErrorResponse ); iState->EntryL( event3 ); // error response resets the received and sent SDP counts EUNIT_ASSERT_EQUALS( 0, iSipSession->iSentSdpCount ) EUNIT_ASSERT_EQUALS( 0, iSipSession->iReceivedSdpCount ) MCE_ASSERT_STUBS( CMCETls::ENone /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/); EUNIT_ASSERT ( event3.Code() == EMceErrorResponse ); EUNIT_ASSERT ( iSipSession->PendingTransactions().Count() == 2 ); MCE_RESET_STUBS(); // KMceSipDecline updating iSipSession->iSubState = CMceSipSession::EUpdating; iStorage->iMediaManagerUpdateStatus = KMceAsync; MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipDecline, SipStrConsts::EPhraseDecline ); TMceStateTransitionEvent event3_1( *iSipSession, EMceErrorResponse ); iState->EntryL( event3_1 ); MCE_ASSERT_STUBS( CMCETls::ENone /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EEmpty /*sentMethod*/, KErrNotFound /*sentResponse*/); EUNIT_ASSERT ( event3_1.Code() == EMceErrorResponse ); EUNIT_ASSERT ( iSipSession->PendingTransactions().Count() == 2 ); MCE_RESET_STUBS(); // KMceSipCallOrTransactionDoesNotExist updating iSipSession->iSubState = CMceSipSession::EUpdating; iStorage->iMediaManagerUpdateStatus = KMceAsync; MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipCallOrTransactionDoesNotExist, SipStrConsts::EPhraseCallTransactionDoesNotExist ); TMceStateTransitionEvent event3_2( *iSipSession, EMceErrorResponse ); iState->EntryL( event3_2 ); MCE_ENTRYL_POSTCONDITION_2 MCE_ASSERT_STUBS( CMCETls::ECloseSession /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EBye /*sentMethod*/, KErrNotFound /*sentResponse*/); EUNIT_ASSERT ( event3_2.Code() == EMceErrorResponse ); EUNIT_ASSERT ( iSipSession->PendingTransactions().Count() == 3 ); MCE_RESET_STUBS(); // KMceSipRequestTimeout updating iSipSession->iSubState = CMceSipSession::EUpdating; iStorage->iMediaManagerUpdateStatus = KMceAsync; MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipRequestTimeout, SipStrConsts::EPhraseRequestTimeout ); TMceStateTransitionEvent event3_3( *iSipSession, EMceErrorResponse ); iState->EntryL( event3_3 ); MCE_ENTRYL_POSTCONDITION_2 MCE_ASSERT_STUBS( CMCETls::ECloseSession /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EBye /*sentMethod*/, KErrNotFound /*sentResponse*/); EUNIT_ASSERT ( event3_2.Code() == EMceErrorResponse ); EUNIT_ASSERT ( iSipSession->PendingTransactions().Count() == 4 ); MCE_RESET_STUBS(); // KMceSipSessionIntervalTooSmall && dialog state ETerminated iSipSession->Dialog()->Dialog().iState = CSIPDialog::ETerminated; iSipSession->iSubState = CMceSipSession::EOffering; iStorage->iMediaManagerUpdateStatus = KMceAsync; MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipSessionIntervalTooSmall, SipStrConsts::EPhraseIntervalTooBrief ); TMceStateTransitionEvent event4_2( *iSipSession, EMceErrorResponse ); iState->EntryL( event4_2 ); MCE_ASSERT_STUBS( CMCETls::ENone /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EInvite /*sentMethod*/, KErrNotFound /*sentResponse*/); EUNIT_ASSERT ( iSipSession->PendingTransactions().Count() == 5 ); EUNIT_ASSERT ( event4_2.Code() == EMceErrorResponse ); MCE_RESET_STUBS(); // KMceSipSessionIntervalTooSmall && dialog state EConfirmed iSipSession->Dialog()->Dialog().iState = CSIPDialog::EConfirmed; iSipSession->iSubState = CMceSipSession::EOffering; iStorage->iMediaManagerUpdateStatus = KMceAsync; MCETestHelper::ChangeResponseTypeL( *iSipSession->iResponse->ResponseElements(), KMceSipSessionIntervalTooSmall, SipStrConsts::EPhraseIntervalTooBrief ); TMceStateTransitionEvent event4_3( *iSipSession, EMceErrorResponse ); iState->EntryL( event4_3 ); MCE_ASSERT_STUBS( CMCETls::ENone /*mmaction*/, CMCETls::ENone /*mmsdpaction*/, SipStrConsts::EInvite /*sentMethod*/, KErrNotFound /*sentResponse*/); EUNIT_ASSERT ( iSipSession->PendingTransactions().Count() == 6 ); EUNIT_ASSERT ( event4_3.Code() == EMceErrorResponse ); MCE_RESET_STUBS(); }
void UT_CMceStateIdle::UT_CMceStateIdle_EntryLL() { //Invite CMceComSession* clientSession = CMceComSession::NewL( CMceComSession::EOutSession ); CleanupStack::PushL( clientSession ); CMceMsgObject<CMceComSession>* clientSessionMsg = new (ELeave) CMceMsgObject<CMceComSession>( *clientSession, EMceItcMsgTypeSession ); CleanupStack::Pop( clientSession ); clientSessionMsg->PushL(); CleanupStack::PushL( clientSessionMsg ); TMceIds ids; iStorage->iMediaManagerUpdateStatus = KMceAsync; TMceStateTransitionEvent event1( *iSipSession, EMceItcEstablishSession, ids, *clientSessionMsg ); iState->EntryL( event1 ); CleanupStack::PopAndDestroy( clientSessionMsg ); EUNIT_ASSERT ( iStorage->iMediaManagerAction == CMCETls::EUpdate ); EUNIT_ASSERT ( iStorage->iMediaManagerSdpAction == CMCETls::ENone ); EUNIT_ASSERT ( iSipSession->Body() == clientSession ); EUNIT_ASSERT ( iSipSession->Body()->iSIPContent == NULL ); EUNIT_ASSERT ( iSipSession->Offer() == NULL ); delete iSipSession->iBody; iSipSession->iBody = NULL; clientSession = CMceComSession::NewL( CMceComSession::EOutSession ); CleanupStack::PushL( clientSession ); clientSessionMsg = new (ELeave) CMceMsgObject<CMceComSession>( *clientSession, EMceItcMsgTypeSession ); CleanupStack::Pop( clientSession ); clientSessionMsg->PushL(); CleanupStack::PushL( clientSessionMsg ); iStorage->iMediaManagerUpdateStatus = KMceReady; TMceStateTransitionEvent event1_1( *iSipSession, EMceItcEstablishSession, ids, *clientSessionMsg ); iState->EntryL( event1_1 ); CleanupStack::PopAndDestroy( clientSessionMsg ); EUNIT_ASSERT ( iStorage->iMediaManagerAction == CMCETls::EUpdate ); EUNIT_ASSERT ( iStorage->iMediaManagerSdpAction == CMCETls::EEncode ); EUNIT_ASSERT ( iSipSession->Body() == clientSession ); EUNIT_ASSERT ( iSipSession->Body()->iSIPContent == NULL ); EUNIT_ASSERT ( iSipSession->Offer() != NULL ); delete iSipSession->iOffer; iSipSession->iOffer = NULL; //Invited iSipSession->Body()->iType = CMceComSession::EInSession; RPointerArray<CSIPHeaderBase> sipHeaders; CSIPHeaderBase::PushLC( &sipHeaders ); // Supported: timer RStringF timerKey = SIPStrings::Pool().OpenFStringL( KMceSipTimer() ); CleanupClosePushL( timerKey ); CSIPSupportedHeader* supportedHeader = CSIPSupportedHeader::NewLC( timerKey ); User::LeaveIfError( sipHeaders.Append( supportedHeader ) ); CleanupStack::Pop( supportedHeader ); CleanupStack::PopAndDestroy();//timerKey // Session-Expires: 10 CSIPExtensionHeader* sessionExpiresHeader = CSIPExtensionHeader::NewLC( KSessionExpires(), _L8("10") ); User::LeaveIfError( sipHeaders.Append( sessionExpiresHeader ) ); CleanupStack::Pop( sessionExpiresHeader ); CSIPServerTransaction* srvtransaction = MCETestHelper::ServerTransactionL( SipStrConsts::EInvite, sipHeaders, ETrue ); CleanupStack::PopAndDestroy( &sipHeaders ); CleanupStack::PushL( srvtransaction ); iSipSession->iPendingReceivedRequests.AppendL( srvtransaction ); CleanupStack::Pop( srvtransaction ); TMceStateTransitionEvent event2( *iSipSession, EMceInvite ); iState->EntryL( event2 ); EUNIT_ASSERT ( iStorage->iMediaManagerAction == CMCETls::EUpdate ); iStorage->iMediaManagerAction = CMCETls::ENone; iStorage->iMediaManagerDecodeStatus = KMceSipWarnMediaTypeNotAvailable; TMceStateTransitionEvent event3( *iSipSession, EMceInvite ); iState->EntryL( event3 ); EUNIT_ASSERT ( iStorage->iMediaManagerAction == CMCETls::ENone ); EUNIT_ASSERT ( iStorage->iSipSentResponse->StatusCode() == KMceSipNotAcceptableHere ); EUNIT_ASSERT ( iSipSession->Body() != NULL ); EUNIT_ASSERT ( iSipSession->BodyCandidate() == NULL ); EUNIT_ASSERT ( iSipSession->Body()->iType == CMceComSession::EInSession ); EUNIT_ASSERT ( iSipSession->Body()->iSIPContent == NULL ); TMceStateTransitionEvent event4( *iSipSession, EMceCancel ); iState->EntryL( event4 ); CSIPServerTransaction& request = iSipSession->Request(); CSIPRequestElements* requestElement = const_cast<CSIPRequestElements*>(request.RequestElements()); requestElement->MessageElements().SetContent( NULL ); TMceStateTransitionEvent event2_2( *iSipSession, EMceInvite ); iState->EntryL( event2_2 ); }
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 ); }