|
1 /* |
|
2 * Copyright (c) 2007 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: Plug-in view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "devdiagapp.hrh" |
|
22 #include "devdiagplugincontainer.h" |
|
23 #include "devdiagengine.h" |
|
24 #include "devdiagpluginview.h" |
|
25 #include "devdiagdef.h" |
|
26 #include "devdiag.pan" |
|
27 #include "devdiagexecutionresults.h" |
|
28 |
|
29 #include <DiagPlugin.h> |
|
30 #include <devdiagapp.rsg> //resources |
|
31 #include <AknQueryDialog.h> |
|
32 #include <aknradiobuttonsettingpage.h> |
|
33 #include <aknViewAppUi.h> |
|
34 #include <featmgr.h> |
|
35 #include <StringLoader.h> |
|
36 #include <bautils.h> |
|
37 #include <coeaui.h> |
|
38 #include <eikfrlbd.h> |
|
39 #include <gulicon.h> |
|
40 #include <hlplch.h> // For HlpLauncher |
|
41 #include <akntitle.h> |
|
42 #include <aknmessagequerydialog.h> |
|
43 #include <aknnotewrappers.h> |
|
44 #include <DiagFrameworkDebug.h> // Debug Logger |
|
45 #include <DiagResultsDatabaseItem.h> |
|
46 |
|
47 // EXTERNAL DATA STRUCTURES |
|
48 |
|
49 // EXTERNAL FUNCTION PROTOTYPES |
|
50 |
|
51 // CONSTANTS |
|
52 |
|
53 // MACROS |
|
54 |
|
55 // LOCAL CONSTANTS AND MACROS |
|
56 _LIT(KLinefeed, "\n"); |
|
57 _LIT(KTabfeed, "\t"); |
|
58 const TInt KFailedTestsMaxLength(1024); |
|
59 |
|
60 // MODULE DATA STRUCTURES |
|
61 |
|
62 // LOCAL FUNCTION PROTOTYPES |
|
63 |
|
64 // FORWARD DECLARATIONS |
|
65 |
|
66 // ============================= LOCAL FUNCTIONS ============================== |
|
67 |
|
68 // ========================= MEMBER FUNCTIONS ================================ |
|
69 |
|
70 // ---------------------------------------------------------------------------- |
|
71 // CDevDiagPluginView::CDevDiagPluginView() |
|
72 // |
|
73 // Constructor |
|
74 // ---------------------------------------------------------------------------- |
|
75 // |
|
76 CDevDiagPluginView::CDevDiagPluginView( CDevDiagEngine& aEngine, TUid aParentSuiteUid ): |
|
77 iContainer(NULL), iEngine(aEngine), iParentSuiteUid( aParentSuiteUid ) |
|
78 { |
|
79 } |
|
80 |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // CDevDiagPluginView::NewL() |
|
84 // |
|
85 // Symbian OS default constructor |
|
86 // --------------------------------------------------------------------------- |
|
87 CDevDiagPluginView* CDevDiagPluginView::NewL( CDevDiagEngine& aEngine, |
|
88 TUid aParentSuiteUid ) |
|
89 { |
|
90 LOGSTRING("CDevDiagPluginView* CDevDiagPluginView::NewL"); |
|
91 CDevDiagPluginView* self = new( ELeave ) |
|
92 CDevDiagPluginView ( aEngine, aParentSuiteUid ); |
|
93 |
|
94 CleanupStack::PushL( self ); |
|
95 self->ConstructL(); |
|
96 CleanupStack::Pop(); |
|
97 |
|
98 return self; |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // CDevDiagPluginView::ConstructL() |
|
103 // |
|
104 // Symbian OS two-phased constructor |
|
105 // --------------------------------------------------------------------------- |
|
106 void CDevDiagPluginView::ConstructL() |
|
107 { |
|
108 if ( iParentSuiteUid == KDDHardwareSuiteUid ) |
|
109 { |
|
110 BaseConstructL( R_DD_HW_PLUGIN_VIEW ); |
|
111 ChangeTitleL( R_DIAG_TITLE_HARDWARE ); |
|
112 } |
|
113 else if ( iParentSuiteUid == KDDConnectivitySuiteUid ) |
|
114 { |
|
115 BaseConstructL( R_DD_CONNECTIVITY_PLUGIN_VIEW ); |
|
116 ChangeTitleL( R_DIAG_TITLE_CONNECTIVITY ); |
|
117 } |
|
118 else if ( iParentSuiteUid == KDDServicesSuiteUid ) |
|
119 { |
|
120 BaseConstructL( R_DD_SERVICE_PLUGIN_VIEW ); |
|
121 ChangeTitleL( R_DIAG_TITLE_SERVICE ); |
|
122 } |
|
123 else if ( iParentSuiteUid == KDDCoverageSuiteUid) |
|
124 { |
|
125 BaseConstructL( R_DD_COVERAGE_PLUGIN_VIEW ); |
|
126 ChangeTitleL( R_DIAG_TITLE_COVERAGE ); |
|
127 } |
|
128 else |
|
129 { |
|
130 Panic( EDDApplicationUnknownSuite ); |
|
131 } |
|
132 |
|
133 } |
|
134 |
|
135 |
|
136 // ---------------------------------------------------------------------------- |
|
137 // CDevDiagPluginView::~CDevDiagPluginView |
|
138 // |
|
139 // Destructor |
|
140 // ---------------------------------------------------------------------------- |
|
141 CDevDiagPluginView::~CDevDiagPluginView() |
|
142 { |
|
143 |
|
144 if ( iContainer ) |
|
145 { |
|
146 delete iContainer; |
|
147 } |
|
148 |
|
149 } |
|
150 |
|
151 |
|
152 // --------------------------------------------------------------------------- |
|
153 // TUid CDevDiagPluginView::Id() |
|
154 // |
|
155 // Returns view's ID. |
|
156 // --------------------------------------------------------------------------- |
|
157 TUid CDevDiagPluginView::Id() const |
|
158 { |
|
159 return KDDPluginViewId; |
|
160 } |
|
161 |
|
162 |
|
163 // --------------------------------------------------------------------------- |
|
164 // Set context menu bar according to the suite. |
|
165 // --------------------------------------------------------------------------- |
|
166 void CDevDiagPluginView::SetContextMenu() |
|
167 { |
|
168 if ( iParentSuiteUid == KDDHardwareSuiteUid ) |
|
169 { |
|
170 |
|
171 MenuBar()->SetContextMenuTitleResourceId( R_DD_HW_CONTEXT_MENUBAR ); |
|
172 } |
|
173 else if ( iParentSuiteUid == KDDConnectivitySuiteUid ) |
|
174 { |
|
175 MenuBar()->SetContextMenuTitleResourceId( R_DD_CONNECTIVITY_CONTEXT_MENUBAR ); |
|
176 } |
|
177 else if ( iParentSuiteUid == KDDServicesSuiteUid ) |
|
178 { |
|
179 MenuBar()->SetContextMenuTitleResourceId( R_DD_SERVICE_CONTEXT_MENUBAR ); |
|
180 } |
|
181 else if ( iParentSuiteUid == KDDCoverageSuiteUid) |
|
182 { |
|
183 MenuBar()->SetContextMenuTitleResourceId( R_DD_COVERAGE_CONTEXT_MENUBAR ); |
|
184 } |
|
185 else |
|
186 { |
|
187 Panic( EDDApplicationUnknownSuite ); |
|
188 } |
|
189 } |
|
190 // --------------------------------------------------------------------------- |
|
191 // CDevDiagPluginView::HandleCommandL(TInt aCommand) |
|
192 // |
|
193 // Handles commands directed to this class. |
|
194 // --------------------------------------------------------------------------- |
|
195 void CDevDiagPluginView::HandleCommandL( TInt aCommand ) |
|
196 { |
|
197 LOGSTRING("CDevDiagPluginView::HandleCommandL"); |
|
198 switch ( aCommand ) |
|
199 { |
|
200 |
|
201 case EDDCmdPerformSingle: |
|
202 { |
|
203 // State == EStateReady then run tests |
|
204 if (iEngine.GetState()== 2) |
|
205 { |
|
206 LOGSTRING("iState == EStateReady"); |
|
207 iContainer->DisplayStartTestingL(); |
|
208 |
|
209 MDiagPlugin* plugin = NULL; |
|
210 iContainer->SelectedPlugin(plugin); |
|
211 |
|
212 iEngine.ExecuteTestL( plugin->Uid(), *AppUi() ); |
|
213 } |
|
214 else |
|
215 { |
|
216 LOGSTRING2("PluginView::iEngine::iState = %d ", iEngine.GetState()); |
|
217 LOGSTRING ("Trying to Execute Plugin @ Invalid State"); |
|
218 } |
|
219 break; |
|
220 } |
|
221 |
|
222 case EAknSoftkeyBack: |
|
223 { |
|
224 if (iEngine.GetState()== 2) |
|
225 { |
|
226 LOGSTRING("Before Activate Local View for Back"); |
|
227 |
|
228 AppUi()->ActivateLocalViewL( KDDMainViewId ); |
|
229 |
|
230 LOGSTRING("After Activate Local View for Back"); |
|
231 |
|
232 } |
|
233 |
|
234 else |
|
235 { |
|
236 LOGSTRING2("PluginView::iEngine::iState = %d ", iEngine.GetState()); |
|
237 LOGSTRING ("Trying to issue Back @ Invalid State"); |
|
238 } |
|
239 break; |
|
240 } |
|
241 |
|
242 case EDDMenuCmdMainHelp: |
|
243 { |
|
244 MessageQueryDialogLaunchL( |
|
245 R_MESSAGE_QUERY_HELP_NOTE ); |
|
246 break; |
|
247 } |
|
248 |
|
249 case EAknCmdHelp: |
|
250 { |
|
251 |
|
252 |
|
253 if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
254 { |
|
255 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
256 AppUi()->AppHelpContextL() ); |
|
257 } |
|
258 |
|
259 break; |
|
260 } |
|
261 |
|
262 case EDDCmdPerformAllHwTests: |
|
263 { |
|
264 //ask confirmation from the user |
|
265 TBool ok = MessageQueryDialogLaunchL( |
|
266 R_MESSAGE_QUERY_PERFORM_ALL_HW_TESTS ); |
|
267 if ( ok ) |
|
268 { |
|
269 iContainer->ResetL(); |
|
270 iContainer->DisplayStartTestingL(); |
|
271 //Engine will populate the suite |
|
272 iEngine.ExecuteTestL( KDDHardwareSuiteUid, *AppUi() ); |
|
273 } |
|
274 |
|
275 break; |
|
276 } |
|
277 |
|
278 case EDDCmdPerformAllCoverageTests: |
|
279 { |
|
280 |
|
281 //ask confirmation from the user |
|
282 TBool ok = MessageQueryDialogLaunchL( |
|
283 R_MESSAGE_QUERY_PERFORM_ALL_COVERAGE_TESTS ); |
|
284 if ( ok ) |
|
285 { |
|
286 //Engine will populate the suite |
|
287 iEngine.ExecuteTestL( KDDCoverageSuiteUid, *AppUi() ); |
|
288 } |
|
289 |
|
290 break; |
|
291 } |
|
292 |
|
293 //These have only one test, so performing all is not needed yet |
|
294 case EDDCmdPerformAllServiceTests: |
|
295 { |
|
296 break; |
|
297 } |
|
298 |
|
299 case EDDCmdPerformAllConnTests: |
|
300 { |
|
301 break; |
|
302 } |
|
303 case EAknCmdTaskSwapper: |
|
304 { |
|
305 /* |
|
306 * MSK: Active Applications |
|
307 * This command is actually handled by Avkon FW |
|
308 * Applications should not handle this |
|
309 */ |
|
310 break; |
|
311 } |
|
312 |
|
313 default: |
|
314 AppUi()->HandleCommandL( aCommand ); |
|
315 break; |
|
316 } |
|
317 } |
|
318 |
|
319 // ---------------------------------------------------------------------------- |
|
320 // CDevDiagPluginView::DoActivateL |
|
321 // |
|
322 // First method called by the Avkon framwork to invoke a view. |
|
323 // ---------------------------------------------------------------------------- |
|
324 // |
|
325 void CDevDiagPluginView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, |
|
326 TUid /*aCustomMessageId*/ , |
|
327 const TDesC8& /*aCustomMessage*/ ) |
|
328 { |
|
329 if( iContainer ) |
|
330 { |
|
331 AppUi()->RemoveFromStack( iContainer ); |
|
332 |
|
333 delete iContainer; |
|
334 iContainer = NULL; |
|
335 } |
|
336 |
|
337 iContainer = CDevDiagPluginContainer::NewL( this, iEngine, ClientRect() ); |
|
338 iContainer->SetMopParent( this ); |
|
339 AppUi()->AddToStackL( iContainer ); |
|
340 |
|
341 iEngine.SetObserver( this ); |
|
342 |
|
343 //Construct the model |
|
344 iContainer->UpdateModelL( iParentSuiteUid ); |
|
345 |
|
346 SetContextMenu(); |
|
347 |
|
348 //Retrieve last test results. HandleEngineCommandL with |
|
349 //EDevDiagEngineCommandGetLastResults is called after this. |
|
350 iEngine.GetLastResultsL( iParentSuiteUid ); |
|
351 } |
|
352 |
|
353 // ---------------------------------------------------------------------------- |
|
354 // CDevDiagPluginView::DoDeactivate |
|
355 // |
|
356 // Called by the Avkon view framework when closing. |
|
357 // ---------------------------------------------------------------------------- |
|
358 // |
|
359 void CDevDiagPluginView::DoDeactivate() |
|
360 { |
|
361 if ( iContainer ) |
|
362 { |
|
363 AppUi()->RemoveFromStack( iContainer ); |
|
364 delete iContainer; |
|
365 iContainer = NULL; |
|
366 } |
|
367 } |
|
368 |
|
369 |
|
370 // ---------------------------------------------------------------------------- |
|
371 // Handle CDevDiagEngine events. |
|
372 // |
|
373 // EDevDiagEngineCommandTestExecutionDone is called when single or group |
|
374 // execution finishes. |
|
375 // |
|
376 // MDevDiagEngineObserver::EDevDiagEngineCommandResultsDataUpdated is called |
|
377 // when a plug-in is executed. |
|
378 // |
|
379 // EDevDiagEngineCommandGetLastResults is called after |
|
380 // iEngine.GetLastResultsL( iParentSuiteUid ) is called. It retrieves the |
|
381 // last results. |
|
382 // ---------------------------------------------------------------------------- |
|
383 // |
|
384 void CDevDiagPluginView::HandleEngineCommandL( TAppEngineCommand aCommand, |
|
385 TInt aError, |
|
386 TAny* aCustom ) |
|
387 { |
|
388 LOGSTRING("CDevDiagPluginView::HandleEngineCommandL"); |
|
389 switch ( aCommand ) |
|
390 { |
|
391 case MDevDiagEngineObserver::EDevDiagEngineCommandGroupExecutionDone: |
|
392 { |
|
393 if ( aError != KErrNone ) |
|
394 { |
|
395 LOGSTRING2("MDevDiagEngineObserver::Exec Done Error: %d: ", aError); |
|
396 return; |
|
397 } |
|
398 |
|
399 iEngine.GetLastResultsL( iParentSuiteUid ); |
|
400 |
|
401 if ( iEngine.HasExecutionResults() ) |
|
402 { |
|
403 TInt failedCount = iEngine.ExecutionResults().FailedResultsCount(); |
|
404 |
|
405 TInt passedCount = iEngine.ExecutionResults().PassedResultsCount(); |
|
406 |
|
407 if ( failedCount == 0 && passedCount > 0) |
|
408 { |
|
409 DisplayConfirmationDialogL(R_DIAG_CONF_TEST_PASSED); |
|
410 } |
|
411 else if(failedCount > 0) |
|
412 { |
|
413 DisplayMessageQueryDialogFailedResultsL(); |
|
414 } |
|
415 } |
|
416 |
|
417 break; |
|
418 } |
|
419 |
|
420 case MDevDiagEngineObserver::EDevDiagEngineCommandGroupExecutionProgress: |
|
421 { |
|
422 if ( aError != KErrNone ) |
|
423 { |
|
424 LOGSTRING2("MDevDiagEngineObserver::ExecutionProgress Error: %d: ", aError); |
|
425 return; |
|
426 } |
|
427 |
|
428 iEngine.GetLastResultsL( iParentSuiteUid ); |
|
429 |
|
430 iContainer->MoveStartTestingDownL(); |
|
431 |
|
432 break; |
|
433 } |
|
434 case MDevDiagEngineObserver::EDevDiagEngineCommandGetLastResults: |
|
435 { |
|
436 if ( aError != KErrNone ) |
|
437 { |
|
438 LOGSTRING2("MDevDiagEngineObserver::GetLastResults Error: %d: ", aError); |
|
439 return; |
|
440 } |
|
441 |
|
442 RPointerArray<CDiagResultsDatabaseItem>* array = |
|
443 static_cast<RPointerArray<CDiagResultsDatabaseItem>*> (aCustom); |
|
444 iContainer->DisplayChildrenWithResultsL( *array ); |
|
445 |
|
446 |
|
447 if ( iEngine.HasExecutionResults() && !iEngine.ExecutionResults().LastTestFinishedL()) |
|
448 { |
|
449 iContainer->MoveStartTestingDownL(); |
|
450 } |
|
451 |
|
452 |
|
453 break; |
|
454 } |
|
455 case MDevDiagEngineObserver::EDevDiagEngineCommandSinglePluginExecutionDone: |
|
456 { |
|
457 |
|
458 if(!iEngine.GetPluginDependencyL()) |
|
459 iEngine.GetLastResultsL( iParentSuiteUid ); |
|
460 |
|
461 if ( aError != KErrNone ) |
|
462 { |
|
463 LOGSTRING2("MDevDiagEngineObserver::SinglePluginExecutionDone Error: %d: ", aError); |
|
464 return; |
|
465 } |
|
466 |
|
467 //iEngine.GetLastResultsL( iParentSuiteUid ); // ADO & Platformization Changes |
|
468 |
|
469 // ADO & Platformization Changes |
|
470 |
|
471 ///@@@KSR: changes for Codescanner error val = High |
|
472 //if(iEngine.ExecutionResults().SinglePluginExecutionL() && !iEngine.GetPluginDependency()) |
|
473 if(iEngine.ExecutionResults().SinglePluginExecutionL() && !iEngine.GetPluginDependencyL()) |
|
474 { |
|
475 |
|
476 const CDiagResultsDatabaseItem* aResult; |
|
477 aResult = iEngine.ExecutionResults().GetSinglepluginExecutionResult(); |
|
478 |
|
479 |
|
480 if(aResult->TestResult() == CDiagResultsDatabaseItem::ESuccess) |
|
481 { |
|
482 DisplayConfirmationDialogL(R_DIAG_CONF_TEST_PASSED_1); |
|
483 LOGSTRING("The test has passed"); |
|
484 } |
|
485 else if(aResult->TestResult() == CDiagResultsDatabaseItem::EFailed) |
|
486 { |
|
487 DisplayConfirmationDialogL(R_DIAG_CONF_TEST_FAILED_1); |
|
488 LOGSTRING("The test has failed"); |
|
489 } |
|
490 } |
|
491 |
|
492 |
|
493 // Changes ends |
|
494 |
|
495 break; |
|
496 } |
|
497 |
|
498 case MDevDiagEngineObserver::EDevDiagEngineCommandTestExecutionCancelled: |
|
499 { |
|
500 //Update container. |
|
501 iEngine.GetLastResultsL( iParentSuiteUid ); |
|
502 |
|
503 if ( iEngine.HasExecutionResults() ) |
|
504 { |
|
505 TInt failedCount = iEngine.ExecutionResults().FailedResultsCount(); |
|
506 |
|
507 TInt passedCount = iEngine.ExecutionResults().PassedResultsCount(); |
|
508 |
|
509 if ( failedCount == 0 && passedCount > 0) |
|
510 { |
|
511 DisplayConfirmationDialogL(R_DIAG_CONF_TEST_PASSED); |
|
512 } |
|
513 else if(failedCount > 0) |
|
514 { |
|
515 DisplayMessageQueryDialogFailedResultsL(); |
|
516 } |
|
517 } |
|
518 |
|
519 break; |
|
520 } |
|
521 } |
|
522 } |
|
523 |
|
524 |
|
525 // ---------------------------------------------------------------------------- |
|
526 // Change the title of the application. |
|
527 // |
|
528 // ---------------------------------------------------------------------------- |
|
529 // |
|
530 void CDevDiagPluginView::ChangeTitleL(TInt aResourceId) |
|
531 { |
|
532 CAknTitlePane* titlePane = |
|
533 (CAknTitlePane*)(AppUi()->StatusPane())->ControlL( |
|
534 TUid::Uid( EEikStatusPaneUidTitle ) ); |
|
535 |
|
536 HBufC* titleText = iEikonEnv->AllocReadResourceLC( aResourceId ); |
|
537 titlePane->SetTextL( titleText->Des() ); |
|
538 CleanupStack::PopAndDestroy(titleText); |
|
539 } |
|
540 |
|
541 |
|
542 // ---------------------------------------------------------------------------- |
|
543 // Display a message query dialog. |
|
544 // |
|
545 // ---------------------------------------------------------------------------- |
|
546 // |
|
547 TBool CDevDiagPluginView::MessageQueryDialogLaunchL( TInt aResourceId ) |
|
548 { |
|
549 CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog(); |
|
550 |
|
551 dlg->PrepareLC( aResourceId ); |
|
552 |
|
553 if (dlg->RunLD()) |
|
554 { |
|
555 return ETrue; |
|
556 } |
|
557 |
|
558 return EFalse; |
|
559 } |
|
560 |
|
561 |
|
562 // ---------------------------------------------------------------------------- |
|
563 // This is needed after performing a group of tests succesfully. |
|
564 // ---------------------------------------------------------------------------- |
|
565 // |
|
566 void CDevDiagPluginView::DisplayConfirmationDialogL(TInt aResourceId) |
|
567 { |
|
568 CAknConfirmationNote* note = |
|
569 new (ELeave) CAknConfirmationNote( ETrue ); //Waiting |
|
570 |
|
571 HBufC* text = NULL; |
|
572 |
|
573 text = StringLoader::LoadLC( aResourceId ); |
|
574 |
|
575 note->ExecuteLD( *text ); //Blocks until note dismissed |
|
576 |
|
577 CleanupStack::PopAndDestroy(); |
|
578 } |
|
579 |
|
580 |
|
581 // ---------------------------------------------------------------------------- |
|
582 // This is needed after performing a group of tests |
|
583 // |
|
584 // Display dialog text according to the test result. |
|
585 // |
|
586 // Message query dialog will display a list of failed test cases. |
|
587 // ---------------------------------------------------------------------------- |
|
588 // |
|
589 void CDevDiagPluginView::DisplayMessageQueryDialogFailedResultsL() |
|
590 { |
|
591 CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog(); |
|
592 |
|
593 dlg->PrepareLC( R_DEVDIAG_FAILED_TESTS_MESSAGEQUERY_DIALOG ); |
|
594 |
|
595 HBufC* failText = StringLoader::LoadL( R_DIAG_CONF_TEST_FAILED ); |
|
596 CleanupStack::PushL( failText ); |
|
597 |
|
598 HBufC* failedTests = CreateResultsTextsForFailedTestsLC( iEngine.ExecutionResults() ); |
|
599 |
|
600 TInt newBufLength = failText->Length() + failedTests->Length(); |
|
601 |
|
602 HBufC* text = HBufC::NewLC( newBufLength ); |
|
603 |
|
604 text->Des().Append( *failText ); |
|
605 text->Des().Append( *failedTests ); |
|
606 |
|
607 dlg->SetMessageTextL( *text ); |
|
608 |
|
609 CleanupStack::PopAndDestroy(); |
|
610 CleanupStack::PopAndDestroy(); |
|
611 CleanupStack::PopAndDestroy(); |
|
612 |
|
613 if (dlg->RunLD()) |
|
614 { |
|
615 |
|
616 } |
|
617 } |
|
618 |
|
619 |
|
620 // ---------------------------------------------------------------------------- |
|
621 // Loads names of the tests that failed. |
|
622 // ---------------------------------------------------------------------------- |
|
623 // |
|
624 HBufC* CDevDiagPluginView::CreateResultsTextsForFailedTestsLC( |
|
625 const CDevDiagExecResults& aExecResults ) |
|
626 { |
|
627 RBuf resultText; |
|
628 CleanupClosePushL( resultText ); |
|
629 |
|
630 resultText.CreateL( KFailedTestsMaxLength ); |
|
631 |
|
632 TBool firstLineFeed = ETrue; |
|
633 |
|
634 for ( TInt i = 0; i < aExecResults.Count(); ++i ) |
|
635 { |
|
636 const CDevDiagExecResults::CResult& result = aExecResults[i]; |
|
637 |
|
638 //if item == NULL it is a test suite |
|
639 const CDiagResultsDatabaseItem* item = result.Result(); |
|
640 |
|
641 if (item && !item->WasDependency()) |
|
642 { |
|
643 //List failed test cases |
|
644 if ( item && item->TestResult() == CDiagResultsDatabaseItem::EFailed ) |
|
645 { |
|
646 const MDiagPlugin& plugin = result.Plugin(); |
|
647 |
|
648 //Note the correct layout. Name is used in the pop-up info pane. |
|
649 HBufC* name = plugin.GetPluginNameL( MDiagPlugin::ENameLayoutPopupInfoPane ); |
|
650 CleanupStack::PushL( name ); |
|
651 |
|
652 if ( resultText.MaxLength() < resultText.Length() + name->Length() ) |
|
653 { |
|
654 HBufC* temp = resultText.AllocLC(); |
|
655 resultText.ReAlloc( resultText.Length() + KFailedTestsMaxLength ); |
|
656 resultText.Append( *temp ); |
|
657 CleanupStack::PopAndDestroy(); |
|
658 } |
|
659 |
|
660 if ( !firstLineFeed ) |
|
661 { |
|
662 resultText.Append( KLinefeed ); |
|
663 } |
|
664 else |
|
665 { |
|
666 firstLineFeed = EFalse; |
|
667 } |
|
668 |
|
669 resultText.Append( *name ); |
|
670 resultText.Append( KTabfeed ); |
|
671 |
|
672 CleanupStack::PopAndDestroy(); |
|
673 } |
|
674 } |
|
675 } |
|
676 |
|
677 //contains combined result texts |
|
678 HBufC* result = resultText.AllocL(); |
|
679 |
|
680 CleanupStack::PopAndDestroy(); |
|
681 |
|
682 CleanupStack::PushL( result ); |
|
683 return result; |
|
684 } |
|
685 |
|
686 // End of File |