1 /* |
|
2 * Copyright (c) 2004 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 |
|
19 // CLASS HEADER |
|
20 #include "UT_CMusAvaSipprofileAvailability.h" |
|
21 #include "musavaavailabilityobserver.h" |
|
22 #include "musavaavailabilityobserverimp.h" |
|
23 #include "musavaavailability.h" |
|
24 #include "muslogger.h" |
|
25 #include "musavaobserver.h" |
|
26 #include "musavaobserverimp.h" |
|
27 #include "musavadefaultimp.h" |
|
28 #include "musavaobserverimp.h" |
|
29 #include "musavasharedobject.h" |
|
30 #include "mussettingskeys.h" |
|
31 #include "mussettings.h" |
|
32 |
|
33 // EXTERNAL INCLUDES |
|
34 #include <digia/eunit/eunitmacros.h> |
|
35 #include <e32base.h> |
|
36 //#include <telephonyinternalpskeys.h> |
|
37 #include <etelmm.h> |
|
38 #include <rconnmon.h> |
|
39 |
|
40 |
|
41 |
|
42 // INTERNAL INCLUDES |
|
43 #include "musavasipprofileavailability.h" |
|
44 |
|
45 |
|
46 |
|
47 // CONSTRUCTION |
|
48 UT_CMusAvaSipprofileAvailability* UT_CMusAvaSipprofileAvailability::NewL() |
|
49 { |
|
50 UT_CMusAvaSipprofileAvailability* self = UT_CMusAvaSipprofileAvailability::NewLC(); |
|
51 CleanupStack::Pop(); |
|
52 |
|
53 return self; |
|
54 } |
|
55 |
|
56 UT_CMusAvaSipprofileAvailability* UT_CMusAvaSipprofileAvailability::NewLC() |
|
57 { |
|
58 UT_CMusAvaSipprofileAvailability* self = new( ELeave ) UT_CMusAvaSipprofileAvailability(); |
|
59 CleanupStack::PushL( self ); |
|
60 |
|
61 self->ConstructL(); |
|
62 |
|
63 return self; |
|
64 } |
|
65 |
|
66 // Destructor (virtual by CBase) |
|
67 UT_CMusAvaSipprofileAvailability::~UT_CMusAvaSipprofileAvailability() |
|
68 { |
|
69 } |
|
70 |
|
71 // Default constructor |
|
72 UT_CMusAvaSipprofileAvailability::UT_CMusAvaSipprofileAvailability() |
|
73 { |
|
74 } |
|
75 |
|
76 // Second phase construct |
|
77 void UT_CMusAvaSipprofileAvailability::ConstructL() |
|
78 { |
|
79 // The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
80 // It generates the test case table. |
|
81 CEUnitTestSuiteClass::ConstructL(); |
|
82 } |
|
83 |
|
84 // METHODS |
|
85 |
|
86 |
|
87 |
|
88 void UT_CMusAvaSipprofileAvailability::SetupL( ) |
|
89 { |
|
90 iAvailabilityObserver = CMusAvaAvailabilityObserverImp::NewL(); |
|
91 iSipprofileAvailability = CMusAvaSipprofileAvailability::NewL( *iAvailabilityObserver ); |
|
92 } |
|
93 |
|
94 void UT_CMusAvaSipprofileAvailability::Teardown( ) |
|
95 { |
|
96 delete iAvailabilityObserver; |
|
97 iAvailabilityObserver = NULL; |
|
98 delete iSipprofileAvailability; |
|
99 iSipprofileAvailability = NULL; |
|
100 } |
|
101 |
|
102 void UT_CMusAvaSipprofileAvailability::UT_CMusAvaSipprofileAvailability_NewLL() |
|
103 { |
|
104 EUNIT_ASSERT( iSipprofileAvailability ); |
|
105 } |
|
106 |
|
107 void UT_CMusAvaSipprofileAvailability::UT_CMusAvaSipprofileAvailability_IsProfileExistL() |
|
108 { |
|
109 TBool val = iSipprofileAvailability->IsProfileExist(); |
|
110 EUNIT_ASSERT( val == ETrue ); |
|
111 } |
|
112 |
|
113 void UT_CMusAvaSipprofileAvailability::UT_CMusAvaSipprofileAvailability_StopL() |
|
114 { |
|
115 iSipprofileAvailability->Stop(); |
|
116 EUNIT_ASSERT( iSipprofileAvailability->State() == MMusAvaObserver::EMusAvaStatusNotExecuted ); |
|
117 |
|
118 TRAPD( error, iSipprofileAvailability->DoExecuteL() ); |
|
119 if ( error == KErrNoMemory ) User::Leave( error ); |
|
120 EUNIT_ASSERT ( error == KErrNone ); |
|
121 |
|
122 iSipprofileAvailability->Stop(); |
|
123 EUNIT_ASSERT( iSipprofileAvailability->State() == MMusAvaObserver::EMusAvaStatusNotExecuted ); |
|
124 } |
|
125 |
|
126 void UT_CMusAvaSipprofileAvailability::UT_CMusAvaSipprofileAvailability_NameL() |
|
127 { |
|
128 EUNIT_ASSERT( iSipprofileAvailability->Name() == MMusAvaObserver::EMusAvaNameSipprofileExist ); |
|
129 } |
|
130 |
|
131 void UT_CMusAvaSipprofileAvailability::UT_CMusAvaSipprofileAvailability_DoExecuteLL() |
|
132 { |
|
133 TRAPD( error, iSipprofileAvailability->DoExecuteL() ); |
|
134 if ( error == KErrNoMemory ) User::Leave( error ); |
|
135 EUNIT_ASSERT ( error == KErrNone ); |
|
136 |
|
137 EUNIT_ASSERT( iSipprofileAvailability->State() == MMusAvaObserver::EMusAvaStatusAvailable ); |
|
138 } |
|
139 |
|
140 |
|
141 // TEST TABLE |
|
142 |
|
143 EUNIT_BEGIN_TEST_TABLE( |
|
144 UT_CMusAvaSipprofileAvailability, |
|
145 "CMusAvaSipprofileAvailability", |
|
146 "UNIT" ) |
|
147 |
|
148 EUNIT_TEST( |
|
149 "NewL - test ", |
|
150 "CMusAvaSipprofileAvailability", |
|
151 "NewL", |
|
152 "FUNCTIONALITY", |
|
153 SetupL, UT_CMusAvaSipprofileAvailability_NewLL, Teardown) |
|
154 |
|
155 EUNIT_TEST( |
|
156 "IsProfileExist - test ", |
|
157 "CMusAvaSipprofileAvailability", |
|
158 "IsProfileExist", |
|
159 "FUNCTIONALITY", |
|
160 SetupL, UT_CMusAvaSipprofileAvailability_IsProfileExistL, Teardown) |
|
161 |
|
162 EUNIT_TEST( |
|
163 "Stop - test ", |
|
164 "CMusAvaSipprofileAvailability", |
|
165 "Stop", |
|
166 "FUNCTIONALITY", |
|
167 SetupL, UT_CMusAvaSipprofileAvailability_StopL, Teardown) |
|
168 |
|
169 EUNIT_TEST( |
|
170 "Name - test ", |
|
171 "CMusAvaSipprofileAvailability", |
|
172 "Name", |
|
173 "FUNCTIONALITY", |
|
174 SetupL, UT_CMusAvaSipprofileAvailability_NameL, Teardown) |
|
175 |
|
176 EUNIT_TEST( |
|
177 "DoExecuteL - test ", |
|
178 "CMusAvaSipprofileAvailability", |
|
179 "DoExecuteL", |
|
180 "FUNCTIONALITY", |
|
181 SetupL, UT_CMusAvaSipprofileAvailability_DoExecuteLL, Teardown) |
|
182 |
|
183 |
|
184 EUNIT_END_TEST_TABLE |
|
185 |
|
186 // END OF FILE |
|