datasourcemodules/defaultpositioningmodule/test/te_defproxy/src/partialupdatestep.cpp
changeset 36 b47902b73a93
parent 0 9cfd9a3ee49c
child 45 15a2125aa2f3
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 PartialUpdateStep.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "PartialUpdateStep.h"
       
    23 #include "Te_defproxySuiteDefs.h"
       
    24 
       
    25 CPartialUpdateStep::~CPartialUpdateStep()
       
    26 /**
       
    27  * Destructor
       
    28  */
       
    29 	{
       
    30 	}
       
    31 
       
    32 CPartialUpdateStep::CPartialUpdateStep()
       
    33 /**
       
    34  * Constructor
       
    35  */
       
    36 	{
       
    37 	SetTestStepName(KPartialUpdateStep);
       
    38 	}
       
    39 
       
    40 TVerdict CPartialUpdateStep::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 CPartialUpdateStep::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, 
       
    62         KIntGpsPsy1, 1,  
       
    63         KExtGpsPsy1, 1, 
       
    64         KNetworkPsy2, 0);
       
    65         
       
    66     TRequestStatus status;
       
    67     TPositionInfo posInfo;
       
    68     TPositionUpdateOptions options;
       
    69     
       
    70     //1. IntGpsPsy always returns partial update, DP shall fallback to
       
    71     //ExtGpsPsy1 after timeshift value
       
    72     ConfigPsyL(KIntGpsPsy1, 1,
       
    73         KConfigLRPartial 
       
    74         );
       
    75     TTime startTime;
       
    76     startTime.UniversalTime();
       
    77     for(;;)
       
    78         {
       
    79         iPositioner.NotifyPositionUpdate(posInfo, status);
       
    80         User::WaitForRequest(status);
       
    81         TTime now;
       
    82         now.UniversalTime();
       
    83         TTimeIntervalSeconds interval;
       
    84         now.SecondsFrom(startTime,interval);
       
    85         if(posInfo.ModuleId()==KExtGpsPsy1)
       
    86             {
       
    87             if(interval.Int()<30)
       
    88                 {
       
    89                 //This can't be true since the external GPS PSY checking time is
       
    90                 //60 seconds
       
    91                 ERR_PRINTF2(KLocationRequestSucceededTooSoon, KErrCorrupt);
       
    92                 SetTestStepResult(EFail);
       
    93                 return TestStepResult();
       
    94                 }
       
    95             break;
       
    96             }
       
    97         if(interval.Int()>70)
       
    98             {
       
    99             //If the external GPS PSY is not used in 70 seconds the test failed
       
   100             ERR_PRINTF2(KLocationRequestStillNotCompleted, KErrGeneral);
       
   101             SetTestStepResult(EFail);
       
   102             return TestStepResult();
       
   103             }
       
   104         }
       
   105         
       
   106     //2. If PSY1 returns partial update location request to sencond PSY 
       
   107     //shall be canceled after cleanup timeout
       
   108     ConfigPsyL(KIntGpsPsy1, 3,
       
   109         KConfigStatusReady,
       
   110         KConfigLRPartial5s,
       
   111         KConfigLRPartial5s 
       
   112         );
       
   113 
       
   114     ConfigPsyL(KExtGpsPsy1, 2,
       
   115         KConfigLRNoError10s,
       
   116         KConfigLRNoError10s 
       
   117         );
       
   118     
       
   119     InitPsyListInDefaultProxyL();
       
   120     
       
   121     //The location request first made to PSY1. After 2 seconds, DP 
       
   122     //fallback to PSY2. 
       
   123     //the location request shall be completed from IntGpsPsy1
       
   124     PositionRequestWithCheck(posInfo, KPositionPartialUpdate, KIntGpsPsy1);
       
   125     
       
   126     //After 15 seconds make another location request.
       
   127     User::After(KSecond * 15);
       
   128     
       
   129     //It shall still be partial from the PSY1. 
       
   130     PositionRequestWithCheck(posInfo, KPositionPartialUpdate, KIntGpsPsy1);
       
   131     
       
   132     //3. If PSY2 give a fix before cleanup timeout, it shall be moved to 
       
   133     //the front of the list
       
   134     ConfigPsyL(KIntGpsPsy1, 2,
       
   135         KConfigLRPartial5s,
       
   136         KConfigLRPartial5s 
       
   137         );
       
   138 
       
   139     ConfigPsyL(KExtGpsPsy1, 1,
       
   140         KConfigLRNoError5s
       
   141         );
       
   142         
       
   143     User::After(KSecond * 7);
       
   144         
       
   145     InitPsyListInDefaultProxyL();
       
   146     
       
   147     PositionRequestWithCheck(posInfo, KPositionPartialUpdate, KIntGpsPsy1);
       
   148     
       
   149     User::After(KSecond * 3);//2s fallback, 5s PSY1 partial, 7s PSY2 fix, 10s cleanup timeout
       
   150 
       
   151     PositionRequestWithCheck(posInfo, KErrNone, KExtGpsPsy1);
       
   152     
       
   153     User::After(KSecond * 5);
       
   154     PositionRequestWithCheck(posInfo, KErrNone, KExtGpsPsy1);
       
   155     
       
   156     //4. If PSY2 gives a fullfix before cleanup timeout and there is location request 
       
   157     //pending, this fix will be given to the client
       
   158     ConfigPsyL(KIntGpsPsy1, 2,
       
   159         KConfigLRPartial5s,
       
   160         KConfigLRPartial5s 
       
   161         );
       
   162 
       
   163     ConfigPsyL(KExtGpsPsy1, 1,
       
   164         KConfigLRNoError5s
       
   165         );
       
   166     
       
   167     User::After(KSecond * 7);
       
   168     InitPsyListInDefaultProxyL();
       
   169     
       
   170     PositionRequestWithCheck(posInfo, KPositionPartialUpdate, KIntGpsPsy1);
       
   171     
       
   172     User::After(KSecond * 1);//2s fallback, 5s PSY1 partial, 7s PSY2 fix, 10s cleanup timeout
       
   173 
       
   174     SET_TIME
       
   175     PositionRequestWithCheck(posInfo, KErrNone, KExtGpsPsy1);
       
   176     CHECK_TIME(1)
       
   177     
       
   178     User::After(KSecond * 5);
       
   179     PositionRequestWithCheck(posInfo, KErrNone, KExtGpsPsy1);
       
   180     
       
   181     // cleanup
       
   182     StandardCleanup();
       
   183     return TestStepResult();
       
   184 	}
       
   185 
       
   186 
       
   187 
       
   188 TVerdict CPartialUpdateStep::doTestStepPostambleL()
       
   189 /**
       
   190  * @return - TVerdict code
       
   191  * Override of base class virtual
       
   192  */
       
   193 	{
       
   194 	CTe_defproxySuiteStepBase::doTestStepPostambleL();
       
   195 	return TestStepResult();
       
   196 	}