|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // CLASS HEADER |
|
22 #include "UT_CNATFWIceSettings.h" |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <digia/eunit/eunitmacros.h> |
|
26 #include <digia/eunit/EUnitDecorators.h> |
|
27 #include <badesca.h> |
|
28 #include <unsafprotocolscrkeys.h> |
|
29 |
|
30 // INTERNAL INCLUDES |
|
31 #include "cnatfwicesettings.h" |
|
32 #include "settingstore.h" |
|
33 #include "cnatfwcenrephandler.h" |
|
34 #include "natfwdefaultsettingsvalues.h" |
|
35 #include "natfwunittestmacros.h" |
|
36 |
|
37 _LIT8( KNokiaStun, "nokia.stun" ); |
|
38 _LIT8( KNokiaTurn, "nokia.turn" ); |
|
39 |
|
40 _LIT8( KDomain,"www.domain.fi" ); |
|
41 const TUint KIapId = 1979; |
|
42 |
|
43 _LIT8( KUtilityPlugin, "nokia.stun, nokia.turn" ); |
|
44 |
|
45 const TInt KTestHostPref = 1001; |
|
46 const TInt KTestServerRefPref = 1002; |
|
47 const TInt KTestRelayPref = 1003; |
|
48 const TInt KTestPeerRefPref = 1004; |
|
49 const TInt KTestIPV4Pref = 1005; |
|
50 const TInt KTestIPV6Pref = 1006; |
|
51 const TInt KTestVPNPref = 1007; |
|
52 const TInt KTestUDPPref = 1008; |
|
53 const TInt KTestTCPPref = 1009; |
|
54 const TInt KTestTCPActivePref = 1010; |
|
55 const TInt KTestTCPPassivePref = 1011; |
|
56 const TInt KTestTCPSimultPref = 1012; |
|
57 |
|
58 const TUint KDefaultGranularity = 1; |
|
59 |
|
60 |
|
61 // CONSTRUCTION |
|
62 UT_CNATFWIceSettings* UT_CNATFWIceSettings::NewL() |
|
63 { |
|
64 UT_CNATFWIceSettings* self = UT_CNATFWIceSettings::NewLC(); |
|
65 CleanupStack::Pop(); |
|
66 |
|
67 return self; |
|
68 } |
|
69 |
|
70 UT_CNATFWIceSettings* UT_CNATFWIceSettings::NewLC() |
|
71 { |
|
72 UT_CNATFWIceSettings* self = new( ELeave ) UT_CNATFWIceSettings(); |
|
73 CleanupStack::PushL( self ); |
|
74 |
|
75 self->ConstructL(); |
|
76 |
|
77 return self; |
|
78 } |
|
79 |
|
80 // Destructor (virtual by CBase) |
|
81 UT_CNATFWIceSettings::~UT_CNATFWIceSettings() |
|
82 { |
|
83 } |
|
84 |
|
85 // Default constructor |
|
86 UT_CNATFWIceSettings::UT_CNATFWIceSettings() |
|
87 { |
|
88 } |
|
89 |
|
90 // Second phase construct |
|
91 void UT_CNATFWIceSettings::ConstructL() |
|
92 { |
|
93 // The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
94 // It generates the test case table. |
|
95 CEUnitTestSuiteClass::ConstructL(); |
|
96 } |
|
97 |
|
98 // METHODS |
|
99 |
|
100 |
|
101 void UT_CNATFWIceSettings::SetupL( ) |
|
102 { |
|
103 iCNATFWIceSettings = CNATFWIceSettings::NewL(); |
|
104 } |
|
105 |
|
106 |
|
107 void UT_CNATFWIceSettings::Teardown( ) |
|
108 { |
|
109 delete iCNATFWIceSettings; |
|
110 iCNATFWIceSettings = NULL; |
|
111 } |
|
112 |
|
113 |
|
114 void UT_CNATFWIceSettings::SetupCenRepL( ) |
|
115 { |
|
116 SetupL(); |
|
117 |
|
118 iSettingsStore = CSettingStore::NewL( KDomain, KIapId ); |
|
119 iSettingsStore->EraseL( 0, 0 ); |
|
120 |
|
121 CNATFWCenRepHandler* repHandler = |
|
122 CNATFWCenRepHandler::NewL( KCRUidUNSAFProtocols ); |
|
123 CleanupStack::PushL( repHandler ); |
|
124 |
|
125 //Create Domain |
|
126 TUint32 domainKey = iSettingsStore->CreateNewDomainL( KDomain ); |
|
127 |
|
128 // ICE settings |
|
129 delete iSettingsStore->iUtilityPlugins; |
|
130 iSettingsStore->iUtilityPlugins = NULL; |
|
131 iSettingsStore->iUtilityPlugins= KUtilityPlugin().AllocL(); |
|
132 |
|
133 iSettingsStore->iHostPref = KTestHostPref; |
|
134 iSettingsStore->iServerReflexivePref = KTestServerRefPref; |
|
135 iSettingsStore->iRelayPref = KTestRelayPref; |
|
136 iSettingsStore->iPeerReflexivePref = KTestPeerRefPref; |
|
137 iSettingsStore->iIpv4AddrFamilyPref = KTestIPV4Pref; |
|
138 iSettingsStore->iIpv6AddrFamilyPref = KTestIPV6Pref; |
|
139 iSettingsStore->iVpnInterfacePref = KTestVPNPref; |
|
140 iSettingsStore->iUdpTransportPref = KTestUDPPref; |
|
141 iSettingsStore->iTcpTransportPref = KTestTCPPref; |
|
142 iSettingsStore->iTcpDirActivePref = KTestTCPActivePref; |
|
143 iSettingsStore->iTcpDirPassivePref = KTestTCPPassivePref; |
|
144 iSettingsStore->iTcpDirSimultaneousOpenPref = KTestTCPSimultPref; |
|
145 |
|
146 CleanupStack::PushL( iSettingsStore ); |
|
147 iSettingsStore->StoreSettingsL(); |
|
148 CleanupStack::Pop( iSettingsStore ); |
|
149 |
|
150 iCNATFWIceSettings->ReadSettingsL( domainKey, *repHandler ); |
|
151 CleanupStack::PopAndDestroy( repHandler ); |
|
152 } |
|
153 |
|
154 |
|
155 void UT_CNATFWIceSettings::TeardownCenRepL( ) |
|
156 { |
|
157 Teardown(); |
|
158 iSettingsStore->EraseL( 0, 0 ); |
|
159 delete iSettingsStore; |
|
160 iSettingsStore = NULL; |
|
161 } |
|
162 |
|
163 |
|
164 void UT_CNATFWIceSettings::T_CNATFWIceSettings_SetPreferencesL() |
|
165 { |
|
166 TNATFWIcePreferences preferences; |
|
167 TInt prefValue = 0; |
|
168 |
|
169 preferences.SetPrefValue( |
|
170 MNATFWIceSettings::EPrefHostCandidate, KTestHostPref ); |
|
171 preferences.SetPrefValue( |
|
172 MNATFWIceSettings::EPrefServerReflexiveCandidate, |
|
173 KTestServerRefPref ); |
|
174 preferences.SetPrefValue( |
|
175 MNATFWIceSettings::EPrefRelayCandidate, KTestRelayPref ); |
|
176 preferences.SetPrefValue( |
|
177 MNATFWIceSettings::EPrefPeerReflexiveCandidate, KTestPeerRefPref ); |
|
178 preferences.SetPrefValue( |
|
179 MNATFWIceSettings::EPrefIpv4AddrFamily, KTestIPV4Pref ); |
|
180 preferences.SetPrefValue( |
|
181 MNATFWIceSettings::EPrefIpv6AddrFamily, KTestIPV6Pref ); |
|
182 preferences.SetPrefValue( |
|
183 MNATFWIceSettings::EPrefVpnInterface, KTestVPNPref ); |
|
184 preferences.SetPrefValue( |
|
185 MNATFWIceSettings::EPrefUdpTransport, KTestUDPPref ); |
|
186 preferences.SetPrefValue( |
|
187 MNATFWIceSettings::EPrefTcpTransport, KTestTCPPref ); |
|
188 preferences.SetPrefValue( |
|
189 MNATFWIceSettings::EPrefTcpDirectionActive, KTestTCPActivePref ); |
|
190 preferences.SetPrefValue( |
|
191 MNATFWIceSettings::EPrefTcpDirectionPassive, KTestTCPPassivePref ); |
|
192 preferences.SetPrefValue( |
|
193 MNATFWIceSettings::EPrefTcpDirectionSimultaneousOpen, |
|
194 KTestTCPSimultPref ); |
|
195 |
|
196 iCNATFWIceSettings->SetPreferences( preferences ); |
|
197 |
|
198 iCNATFWIceSettings->Preferences().GetPrefValue( |
|
199 MNATFWIceSettings::EPrefHostCandidate, prefValue ); |
|
200 EUNIT_ASSERT_EQUALS( prefValue, KTestHostPref ); |
|
201 iCNATFWIceSettings->Preferences().GetPrefValue( |
|
202 MNATFWIceSettings::EPrefServerReflexiveCandidate, prefValue ); |
|
203 EUNIT_ASSERT_EQUALS( prefValue, KTestServerRefPref ); |
|
204 iCNATFWIceSettings->Preferences().GetPrefValue( |
|
205 MNATFWIceSettings::EPrefRelayCandidate, prefValue ); |
|
206 EUNIT_ASSERT_EQUALS( prefValue, KTestRelayPref ); |
|
207 iCNATFWIceSettings->Preferences().GetPrefValue( |
|
208 MNATFWIceSettings::EPrefPeerReflexiveCandidate, prefValue ); |
|
209 EUNIT_ASSERT_EQUALS( prefValue, KTestPeerRefPref ); |
|
210 iCNATFWIceSettings->Preferences().GetPrefValue( |
|
211 MNATFWIceSettings::EPrefIpv4AddrFamily, prefValue ); |
|
212 EUNIT_ASSERT_EQUALS( prefValue, KTestIPV4Pref ); |
|
213 iCNATFWIceSettings->Preferences().GetPrefValue( |
|
214 MNATFWIceSettings::EPrefIpv6AddrFamily, prefValue ); |
|
215 EUNIT_ASSERT_EQUALS( prefValue, KTestIPV6Pref ); |
|
216 iCNATFWIceSettings->Preferences().GetPrefValue( |
|
217 MNATFWIceSettings::EPrefVpnInterface, prefValue ); |
|
218 EUNIT_ASSERT_EQUALS( prefValue, KTestVPNPref ); |
|
219 iCNATFWIceSettings->Preferences().GetPrefValue( |
|
220 MNATFWIceSettings::EPrefUdpTransport, prefValue ); |
|
221 EUNIT_ASSERT_EQUALS( prefValue, KTestUDPPref ); |
|
222 iCNATFWIceSettings->Preferences().GetPrefValue( |
|
223 MNATFWIceSettings::EPrefTcpTransport, prefValue ); |
|
224 EUNIT_ASSERT_EQUALS( prefValue, KTestTCPPref ); |
|
225 iCNATFWIceSettings->Preferences().GetPrefValue( |
|
226 MNATFWIceSettings::EPrefTcpDirectionActive, prefValue ); |
|
227 EUNIT_ASSERT_EQUALS( prefValue, KTestTCPActivePref ); |
|
228 iCNATFWIceSettings->Preferences().GetPrefValue( |
|
229 MNATFWIceSettings::EPrefTcpDirectionPassive, prefValue ); |
|
230 EUNIT_ASSERT_EQUALS( prefValue, KTestTCPPassivePref ); |
|
231 iCNATFWIceSettings->Preferences().GetPrefValue( |
|
232 MNATFWIceSettings::EPrefTcpDirectionSimultaneousOpen, prefValue ); |
|
233 EUNIT_ASSERT_EQUALS( prefValue, KTestTCPSimultPref ); |
|
234 } |
|
235 |
|
236 |
|
237 void UT_CNATFWIceSettings::T_CNATFWIceSettings_GetPrefValueL( ) |
|
238 { |
|
239 TInt value( 0 ); |
|
240 |
|
241 CSettingStore* settingsStore = |
|
242 CSettingStore::NewL( KDomain, KIapId ); |
|
243 CleanupStack::PushL( settingsStore ); |
|
244 |
|
245 settingsStore->EraseL( 0, 0 ); |
|
246 |
|
247 //Create Domain |
|
248 TUint32 domainKey = settingsStore->CreateNewDomainL( KDomain ); |
|
249 |
|
250 CNATFWCenRepHandler* repHandler = |
|
251 CNATFWCenRepHandler::NewL( KCRUidUNSAFProtocols ); |
|
252 |
|
253 CleanupStack::PushL( repHandler ); |
|
254 NATFW_EUNIT_ASSERT_NO_LEAVE( |
|
255 iCNATFWIceSettings->ReadSettingsL( domainKey, *repHandler ) ); |
|
256 CleanupStack::PopAndDestroy( repHandler ); |
|
257 |
|
258 // Test read parameter when no parameters in CR |
|
259 // Then default values should be used |
|
260 iCNATFWIceSettings->GetPrefValue( |
|
261 MNATFWIceSettings::EPrefHostCandidate, value ); |
|
262 EUNIT_ASSERT_EQUALS( KNATFWDefaultlHostPref, value ); |
|
263 |
|
264 iCNATFWIceSettings->GetPrefValue( |
|
265 MNATFWIceSettings::EPrefServerReflexiveCandidate, value ); |
|
266 EUNIT_ASSERT_EQUALS( KNATFWDefaultServerRefPref, value ); |
|
267 |
|
268 iCNATFWIceSettings->GetPrefValue( |
|
269 MNATFWIceSettings::EPrefRelayCandidate, value ); |
|
270 EUNIT_ASSERT_EQUALS( KNATFWDefaultRelayPref, value ); |
|
271 |
|
272 iCNATFWIceSettings->GetPrefValue( |
|
273 MNATFWIceSettings::EPrefPeerReflexiveCandidate, value ); |
|
274 EUNIT_ASSERT_EQUALS( KNATFWDefaultPeerRefPref, value ); |
|
275 |
|
276 iCNATFWIceSettings->GetPrefValue( |
|
277 MNATFWIceSettings::EPrefIpv4AddrFamily, value ); |
|
278 EUNIT_ASSERT_EQUALS( KNATFWDefaultIPV4Pref, value); |
|
279 |
|
280 iCNATFWIceSettings->GetPrefValue( |
|
281 MNATFWIceSettings::EPrefIpv6AddrFamily, value ); |
|
282 EUNIT_ASSERT_EQUALS( KNATFWDefaultIPV6Pref, value ); |
|
283 |
|
284 iCNATFWIceSettings->GetPrefValue( |
|
285 MNATFWIceSettings::EPrefVpnInterface, value ); |
|
286 EUNIT_ASSERT_EQUALS( KNATFWDefaultVPNPref, value ); |
|
287 |
|
288 iCNATFWIceSettings->GetPrefValue( |
|
289 MNATFWIceSettings::EPrefUdpTransport, value ); |
|
290 EUNIT_ASSERT_EQUALS( KNATFWDefaultUDPPref, value ); |
|
291 |
|
292 iCNATFWIceSettings->GetPrefValue( |
|
293 MNATFWIceSettings::EPrefTcpTransport, value ); |
|
294 EUNIT_ASSERT_EQUALS( KNATFWDefaultTCPPref, value ); |
|
295 |
|
296 iCNATFWIceSettings->GetPrefValue( |
|
297 MNATFWIceSettings::EPrefTcpDirectionActive, value ); |
|
298 EUNIT_ASSERT_EQUALS( KNATFWDefaultTCPActivePref, value ); |
|
299 |
|
300 iCNATFWIceSettings->GetPrefValue( |
|
301 MNATFWIceSettings::EPrefTcpDirectionPassive, value ); |
|
302 EUNIT_ASSERT_EQUALS( KNATFWDefaultTCPPassivePref, value ); |
|
303 |
|
304 iCNATFWIceSettings->GetPrefValue( |
|
305 MNATFWIceSettings::EPrefTcpDirectionSimultaneousOpen, value ); |
|
306 EUNIT_ASSERT_EQUALS( KNATFWDefaultTCPSimultPref, value ); |
|
307 |
|
308 |
|
309 // Write ICE priority parameters |
|
310 iCNATFWIceSettings->SetPrefValue( |
|
311 MNATFWIceSettings::EPrefHostCandidate, KTestHostPref ); |
|
312 |
|
313 iCNATFWIceSettings->SetPrefValue( |
|
314 MNATFWIceSettings::EPrefServerReflexiveCandidate, |
|
315 KTestServerRefPref ); |
|
316 |
|
317 iCNATFWIceSettings->SetPrefValue( |
|
318 MNATFWIceSettings::EPrefRelayCandidate, KTestRelayPref ); |
|
319 |
|
320 iCNATFWIceSettings->SetPrefValue( |
|
321 MNATFWIceSettings::EPrefPeerReflexiveCandidate, KTestPeerRefPref ); |
|
322 |
|
323 iCNATFWIceSettings->SetPrefValue( |
|
324 MNATFWIceSettings::EPrefIpv4AddrFamily, KTestIPV4Pref ); |
|
325 |
|
326 iCNATFWIceSettings->SetPrefValue( |
|
327 MNATFWIceSettings::EPrefIpv6AddrFamily, KTestIPV6Pref ); |
|
328 |
|
329 iCNATFWIceSettings->SetPrefValue( |
|
330 MNATFWIceSettings::EPrefVpnInterface, KTestVPNPref ); |
|
331 |
|
332 iCNATFWIceSettings->SetPrefValue( |
|
333 MNATFWIceSettings::EPrefUdpTransport, KTestUDPPref ); |
|
334 |
|
335 iCNATFWIceSettings->SetPrefValue( |
|
336 MNATFWIceSettings::EPrefTcpTransport, KTestTCPPref ); |
|
337 |
|
338 iCNATFWIceSettings->SetPrefValue( |
|
339 MNATFWIceSettings::EPrefTcpDirectionActive, KTestTCPActivePref ); |
|
340 |
|
341 iCNATFWIceSettings->SetPrefValue( |
|
342 MNATFWIceSettings::EPrefTcpDirectionPassive, KTestTCPPassivePref ); |
|
343 |
|
344 iCNATFWIceSettings->SetPrefValue( |
|
345 MNATFWIceSettings::EPrefTcpDirectionSimultaneousOpen, KTestTCPSimultPref ); |
|
346 |
|
347 |
|
348 // Test read parameters |
|
349 iCNATFWIceSettings->GetPrefValue( |
|
350 MNATFWIceSettings::EPrefHostCandidate, value ); |
|
351 EUNIT_ASSERT_EQUALS( KTestHostPref, value ); |
|
352 |
|
353 iCNATFWIceSettings->GetPrefValue( |
|
354 MNATFWIceSettings::EPrefServerReflexiveCandidate, value ); |
|
355 EUNIT_ASSERT_EQUALS( KTestServerRefPref, value ); |
|
356 |
|
357 iCNATFWIceSettings->GetPrefValue( |
|
358 MNATFWIceSettings::EPrefRelayCandidate, value ); |
|
359 EUNIT_ASSERT_EQUALS( KTestRelayPref, value ); |
|
360 |
|
361 iCNATFWIceSettings->GetPrefValue( |
|
362 MNATFWIceSettings::EPrefPeerReflexiveCandidate, value ); |
|
363 EUNIT_ASSERT_EQUALS( KTestPeerRefPref, value ); |
|
364 |
|
365 iCNATFWIceSettings->GetPrefValue( |
|
366 MNATFWIceSettings::EPrefIpv4AddrFamily, value ); |
|
367 EUNIT_ASSERT_EQUALS( KTestIPV4Pref, value ); |
|
368 |
|
369 iCNATFWIceSettings->GetPrefValue( |
|
370 MNATFWIceSettings::EPrefIpv6AddrFamily, value ); |
|
371 EUNIT_ASSERT_EQUALS( KTestIPV6Pref, value ); |
|
372 |
|
373 iCNATFWIceSettings->GetPrefValue( |
|
374 MNATFWIceSettings::EPrefVpnInterface, value ); |
|
375 EUNIT_ASSERT_EQUALS( KTestVPNPref, value ); |
|
376 |
|
377 iCNATFWIceSettings->GetPrefValue( |
|
378 MNATFWIceSettings::EPrefUdpTransport, value ); |
|
379 EUNIT_ASSERT_EQUALS( KTestUDPPref, value ); |
|
380 |
|
381 iCNATFWIceSettings->GetPrefValue( |
|
382 MNATFWIceSettings::EPrefTcpTransport, value ); |
|
383 EUNIT_ASSERT_EQUALS( KTestTCPPref, value ); |
|
384 |
|
385 iCNATFWIceSettings->GetPrefValue( |
|
386 MNATFWIceSettings::EPrefTcpDirectionActive, value ); |
|
387 EUNIT_ASSERT_EQUALS( KTestTCPActivePref, value ); |
|
388 |
|
389 iCNATFWIceSettings->GetPrefValue( |
|
390 MNATFWIceSettings::EPrefTcpDirectionPassive, value ); |
|
391 EUNIT_ASSERT_EQUALS( KTestTCPPassivePref, value ); |
|
392 |
|
393 iCNATFWIceSettings->GetPrefValue( |
|
394 MNATFWIceSettings::EPrefTcpDirectionSimultaneousOpen, value ); |
|
395 EUNIT_ASSERT_EQUALS( KTestTCPSimultPref, value ); |
|
396 |
|
397 CleanupStack::PopAndDestroy( settingsStore ); |
|
398 } |
|
399 |
|
400 |
|
401 void UT_CNATFWIceSettings::T_CNATFWIceSettings_GetPrefValueCenRepL( ) |
|
402 { |
|
403 TInt value( 0 ); |
|
404 |
|
405 // Test read parameter in CR |
|
406 iCNATFWIceSettings->GetPrefValue( |
|
407 MNATFWIceSettings::EPrefHostCandidate, value ); |
|
408 EUNIT_ASSERT_EQUALS( KTestHostPref, value ); |
|
409 |
|
410 iCNATFWIceSettings->GetPrefValue( |
|
411 MNATFWIceSettings::EPrefServerReflexiveCandidate, value ); |
|
412 EUNIT_ASSERT_EQUALS( KTestServerRefPref, value ); |
|
413 |
|
414 iCNATFWIceSettings->GetPrefValue( |
|
415 MNATFWIceSettings::EPrefRelayCandidate, value ); |
|
416 EUNIT_ASSERT_EQUALS( KTestRelayPref, value ); |
|
417 |
|
418 iCNATFWIceSettings->GetPrefValue( |
|
419 MNATFWIceSettings::EPrefPeerReflexiveCandidate, value ); |
|
420 EUNIT_ASSERT_EQUALS( KTestPeerRefPref, value ); |
|
421 |
|
422 iCNATFWIceSettings->GetPrefValue( |
|
423 MNATFWIceSettings::EPrefIpv4AddrFamily, value ); |
|
424 EUNIT_ASSERT_EQUALS( KTestIPV4Pref, value ); |
|
425 |
|
426 iCNATFWIceSettings->GetPrefValue( |
|
427 MNATFWIceSettings::EPrefIpv6AddrFamily, value ); |
|
428 EUNIT_ASSERT_EQUALS( KTestIPV6Pref, value ); |
|
429 |
|
430 iCNATFWIceSettings->GetPrefValue( |
|
431 MNATFWIceSettings::EPrefVpnInterface, value ); |
|
432 EUNIT_ASSERT_EQUALS( KTestVPNPref, value ); |
|
433 |
|
434 iCNATFWIceSettings->GetPrefValue( |
|
435 MNATFWIceSettings::EPrefUdpTransport, value ); |
|
436 EUNIT_ASSERT_EQUALS( KTestUDPPref, value ); |
|
437 |
|
438 iCNATFWIceSettings->GetPrefValue( |
|
439 MNATFWIceSettings::EPrefTcpTransport, value ); |
|
440 EUNIT_ASSERT_EQUALS( KTestTCPPref, value ); |
|
441 |
|
442 iCNATFWIceSettings->GetPrefValue( |
|
443 MNATFWIceSettings::EPrefTcpDirectionActive, value ); |
|
444 EUNIT_ASSERT_EQUALS( KTestTCPActivePref, value ); |
|
445 |
|
446 iCNATFWIceSettings->GetPrefValue( |
|
447 MNATFWIceSettings::EPrefTcpDirectionPassive, value ); |
|
448 EUNIT_ASSERT_EQUALS( KTestTCPPassivePref, value ); |
|
449 |
|
450 iCNATFWIceSettings->GetPrefValue( |
|
451 MNATFWIceSettings::EPrefTcpDirectionSimultaneousOpen, value ); |
|
452 EUNIT_ASSERT_EQUALS( KTestTCPSimultPref, value ); |
|
453 } |
|
454 |
|
455 |
|
456 void UT_CNATFWIceSettings::T_CNATFWIceSettings_NatUtilityPluginsLL( ) |
|
457 { |
|
458 CDesC8Array* desArray = NULL; |
|
459 NATFW_EUNIT_ASSERT_SPECIFIC_LEAVE( iCNATFWIceSettings->SetUtilityPluginsL( |
|
460 *desArray ), KErrArgument ); |
|
461 |
|
462 desArray = new( ELeave ) CDesC8ArrayFlat( KDefaultGranularity ); |
|
463 CleanupStack::PushL( desArray ); |
|
464 |
|
465 desArray->AppendL( KNokiaStun ); |
|
466 desArray->AppendL( KNokiaTurn ); |
|
467 |
|
468 NATFW_EUNIT_ASSERT_NO_LEAVE( iCNATFWIceSettings->SetUtilityPluginsL( |
|
469 *desArray ) ); |
|
470 CleanupStack::PopAndDestroy( desArray ); |
|
471 |
|
472 EUNIT_ASSERT_EQUALS( iCNATFWIceSettings->NatUtilityPlugins().Count(), 2 ); |
|
473 |
|
474 EUNIT_ASSERT_EQUALS( iCNATFWIceSettings->NatUtilityPlugins()[0], |
|
475 KNokiaStun() ); |
|
476 |
|
477 EUNIT_ASSERT_EQUALS( iCNATFWIceSettings->NatUtilityPlugins()[1], |
|
478 KNokiaTurn() ); |
|
479 } |
|
480 |
|
481 |
|
482 // TEST TABLE |
|
483 EUNIT_BEGIN_TEST_TABLE( |
|
484 UT_CNATFWIceSettings, |
|
485 "Add test suite description here.", |
|
486 "UNIT" ) |
|
487 |
|
488 EUNIT_TEST( |
|
489 "SetPreferences - test1", |
|
490 "CNATFWIceSettings", |
|
491 "SetPreferences / Preferences - test1", |
|
492 "FUNCTIONALITY", |
|
493 SetupL, T_CNATFWIceSettings_SetPreferencesL, Teardown ) |
|
494 |
|
495 EUNIT_TEST( |
|
496 "GetPrefValue - test2", |
|
497 "CNATFWIceSettings", |
|
498 "GetPrefValue - test2", |
|
499 "FUNCTIONALITY", |
|
500 SetupL, T_CNATFWIceSettings_GetPrefValueL, Teardown ) |
|
501 |
|
502 EUNIT_TEST( |
|
503 "GetPrefValueCenrep - test3", |
|
504 "CNATFWIceSettings", |
|
505 "GetPrefValue - test3", |
|
506 "FUNCTIONALITY", |
|
507 SetupCenRepL, T_CNATFWIceSettings_GetPrefValueCenRepL, TeardownCenRepL ) |
|
508 |
|
509 EUNIT_TEST( |
|
510 "NatUtilityPlugins - test4", |
|
511 "CNATFWIceSettings", |
|
512 "NatUtilityPlugins - test4", |
|
513 "FUNCTIONALITY", |
|
514 SetupL, T_CNATFWIceSettings_NatUtilityPluginsLL, Teardown ) |
|
515 |
|
516 |
|
517 EUNIT_END_TEST_TABLE |
|
518 |
|
519 // END OF FILE |