telephonyserverplugins/simtsy/test/Te_Sim/Te_SimCallOpenTest.cpp
changeset 0 3553901f7fa8
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 //
       
    15 
       
    16 #include "Te_SimCallOpenTest.h"
       
    17 
       
    18 CSimCallOpenTest::CSimCallOpenTest() 
       
    19 	{ 
       
    20 	SetTestStepName(_L("CallOpenTest"));
       
    21 	}
       
    22 
       
    23 TVerdict CSimCallOpenTest::doTestStepL()
       
    24 	{
       
    25 	INFO_PRINTF1(_L("BeginCallOpenTest"));
       
    26 
       
    27  	CreateConfigFileL(_L("c:\\config3.txt"));
       
    28  	SetTestNumberL(0);
       
    29 
       
    30 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
    31 	INFO_PRINTF2(_L("Result: %d"),ret); 
       
    32 	TESTL(ret == KErrNone); 
       
    33 	INFO_PRINTF1(_L("Opened phone object"));
       
    34 
       
    35 	TESTL(iPhone.Initialise()==KErrNone);
       
    36 	INFO_PRINTF1(_L("Opened phone object"));
       
    37 
       
    38 	TESTL(iLine.Open(iPhone,KVoiceLineName)==KErrNone);
       
    39 	INFO_PRINTF1(_L("Opened Line object"));
       
    40 
       
    41 	INFO_PRINTF1(_L("Testing openning two voice call objects in sequence"));
       
    42 	TName callName;
       
    43 	TName callName2;
       
    44 	TESTL(iCall.OpenNewCall(iLine,callName)==KErrNone);
       
    45 	iCall.Close();
       
    46 	TESTL(iCall2.OpenNewCall(iLine,callName2)==KErrNone);
       
    47 	iCall2.Close();
       
    48 
       
    49 	INFO_PRINTF1(_L("Testing openning two voice call objects in parallel"));
       
    50 	TESTL(iCall.OpenNewCall(iLine,callName)==KErrNone);
       
    51 	TESTL(iCall2.OpenNewCall(iLine,callName2)==KErrNone);
       
    52 	iCall.Close();
       
    53 	iCall2.Close();
       
    54 
       
    55 	INFO_PRINTF1(_L("Testing posting Answering Incoming Call, Cancelling and then Simulating an Incoming Call."));
       
    56 	TESTL(iCall.OpenNewCall(iLine,callName)==KErrNone);
       
    57 	TRequestStatus stat0;
       
    58 	iCall.AnswerIncomingCall(stat0);
       
    59 	User::After(1000000L);
       
    60 	iCall.AnswerIncomingCallCancel();
       
    61 	User::WaitForRequest(stat0);
       
    62 	TESTL(stat0==KErrCancel);
       
    63 
       
    64 	TName incomingCallName;
       
    65 	iLine.NotifyIncomingCall(stat0,incomingCallName);
       
    66 	
       
    67 	TInt state = 998;
       
    68 	RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyIncomingVoiceCall, state);
       
    69 	User::WaitForRequest(stat0);
       
    70 	TESTL(stat0==0);
       
    71 	TESTL(iCall2.OpenExistingCall(iLine,incomingCallName)==KErrNone);
       
    72 	INFO_PRINTF1(_L("\t...Answering Call"));
       
    73 	iCall2.AnswerIncomingCall(stat0);
       
    74 	User::WaitForRequest(stat0);
       
    75 	TESTL(stat0==KErrNone);
       
    76 	INFO_PRINTF1(_L("\t...HangingUp Call"));
       
    77 	TESTL(iCall2.HangUp()==KErrNone);
       
    78 	iCall2.Close();
       
    79 	iCall.Close();
       
    80 
       
    81 	iLine.Close();
       
    82 	iPhone.Close();
       
    83 	ASSERT(RThread().RequestCount()==0);
       
    84 
       
    85 	return TestStepResult();
       
    86 	}
       
    87