lbs/lbsclient/src/ctlbsclientpostp259.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2001-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 the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 //  INCLUDES
       
    19 #include "ctlbsclientpostp259.h"
       
    20 
       
    21 // CONSTANTS
       
    22 
       
    23 // ================= MEMBER FUNCTIONS =======================
       
    24 
       
    25 // ---------------------------------------------------------
       
    26 // Constructor.
       
    27 // ---------------------------------------------------------
       
    28 CT_LbsClientPosTp259::CT_LbsClientPosTp259(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) 
       
    29 	{
       
    30 	_LIT(KTestName, "TP259 - Cancel Request with incorrect enum values");
       
    31 	SetTestStepName(KTestName); 
       
    32 	}
       
    33 
       
    34 // ---------------------------------------------------------
       
    35 // Destructor.
       
    36 // ---------------------------------------------------------
       
    37 CT_LbsClientPosTp259::~CT_LbsClientPosTp259()
       
    38 	{
       
    39 	}
       
    40 // ---------------------------------------------------------
       
    41 // CT_LbsClientPosTp259::CloseTest
       
    42 //
       
    43 // (other items were commented in a header).
       
    44 // ---------------------------------------------------------
       
    45 //
       
    46 void CT_LbsClientPosTp259::CloseTest()
       
    47     {
       
    48     ClosePositioner(); 
       
    49     Disconnect();
       
    50     }
       
    51 
       
    52 // ---------------------------------------------------------
       
    53 // CT_LbsClientPosTp259::StartL
       
    54 //
       
    55 // (other items were commented in a header).
       
    56 // ---------------------------------------------------------
       
    57 //
       
    58 void CT_LbsClientPosTp259::StartL()
       
    59     {
       
    60     // TestPart1 tests the separate case described in Error Report 
       
    61     // "SBUY-5W8KJ6-Bug in subsession selection when forwarding requests"
       
    62     TestPart1L();
       
    63     
       
    64     // Testpart2 tests some other scenarios not included in TestPart1L
       
    65     TestPart2L();
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------
       
    69 // CT_LbsClientPosTp259::TestPart1L
       
    70 //
       
    71 // (other items were commented in a header).
       
    72 // ---------------------------------------------------------
       
    73 //
       
    74 void CT_LbsClientPosTp259::TestPart1L()
       
    75     {
       
    76     _LIT(KFunctionsName, "We are inside TestPart1L()");
       
    77     INFO_PRINTF1(KFunctionsName);
       
    78     ConnectL();
       
    79 
       
    80     // First call the RPosServer::CancelRequest method with inparameter 
       
    81     // EPositionerNotifyPositionUpdate and then call the RPositioner::CancelRequest
       
    82     // method with EPositionServerNotifyModuleStatusEvent
       
    83 
       
    84     _LIT(KCancelRequest, "iPosServer.CancelRequest(EPositionerNotifyPositionUpdate)");
       
    85     INFO_PRINTF1(KCancelRequest);
       
    86     TInt cancelErr = iPosServer.CancelRequest(EPositionerNotifyPositionUpdate);
       
    87     if (cancelErr != KErrNotSupported)
       
    88     	{
       
    89     	_LIT(KErrorAndLeave, "The CancelRequest(EPositionerNotifyPositionUpdate) call did not return KErrNotSupported");
       
    90     	LogErrorAndLeaveL(KErrorAndLeave);
       
    91     	}
       
    92     
       
    93     SetupPsyL(iUidMultiPsy);
       
    94     User::LeaveIfError(OpenPositionerByName(iUidMultiPsy));
       
    95 
       
    96     _LIT(KModuleStatusEvent, "iPositioner.CancelRequest(EPositionServerNotifyModuleStatusEvent);");
       
    97     INFO_PRINTF1(KModuleStatusEvent);
       
    98     TInt err = iPositioner.CancelRequest(EPositionServerNotifyModuleStatusEvent);
       
    99     if (err != KErrNotSupported)
       
   100     	{
       
   101     	_LIT(KErrorAndLeave, "The CancelRequest(EPositionServerNotifyModuleStatusEvent) call did not return KErrNotFound");
       
   102     	LogErrorAndLeaveL(KErrorAndLeave);
       
   103     	}
       
   104     
       
   105     ClosePositioner();
       
   106     Disconnect();
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------
       
   110 // CT_LbsClientPosTp259::TestPart2L
       
   111 //
       
   112 // (other items were commented in a header).
       
   113 // ---------------------------------------------------------
       
   114 //
       
   115 void CT_LbsClientPosTp259::TestPart2L()
       
   116     {
       
   117     _LIT(KFunctionsName,"We are inside TestPart2L()");
       
   118     INFO_PRINTF1(KFunctionsName);
       
   119     SetupPsyL(iUidMultiPsy);
       
   120     ConnectL();
       
   121     TInt err = KErrNone;
       
   122     User::LeaveIfError(OpenPositionerByName(iUidMultiPsy));
       
   123 
       
   124     err = iPositioner.CancelRequest(EPositionServerNotifyModuleStatusEvent);
       
   125     if (err != KErrNotSupported)
       
   126         {
       
   127         _LIT(KErrorAndLeave, "The CancelRequest(EPositionServerNotifyModuleStatusEvent) call did not return KErrNotFound");
       
   128         LogErrorAndLeaveL(KErrorAndLeave);
       
   129         }
       
   130 
       
   131     // Verify that a RPosServer.CancelRequest(EPositionServerNotifyModuleStatusEvent) (incorrect call)
       
   132     // call does not affect the RPositioner.NotifyPositionUpdate call
       
   133     _LIT(KKalle, "Kalle");
       
   134     PerformRequestL(KKalle, CRequestor::ERequestorService, CRequestor::EFormatTelephone); 
       
   135     err = iPosServer.CancelRequest(EPositionServerNotifyModuleStatusEvent);
       
   136     if (err != KErrNotFound)
       
   137         {
       
   138         _LIT(KErrorAndLeave, "The CancelRequest(EPositionServerNotifyModuleStatusEvent) call did not return KErrNotFound");
       
   139         LogErrorAndLeaveL(KErrorAndLeave);
       
   140         }
       
   141     CheckRequestResultL(KErrNone);
       
   142 
       
   143     // Verify that a RPositioner.CancelRequest(EPositionServerNotifyModuleStatusEvent) (incorrect call)
       
   144     // call does not affect the RPositioner.NotifyPositionUpdate call
       
   145     PerformRequestL(KKalle, CRequestor::ERequestorService, CRequestor::EFormatTelephone); 
       
   146     err = iPositioner.CancelRequest(EPositionServerNotifyModuleStatusEvent);
       
   147     if (err != KErrNotSupported)
       
   148         {
       
   149         _LIT(KErrorAndLeave, "The CancelRequest(EPositionServerNotifyModuleStatusEvent) call did not return KErrNotFound");
       
   150         LogErrorAndLeaveL(KErrorAndLeave);
       
   151         }
       
   152 
       
   153     CheckRequestResultL(KErrNone);
       
   154 
       
   155     err = iPositioner.CancelRequest(EPositionerNotifyPositionUpdate);
       
   156     if (err != KErrNotFound) 
       
   157         {
       
   158         _LIT(KErrorAndLeave, "The CancelRequest(EPositionerNotifyPositionUpdate) call did not return KErrNotFound");
       
   159         LogErrorAndLeaveL(KErrorAndLeave);
       
   160         }
       
   161 
       
   162     ClosePositioner();
       
   163 
       
   164     // According to error report "SBUY-5W8KJ6 - Bug in subsession selection when forwarding requests"
       
   165     // CancelRequest call will return with KErrNotSupported
       
   166     TInt cancelErr = iPosServer.CancelRequest(EPositionerNotifyPositionUpdate);
       
   167     if (cancelErr != KErrNotSupported)
       
   168         {
       
   169         _LIT(KErrorAndLeave, "The CancelRequest(EPositionerNotifyPositionUpdate) call did not return KErrNotSupported");
       
   170         LogErrorAndLeaveL(KErrorAndLeave);
       
   171         }
       
   172 
       
   173     // According to error report "SBUY-5W8KJ6 - Bug in subsession selection when forwarding requests"
       
   174     // CancelRequest call will return with KErrNotSupported
       
   175     _LIT(KLastKnownPosition, "iPosServer.CancelRequest(EPositionerGetLastKnownPosition)");
       
   176     INFO_PRINTF1(KLastKnownPosition);
       
   177     cancelErr = iPosServer.CancelRequest(EPositionerGetLastKnownPosition);
       
   178     if (cancelErr != KErrNotSupported)
       
   179         {
       
   180         _LIT(KErrorAndLeave, "The CancelRequest(EPositionerGetLastKnownPosition) call did not return KErrNotSupported");
       
   181         LogErrorAndLeaveL(KErrorAndLeave);
       
   182         }
       
   183 
       
   184     //Make a request and then cancel a GetLastKnownPosition request that hasn't been made
       
   185     //and check that the position request is not affected
       
   186     User::LeaveIfError(OpenPositionerByName(iUidMultiPsy));
       
   187     PerformRequestL(KKalle, CRequestor::ERequestorService, CRequestor::EFormatTelephone);
       
   188 
       
   189     cancelErr = iPosServer.CancelRequest(EPositionerGetLastKnownPosition);
       
   190     if (cancelErr != KErrNotSupported) 
       
   191         {
       
   192         _LIT(KErrorAndLeave, "The CancelRequest(EPositionerGetLastKnownPosition call did not return KErrNotSupported");
       
   193         LogErrorAndLeaveL(KErrorAndLeave);
       
   194         }
       
   195 
       
   196     CheckRequestResultL(KErrNone);
       
   197 
       
   198     ClosePositioner();
       
   199     Disconnect();
       
   200     }