diff -r 000000000000 -r 08ec8eefde2f loggingservices/eventlogger/test/src/T_LogSecurity.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/loggingservices/eventlogger/test/src/T_LogSecurity.cpp Fri Jan 22 11:06:30 2010 +0200 @@ -0,0 +1,238 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include "logservsecurity.h" +#include "LogServResourceInterpreter.h" +#include +#include +#include "SecurityPolicy.h" + +static RTest TheTest(_L("T_LogSecurity")); +static RFs TheFileSess; + +/////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////// +//Test macross and functions + +static void Check(TInt aValue, TInt aLine) + { + if(!aValue) + { + TheTest(EFalse, aLine); + } + } +static void Check(TInt aValue, TInt aExpected, TInt aLine) + { + if(aValue != aExpected) + { + RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); + TheTest(EFalse, aLine); + } + } +#define TEST(arg) ::Check((arg), __LINE__) +#define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) + +/////////////////////////////////////////////////////////////////////////////////////// +// + +//Check if supplied aPolicy parameter has aCapability capability. +static TBool HasCapability(const TCompiledSecurityPolicy& aPolicy, TCapability aCapability) + { + TInt maxCount = 0; + if(aPolicy.Type() == TSecurityPolicy::ETypeS3 || + aPolicy.Type() == TSecurityPolicy::ETypeV3 || + aPolicy.Type() == TSecurityPolicy::ETypeC3) + { + maxCount = 3; + } + else if(aPolicy.Type() == TSecurityPolicy::ETypeC7) + { + maxCount = 7; + } + else + { + TEST(0); + } + for(TInt i=0;i