os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-server/uloggerservertest6step.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-server/uloggerservertest6step.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,127 @@
     1.4 +// Copyright (c) 2007-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 +//
    1.18 +
    1.19 +/**
    1.20 + @file UloggerServerTest6Step.cpp
    1.21 + @internalTechnology
    1.22 +*/
    1.23 +#include "uloggerservertest6step.h"
    1.24 +#include "te_uloggerservertestsuitedefs.h"
    1.25 +
    1.26 +
    1.27 +namespace Ulogger
    1.28 +{
    1.29 +
    1.30 +CUloggerServerTest6Step::~CUloggerServerTest6Step()
    1.31 +/**
    1.32 + * Destructor
    1.33 + */
    1.34 +	{
    1.35 +	
    1.36 +	}
    1.37 +
    1.38 +CUloggerServerTest6Step::CUloggerServerTest6Step()
    1.39 +/**
    1.40 + * Constructor
    1.41 + */
    1.42 +	{
    1.43 +	SetTestStepName(KUloggerServerTest6Step);
    1.44 +	}
    1.45 +
    1.46 +TVerdict CUloggerServerTest6Step::doTestStepPreambleL()
    1.47 +/**
    1.48 + * @return - TVerdict code
    1.49 + * Override of base class virtual
    1.50 + */
    1.51 +	{
    1.52 +	INFO_PRINTF1(_L("****This is unit test for ControlDataManager class****"));	
    1.53 +	iScheduler = new (ELeave) CActiveScheduler();
    1.54 +	CActiveScheduler::Install(iScheduler);
    1.55 +	
    1.56 +	iMan = new CInputData();
    1.57 +	if(!iMan)
    1.58 +		SetTestStepResult(EFail);
    1.59 +
    1.60 +	SetTestStepResult(EPass);
    1.61 +	return TestStepResult();
    1.62 +	}
    1.63 +
    1.64 +
    1.65 +TVerdict CUloggerServerTest6Step::doTestStepL()
    1.66 +/**
    1.67 + * @return - TVerdict code
    1.68 + * Override of base class pure virtual
    1.69 + * Our implementation only gets called if the base class doTestStepPreambleL() did
    1.70 + * not leave. That being the case, the current test result value will be EPass.
    1.71 + */
    1.72 +	{
    1.73 +	  if (TestStepResult()==EPass)
    1.74 +	  {
    1.75 +	  TBuf8<32> cmdDes;
    1.76 +	  cmdDes.Copy(_L8("set f1"));
    1.77 +	  ControlData* cData = iMan->CreatePackage((void*)cmdDes.Ptr(), cmdDes.Length());
    1.78 +	  if(!cData)
    1.79 +		  {
    1.80 +		  INFO_PRINTF1(_L("error"));	
    1.81 +		  SetTestStepResult(EFail);
    1.82 +		  }
    1.83 +	  
    1.84 +	  TBuf8<32> cmdDes3;
    1.85 +	  cmdDes3.Num(4);
    1.86 +	  iMan->AppendNewData(cData, (const void*)cmdDes3.Ptr(), cmdDes3.Length());
    1.87 +	  TInt chunks = iMan->GetChunksCount(cData);
    1.88 +	  if(chunks != 3)
    1.89 +		  {
    1.90 +		  INFO_PRINTF1(_L("error"));	
    1.91 +		  SetTestStepResult(EFail);
    1.92 +		  }
    1.93 +	  
    1.94 +	  //test method
    1.95 +	  TInt size = iMan->GetSize(cData);
    1.96 +	  
    1.97 +	  unsigned long cSize;
    1.98 +	  const void* _cmd3 = iMan->GetChunk(cData, 2, cSize);
    1.99 +	  TPtrC8 cmd3((const unsigned char*)_cmd3, cSize);
   1.100 +	  if(cmd3.Compare(cmdDes3) != 0)
   1.101 +		  {
   1.102 +		  INFO_PRINTF1(_L("error"));	
   1.103 +		  SetTestStepResult(EFail);
   1.104 +		  }
   1.105 +
   1.106 +	  delete [] cData;
   1.107 +	  if(TestStepResult()!=EFail)
   1.108 +		  SetTestStepResult(EPass);
   1.109 +	  }
   1.110 +	  
   1.111 +	  return TestStepResult();
   1.112 +	}
   1.113 +
   1.114 +
   1.115 +
   1.116 +TVerdict CUloggerServerTest6Step::doTestStepPostambleL()
   1.117 +/**
   1.118 + * @return - TVerdict code
   1.119 + * Override of base class virtual
   1.120 + */
   1.121 +	{
   1.122 +	delete iScheduler;
   1.123 +	iScheduler = NULL;
   1.124 +	
   1.125 +	delete iMan;
   1.126 +	iMan = NULL;
   1.127 +	
   1.128 +	return TestStepResult();
   1.129 +	}
   1.130 +}