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