testexecmdw/tef/tef/test/legacy/sampleserver/src/samplestep.cpp
branchRCL_3
changeset 3 9397a16b6eb8
parent 1 6edeef394eb7
equal deleted inserted replaced
1:6edeef394eb7 3:9397a16b6eb8
     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 * Example CTestStep derived implementation
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file SampleStep.cpp
       
    23 */
       
    24 #include "samplestep.h"
       
    25 
       
    26 CSampleStep1::~CSampleStep1()
       
    27 /**
       
    28  * Destructor
       
    29  */
       
    30 	{
       
    31 	}
       
    32 
       
    33 CSampleStep1::CSampleStep1()
       
    34 /**
       
    35  * Constructor
       
    36  */
       
    37 	{
       
    38 	// Call base class method to set up the human readable name for logging
       
    39 	SetTestStepName(KSampleStep1);
       
    40 	}
       
    41 
       
    42 TVerdict CSampleStep1::doTestStepPreambleL()
       
    43 /**
       
    44  * @return - TVerdict code
       
    45  * Override of base class virtual
       
    46  */
       
    47 	{
       
    48 	SetTestStepResult(EPass);
       
    49 	return TestStepResult();
       
    50 	}
       
    51 
       
    52 TVerdict CSampleStep1::doTestStepL()
       
    53 /**
       
    54  * @return - TVerdict code
       
    55  * Override of base class pure virtual
       
    56  * Demonstrates reading configuration parameters fom an ini file section
       
    57  */
       
    58 	{
       
    59 	INFO_PRINTF1(_L("In Test Step"));
       
    60 
       
    61   	TDriveName scriptDrive(ScriptDriveName());
       
    62   	INFO_PRINTF2(_L("The Drive where script file is executed from is %S"), &scriptDrive);
       
    63 
       
    64 	TInt theInt;
       
    65 	TPtrC val;
       
    66 	_LIT(tem,"NewData");
       
    67 	val.Set(tem);
       
    68 	TBool theBool;
       
    69 	TBuf<40> buf;
       
    70 	TPtrC theString;
       
    71 	TInt changeInt(83);
       
    72 	TInt changeHex(183);
       
    73 	TBool changeBool(ETrue);
       
    74 	_LIT(sectName,"Section3");
       
    75 
       
    76 	GetHexFromConfig(sectName,_L("TheHex"),changeInt);
       
    77 	GetIntFromConfig(ConfigSection(),_L("TheInt"),theInt);
       
    78 	GetBoolFromConfig(ConfigSection(),_L("TheBool"),theBool);
       
    79 	GetStringFromConfig(ConfigSection(),_L("TheString"),theString);
       
    80 	buf.Copy(theString);
       
    81 
       
    82 	WriteBoolToConfig(sectName,_L("TheBool"),changeBool);
       
    83 	WriteIntToConfig(ConfigSection(),_L("TheInt"),changeInt);
       
    84 	WriteHexToConfig(sectName,_L("TheHex"),changeHex);
       
    85 
       
    86 	// Demonstrate panic
       
    87 	if(buf == _L("PanicMe"))
       
    88 		{
       
    89 		const TInt KSampleServerPanic = 1;
       
    90 		User::Panic(_L("SampleServer"),KSampleServerPanic);
       
    91 		}
       
    92 		
       
    93 	SetTestStepResult(EPass);
       
    94 	return TestStepResult();
       
    95 	}
       
    96 
       
    97 TVerdict CSampleStep1::doTestStepPostambleL()
       
    98 /**
       
    99  * @return - TVerdict code
       
   100  * Override of base class virtual
       
   101  */
       
   102 	{
       
   103 	INFO_PRINTF1(_L("Test Step Postamble"));
       
   104 	return TestStepResult();
       
   105 	}
       
   106 
       
   107 ///////
       
   108 
       
   109 CSampleStep2::~CSampleStep2()
       
   110 /**
       
   111  * Destructor
       
   112  */
       
   113 	{
       
   114 	}
       
   115 
       
   116 CSampleStep2::CSampleStep2(CSampleServer& aParent) : iParent(aParent)
       
   117 /**
       
   118  * Constructor
       
   119  */
       
   120 	{
       
   121 	// Call base class method to set up the human readable name for logging
       
   122 	SetTestStepName(KSampleStep2);
       
   123 	SetTestStepResult(EPass);
       
   124 	}
       
   125 
       
   126 TVerdict CSampleStep2::doTestStepPreambleL()
       
   127 /**
       
   128  * @return - TVerdict code
       
   129  * Override of base class virtual
       
   130  */
       
   131 	{
       
   132 	INFO_PRINTF1(_L("Test Step Preamble"));
       
   133 	SetTestStepResult(EPass);
       
   134 	return TestStepResult();
       
   135 	}
       
   136 
       
   137 TVerdict CSampleStep2::doTestStepL()
       
   138 /**
       
   139  * @return - TVerdict code
       
   140  * Override of base class pure virtual
       
   141  * Demonstrates reading configuration parameters fom an ini file section
       
   142  */
       
   143 	{
       
   144 	INFO_PRINTF1(_L("doTestStepL"));
       
   145   	TDriveName scriptDrive(ScriptDriveName());
       
   146   	INFO_PRINTF2(_L("The Drive where script file is executed from is %S"), &scriptDrive);
       
   147 
       
   148 	User::LeaveIfError(iParent.Fs().Connect());
       
   149 	SetTestStepResult(EPass);
       
   150 	return TestStepResult();
       
   151 	}
       
   152 
       
   153 TVerdict CSampleStep2::doTestStepPostambleL()
       
   154 /**
       
   155  * @return - TVerdict code
       
   156  * Override of base class virtual
       
   157  */
       
   158 	{
       
   159 	INFO_PRINTF1(_L("Test Step Postamble"));
       
   160 	SetTestStepResult(EPass);
       
   161 	return TestStepResult();
       
   162 	}
       
   163 ///////
       
   164 
       
   165 CSampleStep3::~CSampleStep3()
       
   166 /**
       
   167  * Destructor
       
   168  */
       
   169 	{
       
   170 	}
       
   171 
       
   172 CSampleStep3::CSampleStep3(CSampleServer& aParent) : iParent(aParent)
       
   173 /**
       
   174  * Constructor
       
   175  */
       
   176 	{
       
   177 	// Call base class method to set up the human readable name for logging
       
   178 	SetTestStepName(KSampleStep3);
       
   179 	}
       
   180 
       
   181 TVerdict CSampleStep3::doTestStepPreambleL()
       
   182 /**
       
   183  * @return - TVerdict code
       
   184  * Override of base class virtual
       
   185  */
       
   186 	{
       
   187 	INFO_PRINTF1(_L("Test Step Preamble"));
       
   188 	SetTestStepResult(EPass);
       
   189 	return TestStepResult();
       
   190 	}
       
   191 
       
   192 TVerdict CSampleStep3::doTestStepL()
       
   193 /**
       
   194  * @return - TVerdict code
       
   195  * Override of base class pure virtual
       
   196  * Demonstrates reading configuration parameters fom an ini file section
       
   197  */
       
   198 	{
       
   199 	INFO_PRINTF1(_L("doTestStepL"));
       
   200   	TDriveName scriptDrive(ScriptDriveName());
       
   201   	INFO_PRINTF2(_L("The Drive where script file is executed from is %S"), &scriptDrive);
       
   202 
       
   203 	iParent.Fs().Close();
       
   204 	SetTestStepResult(EPass);
       
   205 	return TestStepResult();
       
   206 	}
       
   207 
       
   208 TVerdict CSampleStep3::doTestStepPostambleL()
       
   209 /**
       
   210  * @return - TVerdict code
       
   211  * Override of base class virtual
       
   212  */
       
   213 	{
       
   214 	INFO_PRINTF1(_L("Test Step Postamble"));
       
   215 	INFO_PRINTF1( GetServerName() );
       
   216 	SetTestStepResult(EPass);
       
   217 	return TestStepResult();
       
   218 	}
       
   219 
       
   220    ///////
       
   221 
       
   222 CSampleStepSelective::~CSampleStepSelective()
       
   223 /**
       
   224  * Destructor
       
   225  */
       
   226 	{
       
   227 	}
       
   228 
       
   229 CSampleStepSelective::CSampleStepSelective()
       
   230 /**
       
   231  * Constructor
       
   232  */
       
   233 	{
       
   234 	}
       
   235 
       
   236 TVerdict CSampleStepSelective::doTestStepPreambleL()
       
   237 /**
       
   238  * @return - TVerdict code
       
   239  * Override of base class virtual
       
   240  */
       
   241 	{
       
   242 	INFO_PRINTF1(TestStepName());
       
   243 	INFO_PRINTF1(_L("Test Step Preamble"));
       
   244 	SetTestStepResult(EPass);
       
   245 	return TestStepResult();
       
   246 	}
       
   247 
       
   248 TVerdict CSampleStepSelective::doTestStepL()
       
   249 /**
       
   250  * @return - TVerdict code
       
   251  * Override of base class pure virtual
       
   252  */
       
   253 	{
       
   254 	INFO_PRINTF1(TestStepName());
       
   255 	INFO_PRINTF1(_L("doTestStepL"));
       
   256 	SetTestStepResult(EPass);
       
   257 	return TestStepResult();
       
   258 	}
       
   259 
       
   260 TVerdict CSampleStepSelective::doTestStepPostambleL()
       
   261 /**
       
   262  * @return - TVerdict code
       
   263  * Override of base class virtual
       
   264  */
       
   265 	{
       
   266 	INFO_PRINTF1(TestStepName());
       
   267 	INFO_PRINTF1(_L("Test Step Postamble"));
       
   268 	INFO_PRINTF1( GetServerName() );
       
   269 	SetTestStepResult(EPass);
       
   270 	return TestStepResult();
       
   271 	}
       
   272 
       
   273 
       
   274 CSampleStep4::~CSampleStep4()
       
   275 /**
       
   276  * Destructor
       
   277  */
       
   278 	{
       
   279 	}
       
   280 
       
   281 CSampleStep4::CSampleStep4()
       
   282 /**
       
   283  * Constructor
       
   284  */
       
   285 	{
       
   286 	// Call base class method to set up the human readable name for logging
       
   287 	SetTestStepName(KSampleStep4);
       
   288 	}
       
   289 
       
   290 TVerdict CSampleStep4::doTestStepPreambleL()
       
   291 /**
       
   292  * @return - TVerdict code
       
   293  * Override of base class virtual
       
   294  */
       
   295 	{
       
   296 	SetTestStepResult(EPass);
       
   297 	return TestStepResult();
       
   298 	}
       
   299 
       
   300 TVerdict CSampleStep4::doTestStepL()
       
   301 /**
       
   302  * @return - TVerdict code
       
   303  * Override of base class pure virtual
       
   304  * Demonstrates reading configuration parameters fom an ini file section
       
   305  */
       
   306 	{
       
   307 	INFO_PRINTF1(_L("In Test Step of SampleStep4"));
       
   308   	TDriveName scriptDrive(ScriptDriveName());
       
   309   	INFO_PRINTF2(_L("The Drive where script file is executed from is %S"), &scriptDrive);	
       
   310 
       
   311 	SetTestStepError(-43);
       
   312 	SetTestStepResult(EPass);
       
   313 	return TestStepResult();
       
   314 	}
       
   315 
       
   316 TVerdict CSampleStep4::doTestStepPostambleL()
       
   317 /**
       
   318  * @return - TVerdict code
       
   319  * Override of base class virtual
       
   320  */
       
   321 	{
       
   322 	INFO_PRINTF1(_L("Test Step Postamble"));
       
   323 	return TestStepResult();
       
   324 	}
       
   325 
       
   326 CSampleStep5::CSampleStep5()
       
   327 	{
       
   328 		SetTestStepName(KSampleStep5);
       
   329 	};
       
   330 
       
   331 CSampleStep6::CSampleStep6()
       
   332 	{
       
   333 		SetTestStepName(KSampleStep6);
       
   334 	};
       
   335 
       
   336 CSampleStep7::CSampleStep7()
       
   337 	{
       
   338 		SetTestStepName(KSampleStep7);
       
   339 	};
       
   340 
       
   341 CSampleStep8::CSampleStep8()
       
   342 	{
       
   343 		SetTestStepName(KSampleStep8);
       
   344 	};
       
   345 CSampleStep9::CSampleStep9()
       
   346 	{
       
   347 		SetTestStepName(KSampleStep9);
       
   348 	};
       
   349 
       
   350 CSampleStep10::CSampleStep10()
       
   351 	{
       
   352 		SetTestStepName(KSampleStep10);
       
   353 	};
       
   354 
       
   355 CSampleStep11::CSampleStep11()
       
   356 	{
       
   357 		SetTestStepName(KSampleStep11);
       
   358 	};
       
   359 
       
   360 CSampleStep12::CSampleStep12()
       
   361 	{
       
   362 		SetTestStepName(KSampleStep12);
       
   363 	};
       
   364 
       
   365 CSampleStep13::CSampleStep13()
       
   366 	{
       
   367 		SetTestStepName(KSampleStep13);
       
   368 	};