kerneltest/e32test/secure/t_platsecconfig.cpp
changeset 271 dc268b18d709
parent 121 661475905584
--- a/kerneltest/e32test/secure/t_platsecconfig.cpp	Mon Sep 13 15:16:07 2010 +0100
+++ b/kerneltest/e32test/secure/t_platsecconfig.cpp	Wed Sep 22 10:53:45 2010 +0100
@@ -235,7 +235,9 @@
 	{
 	CTrapCleanup* cleanupStack = CTrapCleanup::New();
 	if(!cleanupStack)
+		{
 		return KErrNoMemory;
+		}
 	TRAPD(leaveError,DoStartServer())
 	delete cleanupStack;
 	return leaveError;
@@ -272,7 +274,9 @@
 	{
 	TInt i;
 	for(i=0; i<ECapability_Limit; i++)
+		{
 		test((!a1.HasCapability((TCapability)i))==(!a2.HasCapability((TCapability)i)));
+		}
 	}
 
 TBuf8<1024> CapabilityNameBuffer;
@@ -293,9 +297,13 @@
 			if(allCaps.HasCapability((TCapability)i))
 				{
 				if(i&1)
+					{
 					odd = EFalse;
+					}
 				else
+					{
 					even = EFalse;
+					}
 				}
 			continue;
 			}
@@ -305,11 +313,17 @@
 		CapabilityNameBuffer.Append((TChar)' ');
 		}
 	if(!CapabilityNameBuffer.Length())
+		{
 		CapabilityNameBuffer.Append(_L8("NONE"));
+		}
 	if(even)
+		{
 		CapabilityNameBuffer.Append(_L8("(These are all EVEN numbered capabilities)"));
+		}
 	if(odd)
+		{
 		CapabilityNameBuffer.Append(_L8("(These are all ODD numbered capabilities)"));
+		}
 	return CapabilityNameBuffer.Expand();
 }
 
@@ -343,10 +357,16 @@
 	TCapabilitySet notEnforced;
 	notEnforced.SetEmpty();
 	for(TInt i=0; i<ECapability_HardLimit; i++)
+		{
 		if(!PlatSec::IsCapabilityEnforced((TCapability)i))
+			{
 			notEnforced.AddCapability((TCapability)i);
+			}
+		}	
 	if(!PlatSec::ConfigSetting(PlatSec::EPlatSecEnforcement))
+		{
 		disabled.SetAllSupported();
+		}
 	CheckCapabilitySetEqual(notEnforced,disabled);
 
 	test.End();
@@ -377,15 +397,22 @@
 	test(process.ExitType()==EExitKill);
 	r=logon.Int();
 	CLOSE_AND_WAIT(process);
+
 	if(PlatSecEnforcement)
+		{
 		test(r==KErrPermissionDenied);
+		}
 	else
+		{
 		test(r==KErrNone);
+		}
 
 	test.Next(_L("Check static linkage without required capabilities"));
 	r=process.Create(_L("T_PSC_STATIC"),_L(""));
 	if(PlatSecEnforcement)
+		{
 		test(r==KErrPermissionDenied);
+		}	
 	else
 		{
 		test(r==KErrNone);
@@ -396,6 +423,23 @@
 	test.End();
 	}
 
+/**
+Do simple test of diagnostic function without parameters (EmitDiagnostic())
+*/
+void TestPlatSecDiagnostic()
+	{
+	TInt r;
+	r=PlatSec::EmitDiagnostic();
+	if(PlatSecEnforcement)
+		{
+		test(r==KErrPermissionDenied);
+		}
+	else
+		{
+		test(r==KErrNone);
+		}
+	}
+
 #include <e32svr.h>
 IMPORT_C void dummyExport();
 
@@ -446,6 +490,9 @@
 	test.Next(_L("Test PlatSecEnforcement"));
 	TestPlatSecEnforcement();
 
+	test.Next(_L("Test PlatSecDiagnostic()"));
+	TestPlatSecDiagnostic();
+
 	test.Next(_L("Closing server session"));
 	Session.Send(CTestSession::EShutdown);
 	Session.Close();
@@ -474,7 +521,9 @@
 	timer.After(timerStat,20*1000000);
 	User::WaitForRequest(timerStat,keyStat);
 	if(keyStat!=KRequestPending)
+		{
 		(void)test.Console()->KeyCode();
+		}
 	timer.Cancel();
 	test.Console()->ReadCancel();
 	User::WaitForAnyRequest();