datasourcemodules/defaultpositioningmodule/test/te_defproxy/src/canceltrackingstep.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 CancelTrackingStep.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "canceltrackingstep.h"
       
    23 #include "te_defproxysuitedefs.h"
       
    24 
       
    25 CCancelTrackingStep::~CCancelTrackingStep()
       
    26 /**
       
    27  * Destructor
       
    28  */
       
    29 	{
       
    30 	}
       
    31 
       
    32 CCancelTrackingStep::CCancelTrackingStep()
       
    33 /**
       
    34  * Constructor
       
    35  */
       
    36 	{
       
    37 	SetTestStepName(KCancelTrackingStep);
       
    38 	}
       
    39 
       
    40 TVerdict CCancelTrackingStep::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 CCancelTrackingStep::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 
       
    62     // setup order : PSY6
       
    63     ToggleModuleL(KUidLcfPsy3, EFalse);
       
    64     ToggleModuleL(KUidLcfPsy1, EFalse);
       
    65 
       
    66     TRequestStatus status;
       
    67     TPositionInfo posInfo;
       
    68 
       
    69     const TTimeIntervalMicroSeconds KPSYDelay = 2 * KSecondsToMicro;
       
    70     const TTimeIntervalMicroSeconds KInterval = 3 * KSecondsToMicro;
       
    71     const TTimeIntervalMicroSeconds32 KCancelIntervalDelay = 2 * KSecondsToMicro;
       
    72     const TTimeIntervalMicroSeconds32 KCancelPsyDelay = 4 * KSecondsToMicro;
       
    73     const TTimeIntervalMicroSeconds KTimeOut  = 8 * KSecondsToMicro;
       
    74 
       
    75     TPositionUpdateOptions updateOptions;
       
    76     updateOptions.SetUpdateInterval(KInterval);
       
    77     updateOptions.SetUpdateTimeOut(KTimeOut);
       
    78     if(KErrNone != iPositioner.SetUpdateOptions(updateOptions))
       
    79         {
       
    80         ERR_PRINTF1(KFailedStartTracking);
       
    81         SetTestStepResult(EFail);
       
    82         return TestStepResult();
       
    83         }
       
    84     // psy6 must delay
       
    85     HPositionGenericInfo* genInfo = HPositionGenericInfo::NewLC();
       
    86 
       
    87     // warm up 1st tracking
       
    88     PositionRequestWithCheck(*genInfo, KErrNone, KUidLcfPsy6);
       
    89 
       
    90     // 2nd request, cancel during interval
       
    91     iPositioner.NotifyPositionUpdate(*genInfo, status);
       
    92     User::After(KCancelIntervalDelay);
       
    93     iPositioner.CancelRequest(EPositionerNotifyPositionUpdate);
       
    94     User::WaitForRequest(status);
       
    95     CheckExpectedResult(KErrCancel, status.Int(), KFailedCancelInterval);
       
    96 
       
    97     // 3rd request, warm-up new tracking session
       
    98     updateOptions.SetUpdateInterval(0);
       
    99     if(KErrNone != iPositioner.SetUpdateOptions(updateOptions))
       
   100         {
       
   101         ERR_PRINTF1(KFailedStopTracking);
       
   102         SetTestStepResult(EFail);
       
   103         return TestStepResult();
       
   104         }
       
   105     PositionRequestWithCheck(*genInfo, KErrNone, KUidLcfPsy6);
       
   106 
       
   107     updateOptions.SetUpdateInterval(KInterval);
       
   108     if(KErrNone != iPositioner.SetUpdateOptions(updateOptions))
       
   109         {
       
   110         ERR_PRINTF1(KFailedStartTracking2);
       
   111         SetTestStepResult(EFail);
       
   112         return TestStepResult();
       
   113         }
       
   114     PositionRequestWithCheck(*genInfo, KErrNone, KUidLcfPsy6);
       
   115 
       
   116     // 4th request, cancel during psy delay
       
   117     SetPsy6Delay(*genInfo, KPSYDelay);
       
   118     iPositioner.NotifyPositionUpdate(*genInfo, status);
       
   119     User::After(KCancelPsyDelay);
       
   120     iPositioner.CancelRequest(EPositionerNotifyPositionUpdate);
       
   121     User::WaitForRequest(status);
       
   122     CheckExpectedResult(KErrCancel, status.Int(), KFailedCancelPsyDelay);
       
   123 
       
   124     // cleanup
       
   125     CleanupStack::PopAndDestroy(genInfo);
       
   126     StandardCleanup();
       
   127 	return TestStepResult();
       
   128 	}
       
   129 
       
   130 
       
   131 
       
   132 TVerdict CCancelTrackingStep::doTestStepPostambleL()
       
   133 /**
       
   134  * @return - TVerdict code
       
   135  * Override of base class virtual
       
   136  */
       
   137 	{
       
   138 	CTe_defproxySuiteStepBase::doTestStepPostambleL();
       
   139 	return TestStepResult();
       
   140 	}