installationservices/swi/test/tsisregistrytest_legacy/sessionstep.cpp
branchRCL_3
changeset 25 7333d7932ef7
parent 4 3eebb1e54d3a
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
     1 /*
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    19 /**
    19 /**
    20  @file 
    20  @file 
    21  @test
    21  @test
    22  @internalTechnology
    22  @internalTechnology
    23 */
    23 */
    24  
    24 
       
    25 #include <e32svr.h>
    25 #include <test/testexecutelog.h>
    26 #include <test/testexecutelog.h>
    26 #include <test/testexecutestepbase.h>
    27 #include <test/testexecutestepbase.h>
    27 #include "sessionstep.h"
    28 #include "sessionstep.h"
    28 #include "sisregistrysession.h"
    29 #include "sisregistrysession.h"
    29 #include "sisregistryentry.h"
    30 #include "sisregistryentry.h"
    35 #include "arrayutils.h"
    36 #include "arrayutils.h"
    36 #include "sisregistrytoken.h"
    37 #include "sisregistrytoken.h"
    37 #include "sisregistrylog.h"
    38 #include "sisregistrylog.h"
    38 #include <s32file.h>
    39 #include <s32file.h>
    39 
    40 
       
    41 #include <centralrepository.h>
    40 
    42 
    41 /////////////////////////////////////////////////////////////////////
    43 /////////////////////////////////////////////////////////////////////
    42 // defs, Constants used by test steps
    44 // defs, Constants used by test steps
    43 /////////////////////////////////////////////////////////////////////
    45 /////////////////////////////////////////////////////////////////////
    44 
    46 
    45 _LIT(KNoUid, "nouid");
    47 _LIT(KNoUid, "nouid");
    46 _LIT(KUid, "uid");
    48 _LIT(KUid, "uid");
       
    49 _LIT(KCenRepKey, "cenrepkey");
       
    50 _LIT(KCenRepValue, "cenrepvalue");
    47 _LIT(KDrivebitmapcount, "drivebitmapcout");
    51 _LIT(KDrivebitmapcount, "drivebitmapcout");
    48 _LIT(KSid, "sid");
    52 _LIT(KSid, "sid");
    49 _LIT(KPackage, "package");
    53 _LIT(KPackage, "package");
    50 _LIT(KVendor, "vendor");
    54 _LIT(KVendor, "vendor");
    51 _LIT(KController, "ctl");
    55 _LIT(KController, "ctl");
   132 		{
   136 		{
   133 		SetTestStepResult(EFail);
   137 		SetTestStepResult(EFail);
   134 	    return TestStepResult();
   138 	    return TestStepResult();
   135 	    }
   139 	    }
   136 	CleanupClosePushL(entry);
   140 	CleanupClosePushL(entry);
   137 	
   141 
       
   142 	CleanupResetAndDestroyPushL(packages);
   138 	entry.EmbeddingPackagesL(packages);
   143 	entry.EmbeddingPackagesL(packages);
   139 	CleanupResetAndDestroyPushL(packages);
       
   140 	
       
   141 	
   144 	
   142 	if(packages.Count() != embeddingPkgCount)
   145 	if(packages.Count() != embeddingPkgCount)
   143 		{
   146 		{
   144 		ERR_PRINTF3(_L("The actual number of embedding packages does not meet expected. Expected: %d Actual: %d"), embeddingPkgCount, packages.Count());
   147 		ERR_PRINTF3(_L("The actual number of embedding packages does not meet expected. Expected: %d Actual: %d"), embeddingPkgCount, packages.Count());
   145 		SetTestStepResult(EFail);
   148 		SetTestStepResult(EFail);
   651 	CleanupStack::PopAndDestroy(&expectedUids);
   654 	CleanupStack::PopAndDestroy(&expectedUids);
   652 	
   655 	
   653 	return TestStepResult();
   656 	return TestStepResult();
   654 	}
   657 	}
   655 	
   658 	
       
   659 
       
   660 /////////////////////////////////////////////////////////////////////
       
   661 // CSetCenRepSettingStep - Set Central Reposatory Value
       
   662 /////////////////////////////////////////////////////////////////////
       
   663 CSetCenRepSettingStep::CSetCenRepSettingStep()
       
   664     {
       
   665     SetTestStepName(KSetCenRepSetting);
       
   666     }
       
   667 
       
   668 TVerdict CSetCenRepSettingStep::doTestStepL()
       
   669     {        
       
   670     SetTestStepResult(EPass);
       
   671     TUid repUid;
       
   672     if(!GetUidFromConfig(ConfigSection(), KUid, repUid))
       
   673         {
       
   674         ERR_PRINTF1(_L("Package UID is missing in the configuration file!"));
       
   675         SetTestStepResult(EFail);
       
   676         return TestStepResult();
       
   677         }
       
   678     
       
   679     TInt cenRepKey;
       
   680     if(!GetIntFromConfig(ConfigSection(), KCenRepKey, cenRepKey))
       
   681         {
       
   682         ERR_PRINTF1(_L("Central Reposatory Key is missing in the configuration file!"));
       
   683         SetTestStepResult(EFail);
       
   684         return TestStepResult();
       
   685         }
       
   686     
       
   687     TInt cenRepValue;
       
   688     if(!GetIntFromConfig(ConfigSection(), KCenRepValue, cenRepValue))
       
   689         {
       
   690         ERR_PRINTF1(_L("Central Reposatory Value is missing in the configuration file!"));
       
   691         SetTestStepResult(EFail);
       
   692         return TestStepResult();
       
   693         }
       
   694     
       
   695     CRepository* rep = CRepository::NewLC(repUid);
       
   696     TInt err = rep->Set(cenRepKey, cenRepValue);
       
   697         
       
   698     if( err == KErrNone )
       
   699     {
       
   700         INFO_PRINTF4(_L("Setting Central Reposatory  0x%08x  , key = %d, value = %d"),repUid,cenRepKey,cenRepValue);
       
   701     }
       
   702     else
       
   703     {
       
   704         SetTestStepResult(EFail);
       
   705         ERR_PRINTF4(_L("Failed Setting Central Reposatory  0x%08x  , key = %d, value = %d"),repUid,cenRepKey,cenRepValue);
       
   706     }
       
   707     
       
   708     CleanupStack::PopAndDestroy(rep); 
       
   709     return TestStepResult();
       
   710     }
       
   711 
       
   712 
   656 /////////////////////////////////////////////////////////////////////
   713 /////////////////////////////////////////////////////////////////////
   657 // CIsPackageInstalledStep - checks if packages are registered
   714 // CIsPackageInstalledStep - checks if packages are registered
   658 /////////////////////////////////////////////////////////////////////
   715 /////////////////////////////////////////////////////////////////////
   659 
   716 
   660 CIsPackageInstalledStep::CIsPackageInstalledStep()
   717 CIsPackageInstalledStep::CIsPackageInstalledStep()