telephonyserver/etelpacketdata/Te_EtelPacket/Te_EtelPacketTest_Rel5.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-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 // EtelPacketTest_Rel5.cpp
       
    15 // This contains EtelPacket TestCase Testing Release5 (RPacketService functionality testing)
       
    16 // 
       
    17 //
       
    18 
       
    19 // Symbian OS includes
       
    20 #include <e32base.h>
       
    21 
       
    22 #include <etelpckt.h>
       
    23 #include <pcktcs.h>
       
    24 
       
    25 #include "Te_EtelPacketTestStepBase.h"
       
    26 
       
    27 #include "testdef.h"
       
    28 
       
    29 #include "Te_EtelPacketTest_Rel5.h"
       
    30 #include "Te_etelpckt_defs.h"
       
    31 
       
    32 // constructor
       
    33 CEtelPacketTest_Rel5::CEtelPacketTest_Rel5()
       
    34 {
       
    35 	// store the name of this test case
       
    36 	SetTestStepName(_L("Release_5_Service"));
       
    37 }
       
    38 
       
    39 // destructor
       
    40 CEtelPacketTest_Rel5::~CEtelPacketTest_Rel5()
       
    41 {
       
    42 }
       
    43 
       
    44 enum TVerdict CEtelPacketTest_Rel5::doTestStepL( void )
       
    45 /**
       
    46  * Test step Rel5 calls the 3G Packet service (RPacketService) methods
       
    47  */
       
    48 {
       
    49 	RPhone phone;
       
    50 	TInt ret=phone.Open(iTelServer,DPCKTTSY_PHONE_NAME);
       
    51 
       
    52 	RPacketService packetService;
       
    53 	ret=packetService.Open(phone);
       
    54 
       
    55 	RPacketContext r5Context;
       
    56 	TName contextName;
       
    57 	ret=r5Context.OpenNewContext(packetService, contextName);
       
    58 	
       
    59 	TRequestStatus reqStatus, notifyStatus;
       
    60 	
       
    61 	//Set configuration 
       
    62 	RPacketContext::TContextConfig_R5 rel5ContextConfig;
       
    63 	TEST(rel5ContextConfig.ExtensionId()==TPacketDataConfigBase::KConfigRel5);
       
    64 	TPckg<RPacketContext::TContextConfig_R5> contextConfigPckgRel5(rel5ContextConfig);
       
    65 
       
    66 	rel5ContextConfig.iAccessPointName = DPCKTTSY_ACCESS_POINT1;
       
    67 	rel5ContextConfig.iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
       
    68 	rel5ContextConfig.iPdpType = DPCKTTSY_PDP_TYPE1;
       
    69 	rel5ContextConfig.iUseEdge = DPCKTTSY_EGPRS_REQUIRED;;
       
    70 	rel5ContextConfig.iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME1;
       
    71 	rel5ContextConfig.iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD1;
       
    72 	rel5ContextConfig.iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;
       
    73 	rel5ContextConfig.iNWIContext = DPCKTTSY_NWICONTEXT_TRUE;
       
    74 	rel5ContextConfig.iPFI = DPCKTTSY_PFICONTEXT_SMS;
       
    75 	rel5ContextConfig.iPdpDataCompression = DPCKTTSY_DATACOMPRESSION_EV42;
       
    76 	rel5ContextConfig.iPdpHeaderCompression = DPCKTTSY_HEADERCOMPRESSION_ERFC1144;
       
    77 
       
    78 	packetService.SetDefaultContextParams(reqStatus, contextConfigPckgRel5);
       
    79 	User::WaitForRequest(reqStatus);
       
    80 	TEST(reqStatus.Int()==KErrNone);
       
    81 
       
    82 	packetService.GetDefaultContextParams(reqStatus, contextConfigPckgRel5);
       
    83 	User::WaitForRequest(reqStatus);
       
    84 	TEST(reqStatus.Int()==KErrNone);
       
    85 
       
    86 	TEST(rel5ContextConfig.iAccessPointName==DPCKTTSY_ACCESS_POINT2);
       
    87 	TEST(rel5ContextConfig.iPdpAddress==DPCKTTSY_PDP_ADDRESS2);
       
    88 	TEST(rel5ContextConfig.iPdpType==DPCKTTSY_PDP_TYPE2);
       
    89 	TEST(rel5ContextConfig.iUseEdge = DPCKTTSY_EGPRS_REQUIRED);
       
    90 	TEST(rel5ContextConfig.iProtocolConfigOption.iAuthInfo.iUsername==DPCKTTSY_USER_NAME1);
       
    91 	TEST(rel5ContextConfig.iProtocolConfigOption.iAuthInfo.iPassword==DPCKTTSY_PASSWORD1);
       
    92 	TEST(rel5ContextConfig.iProtocolConfigOption.iAuthInfo.iProtocol==DPCKTTSY_PROTOCOL_TYPE1_0);
       
    93 	TEST(rel5ContextConfig.iNWIContext==DPCKTTSY_NWICONTEXT_TRUE);
       
    94 	TEST(rel5ContextConfig.iPFI==DPCKTTSY_PFICONTEXT_SMS);
       
    95 	TEST(rel5ContextConfig.iPdpDataCompression==DPCKTTSY_DATACOMPRESSION_EV44);
       
    96 	TEST(rel5ContextConfig.iPdpHeaderCompression==DPCKTTSY_HEADERCOMPRESSION_ERFC2507);	
       
    97 
       
    98 	packetService.NotifyContextActivationRequested(reqStatus, contextConfigPckgRel5);
       
    99 	User::WaitForRequest(reqStatus);
       
   100 	TEST(reqStatus.Int()==KErrNone);
       
   101 	
       
   102 	packetService.NotifyContextActivationRequested(reqStatus, contextConfigPckgRel5);
       
   103 	packetService.CancelAsyncRequest(EPacketNotifyContextActivationRequested);
       
   104 	User::WaitForRequest(reqStatus);
       
   105 	TEST(reqStatus.Int()==KErrCancel);
       
   106 
       
   107 	//notify
       
   108 	RPacketContext::TContextConfig_R5 rel5NotifyContextConfig;
       
   109 	TPckg<RPacketContext::TContextConfig_R5> contextNotifyConfigPckgRel5(rel5NotifyContextConfig);
       
   110 	
       
   111 	r5Context.NotifyConfigChanged(notifyStatus, contextNotifyConfigPckgRel5);
       
   112 	User::WaitForRequest(notifyStatus);
       
   113 	TEST(notifyStatus.Int()==KErrNone);
       
   114 	TEST(rel5NotifyContextConfig.iAccessPointName==DPCKTTSY_ACCESS_POINT1);
       
   115 	TEST(rel5NotifyContextConfig.iPdpAddress==DPCKTTSY_PDP_ADDRESS1);
       
   116 	TEST(rel5NotifyContextConfig.iPdpType==DPCKTTSY_PDP_TYPE1);
       
   117 	TEST(rel5NotifyContextConfig.iUseEdge = DPCKTTSY_EGPRS_REQUIRED);
       
   118 	TEST(rel5NotifyContextConfig.iProtocolConfigOption.iAuthInfo.iUsername==DPCKTTSY_USER_NAME1);
       
   119 	TEST(rel5NotifyContextConfig.iProtocolConfigOption.iAuthInfo.iPassword==DPCKTTSY_PASSWORD1);
       
   120 	TEST(rel5NotifyContextConfig.iProtocolConfigOption.iAuthInfo.iProtocol==DPCKTTSY_PROTOCOL_TYPE1_0);
       
   121 	TEST(rel5NotifyContextConfig.iNWIContext==DPCKTTSY_NWICONTEXT_TRUE);
       
   122 	TEST(rel5NotifyContextConfig.iPFI==DPCKTTSY_PFICONTEXT_SIG);
       
   123 	TEST(rel5NotifyContextConfig.iPdpDataCompression==DPCKTTSY_DATACOMPRESSION_EV42);
       
   124 	TEST(rel5NotifyContextConfig.iPdpHeaderCompression==DPCKTTSY_HEADERCOMPRESSION_ERFC1144);
       
   125 	
       
   126 	//notify cancel
       
   127 	r5Context.NotifyConfigChanged(notifyStatus, contextConfigPckgRel5);
       
   128 	r5Context.CancelAsyncRequest(EPacketContextNotifyConfigChanged);
       
   129 	User::WaitForRequest(notifyStatus);
       
   130 	TEST(notifyStatus.Int()==KErrCancel);
       
   131 	
       
   132 	//setconfig
       
   133 	rel5ContextConfig.iAccessPointName = DPCKTTSY_ACCESS_POINT1;
       
   134 	rel5ContextConfig.iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
       
   135 	rel5ContextConfig.iPdpType = DPCKTTSY_PDP_TYPE1;
       
   136 	rel5ContextConfig.iUseEdge = DPCKTTSY_EGPRS_REQUIRED;
       
   137 	rel5ContextConfig.iPdpDataCompression = DPCKTTSY_DATACOMPRESSION_EV42;
       
   138 	rel5ContextConfig.iPdpHeaderCompression = DPCKTTSY_HEADERCOMPRESSION_ERFC1144;
       
   139 	
       
   140 	r5Context.SetConfig(reqStatus, contextConfigPckgRel5);
       
   141 	User::WaitForRequest(reqStatus);
       
   142 	TEST(reqStatus.Int()==KErrNone);
       
   143 	
       
   144 	//setconfig cancel
       
   145 	r5Context.SetConfig(reqStatus, contextConfigPckgRel5);
       
   146 	r5Context.CancelAsyncRequest(EPacketContextSetConfig);
       
   147 	User::WaitForRequest(reqStatus);
       
   148 	TEST(reqStatus.Int()==KErrCancel);
       
   149 	
       
   150 	// GetConfig
       
   151 	r5Context.GetConfig(reqStatus, contextConfigPckgRel5);
       
   152 	User::WaitForRequest(reqStatus);
       
   153 
       
   154 	TEST(rel5ContextConfig.iAccessPointName == DPCKTTSY_ACCESS_POINT2);
       
   155 	TEST(rel5ContextConfig.iPdpAddress == DPCKTTSY_PDP_ADDRESS2);
       
   156 	TEST(rel5ContextConfig.iPdpType == DPCKTTSY_PDP_TYPE2);
       
   157 	TEST(rel5ContextConfig.iPdpDataCompression == DPCKTTSY_DATACOMPRESSION_EV44);
       
   158 	TEST(rel5ContextConfig.iPdpHeaderCompression == DPCKTTSY_HEADERCOMPRESSION_ERFC2507);
       
   159 	
       
   160 	//cancel
       
   161 	r5Context.GetConfig(reqStatus, contextConfigPckgRel5);
       
   162 	r5Context.CancelAsyncRequest(EPacketContextGetConfig);
       
   163 	User::WaitForRequest(reqStatus);
       
   164 	TEST(reqStatus.Int()==KErrCancel);
       
   165 	
       
   166 	r5Context.Close();
       
   167 	packetService.Close();
       
   168 	phone.Close();
       
   169 
       
   170 	return TestStepResult();
       
   171 }