kerneltest/e32test/power/domainpolicytest.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <domainpolicy.h>
       
    17 #include "domainpolicytest.h"
       
    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 
       
    49 /**
       
    50 Gets access to the test hierarchy specification.
       
    51 
       
    52 The domain hierarchy specification is a simple array of TDmDomainSpec items.
       
    53 
       
    54 The default implementation provided by Symbian OS just returns a pointer to
       
    55 the domain hierarchy specification array.
       
    56 
       
    57 @return A pointer to the domain hierarchy specification array.
       
    58 */
       
    59 EXPORT_C const TDmDomainSpec* DmPolicy::GetDomainSpecs()
       
    60 	{
       
    61 	return (TDmDomainSpec*) DomainHierarchy;
       
    62 	}
       
    63 
       
    64 
       
    65 
       
    66 
       
    67 /**
       
    68 Releases access to the specified domain hierarchy specification.
       
    69 
       
    70 The domain hierarchy specification is a simple array of TDmDomainSpec items.
       
    71 
       
    72 As the default Symbian OS implementation of GetDomainSpecs() just returns
       
    73 a pointer to the domain hierarchy specification array, then the default
       
    74 implementation of Release() is empty. The API is provided to permit
       
    75 more complex implementations, if required.
       
    76 
       
    77 @param aDomainSpec A pointer to the domain hierarchy specification array.
       
    78 */
       
    79 EXPORT_C void DmPolicy::Release(const TDmDomainSpec* /*aDomainSpec*/)
       
    80 	{
       
    81 	}
       
    82 
       
    83 
       
    84 /**
       
    85 Retrieves the domain hierarchy policy 
       
    86 
       
    87 @param	aPolicy a client-supplied policy which on exit
       
    88 		will contain a copy of the policy for the requested domain hierarchy id.
       
    89 
       
    90   
       
    91 @return	KErrNone
       
    92 */
       
    93 EXPORT_C TInt DmPolicy::GetPolicy(TDmHierarchyPolicy& aPolicy)
       
    94 	{
       
    95 	aPolicy = HierarchyPolicy;
       
    96 	return KErrNone;
       
    97 	}
       
    98