datasourcemodules/defaultpositioningmodule/test/te_defproxy/src/psyenabledstep.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 PsyEnabledStep.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "PsyEnabledStep.h"
       
    23 #include "Te_defproxySuiteDefs.h"
       
    24 
       
    25 CPsyEnabledStep::~CPsyEnabledStep()
       
    26 /**
       
    27  * Destructor
       
    28  */
       
    29 	{
       
    30 	}
       
    31 
       
    32 CPsyEnabledStep::CPsyEnabledStep()
       
    33 /**
       
    34  * Constructor
       
    35  */
       
    36 	{
       
    37 	SetTestStepName(KPsyEnabledStep);
       
    38 	}
       
    39 
       
    40 TVerdict CPsyEnabledStep::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 CPsyEnabledStep::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, 0, KIntGpsPsy1, 1, KNetworkPsy2, 1);
       
    62 
       
    63     ConfigPsyL(KIntGpsPsy1, 3, 
       
    64         KConfigLRNoError5s,        //Step 1. no error in 5s
       
    65         KConfigLRErrGeneral1s,     //Step 2. error in 1s
       
    66         KConfigLRErrGeneral1s      //Step 3. error in 1s
       
    67         );
       
    68 
       
    69     User::After(KSecond*7);
       
    70 
       
    71     TRequestStatus status;
       
    72     TPositionInfo posInfo;
       
    73     TPositionUpdateOptions options;
       
    74     
       
    75     //1. Enable PSY1 shall not affect location request
       
    76     SET_TIME
       
    77     iPositioner.NotifyPositionUpdate(posInfo, status);
       
    78     User::After(KTinyDelay);
       
    79     ToggleModuleL(KNetworkPsy1, ETrue);
       
    80     User::WaitForRequest(status);
       
    81     CHECK_TIME(5)
       
    82     CheckExpectedResult(status.Int(), KErrNone, KFailedPositionRequest);
       
    83     CheckExpectedResult(posInfo.ModuleId(), KIntGpsPsy1, KWrongModuleIdReturned);
       
    84     
       
    85 
       
    86     ToggleModuleL(KNetworkPsy2, EFalse);
       
    87     
       
    88     ConfigPsyL(KNetworkPsy1, 2,
       
    89         KConfigLRNoError35s,      //Step2. no error in 35s
       
    90         KConfigLRErrNoMemory      //Step 3. error in 1s
       
    91         );
       
    92 
       
    93     User::After(KSecond*7);
       
    94 
       
    95     //2. Enable PSY3 during fallback shall has no effect 
       
    96     SET_TIME
       
    97     iPositioner.NotifyPositionUpdate(posInfo, status);
       
    98     User::After(KSecond*5);
       
    99     ToggleModuleL(KNetworkPsy2, ETrue);
       
   100     User::WaitForRequest(status);
       
   101     CHECK_TIME(35)  //PSY1 response time
       
   102     CheckExpectedResult(status.Int(), KErrNone, KFailedPositionRequest);
       
   103     CheckExpectedResult(posInfo.ModuleId(), KNetworkPsy1, KWrongModuleIdReturned);
       
   104     
       
   105     //3. Enabled PSY3 shall be used in next LR
       
   106     SET_TIME
       
   107     iPositioner.NotifyPositionUpdate(posInfo, status);
       
   108     User::WaitForRequest(status);
       
   109     CHECK_TIME(2)  //PSY1 and PSY2 response time
       
   110     CheckExpectedResult(status.Int(), KErrNone, KFailedPositionRequest);
       
   111     CheckExpectedResult(posInfo.ModuleId(), KNetworkPsy2, KWrongModuleIdReturned);
       
   112     
       
   113     // cleanup
       
   114     StandardCleanup();
       
   115     return TestStepResult();
       
   116 	}
       
   117 
       
   118 
       
   119 
       
   120 TVerdict CPsyEnabledStep::doTestStepPostambleL()
       
   121 /**
       
   122  * @return - TVerdict code
       
   123  * Override of base class virtual
       
   124  */
       
   125 	{
       
   126 	CTe_defproxySuiteStepBase::doTestStepPostambleL();
       
   127 	return TestStepResult();
       
   128 	}