datasourcemodules/defaultpositioningmodule/test/te_defproxy/src/threepsysstep.cpp
changeset 36 b47902b73a93
parent 0 9cfd9a3ee49c
equal deleted inserted replaced
35:a2efdd544abf 36:b47902b73a93
       
     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 ThreePsysStep.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "ThreePsysStep.h"
       
    23 #include "Te_defproxySuiteDefs.h"
       
    24 
       
    25 CThreePsysStep::~CThreePsysStep()
       
    26 /**
       
    27  * Destructor
       
    28  */
       
    29 	{
       
    30 	}
       
    31 
       
    32 CThreePsysStep::CThreePsysStep()
       
    33 /**
       
    34  * Constructor
       
    35  */
       
    36 	{
       
    37 	SetTestStepName(KThreePsysStep);
       
    38 	}
       
    39 
       
    40 TVerdict CThreePsysStep::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 CThreePsysStep::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     StandardPrepareL();
       
    61     InitPsySettingsL(3, KNetworkPsy1, 1, KIntGpsPsy1, 1, KNetworkPsy2, 1);
       
    62 
       
    63     ConfigPsyL(KNetworkPsy1, 8,
       
    64         KConfigLRNoError,        //Step1. no error
       
    65         KConfigLRErrNoMemory,    //Step2. KErrNoMemory in 1s
       
    66         KConfigLRErrNoMemory,    //Step3. KErrNoMemory in 1s
       
    67         KConfigLRErrNoMemory,    //Step4. KErrNoMemory in 1s
       
    68         KConfigLRNoError20s,     //Step5. no error in 20 seconds
       
    69         KConfigLRNoError45s,     //Step6. no error in 45 seconds
       
    70         KConfigLRNoError45s,     //Step7. no error in 45 seconds
       
    71         KConfigLRNoError35s      //Step8. no error in 35 seconds
       
    72         );
       
    73         
       
    74     ConfigPsyL(KIntGpsPsy1, 7, 
       
    75         KConfigLRNoError,       //Step 2. no error
       
    76         KConfigLRErrGeneral1s,  //Step 3. KErrGeneral in 1s
       
    77         KConfigLRErrGeneral1s,  //Step 4. KErrGeneral in 1s
       
    78         KConfigLRNoError,       //Step 5. no error
       
    79         KConfigLRNoError35s,    //Step 6. no error
       
    80         KConfigLRNoError32s,    //Step 7. no error
       
    81         KConfigLRErrGeneral1s   //Step 8. KErrGeneral in 1s
       
    82         );
       
    83 
       
    84     ConfigPsyL(KNetworkPsy2, 5,
       
    85         KConfigLRNoError,        //Step3. no error
       
    86         KConfigLRErrGeneral1s,   //Step4. KErrGeneral in 1s
       
    87         KConfigLRNoError,        //Step6. no error
       
    88         KConfigLRNoError10s,     //Step7. no error in 10s
       
    89         KConfigLRNoError35s      //Step7. no error in 35s
       
    90         );
       
    91 
       
    92     User::After(KSecond*7); //Delay is needed after every time PSY is configured.
       
    93     
       
    94     TRequestStatus status;
       
    95     TPositionInfo posInfo;
       
    96     TPositionUpdateOptions options;
       
    97     
       
    98     //1. When PSY1 is able to give a fix. Make location request, 
       
    99     //it shall be completed from IntGpsPsy1
       
   100     SET_TIME
       
   101     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1);
       
   102     CHECK_TIME(1)
       
   103     
       
   104     //2. PSY1: error code. PSY2 is used
       
   105     PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1);
       
   106     CHECK_TIME(2)
       
   107     
       
   108     User::After(KSecond*7);
       
   109         
       
   110     //3. PSY1: error. PSY2 error. PSY3 is used.
       
   111     SET_TIME
       
   112     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy2);
       
   113     CHECK_TIME(3)
       
   114     
       
   115     User::After(KSecond*7);
       
   116 
       
   117     //4. All PSY returns error code, error from PSY1 is used.
       
   118     SET_TIME
       
   119     iPositioner.NotifyPositionUpdate(posInfo,status);
       
   120     User::WaitForRequest(status);
       
   121     CheckExpectedResult(status.Int(), KErrNoMemory, KWrongRequestResult);
       
   122     CHECK_TIME(3)
       
   123 
       
   124     User::After(KSecond*7);
       
   125     
       
   126     //5. PSY1 does not response, PSY2 is used
       
   127     SET_TIME
       
   128     PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1);
       
   129     CHECK_TIME(13) //timeshift for network1 is 12, PSY2 response time is 1s
       
   130     
       
   131     User::After(KSecond*7);
       
   132     
       
   133     //6. PSY1, PSY2 does not response, PSY3 is used
       
   134     SET_TIME
       
   135     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy2);
       
   136     CHECK_TIME(12+30+1) //timeshift network1: 12, IntGpsPsy1:30, Network2 response 1
       
   137     
       
   138     User::After(KSecond*7);
       
   139     
       
   140     //7 PS1, PSY2 PSY3 does not response, then PSY2 returns a fix. Fix from
       
   141     //PSY2 will be used.
       
   142     SET_TIME
       
   143     PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1);
       
   144     CHECK_TIME(12+32) //timeshift network1: 12, IntGpsPsy1 response:32
       
   145     
       
   146     User::After(KSecond*7);
       
   147 
       
   148     //8 PSY1 does not response, PSY2 error code, PSY3 does not response. 
       
   149     //After a whiel fix from PSY1 is receivd, the this fix is used.
       
   150     SET_TIME
       
   151     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1);
       
   152     CHECK_TIME(35) //PSY1 response time: 35s
       
   153     
       
   154     StandardCleanup();
       
   155     return TestStepResult();
       
   156 	}
       
   157 
       
   158 
       
   159 
       
   160 TVerdict CThreePsysStep::doTestStepPostambleL()
       
   161 /**
       
   162  * @return - TVerdict code
       
   163  * Override of base class virtual
       
   164  */
       
   165 	{
       
   166 	CTe_defproxySuiteStepBase::doTestStepPostambleL();
       
   167 	return TestStepResult();
       
   168 	}