loggingservices/eventlogger/test/src/T_LogSecurity.cpp
branchRCL_3
changeset 9 667e88a979d7
parent 0 08ec8eefde2f
equal deleted inserted replaced
8:fa9941cf3867 9:667e88a979d7
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    17 #include <f32file.h>
    17 #include <f32file.h>
    18 #include "logservsecurity.h"
    18 #include "logservsecurity.h"
    19 #include "LogServResourceInterpreter.h"
    19 #include "LogServResourceInterpreter.h"
    20 #include <logeng.h>
    20 #include <logeng.h>
    21 #include <logengevents.h>
    21 #include <logengevents.h>
    22 #include "SecurityPolicy.h"
    22 #include "t_logsecuritypolicy.h"
    23 
    23 #include "t_logutil.h"
    24 static RTest TheTest(_L("T_LogSecurity"));
    24 
       
    25 RTest TheTest(_L("t_logsecurity"));
    25 static RFs TheFileSess;
    26 static RFs TheFileSess;
    26 
    27 
    27 ///////////////////////////////////////////////////////////////////////////////////////
       
    28 ///////////////////////////////////////////////////////////////////////////////////////
       
    29 //Test macross and functions
       
    30 
       
    31 static void Check(TInt aValue, TInt aLine)
       
    32 	{
       
    33 	if(!aValue)
       
    34 		{
       
    35 		TheTest(EFalse, aLine);
       
    36 		}
       
    37 	}
       
    38 static  void Check(TInt aValue, TInt aExpected, TInt aLine)
       
    39 	{
       
    40 	if(aValue != aExpected)
       
    41 		{
       
    42 		RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
       
    43 		TheTest(EFalse, aLine);
       
    44 		}
       
    45 	}
       
    46 #define TEST(arg) ::Check((arg), __LINE__)
       
    47 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
       
    48 	
       
    49 ///////////////////////////////////////////////////////////////////////////////////////
    28 ///////////////////////////////////////////////////////////////////////////////////////
    50 //
    29 //
    51 
    30 
    52 //Check if supplied aPolicy parameter has aCapability capability.
    31 //Check if supplied aPolicy parameter has aCapability capability.
    53 static TBool HasCapability(const TCompiledSecurityPolicy& aPolicy, TCapability aCapability)
    32 static TBool HasCapability(const TCompiledSecurityPolicy& aPolicy, TCapability aCapability)
   188 			__UHEAP_MARKEND;
   167 			__UHEAP_MARKEND;
   189 			}
   168 			}
   190 		else if(err == KErrNone)
   169 		else if(err == KErrNone)
   191 			{
   170 			{
   192 			__UHEAP_MARKEND;
   171 			__UHEAP_MARKEND;
   193 			RDebug::Print(_L("The test succeeded at heap failure rate=%d.\n"), count);
   172 			TheTest.Printf(_L("The test succeeded at heap failure rate=%d.\n"), count);
   194 			break;
   173 			break;
   195 			}
   174 			}
   196 		else 
   175 		else 
   197 			{
   176 			{
   198 			__UHEAP_MARKEND;
   177 			__UHEAP_MARKEND;