os/ossrv/lowlevellibsandfws/apputils/multipartparser/test/tef/smoketest/src/mppsmoketeststeps.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/lowlevellibsandfws/apputils/multipartparser/test/tef/smoketest/src/mppsmoketeststeps.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,118 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// mppSmokeTestStepsDom.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +
    1.22 +#include "mppsmoketeststeps.h"
    1.23 +
    1.24 +#include <e32svr.h>
    1.25 +#include <e32def.h>
    1.26 +
    1.27 +#include <xml/parser.h>
    1.28 +#include <xml/parserfeature.h>
    1.29 +
    1.30 +//#include <string.h>
    1.31 +#include <charconv.h>
    1.32 +#include <utf.h>
    1.33 +#include <bautils.h>
    1.34 +
    1.35 +	
    1.36 +TVerdict CParseBase64Encoding::doTestStepL()
    1.37 +	{
    1.38 +	CMultipartTestContainer* tester = CMultipartTestContainer::NewLC(Logger());
    1.39 +
    1.40 +	TBool success;
    1.41 +	TPtrC inputFile;
    1.42 +	success = GetStringFromConfig(ConfigSection(), _L("InputFile"), inputFile);
    1.43 +	if (success == EFalse)
    1.44 +		{
    1.45 +		User::Leave(KErrArgument);
    1.46 +		}
    1.47 +	RFs fs;
    1.48 +	fs.Connect();
    1.49 +	success = BaflUtils::FileExists(fs, inputFile);
    1.50 +	if (success == EFalse)
    1.51 +		{
    1.52 +		User::Leave(KErrArgument);
    1.53 +		}
    1.54 +	fs.Close();	
    1.55 +	TPtrC url;
    1.56 +	success = GetStringFromConfig(ConfigSection(), _L("Url"), url);	
    1.57 +	if (success == EFalse)
    1.58 +		{
    1.59 +		User::Leave(KErrArgument);
    1.60 +		}
    1.61 +	TPtrC outputFile;
    1.62 +	success = GetStringFromConfig(ConfigSection(), _L("OutputFile"), outputFile);
    1.63 +	if (success == EFalse)
    1.64 +		{
    1.65 +		User::Leave(KErrArgument);
    1.66 +		}
    1.67 +	
    1.68 +	TInt ret;
    1.69 +	TRAP(ret, tester->ParseFileL(inputFile, url, outputFile));
    1.70 +	if (ret != KErrNone)
    1.71 +		{
    1.72 +		User::Leave(KErrGeneral);
    1.73 +		}
    1.74 +
    1.75 +	// find out if the test passed or failed
    1.76 +	TPtrC filename1;
    1.77 +	success = GetStringFromConfig(ConfigSection(), _L("CompareFile1"), filename1);	
    1.78 +	if (success == EFalse)
    1.79 +		{
    1.80 +		User::Leave(KErrArgument);
    1.81 +		}
    1.82 +	TPtrC filename2;
    1.83 +	success = GetStringFromConfig(ConfigSection(), _L("CompareFile2"), filename2);
    1.84 +	if (success == EFalse)
    1.85 +		{
    1.86 +		User::Leave(KErrArgument);
    1.87 +		}
    1.88 +	TBool skipWhitespace = EFalse;
    1.89 +	success = GetBoolFromConfig(ConfigSection(), _L("SkipWhitespace"), skipWhitespace);
    1.90 +	if (success == EFalse)
    1.91 +		{
    1.92 +		User::Leave(KErrArgument);
    1.93 +		}
    1.94 +	
    1.95 +	ret = tester->CompareFilesL(filename1, filename2, skipWhitespace);
    1.96 +
    1.97 +   fs.Connect();
    1.98 +   CleanupClosePushL(fs);
    1.99 +   //Must not be read-only on hardware or files cannot be
   1.100 +   //  deleted, set attr in .iby file. 
   1.101 +   User::LeaveIfError(fs.Delete(outputFile));
   1.102 +   CleanupStack::PopAndDestroy(1, &fs);
   1.103 +   fs.Close();
   1.104 +	
   1.105 +	CleanupStack::PopAndDestroy(1);
   1.106 +	if (ret == KErrNone)
   1.107 +		 {
   1.108 +		 SetTestStepResult(EPass);
   1.109 +		 return EPass;
   1.110 +		 }		
   1.111 +	else
   1.112 +		 {
   1.113 +		 SetTestStepResult(EFail);
   1.114 +		 INFO_PRINTF2(_L("CompareFiles error code: %d"), ret);
   1.115 +		 return EFail;
   1.116 +		 }			
   1.117 +	}
   1.118 +
   1.119 +
   1.120 +
   1.121 +