landmarks/locationlandmarks/tsrc/LandmarkTestModule/src/FT_CPosTp12.cpp
branchRCL_3
changeset 44 2b4ea9893b66
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *   ?description_line
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 //  INCLUDES
       
    21 
       
    22 #include "FT_CPosTp12.h"
       
    23 #include <EPos_CPosLandmarkDatabase.h>
       
    24 #include <EPos_CPosLMCategoryManager.h>
       
    25 #include <EPos_CPosLandmarkCategory.h>
       
    26 #include <EPos_CPosLandmark.h>
       
    27 #include <EPos_CPosLMItemIterator.h>
       
    28 #include <EPos_TPosLMSortPref.h>
       
    29 #include <EPos_CPosLMPartialReadParameters.h>  
       
    30 #include <LbsPosition.h>
       
    31 #include <e32std.h>
       
    32 //#include <ss_std.h>
       
    33 #include <EPos_CPosLmTextCriteria.h>
       
    34 #include <EPos_CPosLmNearestCriteria.h>
       
    35 #include <EPos_CPosLmCompositeCriteria.h>
       
    36 #include <EPos_CPosLmCatNameCriteria.h>
       
    37 
       
    38 // CONSTANTS
       
    39 
       
    40 const TInt KNoLandmarksPanicCodes = 11;
       
    41 const TInt KTestCaseCategoryIterator = 0;
       
    42 const TInt KTestCaseLandmarkIterator = 1;
       
    43 
       
    44 const TInt KTestCasePartialAttributes1 = 2;
       
    45 const TInt KTestCasePartialAttributes2 = 3;
       
    46       
       
    47 const TInt KTestCaseSortPrefNoAttribute = 4;
       
    48 const TInt KTestCaseSortPrefSeveralAttribute = 5;
       
    49 
       
    50 const TInt KTestCaseNegativeMatches = 6;
       
    51 const TInt KTestCaseNegativeDistance = 7;
       
    52 const TInt KTestCaseNegativeRadius = 8;
       
    53 
       
    54 const TInt KTestCaseCompositeSearch1 = 9;
       
    55 const TInt KTestCaseCompositeSearch2 = 10;
       
    56 const TInt KTestCaseCompositeSearch3 = 11;
       
    57 const TInt KTestCaseCompositeSearch4 = 12;
       
    58 
       
    59 const TInt KTestCaseDuplicateNotifyDatabaseEvent = 13;
       
    60 
       
    61 const TInt KTestCaseIncorrectCompositeType1 = 14;
       
    62 const TInt KTestCaseIncorrectCompositeType2 = 15;
       
    63 const TInt KTestCaseIncorrectCompositeType3 = 16;
       
    64 const TInt KTestCaseIncorrectCompositeType4 = 17;
       
    65 
       
    66 const TInt KTestCaseInvalidOperationMode1 = 18;
       
    67 const TInt KTestCaseInvalidOperationMode2 = 19;
       
    68 const TInt KTestCaseInvalidOperationMode3 = 20;
       
    69 const TInt KTestCaseInvalidOperationMode4 = 21;
       
    70 
       
    71 const TInt KTestCaseInvalidAttributes1 = 22;
       
    72 const TInt KTestCaseInvalidAttributes2 = 23;
       
    73 
       
    74 const TInt KTestCaseCompositeSearch5 = 24;
       
    75 const TInt KTestCaseCompositeSearch6 = 25;
       
    76 const TInt KTestCaseCompositeSearch7 = 26;
       
    77 const TInt KTestCaseCompositeSearch8 = 26;
       
    78 
       
    79 const TInt KTestCaseCategoryIteratorSortPref = 27;
       
    80 const TInt KTestCaseReferencedCategoryIteratorSortPref = 28;
       
    81 
       
    82 const TInt KTestCaseCategorySearchSortPref = 29;
       
    83 const TInt KTestCaseLandmarkSortPref = 30;
       
    84 const TInt KTestCaseLandmarkSortPref2 = 31;
       
    85 const TInt KTestCaseLandmarkSearchinvalidAttribute = 32;
       
    86 const TInt KTestCaseLandmarkSearchinvalidAttribute2 = 33;
       
    87 
       
    88 const TInt KTestCaseInvalidRequestedPositionFields1 = 34;
       
    89 const TInt KTestCaseInvalidRequestedPositionFields2 = 35;
       
    90 
       
    91 const TInt KTestCaseZeroMatches = 36;
       
    92 
       
    93 const TInt KTestLandmarkSetIconTest1 = 37;
       
    94 const TInt KTestLandmarkSetIconTest2 = 38;
       
    95 const TInt KTestCategorySetIconTest1 = 41;
       
    96 const TInt KTestCategorySetIconTest2 = 42;
       
    97 
       
    98 _LIT(KResourceFilePath, "c:\\resource\\");
       
    99 _LIT(KResourceFile, "c:\\resource\\EPOSLMASYNCOPS.RSC");
       
   100 _LIT(KTempResourceFile, "c:\\resource\\TEMP_EPOSLMASYNCOPS.RSC");
       
   101 
       
   102 
       
   103 // ================= MEMBER FUNCTIONS =======================
       
   104 
       
   105 
       
   106 // ---------------------------------------------------------
       
   107 // CPosTp12::StartL
       
   108 //
       
   109 // (other items were commented in a header).
       
   110 // ---------------------------------------------------------
       
   111 //
       
   112 void CPosTp12::StartL()
       
   113     {    
       
   114     MakeSurePanicDebugFileExistsL();
       
   115     RemoveDefaultDbL();
       
   116 	TBuf<100> buf;
       
   117 
       
   118         
       
   119     for (TInt i=0; i<KNoLandmarksPanicCodes; i++)
       
   120         {
       
   121         iExpectedPanicCode = static_cast<TPositionLandmarksClientPanic>(i);
       
   122         buf.Format(_L("Expected Panic code %d"), iExpectedPanicCode);
       
   123         iLog->Log(buf);
       
   124         
       
   125         if (iExpectedPanicCode == EPosSpecifiedIntervalLiesOutsideIteratedSet)
       
   126             {
       
   127             iTestCase=KTestCaseCategoryIterator;
       
   128             ResumeThreadAndVerifyExit();
       
   129             iTestCase=KTestCaseLandmarkIterator;
       
   130             }
       
   131         else if (iExpectedPanicCode == EPosInvalidPartialReadParameters)
       
   132             {
       
   133             iTestCase=KTestCasePartialAttributes1;
       
   134             ResumeThreadAndVerifyExit();
       
   135             iTestCase=KTestCasePartialAttributes2;
       
   136             }
       
   137         else if (iExpectedPanicCode == EPosInvalidRequestedPositionFields)
       
   138             {
       
   139             iTestCase=KTestCaseInvalidRequestedPositionFields1;
       
   140             ResumeThreadAndVerifyExit();
       
   141             iTestCase=KTestCaseInvalidRequestedPositionFields2;
       
   142             }            
       
   143         else if (iExpectedPanicCode == EPosNoneOrMultipleLandmarkAttributeSet)
       
   144             {
       
   145             iTestCase=KTestCaseSortPrefNoAttribute;
       
   146             ResumeThreadAndVerifyExit();
       
   147             iTestCase=KTestCaseSortPrefSeveralAttribute;
       
   148             }
       
   149         else if (iExpectedPanicCode == EPosNegativeValue)
       
   150         	{
       
   151             iTestCase=KTestCaseNegativeDistance;
       
   152         	ResumeThreadAndVerifyExit();
       
   153         	iTestCase=KTestCaseNegativeRadius;
       
   154         	}
       
   155         else if (iExpectedPanicCode == EPosInvalidEnumValue)
       
   156             {
       
   157             iTestCase = KTestCaseIncorrectCompositeType1;
       
   158             ResumeThreadAndVerifyExit();
       
   159             iTestCase = KTestCaseIncorrectCompositeType2;
       
   160             ResumeThreadAndVerifyExit();
       
   161             iTestCase = KTestCaseIncorrectCompositeType3;
       
   162             ResumeThreadAndVerifyExit();
       
   163             iTestCase = KTestCaseIncorrectCompositeType4;
       
   164             }
       
   165         else if (iExpectedPanicCode == EPosInvalidOperationMode)
       
   166             {
       
   167             // Excerpt from EPos_LandmarksErrors.h:
       
   168             // "Invalid operation mode. Caused by mixed calls to NextStep and ExecuteL 
       
   169 	        // for an CPosLmOperation object or subsequent calls to NextStep"
       
   170             iTestCase = KTestCaseInvalidOperationMode1;
       
   171             ResumeThreadAndVerifyExit();
       
   172             iTestCase = KTestCaseInvalidOperationMode2;
       
   173             ResumeThreadAndVerifyExit();
       
   174             iTestCase = KTestCaseInvalidOperationMode3;
       
   175             ResumeThreadAndVerifyExit();
       
   176             iTestCase = KTestCaseInvalidOperationMode4;            
       
   177             }
       
   178 		else if (iExpectedPanicCode == EPosInvalidLandmarkAttribute)
       
   179 			{
       
   180 			iTestCase = KTestCaseInvalidAttributes1;
       
   181             ResumeThreadAndVerifyExit();
       
   182             iTestCase = KTestCaseInvalidAttributes2;
       
   183 			}
       
   184 	    
       
   185 	     else  //added for testing
       
   186 		    {
       
   187 		        continue;
       
   188 		    }
       
   189 						
       
   190          ResumeThreadAndVerifyExit();
       
   191         }
       
   192 
       
   193         iLog->Log(_L("Tests below causes a USER-130 panic to be raised"));
       
   194         // Tests below causes a USER-130 panic to be raised
       
   195         iExpectedPanicCode = static_cast<TPositionLandmarksClientPanic>(130);
       
   196 
       
   197         iTestCase = KTestCaseCompositeSearch1;
       
   198         ResumeThreadAndVerifyExit();
       
   199 
       
   200         iTestCase = KTestCaseCompositeSearch2;
       
   201         ResumeThreadAndVerifyExit();
       
   202 
       
   203         iTestCase = KTestCaseCompositeSearch3;
       
   204         ResumeThreadAndVerifyExit();
       
   205 
       
   206         iTestCase = KTestCaseCompositeSearch4;
       
   207         ResumeThreadAndVerifyExit();
       
   208         
       
   209         iTestCase = KTestCaseCompositeSearch5;
       
   210         ResumeThreadAndVerifyExit();
       
   211         
       
   212         iTestCase = KTestCaseCompositeSearch6;
       
   213         ResumeThreadAndVerifyExit();
       
   214         
       
   215         iTestCase = KTestCaseCompositeSearch7;
       
   216         ResumeThreadAndVerifyExit();
       
   217 
       
   218         iTestCase = KTestCaseCompositeSearch8;
       
   219         ResumeThreadAndVerifyExit();          
       
   220 
       
   221         // Test below should raise a EPosEventNotifierAlreadyHasOutstandingRequest (2) panic
       
   222         // defined in EPos_LandmarksServerPanics.h
       
   223         // Since other testparts check for the same panic number change it to something else
       
   224         // and then change it to the correct number (2) in the thread function
       
   225         iLog->Log(_L("Test below should raise a EPosEventNotifierAlreadyHasOutstandingRequest (2) panic"));
       
   226         iExpectedPanicCode = static_cast<TPositionLandmarksClientPanic>(222);
       
   227         iTestCase = KTestCaseDuplicateNotifyDatabaseEvent;
       
   228         ResumeThreadAndVerifyExit();
       
   229         
       
   230         // Test that when using invalid CPosLmCategoryManager::TCategorySortPref in CategoryIteratorL
       
   231         //  causes a panic
       
   232         iLog->Log(_L("Test that when using invalid CPosLmCategoryManager::TCategorySortPref causes a panic"));
       
   233         iExpectedPanicCode = EPosInvalidEnumValue;
       
   234         iTestCase = KTestCaseCategoryIteratorSortPref;
       
   235         ResumeThreadAndVerifyExit();
       
   236         
       
   237          // Test that when using invalid CPosLmCategoryManager::TCategorySortPref in ReferencedCategoryIteratorL
       
   238          //  causes a panic
       
   239         iLog->Log(_L("Test that when using invalid CPosLmCategoryManager::TCategorySortPref causes a panic"));
       
   240         iExpectedPanicCode = EPosInvalidEnumValue;
       
   241         iTestCase = KTestCaseReferencedCategoryIteratorSortPref;
       
   242         ResumeThreadAndVerifyExit();
       
   243 
       
   244         // Test that setting SetMaxNumOfMatches to a negative value causes a panic
       
   245         iLog->Log(_L("Test that setting SetMaxNumOfMatches to a negative value causes a panic"));
       
   246         iExpectedPanicCode = EPosLmInvalidArgument;
       
   247     	iTestCase = KTestCaseNegativeMatches;
       
   248         ResumeThreadAndVerifyExit();
       
   249         
       
   250         // Test that setting SetMaxNumOfMatches to 0 causes a panic
       
   251         iLog->Log(_L("Test that setting SetMaxNumOfMatches to 0 causes a panic"));
       
   252         iExpectedPanicCode = EPosLmInvalidArgument;
       
   253     	iTestCase = KTestCaseZeroMatches;
       
   254         ResumeThreadAndVerifyExit();
       
   255         
       
   256         // Test starting a landmark category search with invalid SortPref panics
       
   257         iLog->Log(_L("Test starting a landmark category search with invalid SortPref panics"));
       
   258         iExpectedPanicCode = EPosInvalidEnumValue;
       
   259     	iTestCase = KTestCaseCategorySearchSortPref;
       
   260         ResumeThreadAndVerifyExit();
       
   261         
       
   262         // Test that it is not possible to create an invalid SortPref
       
   263         iLog->Log(_L("Test that it is not possible to create an invalid SortPref"));
       
   264         iExpectedPanicCode = EPosInvalidEnumValue;
       
   265     	iTestCase = KTestCaseLandmarkSortPref;
       
   266         ResumeThreadAndVerifyExit();
       
   267         
       
   268         // Test that it is not possible to set a SortPref to invalid values
       
   269         iLog->Log(_L("Test that it is not possible to set a SortPref to invalid values"));
       
   270         iExpectedPanicCode = EPosInvalidEnumValue;
       
   271     	iTestCase = KTestCaseLandmarkSortPref2;
       
   272         ResumeThreadAndVerifyExit();
       
   273         
       
   274         // Test that searching with an invalid attribute panics
       
   275         iLog->Log(_L("Test that it is not possible to set a SortPref with incorrect attributes"));
       
   276         iExpectedPanicCode = EPosNoneOrMultipleLandmarkAttributeSet;
       
   277     	iTestCase = KTestCaseLandmarkSearchinvalidAttribute;
       
   278         ResumeThreadAndVerifyExit();
       
   279                 
       
   280         // Test that it is not possible to set a SortPref with incorrect
       
   281         // attributes
       
   282         iLog->Log(_L("Test that searching with an invalid attribute panics"));
       
   283         iExpectedPanicCode = EPosNoneOrMultipleLandmarkAttributeSet;
       
   284     	iTestCase = KTestCaseLandmarkSearchinvalidAttribute2;
       
   285         ResumeThreadAndVerifyExit();
       
   286         
       
   287         // Test that Landmark->SetIcon with invalid index panics
       
   288         iLog->Log(_L("Test that Landmark->SetIcon with invalid index panics"));
       
   289         iExpectedPanicCode = EPosLmInvalidArgument;
       
   290     	iTestCase = KTestLandmarkSetIconTest1;
       
   291         ResumeThreadAndVerifyExit();
       
   292         
       
   293         // Test that Landmark->SetIcon with invalid maskindex panics
       
   294         iLog->Log(_L("Test that Landmark->SetIcon with invalid maskindex panics"));
       
   295         iExpectedPanicCode = EPosLmInvalidArgument;
       
   296     	iTestCase = KTestLandmarkSetIconTest2;
       
   297         ResumeThreadAndVerifyExit();
       
   298         
       
   299         // Test that Category->SetIcon with invalid index panics
       
   300         iLog->Log(_L("Test that Category->SetIcon with invalid index panics"));
       
   301         iExpectedPanicCode = EPosLmInvalidArgument;
       
   302     	iTestCase = KTestCategorySetIconTest1;
       
   303         ResumeThreadAndVerifyExit();
       
   304         
       
   305         // Test that Category->SetIcon with invalid maskindex panics
       
   306         iLog->Log(_L("Test that Category->SetIcon with invalid maskindex panics"));
       
   307         iExpectedPanicCode = EPosLmInvalidArgument;
       
   308     	iTestCase = KTestCategorySetIconTest2;
       
   309         ResumeThreadAndVerifyExit();
       
   310                 
       
   311     }
       
   312 
       
   313 // ---------------------------------------------------------
       
   314 // CPosTp12::ResumeThreadAndVerifyExit
       
   315 //
       
   316 // (other items were commented in a header).
       
   317 // ---------------------------------------------------------
       
   318 //
       
   319 void CPosTp12::ResumeThreadAndVerifyExit()
       
   320     {
       
   321     iLog->Log(_L("ResumeThreadAndVerifyExit"));
       
   322     _LIT(KPanicErr, "Method didn't Panic when expected"); 
       
   323     _LIT(KPanicCodeErr, "Paniced with unexpected panic code");
       
   324 
       
   325     CreateThreadL();
       
   326     TRequestStatus status;
       
   327     iThread.Logon(status);
       
   328     iThread.Resume();
       
   329         
       
   330     User::WaitForRequest(status);
       
   331     
       
   332     // Used for debugging
       
   333     TBuf<100> buf;
       
   334     buf.Format(_L("ExitType %d Exit reason %d"), iThread.ExitType(), iThread.ExitReason());
       
   335     iLog->Log(buf);
       
   336 
       
   337     AssertTrueSecL(iThread.ExitType() == EExitPanic, KPanicErr);
       
   338     AssertTrueSecL(iThread.ExitReason() == iExpectedPanicCode, KPanicCodeErr);
       
   339        
       
   340     iThread.Close();
       
   341     }
       
   342 
       
   343 // ---------------------------------------------------------
       
   344 // CPosTp12::CloseTest
       
   345 //
       
   346 // (other items were commented in a header).
       
   347 // ---------------------------------------------------------
       
   348 //
       
   349 void CPosTp12::CloseTest()
       
   350     {
       
   351     iLog->Log(_L("CloseTest"));
       
   352     iThread.Close();
       
   353     TRAPD(err, RestoreResourceFileL());
       
   354     if (err != KErrNone) iLog->Log(_L("Error in CloseTest"));
       
   355     iLog->Log(_L("CloseTest Done"));
       
   356 	}
       
   357 
       
   358 // ---------------------------------------------------------
       
   359 // CPosTp12::RunPanicTestL
       
   360 //
       
   361 // (other items were commented in a header).
       
   362 // ---------------------------------------------------------
       
   363 void CPosTp12::RunPanicTestL(TAny* aData)
       
   364     {
       
   365     CPosTp12* self = reinterpret_cast<CPosTp12*>(aData);
       
   366 
       
   367     
       
   368     if(self->iExpectedPanicCode == EPosInvalidValueSpecifiedInResourceFile)
       
   369         {
       
   370         self->ResourceFilePanicTestL();
       
   371         }
       
   372     
       
   373     RArray<TPosLmItemId> ids;
       
   374     CleanupClosePushL(ids);
       
   375 
       
   376     CPosLandmarkDatabase* lmd = self->OpenDatabaseLC();
       
   377     CPosLandmark* lm = CPosLandmark::NewLC();
       
   378     
       
   379     CPosLmCategoryManager* cm = CPosLmCategoryManager::NewL(*lmd); 
       
   380     CleanupStack::PushL(cm);
       
   381 
       
   382     if (self->iExpectedPanicCode == EPosInvalidPositionFieldId)
       
   383         {
       
   384         lm->NextPositionFieldId(TUint16(222));
       
   385         }
       
   386     else if (self->iExpectedPanicCode == EPosSpecifiedIntervalLiesOutsideIteratedSet) // CategoryIterator
       
   387         {
       
   388         if (self->iTestCase == KTestCaseCategoryIterator)
       
   389             {
       
   390             CPosLmItemIterator* iter = cm->CategoryIteratorL();
       
   391             CleanupStack::PushL(iter);
       
   392             const TInt KCategories=20;
       
   393             _LIT(KName, "CategoryTP12 - %d");
       
   394             for (TInt i=0; i<KCategories; i++)
       
   395                 {
       
   396                 TBuf<100> categoryName;
       
   397                 categoryName.Format(KName,i);
       
   398                 CPosLandmarkCategory* lmc = CPosLandmarkCategory::NewLC();
       
   399                 lmc->SetCategoryNameL(categoryName);  
       
   400                 TInt err = KErrLocked;
       
   401                 while (err == KErrLocked)
       
   402                     {
       
   403                     TRAP(err, cm->AddCategoryL(*lmc));
       
   404                     }
       
   405                 CleanupStack::Pop(lmc);
       
   406                 }
       
   407                 
       
   408             const TInt KStartIndex=5;
       
   409             const TInt KNumOfItems=16;
       
   410             iter->GetItemIdsL(ids, KStartIndex, KNumOfItems);
       
   411             CleanupStack::PopAndDestroy(iter);
       
   412             }
       
   413         else if (self->iTestCase == KTestCaseLandmarkIterator)
       
   414             {
       
   415             CPosLmItemIterator* iterLm = lmd->LandmarkIteratorL();
       
   416             CleanupStack::PushL(iterLm);
       
   417             const TInt KLmStartIndex=0;
       
   418             const TInt KLmNumOfItems=1;
       
   419             iterLm->GetItemIdsL(ids, KLmStartIndex, KLmNumOfItems);
       
   420             CleanupStack::PopAndDestroy(iterLm);
       
   421             }
       
   422         }
       
   423     else if (self->iExpectedPanicCode == EPosNoneOrMultipleLandmarkAttributeSet)
       
   424         {
       
   425         if (self->iTestCase == KTestCaseSortPrefNoAttribute)
       
   426             {
       
   427             TPosLmSortPref sortPref(CPosLandmark::ENoAttribute);
       
   428             sortPref.SortOrder();
       
   429             }
       
   430         else if (self->iTestCase == KTestCaseSortPrefSeveralAttribute)
       
   431             {
       
   432             TUint32 attr = CPosLandmark::ELandmarkName | CPosLandmark::EPosition;
       
   433             TPosLmSortPref sortPref(attr);
       
   434             sortPref.SortOrder();
       
   435             }
       
   436         //Test that searching for landmarks with invalid attributes panics
       
   437         else if (self->iTestCase == KTestCaseLandmarkSearchinvalidAttribute)
       
   438             {
       
   439             CPosLandmarkSearch* landmarkSearch = CPosLandmarkSearch::NewL(*lmd);
       
   440             CleanupStack::PushL(landmarkSearch);
       
   441             // Invalid attribute, (correct ascended sorted)
       
   442             TPosLmSortPref sortPref((TUint32)5);
       
   443 
       
   444             CPosLmTextCriteria* textCriteria = CPosLmTextCriteria::NewLC();   
       
   445             textCriteria->SetTextL(_L("Library*"));
       
   446             CPosLmOperation* operation = landmarkSearch->StartLandmarkSearchL(*textCriteria, sortPref);
       
   447             CleanupStack::PushL(operation);
       
   448             ExecuteAndDeleteLD(operation);
       
   449             CleanupStack::PopAndDestroy(operation);
       
   450             }
       
   451         //Test that it is not possible to set a TPosLmSortPref with invalid attributes
       
   452         else if (self->iTestCase == KTestCaseLandmarkSearchinvalidAttribute2)
       
   453             {
       
   454             TPosLmSortPref sortPref(CPosLandmark::ELandmarkName, TPosLmSortPref::EAscending);
       
   455             sortPref.SetSortByLandmarkAttribute((TUint32)5, TPosLmSortPref::EAscending);
       
   456             } 
       
   457         }
       
   458     else if (self->iExpectedPanicCode == EPosNaNCoordinate)
       
   459         {
       
   460         TCoordinate coord;
       
   461         CPosLmNearestCriteria* lmnc = CPosLmNearestCriteria::NewLC(coord);  
       
   462         
       
   463         CleanupStack::PopAndDestroy(lmnc);
       
   464         }
       
   465     else if (self->iExpectedPanicCode == EPosInvalidLandmarkAttribute)
       
   466         {
       
   467         if (self->iTestCase == KTestCaseInvalidAttributes1)
       
   468         	{
       
   469         	// Test with incorrect attributes
       
   470 	        CPosLmTextCriteria* textCriteria = CPosLmTextCriteria::NewLC();
       
   471 	        textCriteria->SetAttributesToSearch(CPosLandmark::EIcon);
       
   472 	        CleanupStack::PopAndDestroy(textCriteria);
       
   473 	        }
       
   474 	    else if (self->iTestCase == KTestCaseInvalidAttributes2)
       
   475         	{
       
   476         	// Test with invalid attributes
       
   477         	CPosLmTextCriteria* textCriteria = CPosLmTextCriteria::NewLC();
       
   478 	        textCriteria->SetAttributesToSearch(5);
       
   479 	        CleanupStack::PopAndDestroy(textCriteria);
       
   480         	}
       
   481         }
       
   482     else if (self->iExpectedPanicCode == EPosInvalidPartialReadParameters)
       
   483         {
       
   484         CPosLmPartialReadParameters* partialParam = lmd->PartialReadParametersLC();
       
   485         if (self->iTestCase == KTestCasePartialAttributes1)
       
   486             {
       
   487             TUint attr = 348764;
       
   488             partialParam->SetRequestedAttributes(attr);   
       
   489             }
       
   490         else if (self->iTestCase == KTestCasePartialAttributes2)
       
   491             {
       
   492             TUint attr = CPosLandmark::ELandmarkName|
       
   493 									CPosLandmark::EPosition|
       
   494 									CPosLandmark::ECoverageRadius|
       
   495 									CPosLandmark::ECategoryInfo|
       
   496 									CPosLandmark::EIcon|
       
   497 									CPosLandmark::EDescription;
       
   498             // attr equals 63 (see EPos_CPosLmPartialReadParameters.cpp)
       
   499             partialParam->SetRequestedAttributes(attr+1);
       
   500             }       
       
   501         CleanupStack::PopAndDestroy(partialParam);
       
   502         }
       
   503     else if (self->iExpectedPanicCode == EPosInvalidRequestedPositionFields)
       
   504         {
       
   505         CPosLmPartialReadParameters* partialParam = lmd->PartialReadParametersLC();
       
   506         RArray<TUint> reqFields;
       
   507         CleanupClosePushL(reqFields);
       
   508         
       
   509         if (self->iTestCase == KTestCaseInvalidRequestedPositionFields1)
       
   510             {
       
   511             // Test with index outside allowed interval
       
   512             TInt outside = EPositionFieldIdLast;
       
   513             reqFields.Append(++outside);
       
   514             partialParam->SetRequestedPositionFields(reqFields);
       
   515             }
       
   516         else if (self->iTestCase == KTestCaseInvalidRequestedPositionFields2)
       
   517             {
       
   518             // Test with index outside allowed interval
       
   519             TInt outside = EPositionFieldIdLast;
       
   520 
       
   521             reqFields.Append(EPositionFieldCountry);
       
   522             reqFields.Append(EPositionFieldCity);
       
   523             reqFields.Append(++outside);
       
   524 
       
   525             partialParam->SetRequestedPositionFields(reqFields);
       
   526             }
       
   527         CleanupStack::PopAndDestroy(&reqFields);
       
   528         CleanupStack::PopAndDestroy(partialParam);
       
   529         }
       
   530     else if (self -> iExpectedPanicCode == EPosNegativeValue)
       
   531         {
       
   532         if (self->iTestCase == KTestCaseNegativeDistance)
       
   533             {
       
   534             TCoordinate corr(19,20,10);
       
   535             CPosLmNearestCriteria* criteria =  CPosLmNearestCriteria::NewLC(corr, ETrue);
       
   536             criteria -> SetMaxDistance (-1); //should panic
       
   537             CleanupStack::PopAndDestroy(criteria);
       
   538             }
       
   539         else if (self ->iTestCase == KTestCaseNegativeRadius)
       
   540             {
       
   541             CPosLandmark* lm = CPosLandmark::NewLC();
       
   542             lm -> SetCoverageRadius(-1); // should panic
       
   543             CleanupStack::PopAndDestroy(lm);
       
   544             }
       
   545         }
       
   546     else if (self->iExpectedPanicCode == 130)
       
   547         {
       
   548         // The index supplied to method CPosLmCompositeCriteria::Argument must be in the 
       
   549         // interval [0, NumOfArguments - 1] otherwise cause a USER-130 Panic to be raised
       
   550         if (self->iTestCase == KTestCaseCompositeSearch1)
       
   551             {
       
   552             CPosLmCompositeCriteria* composite = CPosLmCompositeCriteria::NewLC(CPosLmCompositeCriteria::ECompositionAND);
       
   553             // Panic test 1, invalid position, should raise USER-130 panic
       
   554             /*CPosLmSearchCriteria& comp1 = */ composite->Argument(0);
       
   555             }
       
   556         else if (self->iTestCase == KTestCaseCompositeSearch2 || self->iTestCase == KTestCaseCompositeSearch3)
       
   557             {
       
   558             CPosLandmarkSearch* search = CPosLandmarkSearch::NewL(*lmd);
       
   559             CleanupStack::PushL(search);
       
   560 
       
   561             CPosLmCompositeCriteria* composite = CPosLmCompositeCriteria::NewLC(CPosLmCompositeCriteria::ECompositionAND);
       
   562 
       
   563             //CPosLmCatNameCriteria* nameCriteria = CPosLmCatNameCriteria::NewLC();
       
   564             //nameCriteria->SetSearchPatternL(_L("*"));
       
   565             
       
   566             CPosLmTextCriteria* textCriteria1 = CPosLmTextCriteria::NewLC();
       
   567             textCriteria1->SetTextL(_L("*"));
       
   568             
       
   569             TInt err = composite->AddArgument(textCriteria1);
       
   570             if (err != KErrNone) User::Leave(666);
       
   571             CleanupStack::Pop(textCriteria1);
       
   572             
       
   573             CPosLmTextCriteria* textCriteria = CPosLmTextCriteria::NewLC();
       
   574             textCriteria->SetTextL(_L("*"));
       
   575             TUint attr = CPosLandmark::ELandmarkName | CPosLandmark::EDescription;
       
   576             textCriteria->SetAttributesToSearch(attr);
       
   577             
       
   578             err = composite->AddArgument(textCriteria);
       
   579             if (err != KErrNone) User::Leave(667);
       
   580             CleanupStack::Pop(textCriteria);
       
   581             
       
   582             TInt nr = composite->NumOfArguments();
       
   583             
       
   584             if (self->iTestCase == KTestCaseCompositeSearch2)
       
   585                 {
       
   586                 // Should raise a USER-130 panic
       
   587                 /*CPosLmSearchCriteria& comp3 = */composite->Argument(nr);
       
   588                 }
       
   589             else 
       
   590                 {
       
   591                 // Should raise a USER-130 panic
       
   592                 /*CPosLmSearchCriteria& comp3 = */composite->Argument(nr+1);
       
   593                 }
       
   594             CleanupStack::PopAndDestroy(search);
       
   595             }
       
   596         else if (self->iTestCase == KTestCaseCompositeSearch4)
       
   597             {
       
   598             CPosLmCompositeCriteria* composite = CPosLmCompositeCriteria::NewLC(CPosLmCompositeCriteria::ECompositionAND);
       
   599             // Panic test 1, invalid position, should raise USER-130 panic, unfortunately raises a compiler warning
       
   600             // about signed/unsigned
       
   601             
       
   602             TInt dummy = -1;
       
   603             composite->Argument(dummy);
       
   604             }
       
   605 		else if (self->iTestCase == KTestCaseCompositeSearch5)
       
   606             {
       
   607             CPosLmCompositeCriteria* composite = CPosLmCompositeCriteria::NewLC(CPosLmCompositeCriteria::ECompositionAND);
       
   608             // Removing invalid position, should raise USER-130 panic, unfortunately raises a compiler warning
       
   609             // about signed/unsigned
       
   610             
       
   611             TInt dummy = -1;
       
   612             composite->RemoveArgument(dummy);
       
   613             }
       
   614 		else if (self->iTestCase == KTestCaseCompositeSearch6)
       
   615             {
       
   616             CPosLmCompositeCriteria* composite = CPosLmCompositeCriteria::NewLC(CPosLmCompositeCriteria::ECompositionAND);
       
   617             // Removing invalid position, should raise USER-130 panic, unfortunately raises a compiler warning
       
   618             // about signed/unsigned
       
   619             
       
   620             TInt dummy = 0;
       
   621             composite->RemoveArgument(dummy);
       
   622             }            
       
   623 		else if (self->iTestCase == KTestCaseCompositeSearch7)
       
   624             {
       
   625             CPosLmCompositeCriteria* composite = CPosLmCompositeCriteria::NewLC(CPosLmCompositeCriteria::ECompositionAND);
       
   626             // Removing invalid position, should raise USER-130 panic, unfortunately raises a compiler warning
       
   627             // about signed/unsigned
       
   628             
       
   629             
       
   630             CPosLmTextCriteria* textCriteria = CPosLmTextCriteria::NewLC();
       
   631             textCriteria->SetTextL(_L("*"));
       
   632             composite->AddArgument(textCriteria);
       
   633             CleanupStack::Pop(textCriteria);
       
   634             
       
   635             TInt dummy = 1;
       
   636             composite->RemoveArgument(dummy);
       
   637             }
       
   638 		else if (self->iTestCase == KTestCaseCompositeSearch8)
       
   639             {
       
   640             CPosLmCompositeCriteria* composite = CPosLmCompositeCriteria::NewLC(CPosLmCompositeCriteria::ECompositionAND);
       
   641             // Removing invalid position, should raise USER-130 panic, unfortunately raises a compiler warning
       
   642             // about signed/unsigned
       
   643             
       
   644             
       
   645             CPosLmTextCriteria* textCriteria = CPosLmTextCriteria::NewLC();
       
   646             textCriteria->SetTextL(_L("*"));
       
   647             composite->AddArgument(textCriteria);
       
   648             CleanupStack::Pop(textCriteria);
       
   649             
       
   650             TInt dummy = 2;
       
   651             composite->RemoveArgument(dummy);
       
   652             }            
       
   653         }
       
   654     else if (self->iTestCase == KTestCaseDuplicateNotifyDatabaseEvent)
       
   655         {
       
   656         self->iExpectedPanicCode = static_cast<TPositionLandmarksClientPanic>(2);
       
   657         CPosLandmarkDatabase* lmd = CPosLandmarkDatabase::OpenL();
       
   658         CleanupStack::PushL(lmd);
       
   659         TRequestStatus status1;
       
   660         TPosLmEvent event1;
       
   661         TRequestStatus status2;
       
   662         TPosLmEvent event2;
       
   663         lmd->NotifyDatabaseEvent(event1, status1);
       
   664         // Just in case
       
   665         User::After(1000000);
       
   666         // Should raise a EPosEventNotifierAlreadyHasOutstandingRequest Panic
       
   667         lmd->NotifyDatabaseEvent(event2, status2);
       
   668         // Just in case
       
   669         User::After(1000000);
       
   670         CleanupStack::PopAndDestroy(lmd);
       
   671         }
       
   672     else if (self->iExpectedPanicCode == EPosInvalidEnumValue)
       
   673         {
       
   674         CPosLandmarkDatabase* lmd = CPosLandmarkDatabase::OpenL();
       
   675         CleanupStack::PushL(lmd);
       
   676         CPosLmCompositeCriteria* composite = CPosLmCompositeCriteria::NewLC(CPosLmCompositeCriteria::ECompositionAND);
       
   677         if (self->iTestCase == KTestCaseIncorrectCompositeType1)
       
   678             {
       
   679             composite->SetCompositionType((CPosLmCompositeCriteria::TCompositionType)10);
       
   680             }
       
   681         else if (self->iTestCase == KTestCaseIncorrectCompositeType2)
       
   682             {
       
   683             composite->SetCompositionType((CPosLmCompositeCriteria::TCompositionType)-1);
       
   684             }
       
   685         else if (self->iTestCase == KTestCaseIncorrectCompositeType3)
       
   686             {
       
   687             CPosLmCompositeCriteria* composite2 = CPosLmCompositeCriteria::NewLC((CPosLmCompositeCriteria::TCompositionType)5);
       
   688             CleanupStack::PopAndDestroy(composite2);
       
   689             }
       
   690         else if (self->iTestCase == KTestCaseIncorrectCompositeType4)
       
   691             {
       
   692             CPosLmCompositeCriteria* composite2 = CPosLmCompositeCriteria::NewLC((CPosLmCompositeCriteria::TCompositionType)-5);
       
   693             CleanupStack::PopAndDestroy(composite2);
       
   694             }
       
   695         CleanupStack::PopAndDestroy(composite);
       
   696         
       
   697         // Test that using invalid sortpref panics
       
   698         if (self->iTestCase == KTestCaseCategoryIteratorSortPref)
       
   699             {
       
   700             CPosLmCategoryManager* categoryManager = CPosLmCategoryManager::NewL(*lmd);
       
   701             CPosLmItemIterator* catIter = categoryManager->CategoryIteratorL((CPosLmCategoryManager::TCategorySortPref)3);
       
   702             CleanupStack::PushL(catIter);
       
   703             CleanupStack::PopAndDestroy(catIter);
       
   704             }
       
   705         // Test that using invalid sortpref panics
       
   706         else if (self->iTestCase == KTestCaseReferencedCategoryIteratorSortPref)
       
   707             {
       
   708             CPosLmCategoryManager* categoryManager = CPosLmCategoryManager::NewL(*lmd);
       
   709             CPosLmItemIterator* catIter = categoryManager->ReferencedCategoryIteratorL((CPosLmCategoryManager::TCategorySortPref)4);
       
   710             CleanupStack::PushL(catIter);
       
   711             CleanupStack::PopAndDestroy(catIter);
       
   712             }
       
   713         //Test that using invalid sortpref panics
       
   714         else if (self->iTestCase == KTestCaseCategorySearchSortPref)
       
   715             {
       
   716             CPosLandmarkSearch* landmarkSearch = CPosLandmarkSearch::NewL(*lmd);
       
   717             CleanupStack::PushL(landmarkSearch);
       
   718             
       
   719             CPosLmCatNameCriteria* nameCriteria = CPosLmCatNameCriteria::NewLC();
       
   720             // Use wildcard * as search pattern
       
   721             nameCriteria->SetSearchPatternL(_L("Pub"));
       
   722             ExecuteAndDeleteLD(landmarkSearch->StartCategorySearchL(*nameCriteria, (CPosLmCategoryManager::TCategorySortPref)5));
       
   723             CleanupStack::PopAndDestroy(nameCriteria);
       
   724             CleanupStack::PopAndDestroy(landmarkSearch);
       
   725             }
       
   726         //Test that it is not possible to create a TPosLmSortPref with invalid value
       
   727         else if (self->iTestCase == KTestCaseLandmarkSortPref)
       
   728             {           
       
   729             TPosLmSortPref sortPref(CPosLandmark::ELandmarkName, 
       
   730                                     (TPosLmSortPref::TSortOrder)4321);
       
   731             }
       
   732         //Test that it is not possible to set a TPosLmSortPref to invalid values
       
   733         else if (self->iTestCase == KTestCaseLandmarkSortPref2)
       
   734             {           
       
   735             TPosLmSortPref sortPref(CPosLandmark::ELandmarkName, TPosLmSortPref::EAscending);
       
   736             sortPref.SetSortByLandmarkAttribute(CPosLandmark::ELandmarkName, (TPosLmSortPref::TSortOrder)25);
       
   737             }
       
   738         CleanupStack::PopAndDestroy(lmd);
       
   739         }
       
   740     else if (self->iExpectedPanicCode == EPosInvalidOperationMode)
       
   741         {
       
   742         CPosLandmarkDatabase* lmd = CPosLandmarkDatabase::OpenL();
       
   743         CleanupStack::PushL(lmd);
       
   744         
       
   745         CPosLandmarkSearch* landmarkSearch = CPosLandmarkSearch::NewL(*lmd);
       
   746         CleanupStack::PushL(landmarkSearch);
       
   747 
       
   748         CPosLmTextCriteria* textCriteria = CPosLmTextCriteria::NewLC();   
       
   749         textCriteria->SetTextL(_L("Library*"));
       
   750         CPosLmOperation* operation = landmarkSearch->StartLandmarkSearchL(*textCriteria);
       
   751         CleanupStack::PushL(operation);
       
   752 
       
   753         if (self->iTestCase == KTestCaseInvalidOperationMode1)
       
   754             {
       
   755             // Two subsequent ExecuteL calls should Panic
       
   756             operation->ExecuteL();
       
   757             operation->ExecuteL();
       
   758             }
       
   759         else if (self->iTestCase == KTestCaseInvalidOperationMode2)
       
   760             {
       
   761             operation->ExecuteL();
       
   762             TRequestStatus status;
       
   763             TReal32 progress;
       
   764             operation->NextStep(status, progress);
       
   765             }
       
   766         else if (self->iTestCase == KTestCaseInvalidOperationMode3)
       
   767             {
       
   768             TRequestStatus status;
       
   769             TReal32 progress;
       
   770             operation->NextStep(status, progress);
       
   771             operation->ExecuteL();
       
   772             }
       
   773         else if (self->iTestCase == KTestCaseInvalidOperationMode4)
       
   774             {
       
   775             TRequestStatus status;
       
   776             TReal32 progress;
       
   777             operation->NextStep(status, progress);
       
   778             operation->NextStep(status, progress);
       
   779             }
       
   780         CleanupStack::PopAndDestroy(operation);
       
   781         CleanupStack::PopAndDestroy(textCriteria);
       
   782         CleanupStack::PopAndDestroy(landmarkSearch);
       
   783         CleanupStack::PopAndDestroy(lmd);
       
   784         }
       
   785     else if (self->iExpectedPanicCode == EPosLmInvalidArgument)
       
   786         {
       
   787         if (self->iTestCase == KTestCaseNegativeMatches)
       
   788             {
       
   789             CPosLandmarkSearch* search = CPosLandmarkSearch::NewL(*lmd);
       
   790             CleanupStack::PushL(search);
       
   791             search->SetMaxNumOfMatches(-10);
       
   792             CleanupStack::PopAndDestroy(search);
       
   793             }
       
   794        else if (self->iTestCase == KTestCaseZeroMatches)
       
   795             {
       
   796             CPosLandmarkSearch* search = CPosLandmarkSearch::NewL(*lmd);
       
   797             CleanupStack::PushL(search);
       
   798             search->SetMaxNumOfMatches(0);
       
   799             CleanupStack::PopAndDestroy(search);
       
   800             }
       
   801         else if (self->iTestCase == KTestLandmarkSetIconTest1)
       
   802             {
       
   803             CPosLandmark* lm = CPosLandmark::NewLC();
       
   804             // Panics here
       
   805             lm->SetIconL(_L("IconFileName"), -2, KPosLmIconMaskNotUsed);
       
   806             CleanupStack::PopAndDestroy(lm);
       
   807             }
       
   808         else if (self->iTestCase == KTestLandmarkSetIconTest2)
       
   809             {
       
   810             CPosLandmark* lm = CPosLandmark::NewLC();
       
   811             // Panics here
       
   812             lm->SetIconL(_L("IconFileName"), 1, -2);
       
   813             CleanupStack::PopAndDestroy(lm);
       
   814             }
       
   815         else if (self->iTestCase == KTestCategorySetIconTest1)
       
   816             {
       
   817             CPosLandmarkCategory* category = CPosLandmarkCategory::NewLC();
       
   818             category->SetCategoryNameL(_L("NewCategory1"));
       
   819             // Panics here
       
   820             category->SetIconL(_L("IconFileName"), -5, KPosLmIconMaskNotUsed);
       
   821             CleanupStack::PopAndDestroy(category);
       
   822             }
       
   823         else if (self->iTestCase == KTestCategorySetIconTest2)
       
   824             {
       
   825             CPosLandmarkCategory* category = CPosLandmarkCategory::NewLC();
       
   826             category->SetCategoryNameL(_L("NewCategory2"));
       
   827             // Panics here
       
   828             category->SetIconL(_L("IconFileName"), 5, -2);
       
   829             CleanupStack::PopAndDestroy(category);
       
   830             }
       
   831         }
       
   832     
       
   833     CleanupStack::PopAndDestroy(4,&ids);
       
   834     }
       
   835 
       
   836 LOCAL_C TInt ThreadFunction(TAny* aData)
       
   837     {
       
   838     CTrapCleanup* cleanup=CTrapCleanup::New(); 
       
   839 
       
   840     CActiveScheduler* actSch = new (ELeave) CActiveScheduler;
       
   841     CActiveScheduler::Install(actSch);
       
   842 
       
   843     TRAPD(err, CPosTp12::RunPanicTestL(aData));
       
   844     
       
   845     delete actSch;
       
   846     delete cleanup;
       
   847     return err;
       
   848     }
       
   849 
       
   850 // ---------------------------------------------------------
       
   851 // CPosTp12::CreateThreadL
       
   852 //
       
   853 // (other items were commented in a header).
       
   854 // ---------------------------------------------------------
       
   855 void CPosTp12::CreateThreadL()
       
   856     {
       
   857     _LIT(KThreadName, "TP12testthread%d");
       
   858     _LIT(KCreateThreadErr, "Create thread failed with %d");
       
   859 
       
   860 	TBuf<100> buf;
       
   861 	buf.Format(KThreadName, iTreadCounter++);
       
   862      TInt err=0;
       
   863      err = iThread.Create(buf, ThreadFunction, KDefaultStackSize, KMinHeapSize, KMaxHeapSize, this);
       
   864         
       
   865      AssertTrueSecL(err == KErrNone, KCreateThreadErr, err);                                                                  
       
   866             
       
   867     }
       
   868 
       
   869 // ---------------------------------------------------------
       
   870 // CPosTp12::ResourceFilePanicTestLL
       
   871 //
       
   872 // (other items were commented in a header).
       
   873 // ---------------------------------------------------------
       
   874 void CPosTp12::ResourceFilePanicTestL()
       
   875     {
       
   876     RemoveDefaultDbL();
       
   877     CPosLandmarkDatabase* lmd=UseInvalidResourceFileL();
       
   878     CleanupStack::PushL(lmd);
       
   879 
       
   880     if (lmd->IsInitializingNeeded())
       
   881         {
       
   882         ExecuteAndDeleteLD(lmd->InitializeL()); 
       
   883         }
       
   884         
       
   885     CPosLmCategoryManager* categoryManager = CPosLmCategoryManager::NewL(*lmd); 
       
   886     CleanupStack::PushL(categoryManager);
       
   887 
       
   888     RArray<TPosLmItemId> ids;
       
   889     CleanupClosePushL(ids);
       
   890 
       
   891     ids.Append(1);
       
   892     ExecuteAndDeleteLD(categoryManager->RemoveCategoriesL(ids)); 
       
   893    
       
   894     CleanupStack::PopAndDestroy(3, lmd);
       
   895     }
       
   896 
       
   897 // ---------------------------------------------------------
       
   898 // CPosTp12::UseInvalidGlobalCategoriesL
       
   899 //
       
   900 // (other items were commented in a header).
       
   901 // ---------------------------------------------------------
       
   902 CPosLandmarkDatabase* CPosTp12::UseInvalidResourceFileL()
       
   903     {
       
   904     _LIT(KInvalidResourceFile, "c:\\system\\test\\testdata\\EPOSLMASYNCOPS.RSC");
       
   905     
       
   906     CFileMan* fileMan = CFileMan::NewL(iFileSession);
       
   907     CleanupStack::PushL(fileMan);
       
   908 
       
   909     TInt err = fileMan->Rename(KResourceFile, KTempResourceFile, CFileMan::EOverWrite);
       
   910     if (err != KErrNone && err != KErrNotFound)
       
   911         {
       
   912         iLog->Log(_L("Unexpected error when trying to rename EPOSLMASYNCOPS.RSC"));
       
   913         User::Leave(err);
       
   914         }
       
   915 
       
   916     User::LeaveIfError(fileMan->Copy(KInvalidResourceFile, KResourceFilePath, CFileMan::EOverWrite));
       
   917 
       
   918     CleanupStack::PopAndDestroy(fileMan);
       
   919 
       
   920     return CPosLandmarkDatabase::OpenL();
       
   921     }
       
   922 
       
   923 // ---------------------------------------------------------
       
   924 // CPosTp12::RestoreResourceL
       
   925 //
       
   926 // (other items were commented in a header).
       
   927 // ---------------------------------------------------------
       
   928 void CPosTp12::RestoreResourceFileL()
       
   929     {
       
   930     CFileMan* fileMan = CFileMan::NewL(iFileSession);
       
   931     CleanupStack::PushL(fileMan);
       
   932 
       
   933     User::LeaveIfError(fileMan->Delete(KResourceFile));
       
   934 
       
   935     TInt err = fileMan->Rename(KTempResourceFile, KResourceFile, CFileMan::EOverWrite);
       
   936     if (err != KErrNone && err != KErrNotFound)
       
   937         {
       
   938         iLog->Log(_L("Unexpected error when trying to rename TEMP_EPOSLMASYNCOPS.RSC"));
       
   939         User::Leave(err);
       
   940         }
       
   941 
       
   942     CleanupStack::PopAndDestroy(fileMan);
       
   943 
       
   944     }
       
   945 
       
   946 //  End of File