datasourcemodules/defaultpositioningmodule/test/te_defproxy/src/twopsysactivestep.cpp
changeset 0 9cfd9a3ee49c
child 45 15a2125aa2f3
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 TwoPsysActiveStep.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "TwoPsysActiveStep.h"
       
    23 #include "Te_defproxySuiteDefs.h"
       
    24 
       
    25 CTwoPsysActiveStep::~CTwoPsysActiveStep()
       
    26 /**
       
    27  * Destructor
       
    28  */
       
    29 	{
       
    30 	}
       
    31 
       
    32 CTwoPsysActiveStep::CTwoPsysActiveStep()
       
    33 /**
       
    34  * Constructor
       
    35  */
       
    36 	{
       
    37 	SetTestStepName(KTwoPsysActiveStep);
       
    38 	}
       
    39 
       
    40 TVerdict CTwoPsysActiveStep::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 CTwoPsysActiveStep::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, 8,
       
    64         KConfigStatusReady,     //Step 0. Set device status Ready 
       
    65         KConfigLRNoError,       //Step 1. no error
       
    66         KConfigLRErrGeneral1s,  //Step 2. KErrGeneral
       
    67         KConfigLRNoError35s,    //Step 3. no error in 35s
       
    68         KConfigLRErrGeneral1s,  //Step 4. KErrGeneral in 1 seconds
       
    69         KConfigLRNoError5s,    //Step 5. no error in 35s
       
    70         KConfigLRNoError5s,    //Step 6. no error in 35s
       
    71         KConfigLRErrGeneral5s  //Step 7. KErrGeneral in 35s.
       
    72         );
       
    73 
       
    74     ConfigPsyL(KNetworkPsy1, 6, 
       
    75         KConfigLRNoError,        //Step2. no error
       
    76         KConfigLRNoError,        //Step3. no error
       
    77         KConfigLRErrNoMemory,    //Step4. KErrNoMemory in 1 seconds
       
    78         KConfigLRNoError35s,     //Step5. no error in 35 seconds
       
    79         KConfigLRErrNoMemory,    //Step6. KErrNoMemory in 1 seconds
       
    80         KConfigLRNoError10s      //Step7. no error in 35s
       
    81         );
       
    82         
       
    83     User::After(KSecond*7); //Delay is needed after every time PSY is configured.
       
    84     
       
    85     TRequestStatus status;
       
    86     TPositionInfo posInfo;
       
    87     TPositionUpdateOptions options;
       
    88     
       
    89     //1. When PSY1 is able to give a fix. Make location request, 
       
    90     //it shall be completed from IntGpsPsy1
       
    91     SET_TIME
       
    92     PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1);
       
    93     CHECK_TIME(1)
       
    94     
       
    95     //2. When PSY1 returns a error code, PSY2 shall return KErrNone
       
    96     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1);
       
    97     CHECK_TIME(2)
       
    98     
       
    99     //Reset the priority of default proxy. Delay shall be used every time
       
   100     //PSY1 gives a error code
       
   101     User::After(KSecond*7); 
       
   102     
       
   103     //3. When PSY1 does not response anything within timeshift, PSY2 shall
       
   104     //return KErrNone
       
   105     SET_TIME
       
   106     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1);
       
   107     CHECK_TIME(3) //2s is timeshfift value min(2*TTFF(1),10)+1
       
   108 
       
   109     User::After(KSecond*7); 
       
   110     
       
   111     //4. When both PSY returns error code, the error code from the
       
   112     //first PSY be returned
       
   113     //If the completion code is not KErrNone or KPositionPartialUpdate,
       
   114     //Location Server will not return module ID.
       
   115     SET_TIME
       
   116     iPositioner.NotifyPositionUpdate(posInfo,status);
       
   117     User::WaitForRequest(status);
       
   118     CheckExpectedResult(status.Int(), KErrGeneral, KWrongRequestResult);
       
   119     CHECK_TIME(2)
       
   120     
       
   121     //Reset the priority of default proxy. Delay shall be used every time
       
   122     //PSY1 gives error code
       
   123     User::After(KSecond*7); 
       
   124     
       
   125     //5. PSY1 does not give a fix within timeshift, PSY2 is tried. Before PSY2
       
   126     //returns a fix, PSY1 gives a fix, then fix from PSY1 shall be used.
       
   127     SET_TIME
       
   128     PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1);
       
   129     CHECK_TIME(5)
       
   130     
       
   131     //6. PSY1 does not give a fix within timeshift, PSY2 is tried. But PSY2 failed
       
   132     //to give a fix, default proxy will wait until PSY1 give a fix
       
   133     PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1);
       
   134     CHECK_TIME(5)
       
   135     
       
   136     //7. PSY1 does not give a fix within timeshift, PSY2 is tried. If PSY1 then 
       
   137     //give a error code, then fix from PSY2 will be used.
       
   138     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1);
       
   139     CHECK_TIME(12) //Timeshift time 2s + response time 10s
       
   140     
       
   141     //Do everhing again when device status is Active
       
   142     
       
   143     ConfigPsyL(KIntGpsPsy1, 8,
       
   144         KConfigStatusActive,     //Step 0. Set device status Ready 
       
   145         KConfigLRNoError,       //Step 1. no error
       
   146         KConfigLRErrGeneral1s,  //Step 2. KErrGeneral
       
   147         KConfigLRNoError35s,    //Step 3. no error in 35s
       
   148         KConfigLRErrGeneral1s,  //Step 4. KErrGeneral in 1 seconds
       
   149         KConfigLRNoError5s,    //Step 5. no error in 35s
       
   150         KConfigLRNoError5s,    //Step 6. no error in 35s
       
   151         KConfigLRErrGeneral5s  //Step 7. KErrGeneral in 35s.
       
   152         );
       
   153 
       
   154     ConfigPsyL(KNetworkPsy1, 6, 
       
   155         KConfigLRNoError,        //Step2. no error
       
   156         KConfigLRNoError,        //Step3. no error
       
   157         KConfigLRErrNoMemory,    //Step4. KErrNoMemory in 1 seconds
       
   158         KConfigLRNoError35s,     //Step5. no error in 35 seconds
       
   159         KConfigLRErrNoMemory,    //Step6. KErrNoMemory in 1 seconds
       
   160         KConfigLRNoError10s      //Step7. no error in 35s
       
   161         );
       
   162         
       
   163     User::After(KSecond*7); //Delay is needed after every time PSY is configured.
       
   164     
       
   165     //1. When PSY1 is able to give a fix. Make location request, 
       
   166     //it shall be completed from IntGpsPsy1
       
   167     SET_TIME
       
   168     PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1);
       
   169     CHECK_TIME(1)
       
   170     
       
   171     //2. When PSY1 returns a error code, PSY2 shall return KErrNone
       
   172     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1);
       
   173     CHECK_TIME(2)
       
   174     
       
   175     //Reset the priority of default proxy. Delay shall be used every time
       
   176     //PSY1 gives a error code
       
   177     User::After(KSecond*7); 
       
   178     
       
   179     //3. When PSY1 does not response anything within timeshift, PSY2 shall
       
   180     //return KErrNone
       
   181     SET_TIME
       
   182     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1);
       
   183     CHECK_TIME(3) //2s is timeshfift value min(2*TTFF(1),10)+1
       
   184 
       
   185     User::After(KSecond*7); 
       
   186     
       
   187     //4. When both PSY returns error code, the error code from the
       
   188     //first PSY be returned
       
   189     //If the completion code is not KErrNone or KPositionPartialUpdate,
       
   190     //Location Server will not return module ID.
       
   191     SET_TIME
       
   192     iPositioner.NotifyPositionUpdate(posInfo,status);
       
   193     User::WaitForRequest(status);
       
   194     CheckExpectedResult(status.Int(), KErrGeneral, KWrongRequestResult);
       
   195     CHECK_TIME(2)
       
   196     
       
   197     //Reset the priority of default proxy. Delay shall be used every time
       
   198     //PSY1 gives error code
       
   199     User::After(KSecond*7); 
       
   200     
       
   201     //5. PSY1 does not give a fix within timeshift, PSY2 is tried. Before PSY2
       
   202     //returns a fix, PSY1 gives a fix, then fix from PSY1 shall be used.
       
   203     SET_TIME
       
   204     PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1);
       
   205     CHECK_TIME(5)
       
   206     
       
   207     //6. PSY1 does not give a fix within timeshift, PSY2 is tried. But PSY2 failed
       
   208     //to give a fix, default proxy will wait until PSY1 give a fix
       
   209     PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1);
       
   210     CHECK_TIME(5)
       
   211     
       
   212     //7. PSY1 does not give a fix within timeshift, PSY2 is tried. If PSY1 then 
       
   213     //give a error code, then fix from PSY2 will be used.
       
   214     PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1);
       
   215     CHECK_TIME(12) //Timeshift time 2s + response time 10s
       
   216     
       
   217     StandardCleanup();
       
   218     return TestStepResult();
       
   219 	}
       
   220 
       
   221 
       
   222 
       
   223 TVerdict CTwoPsysActiveStep::doTestStepPostambleL()
       
   224 /**
       
   225  * @return - TVerdict code
       
   226  * Override of base class virtual
       
   227  */
       
   228 	{
       
   229 	CTe_defproxySuiteStepBase::doTestStepPostambleL();
       
   230 	return TestStepResult();
       
   231 	}