datasourcemodules/defaultpositioningmodule/test/te_defproxy/src/oomstep.cpp
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Example CTestStep derived implementation
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file OOMStep.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "OOMStep.h"
       
    23 #include "Te_defproxySuiteDefs.h"
       
    24 
       
    25 COOMStep::~COOMStep()
       
    26 /**
       
    27  * Destructor
       
    28  */
       
    29 	{
       
    30 	}
       
    31 
       
    32 COOMStep::COOMStep()
       
    33 /**
       
    34  * Constructor
       
    35  */
       
    36 	{
       
    37 	SetTestStepName(KOOMStep);
       
    38 	}
       
    39 
       
    40 TVerdict COOMStep::doTestStepPreambleL()
       
    41 /**
       
    42  * @return - TVerdict code
       
    43  * Override of base class virtual
       
    44  */
       
    45 	{
       
    46 	CTe_defproxySuiteStepBase::doTestStepPreambleL();
       
    47 	SetTestStepResult(EPass);
       
    48 	return TestStepResult();
       
    49 	}
       
    50 
       
    51 
       
    52 TVerdict COOMStep::doTestStepL()
       
    53 /**
       
    54  * @return - TVerdict code
       
    55  * Override of base class pure virtual
       
    56  * Our implementation only gets called if the base class doTestStepPreambleL() did
       
    57  * not leave. That being the case, the current test result value will be EPass.
       
    58  */
       
    59 	{
       
    60     //Init time
       
    61     iTime1.UniversalTime();
       
    62     iTime2.UniversalTime();
       
    63     
       
    64     iModulesSettings = CPosModules::OpenL();
       
    65     
       
    66     InitPsySettingsL(2, 
       
    67         KIntGpsPsy1, 1,  
       
    68         KNetworkPsy2, 1);
       
    69 
       
    70     for(TInt i=0; i<60; i++)
       
    71         {
       
    72         //Set failrate
       
    73         RFs fs;
       
    74         User::LeaveIfError(fs.Connect());
       
    75         CleanupClosePushL(fs);
       
    76         RFile file;
       
    77         User::LeaveIfError(file.Replace(fs, KOOMTextPath, EFileWrite));
       
    78         CleanupClosePushL(file);
       
    79         TFileText fileText;
       
    80         fileText.Set(file);
       
    81         TBuf<32> frbuf;
       
    82         frbuf.AppendNum(i);
       
    83         fileText.Write(frbuf);
       
    84         CleanupStack::PopAndDestroy(2,&fs);
       
    85 
       
    86         TRAPD(err, MakeLRL());
       
    87         if(KErrNone == err)
       
    88             {
       
    89             INFO_PRINTF2(KErrorCode,err);
       
    90             }
       
    91         else
       
    92             {
       
    93             ERR_PRINTF2(KErrorCode,err);
       
    94             SetTestStepResult(EFail);
       
    95             }
       
    96         }
       
    97     return TestStepResult();
       
    98 	}
       
    99 
       
   100 void COOMStep::MakeLRL()
       
   101     {
       
   102     User::LeaveIfError(iServer.Connect());
       
   103     CleanupClosePushL(iServer);
       
   104     User::LeaveIfError(iPositioner.Open(iServer));
       
   105     CleanupClosePushL(iPositioner);
       
   106     User::LeaveIfError(iPositioner.SetRequestor( 
       
   107             CRequestor::ERequestorService,       
       
   108             CRequestor::EFormatApplication,      
       
   109             KTdDefProxyTestName));               
       
   110     TPositionInfo posInfo;
       
   111     TRequestStatus status;
       
   112     iPositioner.NotifyPositionUpdate(posInfo,status);
       
   113     User::WaitForRequest(status);
       
   114     User::LeaveIfError(status.Int());
       
   115     TPositionSatelliteInfo satInfo;
       
   116     iPositioner.NotifyPositionUpdate(satInfo,status);
       
   117     User::WaitForRequest(status);
       
   118     User::LeaveIfError(status.Int());
       
   119 
       
   120     CleanupStack::PopAndDestroy(2, &iServer);
       
   121     User::After(KSecond*3);
       
   122     }
       
   123 
       
   124 
       
   125 TVerdict COOMStep::doTestStepPostambleL()
       
   126 /**
       
   127  * @return - TVerdict code
       
   128  * Override of base class virtual
       
   129  */
       
   130 	{
       
   131 	CTe_defproxySuiteStepBase::doTestStepPostambleL();
       
   132 	return TestStepResult();
       
   133 	}