homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/src/mt_hspsconfigurationif.cpp
branchRCL_3
changeset 118 8baec10861af
parent 114 a5a39a295112
child 130 67f2ed48ad91
equal deleted inserted replaced
114:a5a39a295112 118:8baec10861af
    21 #include <digia/eunit/eunituids.h>
    21 #include <digia/eunit/eunituids.h>
    22 #include <apgtask.h>
    22 #include <apgtask.h>
    23 #include <eikenv.h>
    23 #include <eikenv.h>
    24 #include <centralrepository.h>
    24 #include <centralrepository.h>
    25 #include <bautils.h>
    25 #include <bautils.h>
       
    26 #include <driveinfo.h>
    26 #include "mt_hspsconfigurationif.h"
    27 #include "mt_hspsconfigurationif.h"
    27 #include "mt_hspsliwlistprinter.h"
    28 #include "mt_hspsliwlistprinter.h"
    28 #include "mt_hspsinstallationservice.h"
    29 #include "mt_hspsinstallationservice.h"
    29 
    30 
    30 #include "liwgenericparam.hrh"
    31 #include "liwgenericparam.hrh"
   130 _LIT( KMinimalResourceFile2, "c:\\private\\20000fb1\\2456\\270513751\\536916225\\1.0\\sources\\viewnavigationrules.xml"  );
   131 _LIT( KMinimalResourceFile2, "c:\\private\\20000fb1\\2456\\270513751\\536916225\\1.0\\sources\\viewnavigationrules.xml"  );
   131 _LIT( KMinimalResourceFile3, "c:\\private\\20000fb1\\2456\\270513751\\536916225\\1.0\\sources\\resource.file"  );
   132 _LIT( KMinimalResourceFile3, "c:\\private\\20000fb1\\2456\\270513751\\536916225\\1.0\\sources\\resource.file"  );
   132 _LIT( KMinimalResourceFile4, "c:\\private\\20000fb1\\2456\\270513751\\536916225\\1.0\\sources\\picture.jpeg"  );
   133 _LIT( KMinimalResourceFile4, "c:\\private\\20000fb1\\2456\\270513751\\536916225\\1.0\\sources\\picture.jpeg"  );
   133 _LIT( KFinnishMifLogo, "c:\\private\\20000fb1\\2456\\270513751\\536916274\\1.0\\sources\\dummy.mif"  );
   134 _LIT( KFinnishMifLogo, "c:\\private\\20000fb1\\2456\\270513751\\536916274\\1.0\\sources\\dummy.mif"  );
   134 
   135 
       
   136 const TInt16 KletterA = 'a'; // ASCII code for 'a'
       
   137 
   135 // ======== LOCAL FUNCTIONS ====================================================
   138 // ======== LOCAL FUNCTIONS ====================================================
       
   139 
       
   140 //------------------------------------------------------------------------------
       
   141 // EMMC drive finder - from hspsServerUtil 
       
   142 //------------------------------------------------------------------------------
       
   143 TInt GetEmmcDrivePath( )
       
   144     {
       
   145     RFs fs;
       
   146     if ( fs.Connect() != KErrNone )
       
   147         {
       
   148         return KErrNotFound;
       
   149         }
       
   150     TInt drive = KErrNotFound;
       
   151     if ( DriveInfo::GetDefaultDrive( 
       
   152             DriveInfo::EDefaultMassStorage, drive ) == KErrNone )
       
   153         {
       
   154         TUint status;
       
   155         if ( DriveInfo::GetDriveStatus( fs, drive, status ) == KErrNone )
       
   156             {
       
   157             if ( status & DriveInfo::EDriveInternal )
       
   158                 {
       
   159                 fs.Close();
       
   160                 return drive;
       
   161                 }
       
   162             }
       
   163         }
       
   164     fs.Close();
       
   165     return KErrNotFound;
       
   166     }
   136 
   167 
   137 // ======== MEMBER FUNCTIONS ===================================================
   168 // ======== MEMBER FUNCTIONS ===================================================
   138 
   169 
   139 //------------------------------------------------------------------------------
   170 //------------------------------------------------------------------------------
   140 // Two-phased constructor.
   171 // Two-phased constructor.
  3207 // Test case: Customization(1)
  3238 // Test case: Customization(1)
  3208 //------------------------------------------------------------------------------
  3239 //------------------------------------------------------------------------------
  3209 void MT_CHSPSConfigurationIf::Customization_1_L()
  3240 void MT_CHSPSConfigurationIf::Customization_1_L()
  3210     {        
  3241     {        
  3211     // Pre conditions
  3242     // Pre conditions
       
  3243     // There is minimal configuration and a D drive present in emulator
       
  3244     // Outcome:
       
  3245     // The original configuration file is bypassed by a new one placed on the D 
       
  3246     // drive
       
  3247     // Possible problems:
       
  3248     // There is no E drive (EMMC) in emulator. The data are copied to the D 
       
  3249     // drive. In case there is the E drive,please check all possible references
       
  3250     // to the D drive and change, if needed. This is important for HW testing.
       
  3251     // Remark: hspsServerUtil::FindFile() determines which drives are searched.
  3212         
  3252         
  3213     EUNIT_PRINT( _L8( "Pre conditions: Set Active configuration Minimal" ) );
  3253     EUNIT_PRINT( _L8( "Pre conditions: Set Active configuration Minimal" ) );
  3214     SetActiveConfigurationL( KHSPSTestAppUid, KHSPSActiveConfMinimal );    
  3254     SetActiveConfigurationL( KHSPSTestAppUid, KHSPSActiveConfMinimal );    
  3215         
  3255         
  3216     EUNIT_PRINT( _L8( "Pre conditions: Attach to HSPS service IConfiguration interface" ) );
  3256     EUNIT_PRINT( _L8( "Pre conditions: Attach to HSPS service IConfiguration interface" ) );
  3217     AttachServiceL( KHSPS, KHSPSConfigurationIf, KHSPSTestAppUid );
  3257     AttachServiceL( KHSPS, KHSPSConfigurationIf, KHSPSTestAppUid );
  3218             
  3258             
  3219     // Simulate customization by copying configuration files to D drive ("ROM" stuff is on C)
  3259     // Simulate customization by copying configuration files to D drive ("ROM" stuff is on C)
  3220     CFileMan* fileManager = CFileMan::NewL( iFileserver );
  3260     CFileMan* fileManager = CFileMan::NewL( iFileserver );
  3221     CleanupStack::PushL( fileManager );
  3261     CleanupStack::PushL( fileManager );
       
  3262     
       
  3263     // Find MMC drive, if not found copy it to the D drive
       
  3264     TInt drive = GetEmmcDrivePath();
       
  3265     if ( drive == KErrNotFound )
       
  3266         {
       
  3267         drive = EDriveD;    // Set D drive
       
  3268         }
       
  3269     _LIT( Kconfigdir, "d:\\data\\mt_hsps\\installed_widget\\widgetconfiguration.xml" );
       
  3270     TBuf<200> confdir;
       
  3271     confdir.Append( Kconfigdir );
       
  3272     confdir[0] = ( TInt16 )drive + KletterA; // see ACII table
  3222     User::LeaveIfError( 
  3273     User::LeaveIfError( 
  3223         fileManager->Copy(
  3274         fileManager->Copy(
  3224             _L( "c:\\data\\mt_hsps\\installed_widget\\widgetconfiguration_customized.xml" ),
  3275         _L( "c:\\data\\mt_hsps\\installed_widget\\widgetconfiguration_customized.xml" ),
  3225             _L( "d:\\data\\mt_hsps\\installed_widget\\widgetconfiguration.xml" ),
  3276         confdir,
  3226             CFileMan::ERecurse|CFileMan::EOverWrite 
  3277         CFileMan::ERecurse|CFileMan::EOverWrite )
  3227             )             
       
  3228         );    
  3278         );    
       
  3279     
  3229     CleanupStack::PopAndDestroy( fileManager );
  3280     CleanupStack::PopAndDestroy( fileManager );
  3230                 
  3281                 
  3231     MT_CHspsInstallationService* installationService = MT_CHspsInstallationService::NewL();    
  3282     MT_CHspsInstallationService* installationService = MT_CHspsInstallationService::NewL();    
  3232     CleanupStack::PushL( installationService );
  3283     CleanupStack::PushL( installationService );
  3233         
  3284