diff -r 000000000000 -r 3553901f7fa8 telephonyserverplugins/common_tsy/test/component/src/cctsysupplementaryservicecapsfu.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/telephonyserverplugins/common_tsy/test/component/src/cctsysupplementaryservicecapsfu.cpp Tue Feb 02 01:41:59 2010 +0200 @@ -0,0 +1,218 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// The TEFUnit test suite for SupplementaryServiceCaps in the Common TSY. +// +// + +/** + @file +*/ + +#include "cctsysupplementaryservicecapsfu.h" +#include +#include +#include +#include +#include +#include "tmockltsydata.h" +#include + +CTestSuite* CCTsySupplementaryServiceCapsFU::CreateSuiteL(const TDesC& aName) + { + SUB_SUITE; + + ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServiceCapsFU, TestGetCallServiceCaps0001L); + ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServiceCapsFU, TestNotifyCallServiceCapsChange0001L); + ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServiceCapsFU, TestNotifyCallServiceCapsChange0002L); + ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServiceCapsFU, TestNotifyCallServiceCapsChange0004L); + + END_SUITE; + } + + +// +// Actual test cases +// + + +/** +@SYMTestCaseID BA-CTSY-SUSC-MGCSC-0001 +@SYMComponent telephony_ctsy +@SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetCallServiceCaps +@SYMTestPriority High +@SYMTestActions Invokes RMobilePhone::GetCallServiceCaps +@SYMTestExpectedResults Pass +@SYMTestType CT +*/ +void CCTsySupplementaryServiceCapsFU::TestGetCallServiceCaps0001L() + { + + OpenEtelServerL(EUseExtendedError); + CleanupStack::PushL(TCleanupItem(Cleanup,this)); + OpenPhoneL(); + + //------------------------------------------------------------------------- + // TEST C: Successful completion request of + // RMobilePhone::GetCallServiceCaps. + //------------------------------------------------------------------------- + + TUint32 caps; + TInt res = iPhone.GetCallServiceCaps(caps); + ASSERT_EQUALS(KErrNone, res); + + // only return value at this moment is KMultimodeTsyGsmCallServiceCaps + ASSERT_EQUALS(KMultimodeTsyGsmCallServiceCaps, caps); + + AssertMockLtsyStatusL(); + CleanupStack::PopAndDestroy(this); + + } + + +/** +@SYMTestCaseID BA-CTSY-SUSC-MCSCC-0001 +@SYMComponent telephony_ctsy +@SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyCallServiceCapsChange +@SYMTestPriority High +@SYMTestActions Invokes RMobilePhone::NotifyCallServiceCapsChange +@SYMTestExpectedResults Pass +@SYMTestType CT +*/ +void CCTsySupplementaryServiceCapsFU::TestNotifyCallServiceCapsChange0001L() + { + + OpenEtelServerL(EUseExtendedError); + CleanupStack::PushL(TCleanupItem(Cleanup,this)); + OpenPhoneL(); + + TUint32 completeCaps(100); + TPckg pckgCaps(completeCaps); + + //------------------------------------------------------------------------- + // TEST C: Successful completion request of + // RMobilePhone::NotifyCallServiceCapsChange when result is not cached. + //------------------------------------------------------------------------- + + TRequestStatus reqStatus; + TUint32 caps(0); + iPhone.NotifyCallServiceCapsChange(reqStatus, caps); + + iMockLTSY.CompleteL(EMobilePhoneNotifyCallServiceCapsChange, KErrNone, pckgCaps); + + User::WaitForRequest(reqStatus); + ASSERT_EQUALS(KErrNone, reqStatus.Int()); + AssertMockLtsyStatusL(); + + ASSERT_EQUALS( completeCaps, caps ); + + CleanupStack::PopAndDestroy(this); + + } + + +/** +@SYMTestCaseID BA-CTSY-SUSC-MCSCC-0002 +@SYMComponent telephony_ctsy +@SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::NotifyCallServiceCapsChange +@SYMTestPriority High +@SYMTestActions Invokes cancelling of RMobilePhone::NotifyCallServiceCapsChange +@SYMTestExpectedResults Pass +@SYMTestType CT +*/ +void CCTsySupplementaryServiceCapsFU::TestNotifyCallServiceCapsChange0002L() + { + + OpenEtelServerL(EUseExtendedError); + CleanupStack::PushL(TCleanupItem(Cleanup,this)); + OpenPhoneL(); + + //------------------------------------------------------------------------- + // Test cancelling of RMobilePhone::NotifyCallServiceCapsChange + //------------------------------------------------------------------------- + + TRequestStatus reqStatus; + TUint32 caps(0); + iPhone.NotifyCallServiceCapsChange(reqStatus, caps); + + iPhone.CancelAsyncRequest(EMobilePhoneNotifyCallServiceCapsChange); + + User::WaitForRequest(reqStatus); + ASSERT_EQUALS(KErrCancel, reqStatus.Int()); + AssertMockLtsyStatusL(); + + AssertMockLtsyStatusL(); + CleanupStack::PopAndDestroy(this); + + } + + +/** +@SYMTestCaseID BA-CTSY-SUSC-MCSCC-0004 +@SYMComponent telephony_ctsy +@SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::NotifyCallServiceCapsChange +@SYMTestPriority High +@SYMTestActions Invokes multiple client requests to RMobilePhone::NotifyCallServiceCapsChange +@SYMTestExpectedResults Pass +@SYMTestType CT +*/ +void CCTsySupplementaryServiceCapsFU::TestNotifyCallServiceCapsChange0004L() + { + + + OpenEtelServerL(EUseExtendedError); + CleanupStack::PushL(TCleanupItem(Cleanup, this)); + OpenPhoneL(); + + // Open second client + RTelServer telServer2; + TInt ret = telServer2.Connect(); + ASSERT_EQUALS(KErrNone, ret); + CleanupClosePushL(telServer2); + + RMobilePhone phone2; + ret = phone2.Open(telServer2, KMmTsyPhoneName); + ASSERT_EQUALS(KErrNone, ret); + CleanupClosePushL(phone2); + + TUint32 completeCaps(100); + TPckg pckgCaps(completeCaps); + + //------------------------------------------------------------------------- + // Test A: Test multiple clients requesting RMobilePhone::NotifyCallServiceCapsChange + //------------------------------------------------------------------------- + + TRequestStatus reqStatus; + TUint32 caps(0); + iPhone.NotifyCallServiceCapsChange(reqStatus, caps); + + TRequestStatus reqStatus2; + TUint32 caps2(0); + phone2.NotifyCallServiceCapsChange(reqStatus2, caps2); + + iMockLTSY.CompleteL(EMobilePhoneNotifyCallServiceCapsChange, KErrNone, pckgCaps); + + User::WaitForRequest(reqStatus); + ASSERT_EQUALS(KErrNone, reqStatus.Int()); + + User::WaitForRequest(reqStatus2); + ASSERT_EQUALS(KErrNone, reqStatus2.Int()); + AssertMockLtsyStatusL(); + + ASSERT_EQUALS( completeCaps, caps ); + ASSERT_EQUALS( completeCaps, caps2 ); + + // Done ! + CleanupStack::PopAndDestroy(3, this); // phone2, telServer2, this + + }