os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/src/T_FileNamesIdenticalData.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2005-2009 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 "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: 
    15 *
    16 */
    17 
    18 
    19 /**
    20 @test
    21 @internalComponent
    22 v
    23 This contains CT_FileNamesIdenticalData
    24 */
    25 
    26 //	User includes
    27 #include "T_FileNamesIdenticalData.h"
    28 #include "T_SfSrvServer.h"
    29 
    30 /*@{*/
    31 ///	Parameters
    32 _LIT(KFile1,										"file1");
    33 _LIT(KFile2,										"file2");
    34 _LIT(KExpected,										"expected");
    35 
    36 
    37 ///Commands
    38 _LIT(KCmdFileNamesIdentical,						"FileNamesIdentical");
    39 
    40 
    41 CT_FileNamesIdenticalData* CT_FileNamesIdenticalData::NewL()
    42 /**
    43 * Two phase constructor
    44 */
    45 	{
    46 	CT_FileNamesIdenticalData* ret = new (ELeave) CT_FileNamesIdenticalData();
    47 	CleanupStack::PushL(ret);
    48 	ret->ConstructL();
    49 	CleanupStack::Pop(ret);
    50 	return ret;
    51 	}
    52 
    53 
    54 CT_FileNamesIdenticalData::CT_FileNamesIdenticalData()
    55 /**
    56 * Protected constructor. First phase construction
    57 */
    58 	{
    59 	}
    60 
    61 
    62 void CT_FileNamesIdenticalData::ConstructL()
    63 /**
    64 * Protected constructor. Second phase construction
    65 */
    66 	{
    67 	}
    68 
    69 
    70 CT_FileNamesIdenticalData::~CT_FileNamesIdenticalData()
    71 /**
    72 * Destructor.
    73 */
    74 	{
    75 	}
    76 
    77 
    78 TAny* CT_FileNamesIdenticalData::GetObject()
    79 	{
    80 	return NULL;
    81 	}
    82 
    83 
    84 TBool CT_FileNamesIdenticalData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
    85 /**
    86 * Process a command read from the ini file
    87 *
    88 * @param aCommand	the command to process
    89 * @param aSection	the section in the ini file requiring the command to be processed
    90 *
    91 * @return ETrue if the command is processed
    92 */
    93 	{
    94 	TBool retVal = ETrue;
    95 
    96 	if (aCommand == KCmdFileNamesIdentical)
    97 		{
    98 		DoCmdFileNamesIdentical(aSection);
    99 		}
   100 	return retVal;
   101 	}
   102 	
   103 void CT_FileNamesIdenticalData::DoCmdFileNamesIdentical(const TDesC& aSection)
   104 	{
   105 	TPtrC file1, file2;
   106 	TBool expected;
   107 	if(GET_MANDATORY_STRING_PARAMETER(KFile1, aSection, file1)
   108 		&& GET_MANDATORY_STRING_PARAMETER(KFile2, aSection, file2)
   109 		&& GET_MANDATORY_BOOL_PARAMETER(KExpected, aSection, expected))
   110 		{
   111 		TBool identical = EFalse;
   112 		
   113 		INFO_PRINTF1(_L("Comparing files:"));
   114 		INFO_PRINTF2(_L("File 1: %S"), &file1);
   115 		INFO_PRINTF2(_L("File 2: %S"), &file2);
   116 		
   117 		identical = FileNamesIdentical(file1,file2);
   118 		if(identical != expected)
   119 			{
   120 			ERR_PRINTF1(_L("File names are not identical and it's not expected!"));
   121 			SetBlockResult(EFail);
   122 			}
   123 		else
   124 			{
   125 			if (expected)
   126 				{
   127 				INFO_PRINTF1(_L("File names are identical."));
   128 				}
   129 			else
   130 				{
   131 				INFO_PRINTF1(_L("File names are not identical, but it's expected."));
   132 				}
   133 			}
   134 		}
   135 	}