telephonyserver/etelpacketdata/Te_EtelPacket/Te_EtelPacketTest1_1Extended.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     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 "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 // EtelPacketTest1_1Extended.cpp
       
    15 // This contains Extended EtelPacket TestCase 1.1 tests (RPacketService functionality 
       
    16 // testing). These extended tests have been added to new files due to stack overflow in
       
    17 // the EtelPackettest1_1 files.
       
    18 // Change Request: NDOE-58VF4Q. 
       
    19 // Asynchronous variants of the following methods have been created:
       
    20 // SetAttachMode(), GetAttachMode(), SetDefaultContextParams, GetDefaultContextParams
       
    21 // The synchronous versions of these methods are also called in this file. This is 
       
    22 // essential if the dummy TSY (dtsy) code is to work properly.
       
    23 // File created 10-04-02.
       
    24 // 
       
    25 //
       
    26 
       
    27 // Symbian OS includes
       
    28 #include <e32base.h>
       
    29 
       
    30 #include <etelpckt.h>
       
    31 #include <pcktcs.h>
       
    32 
       
    33 #include "Te_EtelPacketTestStepBase.h"
       
    34 
       
    35 #include "testdef.h"
       
    36 
       
    37 #include "Te_EtelPacketTest1_1Extended.h"
       
    38 #include "Te_etelpckt_defs.h"
       
    39 
       
    40 // constructor
       
    41 CEtelPacketTest1_1Extended::CEtelPacketTest1_1Extended()
       
    42 {
       
    43 	// store the name of this test case
       
    44 	SetTestStepName(_L("Extended_Service"));
       
    45 }
       
    46 
       
    47 // destructor
       
    48 CEtelPacketTest1_1Extended::~CEtelPacketTest1_1Extended()
       
    49 {
       
    50 }
       
    51 
       
    52 
       
    53 enum TVerdict CEtelPacketTest1_1Extended::doTestStepL( void )
       
    54 /**
       
    55  * Test step Extended_Service tests new asynchronous Packet service (RPacketService) methods
       
    56  */
       
    57 {
       
    58 	RPhone phone;
       
    59 	TInt ret=phone.Open(iTelServer,DPCKTTSY_PHONE_NAME);
       
    60 	CHECKPOINT_EX(ret==KErrNone,CHP_OPEN_PHONE);
       
    61 	RPacketService gprs;
       
    62 	ret=gprs.Open(phone);
       
    63     CHECKPOINT(ret,KErrNone,CHP_SRVS_CASE("A.1"));
       
    64 	
       
    65 	TRequestStatus reqStatus;
       
    66 	
       
    67 // Set Attach Mode
       
    68 	RPacketService::TAttachMode attachMode=DPCKTTSY_ATTACH_MODE1;
       
    69 	CHECKPOINT(gprs.SetAttachMode(attachMode),KErrNone,CHP_SRVS_CASE("A.4"));
       
    70 
       
    71 // Set Attach mode - Asynchronous variant 
       
    72 	RPacketService::TAttachMode attachModeAsync=DPCKTTSY_ATTACH_MODE2;
       
    73 	gprs.SetAttachMode(reqStatus, attachModeAsync);
       
    74 	User::WaitForRequest(reqStatus);
       
    75 	
       
    76 
       
    77 // Cancel Set Attach mode
       
    78 	gprs.SetAttachMode(reqStatus, attachModeAsync);
       
    79 	gprs.CancelAsyncRequest(EPacketSetAttachMode);
       
    80 	User::WaitForRequest(reqStatus);
       
    81 	CHECKPOINT(reqStatus.Int(), KErrCancel, CHP_SRVS_CASE("A.4B"));
       
    82 
       
    83 // Get Attach Mode
       
    84 	CHECKPOINT(gprs.GetAttachMode(attachMode),KErrNone,CHP_SRVS_CASE("A.5"));
       
    85 	CHECKPOINT(attachMode,DPCKTTSY_ATTACH_MODE2,CHP_SRVS_CASE("A.5"));
       
    86 
       
    87 // Get Attach mode - Asynchronous variant 
       
    88 	gprs.GetAttachMode(reqStatus, attachModeAsync);
       
    89 	User::WaitForRequest(reqStatus);
       
    90 
       
    91 	CHECKPOINT(reqStatus.Int(), KErrNone, CHP_SRVS_CASE("A.5B"));
       
    92 	CHECKPOINT(attachModeAsync,DPCKTTSY_ATTACH_MODE1,CHP_SRVS_CASE("A.5B"));
       
    93 
       
    94 // Cancel Get Attach mode
       
    95 	gprs.GetAttachMode(reqStatus, attachModeAsync);
       
    96 	gprs.CancelAsyncRequest(EPacketGetAttachMode);
       
    97 	User::WaitForRequest(reqStatus);
       
    98 	CHECKPOINT(reqStatus.Int(), KErrCancel, CHP_SRVS_CASE("A.5B"));
       
    99 	
       
   100 // Notify Attach mode change
       
   101 	gprs.NotifyAttachModeChange(reqStatus, attachModeAsync);
       
   102 	User::WaitForRequest(reqStatus);
       
   103 	CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.5C"));
       
   104 	CHECKPOINT(attachModeAsync,DPCKTTSY_ATTACH_MODE2,CHP_SRVS_CASE("A.5C"));
       
   105 	
       
   106 // Notify Attach mode change & Cancel
       
   107 	gprs.NotifyAttachModeChange(reqStatus, attachModeAsync);
       
   108 	gprs.CancelAsyncRequest(EPacketNotifyAttachModeChange);
       
   109 	User::WaitForRequest(reqStatus);
       
   110 	CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.5C"));
       
   111 
       
   112 // Set Default Context Parameters
       
   113 	RPacketContext::TContextConfigGPRS contextConfig;
       
   114 	TPckg<RPacketContext::TContextConfigGPRS> contextConfigPckg(contextConfig);
       
   115 
       
   116 	contextConfig.iAccessPointName = DPCKTTSY_ACCESS_POINT1;
       
   117 	contextConfig.iAnonymousAccessReqd = DPCKTTSY_ANONYMOUS_ACCESS1;
       
   118 	contextConfig.iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
       
   119 	contextConfig.iPdpCompression = DPCKTTSY_COMPRESSION1;
       
   120 	contextConfig.iPdpType = DPCKTTSY_PDP_TYPE1;
       
   121 	contextConfig.iUseEdge = DPCKTTSY_EGPRS_REQUIRED;
       
   122 	contextConfig.iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME1;
       
   123 	contextConfig.iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD1;
       
   124 	contextConfig.iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;
       
   125 	contextConfig.iNWIContext = DPCKTTSY_NWICONTEXT_TRUE;
       
   126 	CHECKPOINT(gprs.SetDefaultContextParams(contextConfigPckg),KErrNone,CHP_SRVS_CASE("A.19"));
       
   127 
       
   128 // Set Default Context Parameters - Asynchronous variant
       
   129 	RPacketContext::TContextConfigGPRS contextConfigAsync;
       
   130 	TPckg<RPacketContext::TContextConfigGPRS> contextConfigPckgAsync(contextConfigAsync);
       
   131 
       
   132 	contextConfigAsync.iAccessPointName = DPCKTTSY_ACCESS_POINT2;
       
   133 	contextConfigAsync.iAnonymousAccessReqd = DPCKTTSY_ANONYMOUS_ACCESS2;
       
   134 	contextConfigAsync.iPdpAddress = DPCKTTSY_PDP_ADDRESS2;
       
   135 	contextConfigAsync.iPdpCompression = DPCKTTSY_COMPRESSION2;
       
   136 	contextConfigAsync.iPdpType = DPCKTTSY_PDP_TYPE2;
       
   137 	contextConfigAsync.iUseEdge = DPCKTTSY_EGPRS_NOTREQUIRED;
       
   138 	contextConfigAsync.iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME2;
       
   139 	contextConfigAsync.iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD2;
       
   140 	contextConfigAsync.iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE2_0;
       
   141 	contextConfigAsync.iNWIContext = DPCKTTSY_NWICONTEXT_TRUE;
       
   142 	
       
   143 	gprs.SetDefaultContextParams(reqStatus, contextConfigPckgAsync);
       
   144 	User::WaitForRequest(reqStatus);
       
   145 	CHECKPOINT(reqStatus.Int(), KErrNone, CHP_SRVS_CASE("A.19B"));
       
   146 	
       
   147 // Cancel Set Default Context Parameters
       
   148 	gprs.SetDefaultContextParams(reqStatus, contextConfigPckgAsync);
       
   149 	gprs.CancelAsyncRequest(EPacketSetDefaultContextParams);
       
   150 	User::WaitForRequest(reqStatus);
       
   151 	CHECKPOINT(reqStatus.Int(), KErrCancel, CHP_SRVS_CASE("A.19B"));
       
   152 
       
   153 // Get Default Context Parameters
       
   154 	CHECKPOINT(gprs.GetDefaultContextParams(contextConfigPckg),KErrNone,CHP_SRVS_CASE("A.20"));
       
   155 	CHECKPOINT_COMP_STR(contextConfig.iAccessPointName,DPCKTTSY_ACCESS_POINT2,CHP_SRVS_CASE("A.20"));
       
   156 	CHECKPOINT(contextConfig.iAnonymousAccessReqd,DPCKTTSY_ANONYMOUS_ACCESS2,CHP_SRVS_CASE("A.20"));
       
   157 	CHECKPOINT_COMP_STR(contextConfig.iPdpAddress,DPCKTTSY_PDP_ADDRESS2,CHP_SRVS_CASE("A.20"));
       
   158 	CHECKPOINT(contextConfig.iPdpCompression,DPCKTTSY_COMPRESSION2,CHP_SRVS_CASE("A.20"));
       
   159 	CHECKPOINT(contextConfig.iPdpType,DPCKTTSY_PDP_TYPE2,CHP_SRVS_CASE("A.20"));
       
   160 	CHECKPOINT(contextConfig.iUseEdge,DPCKTTSY_EGPRS_NOTREQUIRED,CHP_SRVS_CASE("A.20"));
       
   161 	CHECKPOINT_COMP_STR(contextConfig.iProtocolConfigOption.iAuthInfo.iUsername,DPCKTTSY_USER_NAME1,CHP_SRVS_CASE("A.20"));
       
   162 	CHECKPOINT_COMP_STR(contextConfig.iProtocolConfigOption.iAuthInfo.iPassword,DPCKTTSY_PASSWORD1,CHP_SRVS_CASE("A.20"));
       
   163 	CHECKPOINT_COMP_STR(contextConfig.iProtocolConfigOption.iAuthInfo.iProtocol,DPCKTTSY_PROTOCOL_TYPE1_0,CHP_SRVS_CASE("A.20"));
       
   164 
       
   165 // Get Default Context Parameters - Asynchronous variant
       
   166 
       
   167 	gprs.GetDefaultContextParams(reqStatus, contextConfigPckgAsync);
       
   168 	User::WaitForRequest(reqStatus);
       
   169 	CHECKPOINT(reqStatus.Int(), KErrNone, CHP_SRVS_CASE("A.20B"));
       
   170 
       
   171 	CHECKPOINT_COMP_STR(contextConfigAsync.iAccessPointName,DPCKTTSY_ACCESS_POINT1,CHP_SRVS_CASE("A.20B"));
       
   172 	CHECKPOINT(contextConfigAsync.iAnonymousAccessReqd,DPCKTTSY_ANONYMOUS_ACCESS1,CHP_SRVS_CASE("A.20B"));
       
   173 	CHECKPOINT_COMP_STR(contextConfigAsync.iPdpAddress,DPCKTTSY_PDP_ADDRESS1,CHP_SRVS_CASE("A.20B"));
       
   174 	CHECKPOINT(contextConfigAsync.iPdpCompression,DPCKTTSY_COMPRESSION1,CHP_SRVS_CASE("A.20B"));
       
   175 	CHECKPOINT(contextConfigAsync.iPdpType,DPCKTTSY_PDP_TYPE1,CHP_SRVS_CASE("A.20B"));
       
   176 	CHECKPOINT(contextConfigAsync.iUseEdge,DPCKTTSY_EGPRS_REQUIRED,CHP_SRVS_CASE("A.20B"));
       
   177 	CHECKPOINT_COMP_STR(contextConfigAsync.iProtocolConfigOption.iAuthInfo.iUsername,DPCKTTSY_USER_NAME1,CHP_SRVS_CASE("A.20B"));
       
   178 	CHECKPOINT_COMP_STR(contextConfigAsync.iProtocolConfigOption.iAuthInfo.iPassword ,DPCKTTSY_PASSWORD1,CHP_SRVS_CASE("A.20B"));
       
   179 	CHECKPOINT(contextConfigAsync.iProtocolConfigOption.iAuthInfo.iProtocol,DPCKTTSY_PROTOCOL_TYPE1_0,CHP_SRVS_CASE("A.20B"));
       
   180 	CHECKPOINT(contextConfigAsync.iNWIContext,DPCKTTSY_NWICONTEXT_TRUE,CHP_SRVS_CASE("A.20B"));
       
   181 
       
   182 // Cancel Get Default Context Parameters
       
   183 	gprs.GetDefaultContextParams(reqStatus, contextConfigPckgAsync);
       
   184 	gprs.CancelAsyncRequest(EPacketGetDefaultContextParams);
       
   185 	User::WaitForRequest(reqStatus);
       
   186 	CHECKPOINT(reqStatus.Int(), KErrCancel, CHP_SRVS_CASE("A.20B"));
       
   187 	
       
   188 // End of RPacketService tests.
       
   189 	gprs.Close();
       
   190 	phone.Close();
       
   191 
       
   192 	return TestStepResult();
       
   193 }