|
1 // |
|
2 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 // All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of "Eclipse Public License v1.0" |
|
6 // which accompanies this distribution, and is available |
|
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 // |
|
9 // Initial Contributors: |
|
10 // Nokia Corporation - initial contribution. |
|
11 // |
|
12 // Contributors: |
|
13 // |
|
14 // Description: |
|
15 // |
|
16 // |
|
17 // |
|
18 // This contains CommDb Unit Test Cases 006.01 - 006.05 |
|
19 |
|
20 // EPOC includes |
|
21 #include <e32base.h> |
|
22 #include <commdb.h> |
|
23 |
|
24 |
|
25 // Test system includes |
|
26 #include "Teststepcommdb.h" |
|
27 #include "step_006_xx.h" |
|
28 |
|
29 |
|
30 |
|
31 ///////////////////// |
|
32 // Test step 006.001 |
|
33 ///////////////////// |
|
34 |
|
35 // constructor |
|
36 CCommDbTest006_01::CCommDbTest006_01() |
|
37 { |
|
38 // store the name of this test case |
|
39 SetTestStepName(_L("step_006_01")); |
|
40 } |
|
41 |
|
42 // destructor |
|
43 CCommDbTest006_01::~CCommDbTest006_01() |
|
44 { |
|
45 } |
|
46 |
|
47 TVerdict CCommDbTest006_01::doTestStepPreambleL() |
|
48 { |
|
49 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
50 SetTestStepResult(EPass); return TestStepResult(); |
|
51 } |
|
52 |
|
53 TInt CCommDbTest006_01::executeStepL() |
|
54 { |
|
55 TInt ret = iTheView->GotoFirstRecord(); |
|
56 return ret; |
|
57 } |
|
58 |
|
59 TVerdict CCommDbTest006_01::doTestStepL( ) |
|
60 { |
|
61 INFO_PRINTF1(_L("Step 006.01 called ")); |
|
62 |
|
63 if ( executeStepL() == KErrNone ) |
|
64 SetTestStepResult(EPass); else |
|
65 SetTestStepResult(EFail); |
|
66 return TestStepResult(); |
|
67 } |
|
68 |
|
69 |
|
70 ///////////////////// |
|
71 // Test step 006.002 |
|
72 ///////////////////// |
|
73 |
|
74 // constructor |
|
75 CCommDbTest006_02::CCommDbTest006_02() |
|
76 { |
|
77 // store the name of this test case |
|
78 SetTestStepName(_L("step_006_02")); |
|
79 // default to no local objects allocated |
|
80 iLocalObjects = EFalse; |
|
81 } |
|
82 |
|
83 // destructor |
|
84 CCommDbTest006_02::~CCommDbTest006_02() |
|
85 { |
|
86 } |
|
87 |
|
88 TVerdict CCommDbTest006_02::doTestStepPreambleL() |
|
89 { |
|
90 openDbAndViewL(TPtrC(IAP)); |
|
91 SetTestStepResult(EPass); return TestStepResult(); |
|
92 } |
|
93 |
|
94 TInt CCommDbTest006_02::executeStepL() |
|
95 { |
|
96 TInt ret = iTheView->GotoFirstRecord(); |
|
97 return ret; |
|
98 } |
|
99 |
|
100 TVerdict CCommDbTest006_02::doTestStepL( ) |
|
101 { |
|
102 INFO_PRINTF1(_L("Step 006.02 called ")); |
|
103 |
|
104 if ( executeStepL() == KErrNotFound ) |
|
105 SetTestStepResult(EPass); else |
|
106 SetTestStepResult(EFail); |
|
107 return TestStepResult(); |
|
108 } |
|
109 |
|
110 ///////////////////// |
|
111 // Test step 006.003 |
|
112 ///////////////////// |
|
113 |
|
114 // constructor |
|
115 CCommDbTest006_03::CCommDbTest006_03() |
|
116 { |
|
117 // store the name of this test case |
|
118 SetTestStepName(_L("step_006_03")); |
|
119 } |
|
120 |
|
121 // destructor |
|
122 CCommDbTest006_03::~CCommDbTest006_03() |
|
123 { |
|
124 } |
|
125 |
|
126 TVerdict CCommDbTest006_03::doTestStepPreambleL() |
|
127 { |
|
128 openDbAndViewL(TPtrC(DIAL_IN_ISP)); |
|
129 SetTestStepResult(EPass); return TestStepResult(); |
|
130 } |
|
131 |
|
132 TInt CCommDbTest006_03::executeStepL() |
|
133 { |
|
134 TInt ret = iTheView->GotoFirstRecord(); |
|
135 return ret; |
|
136 } |
|
137 |
|
138 TVerdict CCommDbTest006_03::doTestStepL( ) |
|
139 { |
|
140 INFO_PRINTF1(_L("Step 006.03 called ")); |
|
141 |
|
142 if ( executeStepL() == KErrNotFound ) |
|
143 SetTestStepResult(EPass); else |
|
144 SetTestStepResult(EFail); |
|
145 |
|
146 return TestStepResult(); |
|
147 } |
|
148 |
|
149 |
|
150 ///////////////////// |
|
151 // Test step 006.004 |
|
152 ///////////////////// |
|
153 |
|
154 // constructor |
|
155 CCommDbTest006_04::CCommDbTest006_04() |
|
156 { |
|
157 // store the name of this test case |
|
158 SetTestStepName(_L("step_006_04")); |
|
159 // default to no local objects allocated |
|
160 iLocalObjects = EFalse; |
|
161 } |
|
162 |
|
163 // destructor |
|
164 CCommDbTest006_04::~CCommDbTest006_04() |
|
165 { |
|
166 } |
|
167 |
|
168 |
|
169 TVerdict CCommDbTest006_04::doTestStepPreambleL() |
|
170 { |
|
171 openDbAndViewL(TPtrC(IAP)); |
|
172 SetTestStepResult(EPass); return TestStepResult(); |
|
173 } |
|
174 |
|
175 |
|
176 TInt CCommDbTest006_04::executeStepL() |
|
177 { |
|
178 TInt ret = iTheView->GotoFirstRecord(); |
|
179 return ret; |
|
180 } |
|
181 |
|
182 TVerdict CCommDbTest006_04::doTestStepL( ) |
|
183 { |
|
184 INFO_PRINTF1(_L("Step 006.04 called ")); |
|
185 |
|
186 if ( executeStepL() == KErrNotFound ) |
|
187 SetTestStepResult(EPass); else |
|
188 SetTestStepResult(EFail); |
|
189 return TestStepResult(); |
|
190 } |
|
191 |
|
192 |
|
193 ///////////////////// |
|
194 // Test step 006.005 |
|
195 ///////////////////// |
|
196 |
|
197 // constructor |
|
198 CCommDbTest006_05::CCommDbTest006_05() |
|
199 { |
|
200 // store the name of this test case |
|
201 SetTestStepName(_L("step_006_05")); |
|
202 } |
|
203 |
|
204 // destructor |
|
205 CCommDbTest006_05::~CCommDbTest006_05() |
|
206 { |
|
207 } |
|
208 |
|
209 |
|
210 TVerdict CCommDbTest006_05::doTestStepL( ) |
|
211 { |
|
212 INFO_PRINTF1(_L("Step 006.04 called ")); |
|
213 |
|
214 SetTestStepResult(EPass); |
|
215 //Heap test for 006.01 |
|
216 CCommDbTest006_01* step006_01 = new CCommDbTest006_01; |
|
217 CleanupStack::PushL(step006_01); |
|
218 doTestStepWithHeapFailureL( *step006_01, KErrNone); |
|
219 if( step006_01->TestStepResult() == EFail ) |
|
220 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step006_01); |
|
221 |
|
222 //Heap test for 006.02 |
|
223 |
|
224 CCommDbTest006_02* step006_02 = new CCommDbTest006_02; |
|
225 CleanupStack::PushL(step006_02); |
|
226 doTestStepWithHeapFailureL( *step006_02, KErrNotFound); |
|
227 if( step006_02->TestStepResult() == EFail ) |
|
228 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step006_02); |
|
229 |
|
230 |
|
231 |
|
232 //Heap test for 006.03 |
|
233 // it is not possible to copy database files, so this tests couldn't run |
|
234 // with proper conditions(database) |
|
235 //Heap test for 006.04 |
|
236 CCommDbTest006_04* step006_04 = new CCommDbTest006_04; |
|
237 CleanupStack::PushL(step006_04); |
|
238 doTestStepWithHeapFailureL( *step006_04, KErrNotFound); |
|
239 if( step006_04->TestStepResult() == EFail ) |
|
240 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step006_04); |
|
241 |
|
242 |
|
243 return TestStepResult(); |
|
244 } |