Update contrib.
1 // Copyright (c) 2008-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\demandpaging\t_dpapi.cpp
19 #define __E32TEST_EXTENSION__
30 RTest test(_L("T_DPAPI"));
32 TInt TestingTChunkCreate();
33 TInt TestingTChunkHeapCreate();
34 TInt TestingTThreadCreate();
36 void TestGlobalConfig()
38 test_Equal(gDataPagingSupported, gDataPagingPolicy != EKernelConfigDataPagingPolicyNoPaging);
48 TPagedSetting GetMmpPagedSetting()
51 // c => ram loaded code
55 TFileName name = RProcess().FileName();
56 test.Printf(_L("%S\n"), &name);
57 TInt pos = name.LocateReverse('\\');
58 test(pos >= 0 && pos < (name.Length() - 1));
59 TPtrC leaf = name.Mid(pos + 1);
60 if (leaf == _L("t_dpapi_p.exe") || leaf == _L("t_dpapi_cp.exe"))
62 else if (leaf == _L("t_dpapi_u.exe") || leaf == _L("t_dpapi_cu.exe"))
64 test(leaf == _L("t_dpapi.exe") || leaf == _L("t_dpapi_c.exe"));
68 TPagedSetting ExpectedProcessPagedSetting(TPagedSetting aMmpPagedSetting)
70 switch (gDataPagingPolicy)
72 case EKernelConfigDataPagingPolicyAlwaysPage:
75 case EKernelConfigDataPagingPolicyNoPaging:
78 case EKernelConfigDataPagingPolicyDefaultUnpaged:
79 return aMmpPagedSetting == EDefault ? EUnpaged : aMmpPagedSetting;
81 case EKernelConfigDataPagingPolicyDefaultPaged:
82 return aMmpPagedSetting == EDefault ? EPaged : aMmpPagedSetting;
90 void TestMmpFileDataPagedKeyword()
92 TPagedSetting expected = ExpectedProcessPagedSetting(GetMmpPagedSetting());
93 TPagedSetting actual = gProcessPaged ? EPaged : EUnpaged;
94 test_Equal(expected, actual);
100 test_KErrNone(GetGlobalPolicies());
102 test.Start(_L("Test global datapaging configuration"));
105 test.Next(_L("Test mmp file data paged keyword"));
106 TestMmpFileDataPagedKeyword();
108 test.Next(_L("TestingTChunkCreate"));
109 TestingTChunkCreate();
111 test.Next(_L("TestingTThreadCreate"));
112 TestingTThreadCreate();
114 test.Next(_L("TestingTChunkHeapCreate"));
115 TestingTChunkHeapCreate();