109 iExchange = iOptionHandler->iCapabilityExchange; |
108 iExchange = iOptionHandler->iCapabilityExchange; |
110 |
109 |
111 iCapability = iOptionHandler->iSwisCapability; |
110 iCapability = iOptionHandler->iSwisCapability; |
112 |
111 |
113 CSipSseTestTls::OpenL(); |
112 CSipSseTestTls::OpenL(); |
114 iStorage = CSipSseTestTls::Storage(); |
113 |
115 iStorage->Set( MusSettingsKeys::KFastStartupMode, |
|
116 MusSettingsKeys::EFastModeOff ); |
|
117 } |
114 } |
118 |
115 |
119 void UT_CMusAvaCapability::Teardown( ) |
116 void UT_CMusAvaCapability::Teardown( ) |
120 { |
117 { |
121 delete iOptionHandler; |
118 delete iOptionHandler; |
122 delete iAvailabilityObserver; |
119 delete iAvailabilityObserver; |
123 delete iConcreteSettings; |
120 delete iConcreteSettings; |
124 if ( iStorage ) |
121 CSipSseTestTls::Close(); |
125 { |
122 |
126 iStorage->Clear(); |
|
127 CSipSseTestTls::Close(); |
|
128 iStorage = NULL; |
|
129 } |
|
130 |
|
131 delete iSIPConnection; |
123 delete iSIPConnection; |
132 delete iProfile; |
124 delete iProfile; |
133 delete iSIP; |
125 delete iSIP; |
134 |
126 |
135 } |
127 } |
179 KCapabilitySwisFeature, |
171 KCapabilitySwisFeature, |
180 KCapabilityTestAcceptHeader, |
172 KCapabilityTestAcceptHeader, |
181 KCapabilityTestTerminalID_B ); |
173 KCapabilityTestTerminalID_B ); |
182 CleanupStack::PushL( options ); |
174 CleanupStack::PushL( options ); |
183 |
175 |
184 CSdpDocument* sdpContent = |
176 // Test : AVC enabled => H263 & H264 |
185 CMusAvaCapability::ResponseContentLC( *options ); |
177 TInt32 KMusDisableAVC = 0x0ffffff1; // some value other than disable magic value |
186 |
178 MultimediaSharingSettings::SetPropertyValueL(MusSettingsKeys::KEncodingDevice, |
|
179 KMusDisableAVC ); |
|
180 CSdpDocument* sdpContent = CMusAvaCapability::ResponseContentLC( *options ); |
187 RPointerArray<CSIPHeaderBase> responseHeaders; |
181 RPointerArray<CSIPHeaderBase> responseHeaders; |
188 CSIPHeaderBase::PushLC( &responseHeaders ); |
182 CSIPHeaderBase::PushLC( &responseHeaders ); |
189 |
183 |
190 iCapability->PopulateResponseL( *options, responseHeaders, *sdpContent ); |
184 iCapability->PopulateResponseL( *options, responseHeaders, *sdpContent ); |
191 |
185 |
192 EUNIT_ASSERT( responseHeaders.Count() == 1 ); |
186 EUNIT_ASSERT( responseHeaders.Count() == 1 ); |
193 EUNIT_ASSERT( sdpContent->AttributeFields().Count() == 2 ); |
187 EUNIT_ASSERT( sdpContent->AttributeFields().Count() == 2 ); |
194 EUNIT_ASSERT( sdpContent->MediaFields().Count() == 1 ); |
188 EUNIT_ASSERT( sdpContent->MediaFields().Count() == 1 ); |
195 EUNIT_ASSERT( sdpContent->MediaFields()[0]->FormatAttributeFields().Count() == 2 ); |
189 EUNIT_ASSERT( sdpContent->MediaFields()[0]->FormatAttributeFields().Count() == 2 ); |
196 |
190 CleanupStack::PopAndDestroy( &responseHeaders ); |
|
191 CleanupStack::PopAndDestroy( sdpContent ); |
|
192 |
|
193 // Test : AVC disabled => H263 |
|
194 KMusDisableAVC = 0x0fffffff; // disable magic value |
|
195 MultimediaSharingSettings::SetPropertyValueL(MusSettingsKeys::KEncodingDevice, |
|
196 KMusDisableAVC ); |
|
197 sdpContent = CMusAvaCapability::ResponseContentLC( *options ); |
|
198 CSIPHeaderBase::PushLC( &responseHeaders ); |
|
199 iCapability->PopulateResponseL( *options, responseHeaders, *sdpContent ); |
|
200 EUNIT_ASSERT( responseHeaders.Count() == 1 ); |
|
201 EUNIT_ASSERT( sdpContent->AttributeFields().Count() == 2 ); |
|
202 EUNIT_ASSERT( sdpContent->MediaFields().Count() == 1 ); |
|
203 EUNIT_ASSERT( sdpContent->MediaFields()[0]->FormatAttributeFields().Count() == 1 ); |
197 CleanupStack::PopAndDestroy( &responseHeaders ); |
204 CleanupStack::PopAndDestroy( &responseHeaders ); |
198 CleanupStack::PopAndDestroy( sdpContent ); |
205 CleanupStack::PopAndDestroy( sdpContent ); |
199 CleanupStack::PopAndDestroy( options ); |
206 CleanupStack::PopAndDestroy( options ); |
200 |
207 |
201 } |
208 } |
207 iOpVariantSetting = MultimediaSharingSettings::OperatorVariantSettingL(); |
214 iOpVariantSetting = MultimediaSharingSettings::OperatorVariantSettingL(); |
208 iCapabQueryObserver = new ( ELeave ) CMusAvaCapabilityQueryObserverImp(); |
215 iCapabQueryObserver = new ( ELeave ) CMusAvaCapabilityQueryObserverImp(); |
209 iExchange = CMusAvaCapabilityExchange::NewL( KTestTerminalId, *iCapabQueryObserver ); |
216 iExchange = CMusAvaCapabilityExchange::NewL( KTestTerminalId, *iCapabQueryObserver ); |
210 iCapability = CMusAvaCapability::NewL( *iExchange ); |
217 iCapability = CMusAvaCapability::NewL( *iExchange ); |
211 CSipSseTestTls::OpenL(); |
218 CSipSseTestTls::OpenL(); |
212 iStorage = CSipSseTestTls::Storage(); |
|
213 iStorage->Set( MusSettingsKeys::KFastStartupMode, |
|
214 MusSettingsKeys::EFastModeOff ); |
|
215 } |
219 } |
216 |
220 |
217 void UT_CMusAvaCapability::Teardown1( ) |
221 void UT_CMusAvaCapability::Teardown1( ) |
218 { |
222 { |
219 if ( iStorage ) |
223 CSipSseTestTls::Close(); |
220 { |
|
221 iStorage->Clear(); |
|
222 CSipSseTestTls::Close(); |
|
223 iStorage = NULL; |
|
224 } |
|
225 delete iCapability; |
224 delete iCapability; |
226 delete iExchange; |
225 delete iExchange; |
227 delete iCapabQueryObserver; |
226 delete iCapabQueryObserver; |
228 } |
227 } |
229 |
228 |
343 CleanupStack::PopAndDestroy( sdpContent ); |
342 CleanupStack::PopAndDestroy( sdpContent ); |
344 CleanupStack::PopAndDestroy( options ); |
343 CleanupStack::PopAndDestroy( options ); |
345 } |
344 } |
346 |
345 |
347 |
346 |
348 void UT_CMusAvaCapability::UT_CMusAvaCapability_ResolveFastModeLL() |
|
349 { |
|
350 // Fast mode feature is disabled in cenrep, fast mode is present in SDP |
|
351 CSdpDocument* sdpContent = CSdpDocument::DecodeLC( KCapabilityTestSDPFastMode ); |
|
352 MusSettingsKeys::TFastMode mode = iCapability->ResolveFastModeL( *sdpContent ); |
|
353 EUNIT_ASSERT( mode == MusSettingsKeys::EFastModeOff ); |
|
354 CleanupStack::PopAndDestroy( sdpContent ); |
|
355 |
|
356 // Fast mode feature is enabled in cenrep, fast mode is present in SDP |
|
357 iStorage->Set( MusSettingsKeys::KFastStartupMode, MusSettingsKeys::EFastModeOn ); |
|
358 sdpContent = CSdpDocument::DecodeLC( KCapabilityTestSDPFastMode ); |
|
359 mode = iCapability->ResolveFastModeL( *sdpContent ); |
|
360 EUNIT_ASSERT( mode == MusSettingsKeys::EFastModeOn ); |
|
361 CleanupStack::PopAndDestroy( sdpContent ); |
|
362 |
|
363 // Fast mode feature is enabled in cenrep, fast mode isn't present in SDP |
|
364 sdpContent = CSdpDocument::DecodeLC( KCapabilityTestSDP ); |
|
365 mode = iCapability->ResolveFastModeL( *sdpContent ); |
|
366 EUNIT_ASSERT( mode == MusSettingsKeys::EFastModeOff ); |
|
367 CleanupStack::PopAndDestroy( sdpContent ); |
|
368 } |
|
369 |
|
370 void UT_CMusAvaCapability::UT_CMusAvaCapability_AddFastModeLL() |
|
371 { |
|
372 // Fast mode feature is disabled in cenrep |
|
373 CSdpDocument* sdpContent = CSdpDocument::DecodeLC( KCapabilityTestSDP ); |
|
374 EUNIT_ASSERT( sdpContent->AttributeFields().Count() == 2 ); |
|
375 iCapability->AddFastModeL( *sdpContent ); |
|
376 EUNIT_ASSERT( sdpContent->AttributeFields().Count() == 2 ); |
|
377 |
|
378 // Fast mode feature is enabled in cenrep, a=keywds:fastmode added |
|
379 iStorage->Set( MusSettingsKeys::KFastStartupMode, MusSettingsKeys::EFastModeOn ); |
|
380 iCapability->AddFastModeL( *sdpContent ); |
|
381 EUNIT_ASSERT( sdpContent->AttributeFields().Count() == 3 ); |
|
382 const CSdpAttributeField* field = sdpContent->AttributeFields()[2]; |
|
383 RStringF keywds = MusAvaCapabilityContext::SDPStringL( |
|
384 SdpCodecStringConstants::EAttributeKeywds ); |
|
385 EUNIT_ASSERT( field->Attribute() == keywds ); |
|
386 EUNIT_ASSERT( field->Value().Compare( KCapabilitySDPAttributeFastMode ) == 0 ); |
|
387 CleanupStack::PopAndDestroy( sdpContent ); |
|
388 } |
|
389 |
|
390 |
|
391 // TEST TABLE |
347 // TEST TABLE |
392 |
348 |
393 EUNIT_BEGIN_TEST_TABLE( |
349 EUNIT_BEGIN_TEST_TABLE( |
394 UT_CMusAvaCapability, |
350 UT_CMusAvaCapability, |
395 "CMusAvaCapability", |
351 "CMusAvaCapability", |
434 "PopulateResponseL Operator Specific - test ", |
390 "PopulateResponseL Operator Specific - test ", |
435 "CMusAvaCapability", |
391 "CMusAvaCapability", |
436 "PopulateResponseL", |
392 "PopulateResponseL", |
437 "FUNCTIONALITY", |
393 "FUNCTIONALITY", |
438 Setup1L, UT_CMusAvaCapability_PopulateResponseL_OpSpecificL, Teardown1 ) |
394 Setup1L, UT_CMusAvaCapability_PopulateResponseL_OpSpecificL, Teardown1 ) |
439 |
395 |
440 EUNIT_TEST( |
|
441 "ResolveFastModeL - test ", |
|
442 "CMusAvaCapability", |
|
443 "ResolveFastModeL", |
|
444 "FUNCTIONALITY", |
|
445 SetupL, UT_CMusAvaCapability_ResolveFastModeLL, Teardown) |
|
446 |
|
447 EUNIT_TEST( |
|
448 "AddFastModeL - test ", |
|
449 "CMusAvaCapability", |
|
450 "AddFastModeL", |
|
451 "FUNCTIONALITY", |
|
452 SetupL, UT_CMusAvaCapability_AddFastModeLL, Teardown) |
|
453 |
396 |
454 EUNIT_END_TEST_TABLE |
397 EUNIT_END_TEST_TABLE |
455 |
398 |
456 // END OF FILE |
399 // END OF FILE |