mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/src/ComposerPluginTest.cpp
changeset 58 fe894bb075c2
parent 51 87e65c44ff3a
child 60 79f826a55db2
equal deleted inserted replaced
51:87e65c44ff3a 58:fe894bb075c2
     1 /*
       
     2 * Copyright (c) 2002-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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <StifTestInterface.h>
       
    21 #include "ComposerPluginTest.h"
       
    22 #include <SettingServerClient.h>
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CComposerPluginTest::CComposerPluginTest
       
    28 // C++ default constructor can NOT contain any code, that
       
    29 // might leave.
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CComposerPluginTest::CComposerPluginTest( 
       
    33     CTestModuleIf& aTestModuleIf ):
       
    34         CScriptBase( aTestModuleIf )
       
    35     {
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CComposerPluginTest::ConstructL
       
    40 // Symbian 2nd phase constructor can leave.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 void CComposerPluginTest::ConstructL()
       
    44     {
       
    45     //Read logger settings to check whether test case name is to be
       
    46     //appended to log file name.
       
    47     RSettingServer settingServer;
       
    48     TInt ret = settingServer.Connect();
       
    49     if(ret != KErrNone)
       
    50         {
       
    51         User::Leave(ret);
       
    52         }
       
    53     // Struct to StifLogger settigs.
       
    54     TLoggerSettings loggerSettings; 
       
    55     // Parse StifLogger defaults from STIF initialization file.
       
    56     ret = settingServer.GetLoggerSettings(loggerSettings);
       
    57     if(ret != KErrNone)
       
    58         {
       
    59         User::Leave(ret);
       
    60         } 
       
    61     // Close Setting server session
       
    62     settingServer.Close();
       
    63 
       
    64     TFileName logFileName;
       
    65     
       
    66     if(loggerSettings.iAddTestCaseTitle)
       
    67         {
       
    68         TName title;
       
    69         TestModuleIf().GetTestCaseTitleL(title);
       
    70         logFileName.Format(KComposerPluginTestLogFileWithTitle, &title);
       
    71         }
       
    72     else
       
    73         {
       
    74         logFileName.Copy(KComposerPluginTestLogFile);
       
    75         }
       
    76 
       
    77     iLog = CStifLogger::NewL( KComposerPluginTestLogPath, 
       
    78                           logFileName,
       
    79                           CStifLogger::ETxt,
       
    80                           CStifLogger::EFile,
       
    81                           EFalse );
       
    82 
       
    83     }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CComposerPluginTest::NewL
       
    87 // Two-phased constructor.
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 CComposerPluginTest* CComposerPluginTest::NewL( 
       
    91     CTestModuleIf& aTestModuleIf )
       
    92     {
       
    93     CComposerPluginTest* self = new (ELeave) CComposerPluginTest( aTestModuleIf );
       
    94 
       
    95     CleanupStack::PushL( self );
       
    96     self->ConstructL();
       
    97     CleanupStack::Pop( self );
       
    98 
       
    99     return self;
       
   100 
       
   101     }
       
   102 
       
   103 // Destructor
       
   104 CComposerPluginTest::~CComposerPluginTest()
       
   105     { 
       
   106 
       
   107     // Delete resources allocated from test methods
       
   108     Delete();
       
   109 
       
   110     // Delete logger
       
   111     delete iLog; 
       
   112 
       
   113     }
       
   114 
       
   115 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // LibEntryL is a polymorphic Dll entry point.
       
   119 // Returns: CScriptBase: New CScriptBase derived object
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 EXPORT_C CScriptBase* LibEntryL( 
       
   123     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   124     {
       
   125 
       
   126     return ( CScriptBase* ) CComposerPluginTest::NewL( aTestModuleIf );
       
   127 
       
   128     }
       
   129 
       
   130 
       
   131 //  End of File