|
1 // Copyright (c) 2001-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 "TestStepNetCon.h" |
|
17 #include <networking/log.h> |
|
18 #include "OomTests.h" |
|
19 |
|
20 CTestStepNetCon::CTestStepNetCon(TInt aTestNumber) |
|
21 // |
|
22 // C'tor |
|
23 // |
|
24 : iTestNumber(aTestNumber) |
|
25 { |
|
26 |
|
27 _LIT(KTestStepNameFormat, "NC-5-%d"); |
|
28 iTestStepName.AppendFormat(KTestStepNameFormat(), iTestNumber); |
|
29 } |
|
30 |
|
31 CTestStepNetCon::~CTestStepNetCon() |
|
32 // |
|
33 // D'tor |
|
34 // |
|
35 { |
|
36 } |
|
37 |
|
38 enum TVerdict CTestStepNetCon::doTestStepL() |
|
39 // |
|
40 // Run a netcon test step |
|
41 // |
|
42 { |
|
43 |
|
44 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
|
45 CleanupStack::PushL(scheduler); |
|
46 CActiveScheduler::Install(scheduler); |
|
47 |
|
48 TInt allocation(1); |
|
49 MNetConTest::TResult result = MNetConTest::EFailed; |
|
50 |
|
51 while(result != MNetConTest::EPassed) |
|
52 { |
|
53 __UHEAP_MARK; |
|
54 |
|
55 CNetConTestBase* test = GetTestLC(); |
|
56 |
|
57 __UHEAP_SETFAIL(RHeap::EDeterministic, allocation); |
|
58 test->Start(); |
|
59 __UHEAP_SETFAIL(RHeap::ENone, 1); |
|
60 |
|
61 ++allocation; |
|
62 result = test->Result(); |
|
63 |
|
64 CleanupStack::PopAndDestroy(test); |
|
65 test = NULL; |
|
66 |
|
67 __UHEAP_MARKEND; |
|
68 } |
|
69 |
|
70 CleanupStack::PopAndDestroy(scheduler); |
|
71 return EPass; |
|
72 } |
|
73 |
|
74 CNetConTestBase* CTestStepNetCon::GetTestLC() |
|
75 // |
|
76 // Return the test |
|
77 // |
|
78 { |
|
79 |
|
80 CNetConTestBase* test = NULL; |
|
81 |
|
82 switch(iTestNumber) |
|
83 { |
|
84 case 1: |
|
85 test = CNetConTest0501::NewLC(); |
|
86 break; |
|
87 case 2: |
|
88 test = CNetConTest0502::NewLC(); |
|
89 break; |
|
90 default: |
|
91 User::Leave(KErrArgument); |
|
92 } |
|
93 |
|
94 return test; |
|
95 } |
|
96 |