devicediagnostics/devdiagapp/src/devdiagsuiteview.cpp
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     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:  Main view implementation. 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "devdiagsuitecontainer.h"
       
    21 #include "devdiagengine.h"
       
    22 #include "devdiagdef.h"
       
    23 #include "devdiagpluginview.h"
       
    24 #include "devdiagexecutionresults.h"
       
    25 #include "devdiag.pan"
       
    26 
       
    27 #include <DiagPlugin.h> 
       
    28 #include <akntitle.h> 
       
    29 #include <coemain.h>
       
    30 #include <devdiagapp.rsg>
       
    31 #include <aknViewAppUi.h> 
       
    32 #include <eikbtgpc.h> 			//Button group container
       
    33 #include <aknmessagequerydialog.h> 
       
    34 #include <DiagFrameworkDebug.h>         // Debug Logger
       
    35 #include <aknnotewrappers.h> 
       
    36 #include <StringLoader.h>
       
    37 #include <AknWaitDialog.h>          // CAknWaitDialog
       
    38 #include <DiagPluginPool.h> 
       
    39 
       
    40 #include <DiagPlugin.h> 
       
    41 #include <AknQueryDialog.h>
       
    42 #include <aknViewAppUi.h>
       
    43 #include <featmgr.h>
       
    44 #include <StringLoader.h>
       
    45 #include <bautils.h>
       
    46 #include <coeaui.h>
       
    47 #include <akntitle.h> 
       
    48 #include <aknmessagequerydialog.h> 
       
    49 #include <aknnotewrappers.h> 
       
    50 #include <DiagResultsDatabaseItem.h>   
       
    51 
       
    52 #ifdef __SERIES60_HELP
       
    53 #include <hlplch.h>
       
    54 #endif
       
    55 
       
    56 #include "devdiagsuiteview.h"
       
    57 
       
    58 const TInt KRootSuite = 0x2000E540; //top level suite
       
    59 
       
    60 _LIT(KLinefeed, "\n");
       
    61 _LIT(KTabfeed, "\t");
       
    62 const TInt KFailedTestsMaxLength(1024);
       
    63 
       
    64 // ----------------------------------------------------------------------------
       
    65 // Standard symbian c++ constructor
       
    66 // ----------------------------------------------------------------------------
       
    67 CDevDiagSuiteView* CDevDiagSuiteView::NewL( CDevDiagEngine& aEngine )
       
    68     {
       
    69     //LOGSTRING("CDevDiagSuiteView* CDevDiagSuiteView::NewL");
       
    70     CDevDiagSuiteView* self = CDevDiagSuiteView::NewLC( aEngine );
       
    71     CleanupStack::Pop(self);
       
    72     return self;
       
    73     }
       
    74 
       
    75 // ----------------------------------------------------------------------------
       
    76 // Standard symbian c++ constructor
       
    77 // ----------------------------------------------------------------------------
       
    78 // 
       
    79 CDevDiagSuiteView* CDevDiagSuiteView::NewLC( CDevDiagEngine& aEngine )
       
    80     {
       
    81     //LOGSTRING("CDevDiagSuiteView* CDevDiagSuiteView::NewLC");
       
    82     CDevDiagSuiteView* self = new (ELeave) CDevDiagSuiteView(aEngine);
       
    83     CleanupStack::PushL(self);
       
    84     self->ConstructL();
       
    85     return self;
       
    86     }
       
    87 
       
    88 // ----------------------------------------------------------------------------
       
    89 // ConstructL.
       
    90 // ----------------------------------------------------------------------------
       
    91 // 
       
    92 void CDevDiagSuiteView::ConstructL()
       
    93     {
       
    94     BaseConstructL( R_GS_DD_VIEW );
       
    95     ChangeTitleL ( R_GS_DIAGNOSTICS_VIEW_CAPTION );        
       
    96     }
       
    97 
       
    98 // ----------------------------------------------------------------------------
       
    99 // Constructor.
       
   100 // ----------------------------------------------------------------------------
       
   101 // 
       
   102 CDevDiagSuiteView::CDevDiagSuiteView(CDevDiagEngine& aEngine): 
       
   103         iContainer ( NULL ),
       
   104         iEngine ( aEngine ),
       
   105         iParentPlugin( TUid::Uid( KRootSuite ))      
       
   106     {
       
   107     aEngine.SetObserver(this);
       
   108     }
       
   109 
       
   110 // ----------------------------------------------------------------------------
       
   111 // Destructor.
       
   112 // ----------------------------------------------------------------------------
       
   113 // 
       
   114 CDevDiagSuiteView::~CDevDiagSuiteView()
       
   115    {
       
   116     if ( iContainer )
       
   117         {
       
   118         AppUi()->RemoveFromStack( iContainer );
       
   119         delete iContainer;
       
   120         iContainer = NULL;
       
   121         } 
       
   122     }
       
   123 
       
   124 // ----------------------------------------------------------------------------
       
   125 // Engine observer.
       
   126 // ----------------------------------------------------------------------------
       
   127 // 
       
   128 void CDevDiagSuiteView::HandleEngineCommandL( TAppEngineCommand aCommand,
       
   129                                        TInt aError,
       
   130                                        TAny* aCustom )
       
   131     {
       
   132     switch ( aCommand )
       
   133         {
       
   134         case MDevDiagEngineObserver::EDevDiagEngineCommandPluginLoadComplete:
       
   135             {                        
       
   136             
       
   137             if ( iWaitDialog )
       
   138                 {                
       
   139                 DismissWaitDialogPreparingL();
       
   140                 }
       
   141             
       
   142             CheckCrashedTestL();    
       
   143                 
       
   144             break;
       
   145             }
       
   146         case MDevDiagEngineObserver::EDevDiagEngineCommandPluginLoadProgress:
       
   147             {
       
   148             MDiagPlugin* plugin = static_cast<MDiagPlugin*>(aCustom);
       
   149             
       
   150             if ( SuiteUid( plugin->Uid() ))
       
   151                 {
       
   152                 iContainer->DisplayPluginL( plugin );    
       
   153                 }
       
   154             
       
   155             break;
       
   156             }
       
   157             
       
   158         case MDevDiagEngineObserver::EDevDiagEngineCommandGroupExecutionDone:
       
   159             {
       
   160             if ( aError != KErrNone )
       
   161                 {
       
   162                 LOGSTRING2("MDevDiagEngineObserver::Exec Done Error: %d: ", aError);
       
   163                 return;
       
   164                 }
       
   165                                                             
       
   166             if ( iEngine.HasExecutionResults() )
       
   167                 {
       
   168                 TInt failedCount = iEngine.ExecutionResults().FailedResultsCount();
       
   169                 
       
   170                 if ( failedCount == 0 )
       
   171                     {
       
   172                     DisplayConfirmationDialogL();
       
   173                     }
       
   174                 else 
       
   175                     {
       
   176                     DisplayMessageQueryDialogFailedResultsL();
       
   177                     }                        
       
   178                 }
       
   179                 
       
   180             break;   
       
   181             }
       
   182         }
       
   183     }
       
   184     
       
   185 // ----------------------------------------------------------------------------
       
   186 // Application ID.
       
   187 // ----------------------------------------------------------------------------
       
   188 //     
       
   189 TUid CDevDiagSuiteView::Id() const
       
   190     {
       
   191     return KDDMainViewId;
       
   192     }
       
   193 
       
   194 
       
   195 // ----------------------------------------------------------------------------
       
   196 // Change the title of the application.
       
   197 // ----------------------------------------------------------------------------
       
   198 //     
       
   199 void CDevDiagSuiteView::ChangeTitleL(TInt aResourceId) 
       
   200 	{
       
   201 	CAknTitlePane* titlePane = 
       
   202 	    (CAknTitlePane*)(AppUi()->StatusPane())->ControlL( 
       
   203 	    TUid::Uid( EEikStatusPaneUidTitle ) );
       
   204 	    
       
   205 	HBufC* titleText = iEikonEnv->AllocReadResourceLC( aResourceId );
       
   206 	titlePane->SetTextL( titleText->Des() );
       
   207 	CleanupStack::PopAndDestroy(titleText);
       
   208 	}    
       
   209 
       
   210 // ----------------------------------------------------------------------------
       
   211 // Handle commands.
       
   212 // ----------------------------------------------------------------------------
       
   213 // 
       
   214 void CDevDiagSuiteView::HandleCommandL( TInt aCommand )
       
   215     {
       
   216     LOGSTRING2("CDevDiagSuiteView::HandleCommandL %d",aCommand);
       
   217     switch ( aCommand )
       
   218         {
       
   219         case EDDCmdOpen:
       
   220             {	
       
   221             	//Selected suite plug-in
       
   222             	MDiagPlugin* plugin;
       
   223             	
       
   224             	iContainer->SelectedPlugin( plugin );
       
   225                         
       
   226             	if ( iPluginView )
       
   227                    {
       
   228                    AppUi()->RemoveView( KDDPluginViewId );                	
       
   229                     }
       
   230             
       
   231                 iPluginView = CDevDiagPluginView::NewL( iEngine, plugin->Uid() );
       
   232             
       
   233                 AppUi()->AddViewL( iPluginView );
       
   234             
       
   235                 AppUi()->ActivateLocalViewL( KDDPluginViewId );
       
   236             
       
   237             }
       
   238             
       
   239             break;
       
   240             
       
   241         case EDDCmdPerformAllTests:
       
   242             {
       
   243             	
       
   244             
       
   245             	TBool ok = MessageQueryDialogLaunchL( R_MESSAGE_QUERY_PERFORM_ALL_TESTS );
       
   246             
       
   247             	if ( ok )
       
   248                 	{                
       
   249                 	//Engine will populate the suite.
       
   250                 	//because the plug-in is root suite, all tests will be executed.
       
   251                 	iEngine.ExecuteTestL( iParentPlugin,  *AppUi() );     
       
   252                 	}
       
   253            
       
   254             break;
       
   255             }
       
   256             
       
   257         case EDDMenuCmdMainHelp:
       
   258         	{
       
   259         	/*	MessageQueryDialogLaunchL( 
       
   260                                 R_MESSAGE_QUERY_HELP_NOTE );*/
       
   261         	
       
   262 			HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), 
       
   263 			                         AppUi()->AppHelpContextL() );                                
       
   264             break;	
       
   265         	}
       
   266  
       
   267         case EAknCmdHelp:
       
   268             {            
       
   269             break;
       
   270             }
       
   271 	case EAknCmdTaskSwapper:
       
   272             {
       
   273     	/*
       
   274     	* MSK: Active Applications
       
   275     	* This command is actually handled by Avkon FW
       
   276     	* Applications should not handle this
       
   277     	*/
       
   278     	    break;
       
   279     	    }
       
   280         default:
       
   281             AppUi()->HandleCommandL( aCommand );
       
   282             break;
       
   283         }
       
   284     }
       
   285 
       
   286 
       
   287 // ----------------------------------------------------------------------------
       
   288 // Identify is it a suite or not.
       
   289 // ----------------------------------------------------------------------------
       
   290 // 
       
   291 TBool CDevDiagSuiteView::SuiteUid( TUid aUid )
       
   292     {
       
   293     
       
   294     if ( aUid == KDDHardwareSuiteUid )
       
   295         {
       
   296         return ETrue;
       
   297         }
       
   298     else if ( aUid == KDDConnectivitySuiteUid )   
       
   299         {
       
   300         return ETrue;
       
   301         }
       
   302     else if ( aUid == KDDServicesSuiteUid )   
       
   303         {
       
   304         return ETrue;
       
   305         }
       
   306     else if ( aUid == KDDCoverageSuiteUid )   
       
   307         {
       
   308         return ETrue;
       
   309         }
       
   310     else
       
   311         {
       
   312         return EFalse;
       
   313         }   
       
   314     }
       
   315 
       
   316 // ----------------------------------------------------------------------------
       
   317 // First method called by the Avkon framwork to invoke a view.
       
   318 // ----------------------------------------------------------------------------
       
   319 //
       
   320 void CDevDiagSuiteView::DoActivateL( const TVwsViewId& aPrevViewId,
       
   321                                      TUid /*aCustomMessageId*/,
       
   322                                      const TDesC8& /*aCustomMessage*/ )
       
   323     {
       
   324     LOGSTRING( "CDevDiagSuiteView::DoActivateL");
       
   325     ChangeTitleL ( R_GS_DIAGNOSTICS_VIEW_CAPTION );
       
   326     
       
   327     iPrevViewId = aPrevViewId;
       
   328     
       
   329     if( iContainer )
       
   330         {
       
   331         AppUi()->RemoveFromStack( iContainer );
       
   332 
       
   333         delete iContainer;
       
   334         iContainer = NULL;
       
   335         }
       
   336         
       
   337     iContainer = CDevDiagSuiteContainer::NewL( this, iEngine, ClientRect() );
       
   338     iContainer->SetMopParent( this );
       
   339     AppUi()->AddToStackL( iContainer );
       
   340     
       
   341     iEngine.SetObserver(this);
       
   342      
       
   343     if ( !iEngine.ArePluginsLoaded() ) 
       
   344         {
       
   345         DisplayWaitDialogPreparingL();    
       
   346         }
       
   347     else 
       
   348         {
       
   349         //display children of the top level suite.
       
   350         iContainer->DisplayChildrenL( iParentPlugin );     
       
   351         }                
       
   352     
       
   353     if ( iEikonEnv->StartedAsServerApp() )
       
   354         {
       
   355         //UpdateCbaL( R_PROFILE_MAIN_VIEW_CBA_2 );    
       
   356         }
       
   357     
       
   358     LOGSTRING( "CDevDiagSuiteView::DoActivateL end");
       
   359     }
       
   360 
       
   361 // ----------------------------------------------------------------------------
       
   362 // Update command buttons
       
   363 // ----------------------------------------------------------------------------
       
   364 // 	
       
   365 void CDevDiagSuiteView::UpdateCbaL(TInt aResourceId)
       
   366     {
       
   367     CEikButtonGroupContainer* cba = Cba();
       
   368     cba->SetCommandSetL(aResourceId);
       
   369     cba->DrawDeferred();
       
   370     }
       
   371 
       
   372 // ----------------------------------------------------------------------------
       
   373 // Called by the Avkon view framework when closing.
       
   374 // ----------------------------------------------------------------------------
       
   375 //
       
   376 void CDevDiagSuiteView::DoDeactivate()
       
   377     {
       
   378    if ( iContainer )
       
   379         {
       
   380         AppUi()->RemoveFromStack( iContainer );
       
   381         delete iContainer;
       
   382         iContainer = NULL;
       
   383         }
       
   384             
       
   385     }
       
   386 
       
   387 // ----------------------------------------------------------------------------
       
   388 // Display message query dialog. 
       
   389 //
       
   390 // ----------------------------------------------------------------------------
       
   391 // 	
       
   392 TBool CDevDiagSuiteView::MessageQueryDialogLaunchL( TInt aResourceId )
       
   393 	{	
       
   394     CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog(); 
       
   395    
       
   396     dlg->PrepareLC( aResourceId ); 
       
   397 
       
   398     if (dlg->RunLD())
       
   399     	{	    
       
   400     	return ETrue;
       
   401     	}
       
   402     	
       
   403 	return EFalse;
       
   404 	}
       
   405 
       
   406 
       
   407 // ----------------------------------------------------------------------------
       
   408 // Display a confirmation dialog.
       
   409 //
       
   410 // ----------------------------------------------------------------------------
       
   411 // 
       
   412 void CDevDiagSuiteView::DisplayConfirmationDialogL( TBool aPassed )
       
   413 	{	    
       
   414     CAknConfirmationNote* note = 
       
   415         new (ELeave) CAknConfirmationNote( ETrue ); //Waiting
       
   416 
       
   417     HBufC* text = NULL;
       
   418 
       
   419     if ( aPassed )
       
   420         {
       
   421         text = StringLoader::LoadL( R_DIAG_CONF_TEST_PASSED  );
       
   422         }
       
   423     else 
       
   424         {
       
   425         text = StringLoader::LoadL( R_DIAG_CONF_TEST_FAILED  );
       
   426         }
       
   427 
       
   428     CleanupStack::PushL( text );
       
   429 
       
   430     note->ExecuteLD( *text ); //Blocks until note dismissed
       
   431 
       
   432     CleanupStack::PopAndDestroy();
       
   433 	}	
       
   434 	
       
   435 
       
   436 // ---------------------------------------------------------------------------
       
   437 // Display a wait dialog to inform the user we are preparing for execution.
       
   438 // ---------------------------------------------------------------------------
       
   439 //
       
   440 void CDevDiagSuiteView::DisplayWaitDialogPreparingL()
       
   441     {
       
   442     LOGSTRING( "CDevDiagSuiteView::DisplayWaitDialogPreparingL()" );
       
   443 
       
   444     __ASSERT_DEBUG( !iWaitDialog, Panic( EDevDiagApplicationGeneral ) );
       
   445  
       
   446     // Create the wait dialog and run it. The dialog will only display if
       
   447     // checking runtime requirements takes more than 1.5 seconds.
       
   448     iWaitDialog = new (ELeave) CAknWaitDialog(
       
   449         reinterpret_cast< CEikDialog** >( &iWaitDialog ),
       
   450         EFalse );
       
   451     iWaitDialog->ExecuteLD( R_DEV_DIAG_PREPARING_WAIT_NOTE );
       
   452 
       
   453     }
       
   454 	
       
   455 // ---------------------------------------------------------------------------
       
   456 // Display a confirmation dialog to inform the user there are no logged
       
   457 // results available.
       
   458 // ---------------------------------------------------------------------------
       
   459 //
       
   460 void CDevDiagSuiteView::DismissWaitDialogPreparingL()
       
   461     {
       
   462     LOGSTRING( "CDevDiagSuiteView::DismissWaitDialogPreparingL()" )
       
   463 
       
   464     __ASSERT_DEBUG( iWaitDialog, Panic( EDevDiagApplicationGeneral ) );
       
   465 
       
   466     // Stop the wait dialog.
       
   467     iWaitDialog->ProcessFinishedL();
       
   468     iWaitDialog = NULL;
       
   469     
       
   470     }
       
   471 
       
   472 // ---------------------------------------------------------------------------
       
   473 // Check and display a dialog if there is a crashed test record. Only the last
       
   474 // crashed test record is counted.
       
   475 // ---------------------------------------------------------------------------
       
   476 //
       
   477 void CDevDiagSuiteView::CheckCrashedTestL()
       
   478     {
       
   479     LOGSTRING("CDevDiagSuiteView::CheckCrashedTestL");
       
   480     TUid pluginUid;
       
   481     TBool found = EFalse;
       
   482     TInt error = KErrNone;
       
   483     found = iEngine.CrashedPluginL( pluginUid );
       
   484     LOGSTRING2("CrashedPlugin Found = %d", found);
       
   485     if ( found )
       
   486         {        
       
   487         //Complete the record. 
       
   488         ///@@@KSR: changes for Codescanner error val = High 
       
   489         //error = iEngine.CompleteCrashedTestRecord();
       
   490         error = iEngine.CompleteCrashedTestRecordL();
       
   491         
       
   492         if ( error != KErrNone )
       
   493             {
       
   494             LOGSTRING2( "CDevDiagSuiteView::CheckCrashedTestL 1() error: %d", error );
       
   495             Panic( EDevDiagCheckCrashedTest );
       
   496             }
       
   497         
       
   498         MDiagPlugin* plugin = NULL;
       
   499         error = iEngine.PluginPool().FindPlugin( pluginUid, plugin );
       
   500         
       
   501         HBufC* name = plugin->GetPluginNameL( MDiagPlugin::ENameLayoutPopupInfoPane );
       
   502         CleanupStack::PushL( name );
       
   503         
       
   504         HBufC* text = StringLoader::LoadLC( R_DIAG_CONF_QUERY_AFTER_CRASH, *name );
       
   505     	
       
   506         CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog;
       
   507         
       
   508         dlg->PrepareLC( R_DEVDIAG_EXECUTE_CRASHED_TEST_MESSAGEQUERY_DIALOG ); 
       
   509          
       
   510         dlg->SetMessageTextL( *text );
       
   511         
       
   512         HBufC* headerText = plugin->GetPluginNameL( MDiagPlugin::ENameLayoutHeadingPane );
       
   513         CleanupStack::PushL( headerText );
       
   514         
       
   515         dlg->SetHeaderTextL( *headerText );
       
   516         
       
   517         CleanupStack::PopAndDestroy();
       
   518 
       
   519         if (dlg->RunLD())
       
   520     	    {	    
       
   521     	    //Create a new test run. 
       
   522     	    iEngine.ExecuteTestL( pluginUid,  *AppUi() );  
       
   523     	    }
       
   524     		                                                
       
   525         CleanupStack::PopAndDestroy();    
       
   526         CleanupStack::PopAndDestroy();
       
   527         }    
       
   528     }
       
   529 
       
   530 
       
   531 // ----------------------------------------------------------------------------
       
   532 // This is needed after performing a group of tests succesfully.
       
   533 // ----------------------------------------------------------------------------
       
   534 // 	
       
   535 void CDevDiagSuiteView::DisplayConfirmationDialogL( )
       
   536 	{	    
       
   537     CAknConfirmationNote* note = 
       
   538         new (ELeave) CAknConfirmationNote( ETrue ); //Waiting
       
   539 
       
   540     HBufC* text = NULL;
       
   541    
       
   542     text = StringLoader::LoadLC( R_DIAG_CONF_TEST_PASSED );
       
   543           
       
   544     note->ExecuteLD( *text ); //Blocks until note dismissed
       
   545 
       
   546     CleanupStack::PopAndDestroy();
       
   547 	}	
       
   548 	
       
   549 
       
   550 // ----------------------------------------------------------------------------
       
   551 // This is needed after performing a group of tests
       
   552 //
       
   553 // Display dialog text according to the test result.
       
   554 //
       
   555 // Message query dialog will display a list of failed test cases. 
       
   556 // ----------------------------------------------------------------------------
       
   557 // 		
       
   558 void CDevDiagSuiteView::DisplayMessageQueryDialogFailedResultsL()
       
   559 	{	
       
   560     CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog(); 
       
   561    
       
   562     dlg->PrepareLC( R_DEVDIAG_FAILED_TESTS_MESSAGEQUERY_DIALOG ); 
       
   563 
       
   564     HBufC* failText = StringLoader::LoadL( R_DIAG_CONF_TEST_FAILED  );
       
   565     CleanupStack::PushL( failText );
       
   566         
       
   567     HBufC* failedTests = CreateResultsTextsForFailedTestsLC( iEngine.ExecutionResults() );
       
   568         
       
   569     TInt newBufLength = failText->Length() + failedTests->Length();
       
   570         
       
   571     HBufC* text = HBufC::NewLC( newBufLength );        
       
   572         
       
   573     text->Des().Append( *failText );
       
   574     text->Des().Append( *failedTests );
       
   575     
       
   576     dlg->SetMessageTextL( *text );
       
   577         
       
   578     CleanupStack::PopAndDestroy();
       
   579     CleanupStack::PopAndDestroy();
       
   580     CleanupStack::PopAndDestroy();    
       
   581 
       
   582     if (dlg->RunLD())
       
   583     	{	    
       
   584     	
       
   585     	}    		
       
   586 	}
       
   587 	
       
   588 	
       
   589 // ----------------------------------------------------------------------------
       
   590 // Loads names of the tests that failed.
       
   591 // ----------------------------------------------------------------------------
       
   592 // 		
       
   593 HBufC* CDevDiagSuiteView::CreateResultsTextsForFailedTestsLC( 
       
   594                                     const CDevDiagExecResults& aExecResults )
       
   595     {
       
   596     LOGSTRING("CDevDiagSuiteView::CreateResultsTextsForFailedTestsLC");        
       
   597     RBuf resultText;
       
   598     CleanupClosePushL( resultText );
       
   599     
       
   600     resultText.CreateL( KFailedTestsMaxLength );
       
   601     
       
   602     TBool firstLineFeed = ETrue;
       
   603     
       
   604     for ( TInt i = 0; i < aExecResults.Count(); ++i )
       
   605         {
       
   606         const CDevDiagExecResults::CResult& result = aExecResults[i];
       
   607         
       
   608         //if item == NULL it is a test suite
       
   609         const CDiagResultsDatabaseItem* item = result.Result();
       
   610         
       
   611         if (item && !item->WasDependency())
       
   612             {
       
   613         
       
   614         //List failed test cases
       
   615             if ( item && item->TestResult() == CDiagResultsDatabaseItem::EFailed )
       
   616                 {
       
   617                 const MDiagPlugin& plugin = result.Plugin();
       
   618                 
       
   619                 //Note the correct layout. Name is used in the pop-up info pane.
       
   620                 HBufC* name = plugin.GetPluginNameL( MDiagPlugin::ENameLayoutPopupInfoPane );
       
   621                 CleanupStack::PushL( name );
       
   622                 
       
   623                 if ( resultText.MaxLength() < resultText.Length() + name->Length() )
       
   624                     {
       
   625                     HBufC* temp = resultText.AllocLC();
       
   626                     resultText.ReAlloc( resultText.Length() + KFailedTestsMaxLength );
       
   627                     resultText.Append( *temp );
       
   628                     CleanupStack::PopAndDestroy();
       
   629                     }
       
   630                 
       
   631                 if ( !firstLineFeed )
       
   632                     {
       
   633                     resultText.Append( KLinefeed );
       
   634                     }
       
   635                 else 
       
   636                     {
       
   637                     firstLineFeed = EFalse;        
       
   638                     }
       
   639                                 
       
   640                 resultText.Append( *name );
       
   641                 resultText.Append(KTabfeed);
       
   642                 
       
   643                 CleanupStack::PopAndDestroy();
       
   644                 }
       
   645             }
       
   646         }
       
   647             
       
   648     //contains combined result texts                
       
   649     HBufC* result = resultText.AllocL(); 
       
   650     
       
   651     CleanupStack::PopAndDestroy();
       
   652     
       
   653     CleanupStack::PushL( result );    
       
   654     return result;
       
   655     }
       
   656 //End of file