telephonyserver/etelmultimode/TETEL/te_EtelMM/TE_mmconference.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 //
       
    15 
       
    16 #include <e32test.h>
       
    17 
       
    18 #include "TE_EtelMMTestStepBase.h"
       
    19 #include "TE_mmconference.h"
       
    20 #include "testdef.h"
       
    21 
       
    22 CTestConferenceCall::CTestConferenceCall()
       
    23 /** Each test step initialises it's own name
       
    24 */
       
    25 	{
       
    26 	// store the name of this test case
       
    27 	// this is the name that is used by the script file
       
    28 	SetTestStepName(_L("TestConferenceCall"));
       
    29 	}
       
    30 
       
    31 enum TVerdict CTestConferenceCall::doTestStepL()
       
    32 	{
       
    33 	iTestCount=1;
       
    34 	INFO_PRINTF1(_L(""));
       
    35 	INFO_PRINTF1(_L("Test Mobile Phone Conference Call Functionality"));
       
    36 //	LOGTEXT(_L8("Test Mobile Phone Conference Call Functionality"));
       
    37 	
       
    38 	RMobilePhone mmPhone;
       
    39 	TInt ret=mmPhone.Open(iTelServer,DMMTSY_PHONE_NAME);
       
    40 	TEST(ret==KErrNone);
       
    41 
       
    42 	RMobileConferenceCall cc;
       
    43 	cc.Open(mmPhone);
       
    44 	
       
    45 	TRequestStatus reqStatus;
       
    46 
       
    47 	TUint32 caps, asyncCaps;
       
    48 
       
    49 	cc.GetCaps(caps);
       
    50 	TEST(caps == DMMTSY_CONFERENCE_CAPS);
       
    51 
       
    52 	INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::GetCaps (sync) passed"), iTestCount++);
       
    53 
       
    54 	cc.NotifyCapsChange(reqStatus,asyncCaps);
       
    55 	User::WaitForRequest(reqStatus);
       
    56 	TEST(reqStatus.Int() == KErrNone);
       
    57 	TEST(asyncCaps == DMMTSY_CONFERENCE_CAPS);
       
    58 
       
    59 	cc.NotifyCapsChange(reqStatus,caps);
       
    60 	cc.CancelAsyncRequest(EMobileConferenceCallNotifyCapsChange);
       
    61 	User::WaitForRequest(reqStatus);
       
    62 	TEST(reqStatus.Int() == KErrNone || reqStatus.Int() == KErrCancel);
       
    63 	if (reqStatus.Int() == KErrCancel)
       
    64 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::NotifyCapsChange (async & cancel (Cancelled Request) passed"), iTestCount++);
       
    65 	else
       
    66 		{
       
    67 		TEST(asyncCaps == DMMTSY_CONFERENCE_CAPS);
       
    68 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::NotifyCapsChange (async & cancel (Request Not Cancelled) passed"), iTestCount++);
       
    69 		}
       
    70 
       
    71 	cc.CreateConference(reqStatus);
       
    72 	User::WaitForRequest(reqStatus);
       
    73 	TEST(reqStatus.Int() == KErrNone);
       
    74 
       
    75 	cc.CreateConference(reqStatus);
       
    76 	cc.CancelAsyncRequest(EMobileConferenceCallCreateConference);
       
    77 	User::WaitForRequest(reqStatus);
       
    78 	TEST(reqStatus.Int() == KErrNone || reqStatus.Int() == KErrCancel);
       
    79 	if (reqStatus.Int() == KErrCancel)
       
    80 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::CreateConference (async & cancel (Cancelled Request) passed"), iTestCount++);
       
    81 	else
       
    82 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::CreateConference (async & cancel (Request Not Cancelled) passed"), iTestCount++);
       
    83 	
       
    84 
       
    85 	TName callName = DMMTSY_CONFERENCE_CALL_NAME;
       
    86 	cc.AddCall(reqStatus,callName);
       
    87 	User::WaitForRequest(reqStatus);
       
    88 	TEST(reqStatus.Int() == KErrNone);
       
    89 
       
    90 	cc.AddCall(reqStatus,callName);
       
    91 	cc.CancelAsyncRequest(EMobileConferenceCallAddCall);
       
    92 	User::WaitForRequest(reqStatus);
       
    93 	TEST(reqStatus.Int() == KErrNone || reqStatus.Int() == KErrCancel);
       
    94 	if (reqStatus.Int() == KErrCancel)
       
    95 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::AddCall (async & cancel (Cancelled Request) passed"), iTestCount++);
       
    96 	else
       
    97 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::AllCall (async & cancel (Request Not Cancelled) passed"), iTestCount++);
       
    98 
       
    99 
       
   100 	cc.Swap(reqStatus);
       
   101 	User::WaitForRequest(reqStatus);
       
   102 	TEST(reqStatus.Int() == KErrNone);
       
   103 
       
   104 	cc.Swap(reqStatus);
       
   105 	cc.CancelAsyncRequest(EMobileConferenceCallSwap);
       
   106 	User::WaitForRequest(reqStatus);
       
   107 	TEST(reqStatus.Int() == KErrNone || reqStatus.Int() == KErrCancel);
       
   108 	if (reqStatus.Int() == KErrCancel)
       
   109 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::Swap (async & cancel (Cancelled Request) passed"), iTestCount++);
       
   110 	else
       
   111 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::Swap (async & cancel (Request Not Cancelled) passed"), iTestCount++);
       
   112 
       
   113 
       
   114 	cc.HangUp(reqStatus);
       
   115 	User::WaitForRequest(reqStatus);
       
   116 	TEST(reqStatus.Int() == KErrNone);
       
   117 
       
   118 	cc.HangUp(reqStatus);
       
   119 	cc.CancelAsyncRequest(EMobileConferenceCallHangUp);
       
   120 	User::WaitForRequest(reqStatus);
       
   121 	TEST(reqStatus.Int() == KErrNone || reqStatus.Int() == KErrCancel);
       
   122 	if (reqStatus.Int() == KErrCancel)
       
   123 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::HangUp (async & cancel (Cancelled Request) passed"), iTestCount++);
       
   124 	else
       
   125 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::HangUp (async & cancel (Request Not Cancelled) passed"), iTestCount++);
       
   126 
       
   127 
       
   128 	TInt calls;
       
   129 	TEST(cc.EnumerateCalls(calls) == KErrNone);
       
   130 	TEST(calls == DMMTSY_CONFERENCE_CALL_COUNT);
       
   131 	INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::EnumerateCalls (sync) passed"), iTestCount++);
       
   132 
       
   133 	RMobileCall::TMobileCallInfoV1 call;
       
   134 	RMobileCall::TMobileCallInfoV1Pckg callPckg(call);
       
   135 
       
   136 	TEST(cc.GetMobileCallInfo(DMMTSY_CONFERENCE_CALL_INDEX,callPckg) == KErrNone);
       
   137 	TEST(call.iCallName.Compare(DMMTSY_CONFERENCE_CALL_NAME) == 0);
       
   138 	TEST(call.iLineName.Compare(DMMTSY_CONFERENCE_CALL_LINE) == 0);
       
   139 
       
   140 	INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::GetMobileCallInfo (sync) passed"), iTestCount++);
       
   141 
       
   142 	RMobileConferenceCall::TMobileConferenceStatus callStatus, asyncCallStatus;
       
   143 
       
   144 	TEST(cc.GetConferenceStatus(callStatus) == KErrNone);
       
   145 	TEST(callStatus == DMMTSY_CONFERENCE_CALL_STATUS);
       
   146 	INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::GetConferenceStatus (sync) passed"), iTestCount++);
       
   147 
       
   148 	cc.NotifyConferenceStatusChange(reqStatus,asyncCallStatus);
       
   149 	User::WaitForRequest(reqStatus);
       
   150 	TEST(reqStatus.Int() == KErrNone);
       
   151 	TEST(asyncCallStatus == DMMTSY_CONFERENCE_CALL_STATUS);
       
   152 
       
   153 	cc.NotifyConferenceStatusChange(reqStatus,asyncCallStatus);
       
   154 	cc.CancelAsyncRequest(EMobileConferenceCallNotifyConferenceStatusChange);
       
   155 	User::WaitForRequest(reqStatus);
       
   156 	TEST(reqStatus.Int() == KErrNone || reqStatus.Int() == KErrCancel);
       
   157 	if (reqStatus.Int() == KErrCancel)
       
   158 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::NotifyConferenceStatusChange (async & cancel (Cancelled Request) passed"), iTestCount++);
       
   159 	else
       
   160 		{
       
   161 		TEST(asyncCallStatus == DMMTSY_CONFERENCE_CALL_STATUS);
       
   162 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::NotifyConferenceStatusChange (async & cancel (Request Not Cancelled) passed"), iTestCount++);
       
   163 		}
       
   164 
       
   165 	RMobileConferenceCall::TMobileConferenceEvent event;
       
   166 	TName eventName; 
       
   167 
       
   168 	cc.NotifyConferenceEvent(reqStatus,event,eventName);
       
   169 	User::WaitForRequest(reqStatus);
       
   170 	TEST(reqStatus.Int() == KErrNone);
       
   171 	TEST(event == DMMTSY_CONFERENCE_CALL_EVENT);
       
   172 	TEST(eventName.Compare(DMMTSY_CONFERENCE_CALL_NAME) == 0);
       
   173 
       
   174 	cc.NotifyConferenceEvent(reqStatus,event,eventName);
       
   175 	cc.CancelAsyncRequest(EMobileConferenceCallNotifyConferenceEvent);
       
   176 	User::WaitForRequest(reqStatus);
       
   177 	TEST(reqStatus.Int() == KErrNone || reqStatus.Int() == KErrCancel);
       
   178 	if (reqStatus.Int() == KErrCancel)
       
   179 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::NotifyConferenceEvent (async & cancel (Cancelled Request) passed"), iTestCount++);
       
   180 	else
       
   181 		{
       
   182 		TEST(event == DMMTSY_CONFERENCE_CALL_EVENT);
       
   183 		TEST(eventName.Compare(DMMTSY_CONFERENCE_CALL_NAME) == 0);
       
   184 		INFO_PRINTF2(_L("Test %d - RMobileConferenceCall::NotifyConferenceEvent (async & cancel (Request Not Cancelled) passed"), iTestCount++);
       
   185 		}
       
   186 
       
   187 	cc.Close();
       
   188 	mmPhone.Close();
       
   189 	INFO_PRINTF1(_L(""));
       
   190 
       
   191 	return TestStepResult();
       
   192 	}