sl@0: /*
sl@0: * Copyright (c) 2007-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: * Example CTestStep derived implementation
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: /**
sl@0:  @file
sl@0:  @internalTechnology
sl@0: */
sl@0: #include "hashpositiveobjectloadstep.h"
sl@0: 
sl@0: #include <cryptospi/cryptohashapi.h>
sl@0: 
sl@0: 
sl@0: using namespace CryptoSpi;
sl@0: 
sl@0: CHashPositiveObjectLoadStep::~CHashPositiveObjectLoadStep()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: 
sl@0: CHashPositiveObjectLoadStep::CHashPositiveObjectLoadStep()
sl@0: 	{
sl@0: 	SetTestStepName(KHashPositiveObjectLoadStep);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: TVerdict CHashPositiveObjectLoadStep::doTestStepPreambleL()
sl@0: 	{
sl@0: 	SetTestStepResult(EPass);
sl@0: 	return TestStepResult();
sl@0: 	}
sl@0: 
sl@0: 
sl@0: TVerdict CHashPositiveObjectLoadStep::doTestStepL()
sl@0: 	{
sl@0: 	if (TestStepResult()==EPass)
sl@0: 		{
sl@0: 		
sl@0: 		//Assume faliure, unless all is successful
sl@0: 		SetTestStepResult(EFail);
sl@0: 			
sl@0: 		INFO_PRINTF1(_L("*** Hash - Positive Object Load ***"));
sl@0: 		INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
sl@0: 		
sl@0: 		TVariantPtrC algorithmUid;
sl@0: 		TVariantPtrC operationModeUid;
sl@0: 		
sl@0: 		//Extract the Test Case ID parameter from the specified INI file
sl@0: 		if(!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
sl@0: 			!GetStringFromConfig(ConfigSection(),KConfigOperationMode,operationModeUid))
sl@0: 			{
sl@0: 			ERR_PRINTF1(_L("** Error: Failed to Load Configuration Parameters **"));
sl@0: 			SetTestStepResult(EFail);
sl@0: 			}
sl@0: 		else
sl@0: 			{
sl@0: 			//Create and intialise a pointer for the Hash implementation object
sl@0: 			CHash* hashImpl = NULL;
sl@0: 			
sl@0: 			INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
sl@0: 			
sl@0: 			//Retrieve a Hash factory object				
sl@0: 			TRAPD(err,CHashFactory::CreateHashL(hashImpl,
sl@0: 												algorithmUid,
sl@0: 												operationModeUid,
sl@0: 												NULL,
sl@0: 												NULL));  
sl@0: 				
sl@0: 			//If there are no errors (KErrNone) creating the Hash factory object, Pass the Test	
sl@0: 			if(hashImpl && (err == KErrNone))
sl@0: 				{
sl@0: 				INFO_PRINTF1(_L("*** Hash - Positive Object Load: PASS ***"));
sl@0: 				delete hashImpl;
sl@0: 				SetTestStepResult(EPass);	
sl@0: 				}
sl@0: 			else
sl@0: 				{
sl@0: 				ERR_PRINTF2(_L("*** FAIL: Failed to Create Hash Object - %d ***"), err);
sl@0: 				SetTestStepResult(EFail);	
sl@0: 				}
sl@0: 			}
sl@0: 		
sl@0: 		INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
sl@0: 		
sl@0: 		}
sl@0: 	return TestStepResult();
sl@0: 	}
sl@0: 
sl@0: 
sl@0: TVerdict CHashPositiveObjectLoadStep::doTestStepPostambleL()
sl@0: 	{
sl@0: 	
sl@0: 	return TestStepResult();
sl@0: 	}