mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/src/AsxParserTest.cpp
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2002 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:  AsxParserTest.cpp
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: 3.1.1 %
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <Stiftestinterface.h>
       
    25 #include "AsxParserTest.h"
       
    26 #include <SettingServerClient.h>
       
    27 
       
    28 // EXTERNAL DATA STRUCTURES
       
    29 //extern  ?external_data;
       
    30 
       
    31 // EXTERNAL FUNCTION PROTOTYPES  
       
    32 //extern ?external_function( ?arg_type,?arg_type );
       
    33 
       
    34 // CONSTANTS
       
    35 //const ?type ?constant_var = ?constant;
       
    36 
       
    37 // MACROS
       
    38 //#define ?macro ?macro_def
       
    39 
       
    40 // LOCAL CONSTANTS AND MACROS
       
    41 //const ?type ?constant_var = ?constant;
       
    42 //#define ?macro_name ?macro_def
       
    43 
       
    44 // MODULE DATA STRUCTURES
       
    45 //enum ?declaration
       
    46 //typedef ?declaration
       
    47 
       
    48 // LOCAL FUNCTION PROTOTYPES
       
    49 //?type ?function_name( ?arg_type, ?arg_type );
       
    50 
       
    51 // FORWARD DECLARATIONS
       
    52 //class ?FORWARD_CLASSNAME;
       
    53 
       
    54 // ============================= LOCAL FUNCTIONS ===============================
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // ?function_name ?description.
       
    58 // ?description
       
    59 // Returns: ?value_1: ?description
       
    60 //          ?value_n: ?description_line1
       
    61 //                    ?description_line2
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 /*
       
    65 ?type ?function_name(
       
    66     ?arg_type arg,  // ?description
       
    67     ?arg_type arg)  // ?description
       
    68     {
       
    69 
       
    70     ?code  // ?comment
       
    71 
       
    72     // ?comment
       
    73     ?code
       
    74     }
       
    75 */
       
    76 
       
    77 // ============================ MEMBER FUNCTIONS ===============================
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CAsxParserTest::CAsxParserTest
       
    81 // C++ default constructor can NOT contain any code, that
       
    82 // might leave.
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 CAsxParserTest::CAsxParserTest( 
       
    86     CTestModuleIf& aTestModuleIf ):
       
    87         CScriptBase( aTestModuleIf )
       
    88     {
       
    89     }
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CAsxParserTest::ConstructL
       
    93 // Symbian 2nd phase constructor can leave.
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void CAsxParserTest::ConstructL()
       
    97     {
       
    98     //Read logger settings to check whether test case name is to be
       
    99     //appended to log file name.
       
   100     RSettingServer settingServer;
       
   101     TInt ret = settingServer.Connect();
       
   102     if(ret != KErrNone)
       
   103         {
       
   104         User::Leave(ret);
       
   105         }
       
   106     // Struct to StifLogger settigs.
       
   107     TLoggerSettings loggerSettings; 
       
   108     // Parse StifLogger defaults from STIF initialization file.
       
   109     ret = settingServer.GetLoggerSettings(loggerSettings);
       
   110     if(ret != KErrNone)
       
   111         {
       
   112         User::Leave(ret);
       
   113         } 
       
   114     // Close Setting server session
       
   115     settingServer.Close();
       
   116 
       
   117     TFileName logFileName;
       
   118     
       
   119     if(loggerSettings.iAddTestCaseTitle)
       
   120         {
       
   121         TName title;
       
   122         TestModuleIf().GetTestCaseTitleL(title);
       
   123         logFileName.Format(KAsxParserTestLogFileWithTitle, &title);
       
   124         }
       
   125     else
       
   126         {
       
   127         logFileName.Copy(KAsxParserTestLogFile);
       
   128         }
       
   129 
       
   130     iLog = CStifLogger::NewL( KAsxParserTestLogPath, 
       
   131                           logFileName,
       
   132                           CStifLogger::ETxt,
       
   133                           CStifLogger::EFile,
       
   134                           EFalse );
       
   135     
       
   136  //   SendTestClassVersion();
       
   137     }
       
   138 
       
   139 // -----------------------------------------------------------------------------
       
   140 // CAsxParserTest::NewL
       
   141 // Two-phased constructor.
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 CAsxParserTest* CAsxParserTest::NewL( 
       
   145     CTestModuleIf& aTestModuleIf )
       
   146     {
       
   147     CAsxParserTest* self = new (ELeave) CAsxParserTest( aTestModuleIf );
       
   148 
       
   149     CleanupStack::PushL( self );
       
   150     self->ConstructL();
       
   151     CleanupStack::Pop();
       
   152 
       
   153     return self;
       
   154 
       
   155     }
       
   156 
       
   157 // Destructor
       
   158 CAsxParserTest::~CAsxParserTest()
       
   159     { 
       
   160 
       
   161     // Delete resources allocated from test methods
       
   162     Delete();
       
   163 
       
   164     // Delete logger
       
   165     delete iLog; 
       
   166     if(NULL != iAsxParser)
       
   167        	{
       
   168    	    delete iAsxParser;
       
   169    	    iAsxParser = NULL;
       
   170    	    }
       
   171     }
       
   172 /*
       
   173 //-----------------------------------------------------------------------------
       
   174 // CAsxParserTest::SendTestClassVersion
       
   175 // Method used to send version of test class
       
   176 //-----------------------------------------------------------------------------
       
   177 //
       
   178 void CAsxParserTest::SendTestClassVersion()
       
   179 	{
       
   180 	TVersion moduleVersion;
       
   181 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   182 	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   183 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   184 	
       
   185 	TFileName moduleName;
       
   186 	moduleName = _L("AsxParserTest.dll");
       
   187 
       
   188 	TBool newVersionOfMethod = ETrue;
       
   189 	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   190 	}
       
   191 */
       
   192 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   193 
       
   194 // -----------------------------------------------------------------------------
       
   195 // LibEntryL is a polymorphic Dll entry point.
       
   196 // Returns: CScriptBase: New CScriptBase derived object
       
   197 // -----------------------------------------------------------------------------
       
   198 //
       
   199 EXPORT_C CScriptBase* LibEntryL( 
       
   200     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   201     {
       
   202 
       
   203     return ( CScriptBase* ) CAsxParserTest::NewL( aTestModuleIf );
       
   204 
       
   205     }
       
   206 
       
   207 
       
   208 //  End of File