datasourcemodules/defaultpositioningmodule/test/te_defproxy/src/twopsysstep.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 TwoPsysStep.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "TwoPsysStep.h"
       
    23 #include "Te_defproxySuiteDefs.h"
       
    24 
       
    25 CTwoPsysStep::~CTwoPsysStep()
       
    26 /**
       
    27  * Destructor
       
    28  */
       
    29 	{
       
    30 	}
       
    31 
       
    32 CTwoPsysStep::CTwoPsysStep()
       
    33 /**
       
    34  * Constructor
       
    35  */
       
    36 	{
       
    37 	SetTestStepName(KTwoPsysStep);
       
    38 	}
       
    39 
       
    40 TVerdict CTwoPsysStep::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 CTwoPsysStep::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(2, KIntGpsPsy1, 1, KNetworkPsy1, 1);
       
    62 
       
    63     ConfigPsyL(KIntGpsPsy1, 7, 
       
    64         KConfigLRNoError,       //Step 1. no error
       
    65         KConfigLRErrGeneral1s,  //Step 2. KErrGeneral
       
    66         KConfigLRNoError35s,    //Step 3. no error in 35s
       
    67         KConfigLRErrGeneral1s,  //Step 4. KErrGeneral in 1 seconds
       
    68         KConfigLRNoError35s,    //Step 5. no error in 35s
       
    69         KConfigLRNoError35s,    //Step 6. no error in 35s
       
    70         KConfigLRErrGeneral35s  //Step 7. KErrGeneral in 35s.
       
    71         );
       
    72 
       
    73     ConfigPsyL(KNetworkPsy1, 6, 
       
    74         KConfigLRNoError,        //Step2. no error
       
    75         KConfigLRNoError,        //Step3. no error
       
    76         KConfigLRErrNoMemory,    //Step4. KErrNoMemory in 1 seconds
       
    77         KConfigLRNoError35s,     //Step5. no error in 35 seconds
       
    78         KConfigLRErrNoMemory,    //Step6. KErrNoMemory in 1 seconds
       
    79         KConfigLRNoError10s      //Step7. no error in 35s
       
    80         );
       
    81         
       
    82     User::After(KSecond*7); //Delay is needed after every time PSY is configured.
       
    83     
       
    84     TRequestStatus status;
       
    85     TPositionInfo posInfo;
       
    86     TPositionUpdateOptions options;
       
    87     
       
    88     //1. When PSY1 is able to give a fix. Make location request, 
       
    89     //it shall be completed from IntGpsPsy1
       
    90     SET_TIME
       
    91     PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1);
       
    92     CHECK_TIME(1)
       
    93     
       
    94     //2. When PSY1 returns a error code, PSY2 shall return KErrNone
       
    95     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1);
       
    96     CHECK_TIME(2)
       
    97     
       
    98     //Reset the priority of default proxy. Delay shall be used every time
       
    99     //PSY1 gives a error code
       
   100     User::After(KSecond*7); 
       
   101     
       
   102     //3. When PSY1 does not response anything within timeshift, PSY2 shall
       
   103     //return KErrNone
       
   104     SET_TIME
       
   105     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1);
       
   106     CHECK_TIME(31) //30 is the timeshift value min(TTFF(80), 30)
       
   107 
       
   108     User::After(KSecond*7); 
       
   109 
       
   110     //4. When both PSY returns error code, the error code from the
       
   111     //first PSY be returned
       
   112     //If the completion code is not KErrNone or KPositionPartialUpdate,
       
   113     //Location Server will not return module ID.
       
   114     SET_TIME
       
   115     iPositioner.NotifyPositionUpdate(posInfo,status);
       
   116     User::WaitForRequest(status);
       
   117     CheckExpectedResult(status.Int(), KErrGeneral, KWrongRequestResult);
       
   118     CHECK_TIME(2)
       
   119     
       
   120     //Reset the priority of default proxy. Delay shall be used every time
       
   121     //PSY1 gives error code
       
   122     User::After(KSecond*7); 
       
   123     
       
   124     //5. PSY1 does not give a fix within timeshift, PSY2 is tried. Before PSY2
       
   125     //returns a fix, PSY gives a fix, then fix from PSY1 shall be used.
       
   126     SET_TIME
       
   127     PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1);
       
   128     CHECK_TIME(35)
       
   129     
       
   130     //6. PSY1 does not give a fix within timeshift, PSY2 is tried. But PSY2 failed
       
   131     //to give a fix, default proxy will wait until PSY1 give a fix
       
   132     PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1);
       
   133     CHECK_TIME(35)
       
   134     
       
   135     //7. PSY1 does not give a fix within timeshift, PSY2 is tried. If PSY1 then 
       
   136     //give a error code, then fix from PSY2 will be used.
       
   137     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1);
       
   138     CHECK_TIME(40)
       
   139     
       
   140     
       
   141     StandardCleanup();
       
   142     return TestStepResult();
       
   143 	}
       
   144 
       
   145 
       
   146 
       
   147 TVerdict CTwoPsysStep::doTestStepPostambleL()
       
   148 /**
       
   149  * @return - TVerdict code
       
   150  * Override of base class virtual
       
   151  */
       
   152 	{
       
   153 	CTe_defproxySuiteStepBase::doTestStepPostambleL();
       
   154 	return TestStepResult();
       
   155 	}