|
1 /* |
|
2 * Copyright (c) 2005-2006 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: Monitor that observes the status of the current CS call |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "ut_musconferencecallmonitor.h" |
|
20 #include "musconferencecallmonitor.h" |
|
21 |
|
22 /* |
|
23 #include "muscallmonitor.h" |
|
24 #include "muscalleventmonitor.h" |
|
25 #include "musaoplugin.h" |
|
26 #include "ut_muscalleventmonitor.h" |
|
27 #include "mussesseioninformationapi.h" |
|
28 */ |
|
29 |
|
30 #include <etelmm.h> |
|
31 #include <etel.h> |
|
32 #include <digia/eunit/eunitmacros.h> |
|
33 #include <e32property.h> |
|
34 |
|
35 |
|
36 #pragma warn_illtokenpasting off |
|
37 |
|
38 // Constants |
|
39 _LIT( KMusTestCallName , "Voice1"); |
|
40 |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // Symbian two-phase constructor. |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 UT_CMusConferenceCallMonitor* UT_CMusConferenceCallMonitor::NewLC() |
|
47 { |
|
48 UT_CMusConferenceCallMonitor* self = new (ELeave) UT_CMusConferenceCallMonitor(); |
|
49 CleanupStack::PushL( self ); |
|
50 self->ConstructL(); |
|
51 return self; |
|
52 } |
|
53 |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // Symbian second-phase constructor. |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 void UT_CMusConferenceCallMonitor::ConstructL() |
|
60 { |
|
61 CEUnitTestSuiteClass::ConstructL(); |
|
62 } |
|
63 |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // Observer function |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 void UT_CMusConferenceCallMonitor::StatusChanged() |
|
70 { |
|
71 // Function called flag |
|
72 iStatusChanged = ETrue; |
|
73 } |
|
74 |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // C++ constructor. |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 UT_CMusConferenceCallMonitor::UT_CMusConferenceCallMonitor() |
|
81 : CEUnitTestSuiteClass() |
|
82 { |
|
83 // nothing |
|
84 } |
|
85 |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // C++ destructor. |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 UT_CMusConferenceCallMonitor::~UT_CMusConferenceCallMonitor() |
|
92 { |
|
93 } |
|
94 |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 void UT_CMusConferenceCallMonitor::UT_RunL() |
|
101 { |
|
102 iStatusChanged = EFalse; |
|
103 iMonitor->RunL(); |
|
104 iMonitor->Cancel(); |
|
105 EUNIT_ASSERT( iStatusChanged ); |
|
106 } |
|
107 |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 void UT_CMusConferenceCallMonitor::UT_DoCancel() |
|
114 { |
|
115 iMonitor->DoCancel(); |
|
116 EUNIT_ASSERT(RTelHelper::GetCalledFunction() == |
|
117 RTelSubSessionBase::ECancelAsyncRequest ) |
|
118 } |
|
119 |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 void UT_CMusConferenceCallMonitor::UT_RunError() |
|
126 { |
|
127 EUNIT_ASSERT_EQUALS( iMonitor->RunError( KErrNone ), |
|
128 KErrNone ) |
|
129 // Make sure RunError handles the error compleatly and returns |
|
130 // KErrNone |
|
131 EUNIT_ASSERT( iMonitor->RunError( KErrGeneral ) == KErrNone ); |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 void UT_CMusConferenceCallMonitor::SetupL() |
|
139 { |
|
140 RMobilePhone phone; |
|
141 iMonitor = CMusConferenceCallMonitor::NewL( phone, *this ); |
|
142 iMonitor->Cancel(); |
|
143 } |
|
144 |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 void UT_CMusConferenceCallMonitor::Teardown() |
|
151 { |
|
152 delete iMonitor; |
|
153 |
|
154 } |
|
155 |
|
156 // test table |
|
157 |
|
158 EUNIT_BEGIN_TEST_TABLE( |
|
159 UT_CMusConferenceCallMonitor, |
|
160 "UT_CMusConferenceCallMonitor", |
|
161 "UNIT" ) |
|
162 |
|
163 EUNIT_TEST( |
|
164 "UT_RunL", |
|
165 "CMusCallEventMonitor", |
|
166 "RunL", |
|
167 "FUNCTIONALITY", |
|
168 SetupL, UT_RunL, Teardown) |
|
169 |
|
170 EUNIT_TEST( |
|
171 "UT_DoCancel", |
|
172 "CMusCallEventMonitor", |
|
173 "DoCancel", |
|
174 "FUNCTIONALITY", |
|
175 SetupL, UT_DoCancel, Teardown) |
|
176 |
|
177 EUNIT_TEST( |
|
178 "UT_RunError", |
|
179 "CMusCallEventMonitor", |
|
180 "RunError", |
|
181 "FUNCTIONALITY", |
|
182 SetupL, UT_RunError, Teardown) |
|
183 |
|
184 |
|
185 EUNIT_END_TEST_TABLE |