landmarks/locationlandmarks/tsrc/LandmarkTestModule/src/FT_CPosTp17.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_CPosTp17.h"
       
    23 #include <f32file.h>
       
    24 #include <bautils.h>
       
    25 
       
    26 // CONSTANTS
       
    27 const TInt KMaxDllFileNameLength = 100;
       
    28 
       
    29 // ================= MEMBER FUNCTIONS =======================
       
    30 
       
    31 // ---------------------------------------------------------
       
    32 // CPosTp17::GetName
       
    33 //
       
    34 // (other items were commented in a header).
       
    35 // ---------------------------------------------------------
       
    36 //
       
    37 void CPosTp17::GetName(TDes& aName) const
       
    38     {
       
    39     _LIT(KTestName, "TP17 - Memory footprint");
       
    40     aName = KTestName;
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------
       
    44 // CPosTp17::CloseTest
       
    45 //
       
    46 // (other items were commented in a header).
       
    47 // ---------------------------------------------------------
       
    48 //
       
    49 void CPosTp17::CloseTest()
       
    50     {
       
    51     iFootprints.Close();
       
    52     iDllNames.Close();
       
    53     }
       
    54 
       
    55 // ---------------------------------------------------------
       
    56 // CPosTp17::StartL
       
    57 //
       
    58 // (other items were commented in a header).
       
    59 // ---------------------------------------------------------
       
    60 //
       
    61 void CPosTp17::StartL()
       
    62     {
       
    63 #ifdef __WINS__
       
    64     _LIT(KNotSupported, "Test case is not supported on WINS, exucute it on target!");
       
    65     LogErrorAndLeave(KNotSupported);
       
    66 #else
       
    67     _LIT(KErrors, "One or several Dll's have an incorrect size");
       
    68     SetupTestDataL();
       
    69  
       
    70     RFs session;
       
    71     User::LeaveIfError(session.Connect());
       
    72     CleanupClosePushL(session);
       
    73  
       
    74     RFile file;
       
    75     TBuf<1> drive= _L("c");
       
    76     TBuf<KMaxDllFileNameLength> name;
       
    77     name.Copy(iDllNames[0]);
       
    78     name.Replace(0,1,drive); 
       
    79  
       
    80     if (file.Open(session, name, EFileRead) != KErrNone)
       
    81         {
       
    82         iLog->Put(_L("(Flashed) Use Drive Z:"));
       
    83         drive.Copy(_L("z"));
       
    84         }
       
    85 	else iLog->Put(_L("(Nonflashed) Use Drive C:"));
       
    86  
       
    87     file.Close();
       
    88     TBool errors=EFalse;
       
    89     for (TInt i=0; i<iDllNames.Count(); i++)
       
    90         {
       
    91         name.Copy(iDllNames[i]);
       
    92         name.Replace(0,1,drive);
       
    93         //User::LeaveIfError(file.Open(session, name, EFileRead));
       
    94         TInt err = file.Open(session, name, EFileRead);
       
    95         if (err != KErrNone)
       
    96             {
       
    97             TBuf<70> buffe;
       
    98             buffe.Append(_L("Error when opening file "));
       
    99             buffe.Append(name);
       
   100 			LogErrorAndLeave(buffe, err);
       
   101             }
       
   102 
       
   103         CleanupClosePushL(file);
       
   104         TInt fileSize=0;
       
   105         file.Size(fileSize);
       
   106        
       
   107         if (fileSize > iFootprints[i])
       
   108             {
       
   109             errors = ETrue;
       
   110             
       
   111             _LIT(KDllSizeErr, "ERROR: %S is to big (%d), Max allowed ROM footprint is %d");
       
   112             TBuf<255> info;
       
   113             HBufC* temp = name.Alloc();
       
   114             info.Format(KDllSizeErr, temp, fileSize, iFootprints[i]);
       
   115             delete temp;
       
   116             iLog->Put(info);
       
   117             }
       
   118         else 
       
   119             {
       
   120 			// Always log .dll size
       
   121             _LIT(KDllSizeDebug, "%S is (%d), Max allowed ROM footprint is %d");
       
   122             TBuf<255> info;
       
   123             HBufC* temp = name.Alloc();
       
   124             info.Format(KDllSizeDebug, temp, fileSize, iFootprints[i]);
       
   125             delete temp;
       
   126             iLog->Put(info);
       
   127             }
       
   128         
       
   129         CleanupStack::PopAndDestroy(&file);
       
   130         } 
       
   131     CleanupStack::PopAndDestroy(&session);
       
   132 
       
   133     if (errors)
       
   134         {
       
   135         LogErrorAndLeave(KErrors);
       
   136         }
       
   137 #endif
       
   138     }
       
   139 
       
   140 // ---------------------------------------------------------
       
   141 // CPosTp17::SetupTestDataL()
       
   142 //
       
   143 // (other items were commented in a header).
       
   144 // ---------------------------------------------------------
       
   145 //
       
   146 void CPosTp17::SetupTestDataL()
       
   147     {  
       
   148     iLog->Put(_L("SetupTestDataL"));
       
   149     
       
   150     _LIT(KLANDMARK,"z:\\sys\\bin\\eposlandmarks.dll");
       
   151     RFs fs;
       
   152     User::LeaveIfError(fs.Connect());
       
   153     CleanupClosePushL(fs);
       
   154     
       
   155     CFileMan* fileMan = CFileMan::NewL(fs);
       
   156     CleanupStack::PushL(fileMan);
       
   157     
       
   158     //check if landmark is flashed
       
   159      if (BaflUtils::FileExists(fs, KLANDMARK))
       
   160         {
       
   161          //Landmark is flashed
       
   162         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlandmarks.dll")));        
       
   163         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmsearchlib.dll")));
       
   164         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmmultidbsearch.dll")));
       
   165         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmlocalsearchprovider.dll")));
       
   166         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmlocalaccessprovider.dll"))); 
       
   167         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmlocalaccess.dll")));
       
   168         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmservlib.dll")));
       
   169         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmserver.exe")));
       
   170         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmdbreg.dll")));
       
   171         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmintservices.dll")));
       
   172         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmconverter.dll")));
       
   173         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmrecognizer.dll")));
       
   174         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmdbmanlib.dll")));
       
   175         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmdbmanprov.dll")));
       
   176         User::LeaveIfError(iDllNames.Append(_L("z:\\sys\\bin\\eposlmlocaldbmanprovider.dll")));
       
   177         }
       
   178      else
       
   179         {
       
   180          //Landmark is not flashed
       
   181         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlandmarks.dll")));
       
   182         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmsearchlib.dll")));
       
   183         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmmultidbsearch.dll")));
       
   184         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmlocalsearchprovider.dll")));
       
   185         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmlocalaccessprovider.dll"))); 
       
   186         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmlocalaccess.dll")));
       
   187         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmservlib.dll")));
       
   188         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmserver.exe")));
       
   189         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmdbreg.dll")));
       
   190         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmintservices.dll")));
       
   191         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmconverter.dll")));
       
   192         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmrecognizer.dll")));
       
   193         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmdbmanlib.dll")));
       
   194         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmdbmanprov.dll")));
       
   195         User::LeaveIfError(iDllNames.Append(_L("!:\\sys\\bin\\eposlmlocaldbmanprovider.dll")));
       
   196         }
       
   197 
       
   198     User::LeaveIfError(iFootprints.Append(9000));  //eposlandmarks.dll (Landmarks Client Library)
       
   199     // Note that eposlmmultidbsearch.dll + eposlmsearchlib.dll must not be bigger than 17000
       
   200     User::LeaveIfError(iFootprints.Append(8500)); //eposlmsearchlib.dll (Landmarks Search Client Library)
       
   201     User::LeaveIfError(iFootprints.Append(8500)); //eposlmmultidbsearch.dll (Landmarks Search Client Library)
       
   202     User::LeaveIfError(iFootprints.Append(19000)); //eposlmlocalsearchprovider.dll (Landmarks Local Search Provider)
       
   203     // Note that eposlmlocalaccessprovider.dll + eposlmlocalaccess.dll must not be bigger than 23000
       
   204     User::LeaveIfError(iFootprints.Append(400));   //eposlmlocalaccessprovider.dll (Landmarks Local Access Provider)
       
   205     User::LeaveIfError(iFootprints.Append(23000)); //eposlmlocalaccess.dll (Landmarks Local Access)
       
   206     User::LeaveIfError(iFootprints.Append(2000));  //eposlmservlib.dll (Landmarks Server Client Library)
       
   207     User::LeaveIfError(iFootprints.Append(26000)); //eposlmserver.exe (Landmarks Server)
       
   208     User::LeaveIfError(iFootprints.Append(6000));  //eposlmdbreg.dll (Landmarks Database Registry)
       
   209     User::LeaveIfError(iFootprints.Append(23000)); //eposlmintservices.dll (Landmarks Internal Services)
       
   210     User::LeaveIfError(iFootprints.Append(22000)); //eposlmconverter,dll (Landmarks Content Format Converter)
       
   211     User::LeaveIfError(iFootprints.Append(2000));  //eposlmrecognizer.mdl (Landmarks Content Format Recognizer)
       
   212     User::LeaveIfError(iFootprints.Append(3000));  //eposlmdbmanlib.dll (Landmarks DB Management Client)
       
   213     User::LeaveIfError(iFootprints.Append(6000));  //eposlmdbmanprov.dll (Landmarks Database Management Provider)
       
   214     User::LeaveIfError(iFootprints.Append(5000));  //eposlmlocaldbmanprovider.dll (Landmarks Local Database Management Provider)
       
   215 
       
   216     CleanupStack::PopAndDestroy(2, &fs);
       
   217     }
       
   218 
       
   219 //  End of File