kerneltest/e32test/domainmgr/domainpolicytest.cpp
changeset 279 957c583b417b
parent 245 647ab20fee2e
equal deleted inserted replaced
275:2b433474f2ba 279:957c583b417b
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2004-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 the License "Eclipse Public License v1.0"
     4 // under the terms of the License "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".
    14 //
    14 //
    15 
    15 
    16 #include <domainpolicy.h>
    16 #include <domainpolicy.h>
    17 #include "domainpolicytest.h"
    17 #include "domainpolicytest.h"
    18 
    18 
    19 const TInt KDomainTimeout = 2000000; /* 2000ms */
       
    20 
       
    21 static const TDmDomainSpec DomainHierarchy[] = 
       
    22 	{
       
    23 		{ KDmIdRoot,	KDmIdNone,	_INIT_SECURITY_POLICY_C1(ECapabilityWriteDeviceData),		EStartupCriticalStatic,	KDomainTimeout	},
       
    24 
       
    25 		// row 1		
       
    26 		{ KDmIdTestA,	KDmIdRoot,	_INIT_SECURITY_POLICY_PASS,									EStartupCriticalStatic,	KDomainTimeout	},
       
    27 		{ KDmIdTestB,	KDmIdRoot,	_INIT_SECURITY_POLICY_PASS,									EStartupCriticalStatic,	KDomainTimeout	},
       
    28 		{ KDmIdTestC,	KDmIdRoot,	_INIT_SECURITY_POLICY_PASS,									EStartupCriticalStatic,	KDomainTimeout	},
       
    29 
       
    30 		// row 2
       
    31 		{ KDmIdTestAA,	KDmIdTestA,	_INIT_SECURITY_POLICY_PASS,									EStartupCriticalStatic,	KDomainTimeout	},
       
    32 		{ KDmIdTestAB,	KDmIdTestA,	_INIT_SECURITY_POLICY_PASS,									EStartupCriticalStatic,	KDomainTimeout	},
       
    33 		{ KDmIdTestBA,	KDmIdTestB,	_INIT_SECURITY_POLICY_PASS,									EStartupCriticalStatic,	KDomainTimeout	},
       
    34 		{ KDmIdTestCA,	KDmIdTestC,	_INIT_SECURITY_POLICY_PASS,									EStartupCriticalStatic,	KDomainTimeout	},
       
    35 		
       
    36 		// row 3
       
    37 		{ KDmIdTestABA,	KDmIdTestAB,_INIT_SECURITY_POLICY_PASS,									EStartupCriticalStatic,	KDomainTimeout	},
       
    38 		{ KDmIdTestABB,	KDmIdTestAB,_INIT_SECURITY_POLICY_PASS,									EStartupCriticalStatic,	KDomainTimeout	},
       
    39 		{ KDmIdTestCAA,	KDmIdTestCA,_INIT_SECURITY_POLICY_PASS,									EStartupCriticalStatic,	KDomainTimeout	},
       
    40 
       
    41 		// end of array marker
       
    42 		{ KDmIdNone,	KDmIdNone,	_INIT_SECURITY_POLICY_PASS,	0,	0	}
       
    43 	};
       
    44 static const TDmHierarchyPolicy HierarchyPolicy	= 
       
    45 	{ETraverseParentsFirst, ETraverseChildrenFirst, ETransitionFailureStop};
       
    46 	
       
    47 
       
    48 
    19 
    49 /**
    20 /**
    50 Gets access to the test hierarchy specification.
    21 Gets access to the test hierarchy specification.
    51 
    22 
    52 The domain hierarchy specification is a simple array of TDmDomainSpec items.
    23 The domain hierarchy specification is a simple array of TDmDomainSpec items.
    56 
    27 
    57 @return A pointer to the domain hierarchy specification array.
    28 @return A pointer to the domain hierarchy specification array.
    58 */
    29 */
    59 EXPORT_C const TDmDomainSpec* DmPolicy::GetDomainSpecs()
    30 EXPORT_C const TDmDomainSpec* DmPolicy::GetDomainSpecs()
    60 	{
    31 	{
    61 	return (TDmDomainSpec*) DomainHierarchy;
    32 	return DomainHierarchy;
    62 	}
    33 	}
    63 
       
    64 
       
    65 
    34 
    66 
    35 
    67 /**
    36 /**
    68 Releases access to the specified domain hierarchy specification.
    37 Releases access to the specified domain hierarchy specification.
    69 
    38 
    80 	{
    49 	{
    81 	}
    50 	}
    82 
    51 
    83 
    52 
    84 /**
    53 /**
    85 Retrieves the domain hierarchy policy 
    54 Retrieves the domain hierarchy policy
    86 
    55 
    87 @param	aPolicy a client-supplied policy which on exit
    56 @param	aPolicy a client-supplied policy which on exit
    88 		will contain a copy of the policy for the requested domain hierarchy id.
    57 		will contain a copy of the policy for the requested domain hierarchy id.
    89 
    58 
    90   
    59 
    91 @return	KErrNone
    60 @return	KErrNone
    92 */
    61 */
    93 EXPORT_C TInt DmPolicy::GetPolicy(TDmHierarchyPolicy& aPolicy)
    62 EXPORT_C TInt DmPolicy::GetPolicy(TDmHierarchyPolicy& aPolicy)
    94 	{
    63 	{
    95 	aPolicy = HierarchyPolicy;
    64 	aPolicy = HierarchyPolicy;
    96 	return KErrNone;
    65 	return KErrNone;
    97 	}
    66 	}
    98 
    67 
       
    68 
       
    69 #ifdef DOMAIN_POLICY_V2
       
    70 
       
    71 EXPORT_C TInt DmPolicy::GetStateSpec(TAny*& aPtr, TUint& aNumElements)
       
    72 	{
       
    73 	aNumElements = StateSpecificationSize;
       
    74 	if (StateSpecificationSize)
       
    75 		aPtr = (TAny*) StateSpecification;
       
    76 	else
       
    77 		aPtr = NULL;
       
    78 	return StateSpecificationVersion;
       
    79 	}
       
    80 
       
    81 
       
    82 EXPORT_C void DmPolicy::ReleaseStateSpec(TAny* /*aStateSpec*/)
       
    83 	{
       
    84 	}
       
    85 
       
    86 #endif
       
    87 
       
    88