First public contribution.
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 "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.
16 #include "TestPlayerUtils.h"
17 #include "OpenFileByHandle7805.h"
21 CTestMmfAclntOpenFile7805::CTestMmfAclntOpenFile7805(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
22 : CTestMmfAclntOpenFile7803(aTestName, aSectName, aKeyName)
25 CTestMmfAclntOpenFile7805* CTestMmfAclntOpenFile7805::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
27 CTestMmfAclntOpenFile7805* self = new (ELeave) CTestMmfAclntOpenFile7805(aTestName, aSectName, aKeyName);
34 TVerdict CTestMmfAclntOpenFile7805::DoTestL(CMdaAudioPlayerUtility* aPlayer)
36 TVerdict iAllocTestStepResult=EPass;
38 TBool result = EFalse;
40 //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<<
41 if( PerformTestL(aPlayer) != EPass )
48 INFO_PRINTF2(_L("Test error, returned error code = %d"), err);
53 //Check the iAllocTestStepResult
54 if (iAllocTestStepResult != EPass)
61 TBool completed = EFalse;
62 iAllocTestStepResult = EPass; // XXX check?? assume pass
63 TBool reachedEnd = EFalse; // Note: declare outside loop to help with debugging
65 aPlayer->UseSharedHeap(); //-Enable UseSharedHeap to test controller alloc failures
71 __UHEAP_SETFAIL(RHeap::EFailNext, failCount);
73 //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<<
74 TVerdict verdict = EFail;
75 TRAP(err, verdict = PerformTestL(aPlayer));
77 if (err == KErrNone && verdict != EPass)
85 TAny *testAlloc = User::Alloc(1); // when this fails, we passed through all allocs within test
86 if (testAlloc == NULL)
93 User::Free(testAlloc);
96 //Check the iAllocTestStepResult
97 if (iAllocTestStepResult != EPass)
102 completed = reachedEnd || result;
104 else if (err != KErrNoMemory) // bad error code
111 __UHEAP_SETFAIL(RHeap::ENone, 0);
121 failCount -= 1; // Failcount of 1 equates to 0 successful allocs, etc
123 if (err != KErrNone || result)
126 iAllocTestStepResult = EFail;
129 format.Format(_L(" Bad result with %d memory allocations tested\n"), failCount);
133 format.Format(_L(" Error(%d) with %d memory allocations tested\n"), err, failCount);
140 format.Format(_L(" Completed OK with %d memory allocations tested\n"), failCount);
144 return iAllocTestStepResult;