telephonyserverplugins/common_tsy/test/component/src/cctsysupplementaryservicecapsfu.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-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 // The TEFUnit test suite for SupplementaryServiceCaps in the Common TSY.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20 */
       
    21 
       
    22 #include "cctsysupplementaryservicecapsfu.h"
       
    23 #include <etel.h>
       
    24 #include <etelmm.h>
       
    25 #include <et_clsvr.h>
       
    26 #include <ctsy/mmtsy_names.h>
       
    27 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    28 #include "tmockltsydata.h"
       
    29 #include <ctsy/serviceapi/gsmerror.h>
       
    30 
       
    31 CTestSuite* CCTsySupplementaryServiceCapsFU::CreateSuiteL(const TDesC& aName)
       
    32 	{
       
    33 	SUB_SUITE;
       
    34 
       
    35 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServiceCapsFU, TestGetCallServiceCaps0001L);
       
    36 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServiceCapsFU, TestNotifyCallServiceCapsChange0001L);
       
    37 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServiceCapsFU, TestNotifyCallServiceCapsChange0002L);
       
    38 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServiceCapsFU, TestNotifyCallServiceCapsChange0004L);
       
    39 
       
    40 	END_SUITE;
       
    41 	}
       
    42 
       
    43 
       
    44 //
       
    45 // Actual test cases
       
    46 //
       
    47 
       
    48 
       
    49 /**
       
    50 @SYMTestCaseID BA-CTSY-SUSC-MGCSC-0001
       
    51 @SYMComponent  telephony_ctsy
       
    52 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetCallServiceCaps
       
    53 @SYMTestPriority High
       
    54 @SYMTestActions Invokes RMobilePhone::GetCallServiceCaps
       
    55 @SYMTestExpectedResults Pass
       
    56 @SYMTestType CT
       
    57 */
       
    58 void CCTsySupplementaryServiceCapsFU::TestGetCallServiceCaps0001L()
       
    59 	{
       
    60 
       
    61 	OpenEtelServerL(EUseExtendedError);
       
    62 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
    63 	OpenPhoneL();
       
    64 
       
    65  	//-------------------------------------------------------------------------
       
    66 	// TEST C: Successful completion request of
       
    67 	// RMobilePhone::GetCallServiceCaps.
       
    68  	//-------------------------------------------------------------------------
       
    69 
       
    70 	TUint32 caps;
       
    71 	TInt res = iPhone.GetCallServiceCaps(caps); 
       
    72 	ASSERT_EQUALS(KErrNone, res);
       
    73 	
       
    74 	// only return value at this moment is KMultimodeTsyGsmCallServiceCaps
       
    75 	ASSERT_EQUALS(KMultimodeTsyGsmCallServiceCaps, caps);
       
    76 
       
    77 	AssertMockLtsyStatusL();
       
    78 	CleanupStack::PopAndDestroy(this);
       
    79 	
       
    80 	}
       
    81 
       
    82 
       
    83 /**
       
    84 @SYMTestCaseID BA-CTSY-SUSC-MCSCC-0001
       
    85 @SYMComponent  telephony_ctsy
       
    86 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyCallServiceCapsChange
       
    87 @SYMTestPriority High
       
    88 @SYMTestActions Invokes RMobilePhone::NotifyCallServiceCapsChange
       
    89 @SYMTestExpectedResults Pass
       
    90 @SYMTestType CT
       
    91 */
       
    92 void CCTsySupplementaryServiceCapsFU::TestNotifyCallServiceCapsChange0001L()
       
    93 	{
       
    94 
       
    95 	OpenEtelServerL(EUseExtendedError);
       
    96 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
    97 	OpenPhoneL();
       
    98 
       
    99 	TUint32 completeCaps(100);
       
   100 	TPckg<TUint32> pckgCaps(completeCaps);
       
   101 	
       
   102  	//-------------------------------------------------------------------------
       
   103 	// TEST C: Successful completion request of
       
   104 	// RMobilePhone::NotifyCallServiceCapsChange when result is not cached.
       
   105  	//-------------------------------------------------------------------------
       
   106 	
       
   107 	TRequestStatus reqStatus;
       
   108 	TUint32 caps(0);
       
   109 	iPhone.NotifyCallServiceCapsChange(reqStatus, caps);
       
   110 	
       
   111 	iMockLTSY.CompleteL(EMobilePhoneNotifyCallServiceCapsChange, KErrNone, pckgCaps);
       
   112 
       
   113 	User::WaitForRequest(reqStatus);
       
   114 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   115 	AssertMockLtsyStatusL();
       
   116 
       
   117 	ASSERT_EQUALS( completeCaps, caps );
       
   118 	
       
   119 	CleanupStack::PopAndDestroy(this);
       
   120 	
       
   121 	}
       
   122 
       
   123 
       
   124 /**
       
   125 @SYMTestCaseID BA-CTSY-SUSC-MCSCC-0002
       
   126 @SYMComponent  telephony_ctsy
       
   127 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::NotifyCallServiceCapsChange
       
   128 @SYMTestPriority High
       
   129 @SYMTestActions Invokes cancelling of RMobilePhone::NotifyCallServiceCapsChange
       
   130 @SYMTestExpectedResults Pass
       
   131 @SYMTestType CT
       
   132 */
       
   133 void CCTsySupplementaryServiceCapsFU::TestNotifyCallServiceCapsChange0002L()
       
   134 	{
       
   135 
       
   136 	OpenEtelServerL(EUseExtendedError);
       
   137 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   138 	OpenPhoneL();
       
   139 
       
   140  	//-------------------------------------------------------------------------
       
   141 	// Test cancelling of RMobilePhone::NotifyCallServiceCapsChange
       
   142  	//-------------------------------------------------------------------------
       
   143  	
       
   144 	TRequestStatus reqStatus;
       
   145 	TUint32 caps(0);
       
   146 	iPhone.NotifyCallServiceCapsChange(reqStatus, caps);
       
   147 	
       
   148 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyCallServiceCapsChange);
       
   149 
       
   150 	User::WaitForRequest(reqStatus);
       
   151 	ASSERT_EQUALS(KErrCancel, reqStatus.Int());
       
   152 	AssertMockLtsyStatusL();
       
   153 
       
   154 	AssertMockLtsyStatusL();
       
   155 	CleanupStack::PopAndDestroy(this);
       
   156 	
       
   157 	}
       
   158 
       
   159 
       
   160 /**
       
   161 @SYMTestCaseID BA-CTSY-SUSC-MCSCC-0004
       
   162 @SYMComponent  telephony_ctsy
       
   163 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::NotifyCallServiceCapsChange
       
   164 @SYMTestPriority High
       
   165 @SYMTestActions Invokes multiple client requests to RMobilePhone::NotifyCallServiceCapsChange
       
   166 @SYMTestExpectedResults Pass
       
   167 @SYMTestType CT
       
   168 */
       
   169 void CCTsySupplementaryServiceCapsFU::TestNotifyCallServiceCapsChange0004L()
       
   170 	{
       
   171 
       
   172 					
       
   173 	OpenEtelServerL(EUseExtendedError);
       
   174 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   175 	OpenPhoneL();
       
   176 
       
   177 	// Open second client
       
   178 	RTelServer telServer2;
       
   179 	TInt ret = telServer2.Connect();
       
   180 	ASSERT_EQUALS(KErrNone, ret);
       
   181 	CleanupClosePushL(telServer2);
       
   182 
       
   183 	RMobilePhone phone2;
       
   184 	ret = phone2.Open(telServer2, KMmTsyPhoneName);
       
   185 	ASSERT_EQUALS(KErrNone, ret);
       
   186 	CleanupClosePushL(phone2);
       
   187 
       
   188 	TUint32 completeCaps(100);
       
   189 	TPckg<TUint32> pckgCaps(completeCaps);
       
   190 	
       
   191 	//-------------------------------------------------------------------------
       
   192 	// Test A: Test multiple clients requesting RMobilePhone::NotifyCallServiceCapsChange
       
   193  	//-------------------------------------------------------------------------
       
   194 
       
   195 	TRequestStatus reqStatus;
       
   196 	TUint32 caps(0);
       
   197 	iPhone.NotifyCallServiceCapsChange(reqStatus, caps);
       
   198 	
       
   199 	TRequestStatus reqStatus2;
       
   200 	TUint32 caps2(0);
       
   201 	phone2.NotifyCallServiceCapsChange(reqStatus2, caps2);
       
   202 	
       
   203 	iMockLTSY.CompleteL(EMobilePhoneNotifyCallServiceCapsChange, KErrNone, pckgCaps);
       
   204 
       
   205 	User::WaitForRequest(reqStatus);
       
   206 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   207 
       
   208 	User::WaitForRequest(reqStatus2);
       
   209 	ASSERT_EQUALS(KErrNone, reqStatus2.Int());
       
   210 	AssertMockLtsyStatusL();
       
   211 
       
   212 	ASSERT_EQUALS( completeCaps, caps );
       
   213 	ASSERT_EQUALS( completeCaps, caps2 );	
       
   214 	
       
   215 	// Done !
       
   216 	CleanupStack::PopAndDestroy(3, this); // phone2, telServer2, this
       
   217 
       
   218 	}