|
1 /* |
|
2 * Copyright (c) 2007 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: Unit test class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INTERNAL INCLUDES |
|
20 #include "ut_cmusavaclientresolverutil.h" |
|
21 #include "musavaclientresolverutil.h" |
|
22 #include "CSipSseTestTls.h" |
|
23 |
|
24 // SYSTEM INCLUDES |
|
25 #include <digia/eunit/eunitmacros.h> |
|
26 #include <centralrepository.h> |
|
27 #include <sipstrings.h> |
|
28 |
|
29 |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 UT_CMusAvaClientResolverUtil* UT_CMusAvaClientResolverUtil::NewL() |
|
36 { |
|
37 UT_CMusAvaClientResolverUtil* self = UT_CMusAvaClientResolverUtil::NewLC(); |
|
38 CleanupStack::Pop( self ); |
|
39 return self; |
|
40 } |
|
41 |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 UT_CMusAvaClientResolverUtil* UT_CMusAvaClientResolverUtil::NewLC() |
|
48 { |
|
49 UT_CMusAvaClientResolverUtil* self = new( ELeave ) UT_CMusAvaClientResolverUtil(); |
|
50 CleanupStack::PushL( self ); |
|
51 self->ConstructL(); |
|
52 return self; |
|
53 } |
|
54 |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 UT_CMusAvaClientResolverUtil::~UT_CMusAvaClientResolverUtil() |
|
61 { |
|
62 // NOP |
|
63 } |
|
64 |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // Default constructor |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 UT_CMusAvaClientResolverUtil::UT_CMusAvaClientResolverUtil() |
|
71 { |
|
72 // NOP |
|
73 } |
|
74 |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // Second phase construct |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void UT_CMusAvaClientResolverUtil::ConstructL() |
|
81 { |
|
82 // The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
83 // It generates the test case table. |
|
84 CEUnitTestSuiteClass::ConstructL(); |
|
85 } |
|
86 |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void UT_CMusAvaClientResolverUtil::SetupL() |
|
93 { |
|
94 TRAP_IGNORE( SIPStrings::OpenL() ) |
|
95 CSipSseTestTls::OpenL(); |
|
96 } |
|
97 |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void UT_CMusAvaClientResolverUtil::Teardown() |
|
104 { |
|
105 CSipSseTestTls::Close(); |
|
106 SIPStrings::Close(); |
|
107 } |
|
108 |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 void UT_CMusAvaClientResolverUtil::Setup_SawfishL() |
|
115 { |
|
116 TRAP_IGNORE( SIPStrings::OpenL() ) |
|
117 CSipSseTestTls::OpenL(); |
|
118 CRepository::iEmulateSawfishRepository = ETrue; |
|
119 iResolver = CMusAvaClientResolverUtil::NewL(); |
|
120 } |
|
121 |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 void UT_CMusAvaClientResolverUtil::Teardown_Sawfish() |
|
128 { |
|
129 delete iResolver; |
|
130 CRepository::iEmulateSawfishRepository = EFalse; |
|
131 CSipSseTestTls::Close(); |
|
132 SIPStrings::Close(); |
|
133 } |
|
134 |
|
135 |
|
136 // TEST CASES |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 void UT_CMusAvaClientResolverUtil::UT_NewL_SucceedsInSawfishL() |
|
143 { |
|
144 EUNIT_ASSERT( iResolver ) |
|
145 |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 void UT_CMusAvaClientResolverUtil::UT_NewL_FailsInOthersThanSawfishL() |
|
153 { |
|
154 TRAPD( error, iResolver = CMusAvaClientResolverUtil::NewL() ); |
|
155 if ( error == KErrNoMemory ) User::Leave( error ); |
|
156 EUNIT_ASSERT( error != KErrNone ); |
|
157 } |
|
158 |
|
159 |
|
160 // TEST TABLE |
|
161 |
|
162 EUNIT_BEGIN_TEST_TABLE( |
|
163 UT_CMusAvaClientResolverUtil, |
|
164 "CMusAvaClientResolverUtil", |
|
165 "UNIT" ) |
|
166 |
|
167 EUNIT_TEST( |
|
168 "UT_NewL_SucceedsInSawfishL", |
|
169 "CMusAvaClientResolverUtil", |
|
170 "NewL", |
|
171 "FUNCTIONALITY", |
|
172 Setup_SawfishL, UT_NewL_SucceedsInSawfishL, Teardown_Sawfish) |
|
173 |
|
174 EUNIT_TEST( |
|
175 "UT_NewL_FailsInOthersThanSawfishL", |
|
176 "CMusAvaClientResolverUtil", |
|
177 "NewL", |
|
178 "FUNCTIONALITY", |
|
179 SetupL, UT_NewL_FailsInOthersThanSawfishL, Teardown) |
|
180 |
|
181 |
|
182 EUNIT_END_TEST_TABLE |
|
183 |
|
184 // END OF FILE |
|
185 |
|
186 |