24
|
1 |
// Copyright (c) 1997-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 |
//
|
|
15 |
|
|
16 |
#include <e32test.h>
|
|
17 |
|
|
18 |
#include "TE_EtelMMTestStepBase.h"
|
|
19 |
#include "TE_mmmemlist.h"
|
|
20 |
#include "testdef.h"
|
|
21 |
|
|
22 |
CTestMemMMLists::CTestMemMMLists()
|
|
23 |
/** Each test step initialises it's own name
|
|
24 |
*/
|
|
25 |
{
|
|
26 |
// store the name of this test case
|
|
27 |
// this is the name that is used by the script file
|
|
28 |
SetTestStepName(_L("TestMemMMLists"));
|
|
29 |
}
|
|
30 |
|
|
31 |
enum TVerdict CTestMemMMLists::doTestStepL()
|
|
32 |
{
|
|
33 |
iTestCount=1;
|
|
34 |
TInt err = KErrNone;
|
|
35 |
INFO_PRINTF1(_L(""));
|
|
36 |
INFO_PRINTF1(_L("Test List classes coping with OOM"));
|
|
37 |
|
|
38 |
CMobilePhoneBroadcastIdList *list = CMobilePhoneBroadcastIdList::NewL();
|
|
39 |
CleanupStack::PushL(list);
|
|
40 |
|
|
41 |
|
|
42 |
RMobileBroadcastMessaging::TMobileBroadcastIdEntryV1 entry;
|
|
43 |
entry.iId = STATIC_CAST(TInt16,1);
|
|
44 |
|
|
45 |
TInt failNext = 0;
|
|
46 |
do
|
|
47 |
{
|
|
48 |
__UHEAP_FAILNEXT(++failNext);
|
|
49 |
TRAP(err,list->AddEntryL(entry));
|
|
50 |
} while (err != KErrNone);
|
|
51 |
__UHEAP_RESET;
|
|
52 |
|
|
53 |
INFO_PRINTF3(_L("Test %d - CMobilePhoneBroadcastIdList::AddEntryL OOM Test required %d allocations to succeed"),iTestCount++,failNext);
|
|
54 |
CleanupStack::PopAndDestroy();
|
|
55 |
|
|
56 |
list = CMobilePhoneBroadcastIdList::NewL();
|
|
57 |
CleanupStack::PushL(list);
|
|
58 |
|
|
59 |
failNext = 0;
|
|
60 |
entry.iId = STATIC_CAST(TInt16,0);
|
|
61 |
do
|
|
62 |
{
|
|
63 |
__UHEAP_FAILNEXT(++failNext);
|
|
64 |
TRAP(err,list->InsertEntryL(0,entry));
|
|
65 |
} while (err == KErrNoMemory);
|
|
66 |
__UHEAP_RESET;
|
|
67 |
|
|
68 |
INFO_PRINTF3(_L("Test %d - CMobilePhoneBroadcastIdList::InsertEntryL OOM Test required %d allocations to succeed"),iTestCount++,failNext);
|
|
69 |
|
|
70 |
CleanupStack::PopAndDestroy();
|
|
71 |
|
|
72 |
list = CMobilePhoneBroadcastIdList::NewL();
|
|
73 |
CleanupStack::PushL(list);
|
|
74 |
|
|
75 |
RMobileBroadcastMessaging::TMobileBroadcastIdEntryV1 start,end;
|
|
76 |
|
|
77 |
start.iId = 0;
|
|
78 |
end.iId = 49;
|
|
79 |
|
|
80 |
failNext = 0;
|
|
81 |
do
|
|
82 |
{
|
|
83 |
__UHEAP_FAILNEXT(++failNext);
|
|
84 |
TRAP(err,list->AddRangeEntryL(start,end));
|
|
85 |
} while (err == KErrNoMemory);
|
|
86 |
__UHEAP_RESET;
|
|
87 |
|
|
88 |
INFO_PRINTF3(_L("Test %d - CMobilePhoneBroadcastIdList::AddRangeEntryL OOM Test required %d allocations to succeed"),iTestCount++,failNext);
|
|
89 |
|
|
90 |
CleanupStack::PopAndDestroy();
|
|
91 |
INFO_PRINTF1(_L(""));
|
|
92 |
|
|
93 |
return TestStepResult();
|
|
94 |
}
|