74
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "ut_cphsingleandcallsetupandwait.h"
|
|
19 |
#include <EUnitMacros.h>
|
|
20 |
#include <EUnitDecorators.h>
|
|
21 |
#include <featmgr.h>
|
|
22 |
#include "CPhoneSingleAndCallSetupAndWaiting.h"
|
|
23 |
#include "PEVirtualEngine.h"
|
|
24 |
#include "CPhoneViewControllerStub.h"
|
|
25 |
#include "CPhoneStateMachineStub.h"
|
|
26 |
#include "MPhoneKeyEvents.h"
|
|
27 |
#include "TPhoneCommandParam.h"
|
|
28 |
#include "CPhoneMainResourceResolver.h"
|
|
29 |
#include "phoneappcommands.hrh"
|
78
|
30 |
#include <csmcmockcontext.h>
|
|
31 |
#include <smcdefaultvalue.h>
|
|
32 |
#include <msmcmockspecbuilder.h>
|
|
33 |
#include <smcobjecttotypemapper.h>
|
|
34 |
#include <smcmacros.h>
|
|
35 |
#include <msmcmockaction.h>
|
74
|
36 |
|
|
37 |
|
|
38 |
// - Construction -----------------------------------------------------------
|
|
39 |
|
|
40 |
ut_cphsingleandcallsetupandwait* ut_cphsingleandcallsetupandwait::NewL()
|
|
41 |
{
|
|
42 |
ut_cphsingleandcallsetupandwait* self = ut_cphsingleandcallsetupandwait::NewLC();
|
|
43 |
CleanupStack::Pop();
|
|
44 |
return self;
|
|
45 |
}
|
|
46 |
|
|
47 |
ut_cphsingleandcallsetupandwait* ut_cphsingleandcallsetupandwait::NewLC()
|
|
48 |
{
|
|
49 |
ut_cphsingleandcallsetupandwait* self = new( ELeave ) ut_cphsingleandcallsetupandwait();
|
|
50 |
CleanupStack::PushL( self );
|
|
51 |
self->ConstructL();
|
|
52 |
return self;
|
|
53 |
}
|
|
54 |
|
|
55 |
ut_cphsingleandcallsetupandwait::~ut_cphsingleandcallsetupandwait()
|
|
56 |
{
|
78
|
57 |
CSmcMockContext::Release();
|
74
|
58 |
}
|
|
59 |
|
|
60 |
ut_cphsingleandcallsetupandwait::ut_cphsingleandcallsetupandwait()
|
|
61 |
{
|
|
62 |
}
|
|
63 |
|
|
64 |
void ut_cphsingleandcallsetupandwait::ConstructL()
|
|
65 |
{
|
|
66 |
CEUnitTestSuiteClass::ConstructL();
|
78
|
67 |
iMockContext = CSmcMockContext::InstanceL();
|
74
|
68 |
}
|
|
69 |
|
|
70 |
// - Test methods -----------------------------------------------------------
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
void ut_cphsingleandcallsetupandwait::SetupL( )
|
|
75 |
{
|
78
|
76 |
iMockContext->InitializeL();
|
74
|
77 |
iViewCommandHandle = CPhoneViewController::NewL();
|
|
78 |
iStateMachine = CPhoneStateMachineStub::NewL();
|
|
79 |
|
|
80 |
iStateSingleAndCallSetupAndWaiting = CPhoneSingleAndCallSetupAndWaiting::NewL(
|
|
81 |
iStateMachine, iViewCommandHandle, NULL );
|
|
82 |
|
|
83 |
}
|
|
84 |
|
|
85 |
|
|
86 |
void ut_cphsingleandcallsetupandwait::Teardown( )
|
|
87 |
{
|
|
88 |
delete CPhoneMainResourceResolver::Instance();
|
|
89 |
delete iStateSingleAndCallSetupAndWaiting;
|
|
90 |
delete iViewCommandHandle;
|
|
91 |
delete iStateMachine;
|
78
|
92 |
iMockContext->Reset();
|
74
|
93 |
}
|
|
94 |
|
|
95 |
// -----------------------------------------------------------------------------
|
|
96 |
// Test conference idle
|
|
97 |
// -check commands
|
|
98 |
// -----------------------------------------------------------------------------
|
|
99 |
//
|
|
100 |
void ut_cphsingleandcallsetupandwait::T_HandleIdleL( )
|
|
101 |
{
|
|
102 |
|
|
103 |
iViewCommandHandle->SetViewGetCountOfActiveCalls(1);
|
|
104 |
|
|
105 |
iStateSingleAndCallSetupAndWaiting->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, 0 );
|
|
106 |
|
|
107 |
iViewCommandHandle->VerifyViewCommand( EPhoneViewRemoveCallHeader );
|
|
108 |
|
|
109 |
}
|
|
110 |
|
|
111 |
// -----------------------------------------------------------------------------
|
|
112 |
// Test callsetup fail with reason remote busy.
|
|
113 |
// -check commands
|
|
114 |
// -----------------------------------------------------------------------------
|
|
115 |
//
|
|
116 |
void ut_cphsingleandcallsetupandwait::T_RemoteBusyL( )
|
|
117 |
{
|
|
118 |
// At the moment ut_cphsingleandcallsetupandwait uses cphonestatestub and because of this
|
|
119 |
// we cant check/verify EPhoneViewStopCapturingKey command since it is called from cphonestate
|
|
120 |
// and because test uses cphonestatestub+cphonestate.h(original) we cant check if CaptureKeysDuringCallNotificationL
|
|
121 |
// was called.
|
|
122 |
// When this test dll is transfered to use MOCK FW this case can be made fully functional.
|
|
123 |
/*iStateSingleAndCallSetupAndWaiting->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageRemoteBusy, 0 );
|
|
124 |
|
|
125 |
iViewCommandHandle->VerifyViewCommand( EPhoneViewStopCapturingKey ); */
|
|
126 |
}
|
|
127 |
|
|
128 |
// - EUnit test table -------------------------------------------------------
|
|
129 |
|
|
130 |
EUNIT_BEGIN_TEST_TABLE(
|
|
131 |
ut_cphsingleandcallsetupandwait,
|
|
132 |
"Add test suite description here.",
|
|
133 |
"UNIT" )
|
|
134 |
|
|
135 |
|
|
136 |
EUNIT_TEST(
|
|
137 |
"2- CPhoneSingleAndCallSetupAndWaiting: Test idle",
|
|
138 |
"",
|
|
139 |
"Test0",
|
|
140 |
"FUNCTIONALITY",
|
|
141 |
SetupL, T_HandleIdleL, Teardown )
|
|
142 |
|
|
143 |
/*EUNIT_TEST(
|
|
144 |
"3- CPhoneSingleAndCallSetupAndWaiting: Test remote busy",
|
|
145 |
"",
|
|
146 |
"Test0",
|
|
147 |
"FUNCTIONALITY",
|
|
148 |
SetupL, T_RemoteBusyL, Teardown ) */
|
|
149 |
|
|
150 |
EUNIT_END_TEST_TABLE
|