testexecmdw/tef/tef/test/regressiontest/scriptcommand/src/accessstep.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 AccessStep.cpp
       
    23 */
       
    24 #include "accessstep.h"
       
    25 #include <test/testshareddata.h>
       
    26 #include <test/testexecutelog.h>
       
    27 
       
    28 CAccessStep1::~CAccessStep1()
       
    29 /**
       
    30  * Destructor
       
    31  */
       
    32 	{
       
    33 	}
       
    34 
       
    35 CAccessStep1::CAccessStep1()
       
    36 /**
       
    37  * Constructor
       
    38  */
       
    39 	{
       
    40 	// Call base class method to set up the human readable name for logging
       
    41 	SetTestStepName(KAccessStep1);
       
    42 	}
       
    43 
       
    44 TVerdict CAccessStep1::doTestStepL()
       
    45 /**
       
    46  * @return - TVerdict code
       
    47  * Override of base class pure virtual
       
    48  * Demonstrates opening up a handle to the data saved at RChunk base using template class
       
    49  * Overwrite shared data with values without locking mechanism for data access
       
    50  */
       
    51 	{
       
    52 	INFO_PRINTF1(_L("Access Step1 doTestStepL"));
       
    53 	SetTestStepResult(EFail);
       
    54 	
       
    55 	TBuf<256> txtReadData(KNull);
       
    56 	TRAPD(err,ReadSharedDataL(_L("SharedData"), txtReadData));
       
    57 	if (err == KErrNone)
       
    58 		{
       
    59 		INFO_PRINTF2(_L("Value of Shared Data in Access Step1 initially is %S"), &txtReadData);
       
    60 		_LIT(KDesVal, "Good Morning James! Good Morning Nataraj! Good Morning Bala! Good Morning Ganesh! Good Morning Sridhar! Good Morning Naresh! Good Morning Sanjeev! Good Morning Kathirvel!");
       
    61 		TPtrC txtPtr;
       
    62 		txtPtr.Set(KDesVal);
       
    63 		WriteSharedDataL(_L("SharedData"), txtPtr, ESetText);
       
    64 		txtReadData.Zero();
       
    65 		ReadSharedDataL(_L("SharedData"), txtReadData);
       
    66 		INFO_PRINTF2(_L("Value of Shared Data in Access Step1 updated is %S"), &txtReadData);
       
    67 		SetTestStepResult(EPass);
       
    68 		}
       
    69 	return TestStepResult();
       
    70 	}
       
    71 
       
    72 CAccessStep2::~CAccessStep2()
       
    73 /**
       
    74  * Destructor
       
    75  */
       
    76 	{
       
    77 	}
       
    78 
       
    79 CAccessStep2::CAccessStep2()
       
    80 /**
       
    81  * Constructor
       
    82  */
       
    83 	{
       
    84 	// Call base class method to set up the human readable name for logging
       
    85 	SetTestStepName(KAccessStep2);
       
    86 	}
       
    87 
       
    88 TVerdict CAccessStep2::doTestStepL()
       
    89 /**
       
    90  * @return - TVerdict code
       
    91  * Override of base class pure virtual
       
    92  * Demonstrates opening up a handle to the data saved at RChunk base using template class
       
    93  * Overwrite shared data with values and also demonstrates the locking mechanism
       
    94  */
       
    95 	{
       
    96 	INFO_PRINTF1(_L("Access Step2 doTestStepL"));
       
    97 	SetTestStepResult(EFail);
       
    98 	
       
    99 	TBuf<256> txtReadData(KNull);
       
   100 	TRAPD(err,ReadSharedDataL(_L("SharedData1"), txtReadData));
       
   101 	if (err == KErrNone)
       
   102 		{
       
   103 		INFO_PRINTF2(_L("Value of Shared Data1 in Access Step2 initially is %S"), &txtReadData);
       
   104 		_LIT(KDesVal, "Good Morning Ganesh!");
       
   105 		TPtrC txtPtr;
       
   106 		txtPtr.Set(KDesVal);
       
   107 		WriteSharedDataL(_L("SharedData1"), txtPtr, EAppendText);
       
   108 		txtReadData.Zero();
       
   109 		ReadSharedDataL(_L("SharedData1"), txtReadData);
       
   110 		INFO_PRINTF2(_L("Value of Shared Data1 in Access Step2 updated is %S"), &txtReadData);
       
   111 		SetTestStepResult(EPass);
       
   112 		}
       
   113 	return TestStepResult();
       
   114 	}