sl@0: /* sl@0: * Copyright (c) 2005-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 the License "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: sl@0: sl@0: /** sl@0: @file sl@0: */ sl@0: sl@0: //This is a dummy source file to be used to create a dummy exe sl@0: #include sl@0: #include sl@0: sl@0: #include "captestframework.h" sl@0: sl@0: sl@0: void MainL(); sl@0: sl@0: GLDEF_D TInt E32Main() sl@0: { sl@0: CTrapCleanup* cleanup = CTrapCleanup::New(); sl@0: if(cleanup == NULL) sl@0: { sl@0: return KErrNoMemory; sl@0: } sl@0: sl@0: TRAPD(err,MainL()); sl@0: delete cleanup; sl@0: return err; sl@0: } sl@0: sl@0: HBufC* GetDesParameterL(TInt aParam) sl@0: { sl@0: // Get Dll name sl@0: TInt length=User::ParameterLength(aParam); sl@0: User::LeaveIfError(length); sl@0: sl@0: HBufC* des=HBufC::NewLC(length); sl@0: TPtr desPtr=des->Des(); sl@0: User::LeaveIfError(User::GetDesParameter(aParam, desPtr)); sl@0: sl@0: CleanupStack::Pop(des); sl@0: return des; sl@0: } sl@0: sl@0: sl@0: HBufC* GetDllNameL() sl@0: { sl@0: return GetDesParameterL(KDllNameTransferSlot); sl@0: } sl@0: sl@0: void MainL() sl@0: { sl@0: TInt err=KErrNone; sl@0: sl@0: // figure out which test we're supposed to be running sl@0: HBufC* dllName=GetDllNameL(); sl@0: sl@0: HBufC* logFileName=GetDesParameterL(KLogFileNameTransferSlot); sl@0: sl@0: TBool shouldPass; sl@0: err = User::GetTIntParameter(KShouldPassTransferSlot, shouldPass); sl@0: TInt testNumber; sl@0: err = User::GetTIntParameter(KTestNumberTransferSlot, testNumber); sl@0: sl@0: // session sl@0: RFs fs; sl@0: User::LeaveIfError(fs.Connect()); sl@0: CleanupClosePushL(fs); sl@0: sl@0: //logfile sl@0: RFile logFile; sl@0: User::LeaveIfError(logFile.Replace(fs, *logFileName, 0)); sl@0: CleanupClosePushL(logFile); sl@0: sl@0: // load library sl@0: RLibrary lib; sl@0: User::LeaveIfError(lib.Load(*dllName)); sl@0: CleanupClosePushL(lib); sl@0: sl@0: //runtests sl@0: TLibraryFunction testFactory=lib.Lookup(1); sl@0: MCapabilityTestFactory* factory=reinterpret_cast(testFactory()); sl@0: factory->Test(testNumber)->SetExpectPermissionDenied(!shouldPass); sl@0: sl@0: TRAP(err, factory->Test(testNumber)->RunTestL(logFile)); sl@0: sl@0: delete factory; sl@0: CleanupStack::PopAndDestroy(3, &fs); // lib, logFile, fs sl@0: sl@0: User::LeaveIfError(err); sl@0: }