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: Monitors the Kodiak Phone Call |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <e32property.h> |
|
21 #include <CTSYDomainPSKeys.h> |
|
22 #include <digia/eunit/eunitmacros.h> |
|
23 #include "muspttcallmonitor.h" |
|
24 #include "ut_muspttcallmonitor.h" |
|
25 |
|
26 #pragma warn_illtokenpasting off |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // Symbian two-phase constructor. |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 UT_CMusPTTCallMonitor* UT_CMusPTTCallMonitor::NewLC() |
|
33 { |
|
34 UT_CMusPTTCallMonitor* self = new (ELeave) UT_CMusPTTCallMonitor(); |
|
35 CleanupStack::PushL( self ); |
|
36 self->ConstructL(); |
|
37 return self; |
|
38 } |
|
39 |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // Symbian second-phase constructor. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 void UT_CMusPTTCallMonitor::ConstructL() |
|
46 { |
|
47 CEUnitTestSuiteClass::ConstructL(); |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // C++ constructor. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 UT_CMusPTTCallMonitor::UT_CMusPTTCallMonitor() |
|
55 : CEUnitTestSuiteClass() |
|
56 { |
|
57 // nothing |
|
58 } |
|
59 |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // C++ destructor. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 UT_CMusPTTCallMonitor::~UT_CMusPTTCallMonitor() |
|
66 { |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 void UT_CMusPTTCallMonitor::UT_RunLL() |
|
74 { |
|
75 |
|
76 iMonitor->RunL(); |
|
77 iMonitor->Cancel(); |
|
78 EUNIT_ASSERT( iMonitor->IsPTTCallExist()); |
|
79 |
|
80 // case 2. |
|
81 iMonitor->iPropertyEvent.iPValue = EPSCTsyKodiakPttNotActive; |
|
82 iMonitor->RunL(); |
|
83 iMonitor->Cancel(); |
|
84 EUNIT_ASSERT( !iMonitor->IsPTTCallExist() ); |
|
85 |
|
86 // case 3 |
|
87 iMonitor->iPropertyEvent.iPValue = EPSCTsyKodiakPttActive; |
|
88 iMonitor->RunL(); |
|
89 iMonitor->Cancel(); |
|
90 EUNIT_ASSERT( iMonitor->IsPTTCallExist() ); |
|
91 |
|
92 } |
|
93 |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 void UT_CMusPTTCallMonitor::UT_IsPTTCallExistL() |
|
100 { |
|
101 iMonitor->iPropertyEvent.iPValue = EPSCTsyKodiakPttNotActive; |
|
102 EUNIT_ASSERT( !iMonitor->IsPTTCallExist()); |
|
103 |
|
104 iMonitor->iPropertyEvent.iPValue = EPSCTsyKodiakPttActive; |
|
105 EUNIT_ASSERT( iMonitor->IsPTTCallExist()); |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 void UT_CMusPTTCallMonitor::UT_DoCancelL() |
|
113 { |
|
114 iMonitor->Cancel(); |
|
115 EUNIT_ASSERT(!iMonitor->IsActive()); |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 void UT_CMusPTTCallMonitor::SetupL() |
|
123 { |
|
124 iMonitor = CMusPttCallMonitor::NewL(*this); |
|
125 iMonitor->Cancel(); |
|
126 } |
|
127 |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 void UT_CMusPTTCallMonitor::Teardown() |
|
134 { |
|
135 delete iMonitor; |
|
136 } |
|
137 |
|
138 // test table |
|
139 |
|
140 EUNIT_BEGIN_TEST_TABLE( |
|
141 UT_CMusPTTCallMonitor, |
|
142 "UT_CMusPTTCallMonitor", |
|
143 "UNIT" ) |
|
144 |
|
145 EUNIT_TEST( |
|
146 "RunL - test", |
|
147 "CMusPTTCallMonitor", |
|
148 "RunL", |
|
149 "FUNCTIONALITY", |
|
150 SetupL, UT_RunLL, Teardown) |
|
151 |
|
152 EUNIT_TEST( |
|
153 "IsPTTCallExist - test", |
|
154 "CMusPTTCallMonitor", |
|
155 "IsPTTCallExist", |
|
156 "FUNCTIONALITY", |
|
157 SetupL, UT_IsPTTCallExistL, Teardown) |
|
158 |
|
159 EUNIT_TEST( |
|
160 "DoCancel - test", |
|
161 "CMusPTTCallMonitor", |
|
162 "DoCancel", |
|
163 "FUNCTIONALITY", |
|
164 SetupL, UT_DoCancelL, Teardown) |
|
165 |
|
166 EUNIT_END_TEST_TABLE |
|
167 |
|