loudmouth/tsrc/src/tstlm.cpp
changeset 10 59927b2d3b75
parent 0 d0f3a028347a
equal deleted inserted replaced
0:d0f3a028347a 10:59927b2d3b75
     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 the License "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:   tstlm.cpp
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <StifTestInterface.h>
       
    23 #include <stdlib.h>
       
    24 #include "tstlm.h"
       
    25 #include <e32cons.h>
       
    26 //#include <mrtlib.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 // Ctstlm::Ctstlm
       
    81 // C++ default constructor can NOT contain any code, that
       
    82 // might leave.
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 Ctstlm::Ctstlm( 
       
    86     CTestModuleIf& aTestModuleIf ):
       
    87         CScriptBase( aTestModuleIf )
       
    88     {
       
    89     //MrtInit();
       
    90     setenv("G_SLICE","always-malloc",1);
       
    91     setenv("LM_DEBUG","ALL",1);
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // Ctstlm::ConstructL
       
    96 // Symbian 2nd phase constructor can leave.
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 void Ctstlm::ConstructL()
       
   100     {
       
   101     iLog = CStifLogger::NewL( KtstlmLogPath, 
       
   102                           KtstlmLogFile,
       
   103                           CStifLogger::ETxt,
       
   104                           CStifLogger::EFile,
       
   105                           EFalse );
       
   106 
       
   107 		TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksMem );
       
   108 		TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests );
       
   109 		TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );
       
   110     }
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // Ctstlm::NewL
       
   114 // Two-phased constructor.
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 Ctstlm* Ctstlm::NewL( 
       
   118     CTestModuleIf& aTestModuleIf )
       
   119     {
       
   120     Ctstlm* self = new (ELeave) Ctstlm( aTestModuleIf );
       
   121 
       
   122     CleanupStack::PushL( self );
       
   123     self->ConstructL();
       
   124     CleanupStack::Pop();
       
   125 
       
   126     return self;
       
   127 
       
   128     }
       
   129 
       
   130 // Destructor
       
   131 Ctstlm::~Ctstlm()
       
   132     { 
       
   133 
       
   134     // Delete resources allocated from test methods
       
   135     Delete();
       
   136 
       
   137     // Delete logger
       
   138     delete iLog; 
       
   139 
       
   140     }
       
   141 
       
   142 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 // LibEntryL is a polymorphic Dll entry point.
       
   146 // Returns: CScriptBase: New CScriptBase derived object
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 EXPORT_C CScriptBase* LibEntryL( 
       
   150     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   151     {
       
   152 
       
   153     return ( CScriptBase* ) Ctstlm::NewL( aTestModuleIf );
       
   154 
       
   155     }
       
   156 
       
   157 // -----------------------------------------------------------------------------
       
   158 // E32Dll is a DLL entry point function.
       
   159 // Returns: KErrNone
       
   160 // -----------------------------------------------------------------------------
       
   161 //
       
   162 #ifndef EKA2 // Hide Dll entry point to EKA2
       
   163 GLDEF_C TInt E32Dll(
       
   164     TDllReason /*aReason*/) // Reason code
       
   165     {
       
   166     return(KErrNone);
       
   167 
       
   168     }
       
   169 #endif // EKA2
       
   170 
       
   171 //  End of File