datasourcemodules/defaultpositioningmodule/test/te_defproxy/src/psydisabledstep.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 PsyDisabledStep.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "PsyDisabledStep.h"
       
    23 #include "Te_defproxySuiteDefs.h"
       
    24 
       
    25 CPsyDisabledStep::~CPsyDisabledStep()
       
    26 /**
       
    27  * Destructor
       
    28  */
       
    29 	{
       
    30 	}
       
    31 
       
    32 CPsyDisabledStep::CPsyDisabledStep()
       
    33 /**
       
    34  * Constructor
       
    35  */
       
    36 	{
       
    37 	SetTestStepName(KPsyDisabledStep);
       
    38 	}
       
    39 
       
    40 TVerdict CPsyDisabledStep::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 CPsyDisabledStep::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, 1,
       
    64         KConfigLRNoError10s      //Step1. no error in 10s
       
    65         );
       
    66         
       
    67     ConfigPsyL(KIntGpsPsy1, 2, 
       
    68         KConfigLRNoError,       //Step 1. no error
       
    69         KConfigLRNoError10s     //Step 2. no error in 10s
       
    70         );
       
    71 
       
    72     ConfigPsyL(KNetworkPsy2, 1,
       
    73         KConfigLRNoError         //Step2. no error
       
    74         );
       
    75     
       
    76     User::After(KSecond*7);
       
    77 
       
    78     TRequestStatus status;
       
    79     TPositionInfo posInfo;
       
    80     TPositionUpdateOptions options;
       
    81     
       
    82     //1. Disable PSY1 while location request is on going. LR shall 
       
    83     //fallback to PSY2 and then fix from PSY2 is used.
       
    84     iPositioner.NotifyPositionUpdate(posInfo, status);
       
    85     User::After(KTinyDelay);
       
    86     SET_TIME
       
    87     ToggleModuleL(KNetworkPsy1, EFalse);
       
    88     User::WaitForRequest(status);
       
    89     //CHECK_TIME(1)
       
    90     CheckExpectedResult(status.Int(), KErrNone, KFailedPositionRequest);
       
    91     CheckExpectedResult(posInfo.ModuleId(), KIntGpsPsy1, KWrongModuleIdReturned);
       
    92     
       
    93     ToggleModuleL(KNetworkPsy1, ETrue);
       
    94     //Config PSY1 again since it was unloaded when it was disabled.
       
    95     ConfigPsyL(KNetworkPsy1, 1,
       
    96         KConfigLRNoError20s      //Step2. no error in 20s
       
    97         );
       
    98 
       
    99     User::After(KSecond*7);
       
   100     
       
   101     //2. Disable PSY2 while location request ongoing, the request shall
       
   102     //fallbck to PSY3
       
   103     SET_TIME
       
   104     iPositioner.NotifyPositionUpdate(posInfo, status);
       
   105     User::After(KSecond*15); //after 15s disable PSY2
       
   106     ToggleModuleL(KIntGpsPsy1, EFalse);
       
   107     User::WaitForRequest(status);
       
   108     CHECK_TIME(16) //After PSY2 is disabled in 15 seconds, PSY3 is used. 
       
   109     CheckExpectedResult(status.Int(), KErrNone, KFailedPositionRequest);
       
   110     CheckExpectedResult(posInfo.ModuleId(), KNetworkPsy2, KWrongModuleIdReturned);
       
   111     
       
   112     
       
   113     // cleanup
       
   114     StandardCleanup();
       
   115     return TestStepResult();
       
   116 	}
       
   117 
       
   118 
       
   119 
       
   120 TVerdict CPsyDisabledStep::doTestStepPostambleL()
       
   121 /**
       
   122  * @return - TVerdict code
       
   123  * Override of base class virtual
       
   124  */
       
   125 	{
       
   126 	CTe_defproxySuiteStepBase::doTestStepPostambleL();
       
   127 	return TestStepResult();
       
   128 	}