sl@0: /* sl@0: * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: // INCLUDE FILES sl@0: #include sl@0: #include "BCException.h" sl@0: #include sl@0: sl@0: // EXTERNAL DATA STRUCTURES sl@0: //extern ?external_data; sl@0: sl@0: // EXTERNAL FUNCTION PROTOTYPES sl@0: //extern ?external_function( ?arg_type,?arg_type ); sl@0: sl@0: // CONSTANTS sl@0: //const ?type ?constant_var = ?constant; sl@0: sl@0: // MACROS sl@0: //#define ?macro ?macro_def sl@0: sl@0: // LOCAL CONSTANTS AND MACROS sl@0: //const ?type ?constant_var = ?constant; sl@0: //#define ?macro_name ?macro_def sl@0: sl@0: // MODULE DATA STRUCTURES sl@0: //enum ?declaration sl@0: //typedef ?declaration sl@0: sl@0: // LOCAL FUNCTION PROTOTYPES sl@0: //?type ?function_name( ?arg_type, ?arg_type ); sl@0: sl@0: // FORWARD DECLARATIONS sl@0: //class ?FORWARD_CLASSNAME; sl@0: sl@0: // ============================= LOCAL FUNCTIONS =============================== sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // ?function_name ?description. sl@0: // ?description sl@0: // Returns: ?value_1: ?description sl@0: // ?value_n: ?description_line1 sl@0: // ?description_line2 sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: /* sl@0: ?type ?function_name( sl@0: ?arg_type arg, // ?description sl@0: ?arg_type arg) // ?description sl@0: { sl@0: sl@0: ?code // ?comment sl@0: sl@0: // ?comment sl@0: ?code sl@0: } sl@0: */ sl@0: sl@0: // ============================ MEMBER FUNCTIONS =============================== sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBCException::CBCException sl@0: // C++ default constructor can NOT contain any code, that sl@0: // might leave. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: CBCException::CBCException( sl@0: CTestModuleIf& aTestModuleIf ): sl@0: CScriptBase( aTestModuleIf ) sl@0: { sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBCException::ConstructL sl@0: // Symbian 2nd phase constructor can leave. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: void CBCException::ConstructL() sl@0: { sl@0: //Read logger settings to check whether test case name is to be sl@0: //appended to log file name. sl@0: RSettingServer settingServer; sl@0: TInt ret = settingServer.Connect(); sl@0: if(ret != KErrNone) sl@0: { sl@0: User::Leave(ret); sl@0: } sl@0: // Struct to StifLogger settigs. sl@0: TLoggerSettings loggerSettings; sl@0: // Parse StifLogger defaults from STIF initialization file. sl@0: ret = settingServer.GetLoggerSettings(loggerSettings); sl@0: if(ret != KErrNone) sl@0: { sl@0: User::Leave(ret); sl@0: } sl@0: // Close Setting server session sl@0: settingServer.Close(); sl@0: sl@0: TFileName logFileName; sl@0: sl@0: if(loggerSettings.iAddTestCaseTitle) sl@0: { sl@0: TName title; sl@0: TestModuleIf().GetTestCaseTitleL(title); sl@0: logFileName.Format(KBCExceptionLogFileWithTitle, &title); sl@0: } sl@0: else sl@0: { sl@0: logFileName.Copy(KBCExceptionLogFile); sl@0: } sl@0: sl@0: iLog = CStifLogger::NewL( KBCExceptionLogPath, sl@0: logFileName, sl@0: CStifLogger::ETxt, sl@0: CStifLogger::EFile, sl@0: EFalse ); sl@0: sl@0: SendTestClassVersion(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBCException::NewL sl@0: // Two-phased constructor. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: CBCException* CBCException::NewL( sl@0: CTestModuleIf& aTestModuleIf ) sl@0: { sl@0: CBCException* self = new (ELeave) CBCException( aTestModuleIf ); sl@0: sl@0: CleanupStack::PushL( self ); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(); sl@0: sl@0: return self; sl@0: sl@0: } sl@0: sl@0: // Destructor sl@0: CBCException::~CBCException() sl@0: { sl@0: sl@0: // Delete resources allocated from test methods sl@0: Delete(); sl@0: sl@0: // Delete logger sl@0: delete iLog; sl@0: sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: // CBCException::SendTestClassVersion sl@0: // Method used to send version of test class sl@0: //----------------------------------------------------------------------------- sl@0: // sl@0: void CBCException::SendTestClassVersion() sl@0: { sl@0: TVersion moduleVersion; sl@0: moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; sl@0: moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; sl@0: moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; sl@0: sl@0: TFileName moduleName; sl@0: moduleName = _L("BCException.dll"); sl@0: sl@0: TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName); sl@0: } sl@0: sl@0: // ========================== OTHER EXPORTED FUNCTIONS ========================= sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // LibEntryL is a polymorphic Dll entry point. sl@0: // Returns: CScriptBase: New CScriptBase derived object sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CScriptBase* LibEntryL( sl@0: CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework sl@0: { sl@0: sl@0: return ( CScriptBase* ) CBCException::NewL( aTestModuleIf ); sl@0: sl@0: } sl@0: sl@0: sl@0: // End of File