void Panic(TCdtPanic reason) { _LIT(KCat, "QtHybridHeap"); User::Panic(KCat, reason); }
/** * * DoTestStepL * This method tests removing a Data Source */ TVerdict CTestStepRemoveDataSource::DoTestStepL( void ) { __MM_HEAP_MARK; TVerdict result = EPass; _LIT( KTestPlay, "Remove Data Source Test"); Log( KTestPlay ); _LIT( KTestStepSource, "This test checks removing a data source"); Log( KTestStepSource ); // [ audio file to play ] _LIT(KTestWavFile, "newmail.wav"); SetReadFileNameL( KTestWavFile ); TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority); User::LeaveIfError( errorCode ); //iFileConfig().iPath = KTestWavFile; //[ declare handles for removal of the data source and data sink] TMMFMessageDestination aSourceHandleInfo; TMMFMessageDestination aSinkHandleInfo ; //[ add data source and sink and prime the controller ] errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig(), aSourceHandleInfo ); User::LeaveIfError( errorCode ); errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8, aSinkHandleInfo ); User::LeaveIfError( errorCode ); //[ lets remove the data source using the sink handle !! ] errorCode = iController.RemoveDataSource( aSinkHandleInfo ); if( errorCode == KErrNone ) { result = EFail; return result ; } //[ lets remove the data source ] errorCode = iController.RemoveDataSource( aSourceHandleInfo ); User::LeaveIfError( errorCode ); //[ search for remove event ] TMMFEvent removeDataSourceEvent( KRemoveDataSourceTestId, KErrNone ); TVerdict removeResult = SearchForEvent( removeDataSourceEvent ); if( removeResult == EFail ) { return removeResult ; } //[ try removing the data source a second time ] errorCode = iController.RemoveDataSource( aSourceHandleInfo ); if( errorCode == KErrNone ) { result = EFail; return result ; } //[ no need to remove event since the message does not reach the custom controller ] //[ add data source and sink and prime the controller ] errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig(), aSourceHandleInfo ); User::LeaveIfError( errorCode ); errorCode = iController.Prime(); User::LeaveIfError( errorCode ); // [ wait for and process the return event from the audio output ] TMMFEvent primeEvent( KPrimeTestId, KErrNone); TVerdict primeResult = SearchForEvent( primeEvent ); if( primeResult == EFail ) { return primeResult; } //[ try removing the data source ] errorCode = iController.RemoveDataSource( aSourceHandleInfo ); if( errorCode == KErrNone ) { result = EFail; return result ; } // [ second event is not generated on failure ] User::LeaveIfError( iController.Play() ); // note this test does not wait around // to detect that the audio has been played // [ now process the confirmation event that play has reached audio output // this is the raison detre of the test ] TMMFEvent playEvent( KPlayTestId, KErrNone ); TVerdict playResult = SearchForEvent( playEvent ); if( playResult == EFail ) { return playResult ; } //[ try removing the data sink ] errorCode = iController.RemoveDataSource( aSourceHandleInfo ); if( errorCode == KErrNone ) { result = EFail; return result ; } //[ try removing the data sink ] errorCode = iController.RemoveDataSource( aSourceHandleInfo ); if( errorCode == KErrNone ) { result = EFail; return result ; } result = EPass ; //[ ensure the controller is unloaded so that it does // not interfere with the following test ] // There is error in this code and the stop followed by reset // ensure the controller resources are released. iController.Stop(); iController.Reset(); iController.Close(); __MM_HEAP_MARKEND; // test steps return a result return result; }
// --------------------------------------------------------------------------- // CBCTestForMAndView::TestForAknGridViewL // --------------------------------------------------------------------------- // void CBCTestForMAndView::TestForAknGridViewL() { CAknGrid *aknGrid = new( ELeave ) CAknGrid(); CleanupStack::PushL( aknGrid ); aknGrid->SetContainerWindowL ( *iContainer ); TResourceReader reader; iEnv->CreateResourceReaderLC( reader, R_BCTESTGRIDS_GRID ); aknGrid->ConstructFromResourceL( reader ); _LIT( KConstructFromResourceL, "ConstructFromResourceL test" ); AssertTrueL( ETrue, KConstructFromResourceL ); CleanupStack::PopAndDestroy(); //reader CAknGridView* gridView = aknGrid->GridView(); _LIT( KCAknGridView, "CAknGridView test" ); AssertTrueL( ETrue, KCAknGridView ); TInt listBoxIndex = 0; TInt dataIndex = gridView->ActualDataIndex( listBoxIndex ); _LIT( KActualDataIndex, "ActualDataIndex test" ); AssertTrueL( ETrue, KActualDataIndex ); TInt listBoxIndex1 = gridView->ListBoxIndex( dataIndex ); _LIT( KListBoxIndex, "ListBoxIndex test" ); AssertTrueL( ETrue, KListBoxIndex ); TInt currentDataIndex = gridView->CurrentDataIndex(); _LIT( KCurrentDataIndex, "CurrentDataIndex test" ); AssertTrueL( ETrue, KCurrentDataIndex ); gridView->SetCurrentDataIndex( dataIndex ); _LIT( KSetCurrentDataIndex, "SetCurrentDataIndex test" ); AssertTrueL( ETrue, KSetCurrentDataIndex ); gridView->SetPrimaryScrollingType( CAknGridView::EScrollFollowsGrid ); _LIT( KSetPrimaryScrollingType, "SetPrimaryScrollingType test" ); AssertTrueL( ETrue, KSetPrimaryScrollingType ); gridView->SetSecondaryScrollingType( CAknGridView::EScrollFollowsGrid ); _LIT( KSetSecondaryScrollingType, "SetSecondaryScrollingType test" ); AssertTrueL( ETrue, KSetSecondaryScrollingType ); TSize size = iContainer->Rect().Size(); gridView->SetGridCellDimensions( size ); _LIT( KSetGridCellDimensions, "SetGridCellDimensions test" ); AssertTrueL( ETrue, KSetGridCellDimensions ); TSize gridCellDimensions = gridView->GridCellDimensions(); _LIT( KGridCellDimensions, "GridCellDimensions test" ); AssertTrueL( ETrue, KGridCellDimensions ); gridView->SetSpacesBetweenItems( size ); _LIT( KSetSpacesBetweenItems, "SetSpacesBetweenItems test" ); AssertTrueL( ETrue, KSetSpacesBetweenItems ); TBool isPrimaryVertical = gridView->IsPrimaryVertical(); _LIT( KIsPrimaryVertical, "IsPrimaryVertical test" ); AssertTrueL( ETrue, KIsPrimaryVertical ); TInt itemIndex = 1; TInt rowIndex = 1; TInt colIndex = 1; gridView->DataIndexFromLogicalPos( itemIndex, rowIndex, colIndex ); _LIT( KDataIndexFromLogicalPos, "DataIndexFromLogicalPos test" ); AssertTrueL( ETrue, KDataIndexFromLogicalPos ); TInt negative = -2; gridView->LogicalPosFromDataIndex( itemIndex, rowIndex, colIndex ); gridView->LogicalPosFromDataIndex( negative, rowIndex, colIndex ); gridView->LogicalPosFromDataIndex( itemIndex, negative, colIndex ); gridView->LogicalPosFromDataIndex( negative, rowIndex, colIndex ); gridView->LogicalPosFromDataIndex( itemIndex, rowIndex, negative ); gridView->LogicalPosFromDataIndex( negative, rowIndex, negative ); gridView->LogicalPosFromDataIndex( itemIndex, negative, negative ); gridView->LogicalPosFromDataIndex( negative, negative, negative ); _LIT( KLogicalPosFromDataIndex, "LogicalPosFromDataIndex test" ); AssertTrueL( ETrue, KLogicalPosFromDataIndex ); CAknGridView::SGrid gridDetailPos1 = { size, 1, 1, 1, 1, size, size }; gridView->SetGridDetails( gridDetailPos1 ); gridView->ListBoxIndexFromLogicalPos( itemIndex, rowIndex, colIndex ); TInt isVisible = gridView->CalcNewTopItemIndexSoItemIsVisible( KZero ); CAknGridView::SGrid gridDetailPos2 = { size, 0, 1, 1, 1, size, size }; gridView->SetGridDetails( gridDetailPos2 ); gridView->ListBoxIndexFromLogicalPos( itemIndex, rowIndex, colIndex ); _LIT( KListBoxIndexFromLogicalPos, "ListBoxIndexFromLogicalPos test" ); AssertTrueL( ETrue, KListBoxIndexFromLogicalPos ); gridView->LogicalPosFromListBoxIndex( itemIndex, rowIndex, colIndex ); _LIT( KLogicalPosFromListBoxIndex, "LogicalPosFromListBoxIndex test" ); AssertTrueL( ETrue, KLogicalPosFromListBoxIndex ); gridView->DrawEmptyList(); _LIT( KDrawEmptyList, "DrawEmptyList test" ); AssertTrueL( ETrue, KDrawEmptyList ); CAknGridView::SGrid gridDetail = { size, 1, 1, 1, 1, size, size }; gridView->SetGridDetails( gridDetail ); _LIT( KSetGridDetails, "SetGridDetails test" ); AssertTrueL( ETrue, KSetGridDetails ); gridView->MoveToItemIndexL( itemIndex, CAknGridView::ENoSelection ); gridView->MoveToItemIndexL( negative, CAknGridView::ENoSelection ); _LIT( KMoveToItemIndex, "MoveToItemIndex test" ); AssertTrueL( ETrue, KMoveToItemIndex ); TInt numberOfColsInView = gridView->NumberOfColsInView(); _LIT( KNumberOfColsInView, "NumberOfColsInView test" ); AssertTrueL( ETrue, KNumberOfColsInView ); TInt numberOfRowsInView = gridView->NumberOfRowsInView(); _LIT( KNumberOfRowsInView, "NumberOfRowsInView test" ); AssertTrueL( ETrue, KNumberOfRowsInView ); gridView->DrawMatcherCursor(); _LIT( KDrawMatcherCursor, "DrawMatcherCursor test" ); AssertTrueL( ETrue, KDrawMatcherCursor ); TInt currentItemIndex = gridView->CurrentItemIndex(); _LIT( KCurrentItemIndex, "CurrentItemIndex test" ); AssertTrueL( ETrue, KCurrentItemIndex ); gridView->ScrollToMakeItemVisible( KNegative ); currentItemIndex = gridView->CurrentItemIndex(); TInt columnWidth = 1; gridView->SetColumnWidth( columnWidth ); _LIT( KSetColumnWidth, "SetColumnWidth test" ); AssertTrueL( ETrue, KSetColumnWidth ); gridView->MoveCursorL( CAknGridView::ECursorNextItem, CAknGridView::ENoSelection ); gridView->MoveCursorL( CAknGridView::ECursorPreviousItem, CAknGridView::ENoSelection ); gridView->MoveCursorL( CAknGridView::ECursorNextColumn, CAknGridView::ENoSelection ); gridView->MoveCursorL( CAknGridView::ECursorPreviousColumn, CAknGridView::ENoSelection ); gridView->MoveCursorL( CAknGridView::ECursorPreviousPage, CAknGridView::ENoSelection ); gridView->MoveCursorL( CAknGridView::ECursorNextPage, CAknGridView::ENoSelection ); gridView->MoveCursorL( CAknGridView::ECursorFirstItem, CAknGridView::ENoSelection ); gridView->MoveCursorL( CAknGridView::ECursorLastItem, CAknGridView::ENoSelection ); gridView->MoveCursorL( CAknGridView::ECursorNextScreen, CAknGridView::ENoSelection ); gridView->MoveCursorL( CAknGridView::ECursorPrevScreen, CAknGridView::ENoSelection ); _LIT( KMoveCursorL, "MoveCursorL test" ); AssertTrueL( ETrue, KMoveCursorL ); gridView->Draw( NULL ); _LIT( KDraw, "Draw test" ); AssertTrueL( ETrue, KDraw ); gridView->DrawItem( itemIndex ); gridView->DrawItem( KZero ); _LIT( KDrawItem, "DrawItem test" ); AssertTrueL( ETrue, KDrawItem ); TPoint point = gridView->ItemPos( itemIndex ); _LIT( KItemPos, "ItemPos test" ); AssertTrueL( ETrue, KItemPos ); gridView->CalcBottomItemIndex(); _LIT( KCalcBottomItemIndex, "CalcBottomItemIndex test" ); AssertTrueL( ETrue, KCalcBottomItemIndex ); isVisible = gridView->CalcNewTopItemIndexSoItemIsVisible( itemIndex ); _LIT( KCalcNewTopItemIndexSoItemIsVisible, "CalcNewTopItemIndexSoItemIsVisible test" ); AssertTrueL( ETrue, KCalcNewTopItemIndexSoItemIsVisible ); gridView->DrawItemRange( KZero, KOne ); gridView->DrawItemRange( KNegative, KOne ); _LIT( KDrawItemRange, "DrawItemRange test" ); AssertTrueL( ETrue, KDrawItemRange ); gridView->SetTopItemIndex( itemIndex ); _LIT( KSetTopItemIndex, "SetTopItemIndex test" ); AssertTrueL( ETrue, KSetTopItemIndex ); gridView->SetItemHeight( KItemHeight ); _LIT( KSetItemHeight, "SetItemHeight test" ); AssertTrueL( ETrue, KSetItemHeight ); TBool posToItemIndex = gridView->XYPosToItemIndex( point, itemIndex ); _LIT( KXYPosToItemIndex, "XYPosToItemIndex test" ); AssertTrueL( ETrue, KXYPosToItemIndex ); gridView->CalcDataWidth(); _LIT( KCalcDataWidth, "CalcDataWidth test" ); AssertTrueL( ETrue, KCalcDataWidth ); TRect rect = iContainer->Rect(); TInt visibleWidth = gridView->VisibleWidth( rect ); _LIT( KVisibleWidth, "VisibleWidth test" ); AssertTrueL( ETrue, KVisibleWidth ); CAknGridView::SGrid gridDetailIndex1 = { size, 0, 1, 1, 1, size, size }; gridView->SetGridDetails( gridDetailIndex1 ); TBool visible = gridView->ScrollToMakeItemVisible( KOne ); visible = gridView->ScrollToMakeItemVisible( KNegative ); TInt itemIsVisible = gridView->CalculateHScrollOffsetSoItemIsVisible( itemIndex ); CAknGridView::SGrid gridDetailIndex2 = { size, 1, 1, 1, 1, size, size }; gridView->SetGridDetails( gridDetailIndex2 ); visible = gridView->ScrollToMakeItemVisible( KOne ); visible = gridView->ScrollToMakeItemVisible( KNegative ); _LIT( KScrollToMakeItemVisible, "ScrollToMakeItemVisible test" ); AssertTrueL( ETrue, KScrollToMakeItemVisible ); itemIsVisible = gridView->CalculateHScrollOffsetSoItemIsVisible( itemIndex ); _LIT( KCalculateHScrollOffsetSoItemIsVisible, "CalculateHScrollOffsetSoItemIsVisible test" ); AssertTrueL( ETrue, KCalculateHScrollOffsetSoItemIsVisible ); TSize itemSize = gridView->ItemSize( 0 ); _LIT( KItemSize, "ItemSize test" ); AssertTrueL( ETrue, KItemSize ); gridView->CalcRowAndColIndexesFromItemIndex( itemIndex, rowIndex, colIndex ); _LIT( KCalcRowAndColIndexesFromItemIndex, "CalcRowAndColIndexesFromItemIndex test" ); AssertTrueL( ETrue, KCalcRowAndColIndexesFromItemIndex ); gridView->CalcItemIndexFromRowAndColIndexes( itemIndex, rowIndex, colIndex ); _LIT( KCalcItemIndexFromRowAndColIndexes, "CalcItemIndexFromRowAndColIndexes test" ); AssertTrueL( ETrue, KCalcItemIndexFromRowAndColIndexes ); CBCTestForGridView* testForGridView = new( ELeave ) CBCTestForGridView(); CleanupStack::PushL( testForGridView ); /*CTextListBoxModel* listBoxModel = aknGrid->Model(); CDesCArray* array = iEnv->ReadDesCArrayResourceL( R_BCTESTGRIDS_ARRAY ); listBoxModel->ConstructL ( array, ELbmOwnsItemArray ); CFormattedCellListBoxItemDrawer* itemDrawer = aknGrid->ItemDrawer();*/ CAknGridM* listBoxModel = new( ELeave ) CAknGridM(); CleanupStack::PushL( listBoxModel ); CDesCArray* array = iEnv->ReadDesCArrayResourceL( R_BCTESTGRIDS_ARRAY ); CleanupStack::PushL( array ); listBoxModel->ConstructL ( array, ELbmOwnsItemArray ); CleanupStack::Pop( array ); CFormattedCellListBoxData* data = CFormattedCellListBoxData::NewL(); CleanupStack::PushL( data ); CFormattedCellListBoxItemDrawer* itemDrawer = new( ELeave ) CFormattedCellListBoxItemDrawer( listBoxModel, iEnv->NormalFont(), data ); CleanupStack::PushL( itemDrawer ); CWsScreenDevice* screen = iEnv->ScreenDevice(); RWindowGroup& groupWin = iEnv->RootWin(); RWindow& wsWindow = iContainer->Window(); testForGridView->ConstructL( listBoxModel, itemDrawer, screen, &groupWin, &wsWindow, rect, KItemHeight ); TSize gridDimension( KDimensionX, KDimensionY ); TSize betweenItems( KItemX, KItemY ); TSize sizeOfItem( size.iWidth / KOne, size.iHeight / KTwo ); TInt flags = CAknGridView::ELeftToRight | CAknGridView::ETopToBottom | CAknGridView::EPrimaryIsVertical; CAknGridView::SGrid gridDetail2 = { gridDimension, flags, KTwo, KOne, KTwo, betweenItems, sizeOfItem }; testForGridView->SetGridDetails( gridDetail2 ); TSize betweenItemsTwo( KNegative, KOne ); CAknGridView::SGrid gridDetail3 = { gridDimension, flags, KTwo, KOne, KTwo, betweenItemsTwo, sizeOfItem }; testForGridView->SetGridDetails( gridDetail3 ); TSize betweenItemsThree( KNegative, KNegative ); CAknGridView::SGrid gridDetail4 = { gridDimension, flags, KTwo, KOne, KTwo, betweenItemsThree, sizeOfItem }; testForGridView->SetGridDetails( gridDetail4 ); TInt startColIndex = 0; TInt endColIndex = 1; testForGridView->DrawColumnRange( startColIndex, endColIndex ); _LIT( KDrawColumnRange, "DrawColumnRange test" ); AssertTrueL( ETrue, KDrawColumnRange ); testForGridView->ClearUnusedItemSpace( KZero, KOne ); _LIT( KClearUnusedItemSpace, "ClearUnusedItemSpace test" ); AssertTrueL( ETrue, KClearUnusedItemSpace ); testForGridView->UpdateHScrollOffsetBasedOnTopItemIndex(); _LIT( KUpdateHScrollOffsetBasedOnTopItemIndex, "UpdateHScrollOffsetBasedOnTopItemIndex test" ); AssertTrueL( ETrue, KUpdateHScrollOffsetBasedOnTopItemIndex ); testForGridView->DoMoveL( CAknGridView::ECursorNextItem, CAknGridView::ENoSelection ); _LIT( KDoMoveL, "DoMoveL test" ); AssertTrueL( ETrue, KDoMoveL ); TBool itemExists = testForGridView->ItemExists( listBoxIndex ); _LIT( KItemExists, "ItemExists test" ); AssertTrueL( ETrue, KItemExists ); //for block coverage CAknGridView::SGrid gridDetailForScroll1 = { gridDimension, KOne, KOne, KOne, KOne, betweenItemsThree, sizeOfItem }; testForGridView->SetGridDetails( gridDetailForScroll1 ); testForGridView->SetPrimaryScrollingType( CAknGridView::EScrollStops ); testForGridView->SetSecondaryScrollingType( CAknGridView::EScrollStops ); testForGridView->DoMoveL(CAknGridView::ECursorNextItem, CAknGridView::ENoSelection ); testForGridView->SetPrimaryScrollingType( CAknGridView::EScrollFollowsGrid ); testForGridView->SetSecondaryScrollingType( CAknGridView::EScrollFollowsGrid ); testForGridView->DoMoveL(CAknGridView::ECursorNextItem, CAknGridView::ENoSelection ); testForGridView->SetPrimaryScrollingType( CAknGridView::EScrollFollowsItemsAndStops ); testForGridView->SetSecondaryScrollingType( CAknGridView::EScrollFollowsItemsAndStops ); testForGridView->DoMoveL(CAknGridView::ECursorNextItem, CAknGridView::ENoSelection ); CAknGridView::SGrid gridDetailForScroll2 = { gridDimension, KZero, KOne, KOne, KOne, betweenItemsThree, sizeOfItem }; testForGridView->SetGridDetails( gridDetailForScroll2 ); testForGridView->SetPrimaryScrollingType( CAknGridView::EScrollFollowsItemsAndLoops ); testForGridView->SetSecondaryScrollingType( CAknGridView::EScrollFollowsItemsAndLoops ); testForGridView->DoMoveL(CAknGridView::ECursorNextItem, CAknGridView::ENoSelection ); testForGridView->SetPrimaryScrollingType( CAknGridView::EScrollIncrementLineAndStops ); testForGridView->SetSecondaryScrollingType( CAknGridView::EScrollIncrementLineAndStops ); testForGridView->DoMoveL(CAknGridView::ECursorNextItem, CAknGridView::ENoSelection ); testForGridView->SetPrimaryScrollingType( CAknGridView::EScrollIncrementLineAndLoops ); testForGridView->SetSecondaryScrollingType( CAknGridView::EScrollIncrementLineAndLoops ); testForGridView->DoMoveL(CAknGridView::ECursorNextItem, CAknGridView::ENoSelection ); testForGridView->DoMoveL(CAknGridView::ECursorPreviousItem, CAknGridView::ENoSelection ); testForGridView->DoMoveL(CAknGridView::ECursorNextColumn, CAknGridView::ENoSelection ); testForGridView->DoMoveL(CAknGridView::ECursorPreviousColumn, CAknGridView::ENoSelection ); CleanupStack::Pop( itemDrawer ); CleanupStack::Pop( data ); CleanupStack::PopAndDestroy( listBoxModel ); CleanupStack::PopAndDestroy( testForGridView ); CleanupStack::PopAndDestroy( aknGrid ); _LIT( KDesCAknGridView, "~CAknGridView test" ); AssertTrueL( ETrue, KDesCAknGridView ); }
// --------------------------------------------------------- // CPosTp34::GetName // // (other items were commented in a header). // --------------------------------------------------------- // void CPosTp34::GetName(TDes& aName) const { _LIT(KTestName, "TP34 - Multiple async operations"); aName = KTestName; }
// --------------------------------------------------------- // CPosTp26::DoLandmarkSearch // // (other items were commented in a header). // --------------------------------------------------------- // void CPosTp26::DoLandmarkSearchL(const RPointerArray<CSearchResult>& aSearchResults) { iLog->Log(_L("DoLandmarkSearch()")); _LIT(KNumOfMatchesErr, "No. of matches is incorrect when the search is performed asyncronously"); _LIT(KNotFoundErr, "Id %d not found in parsed Lm search results when the search is performed asyncronously"); _LIT(KNumOfMatchesInIteratorErr, "Wrong number of matches in iterator"); _LIT(KWrongIdErr, "Wrong id returned from iterator after reset"); iLandmarkSearch = CPosLandmarkSearch::NewL(*iDatabase); TBuf<150> buf; _LIT(KDebug, "Searching for "); // Put this RArray outside loop so that if reset of the array is missing in the code // it will be noticed RArray<TPosLmItemId> lmIdArray; CleanupClosePushL(lmIdArray); for(TInt i=0; i<aSearchResults.Count(); i++) { CPosLmTextCriteria* textCriteria = CPosLmTextCriteria::NewLC(); textCriteria->SetTextL(aSearchResults[i]->TextCriteria()); textCriteria->SetAttributesToSearch(aSearchResults[i]->Attributes()); textCriteria->SetPositionFieldsToSearchL(aSearchResults[i]->PositionFields()); buf.Zero(); buf.Append(KDebug); buf.Append(aSearchResults[i]->TextCriteria()); iLog->Log(buf); iOperation = iLandmarkSearch->StartLandmarkSearchL(*textCriteria, aSearchResults[i]->Redefined()); RunAsyncOperationLD(iOperation); CPosLmItemIterator* iter = iLandmarkSearch->MatchIteratorL(); CleanupStack::PushL(iter); buf.Zero(); buf.Format(_L("Found %d nr of matches, should found %d nr of matches"), iLandmarkSearch->NumOfMatches(), (aSearchResults[i]->SearchResult()).Count()); iLog->Log(buf); TUint nrOfMatches = iLandmarkSearch->NumOfMatches(); AssertTrueSecL((TUint)(aSearchResults[i]->SearchResult()).Count() == nrOfMatches, KNumOfMatchesErr); TPosLmItemId id1 = iter->NextL(); TPosLmItemId id = KPosLmNullItemId; if (id1 != KPosLmNullItemId) { CPosLandmark* lm = iDatabase->ReadLandmarkLC(id1); CleanupStack::PopAndDestroy(lm); // Reset the iterator and make sure that the first id is returned again iter->Reset(); id = iter->NextL(); } AssertTrueSecL(id1 == id, KWrongIdErr); TUint counter=0; while (id != KPosLmNullItemId) { AssertTrueSecL(aSearchResults[i]->FindSearchResult(id), KNotFoundErr); CPosLandmark* lm = iDatabase->ReadLandmarkLC(id); CleanupStack::PopAndDestroy(lm); id = iter->NextL(); counter++; } TUint nrInIterator = iter->NumOfItemsL(); if (nrOfMatches != counter || nrOfMatches != nrInIterator) { iLog->Log(KNumOfMatchesInIteratorErr); User::Leave(-1); } // Get a sequence of items and check ids TInt startIndex = 0; // Just to get some different starting index depending on nr of ids if (nrOfMatches>2) startIndex = 2; if (nrOfMatches>5) startIndex = 5; if (nrOfMatches>20) startIndex = 20; // Do this if there are some matches if (nrOfMatches-startIndex>0) { buf.Zero(); buf.Format(_L("GetItemIdsL from index %d nr of items index %d"), startIndex, nrOfMatches-startIndex); iLog->Log(buf); // lmIdArray should be reset in GetItemIdsL iter->GetItemIdsL(lmIdArray, startIndex, nrOfMatches-startIndex); TInt nr = lmIdArray.Count(); for (TInt j=0;j<nr; j++) { AssertTrueSecL(aSearchResults[i]->FindSearchResult(lmIdArray[j]), KNotFoundErr); CPosLandmark* lm = iDatabase->ReadLandmarkLC(lmIdArray[j]); CleanupStack::PopAndDestroy(lm); } } CleanupStack::PopAndDestroy(2, textCriteria); } // end for CleanupStack::PopAndDestroy(&lmIdArray); delete iLandmarkSearch; iLandmarkSearch = NULL; }
/** Import the fields from vCard format into contact item in 3 scenarios. * 1) Field present in both vCard and the Contact Item * 2) Field present in vCard but absent in the Contact Item * 3) Field present in vCard but does not contain any value * @param aExistingFile - existing file for existing contact item * @param aNewFile - New file for vCard format * @param aStorageType - Storage type of each field * @param aContFieldUid - Uid of Contact field * @param avCardMapUid - Uid of vCard * @return - void */ void CTestImportContactMergeModeStep::ImportFieldsInMergeModeL(TBuf<50> aExistingFile, TBuf<50> aNewFile, TInt aStorageType,TUid aContFieldUid, TUid avCardMapUid) { TPtrC compareVal, value; _LIT(KTestDbName, "c:importcontact.cdb"); TInt year, month, day; RFs fsSession; RFileReadStream readStream, newReadStream; TBool success=EFalse; _LIT(KImportNewFileWithUid, "C:\\ImportNewFileWithUid.vcf"); //replace existing database dBase = CContactDatabase::ReplaceL(KTestDbName); //connect to file system User::LeaveIfError(fsSession.Connect()); CleanupClosePushL(fsSession); //Opens a existing file in read mode User::LeaveIfError(readStream.Open(fsSession,aExistingFile, EFileRead)); CleanupClosePushL(readStream); INFO_PRINTF1(_L("Importing Contact in Merge Mode.....")); // importing contact item from vCard format CArrayPtr<CContactItem>* item = dBase->ImportContactsL(TUid::Uid(KUidVCardConvDefaultImpl), readStream, success, CContactDatabase::EImportSingleContact|CContactDatabase::ETTFormat); if(!success) { INFO_PRINTF1(_L("Contact Imported Failed")); SetTestStepResult(EFail); return; } INFO_PRINTF1(_L("Contact Imported in Merge Mode")); // Get the Contact Id TContactItemId contactId = (*item)[0]->Id(); // Reads a contact item CContactItem* importedContact = dBase->ReadContactLC(contactId); AddUidRevPropertyL(*importedContact, fsSession, aNewFile, KImportNewFileWithUid); item->ResetAndDestroy(); delete item; //Opens a file contains Uid of existing CI and field value from // newly created contact item in read mode User::LeaveIfError(newReadStream.Open(fsSession,KImportNewFileWithUid, EFileRead)); CleanupClosePushL(newReadStream); // import the contact from vCard format. item = NULL; item = dBase->ImportContactsL(TUid::Uid(KUidVCardConvDefaultImpl), newReadStream, success, CContactDatabase::EImportSingleContact|CContactDatabase::ETTFormat); if(!success) { INFO_PRINTF1(_L("Contact Imported Failed")); SetTestStepResult(EFail); return; } INFO_PRINTF1(_L("Contact Imported in Merge Mode")); // Extract the merge mode value from ImportExportTestCases.ini. TInt flagValue; GetIntFromConfig(ConfigSection(), KIniFlagvalue, flagValue); // // Specifically for Mode 3 tests. Checks if the contact item has // been deleted. Passes the test if the contact item has been deleted. // Fails otherwise. // if( flagValue == 3 ) { // Checks if any contact item has been returned. if( (*item).Count() == 0 ) { SetTestStepResult(EPass); INFO_PRINTF1(_L("Contact Item Deleted")); } else { // Assuming that in mode 3, the item always has just 1 field // hence on merge, the item should always be deleted, and // if it is not deleted the test will fail. SetTestStepResult(EFail); INFO_PRINTF1(_L("Contact Item Not Deleted")); } // Cleanup. item->ResetAndDestroy(); delete item; CleanupStack::PopAndDestroy(4,&fsSession); delete dBase; return; } // verify the field is being added CContactItemFieldSet& ContactFieldSet = (*item)[0]->CardFields(); //get the string value GetStringFromConfig(ConfigSection(), KExpectedData, compareVal); TInt pos = ContactFieldSet.Find(aContFieldUid, avCardMapUid); if(pos != KErrNotFound) { if(aStorageType==KStorageTypeDateTime) { //Get the int value TBool res; res = GetIntFromConfig(ConfigSection(), KIniYear, year); if(!res) { ERR_PRINTF1(_L("Unable to read year val from ini file")); SetTestStepResult(EFail); } res = GetIntFromConfig(ConfigSection(), KIniMonth, month); if(!res) { ERR_PRINTF1(_L("Unable to read month val from ini file")); SetTestStepResult(EFail); } res = GetIntFromConfig(ConfigSection(), KIniDay, day); if(!res) { ERR_PRINTF1(_L("Unable to read day val from ini file")); SetTestStepResult(EFail); } TDateTime result=ContactFieldSet[pos].DateTimeStorage()->Time().DateTime(); //compare the results if((result.Year() == year) && (result.Month() == (TMonth)month) && (result.Day() == day)) { SetTestStepResult(EPass); } else { SetTestStepResult(EFail); } } else { value.Set(ContactFieldSet[pos].TextStorage()->Text()); //compare the results if(compareVal.Compare(value)==0 ) { SetTestStepResult(EPass); } else { SetTestStepResult(EFail); } } } else { TInt deleted; // get the flag value from ini file GetIntFromConfig(ConfigSection(), KIniFlagvalue, deleted); if(deleted == 3) { SetTestStepResult(EPass); INFO_PRINTF1(_L("Field deleted")); } else { INFO_PRINTF1(_L("Field not found")); } } // Cleanup item->ResetAndDestroy(); delete item; CleanupStack::PopAndDestroy(4,&fsSession); delete dBase; }
/** set test name to 'Service Indication' @param void @return string string represents test name */ const TDesC& CWapPushSIMessageTest::TestName() { _LIT(KTextSIMessageTest, "Service Indication"); return KTextSIMessageTest; }
// ----------------------------------------------------------------------------- // CWimCertHandler::CopyCertExtrasInfoL // Copies certs extra information to client's allocated memory area. // ----------------------------------------------------------------------------- // void CWimCertHandler::CopyCertExtrasInfoL( WIMI_Ref_t* aCert, const RMessage2& aMessage ) { _WIMTRACE(_L("WIM | WIMServer | CWimCertHandler::CopyCertExtrasInfoL | Begin")); TUint8 pushedItemCount = 0; WIMI_Ref_t* tempref = NULL; WIMI_BinData_t ptLabel; WIMI_BinData_t ptKeyID; WIMI_BinData_t ptCAID; WIMI_BinData_t ptIssuerHash; WIMI_BinData_t ptTrustedUsage; TUint8 uiCDFRefs; TUint8 usage; TUint8 type; TUint16 certlen; TUint8 modifiable = 0; TBool found = ETrue; TCertExtrasInfo certExtraInfo; certExtraInfo.iCDFRefs = 0; certExtraInfo.iTrustedUsage = NULL; WIMI_STAT callStatus = WIMI_GetCertificateInfo( aCert, &tempref, &ptLabel, &ptKeyID, /* Key Id (hash)*/ &ptCAID, &ptIssuerHash, &ptTrustedUsage, &uiCDFRefs, &usage, /* 0 = client, 1 = CA */ &type, &certlen, /* cert. content or URL length */ &modifiable); if ( callStatus == WIMI_Ok ) { free_WIMI_Ref_t( tempref ); WSL_OS_Free( ptLabel.pb_buf ); WSL_OS_Free( ptKeyID.pb_buf ); WSL_OS_Free( ptCAID.pb_buf ); WSL_OS_Free( ptIssuerHash.pb_buf ); CleanupPushWimBufL( ptTrustedUsage ); pushedItemCount++; TPtrC8 undecodedUsage; undecodedUsage.Set( ptTrustedUsage.pb_buf ); if ( ptTrustedUsage.ui_buf_length == 0 ) // No OIDs { found = EFalse; } // DECODE OIDs TASN1DecObjectIdentifier decoder; RPointerArray<HBufC> decodedOIDArray; CleanupResetAndDestroyPushL( decodedOIDArray ); pushedItemCount++; HBufC* decodedOIDs = NULL; TInt oidsLength = 0; // length of total OID buffer TInt err; for ( TInt position = 0; found; ) //Loop until no OIDs found anymore { if ( undecodedUsage.Length() > position ) //Don't go over buffer { TRAP( err, decodedOIDs = decoder.DecodeDERL( undecodedUsage, position ) ); if ( err == KErrNone ) //Found OID { CleanupStack::PushL( decodedOIDs ); if ( decodedOIDs->Length() ) { found = ETrue; decodedOIDArray.AppendL( decodedOIDs ); oidsLength += decodedOIDs->Length(); CleanupStack::Pop( decodedOIDs ); } else // Not found OID from buffer { found = EFalse; CleanupStack::PopAndDestroy( decodedOIDs ); } decodedOIDs = NULL; } else // Error in OID parsing -> Not found OID { found = EFalse; } } else // undecoded OID buffer seeked through { found = EFalse; } } _LIT( KDelimeter16, " " ); //Delimeter between OIDs TInt trustedUsagesBufMaxLength = oidsLength + decodedOIDArray.Count(); TPtr trustedUsage( NULL, 0, trustedUsagesBufMaxLength ); if ( oidsLength > 0 ) // OID's found { // Alloc new buffer for all OID's HBufC* trustedUsagesBuf = HBufC::NewLC( trustedUsagesBufMaxLength ); pushedItemCount++; trustedUsage.Set( trustedUsagesBuf->Des() ); // Add OID's to one buffer from separate buffers for ( TInt i = 0; i < decodedOIDArray.Count(); i++ ) { if ( i == 0 ) //First one { trustedUsage.Copy( decodedOIDArray[i]->Des() ); } else // Append other OIDs, with delimeter { trustedUsage.Append( KDelimeter16 ); trustedUsage.Append( decodedOIDArray[i]->Des() ); } } } TPckgBuf<TCertExtrasInfo> wimCertExtraPckg( certExtraInfo ); aMessage.ReadL( 1, wimCertExtraPckg ); wimCertExtraPckg().iCDFRefs = iWimUtilFuncs->MapCertLocation( uiCDFRefs ); if ( oidsLength > 0 ) // OID's found, write buffer to client { aMessage.WriteL( 3, trustedUsage ); } aMessage.WriteL( 1, wimCertExtraPckg ); CleanupStack::PopAndDestroy( pushedItemCount, ptTrustedUsage.pb_buf ); } }
void CTestStepESockSSA::KillC32Start() { // Start by looking for the running configurator and kill it if found. The caller // needs the appropriate capability to do this RDebug::Printf("Finding existing configurator process."); _LIT(KC32StartName, "*"); TInt result; TBool configuratorWasPresent; TInt count = 0; const TInt KMaxKillRetry = 10; do { configuratorWasPresent = EFalse; TFullName fn; TFindProcess fp(KC32StartName); while(fp.Next(fn) == KErrNone) { RProcess proc; result = proc.Open(fn); if(result == KErrNone) { TUidType type = proc.Type(); if(type[2] == TUid::Uid(KUidC32StartProcess) && proc.ExitType() == EExitPending) { // Kill the existing configurator process. RDebug::Print(_L("Opened existing configurator process \"%S\""), &fn); TRequestStatus status; proc.Logon(status); proc.Kill(KErrNone); RDebug::Printf("Killed process."); User::WaitForRequest(status); TExitType exitType = proc.ExitType(); // Create a timer in case some other entity holds an open handle on the // configurator which prevents the kernel from destroying it. We timeout // after one second. TAutoClose<RTimer> timer; if(timer.iObj.CreateLocal() == KErrNone) { // Request destruction notification so we know when it is safe to start // the process again. TRequestStatus destructionStatus; proc.NotifyDestruction(destructionStatus); proc.Close(); enum{ KProcessDestructionTimeout = 1000000 }; TRequestStatus timerStatus; timer.iObj.After(timerStatus, KProcessDestructionTimeout); // Wait for the process to be destroyed or for the timeout. User::WaitForRequest(destructionStatus, timerStatus); if(timerStatus.Int() == KRequestPending) { timer.iObj.Cancel(); User::WaitForRequest(timerStatus); } else { User::CancelMiscNotifier(destructionStatus); User::WaitForRequest(destructionStatus); RDebug::Printf("Existing configurator process has still not been destroyed after %f.0s", KProcessDestructionTimeout / 1000000.0); } } else { proc.Close(); } RDebug::Printf("Process logon completed with %d, exitType %d", status.Int(), exitType); configuratorWasPresent = ETrue; } else { proc.Close(); } } } } while(configuratorWasPresent && ++count < KMaxKillRetry); if (count >= KMaxKillRetry) { RDebug::Printf("KillC32Start - Cannot kill the configurator process, we will try continue and hope all is well"); } // Restart the boot sequence from scratch - the configurator reads this. RProperty::Set(KUidSystemCategory, KUidC32StartPropertyKey.iUid, EReset); }
/** * Creating 1000 contact item with all new fields * @return - void */ void CTestContactPerformanceStep::FieldPerformanceL() { TPtrC value, temp; _LIT(KTestDbName, "c:contactmultiple.cdb"); TInt readPos=0; TContactItemId id = 0; _LIT(KUpdate, "update"); _LIT(KDelete, "delete"); CleanupClosePushL(idArray); RArray<TPtrC> readValues; CleanupClosePushL(readValues); // get string value from ini file. GetStringFromConfig(ConfigSection(), KIniFieldAsstVal, temp); readValues.Append(temp); GetStringFromConfig(ConfigSection(), KIniFieldAsstTelVal, temp); readValues.Append(temp); GetStringFromConfig(ConfigSection(), KIniFieldSpouseVal, temp); readValues.Append(temp); GetStringFromConfig(ConfigSection(), KIniFieldChildVel, temp); readValues.Append(temp); GetStringFromConfig(ConfigSection(), KIniFieldClassVal, temp); readValues.Append(temp); GetStringFromConfig(ConfigSection(), KIniFieldDeptVal, temp); readValues.Append(temp); // get int val from ini file GetIntFromConfig(ConfigSection(), KIniYear, iYear); GetIntFromConfig(ConfigSection(), KIniMonth, iMonth); GetIntFromConfig(ConfigSection(), KIniDay, iDay); //replace existing database name dBase = CContactDatabase::ReplaceL(KTestDbName); //Get the number of contact item from ini file GetIntFromConfig(ConfigSection(), KNoOfContactItem, iNoOfCI); // Create contact item and add all fields to it for(TInt range=0; range<iNoOfCI; range++) { CContactItem* item = CContactCard::NewLC(); for(TInt noOfFields=0; noOfFields<7; noOfFields++) { CContactItemField* field = CContactItemField::NewL(iStorage[noOfFields], iFieldUid[noOfFields]); CleanupStack::PushL(field); field->SetMapping(iVcardUid[noOfFields]); if(iStorage[noOfFields]==KStorageTypeDateTime) { TDateTime date(iYear,(TMonth)iMonth,iDay,0,0,0,0); field->DateTimeStorage()->SetTime(date); } else { field->TextStorage()->SetTextL(readValues[readPos++]); } item->AddFieldL(*field); CleanupStack::Pop(field); } // add contact item to database id = dBase->AddNewContactL(*item); //Append the id into array idArray.Append(id); readPos=0; // Cleanup CleanupStack::PopAndDestroy(item); } dBase->CloseContactL(id); // verify for multiple contact item with all fields is being added readPos=0; CContactItem *readItem = NULL; for(TInt readContact=0; readContact<iNoOfCI; readContact++) { readItem = dBase->ReadContactLC(idArray[readContact]); for(TInt check=0; check<7; check++) { CContactItemFieldSet& ContactFieldSet = readItem->CardFields(); TInt pos = ContactFieldSet.Find(iFieldUid[check], iVcardUid[check]); if(pos != KErrNotFound) { if(iStorage[check]==KStorageTypeDateTime) { TDateTime result=ContactFieldSet[pos].DateTimeStorage()->Time().DateTime(); //compare the results if((result.Year() == iYear) && (result.Month() == (TMonth)iMonth) && (result.Day() == iDay)) { SetTestStepResult(EPass); } else { SetTestStepResult(EFail); } } else { value.Set(ContactFieldSet[pos].TextStorage()->Text()); //compare the results if(value.Compare(readValues[readPos++])==0 ) { SetTestStepResult(EPass); } else { SetTestStepResult(EFail); } } } } readPos=0; CleanupStack::PopAndDestroy(readItem); } CleanupStack::PopAndDestroy(&readValues); GetStringFromConfig(ConfigSection(), KIniFlagvalue, temp); if(KErrNone == temp.Compare(KUpdate)) { UpdatePerformanceL(); } else if(KErrNone == temp.Compare(KDelete)) { DeletePerformanceL(); } CleanupStack::PopAndDestroy(&idArray); delete dBase; }
//Check that XOR-MAPPED-ADDRESS is encoded correctly. void UT_CNATFWUNSAFMessage::TestEncodeMessageWithXorMappedAddrAttrL() { const TInt KMessageLength = 2 * CNATFWUNSAFAttribute::EValueOffset + CNATFWUNSAFXorMappedAddressAttribute::EAttributeValueSizeIPv4 + CNATFWUNSAFXorMappedAddressAttribute::EAttributeValueSizeIPv6; const TUint8 KExpectedResult[] = { 0, 1, //UNSAF message type: Binding Request 0, KMessageLength, //Message length (one XOR-MAPPED-ADDRESS attribute) 0x21, 0x12, 0xa4, 0x42, //Magic cookie 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, //TransactionID //XOR-MAPPED-ADDRESS attribute with IPv4 address 0, 0x20, //type //length of value element 0, CNATFWUNSAFXorMappedAddressAttribute::EAttributeValueSizeIPv4, 0, //undefined CNATFWUNSAFAddressAttribute::KAddressFamilyIPv4, //family 0x31, 0x0f, //x-port 0x2b, 0x46, 0x23, 0xb3, //x-address //XOR-MAPPED-ADDRESS attribute with IPv6 address 0, 0x20, //type //length of value element 0, CNATFWUNSAFXorMappedAddressAttribute::EAttributeValueSizeIPv6, 0, //undefined CNATFWUNSAFAddressAttribute::KAddressFamilyIPv6, //family 0x32, 0xd6, //x-port 0x8b, 0xa3, 0xaa, 0x32, //x-address 0x60, 0x62, 0x28, 0x9b, 0xff, 0x66, 0x67, 0x58, 0x65, 0x7b, 0x85, 0x07 }; //Add first attribute _LIT(KAddr, "10.84.135.241"); _LIT8(KTransactionId, "abcdefghijkl"); TInetAddr addr; User::LeaveIfError(addr.Input(KAddr)); addr.SetPort(4125); TNATFWUNSAFTransactionID taID(KTransactionId); CNATFWUNSAFAttribute* attr = CNATFWUNSAFXorMappedAddressAttribute::NewLC(addr, taID); iMsg->AddAttributeL(attr); CleanupStack::Pop(attr); attr = NULL; //Add second attribute TIp6Addr ip6addr; ip6addr.u.iAddr8[0] = 0xaa; ip6addr.u.iAddr8[1] = 0xb1; ip6addr.u.iAddr8[2] = 0x0e; ip6addr.u.iAddr8[3] = 0x70; ip6addr.u.iAddr8[4] = 0x01; ip6addr.u.iAddr8[5] = 0x00; ip6addr.u.iAddr8[6] = 0x4b; ip6addr.u.iAddr8[7] = 0xff; ip6addr.u.iAddr8[8] = 0x9a; ip6addr.u.iAddr8[9] = 0x00; ip6addr.u.iAddr8[10] = 0x00; ip6addr.u.iAddr8[11] = 0x30; ip6addr.u.iAddr8[12] = 0x0c; ip6addr.u.iAddr8[13] = 0x11; ip6addr.u.iAddr8[14] = 0xee; ip6addr.u.iAddr8[15] = 0x6b; TInetAddr addrIPv6; addrIPv6.SetAddress(ip6addr); addrIPv6.SetPort(5060); attr = CNATFWUNSAFXorMappedAddressAttribute::NewLC(addrIPv6, taID); iMsg->AddAttributeL(attr); CleanupStack::Pop(attr); attr = NULL; //Create encoded message CBufBase* msg = iMsg->EncodeL(); CleanupStack::PushL(msg); EUNIT_ASSERT(CNATFWUNSAFMessage::EHeaderSize + KMessageLength == msg->Size()); CompareEncodedUNSAFMessageL(KExpectedResult, *msg); CleanupStack::PopAndDestroy(msg); }
//////////////////////////////////////////////////// //// INTIA CASE //////////////////////////////////////////////////// void T_PresenceWatcherListManagement::T_IndiaCase_L() { EUNIT_PRINT( _L("Presence notification subscribed list, Intia") ); BindL(); CXIMPTestContextWrapper* wrapper = iWrapperMgr->GetWrapperL( 0 ); MXIMPContext* presenceCtx = wrapper->GetContext(); CXIMPTestMessenger* messenger = wrapper->GetMessenger(); CXIMPTestListener* ctxObserver = CXIMPTestListener::NewL( presenceCtx ); CleanupStack::PushL( ctxObserver ); // << ctxObserver // Tell the protocol it should act normally messenger->SetNoError(); // Get the interfaces MPresenceFeatures* presFeat = wrapper->GetPresenceFeatures(); MPresencePublishing& presPub = presFeat->PresencePublishing(); MPresentityGroups& presGroups = presFeat->PresentityGroups(); MPresenceWatching& presWatch = presFeat->PresenceWatching(); MXIMPObjectFactory& objFactory = presenceCtx->ObjectFactory(); _LIT( KGroupId, "rakesh.harsh/Friends" ); _LIT( KGroupDisplayName, "my_friend" ); _LIT( KMemberId1, "user1" ); _LIT( KMember1DisplayName, "user1DisplayName" ); _LIT( KMemberId2, "user2" ); _LIT( KMember2DisplayName, "user2DisplayName" ); // Create test variables MXIMPIdentity* testGroupId = objFactory.NewIdentityLC(); // << testGroupId testGroupId->SetIdentityL( KGroupId ); MXIMPIdentity* member1 = objFactory.NewIdentityLC(); // << member1 member1->SetIdentityL( KMemberId1 ); MXIMPIdentity* member2 = objFactory.NewIdentityLC(); // << member2 member2->SetIdentityL( KMemberId2 ); ////////////////////////////////////////////////////////////////////////// // SUBSCRIBE PRESENTITY GROUP LIST ////////////////////////////////////////////////////////////////////////// // Setup status event listener for RequestComplete TXIMPRequestId reqId; ctxObserver->Reset(); CXIMPRequestCompleteEventImp* evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId );// << evReqComplete ctxObserver->ExpectL( evReqComplete ); CleanupStack::Pop( evReqComplete ); // >> evReqComplete SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // subscribe PresentityGroupList reqId = presGroups.SubscribePresentityGroupListL(); // Wait for events on the request wrapper->WaitRequestAndStackEvents( reqId ); wrapper->VerifyEventStackL( _L8("Subscribing presentity group list, complete with error: ") ); // verify that SubscribePresentityGroupListL was called messenger->AssertSubscribePresentityGroupListCalled( ETrue ); // get list request /* TXIMPRequestId req = presGroups.SubscribePresentityGroupListL(); ctxObserver->WaitOpToCompleteL( req ); CUserAfter::AfterL( 1000000 ); */ ////////////////////////////////////////////////////////////////////////// // SUBSCRIBE PRESENTITY GROUP CONTENT ////////////////////////////////////////////////////////////////////////// // Setup status event listener for RequestComplete ctxObserver->Reset(); evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); ctxObserver->ExpectL( evReqComplete ); CleanupStack::Pop( evReqComplete ); SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); // subscribe group content reqId = presGroups.SubscribePresentityGroupContentL( *testGroupId ); // Wait for events on the request wrapper->WaitRequestAndStackEvents( reqId ); wrapper->VerifyEventStackL( _L8("Subscribe presentity group content, complete with error: ") ); COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupContentCalled, "SubscribeGroupContentL was not called", ETrue, NULL ); /* TInt count = ctxObserver->gidcount; // List manage request for(TInt i = 0; i<count;i++) { //get the content of the lists MXIMPIdentity* tgid = objFactory.NewIdentityLC(); tgid->SetIdentityL( ctxObserver->gid[i] ); // tgid->SetIdentityL( _L("rakesh.harsh/[email protected]") ); TXIMPRequestId req = presGroups.SubscribePresentityGroupContentL( *tgid ); ctxObserver->WaitOpToCompleteL( req ); CleanupStack::PopAndDestroy( 1 ); // tgid } */ ////////////////////////////////////////////////////////////////////////// // CREATE PRESENTITY GROUP ///////////////////////////////////////////////////////////////////////// // Setup status event listener for RequestComplete // This will also produce HandlePresentityGroupListEvent, since the // the group is subscribed ctxObserver->Reset(); evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); ctxObserver->ExpectL( evReqComplete ); CleanupStack::Pop( evReqComplete );//TODO??? SetupListenerReqCompleteAllowEventsL( wrapper, EXIMPTestStatusEvents_RequestOk ); // Create group reqId = presGroups.CreatePresentityGroupL( *testGroupId, KGroupDisplayName ); // Wait for events on the request wrapper->WaitRequestAndStackEvents( reqId ); wrapper->VerifyEventStackL( _L8("CreatePresentityGroupL failed, complete with error: ") ); // verify that SubscribePresentityGroupListL was called messenger->AssertCreatePresentityGroupCalled( ETrue ); // first make a test group in our roster /* MXIMPIdentity* newGroupId = objFactory.NewIdentityLC();//1 newGroupId->SetIdentityL( _L("rakesh.harsh/Friends") ); req = presGroups.CreatePresentityGroupL( *newGroupId,_L("my_friend") ); // wait completion ctxObserver->WaitOpToCompleteL( req ); CUserAfter::AfterL( 1000000 );*/ ////////////////////////////////////////////////////////////////////////// // ADD PRESENTITY GROUP MEMBER ////////////////////////////////////////////////////////////////////////// // Setup event listener for RequestComplete ctxObserver->Reset(); evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); // << evReqComplete // group id CXIMPIdentityImp* grid = CXIMPIdentityImp::NewLC( testGroupId->Identity() ); // << grid evReqComplete->AppendParamL( grid ); CleanupStack::Pop(); // >> grid // id for member info CXIMPIdentityImp* miId = CXIMPIdentityImp::NewLC( KMemberId1 ); // << miId // member info CPresentityGroupMemberInfoImp* memInfoImp = CPresentityGroupMemberInfoImp::NewLC( *miId, KMember1DisplayName ); // << memInfoImp evReqComplete->AppendParamL( memInfoImp ); CleanupStack::Pop(); // memInfoImp owned by AppendParamL // >> memInfoImp CleanupStack::PopAndDestroy( miId ); // copy was made // >>> miId ctxObserver->ExpectL( evReqComplete ); CleanupStack::Pop( evReqComplete ); // >> evReqComplete // do the call reqId = presGroups.AddPresentityGroupMemberL( *testGroupId, *member1, KMember1DisplayName ); // Wait for events on the request wrapper->WaitRequestAndStackEvents( reqId ); messenger->AssertAddPresentityGroupMemberCalled( ETrue ); //add a member /* MXIMPIdentity* testContactId = objFactory.NewIdentityLC(); testContactId->SetIdentityL( _L("mukesh") ); req = presGroups.AddPresentityGroupMemberL( *newGroupId, *testContactId, _L("h2") ); // wait completion ctxObserver->WaitOpToCompleteL( req ); CUserAfter::AfterL( 1000000 );*/ ////////////////////////////////////////////////////////////////////////// // ADD PRESENTITY GROUP MEMBER ////////////////////////////////////////////////////////////////////////// // Setup event listener for RequestComplete ctxObserver->Reset(); evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); // << evReqComplete // group id CXIMPIdentityImp* grid2 = CXIMPIdentityImp::NewLC( testGroupId->Identity() ); evReqComplete->AppendParamL( grid2 ); CleanupStack::Pop(); // grid2 // id for member info CXIMPIdentityImp* miId2 = CXIMPIdentityImp::NewLC( KMemberId2 ); // member info CPresentityGroupMemberInfoImp* memInfoImp2 = CPresentityGroupMemberInfoImp::NewLC( *miId2, KMember2DisplayName ); evReqComplete->AppendParamL( memInfoImp2 ); CleanupStack::Pop(); // memInfoImp owned by AppendParamL CleanupStack::PopAndDestroy( miId2 ); // copy was made ctxObserver->ExpectL( evReqComplete ); CleanupStack::Pop( evReqComplete ); // reset the variable messenger->SetValueFor( EXIMPPlgTestAddPresentityGroupMemberCalled, 0 ); // do the call reqId = presGroups.AddPresentityGroupMemberL( *testGroupId, *member2, KMember2DisplayName ); // Wait for events on the request wrapper->WaitRequestAndStackEvents( reqId ); messenger->AssertAddPresentityGroupMemberCalled( ETrue ); /* testContactId->SetIdentityL( _L("bb0") ); req = presGroups.AddPresentityGroupMemberL( *newGroupId, *testContactId, _L("b1") ); // wait completion ctxObserver->WaitOpToCompleteL( req ); */ ////////////////////////////////////////////////////////////////////////// // SUBSCRIBE PRESENTITY GROUP MEMBERS PRESENCE ////////////////////////////////////////////////////////////////////////// // Setup status event listener for RequestComplete ctxObserver->Reset(); evReqComplete = CXIMPRequestCompleteEventImp::NewLC( reqId ); ctxObserver->ExpectL( evReqComplete ); CleanupStack::Pop( evReqComplete ); SetupListenerReqCompleteL( wrapper, EXIMPTestStatusEvents_RequestOk ); // Set filter for the group MPresenceInfoFilter* gpif = presFeat->PresenceObjectFactory().NewPresenceInfoFilterLC(); gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KStatusMessage ); gpif->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAvatar ); // register interest reqId = presWatch.SubscribePresentityGroupMembersPresenceL( *testGroupId, *gpif ); CleanupStack::PopAndDestroy(); // >>> gpif // Wait for events on the request wrapper->WaitRequestAndStackEvents( reqId ); wrapper->VerifyEventStackL( _L8("Subscribe presentity group members, complete with error: ") ); // verify that UpdateInterest was called COMMONASSERT( messenger, EXIMPPlgTestSubscribePresentityGroupMembersPresesenceCalled, "SubscribePresentityGroupMembersPresenceL was not called", ETrue, NULL ); /* CUserAfter::AfterL( 1000000 ); MPresenceWatching& presWatch = presenceCtx->PresenceWatching(); MPresenceInfoFilter* infoFilt = objFactory.NewPresenceInfoFilterLC(); req = presWatch.SubscribePresentityGroupMembersPresenceL( *newGroupId, *infoFilt ); // wait completion ctxObserver->WaitOpToCompleteL( req ); // req = presWatch.SubscribePresentityPresenceL( *testContactId, *infoFilt ); // wait completion // ctxObserver->WaitOpToCompleteL( req ); //MXIMPClient* presClient1 = NULL; // MXIMPContext* presenceCtx1 = NULL; //CUSContextObserver* ctxObserver1 = NULL; /*TInt pushCount1 = DoSetupDefaultContext1LC( presClient1, presenceCtx1, ctxObserver1 ); ctxObserver->WaitOpToCompleteL( req );*/ // CUserAfter::AfterL( 60000000 ); //60 seconds /*if ( !iWait.IsStarted() ) { iWait.Start(); // CSI: 10 # iWait is not an active object } */ //code is for login with diff id //Initialize XIMP client /* #if 0 MXIMPClient* presClient1 = MXIMPClient::NewClientL(); CleanupDeletePushL( presClient ); //Create new sink to receive presence context events CUSContextObserver* eventObserver1 = CUSContextObserver::NewLC(); //Create new presence context MXIMPContext* presecenCtx1 = presClient->NewPresenceContextLC(); presecenCtx1->RegisterObserverL( *eventObserver1 ); //Bind context to desired presence service TUid protocolUid = TUid::Uid( KProtocolUid ); //Bind context to desired presence service req = presecenCtx1->BindToL( protocolUid, KServerAddress, KUserName2, KPassword2, KIAP ); //Wait with CActiveSchedulerWait the binding to complete //If binding fails, it is handled with leave eventObserver1->WaitOpToCompleteL( req ); MXIMPIdentity* newGroupId1 = objFactory.NewIdentityLC();//1 newGroupId1->SetIdentityL( _L("bb0/jaya") ); req = presGroups.CreatePresentityGroupL( *newGroupId1,_L("my_sweety") ); // wait completion ctxObserver->WaitOpToCompleteL( req ); CUserAfter::AfterL( 1000000 ); presecenCtx1->UnbindL(); eventObserver1->WaitOpToCompleteL( req ); CleanupStack::PopAndDestroy( 4 ); //newGroupId1,presecenCtx1,eventObserver1,presClient1 #endif*/ //code is for login with diff id end //add this user to bb0's contact list.i should recieve notification // delete group friend which is created above statement //req = presGroups.DeletePresentityGroupL( *newGroupId ); // wait completion // ctxObserver->WaitOpToCompleteL( req ); // CUserAfter::AfterL( 60000000 ); //Unbind the context and wait completion // req = presenceCtx->UnbindL(); // ctxObserver->WaitOpToCompleteL( req ); //Destroy the context (it is automaticly unbind) // CleanupStack::PopAndDestroy( 3 ); // infoFilt,testContactId,newGroupId // CleanupStack::PopAndDestroy( pushCount ); ////////////////////////////////////////////////////////////////////////// // SEND DATA FOR GROUP MEMBER -> HANDLE PRESENTITY PRESENCE ////////////////////////////////////////////////////////////////////////// // create test message CPresenceInfoImp* presenceInfo = CPresenceInfoImp::NewLC(); // << presenceInfo HBufC8* packedInfo = TXIMPObjectPacker< CPresenceInfoImp >::PackL( *presenceInfo ); CleanupStack::PopAndDestroy( presenceInfo );// >>> presenceInfo CleanupStack::PushL( packedInfo ); // << packedInfo CXIMPIdentityImp* changed = CXIMPIdentityImp::NewLC( ); // << changed changed->SetIdentityL( KMemberId1 ); HBufC8* packedId = TXIMPObjectPacker< CXIMPIdentityImp >::PackL( *changed ); CleanupStack::PopAndDestroy(); // >>> changed CleanupStack::PushL( packedId );// << packedId RPointerArray< HBufC8 > bufferArray; CleanupClosePushL( bufferArray ); // << bufferArray bufferArray.AppendL( packedId ); bufferArray.AppendL( packedInfo ); HBufC8* packedBufferArray = TXIMPHBuf8Packer::PackArrayL( bufferArray ); CleanupStack::PopAndDestroy( 2 ); // >>> packedId, packedInfo CleanupStack::PopAndDestroy(); // >>> bufferArray CleanupStack::PushL( packedBufferArray ); // << packedBufferArray // Send it to plugin CXIMPTestFileSrvMsg* srvMsg = CXIMPTestFileSrvMsg::NewL( CXIMPTestFileSrvMsg::ETestSrvMsgPresentityPresence, *packedBufferArray ); CleanupStack::PopAndDestroy( packedBufferArray ); // >>> packedBufferArray CleanupStack::PushL( srvMsg ); // << srvMsg wrapper->FileTool().SrvMsgStoreL( srvMsg ); CleanupStack::PopAndDestroy( srvMsg ); // >>> srvMsg wrapper->FileTool().CleanAllL(); // Wait for server to handle srvmsg. User::After( 4 * 1000000 ); COMMONASSERT( messenger, EXIMPPlgTestHandlePresentityPresenceCalled, "HandlePresentityPresenceL was not called", ETrue, NULL ); CleanupStack::PopAndDestroy( 3 ); // >>> testGroupId, member1, member2 CleanupStack::PopAndDestroy( ctxObserver ); // >>> ctxObserver UnbindL(); }
//---------------------------------------------------------------------------------------- LOCAL_C void CheckBioness(TInt aTestNumber) //---------------------------------------------------------------------------------------- { HBufC* commentText = HBufC::NewLC(100); testUtils->TestStart( aTestNumber, _L("Check Bioness...")); // Check if message is bio CBIODatabase* bioDB = CBIODatabase::NewL(gFs); CleanupStack::PushL( bioDB ); TUid bioMsgId; gTest.Printf(_L("Searching if this data type is a BIO Message\n")); (commentText->Des()).Format(_L("Searching if this data type is a BIO Message")); testUtils->WriteComment(commentText->Des()); TBioMsgId bioMessageData; bioMessageData.iType= KId0Type; bioMessageData.iConfidence= KId0Confidence; bioMessageData.iText= KId0Text; bioMessageData.iPort= KId0Port; bioMessageData.iCharacterSet= KId0CharacterSet; bioMessageData.iGeneralIdData= KId0GeneralIdData; if (bioDB->IsBioMessageL(bioMessageData, bioMsgId)) { gTest.Printf(_L("This is a BIO Message\n")); } else { gTest.Printf(_L("This is not a BIO Message\n")); } bioMessageData.iType= KId3Type; bioMessageData.iConfidence= KId3Confidence; bioMessageData.iText= KId3Text; bioMessageData.iPort= KId3Port; bioMessageData.iCharacterSet= KId3CharacterSet; bioMessageData.iGeneralIdData= KId3GeneralIdData; if (bioDB->IsBioMessageL(bioMessageData, bioMsgId)) { gTest.Printf(_L("This is a BIO Message\n")); } else { gTest.Printf(_L("This is not a BIO Message\n")); } bioMessageData.iText= _L("text/X-vCard"); if (bioDB->IsBioMessageL(bioMessageData, bioMsgId)) { gTest.Printf(_L("This is a BIO Message\n")); } else { gTest.Printf(_L("This is not a BIO Message\n")); } bioMessageData.iType = KId1Type; bioDB->IsBioMessageL(bioMessageData, bioMsgId); if (bioMsgId != KNullUid) gTest.Printf(_L("This is a BIO Message\n")); else gTest.Printf(_L("This is not a BIO Message\n")); TBioMsgIdText text = _L("//MLAP11"); _LIT(KIsBioFormat, "%S is a BIO Message with Uid: %D\n"); _LIT(KIsNotBioFormat, "%S is NOT a BIO Message\n"); bioDB->IsBioMessageL(EBioMsgIdNbs, text, 0, bioMsgId); if (bioMsgId != KNullUid) gTest.Printf(KIsBioFormat, &text, bioMsgId); else gTest.Printf(KIsNotBioFormat, &text); text = _L("Some Bogus Text"); bioDB->IsBioMessageL(EBioMsgIdWapSecure, text, 9, bioMsgId); if (bioMsgId != KNullUid) gTest.Printf(KIsBioFormat, &text, bioMsgId ); else gTest.Printf(KIsNotBioFormat, &text); TBuf<KMaxBioIdText*2> testBuf; testBuf.Fill('a', KMaxBioIdText*2); bioDB->IsBioMessageL(EBioMsgIdWapSecure, testBuf, 9, bioMsgId); if (bioMsgId != KNullUid) gTest.Printf(KIsBioFormat, &text, bioMsgId ); else gTest.Printf(KIsNotBioFormat, &text); CleanupStack::PopAndDestroy(); // bioDB CleanupStack::PopAndDestroy(); // commentText testUtils->TestFinish( aTestNumber,0 ); }
void CImSmtpSession::DoStateL() // performs the operation required by iState { switch (iState) { case EConnectingToSmtp: iEsmtpSpokenHere = EFalse; i8BitMimeAcceptedHere = EFalse; iSizeAcceptedHere = EFalse; iStartTlsAcceptedHere = EFalse; if(iSettings.SSLWrapper()) { // Open secure socket on port 465 for SMTP session iSocket->SSLQueueConnectL(iStatus, iSettings.ServerAddress(), iSettings.Port(), iSettings.IapPrefs(), iSettings.TlsSslDomain()); } else { // Open socket on port 25 for SMTP session iSocket->QueueConnectL(iStatus, iSettings.ServerAddress(), iSettings.Port(), iSettings.IapPrefs(), iSettings.TlsSslDomain()); } MOBILITY_TEST_MTM_STATE(iServiceId, KMobilityTestMtmStateSmtpConnectingToSmtp); break; case EWaitingForReply: iSocketIsConnected=ETrue; iSocket->QueueReceiveNextTextLine(iStatus); MOBILITY_TEST_MTM_STATE(iServiceId, KMobilityTestMtmStateSmtpWaitingForReply); break; case EAuthorisingSmtp: { TBuf8<KImskIPAddressLen> address; GetIpAddress(address); if(iRetryAuthWithHostname) { // Try sending a text string hostname instead of IP address _LIT(KDefaultNameString, "localhost"); address.Copy(KDefaultNameString); } if (iThisSession!=ESmtpSession) iSmtpBuffer.Format(KSmtpEhloCommand,&address); else iSmtpBuffer.Format(KSmtpHeloCommand,&address); iSocket->SendQueueReceive(iStatus, iSmtpBuffer); MOBILITY_TEST_MTM_STATE(iServiceId, KMobilityTestMtmStateSmtpAuthorisingSmtp); break; } case EAuthInProgress: { iSmtpAuthHelper->GetNextClientMessageL(iSmtpBuffer); iSocket->SendQueueReceive(iStatus, iSmtpBuffer); MOBILITY_TEST_MTM_STATE(iServiceId, KMobilityTestMtmStateSmtpAuthInProgress); break; } case ESendingStarttls: { // User has chosen to use Tls - send the STARTTLS cmd. iSocket->SetSSLTLSResponseL(KSmtpTlsResponse); iSocket->SendQueueReceive(iStatus, KSmtpStartTlsCommand()); MOBILITY_TEST_MTM_STATE(iServiceId, KMobilityTestMtmStateSmtpSendingStartTls); break; } case ESettingSecurity: { // Reset the Auth profiles and flags. i8BitMimeAcceptedHere = EFalse; iSizeAcceptedHere = EFalse; iStartTlsAcceptedHere = EFalse; iSupportedAuthProfiles = ENone; // Set Security, send a NOOP // and then queues asynch read request for a response // from the remote SMTP server. TBuf8<KImskIPAddressLen> address; GetIpAddress(address); iSmtpBuffer.Format(KSmtpEhloCommand, &address); iSocket->SendQueueReceive(iStatus,iSmtpBuffer); MOBILITY_TEST_MTM_STATE(iServiceId, KMobilityTestMtmStateSmtpSettingSecurity); break; } case ESendingImail: // send one Imail message SendFileL(); break; case ELogDataEvent: { if (iLogMessage) { const TInt logError = iServerEntry.Entry().iError; if (logError == KErrNone) { TBuf<KLogMaxStatusLength> status; if (iLogMessage->GetString(status, R_LOG_DEL_SENT) == KErrNone) iLogMessage->LogEvent().SetStatus(status); } iLogMessage->Start(logError, iStatus); } else { TRequestStatus* status = &iStatus; User::RequestComplete(status, KErrNone); } break; } case EResetSmtp: iSocket->SendQueueReceive(iStatus, KSmtpResetCommand()); MOBILITY_TEST_MTM_STATE(iServiceId, KMobilityTestMtmStateSmtpResetSmtp); break; case EClosingSmtp: //finished running - end SMTP session iSocket->SendQueueReceive(iStatus, KSmtpQuitCommand()); MOBILITY_TEST_MTM_STATE(iServiceId, KMobilityTestMtmStateSmtpClosingSmtp); break; default: // Unknown state gPanic(EImsmBadSessionState); break; } SetActive(); }
void PanicAppServerClient(const RMessagePtr2& aMessage,TInt aPanic) { _LIT(KPanic,"ApaAppServer"); aMessage.Panic(KPanic,aPanic); }
void CTestStepESockSSA::DoDataThreadL(TDataThreadControl& aControl) { User::LeaveIfError(aControl.iSession.Connect()); // Wait for blocker to start blocking; we can then create an IP socket as it will have already loaded RProperty blockProp; TInt err = blockProp.Attach(TBlockerSID, CBlockerChannelHandler::EBlockingStateKey); if(err == KErrNone) { TRequestStatus status; do { blockProp.Subscribe(status); TInt blockState; err = blockProp.Get(blockState); if(err != KErrNone || blockState >= CBlockerChannelHandler::EStateBlocking) { blockProp.Cancel(); } User::WaitForRequest(status); } while(status == KErrNone); blockProp.Close(); } switch(aControl.iRequest) { case TDataThreadControl::ESocketOpen: { RSocket sock; User::LeaveIfError(sock.Open(aControl.iSession, KAfInet, KSockDatagram, KProtocolInetUdp)); sock.Close(); aControl.iBlocked = ETrue; aControl.iBlockSemaphore.Signal(1); aControl.iResult = sock.Open(aControl.iSession, KDummyOneName); // should block sock.Close(); break; } case TDataThreadControl::EHostResolverOpen: { RHostResolver hr; hr.Open(aControl.iSession, KAfInet, KProtocolInetUdp); hr.Close(); aControl.iBlocked = ETrue; aControl.iBlockSemaphore.Signal(1); aControl.iResult = hr.Open(aControl.iSession, KDummyAddrFamily, KDummyOne); // should block hr.Close(); break; } case TDataThreadControl::EHostResolverOpenMulti: { RHostResolver hr; aControl.iBlocked = ETrue; aControl.iBlockSemaphore.Signal(1); aControl.iResult = hr.Open(aControl.iSession, KDummyAddrFamily, KDummyOne); // should block hr.Close(); break; } case TDataThreadControl::EServiceResolverOpen: { RServiceResolver sr; sr.Open(aControl.iSession, KAfInet, KSockDatagram, KProtocolInetUdp); sr.Close(); aControl.iBlocked = ETrue; aControl.iBlockSemaphore.Signal(1); aControl.iResult = sr.Open(aControl.iSession, KDummyAddrFamily, KSockDatagram, KDummyOne); // should block sr.Close(); break; } case TDataThreadControl::ENetDBOpen: { RNetDatabase ndb; ndb.Open(aControl.iSession, KAfInet, KProtocolInetUdp); ndb.Close(); aControl.iBlocked = ETrue; aControl.iBlockSemaphore.Signal(1); aControl.iResult = ndb.Open(aControl.iSession, KDummyAddrFamily, KDummyOne); // should block ndb.Close(); break; } case TDataThreadControl::ENumProtocols: { TUint numOfProtocols; aControl.iBlocked = ETrue; aControl.iBlockSemaphore.Signal(1); aControl.iResult = aControl.iSession.NumProtocols(numOfProtocols); // should block break; } case TDataThreadControl::EGetProtocolInfo: { TUint absentIndex = 99; TProtocolDesc protocolDesc; RHostResolver hr; hr.Open(aControl.iSession, KAfInet, KProtocolInetUdp); hr.Close(); aControl.iBlocked = ETrue; aControl.iBlockSemaphore.Signal(1); aControl.iResult = aControl.iSession.GetProtocolInfo(absentIndex, protocolDesc); // should block break; } case TDataThreadControl::EFindProtocol: { _LIT(KAbsentProtocolName,"NoSuchProtocol"); TProtocolDesc protocolDesc; RHostResolver hr; hr.Open(aControl.iSession, KAfInet, KProtocolInetUdp); hr.Close(); aControl.iBlocked = ETrue; aControl.iBlockSemaphore.Signal(1); aControl.iResult = aControl.iSession.FindProtocol(KAbsentProtocolName(), protocolDesc); // should block break; } default: ASSERT(0); } }
/** GetObjectHandles request handler */ void CMTPGetObjectHandles::ServiceL() { OstTraceFunctionEntry0( CMTPGETOBJECTHANDLES_SERVICEL_ENTRY ); if(iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted) { TUint storageId = Request().Uint32(TMTPTypeRequest::ERequestParameter1); TUint handle = Request().Uint32(TMTPTypeRequest::ERequestParameter3); TUint enumerateState = iSingletons.DpController().StorageEnumerateState(storageId); if ( (enumerateState < CMTPDataProviderController::EEnumeratingPhaseOneDone) || (enumerateState != CMTPDataProviderController::EEnumeratedFulllyCompleted && handle != KMTPHandleAll)) { if (iTimeoutCount++ >= KMTPGetObjectHandlesTimeOut) { OstTrace0( TRACE_NORMAL, CMTPGETOBJECTHANDLES_SERVICEL, "Wait for enumeration time out, return busy." ); SendResponseL(EMTPRespCodeDeviceBusy); iTimeoutCount = 0; OstTraceFunctionExit0( CMTPGETOBJECTHANDLES_SERVICEL_EXIT ); return; } else { OstTrace0( TRACE_NORMAL, DUP1_CMTPGETOBJECTHANDLES_SERVICEL, "Enumeration not completed, suspend request." ); RegisterPendingRequest(20); OstTraceFunctionExit0( DUP1_CMTPGETOBJECTHANDLES_SERVICEL_EXIT ); return; } } } iTimeoutCount = 0; delete iHandles; iHandles = NULL; iHandles = CMTPTypeArray::NewL(EMTPTypeAUINT32); OstTraceExt2( TRACE_NORMAL, DUP2_CMTPGETOBJECTHANDLES_SERVICEL, "IsConnectMac = %d; ERequestParameter2 = %d", iDevDpSingletons.DeviceDataStore().IsConnectMac(), Request().Uint32(TMTPTypeRequest::ERequestParameter2)); if(iDevDpSingletons.DeviceDataStore().IsConnectMac() &&(KMTPFormatsAll == Request().Uint32(TMTPTypeRequest::ERequestParameter2))) { OstTrace0( TRACE_NORMAL, DUP3_CMTPGETOBJECTHANDLES_SERVICEL, "ConnectMac and Fetch all." ); HandleObjectHandlesUnderMacL(*iHandles); } else { RMTPObjectMgrQueryContext context; RArray<TUint> handles; CleanupClosePushL(context); CleanupClosePushL(handles); TMTPObjectMgrQueryParams params(Request().Uint32(TMTPTypeRequest::ERequestParameter1), Request().Uint32(TMTPTypeRequest::ERequestParameter2), Request().Uint32(TMTPTypeRequest::ERequestParameter3)); do { iFramework.ObjectMgr().GetObjectHandlesL(params, context, handles); TUint32 storageId = Request().Uint32(TMTPTypeRequest::ERequestParameter1); TUint32 parentHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter3); if ( storageId != KMTPStorageAll && parentHandle == KMTPHandleNoParent ) { const CMTPStorageMetaData& storage(iFramework.StorageMgr().StorageL(storageId)); HBufC* StorageSuid = storage.DesC(CMTPStorageMetaData::EStorageSuid).AllocL(); RBuf suid; suid.CleanupClosePushL(); suid.CreateL(KMaxFileName); suid = *StorageSuid; _LIT(WMPInfoXml,"WMPInfo.xml"); suid.Append(WMPInfoXml); TUint32 handle = iFramework.ObjectMgr().HandleL(suid); if ( handle != KMTPHandleNone ) { TInt index = handles.Find(handle); if ( index != KErrNotFound ) { handles.Remove(index); handles.InsertL(handle,0); } } delete StorageSuid; StorageSuid = NULL; CleanupStack::PopAndDestroy(); } iHandles->AppendL(handles); } while (!context.QueryComplete()); CleanupStack::PopAndDestroy(&handles); CleanupStack::PopAndDestroy(&context); } SendDataL(*iHandles); OstTraceFunctionExit0( DUP2_CMTPGETOBJECTHANDLES_SERVICEL_EXIT ); }
TInt E32Main() { __UHEAP_MARK; UserSvr::WsRegisterThread(); RThread thread; // Set wserv's main thread to system permanent TInt err; err = User::SetCritical(User::ESystemPermanent); if (err!=KErrNone) { WS_PANIC_ALWAYS(EWsPanicFailedToSetThread); } // If in the future wserv becomes multi-threaded, // we can uncomment the following lines to set any new threads to be system permanent as well. // err = User::SetProcessCritical(User::ESystemPermanent); // if (err!=KErrNone) // { // WS_PANIC_ALWAYS(EWsPanicFailedToSetProcess); // } thread.SetPriority(EPriorityMore); err = User::RenameThread(KWSERVThreadName); if (err==KErrNone) { thread.Close(); } else { return err; } CTrapCleanup* CleanUpStack=CTrapCleanup::New(); TRAP(err, WsIniFile = CIniFile::NewL()); if (err!=KErrNone) { WS_PANIC_ALWAYS(EWsPanicFailedToInitialise); } _LIT(KMemLeakCheck, "MEMLEAKCHECK"); if (WsIniFile->FindVar(KMemLeakCheck)) { RDebug::Printf("The Memory Leak Check is Enabled => ECOM plugins are preload"); CWsPluginManager* pm = NULL; TRAP(err,pm = CWsPluginManager::NewL()); delete pm; if (err!=KErrNone) { WS_PANIC_ALWAYS(EWsPanicFailedToInitialise); } } // Define properties for singleton callbacks. This must only be done ONCE // to ensure the properties can't be hijacked. gReleaseSingletonsOnExit = ETrue; DefineSingletonKey(KOpenWfcInteropCleanupKey); DefineSingletonKey(KOpenWfcImplCleanupKey); TInt startCount; do { User::Heap().__DbgMarkStart(); startCount=User::Heap().Count(); TRAP(err,CWsTop::RunServerL()); if (err!=KErrNone) { WS_PANIC_ALWAYS(EWsPanicFailedToInitialise); } UserSvr::ReleaseEventHook(); } while (CWsTop::NeedsHeapCheckAndRestart(startCount)); REComSession::FinalClose(); // Now we can unload the plugins' dlls delete WsIniFile; delete CleanUpStack; __UHEAP_MARKEND; return(err); }
const TDesC& CTestCase2::TestCaseName() const { _LIT(KTxtTitle, "Test Case 2"); return KTxtTitle(); }
void CWsTop::InitStaticsL() { iShuttingDown=EFalse; // By default shell should be started. TBool startShell = ETrue; iCurrentFocusScreen = 0; // The windows server has been invoked. // This may have been from the system starter (via a // start up rss file) // This block looks for a "-NoShell" argument in the invocation. // The existence of the argument means that shell does not need to be // invoked from here because the new system starter // is in charge, and it will do it if required. _LIT(KNoShell,"-NOSHELL"); TInt argLen = User::CommandLineLength(); if(argLen) { HBufC* arg = HBufC::NewLC(argLen); TPtr argPtr = arg->Des(); User::CommandLine(argPtr); argPtr.UpperCase(); if(KErrNotFound != argPtr.Find(KNoShell)) { // Don't start the shell. It will be started if required by // the system starter. startShell = EFalse; } CleanupStack::PopAndDestroy(arg); } TheActiveScheduler=new(ELeave) CWsActiveScheduler; CActiveScheduler::Install(TheActiveScheduler); // WsIniFile is already created (before E32Main's Loop) _LIT(KWSERVIniFileVarLogEnable,"LOGENABLE"); TInt loggingLevel; if (WsIniFile->FindVar(KWSERVIniFileVarLogEnable,loggingLevel)) { EnableLogging(EDoNotReloadWsIni); if (wsDebugLog) { wsDebugLog->SetLoggingLevel(loggingLevel); } } _LIT(KWSERVIniFileVarFadeEnable,"FADEDISABLE"); iFadeEnabled = !WsIniFile->FindVar(KWSERVIniFileVarFadeEnable); _LIT(KWSERVIniFileVarFinishEveryFlush,"FINISHEVERYFLUSH"); iFinishEveryFlush = WsIniFile->FindVar(KWSERVIniFileVarFinishEveryFlush); _LIT(KWSERVIniFileVarSwitchOffEvent,"IGNORESWITCHOFFEVENT"); iIgnoreSwitchOffEvent = WsIniFile->FindVar(KWSERVIniFileVarSwitchOffEvent); iPluginManager = CWsPluginManager::NewL(); // need to be constructed before iServer! iServer=CWindowServer::NewL(); CClick::InitStaticsL(); RProcess wservProc; if (!wservProc.DefaultDataPaged()) { iServer->SetPinClientDescriptors(ETrue); } User::LeaveIfError(FbsStartup()); User::LeaveIfError(RFbsSession::Connect()); User::LeaveIfError(iTimer.CreateLocal()); TWindowServerEvent::InitStaticsL(); CWsClient::InitStaticsL(); //------------------------------------------- User::LeaveIfError( HAL::Get( HAL::EDisplayNumberOfScreens, iNumberOfScreens ) ) ; // Check that the INI file matches the HAL WS_ASSERT_ALWAYS(WsIniFile->NumberOfScreens()<=iNumberOfScreens, EWsPanicScreenInformationError); iScreens = new (ELeave) CArrayPtrFlat<CScreen>( iNumberOfScreens ) ; // // now construct screens for as long as there is information TInt ii ; for ( ii = 0 ; ii < iNumberOfScreens ; ++ii ) { InitScreenL( ii ) ; } //--------------------------------------------- iCurrentFocusScreen = (*iScreens)[0] ; iServer->StartL(); CWsFontCache::CreateInstanceL(); CWsGc::InitStaticsL(); CPlaybackGc::InitStaticsL(); CWsSpriteBase::InitStaticsL(); CEventQueue::InitStaticsL(); // CWsAnimDll::InitStaticsL(); // TInt bootMode=0; _LIT(KWSERVIniFileVarReboot,"REBOOT"); WsIniFile->FindVar(KWSERVIniFileVarReboot,bootMode); if (bootMode>=0 && bootMode<=2) iShellBootMode=bootMode; // CWsBackedUpWindow::StaticInitL(); CWsRedrawMsgWindow::StaticInitL(); // TWsPointer::InitStaticsL(); iShellStarter=new (ELeave) CShellStarter; iShellStarter->ConstructL(); _LIT(KPreProcess,"REMOVEFADINGONFOCUSGAIN"); CWsWindowGroup::SetFocusGainPreprocessing(WsIniFile->FindVar(KPreProcess)); _LIT(KAbsFade,"ABSOLUTEFADING"); CWsClientWindow::SetAbsoluteFading(WsIniFile->FindVar(KAbsFade)); //Set the focus policy _LIT(KFocusPolicy,"MULTIFOCUSPOLICY"); if(WsIniFile->FindVar(KFocusPolicy)) { iMultiFocusPolicy = ETrue; } RProcess::Rendezvous(KErrNone); // Start the shell from here unless the 'NoShell' option has been // received indicating that the system starter will start the shell directly. if(startShell) { StartShell(); } UserSvr::WsRegisterSwitchOnScreenHandling(ETrue); iRenderOrientationTracker = CWsRenderOrienationTracker::NewL(); }
TVerdict CSimCallOOMTest::doTestStepL() { INFO_PRINTF1(_L("BeginCallOOMTest")); CreateConfigFileL(_L("c:\\config3.txt")); SetTestNumberL(0); TInt ret = iPhone.Open(iTelServer,KPhoneName); INFO_PRINTF2(_L("Result: %d"),ret); TESTL(ret == KErrNone); INFO_PRINTF1(_L("Opened phone object")); iTelServer.SetPriorityClient(); TESTL(iPhone.Initialise()==KErrNone); INFO_PRINTF1(_L("Opened phone object")); TESTL(iLine.Open(iPhone,KVoiceLineName)==KErrNone); INFO_PRINTF1(_L("Opened Line object")); TName callName; TESTL(iCall.OpenNewCall(iLine,callName)==KErrNone); INFO_PRINTF1(_L("Opened Call object")); iLine.Close(); iCall.Close(); TESTL(iLine.Open(iPhone,KVoiceLineName)==KErrNone); INFO_PRINTF1(_L("Opened Line object")); TName callName2; TInt error = iCall.OpenNewCall(iLine,callName2); TESTL(error==KErrNone); INFO_PRINTF1(_L("Opened Call object")); #ifdef _DEBUG TRequestStatus stat; TBool oomAvailable = EFalse; TInt failure(0); const TInt KMaxTests = 1000; _LIT(KEmergencyNo, "01632960000"); while (!oomAvailable && failure < KMaxTests) { INFO_PRINTF2(_L("Failing alloc %d. Making Call... "),failure); iTelServer.__DbgFailNext(failure); // Check that the heap is balanced at the same level before and // after all attempts at emergency call. iTelServer.__DbgMarkHeap(); iCall.DialEmergencyCall(stat, KEmergencyNo); User::WaitForRequest(stat); INFO_PRINTF2(_L("result=%d... "), stat.Int()); if (stat.Int()!=KErrNone) { INFO_PRINTF2(_L("Failing after %d Allocs"),failure); iTelServer.__DbgMarkEnd(0); } else { INFO_PRINTF2(_L("Passing after %d Allocs"),failure); } iTelServer.__DbgFailNextAvailable(oomAvailable); TInt ret = iCall.HangUp(); INFO_PRINTF2(_L("HangUp result=%d"), ret); if (ret!=KErrNone) { iCall.HangUp();//if hang up unsuceessfull call again without heap fail } // Test for the end of the test. Not perfect (doesn't demonstrate // that there wasn't an OOM situation that was handled quietly // such that the call/hangup still worked) but I think it's all we // can do. if ( stat!=KErrNone || ret!=KErrNone) { INFO_PRINTF3(_L("OOM testing complete. Call status is %d and hang-up return is %d"),stat.Int(),ret); break; } failure++; } // Resetting the heap to flush any FailNext there might be hanging around. iTelServer.__DbgFailNext(0); iCall.DialEmergencyCall(stat, KEmergencyNo);//use this to make the previous memory failure happen User::WaitForRequest(stat); iCall.HangUp(); // KMaxTests is used to stop the above while statement looping // indefinitely. If KMaxTests is reached then we can guess that something // has gone wrong and the test should be failed. TESTL(failure < KMaxTests); #else INFO_PRINTF1(_L("TestDisabled on release build")); #endif // _DEBUG INFO_PRINTF1(_L("Closing objects...")); iCall.Close(); iLine.Close(); iPhone.Close(); ASSERT(RThread().RequestCount()==0); return TestStepResult(); }
void CWsTop::EnableLogging(TReloadWsIni aSetting) { TInt errorLoc=0; if (wsDebugLog) { if (wsDebugLogLevel==CDebugLogBase::ELogEverything) { wsDebugLogLevel=CDebugLogBase::ELogImportant; wsDebugLog->SetLoggingLevel(wsDebugLogLevel); return; } DisableLogging(); } if(aSetting == EDoReloadWsIni) { CIniFile* temp = NULL; TRAPD(err, temp = CIniFile::NewL()); if(err == KErrNone) { //loading successful, replace the previous one delete WsIniFile; WsIniFile = temp; } } TPtrC dlog; _LIT(KWSERVDebugLogFileName,"DLOG"); TBuf<KMaxFileName> fname(KWSERVDebugLogFileName); _LIT(KWSERVIniFileVarLog,"LOG"); if (WsIniFile->FindVar(KWSERVIniFileVarLog,dlog) && dlog.Length()==2) { fname.Append(dlog); TInt err=iDebugLib.Load(fname); if (err==KErrNone) { TUidType uid=iDebugLib.Type(); if (uid[1]!=KWservLoggingDllUid) { err=KErrNotSupported; errorLoc=2; } else { TPtrC params; _LIT(KWSERVIniFileVarLogP,"LOGP"); if (!WsIniFile->FindVar(KWSERVIniFileVarLogP,params)) params.Set(NULL,0); CreateDebugLog func=(CreateDebugLog)iDebugLib.Lookup(1); if (func!=NULL) { TRAP(err,wsDebugLog=(*func)(iIsFirstLog, params)); if (err==KErrNone) { iIsFirstLog=EFalse; wsDebugLogLevel=CDebugLogBase::ELogEverything; } else errorLoc=4; } else errorLoc=3; } } else errorLoc=1; if (iCurrentFocusScreen) { TWindowServerEvent::ProcessErrorMessages(TWsErrorMessage::ELogging,(errorLoc<<8)-err); } } }
// --------------------------------------------------------- // CPosTp34::StartL // // (other items were commented in a header). // --------------------------------------------------------- // void CPosTp34::StartL() { _LIT(KInUseErr, "search is already running, StartLandmarksSearch should leave with error code KErrInUse"); iDatabase = UseGeneratedDbFileL(); if (iDatabase->IsInitializingNeeded()) { ExecuteAndDeleteLD(iDatabase->InitializeL()); } iLandmarkSearch = CPosLandmarkSearch::NewL(*iDatabase); CActiveLmOperation* activeLmOperation = new(ELeave) CActiveLmOperation(iLog);//1 CleanupStack::PushL(activeLmOperation); AppendSearchResultsL(); const TInt KSearchResultIndex1=1; const TInt KSearchResultIndex2=10; CPosLmTextCriteria* textCriteria1 = CPosLmTextCriteria::NewLC(); //2 textCriteria1->SetTextL(iSearchResults[KSearchResultIndex1]->TextCriteria()); textCriteria1->SetAttributesToSearch(iSearchResults[KSearchResultIndex1]->Attributes()); CPosLmTextCriteria* textCriteria2 = CPosLmTextCriteria::NewLC(); //3 textCriteria2->SetTextL(iSearchResults[KSearchResultIndex2]->TextCriteria()); textCriteria2->SetAttributesToSearch(iSearchResults[KSearchResultIndex2]->Attributes()); iOperation = iLandmarkSearch->StartLandmarkSearchL(*textCriteria1); activeLmOperation->Start(iOperation); TRAPD(err, iLandmarkSearch->StartLandmarkSearchL(*textCriteria2)); AssertTrueSecL(err == KErrInUse, KInUseErr); CActiveLmOperation* activeLmOperation2 = new(ELeave) CActiveLmOperation(iLog); CleanupStack::PushL(activeLmOperation2); //4 /// CPosLandmarkSearch* landmarkSearch2 = CPosLandmarkSearch::NewL(*iDatabase); CleanupStack::PushL(landmarkSearch2); //5 CPosLmOperation* lmo = landmarkSearch2->StartLandmarkSearchL(*textCriteria2); CleanupStack::PushL(lmo); //6 activeLmOperation2->Start(lmo); CActiveScheduler::Start(); CActiveScheduler::Start(); activeLmOperation->CheckOperationL(); delete iOperation; iOperation = NULL; activeLmOperation2->CheckOperationL(); CheckSearchResultL(*iSearchResults[KSearchResultIndex1], *iLandmarkSearch, *textCriteria1); CheckSearchResultL(*iSearchResults[KSearchResultIndex2], *landmarkSearch2, *textCriteria2); //CleanupStack::PopAndDestroy(5, activeSearch); CleanupStack::PopAndDestroy(6, activeLmOperation); }
// ---------------------------------------------------------------------------- // test ScreenClearer API // ---------------------------------------------------------------------------- // void CBCTestScreenClearerCase::TestL() { TBool blankAppStatusPane = ETrue; TPointerEvent pointerEvent; CAknLocalScreenClearer* screenclearernew1 = CAknLocalScreenClearer::NewLC(); _LIT( KScreenClearerNew11, "~CAknScreenClearerBase() test" ); AssertNotNullL( screenclearernew1, KScreenClearerNew11 ); _LIT( KScreenClearerNew12, "NewLC test" ); AssertNotNullL( screenclearernew1, KScreenClearerNew12 ); _LIT( KScreenClearerNew13, "ConstructL( 3 ) test for screenclearer:" ); AssertNotNullL( screenclearernew1, KScreenClearerNew13 ); screenclearernew1->HandleStatusPaneSizeChangeL(); _LIT( KScreenClearerNew14, "HandleStatusPaneSizeChangeL test" ); AssertNotNullL( screenclearernew1, KScreenClearerNew14 ); screenclearernew1->HandlePointerEventL( pointerEvent ); _LIT( KScreenClearerNew15, "HandlePointerEventL test" ); AssertNotNullL( screenclearernew1, KScreenClearerNew15 ); CleanupStack::PopAndDestroy( screenclearernew1 ); CAknLocalScreenClearer* screenclearernew2; screenclearernew2 = CAknLocalScreenClearer::NewLC( blankAppStatusPane ); _LIT( KScreenClearerNew21, "NewLC( TBool aBlankAppStatusPane) test" ); AssertNotNullL( screenclearernew2, KScreenClearerNew21 ); CleanupStack::PopAndDestroy( screenclearernew2 ); CAknLocalScreenClearer* screenclearernew3; screenclearernew3 = CAknLocalScreenClearer::NewL( blankAppStatusPane ); CleanupStack::PushL( screenclearernew3 ); _LIT( KScreenClearerNew22, "NewL( TBool aBlankAppStatusPane ) test" ); AssertNotNullL( screenclearernew3, KScreenClearerNew22 ); CleanupStack::PopAndDestroy( screenclearernew3 ); CEikSpacer* eikspacer1 = new( ELeave ) CEikSpacer; CleanupStack::PushL( eikspacer1 ); _LIT( KEikSpacer11, "CEikSpacer test for screenclearer:" ); AssertNotNullL( eikspacer1, KEikSpacer11 ); eikspacer1->SetWidth( KLength ); _LIT( KEikSpacer12, "SetWidth( TInt aWidth ) test" ); AssertNotNullL( eikspacer1, KEikSpacer12 ); eikspacer1->SetHeight( KLength ); _LIT( KEikSpacer13, "SetHeight( TInt aHeight ) test" ); AssertNotNullL( eikspacer1, KEikSpacer13 ); eikspacer1->SetColor( KRgbBlack ); _LIT( KEikSpacer14, "SetColor( TRgb aColor ) test" ); AssertNotNullL( eikspacer1, KEikSpacer14 ); eikspacer1->SetClear( ETrue ); _LIT( KEikSpacer15, "SetClear( TBool aClear ) test" ); AssertNotNullL( eikspacer1, KEikSpacer15 ); TPointerEvent pointerEvent2 = { TPointerEvent::EButton1Up, EModifierAutorepeatable, TPoint( 20, 20 ), TPoint( 0, 0 ) }; eikspacer1->HandlePointerEventL( pointerEvent2 ); _LIT( KHandlePointerEventL2, "HandlePointerEventL test" ); AssertNotNullL( eikspacer1, KHandlePointerEventL2 ); CleanupStack::PopAndDestroy( eikspacer1 ); CEikSpacer* eikspacer2; eikspacer2 = new( ELeave )CEikSpacer( KNum, KNum, KRgbBlack ); CleanupStack::PushL( eikspacer2 ); _LIT( KEikSpacer21, "CEikSpacer( 3 ) test" ); AssertNotNullL( eikspacer2, KEikSpacer21 ); _LIT( KEikSpacer22, "~CEikSpacer() test" ); AssertNotNullL( eikspacer2, KEikSpacer22 ); CleanupStack::PopAndDestroy( eikspacer2 ); }
// --------------------------------------------------------- // CPosTp26::DoLandmarkCategorySearch // // (other items were commented in a header). // --------------------------------------------------------- // void CPosTp26::DoLandmarkCategorySearchL(const RPointerArray<CCategorySearchResult>& aSearchResults) { _LIT(KNumOfMatchesErr, "No. of matches is incorrect when the search is performed"); _LIT(KNotFoundErr, "Id %d not found in parsed Lm search results when the search is performed syncronously"); _LIT(KWrongIdErr, "Wrong id returned from iterator after reset"); CPosLmCategoryManager* categoryManager = CPosLmCategoryManager::NewL(*iDatabase); CleanupStack::PushL(categoryManager); CPosLmCatNameCriteria* nameCriteria = CPosLmCatNameCriteria::NewLC(); // Use wildcard * as search pattern nameCriteria->SetSearchPatternL(aSearchResults[0]->TextCriteria()); ExecuteAndDeleteLD(iLandmarkSearch->StartCategorySearchL(*nameCriteria, CPosLmCategoryManager::ECategorySortOrderNone)); CPosLmItemIterator* iter = iLandmarkSearch->MatchIteratorL(); CleanupStack::PushL(iter); if ((TUint)(aSearchResults[0]->SearchResult()).Count() != iLandmarkSearch->NumOfMatches()) { _LIT(KExpected, "Expected no. of matches: %d"); _LIT(KReturned, "Returned no. of matches: %d"); TBuf<100> info; info.Format(KExpected, (aSearchResults[0]->SearchResult()).Count()); iLog->Log(info); info.Format(KReturned, iLandmarkSearch->NumOfMatches()); iLog->Log(info); iLog->Log(_L("Name criteria: ")); iLog->Log(nameCriteria->SearchPattern()); iLog->Log(KNumOfMatchesErr); User::Leave(-1); } // Get the first category in list, id1 TPosLmItemId id1 = iter->NextL(); CPosLandmarkCategory* cat = categoryManager->ReadCategoryLC(id1); TPtrC name; cat->GetCategoryName(name); iLog->Log(_L("First time")); iLog->Log(name); CleanupStack::PopAndDestroy(cat); //Reset iterator and make sure that id1 is returned again iter->Reset(); TPosLmItemId id11 = iter->NextL(); AssertTrueSecL(id1 == id11, KWrongIdErr); iLog->Log(_L("******************")); // Iterate through whole iterator while (id11 != KPosLmNullItemId) { AssertTrueSecL(aSearchResults[0]->FindSearchResult(id11), KNotFoundErr, id11); CPosLandmarkCategory* cat = categoryManager->ReadCategoryLC(id11); TPtrC name; cat->GetCategoryName(name); iLog->Log(name); CleanupStack::PopAndDestroy(cat); id11 = iter->NextL(); } iLog->Log(_L("******************")); RArray<TPosLmItemId> lmIdArray; CleanupClosePushL(lmIdArray); // Get a sequence of items from the iterated set // lmIdArray should be reset in GetItemIdsL // Use some magic numbers here, check landmarksDb.xls for more info iter->GetItemIdsL(lmIdArray, 5, 10); TInt nr = lmIdArray.Count(); for (TInt j=0;j<nr; j++) { AssertTrueSecL(aSearchResults[0]->FindSearchResult(lmIdArray[j]), KNotFoundErr); CPosLandmarkCategory* cat = categoryManager->ReadCategoryLC(lmIdArray[j]); TPtrC name; cat->GetCategoryName(name); iLog->Log(name); CleanupStack::PopAndDestroy(cat); } CleanupStack::PopAndDestroy(&lmIdArray); CleanupStack::PopAndDestroy(2, nameCriteria); CleanupStack::PopAndDestroy(categoryManager); }
void CCRMLDirectoryMonitor::IssueNotifyChange() { _LIT(KCRMLDirectory, "?:\\resource\\qt\\crml"); m_fs.NotifyChange(ENotifyFile, iStatus, KCRMLDirectory); SetActive(); }
/** * * DoTestStepL * This method tests the controllers reset function * */ TVerdict CTestStepResetController::DoTestStepL( void ) { __MM_HEAP_MARK; TVerdict result = EPass; _LIT( KTestPlay, "Reset Test"); Log( KTestPlay ); _LIT( KTestStepReset, "This test checks a controller reset"); Log( KTestStepReset ); // [ audio file to play ] _LIT(KTestWavFile, "newmail.wav"); SetReadFileNameL( KTestWavFile ); TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority); User::LeaveIfError( errorCode ); //[ok lets reset the controller from it initial state] errorCode = iController.Reset(); User::LeaveIfError( errorCode ); //[ search for reset event ] TMMFEvent resetEvent( KResetTestId, KErrNone); result = SearchForEvent( resetEvent ); if( result == EFail ) { return result; } //[ lets try a second reset ] errorCode = iController.Reset(); User::LeaveIfError( errorCode ); //[ search for reset event ] result = SearchForEvent( resetEvent ); if( result == EFail ) { return result; } //[ add data source and sink and prime the controller ] errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig()); User::LeaveIfError( errorCode ); errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8); User::LeaveIfError( errorCode ); //[ok lets reset the controller from it initial state] errorCode = iController.Reset(); User::LeaveIfError( errorCode ); //[ search for reset event ] result = SearchForEvent( resetEvent ); if( result == EFail ) { return result; } //[ lets try a second reset ] errorCode = iController.Reset(); User::LeaveIfError( errorCode ); //[ search for reset event ] result = SearchForEvent( resetEvent ); if( result == EFail ) { return result; } //[ add data source and sink and prime the controller ] errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig()); User::LeaveIfError( errorCode ); errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8); User::LeaveIfError( errorCode ); errorCode = iController.Prime(); User::LeaveIfError( errorCode ); // [ wait for and process the return event from the audio output ] TMMFEvent primeEvent( KPrimeTestId, KErrNone); result = SearchForEvent( primeEvent ); if( result == EFail ) { return result; } //[ lets reset again in the primed state ] errorCode = iController.Reset(); User::LeaveIfError( errorCode ); //[ search for reset event ] result = SearchForEvent( resetEvent ); if( result == EFail ) { return result; } // [ get back to primed state ] //[ add data source and sink and prime the controller ] errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig()); User::LeaveIfError( errorCode ); errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8); User::LeaveIfError( errorCode ); errorCode = iController.Prime(); User::LeaveIfError( errorCode ); result = SearchForEvent( primeEvent ); if( result == EFail ) { return result; } User::LeaveIfError( iController.Play() ); // note this test does not wait around // to detect that the audio has been played // [ now process the confirmation event that play has reached audio output // this is the raison detre of the test ] TMMFEvent playEvent( KPlayTestId, KErrNone ); result = SearchForEvent( playEvent ); if( result == EFail ) { return result; } //[ lets reset again in the primed state ] errorCode = iController.Reset(); User::LeaveIfError( errorCode ); //[ search for reset event ] result = SearchForEvent( resetEvent ); if( result == EFail ) { return result; } errorCode = iController.Reset(); User::LeaveIfError( errorCode ); //[ search for reset event ] result = SearchForEvent( resetEvent ); if( result == EFail ) { return result; } //[ ensure the controller is unloaded so that it does // not interfere with the following test ] // There is error in this code and the stop followed by reset // ensure the controller resources are released. iController.Stop(); iController.Reset(); iController.Close(); __MM_HEAP_MARKEND; // [test steps return a result] return result; }
const TDesC& CTTGPSLoggerCheckBoxSettingItem::SettingTextL() { _LIT(KText1Space, " "); return KText1Space; }
// Test step 19.5 const TDesC& CEsockTest19_5::GetTestName() { // store the name of this test case _LIT(ret,"Test19.5"); return ret; }
void CConsoleControl::ConstructL(const TRect& aClientRect) { iConsole=new(ELeave) CEikConsoleScreen; _LIT(KEikSec,"EikSec"); iConsole->ConstructL(KEikSec,aClientRect.iTl, aClientRect.Size(),0,EEikConsWinInPixels); }