|
1 // Copyright (c) 2005-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Contains implementation of CTestCreateEntriesOOMStep class |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 */ |
|
22 |
|
23 // User Include |
|
24 #include "TestCreateEntriesOOMStep.h" |
|
25 |
|
26 /** |
|
27 Constructor. Sets the test step name. Testserver reference passed to make use |
|
28 of TEF's method of sharing data between test steps |
|
29 @internalTechnology |
|
30 @test |
|
31 */ |
|
32 CTestCreateEntriesOOMStep::CTestCreateEntriesOOMStep(CTestMultipleAlarmsServer& aTestServer) |
|
33 : CTestCreateCalEntriesStep(aTestServer) |
|
34 { |
|
35 //Call base class method to set human readable name for test step |
|
36 SetTestStepName(KTestCreateEntriesOOMStep); |
|
37 } |
|
38 |
|
39 /** |
|
40 Base class pure virtual. |
|
41 @return EPass or EFail indicating the result of the test step. |
|
42 @internalTechnology |
|
43 @test |
|
44 */ |
|
45 TVerdict CTestCreateEntriesOOMStep::doTestStepL() |
|
46 { |
|
47 CActiveScheduler* sched = new(ELeave) CActiveScheduler; |
|
48 CActiveScheduler::Install(sched); |
|
49 TestOOML(); |
|
50 delete sched; |
|
51 return TestStepResult(); |
|
52 } |
|
53 |
|
54 /** |
|
55 Tests creation of calendar entries in an OOM loop |
|
56 @internalTechnology |
|
57 @test |
|
58 */ |
|
59 void CTestCreateEntriesOOMStep::TestOOML() |
|
60 { |
|
61 TInt error = KErrNone; |
|
62 TInt failRate = 0; |
|
63 |
|
64 do |
|
65 {// The OOM loop |
|
66 ++failRate; |
|
67 __UHEAP_SETFAIL(RHeap::EDeterministic, failRate); |
|
68 __UHEAP_MARK; |
|
69 |
|
70 // Do the tests |
|
71 TRAP(error, CreateCalEntriesL()); |
|
72 |
|
73 __UHEAP_MARKEND; |
|
74 __UHEAP_RESET; |
|
75 |
|
76 if(error != KErrNone && error != KErrNoMemory) |
|
77 { |
|
78 INFO_PRINTF3(_L("Unexpected error occured in %S: %D"), &TestStepName(), error); |
|
79 SetTestStepResult(EFail); |
|
80 break; |
|
81 } |
|
82 }while(error != KErrNone); |
|
83 } |