|
1 /* |
|
2 * Copyright (c) 2005 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 the License "Symbian Foundation License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * ?description_line |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDES |
|
21 #include "FT_CPosTp126.h" |
|
22 #include <EPos_CPosLandmarkDatabase.h> |
|
23 #include <EPos_CPosLmMultiDbSearch.h> |
|
24 #include <EPos_CPosLmTextCriteria.h> |
|
25 #include <EPos_CPosLmCatNameCriteria.h> |
|
26 #include <EPos_CPosLmAreaCriteria.h> |
|
27 #include <EPos_CPosLmCategoryCriteria.h> |
|
28 #include <EPos_CPosLmCompositeCriteria.h> |
|
29 #include <EPos_CPosLmIdListCriteria.h> |
|
30 #include <EPos_CPosLmNearestCriteria.h> |
|
31 #include <EPos_CPosLmSearchCriteria.h> |
|
32 #include <EPos_TPosLMSortPref.h> |
|
33 #include <EPos_CPosLmDatabaseManager.h> |
|
34 #include "FT_LandmarkConstants.h" |
|
35 #include <EPos_CPosLandmarkSearch.h> |
|
36 //#include <ss_std.h> |
|
37 |
|
38 |
|
39 // CONSTANTS |
|
40 _LIT(KWildcard, "*"); |
|
41 |
|
42 // ================= MEMBER FUNCTIONS ======================= |
|
43 |
|
44 // --------------------------------------------------------- |
|
45 // CPosTp126::CloseTest |
|
46 // |
|
47 // (other items were commented in a header). |
|
48 // --------------------------------------------------------- |
|
49 // |
|
50 void CPosTp126::CloseTest() |
|
51 { |
|
52 iLog->Log(_L("CloseTest")); |
|
53 delete iLandmarksMultiDbSearch; |
|
54 iLandmarksMultiDbSearch = NULL; |
|
55 |
|
56 iThread.Close(); |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------- |
|
60 // CPosTp126::StartL |
|
61 // |
|
62 // (other items were commented in a header). |
|
63 // --------------------------------------------------------- |
|
64 // |
|
65 void CPosTp126::StartL() |
|
66 { |
|
67 RemoveAllLmDatabasesL(); |
|
68 CopyTestDbFileL(KDb20); |
|
69 CopyTestDbFileL(KDb40); |
|
70 CopyTestDbFileL(KDb60); |
|
71 CopyTestDbFileL(KDb80); |
|
72 CopyTestDbFileL(KDb105); |
|
73 |
|
74 CDesCArray* dbList = new (ELeave) CDesCArrayFlat(8); |
|
75 CleanupStack::PushL(dbList); |
|
76 dbList->AppendL(KDb20); |
|
77 dbList->AppendL(KDb40); |
|
78 dbList->AppendL(KDb60); |
|
79 dbList->AppendL(KDb80); |
|
80 dbList->AppendL(KDb105); |
|
81 |
|
82 iLandmarksMultiDbSearch = CPosLmMultiDbSearch::NewL(*dbList); |
|
83 TInt err = KErrNone; |
|
84 |
|
85 // Test that a 'use previous matches' search doesn't work in the first search. |
|
86 CPosLmTextCriteria* lmtextCriteria = CPosLmTextCriteria::NewLC(); |
|
87 lmtextCriteria->SetTextL(KWildcard); |
|
88 TPosLmSortPref sortPref(CPosLandmark::ELandmarkName, TPosLmSortPref::EAscending); |
|
89 TRAP(err, ExecuteAndDeleteLD(iLandmarksMultiDbSearch->StartLandmarkSearchL(*lmtextCriteria, |
|
90 sortPref, |
|
91 ETrue))); |
|
92 |
|
93 _LIT(KErrorWrongCodePreviousMatches, "Wrong error code for searching in previous matches when there are no previous matches"); |
|
94 AssertTrueSecL(err == KErrArgument, KErrorWrongCodePreviousMatches, err); |
|
95 |
|
96 // Test that a 'use previous matches' search doesn't work in the first search. (category search) |
|
97 CPosLmCategoryManager::TCategorySortPref sortPrefCat = CPosLmCategoryManager::ECategorySortOrderNameAscending; |
|
98 CPosLmCatNameCriteria* nameCriteriaCat = CPosLmCatNameCriteria::NewLC(); |
|
99 nameCriteriaCat->SetSearchPatternL(KWildcard); |
|
100 TRAP(err, ExecuteAndDeleteLD(iLandmarksMultiDbSearch->StartCategorySearchL(*nameCriteriaCat, |
|
101 sortPrefCat, |
|
102 ETrue))); |
|
103 _LIT(KErrorWrongCodePreviousMatchesCat, "Wrong error code for searching in previous matches when there are no previous matches (categories)"); |
|
104 AssertTrueSecL(err == KErrArgument, KErrorWrongCodePreviousMatchesCat, err); |
|
105 |
|
106 CleanupStack::PopAndDestroy(nameCriteriaCat); |
|
107 |
|
108 // Check that only correct criteria works with category searches: |
|
109 CPosLmAreaCriteria* areaCriteria = CPosLmAreaCriteria::NewLC(5,5,5,5); |
|
110 CPosLmCatNameCriteria* nameCriteria = CPosLmCatNameCriteria::NewLC(); |
|
111 CPosLmCompositeCriteria* compCriteria = |
|
112 CPosLmCompositeCriteria::NewLC(CPosLmCompositeCriteria::ECompositionAND); |
|
113 CPosLmIdListCriteria* idListCriteria = CPosLmIdListCriteria::NewLC(); |
|
114 CPosLmNearestCriteria* nearestCriteria = CPosLmNearestCriteria::NewLC(TCoordinate(10,10)); |
|
115 CPosLmTextCriteria* textCriteria = CPosLmTextCriteria::NewLC(); |
|
116 CPosLmCategoryCriteria* catCriteria = CPosLmCategoryCriteria::NewLC(); |
|
117 nameCriteria->SetSearchPatternL(KWildcard); |
|
118 RArray<TPosLmItemId> idArray; |
|
119 CleanupClosePushL(idArray); |
|
120 idArray.Append(3); |
|
121 idArray.Append(4); |
|
122 idListCriteria->SetLandmarkIdsL(idArray); |
|
123 textCriteria->SetTextL(KWildcard); |
|
124 catCriteria->SetCategoryNameL(KWildcard); |
|
125 textCriteria->SetTextL(KWildcard); |
|
126 |
|
127 _LIT(KErrorWrongCodeForUnsupportedCriteria,"Wrong error code for unsupported criteria in category search"); |
|
128 TRAP(err, ExecuteAndDeleteLD(iLandmarksMultiDbSearch->StartCategorySearchL(*catCriteria,sortPrefCat))); |
|
129 AssertTrueSecL(err == KErrArgument, KErrorWrongCodeForUnsupportedCriteria, err); |
|
130 TRAP(err, ExecuteAndDeleteLD(iLandmarksMultiDbSearch->StartCategorySearchL(*textCriteria,sortPrefCat))); |
|
131 AssertTrueSecL(err == KErrArgument, KErrorWrongCodeForUnsupportedCriteria, err); |
|
132 TRAP(err, ExecuteAndDeleteLD(iLandmarksMultiDbSearch->StartCategorySearchL(*areaCriteria,sortPrefCat))); |
|
133 AssertTrueSecL(err == KErrArgument, KErrorWrongCodeForUnsupportedCriteria, err); |
|
134 TRAP(err, ExecuteAndDeleteLD(iLandmarksMultiDbSearch->StartCategorySearchL(*compCriteria,sortPrefCat))); |
|
135 // Composite is not supported in category search |
|
136 AssertTrueSecL(err == KErrNotSupported, KErrorWrongCodeForUnsupportedCriteria, err); |
|
137 TRAP(err, ExecuteAndDeleteLD(iLandmarksMultiDbSearch->StartCategorySearchL(*idListCriteria,sortPrefCat))); |
|
138 AssertTrueSecL(err == KErrArgument, KErrorWrongCodeForUnsupportedCriteria, err); |
|
139 TRAP(err, ExecuteAndDeleteLD(iLandmarksMultiDbSearch->StartCategorySearchL(*nearestCriteria,sortPrefCat))); |
|
140 AssertTrueSecL(err == KErrArgument, KErrorWrongCodeForUnsupportedCriteria, err); |
|
141 |
|
142 // This should not leave: |
|
143 ExecuteAndDeleteLD(iLandmarksMultiDbSearch->StartCategorySearchL(*nameCriteria,sortPrefCat)); |
|
144 |
|
145 // Start a search and test that a new search cannot start until it is finished: |
|
146 CPosLmOperation* op = iLandmarksMultiDbSearch->StartLandmarkSearchL(*lmtextCriteria,sortPref); |
|
147 CleanupStack::PushL(op); |
|
148 TRAP(err, iLandmarksMultiDbSearch->StartLandmarkSearchL(*lmtextCriteria,sortPref)); |
|
149 _LIT(KErrorWrongCodeForInUse, "Wrong error code when testing 'in use' for multi db searches."); |
|
150 AssertTrueSecL(err == KErrInUse, KErrorWrongCodeForInUse, err); |
|
151 |
|
152 // Check that a new db list cannot be set during a search. |
|
153 TRAP(err,iLandmarksMultiDbSearch->SetDatabasesToSearchL(*dbList)); |
|
154 _LIT(KErrorWrongCodeForInUseSetDB, "Wrong error code when testing 'in use' for SetDatabasesToSearchL."); |
|
155 AssertTrueSecL(err == KErrInUse, KErrorWrongCodeForInUseSetDB, err); |
|
156 TRAP(err, iLandmarksMultiDbSearch->StartCategorySearchL(*nameCriteria,sortPrefCat)); |
|
157 ExecuteAndDeleteLD(op); |
|
158 CleanupStack::Pop(op); |
|
159 AssertTrueSecL(err == KErrInUse, KErrorWrongCodeForInUse, err); |
|
160 |
|
161 // Start a category search and test that a new search cannot start until it is finished: |
|
162 op = iLandmarksMultiDbSearch->StartCategorySearchL(*nameCriteria,sortPrefCat); |
|
163 CleanupStack::PushL(op); |
|
164 TRAP(err, iLandmarksMultiDbSearch->StartCategorySearchL(*nameCriteria,sortPrefCat)); |
|
165 AssertTrueSecL(err == KErrInUse, KErrorWrongCodeForInUse, err); |
|
166 TRAP(err, iLandmarksMultiDbSearch->StartLandmarkSearchL(*lmtextCriteria,sortPref)); |
|
167 ExecuteAndDeleteLD(op); |
|
168 CleanupStack::Pop(op); |
|
169 AssertTrueSecL(err == KErrInUse, KErrorWrongCodeForInUse, err); |
|
170 |
|
171 // Test that an id list criteria cannot be used. |
|
172 TRAP(err, ExecuteAndDeleteLD(iLandmarksMultiDbSearch->StartLandmarkSearchL(*idListCriteria, |
|
173 sortPref))); |
|
174 _LIT(KErrorWrongCodeForIdListCriteria, "Wrong error code for id list criteria."); |
|
175 AssertTrueSecL(err == KErrArgument, KErrorWrongCodeForIdListCriteria, err); |
|
176 |
|
177 CleanupStack::PopAndDestroy(); // idArray |
|
178 CleanupStack::PopAndDestroy(catCriteria); |
|
179 CleanupStack::PopAndDestroy(textCriteria); |
|
180 CleanupStack::PopAndDestroy(nearestCriteria); |
|
181 CleanupStack::PopAndDestroy(idListCriteria); |
|
182 CleanupStack::PopAndDestroy(compCriteria); |
|
183 CleanupStack::PopAndDestroy(nameCriteria); |
|
184 CleanupStack::PopAndDestroy(areaCriteria); |
|
185 |
|
186 |
|
187 /////////////////////////////////////////////////////////////////////////// |
|
188 // Panic tests //////////////////////////////////////////////////////////// |
|
189 /////////////////////////////////////////////////////////////////////////// |
|
190 |
|
191 //Set max nr of matches to zero: |
|
192 iStep = EStepZeroMaxMatches; |
|
193 iExpectedPanicCode = EPosLmInvalidArgument; |
|
194 ResumeThreadAndVerifyExitL(); |
|
195 |
|
196 // Set max nr of matches to a negative value: |
|
197 iStep = EStepNegativeMaxMatches; |
|
198 iExpectedPanicCode = EPosLmInvalidArgument; |
|
199 ResumeThreadAndVerifyExitL(); |
|
200 |
|
201 //Set max nr of matches to constant KPosLmMaxNumOfMatchesUnlimited: |
|
202 // This is allowed so we use our own panic code to verify that method |
|
203 // was correctly returned |
|
204 iStep = EStepUnlimitedMaxMatches; |
|
205 iExpectedPanicCode = (TPositionLandmarksClientPanic)567; |
|
206 ResumeThreadAndVerifyExitL(); |
|
207 |
|
208 // Invalid index to DatabaseUriPtr method: |
|
209 iStep = EStepOutOfBoundsDatabaseUriPtr; |
|
210 iExpectedPanicCode = EPosInvalidIndex; |
|
211 ResumeThreadAndVerifyExitL(); |
|
212 |
|
213 // Invalid index for GetSearchError: |
|
214 iStep = EStepOutOfBoundsGetSearchError; |
|
215 iExpectedPanicCode = EPosInvalidIndex; |
|
216 ResumeThreadAndVerifyExitL(); |
|
217 |
|
218 // Invalid TPosLmSortPref |
|
219 iStep = EStepIllegalSortPrefLMa; |
|
220 iExpectedPanicCode = EPosInvalidEnumValue; |
|
221 ResumeThreadAndVerifyExitL(); |
|
222 |
|
223 // Invalid TPosLmSortPref |
|
224 iStep = EStepIllegalSortPrefLMb; |
|
225 iExpectedPanicCode = EPosInvalidEnumValue; |
|
226 ResumeThreadAndVerifyExitL(); |
|
227 |
|
228 // Invalid TPosLmSortPref |
|
229 iStep = EStepIllegalSortPrefLMc; |
|
230 iExpectedPanicCode = EPosNoneOrMultipleLandmarkAttributeSet; |
|
231 ResumeThreadAndVerifyExitL(); |
|
232 |
|
233 // Invalid TPosLmSortPref |
|
234 iStep = EStepIllegalSortPrefLMd; |
|
235 iExpectedPanicCode = EPosNoneOrMultipleLandmarkAttributeSet; |
|
236 ResumeThreadAndVerifyExitL(); |
|
237 |
|
238 // Invalid TPosLmSortPref |
|
239 iStep = EStepIllegalSortPrefCat; |
|
240 iExpectedPanicCode = EPosInvalidEnumValue; |
|
241 ResumeThreadAndVerifyExitL(); |
|
242 |
|
243 // Invalid index for MatchIteratorL: |
|
244 iStep = EStepTooBigValueMatchIteratorL; |
|
245 iExpectedPanicCode = EPosInvalidIndex; |
|
246 ResumeThreadAndVerifyExitL(); |
|
247 |
|
248 // Invalid index for NumOfMatches: |
|
249 iStep = EStepTooBigValueNumOfMatches; |
|
250 iExpectedPanicCode = EPosInvalidIndex; |
|
251 ResumeThreadAndVerifyExitL(); |
|
252 |
|
253 // Test LandmarkSearch with NULL search criteria |
|
254 iStep = EStepNULLSearch1; |
|
255 iExpectedPanicCode = (TPositionLandmarksClientPanic)3; // KernExec-3 |
|
256 ResumeThreadAndVerifyExitL(); |
|
257 |
|
258 // Test LandmarkSearch with NULL search criteria |
|
259 iStep = EStepNULLSearch2; |
|
260 iExpectedPanicCode = (TPositionLandmarksClientPanic)3; // KernExec-3 |
|
261 ResumeThreadAndVerifyExitL(); |
|
262 |
|
263 // Test CategorySearch with NULL search criteria |
|
264 iStep = EStepNULLSearch3; |
|
265 iExpectedPanicCode = (TPositionLandmarksClientPanic)3; // KernExec-3 |
|
266 ResumeThreadAndVerifyExitL(); |
|
267 |
|
268 // Test LandmarkSearch with Databases to search with NULL value |
|
269 iStep = EStepNULLSearch4; |
|
270 iExpectedPanicCode = (TPositionLandmarksClientPanic)3; // KernExec-3 |
|
271 ResumeThreadAndVerifyExitL(); |
|
272 |
|
273 CleanupStack::PopAndDestroy(lmtextCriteria); |
|
274 CleanupStack::PopAndDestroy(dbList); |
|
275 } |
|
276 |
|
277 // --------------------------------------------------------- |
|
278 // CPosTp126::RunPanicTestL |
|
279 // |
|
280 // (other items were commented in a header). |
|
281 // --------------------------------------------------------- |
|
282 void CPosTp126::RunPanicTestL(TAny* aData) |
|
283 { |
|
284 CPosTp126* self = reinterpret_cast<CPosTp126*>(aData); |
|
285 |
|
286 CDesCArray* dbList = new (ELeave) CDesCArrayFlat(8); |
|
287 CleanupStack::PushL(dbList); |
|
288 dbList->AppendL(KDb20); |
|
289 dbList->AppendL(KDb40); |
|
290 dbList->AppendL(KDb60); |
|
291 dbList->AppendL(KDb80); |
|
292 dbList->AppendL(KDb105); |
|
293 |
|
294 CPosLmTextCriteria* textCriteria = NULL; |
|
295 CPosLmMultiDbSearch* multiSearch = CPosLmMultiDbSearch::NewL(*dbList); |
|
296 switch(self->iStep) |
|
297 { |
|
298 case EStepZeroMaxMatches: |
|
299 // Not allowed to set 0 number of matches |
|
300 multiSearch->SetMaxNumOfMatches(0); |
|
301 break; |
|
302 case EStepUnlimitedMaxMatches: |
|
303 multiSearch->SetMaxNumOfMatches(KPosLmMaxNumOfMatchesUnlimited); |
|
304 User::Panic(_L("567"), 567); |
|
305 break; |
|
306 case EStepNegativeMaxMatches: |
|
307 multiSearch->SetMaxNumOfMatches(-10); |
|
308 break; |
|
309 case EStepOutOfBoundsDatabaseUriPtr: |
|
310 multiSearch->DatabaseUriPtr(6); |
|
311 break; |
|
312 case EStepOutOfBoundsGetSearchError: |
|
313 textCriteria = CPosLmTextCriteria::NewLC(); |
|
314 textCriteria->SetTextL(KWildcard); |
|
315 multiSearch->SetMaxNumOfMatches(3); |
|
316 ExecuteAndDeleteLD(multiSearch->StartLandmarkSearchL(*textCriteria)); |
|
317 TInt errors = multiSearch->NumOfSearchErrors(); |
|
318 CPosLmMultiDbSearch::TSearchError searchError; |
|
319 multiSearch->GetSearchError(errors + 2, searchError); // too large, should panic |
|
320 CleanupStack::PopAndDestroy(textCriteria); |
|
321 break; |
|
322 case EStepTooBigValueMatchIteratorL: |
|
323 textCriteria = CPosLmTextCriteria::NewLC(); |
|
324 textCriteria->SetTextL(KWildcard); |
|
325 ExecuteAndDeleteLD(multiSearch->StartLandmarkSearchL(*textCriteria)); |
|
326 multiSearch->MatchIteratorL(6); // Panic here |
|
327 CleanupStack::PopAndDestroy(textCriteria); |
|
328 break; |
|
329 case EStepTooBigValueNumOfMatches: |
|
330 textCriteria = CPosLmTextCriteria::NewLC(); |
|
331 textCriteria->SetTextL(KWildcard); |
|
332 ExecuteAndDeleteLD(multiSearch->StartLandmarkSearchL(*textCriteria)); |
|
333 multiSearch->NumOfMatches(6); // Panic here |
|
334 CleanupStack::PopAndDestroy(textCriteria); |
|
335 break; |
|
336 case EStepIllegalSortPrefLMa: |
|
337 TPosLmSortPref sortPrefa(CPosLandmark::ELandmarkName, |
|
338 (TPosLmSortPref::TSortOrder)4321); |
|
339 break; |
|
340 case EStepIllegalSortPrefLMb: |
|
341 TPosLmSortPref sortPrefb(CPosLandmark::ELandmarkName, TPosLmSortPref::EAscending); |
|
342 sortPrefb.SetSortByLandmarkAttribute(CPosLandmark::ELandmarkName, |
|
343 (TPosLmSortPref::TSortOrder)4321); // Panic here |
|
344 break; |
|
345 case EStepIllegalSortPrefLMc: |
|
346 TPosLmSortPref sortPrefc(0, TPosLmSortPref::EAscending); |
|
347 break; |
|
348 case EStepIllegalSortPrefLMd: |
|
349 TPosLmSortPref sortPrefd(CPosLandmark::ELandmarkName, TPosLmSortPref::EAscending); |
|
350 sortPrefd.SetSortByLandmarkAttribute(0, TPosLmSortPref::EAscending); |
|
351 case EStepIllegalSortPrefCat: |
|
352 CPosLmCategoryManager::TCategorySortPref sortPrefCat = |
|
353 (CPosLmCategoryManager::TCategorySortPref)12345; |
|
354 CPosLmCatNameCriteria* nameCriteriaCat = CPosLmCatNameCriteria::NewLC(); |
|
355 nameCriteriaCat->SetSearchPatternL(KWildcard); |
|
356 ExecuteAndDeleteLD(multiSearch->StartCategorySearchL(*nameCriteriaCat, |
|
357 sortPrefCat)); // Panic here |
|
358 CleanupStack::PopAndDestroy(nameCriteriaCat); |
|
359 break; |
|
360 case EStepNULLSearch1: |
|
361 textCriteria = NULL; |
|
362 ExecuteAndDeleteLD(multiSearch->StartLandmarkSearchL(*textCriteria)); |
|
363 break; |
|
364 case EStepNULLSearch2: |
|
365 textCriteria = NULL; |
|
366 TPosLmSortPref sortPref(CPosLandmark::ELandmarkName, TPosLmSortPref::EAscending); |
|
367 ExecuteAndDeleteLD(multiSearch->StartLandmarkSearchL(*textCriteria, sortPref)); |
|
368 break; |
|
369 case EStepNULLSearch3: |
|
370 CPosLmCategoryManager::TCategorySortPref sortPrefCat2 = CPosLmCategoryManager::ECategorySortOrderNameAscending; |
|
371 CPosLmCatNameCriteria* criteria = NULL; |
|
372 ExecuteAndDeleteLD(multiSearch->StartCategorySearchL(*criteria, sortPrefCat2)); |
|
373 break; |
|
374 case EStepNULLSearch4: |
|
375 CDesCArray* list = NULL; |
|
376 CPosLmMultiDbSearch* multiSearch = CPosLmMultiDbSearch::NewL(*list); |
|
377 textCriteria = CPosLmTextCriteria::NewLC(); |
|
378 textCriteria->SetTextL(KWildcard); |
|
379 TPosLmSortPref sortPref4(CPosLandmark::ELandmarkName, TPosLmSortPref::EAscending); |
|
380 ExecuteAndDeleteLD(multiSearch->StartLandmarkSearchL(*textCriteria, sortPref4)); |
|
381 break; |
|
382 default: |
|
383 break; |
|
384 |
|
385 } |
|
386 } |
|
387 |
|
388 // --------------------------------------------------------- |
|
389 // CPosTp126::ResumeThreadAndVerifyExitL |
|
390 // |
|
391 // (other items were commented in a header). |
|
392 // --------------------------------------------------------- |
|
393 // |
|
394 void CPosTp126::ResumeThreadAndVerifyExitL() |
|
395 { |
|
396 iLog->Log(_L("ResumeThreadAndVerifyExitL")); |
|
397 _LIT(KPanicErr, "Method didn't Panic when expected"); |
|
398 _LIT(KPanicCodeErr, "Panicked with unexpected panic code"); |
|
399 |
|
400 CreateThreadL(); |
|
401 TRequestStatus status; |
|
402 iThread.Logon(status); |
|
403 iThread.Resume(); |
|
404 |
|
405 User::WaitForRequest(status); |
|
406 |
|
407 // Used for debugging |
|
408 TBuf<100> buf; |
|
409 buf.Format(_L("ExitType %d Exit reason %d"), iThread.ExitType(), iThread.ExitReason()); |
|
410 iLog->Log(buf); |
|
411 |
|
412 AssertTrueSecL(iThread.ExitType() == EExitPanic, KPanicErr); |
|
413 AssertTrueSecL(iThread.ExitReason() == iExpectedPanicCode, KPanicCodeErr); |
|
414 |
|
415 iThread.Close(); |
|
416 } |
|
417 |
|
418 // --------------------------------------------------------- |
|
419 // ThreadFunction |
|
420 // |
|
421 // --------------------------------------------------------- |
|
422 |
|
423 LOCAL_C TInt ThreadFunction(TAny* aData) |
|
424 { |
|
425 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
426 |
|
427 CActiveScheduler* actSch = new (ELeave) CActiveScheduler; |
|
428 CActiveScheduler::Install(actSch); |
|
429 |
|
430 TRAPD(err, CPosTp126::RunPanicTestL(aData)); |
|
431 |
|
432 delete actSch; |
|
433 delete cleanup; |
|
434 return err; |
|
435 } |
|
436 |
|
437 // --------------------------------------------------------- |
|
438 // --------------------------------------------------------- |
|
439 void CPosTp126::CreateThreadL() |
|
440 { |
|
441 _LIT(KThreadName, "TP126testthread%d"); |
|
442 _LIT(KCreateThreadErr, "Create thread failed with %d"); |
|
443 |
|
444 TBuf<100> buf; |
|
445 buf.Format(KThreadName, (TInt)iStep); |
|
446 |
|
447 TInt err = iThread.Create(buf, ThreadFunction, KDefaultStackSize, KMinHeapSize, KMaxHeapSize, this); |
|
448 AssertTrueSecL(err == KErrNone, KCreateThreadErr, err); |
|
449 } |
|
450 |
|
451 |
|
452 // End of File |