1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/authorisation/userpromptservice/test/tups/src/tupspropertystep.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,124 @@
1.4 +/*
1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* tpropertystep.cpp
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +#include <e32property.h>
1.24 +#include "numberconversion.h"
1.25 +#include "tupspropertystep.h"
1.26 +
1.27 +CPropertyStep::CPropertyStep()
1.28 +/**
1.29 + * Constructor
1.30 + */
1.31 + {
1.32 + SetTestStepName(KPropertyStep);
1.33 + }
1.34 +
1.35 +CPropertyStep::~CPropertyStep()
1.36 +/**
1.37 + * Destructor
1.38 + */
1.39 + {
1.40 + __UHEAP_MARKEND;
1.41 + }
1.42 +
1.43 +TVerdict CPropertyStep::doTestStepPreambleL()
1.44 +/**
1.45 + * @return - TVerdict code
1.46 + * Override of base class virtual
1.47 + */
1.48 + {
1.49 + __UHEAP_MARK;
1.50 + SetTestStepResult(EPass);
1.51 + return TestStepResult();
1.52 + }
1.53 +
1.54 +TVerdict CPropertyStep::doTestStepPostambleL()
1.55 +/**
1.56 + * @return - TVerdict code
1.57 + * Override of base class virtual
1.58 + */
1.59 + {
1.60 + return TestStepResult();
1.61 + }
1.62 +
1.63 +TVerdict CPropertyStep::doTestStepL()
1.64 + {
1.65 +
1.66 + INFO_PRINTF1(_L(">> CPropertyStep::doTestStepL()"));
1.67 +
1.68 + TInt index = 1;
1.69 +
1.70 + TName fPropertyName;
1.71 + fPropertyName.Format(_L("PropertyName_%d"),index);
1.72 + TName fPropertyCreate;
1.73 + fPropertyCreate.Format(_L("PropertyCreate_%d"),index);
1.74 + TName fPropertyKey;
1.75 + fPropertyKey.Format(_L("PropertyKey_%d"),index);
1.76 + TName fPropertyType;
1.77 + fPropertyType.Format(_L("PropertyType_%d"),index);
1.78 +
1.79 + TPtrC propertyName;
1.80 + TBool propertyCreate;
1.81 + TInt propertyKey;
1.82 + TInt propertyType;
1.83 +
1.84 + GetStringFromConfig(ConfigSection(), fPropertyName, propertyName);
1.85 + GetBoolFromConfig(ConfigSection(),fPropertyCreate, propertyCreate);
1.86 + GetIntFromConfig(ConfigSection(),fPropertyKey, propertyKey);
1.87 + GetIntFromConfig(ConfigSection(),fPropertyType, propertyType);
1.88 +
1.89 + // read all the property details in from the ini file
1.90 + while (GetStringFromConfig(ConfigSection(), fPropertyName, propertyName)
1.91 + && GetBoolFromConfig(ConfigSection(),fPropertyCreate, propertyCreate)
1.92 + && GetIntFromConfig(ConfigSection(),fPropertyKey, propertyKey)
1.93 + && GetIntFromConfig(ConfigSection(),fPropertyType, propertyType))
1.94 + {
1.95 + // INFO_PRINTF2(_L("Read test action %d"),index); // debug
1.96 +
1.97 + if (propertyCreate)
1.98 + {
1.99 + static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
1.100 + if (propertyType == static_cast<TInt>(RProperty::EInt))
1.101 + {
1.102 + RProperty::Define(propertyKey, RProperty::EInt, KAllowAllPolicy, KAllowAllPolicy);
1.103 + }
1.104 + else
1.105 + {
1.106 + RProperty::Define(propertyKey, RProperty::EByteArray, KAllowAllPolicy, KAllowAllPolicy);
1.107 + }
1.108 + }
1.109 + else
1.110 + {
1.111 + RProperty::Delete(propertyKey);
1.112 + }
1.113 + ++index;
1.114 + fPropertyName.Format(_L("PropertyName_%d"), index);
1.115 + fPropertyCreate.Format(_L("PropertyCreate_%d"), index);
1.116 + fPropertyKey.Format(_L("PropertyKey_%d"), index);
1.117 + fPropertyType.Format(_L("PropertyType_%d"), index);
1.118 +
1.119 + GetStringFromConfig(ConfigSection(), fPropertyName, propertyName);
1.120 + GetBoolFromConfig(ConfigSection(),fPropertyCreate, propertyCreate);
1.121 + GetIntFromConfig(ConfigSection(),fPropertyKey, propertyKey);
1.122 + GetIntFromConfig(ConfigSection(),fPropertyType, propertyType);
1.123 +
1.124 + }
1.125 + SetTestStepResult(EPass);
1.126 + return TestStepResult();
1.127 + }