os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/src/T_FileNamesIdenticalData.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/src/T_FileNamesIdenticalData.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,135 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +/**
    1.23 +@test
    1.24 +@internalComponent
    1.25 +v
    1.26 +This contains CT_FileNamesIdenticalData
    1.27 +*/
    1.28 +
    1.29 +//	User includes
    1.30 +#include "T_FileNamesIdenticalData.h"
    1.31 +#include "T_SfSrvServer.h"
    1.32 +
    1.33 +/*@{*/
    1.34 +///	Parameters
    1.35 +_LIT(KFile1,										"file1");
    1.36 +_LIT(KFile2,										"file2");
    1.37 +_LIT(KExpected,										"expected");
    1.38 +
    1.39 +
    1.40 +///Commands
    1.41 +_LIT(KCmdFileNamesIdentical,						"FileNamesIdentical");
    1.42 +
    1.43 +
    1.44 +CT_FileNamesIdenticalData* CT_FileNamesIdenticalData::NewL()
    1.45 +/**
    1.46 +* Two phase constructor
    1.47 +*/
    1.48 +	{
    1.49 +	CT_FileNamesIdenticalData* ret = new (ELeave) CT_FileNamesIdenticalData();
    1.50 +	CleanupStack::PushL(ret);
    1.51 +	ret->ConstructL();
    1.52 +	CleanupStack::Pop(ret);
    1.53 +	return ret;
    1.54 +	}
    1.55 +
    1.56 +
    1.57 +CT_FileNamesIdenticalData::CT_FileNamesIdenticalData()
    1.58 +/**
    1.59 +* Protected constructor. First phase construction
    1.60 +*/
    1.61 +	{
    1.62 +	}
    1.63 +
    1.64 +
    1.65 +void CT_FileNamesIdenticalData::ConstructL()
    1.66 +/**
    1.67 +* Protected constructor. Second phase construction
    1.68 +*/
    1.69 +	{
    1.70 +	}
    1.71 +
    1.72 +
    1.73 +CT_FileNamesIdenticalData::~CT_FileNamesIdenticalData()
    1.74 +/**
    1.75 +* Destructor.
    1.76 +*/
    1.77 +	{
    1.78 +	}
    1.79 +
    1.80 +
    1.81 +TAny* CT_FileNamesIdenticalData::GetObject()
    1.82 +	{
    1.83 +	return NULL;
    1.84 +	}
    1.85 +
    1.86 +
    1.87 +TBool CT_FileNamesIdenticalData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
    1.88 +/**
    1.89 +* Process a command read from the ini file
    1.90 +*
    1.91 +* @param aCommand	the command to process
    1.92 +* @param aSection	the section in the ini file requiring the command to be processed
    1.93 +*
    1.94 +* @return ETrue if the command is processed
    1.95 +*/
    1.96 +	{
    1.97 +	TBool retVal = ETrue;
    1.98 +
    1.99 +	if (aCommand == KCmdFileNamesIdentical)
   1.100 +		{
   1.101 +		DoCmdFileNamesIdentical(aSection);
   1.102 +		}
   1.103 +	return retVal;
   1.104 +	}
   1.105 +	
   1.106 +void CT_FileNamesIdenticalData::DoCmdFileNamesIdentical(const TDesC& aSection)
   1.107 +	{
   1.108 +	TPtrC file1, file2;
   1.109 +	TBool expected;
   1.110 +	if(GET_MANDATORY_STRING_PARAMETER(KFile1, aSection, file1)
   1.111 +		&& GET_MANDATORY_STRING_PARAMETER(KFile2, aSection, file2)
   1.112 +		&& GET_MANDATORY_BOOL_PARAMETER(KExpected, aSection, expected))
   1.113 +		{
   1.114 +		TBool identical = EFalse;
   1.115 +		
   1.116 +		INFO_PRINTF1(_L("Comparing files:"));
   1.117 +		INFO_PRINTF2(_L("File 1: %S"), &file1);
   1.118 +		INFO_PRINTF2(_L("File 2: %S"), &file2);
   1.119 +		
   1.120 +		identical = FileNamesIdentical(file1,file2);
   1.121 +		if(identical != expected)
   1.122 +			{
   1.123 +			ERR_PRINTF1(_L("File names are not identical and it's not expected!"));
   1.124 +			SetBlockResult(EFail);
   1.125 +			}
   1.126 +		else
   1.127 +			{
   1.128 +			if (expected)
   1.129 +				{
   1.130 +				INFO_PRINTF1(_L("File names are identical."));
   1.131 +				}
   1.132 +			else
   1.133 +				{
   1.134 +				INFO_PRINTF1(_L("File names are not identical, but it's expected."));
   1.135 +				}
   1.136 +			}
   1.137 +		}
   1.138 +	}