installationservices/swi/test/tsisregistrytest/sessionstep.cpp
changeset 25 98b66e4fb0be
parent 0 ba25891c3a9e
child 42 d17dc5398051
--- a/installationservices/swi/test/tsisregistrytest/sessionstep.cpp	Fri Mar 19 09:33:35 2010 +0200
+++ b/installationservices/swi/test/tsisregistrytest/sessionstep.cpp	Fri Apr 16 15:05:20 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -45,6 +45,8 @@
 #include "hashcontainer.h"
 #include "sisregistryproperty.h"
 
+#include <centralrepository.h>
+
 const TInt KDefaultBufferSize		= 2048;
 /////////////////////////////////////////////////////////////////////
 // defs, Constants used by test steps
@@ -52,6 +54,8 @@
 
 _LIT(KNoUid, "nouid");
 _LIT(KUid, "uid");
+_LIT(KCenRepKey, "cenrepkey");
+_LIT(KCenRepValue, "cenrepvalue");
 _LIT(KDrivebitmapcount, "drivebitmapcout");
 _LIT(KSid, "sid");
 _LIT(KPackage, "package");
@@ -678,6 +682,59 @@
 	}
 	
 /////////////////////////////////////////////////////////////////////
+// CSetCenRepSettingStep - Set Central Reposatory Value
+/////////////////////////////////////////////////////////////////////
+CSetCenRepSettingStep::CSetCenRepSettingStep()
+    {
+    SetTestStepName(KSetCenRepSetting);
+    }
+
+TVerdict CSetCenRepSettingStep::doTestStepL()
+    {        
+    SetTestStepResult(EPass);
+    TUid repUid;
+    if(!GetUidFromConfig(ConfigSection(), KUid, repUid))
+        {
+        ERR_PRINTF1(_L("Package UID is missing in the configuration file!"));
+        SetTestStepResult(EFail);
+        return TestStepResult();
+        }
+    
+    TInt cenRepKey;
+    if(!GetIntFromConfig(ConfigSection(), KCenRepKey, cenRepKey))
+        {
+        ERR_PRINTF1(_L("Central Reposatory Key is missing in the configuration file!"));
+        SetTestStepResult(EFail);
+        return TestStepResult();
+        }
+    
+    TInt cenRepValue;
+    if(!GetIntFromConfig(ConfigSection(), KCenRepValue, cenRepValue))
+        {
+        ERR_PRINTF1(_L("Central Reposatory Value is missing in the configuration file!"));
+        SetTestStepResult(EFail);
+        return TestStepResult();
+        }
+    
+    CRepository* rep = CRepository::NewLC(repUid);
+    TInt err = rep->Set(cenRepKey, cenRepValue);
+        
+    if( err == KErrNone )
+    {
+        INFO_PRINTF4(_L("Setting Central Reposatory  0x%08x  , key = %d, value = %d"),repUid,cenRepKey,cenRepValue);
+    }
+    else
+    {
+        SetTestStepResult(EFail);
+        ERR_PRINTF4(_L("Failed Setting Central Reposatory  0x%08x  , key = %d, value = %d"),repUid,cenRepKey,cenRepValue);
+    }
+    
+    CleanupStack::PopAndDestroy(rep); 
+    return TestStepResult();
+    }
+
+
+/////////////////////////////////////////////////////////////////////
 // CIsPackageInstalledStep - checks if packages are registered
 /////////////////////////////////////////////////////////////////////