|
1 /* |
|
2 * Copyright (c) 2002-2009 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 // INCLUDE FILES |
|
27 #include <e32math.h> |
|
28 #include "senservicemanagerbctest.h" |
|
29 |
|
30 // EXTERNAL DATA STRUCTURES |
|
31 //extern ?external_data; |
|
32 |
|
33 // EXTERNAL FUNCTION PROTOTYPES |
|
34 //extern ?external_function( ?arg_type,?arg_type ); |
|
35 |
|
36 // CONSTANTS |
|
37 //const ?type ?constant_var = ?constant; |
|
38 |
|
39 // MACROS |
|
40 //#define ?macro ?macro_def |
|
41 |
|
42 // LOCAL CONSTANTS AND MACROS |
|
43 //const ?type ?constant_var = ?constant; |
|
44 //#define ?macro_name ?macro_def |
|
45 |
|
46 // MODULE DATA STRUCTURES |
|
47 //enum ?declaration |
|
48 //typedef ?declaration |
|
49 |
|
50 // LOCAL FUNCTION PROTOTYPES |
|
51 //?type ?function_name( ?arg_type, ?arg_type ); |
|
52 |
|
53 // FORWARD DECLARATIONS |
|
54 //class ?FORWARD_CLASSNAME; |
|
55 |
|
56 // ============================= LOCAL FUNCTIONS =============================== |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // ?function_name ?description. |
|
60 // ?description |
|
61 // Returns: ?value_1: ?description |
|
62 // ?value_n: ?description_line1 |
|
63 // ?description_line2 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 /* |
|
67 ?type ?function_name( |
|
68 ?arg_type arg, // ?description |
|
69 ?arg_type arg) // ?description |
|
70 { |
|
71 |
|
72 ?code // ?comment |
|
73 |
|
74 // ?comment |
|
75 ?code |
|
76 } |
|
77 */ |
|
78 |
|
79 |
|
80 //Macro for Porting to STIF |
|
81 #define LOCAL_ASSERT(expression) {if(!(expression)){return KErrArgument;}} |
|
82 |
|
83 |
|
84 // ============================ MEMBER FUNCTIONS =============================== |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CSenServiceManagerBCTest::Case |
|
88 // Returns a test case by number. |
|
89 // |
|
90 // This function contains an array of all available test cases |
|
91 // i.e pair of case name and test function. If case specified by parameter |
|
92 // aCaseNumber is found from array, then that item is returned. |
|
93 // |
|
94 // The reason for this rather complicated function is to specify all the |
|
95 // test cases only in one place. It is not necessary to understand how |
|
96 // function pointers to class member functions works when adding new test |
|
97 // cases. See function body for instructions how to add new test case. |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 const TCaseInfo CSenServiceManagerBCTest::Case ( |
|
101 const TInt aCaseNumber ) const |
|
102 { |
|
103 |
|
104 /** |
|
105 * To add new test cases, implement new test case function and add new |
|
106 * line to KCases array specify the name of the case and the function |
|
107 * doing the test case |
|
108 * In practice, do following |
|
109 * 1) Make copy of existing test case function and change its name |
|
110 * and functionality. Note that the function must be added to |
|
111 * SenServiceManager_stif.cpp file and to SenServiceManager_stif.h |
|
112 * header file. |
|
113 * |
|
114 * 2) Add entry to following KCases array either by using: |
|
115 * |
|
116 * 2.1: FUNCENTRY or ENTRY macro |
|
117 * ENTRY macro takes two parameters: test case name and test case |
|
118 * function name. |
|
119 * |
|
120 * FUNCENTRY macro takes only test case function name as a parameter and |
|
121 * uses that as a test case name and test case function name. |
|
122 * |
|
123 * Or |
|
124 * |
|
125 * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used |
|
126 * only with OOM (Out-Of-Memory) testing! |
|
127 * |
|
128 * OOM_ENTRY macro takes five parameters: test case name, test case |
|
129 * function name, TBool which specifies is method supposed to be run using |
|
130 * OOM conditions, TInt value for first heap memory allocation failure and |
|
131 * TInt value for last heap memory allocation failure. |
|
132 * |
|
133 * OOM_FUNCENTRY macro takes test case function name as a parameter and uses |
|
134 * that as a test case name, TBool which specifies is method supposed to be |
|
135 * run using OOM conditions, TInt value for first heap memory allocation |
|
136 * failure and TInt value for last heap memory allocation failure. |
|
137 */ |
|
138 |
|
139 static TCaseInfoInternal const KCases[] = |
|
140 { |
|
141 // To add new test cases, add new items to this array |
|
142 |
|
143 // NOTE: When compiled to GCCE, there must be Classname:: |
|
144 // declaration in front of the method name, e.g. |
|
145 // CSenServiceManagerBCTest::PrintTest. Otherwise the compiler |
|
146 // gives errors. |
|
147 |
|
148 ENTRY("NewL - test ", CSenServiceManagerBCTest::UT_CSenServiceManager_NewLL), |
|
149 ENTRY("NewLC - test ", CSenServiceManagerBCTest::UT_CSenServiceManager_NewLCL), |
|
150 ENTRY("normal - ServiceDescriptionsL", CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsLL_normalL), |
|
151 ENTRY("notFound - ServiceDescriptionsL", CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsLL_notFoundL), |
|
152 ENTRY("badDescriptor - ServiceDescriptionsL", CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsLL_badDescriptorL), |
|
153 ENTRY("NULL - ServiceDescriptionsL", CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsLL_nullL), |
|
154 ENTRY("randomPtr - ServiceDescriptionsL", CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsLL_randomPtrL), |
|
155 ENTRY("normal(URI) - ServiceDescriptionsL", CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsL_1L_normalL), |
|
156 ENTRY("notFound(URI) - ServiceDescriptionsL", CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsL_1L_notFoundL), |
|
157 ENTRY("badDescriptor(URI) - ServiceDescriptionsL", CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsL_1L_badDescriptorL), |
|
158 ENTRY("XMLPattern(URI) - ServiceDescriptionsL", CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsL_1L_XMLpatternL), |
|
159 ENTRY("normal - RegisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_normalL), |
|
160 ENTRY("badDescriptor - RegisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_badDescriptorL), |
|
161 ENTRY("no Endpoint - RegisterServiceDescriptionL ", CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_noEndpointL), |
|
162 ENTRY("no Contract - RegisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_noContractL), |
|
163 ENTRY("bad Framework - RegisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_badFrameworkL), |
|
164 ENTRY("random Ptr - RegisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_randomPtrL), |
|
165 ENTRY("NULL - RegisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_nullL), |
|
166 ENTRY("normal - UnregisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_normalL), |
|
167 ENTRY("badDescriptor - UnregisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_badDescriptorL), |
|
168 ENTRY("noEndpoint - UnregisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_noEndpointL), |
|
169 ENTRY("noContract - UnregisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_noContractL), |
|
170 ENTRY("badFramework - UnregisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_badFrameworkL), |
|
171 ENTRY("randomPtr - UnregisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_randomPtrL), |
|
172 ENTRY("NULL - UnregisterServiceDescriptionL", CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_nullL), |
|
173 ENTRY("normal - RegisterIdentityProviderL", CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterIdentityProviderLL_normalL), |
|
174 ENTRY("badDescriptor - RegisterIdentityProviderL", CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterIdentityProviderLL_badDescriptorL), |
|
175 ENTRY("providerIDInUse - RegisterIdentityProviderL", CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterIdentityProviderLL_providerIDInUseL), |
|
176 ENTRY("NULL - RegisterIdentityProviderL", CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterIdentityProviderLL_nullL), |
|
177 ENTRY("randomPtr - RegisterIdentityProviderL", CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterIdentityProviderLL_randomPtrL), |
|
178 ENTRY("normal - UnregisterIdentityProviderL", CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterIdentityProviderLL_normalL), |
|
179 ENTRY("badDescriptor - UnregisterIdentityProviderL", CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterIdentityProviderLL_badDescriptorL), |
|
180 ENTRY("notFound - UnregisterIdentityProviderL", CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterIdentityProviderLL_notFoundL), |
|
181 ENTRY("NULL - UnregisterIdentityProviderL", CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterIdentityProviderLL_nullL), |
|
182 ENTRY("randomPtr - UnregisterIdentityProviderL", CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterIdentityProviderLL_randomPtrL), |
|
183 ENTRY("normal - AssociateServiceL", CSenServiceManagerBCTest::UT_CSenServiceManager_AssociateServiceLL_normalL), |
|
184 ENTRY("argument - AssociateServiceL", CSenServiceManagerBCTest::UT_CSenServiceManager_AssociateServiceLL_argumentL), |
|
185 ENTRY("notReady - AssociateServiceL", CSenServiceManagerBCTest::UT_CSenServiceManager_AssociateServiceLL_notReadyL), |
|
186 ENTRY("notFound - AssociateServiceL", CSenServiceManagerBCTest::UT_CSenServiceManager_AssociateServiceLL_notFoundL), |
|
187 ENTRY("normal - DissociateServiceL", CSenServiceManagerBCTest::UT_CSenServiceManager_DissociateServiceLL_normalL), |
|
188 ENTRY("argument - DissociateServiceL", CSenServiceManagerBCTest::UT_CSenServiceManager_DissociateServiceLL_argumentL), |
|
189 ENTRY("notReady - DissociateServiceL", CSenServiceManagerBCTest::UT_CSenServiceManager_DissociateServiceLL_notReadyL), |
|
190 ENTRY("notFound - DissociateServiceL", CSenServiceManagerBCTest::UT_CSenServiceManager_DissociateServiceLL_notFoundL), |
|
191 |
|
192 }; |
|
193 |
|
194 // Verify that case number is valid |
|
195 if( (TUint) aCaseNumber >= sizeof( KCases ) / |
|
196 sizeof( TCaseInfoInternal ) ) |
|
197 { |
|
198 // Invalid case, construct empty object |
|
199 TCaseInfo null( (const TText*) L"" ); |
|
200 null.iMethod = NULL; |
|
201 null.iIsOOMTest = EFalse; |
|
202 null.iFirstMemoryAllocation = 0; |
|
203 null.iLastMemoryAllocation = 0; |
|
204 return null; |
|
205 } |
|
206 |
|
207 // Construct TCaseInfo object and return it |
|
208 TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName ); |
|
209 tmp.iMethod = KCases[ aCaseNumber ].iMethod; |
|
210 tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest; |
|
211 tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation; |
|
212 tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation; |
|
213 return tmp; |
|
214 |
|
215 } |
|
216 |
|
217 void CSenServiceManagerBCTest::Empty( ) |
|
218 { |
|
219 } |
|
220 void CSenServiceManagerBCTest::DeleteDBL(){ |
|
221 TPtrC file; |
|
222 TInt fileErr = KErrNone; |
|
223 |
|
224 CFileMan* fileMan = CFileMan::NewL(iFsSession); |
|
225 CleanupStack::PushL(fileMan); |
|
226 |
|
227 fileErr = fileMan->Delete(KSessionsFile); |
|
228 RDebug::Print( KSessionsFile); |
|
229 RDebug::Print( _L( "WSModTester: DeleteFileL status %d" ), fileErr ); |
|
230 |
|
231 if(!(fileErr == KErrNone || fileErr == KErrNotFound)) |
|
232 { |
|
233 User::LeaveIfError(fileErr); |
|
234 } |
|
235 |
|
236 fileErr = fileMan->Delete(KIdentitiesFile); |
|
237 RDebug::Print( _L( "WSModTester: DeleteFileL status %d" ), fileErr ); |
|
238 if(!(fileErr == KErrNone || fileErr == KErrNotFound)) |
|
239 { |
|
240 User::LeaveIfError(fileErr); |
|
241 } |
|
242 |
|
243 CleanupStack::PopAndDestroy(); |
|
244 } |
|
245 |
|
246 void CSenServiceManagerBCTest::SetupL( ) |
|
247 { |
|
248 User::LeaveIfError(this->iFsSession.Connect()); |
|
249 |
|
250 DeleteDBL(); |
|
251 |
|
252 if ( iServiceManager!= NULL ){ |
|
253 delete iServiceManager; |
|
254 iServiceManager = NULL; |
|
255 } |
|
256 iServiceManager = CSenServiceManager::NewL(); |
|
257 User::LeaveIfNull(iServiceManager); |
|
258 |
|
259 if ( iSenXmlServiceDescription!= NULL ){ |
|
260 delete iSenXmlServiceDescription; |
|
261 iSenXmlServiceDescription = NULL; |
|
262 } |
|
263 iSenXmlServiceDescription = CSenXmlServiceDescription::NewL(); |
|
264 User::LeaveIfNull(iSenXmlServiceDescription); |
|
265 |
|
266 if ( iProvider != NULL ){ |
|
267 delete iProvider; |
|
268 iProvider = NULL; |
|
269 } |
|
270 iProvider = CSenIdentityProvider::NewL(KText, KText); |
|
271 User::LeaveIfNull(iProvider); |
|
272 |
|
273 } |
|
274 |
|
275 void CSenServiceManagerBCTest::Teardown( ) |
|
276 { |
|
277 if ( iSenXmlServiceDescription!= NULL ){ |
|
278 delete iSenXmlServiceDescription; |
|
279 iSenXmlServiceDescription = NULL; |
|
280 } |
|
281 if ( iServiceManager!= NULL ){ |
|
282 delete iServiceManager; |
|
283 iServiceManager = NULL; |
|
284 } |
|
285 if ( iProvider!= NULL ){ |
|
286 delete iProvider; |
|
287 iProvider = NULL; |
|
288 } |
|
289 iFsSession.Close(); |
|
290 } |
|
291 |
|
292 //------------------------------------------- |
|
293 // METHODS |
|
294 //------------------------------------------- |
|
295 |
|
296 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_NewLL( TTestResult& aResult ) |
|
297 { |
|
298 Empty(); |
|
299 |
|
300 CSenServiceManager* serviceManager = NULL; |
|
301 CSenServiceManager* serviceManager2 = NULL; |
|
302 serviceManager = CSenServiceManager::NewL(); |
|
303 TL(serviceManager != (CSenServiceManager*)NULL); |
|
304 |
|
305 __ASSERT_ALWAYS_NO_LEAVE(delete serviceManager ); |
|
306 |
|
307 serviceManager = NULL; |
|
308 |
|
309 serviceManager = CSenServiceManager::NewL(); |
|
310 TRAPD(error, serviceManager2 = CSenServiceManager::NewL()); |
|
311 RDebug::Print( _L( "WSModTester: CSenServiceManager_NewL 2nd try with status %d" ), error); |
|
312 LOCAL_ASSERT(error==KErrNone); |
|
313 |
|
314 if (serviceManager != NULL){ |
|
315 __ASSERT_ALWAYS_NO_LEAVE(delete serviceManager ); |
|
316 serviceManager = NULL; |
|
317 } |
|
318 |
|
319 if (serviceManager2 != NULL){ |
|
320 __ASSERT_ALWAYS_NO_LEAVE(delete serviceManager2 ); |
|
321 serviceManager2 = NULL; |
|
322 } |
|
323 |
|
324 Empty(); |
|
325 return KErrNone; |
|
326 } |
|
327 |
|
328 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_NewLCL( TTestResult& aResult ) |
|
329 { |
|
330 Empty(); |
|
331 |
|
332 CSenServiceManager* serviceManager = NULL; |
|
333 serviceManager = CSenServiceManager::NewLC(); |
|
334 TL(serviceManager != (CSenServiceManager*)NULL); |
|
335 CleanupStack::PopAndDestroy(); |
|
336 serviceManager = NULL; |
|
337 Empty(); |
|
338 return KErrNone; |
|
339 } |
|
340 |
|
341 //------------------------------------------- |
|
342 // SEARCHING |
|
343 //------------------------------------------- |
|
344 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsLL_normalL(TTestResult& aResult) |
|
345 { |
|
346 SetupL(); |
|
347 |
|
348 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
349 iSenXmlServiceDescription->SetEndPointL(KText); |
|
350 iSenXmlServiceDescription->SetContractL(KText); |
|
351 LOCAL_ASSERT((iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNone); |
|
352 |
|
353 RServiceDescriptionArray arr; |
|
354 LOCAL_ASSERT(iServiceManager->ServiceDescriptionsL(*iSenXmlServiceDescription, arr) == KErrNone); |
|
355 TInt SDs = arr.Count(); |
|
356 LOCAL_ASSERT(SDs == 1); |
|
357 arr.ResetAndDestroy(); |
|
358 |
|
359 //Added Vaibhav |
|
360 iServiceManager->UnregisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
361 |
|
362 Teardown(); |
|
363 return KErrNone; |
|
364 } |
|
365 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsLL_notFoundL(TTestResult& aResult) |
|
366 { |
|
367 SetupL(); |
|
368 |
|
369 iSenXmlServiceDescription->SetEndPointL(KText); |
|
370 RServiceDescriptionArray arr; |
|
371 LOCAL_ASSERT(iServiceManager->ServiceDescriptionsL(*iSenXmlServiceDescription, arr) == KErrNotFound); |
|
372 TInt SDs = arr.Count(); |
|
373 LOCAL_ASSERT(SDs == 0); |
|
374 arr.ResetAndDestroy(); |
|
375 |
|
376 Teardown(); |
|
377 return KErrNone; |
|
378 } |
|
379 |
|
380 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsLL_badDescriptorL(TTestResult& aResult) |
|
381 { |
|
382 SetupL(); |
|
383 |
|
384 iSenXmlServiceDescription->SetEndPointL(KNullDesC8); |
|
385 RServiceDescriptionArray arr; |
|
386 TInt SDs = arr.Count(); |
|
387 LOCAL_ASSERT(SDs == 0); |
|
388 arr.ResetAndDestroy(); |
|
389 |
|
390 Teardown(); |
|
391 return KErrNone; |
|
392 } |
|
393 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsLL_nullL(TTestResult& aResult) |
|
394 { |
|
395 SetupL(); |
|
396 |
|
397 delete iSenXmlServiceDescription; |
|
398 iSenXmlServiceDescription = NULL; |
|
399 RServiceDescriptionArray arr; |
|
400 |
|
401 #ifdef __WINS__ |
|
402 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcAccessViolation) ; |
|
403 #else |
|
404 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcPageFault) ; |
|
405 #endif |
|
406 iServiceManager->ServiceDescriptionsL(*iSenXmlServiceDescription, arr); |
|
407 |
|
408 TInt SDs = arr.Count(); |
|
409 LOCAL_ASSERT(SDs == 0); |
|
410 arr.ResetAndDestroy(); |
|
411 |
|
412 Teardown(); |
|
413 return KErrNone; |
|
414 } |
|
415 |
|
416 |
|
417 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsLL_randomPtrL(TTestResult& aResult) |
|
418 { |
|
419 SetupL(); |
|
420 |
|
421 delete iSenXmlServiceDescription; |
|
422 iSenXmlServiceDescription = (CSenXmlServiceDescription *)0xeaeaea; |
|
423 RServiceDescriptionArray arr; |
|
424 |
|
425 #ifdef __WINS__ |
|
426 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcAccessViolation) ; |
|
427 #else |
|
428 TestModuleIf().SetExitReason (TestModuleIf(). EException,EExcPageFault); |
|
429 #endif |
|
430 iServiceManager->ServiceDescriptionsL(*iSenXmlServiceDescription, arr); |
|
431 |
|
432 TInt SDs = arr.Count(); |
|
433 LOCAL_ASSERT(SDs == 0); |
|
434 arr.ResetAndDestroy(); |
|
435 |
|
436 Teardown(); |
|
437 return KErrNone; |
|
438 } |
|
439 |
|
440 |
|
441 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsL_1L_normalL(TTestResult& aResult) |
|
442 { |
|
443 |
|
444 SetupL(); |
|
445 |
|
446 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
447 iSenXmlServiceDescription->SetEndPointL(KText); |
|
448 iSenXmlServiceDescription->SetContractL(KText); |
|
449 LOCAL_ASSERT((iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNone); |
|
450 |
|
451 RServiceDescriptionArray arr; |
|
452 LOCAL_ASSERT(iServiceManager->ServiceDescriptionsL(KText, arr) == KErrNone); |
|
453 TInt SDs = arr.Count(); |
|
454 LOCAL_ASSERT(SDs == 1); |
|
455 |
|
456 arr.ResetAndDestroy(); |
|
457 |
|
458 //Added Vaibhav |
|
459 iServiceManager->UnregisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
460 |
|
461 Teardown(); |
|
462 return KErrNone; |
|
463 } |
|
464 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsL_1L_notFoundL(TTestResult& aResult) |
|
465 { |
|
466 SetupL(); |
|
467 |
|
468 RServiceDescriptionArray arr; |
|
469 LOCAL_ASSERT(iServiceManager->ServiceDescriptionsL(KText, arr) == KErrNotFound); |
|
470 TInt SDs = arr.Count(); |
|
471 LOCAL_ASSERT(SDs == 0); |
|
472 arr.ResetAndDestroy(); |
|
473 |
|
474 Teardown(); |
|
475 return KErrNone; |
|
476 } |
|
477 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsL_1L_badDescriptorL(TTestResult& aResult) |
|
478 { |
|
479 SetupL(); |
|
480 |
|
481 RServiceDescriptionArray arr; |
|
482 //LOCAL_ASSERT(iServiceManager->ServiceDescriptionsL(KNullDesC8, arr) == KErrBadDescriptor); |
|
483 TInt SDs = arr.Count(); |
|
484 LOCAL_ASSERT(SDs == 0); |
|
485 arr.ResetAndDestroy(); |
|
486 |
|
487 Teardown(); |
|
488 return KErrNone; |
|
489 } |
|
490 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_ServiceDescriptionsL_1L_XMLpatternL(TTestResult& aResult) |
|
491 { |
|
492 SetupL(); |
|
493 |
|
494 RServiceDescriptionArray arr; |
|
495 _LIT8(KXmlPattern, "&<>"); |
|
496 LOCAL_ASSERT(iServiceManager->ServiceDescriptionsL(KXmlPattern, arr) == KErrNotFound); |
|
497 TInt SDs = arr.Count(); |
|
498 LOCAL_ASSERT(SDs == 0); |
|
499 arr.ResetAndDestroy(); |
|
500 |
|
501 Teardown(); |
|
502 return KErrNone; |
|
503 } |
|
504 //------------------------------------------- |
|
505 // REGISTERING SERVICE |
|
506 //------------------------------------------- |
|
507 |
|
508 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_normalL(TTestResult& aResult){ |
|
509 SetupL(); |
|
510 |
|
511 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
512 iSenXmlServiceDescription->SetEndPointL(KText); |
|
513 iSenXmlServiceDescription->SetContractL(KText); |
|
514 LOCAL_ASSERT((iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNone); |
|
515 |
|
516 //Added Vaibhav |
|
517 iServiceManager->UnregisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
518 |
|
519 Teardown(); |
|
520 return KErrNone; |
|
521 } |
|
522 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_badDescriptorL(TTestResult& aResult){ |
|
523 SetupL(); |
|
524 |
|
525 Teardown(); |
|
526 return KErrNone; |
|
527 } |
|
528 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_noEndpointL(TTestResult& aResult) |
|
529 { |
|
530 SetupL(); |
|
531 |
|
532 TInt error = KErrNone; |
|
533 |
|
534 //not set |
|
535 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
536 iSenXmlServiceDescription->SetContractL(KText); |
|
537 error = iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
538 RDebug::Print( _L( "WSModTester: CSenServiceManager_RegisterServiceDescriptionLL_noEndpoint status %d" ), error); |
|
539 |
|
540 //null |
|
541 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
542 iSenXmlServiceDescription->SetContractL(KText); |
|
543 iSenXmlServiceDescription->SetEndPointL(KNullDesC8); |
|
544 error = iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
545 RDebug::Print( _L( "WSModTester: CSenServiceManager_RegisterServiceDescriptionLL_noEndpoint status %d" ), error); |
|
546 |
|
547 Teardown(); |
|
548 return KErrNone; |
|
549 |
|
550 } |
|
551 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_noContractL(TTestResult& aResult) |
|
552 { |
|
553 SetupL(); |
|
554 |
|
555 TInt error = KErrNone; |
|
556 |
|
557 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
558 error = iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
559 RDebug::Print( _L( "WSModTester: CSenServiceManager_RegisterServiceDescriptionLL_noContract status %d" ), error); |
|
560 |
|
561 //not set |
|
562 iSenXmlServiceDescription->SetEndPointL(KText); |
|
563 error = iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
564 RDebug::Print( _L( "WSModTester: CSenServiceManager_RegisterServiceDescriptionLL_noContract status %d" ), error); |
|
565 LOCAL_ASSERT(error == KErrSenNoContract); |
|
566 |
|
567 //null |
|
568 iSenXmlServiceDescription->SetContractL(KNullDesC8); |
|
569 error = iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
570 RDebug::Print( _L( "WSModTester: CSenServiceManager_RegisterServiceDescriptionLL_noContract status %d" ), error); |
|
571 LOCAL_ASSERT(error == KErrSenNoContract); |
|
572 |
|
573 Teardown(); |
|
574 return KErrNone; |
|
575 |
|
576 } |
|
577 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_badFrameworkL(TTestResult& aResult) |
|
578 { |
|
579 SetupL(); |
|
580 |
|
581 _LIT8(KBadFramework,"bla"); |
|
582 iSenXmlServiceDescription->SetFrameworkIdL(KBadFramework); |
|
583 iSenXmlServiceDescription->SetEndPointL(KText); |
|
584 iSenXmlServiceDescription->SetContractL(KText); |
|
585 LOCAL_ASSERT((iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNotFound); |
|
586 |
|
587 Teardown(); |
|
588 return KErrNone; |
|
589 } |
|
590 |
|
591 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_randomPtrL(TTestResult& aResult){ |
|
592 SetupL(); |
|
593 |
|
594 delete iSenXmlServiceDescription; |
|
595 iSenXmlServiceDescription = (CSenXmlServiceDescription *)0xeaeaea; |
|
596 #ifdef __WINS__ |
|
597 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcAccessViolation) ; |
|
598 #else |
|
599 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcPageFault) ; |
|
600 #endif |
|
601 iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
602 |
|
603 Teardown(); |
|
604 return KErrNone; |
|
605 |
|
606 } |
|
607 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterServiceDescriptionLL_nullL(TTestResult& aResult){ |
|
608 SetupL(); |
|
609 |
|
610 delete iSenXmlServiceDescription; |
|
611 iSenXmlServiceDescription = NULL; |
|
612 #ifdef __WINS__ |
|
613 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcAccessViolation) ; |
|
614 #else |
|
615 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcPageFault) ; |
|
616 #endif |
|
617 iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
618 |
|
619 Teardown(); |
|
620 return KErrNone; |
|
621 |
|
622 } |
|
623 //------------------------------------------- |
|
624 // UNREGISTERING SERVICE |
|
625 //------------------------------------------- |
|
626 |
|
627 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_normalL(TTestResult& aResult) |
|
628 { |
|
629 SetupL(); |
|
630 |
|
631 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
632 iSenXmlServiceDescription->SetEndPointL(KText); |
|
633 iSenXmlServiceDescription->SetContractL(KText); |
|
634 LOCAL_ASSERT((iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNone); |
|
635 LOCAL_ASSERT((iServiceManager->UnregisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNone); |
|
636 |
|
637 Teardown(); |
|
638 return KErrNone; |
|
639 } |
|
640 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_badDescriptorL(TTestResult& aResult){ |
|
641 SetupL(); |
|
642 |
|
643 Teardown(); |
|
644 return KErrNone; |
|
645 } |
|
646 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_noEndpointL(TTestResult& aResult) |
|
647 { |
|
648 SetupL(); |
|
649 |
|
650 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
651 iSenXmlServiceDescription->SetEndPointL(KText); |
|
652 iSenXmlServiceDescription->SetContractL(KText); |
|
653 LOCAL_ASSERT((iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNone); |
|
654 iSenXmlServiceDescription->SetEndPointL(KNullDesC8); |
|
655 |
|
656 Teardown(); |
|
657 return KErrNone; |
|
658 } |
|
659 |
|
660 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_noContractL(TTestResult& aResult) |
|
661 { |
|
662 SetupL(); |
|
663 |
|
664 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
665 iSenXmlServiceDescription->SetEndPointL(KText); |
|
666 iSenXmlServiceDescription->SetContractL(KText); |
|
667 LOCAL_ASSERT((iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNone); |
|
668 iSenXmlServiceDescription->SetContractL(KNullDesC8); |
|
669 LOCAL_ASSERT((iServiceManager->UnregisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrSenNoContract); |
|
670 |
|
671 Teardown(); |
|
672 return KErrNone; |
|
673 } |
|
674 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_badFrameworkL(TTestResult& aResult) |
|
675 { |
|
676 SetupL(); |
|
677 |
|
678 _LIT8(KBadFramework,"bla"); |
|
679 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
680 iSenXmlServiceDescription->SetEndPointL(KText); |
|
681 iSenXmlServiceDescription->SetContractL(KText); |
|
682 LOCAL_ASSERT((iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNone); |
|
683 iSenXmlServiceDescription->SetFrameworkIdL(KBadFramework); |
|
684 LOCAL_ASSERT((iServiceManager->UnregisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNotFound); |
|
685 |
|
686 Teardown(); |
|
687 return KErrNone; |
|
688 } |
|
689 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_randomPtrL(TTestResult& aResult) |
|
690 { |
|
691 SetupL(); |
|
692 |
|
693 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
694 iSenXmlServiceDescription->SetEndPointL(KText); |
|
695 iSenXmlServiceDescription->SetContractL(KText); |
|
696 LOCAL_ASSERT((iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNone); |
|
697 iSenXmlServiceDescription = (CSenXmlServiceDescription *)0xeaeaea; |
|
698 #ifdef __WINS__ |
|
699 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcAccessViolation) ; |
|
700 #else |
|
701 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcPageFault) ; |
|
702 #endif |
|
703 iServiceManager->UnregisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
704 |
|
705 Teardown(); |
|
706 return KErrNone; |
|
707 } |
|
708 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterServiceDescriptionLL_nullL(TTestResult& aResult) |
|
709 { |
|
710 SetupL(); |
|
711 |
|
712 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
713 iSenXmlServiceDescription->SetEndPointL(KText); |
|
714 iSenXmlServiceDescription->SetContractL(KText); |
|
715 LOCAL_ASSERT((iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNone); |
|
716 iSenXmlServiceDescription = NULL; |
|
717 #ifdef __WINS__ |
|
718 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcAccessViolation) ; |
|
719 #else |
|
720 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcPageFault) ; |
|
721 #endif |
|
722 iServiceManager->UnregisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
723 |
|
724 Teardown(); |
|
725 return KErrNone; |
|
726 |
|
727 } |
|
728 |
|
729 //------------------------------------------- |
|
730 // REGISTERING IDENTITY |
|
731 //------------------------------------------- |
|
732 |
|
733 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterIdentityProviderLL_normalL(TTestResult& aResult) |
|
734 { |
|
735 SetupL(); |
|
736 |
|
737 iProvider->SetProviderID(KText); |
|
738 iProvider->SetUserInfoL(KText, KText, KText); |
|
739 LOCAL_ASSERT((iServiceManager->RegisterIdentityProviderL(*iProvider)) == KErrNone); |
|
740 |
|
741 //Added Vaibhav |
|
742 iServiceManager->UnregisterIdentityProviderL(*iProvider); |
|
743 |
|
744 Teardown(); |
|
745 return KErrNone; |
|
746 } |
|
747 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterIdentityProviderLL_badDescriptorL(TTestResult& aResult) |
|
748 { |
|
749 SetupL(); |
|
750 |
|
751 Teardown(); |
|
752 return KErrNone; |
|
753 } |
|
754 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterIdentityProviderLL_providerIDInUseL(TTestResult& aResult) |
|
755 { |
|
756 TRAPD(err, SetupL()) |
|
757 if(err != KErrNone)return err; |
|
758 |
|
759 iProvider->SetProviderID(KText); |
|
760 iProvider->SetUserInfoL(KText, KText, KText); |
|
761 iServiceManager->RegisterIdentityProviderL(*iProvider); |
|
762 |
|
763 CSenIdentityProvider* provider = CSenIdentityProvider::NewL(KText2, KText2); |
|
764 provider->SetProviderID(KText); |
|
765 LOCAL_ASSERT((iServiceManager->RegisterIdentityProviderL(*provider)) == KErrSenProviderIdInUseByAnotherEndpoint); |
|
766 delete provider; |
|
767 |
|
768 Teardown(); |
|
769 return KErrNone; |
|
770 } |
|
771 |
|
772 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterIdentityProviderLL_nullL(TTestResult& aResult) |
|
773 { |
|
774 SetupL(); |
|
775 |
|
776 delete iProvider; |
|
777 iProvider = NULL; |
|
778 #ifdef __WINS__ |
|
779 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcAccessViolation) ; |
|
780 #else |
|
781 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcPageFault) ; |
|
782 #endif |
|
783 iServiceManager->RegisterIdentityProviderL(*iProvider); |
|
784 |
|
785 Teardown(); |
|
786 return KErrNone; |
|
787 } |
|
788 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_RegisterIdentityProviderLL_randomPtrL(TTestResult& aResult) |
|
789 { |
|
790 SetupL(); |
|
791 |
|
792 delete iProvider; |
|
793 iProvider = (CSenIdentityProvider *)0xeaeaea; |
|
794 #ifdef __WINS__ |
|
795 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcAccessViolation) ; |
|
796 #else |
|
797 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcPageFault) ; |
|
798 #endif |
|
799 iServiceManager->RegisterIdentityProviderL(*iProvider); |
|
800 |
|
801 Teardown(); |
|
802 return KErrNone; |
|
803 } |
|
804 |
|
805 //------------------------------------------- |
|
806 // UNREGISTERING IDENTITY |
|
807 //------------------------------------------- |
|
808 |
|
809 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterIdentityProviderLL_normalL(TTestResult& aResult) |
|
810 { |
|
811 SetupL(); |
|
812 |
|
813 iProvider->SetProviderID(KText); |
|
814 iProvider->SetUserInfoL(KText, KText, KText); |
|
815 LOCAL_ASSERT((iServiceManager->RegisterIdentityProviderL(*iProvider)) == KErrNone); |
|
816 LOCAL_ASSERT((iServiceManager->UnregisterIdentityProviderL( *iProvider)) == KErrNone); |
|
817 |
|
818 Teardown(); |
|
819 return KErrNone; |
|
820 } |
|
821 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterIdentityProviderLL_badDescriptorL(TTestResult& aResult) |
|
822 { |
|
823 SetupL(); |
|
824 |
|
825 Teardown(); |
|
826 return KErrNone; |
|
827 } |
|
828 |
|
829 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterIdentityProviderLL_notFoundL(TTestResult& aResult) |
|
830 { |
|
831 SetupL(); |
|
832 |
|
833 iProvider->SetProviderID(KText); |
|
834 iProvider->SetUserInfoL(KText, KText, KText); |
|
835 LOCAL_ASSERT((iServiceManager->RegisterIdentityProviderL(*iProvider)) == KErrNone); |
|
836 |
|
837 CSenIdentityProvider* provider = CSenIdentityProvider::NewL(KText2, KText2); |
|
838 provider->SetProviderID(KText2); |
|
839 LOCAL_ASSERT((iServiceManager->UnregisterIdentityProviderL( *provider)) == KErrNotFound); |
|
840 delete provider; |
|
841 |
|
842 Teardown(); |
|
843 return KErrNone; |
|
844 } |
|
845 |
|
846 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterIdentityProviderLL_nullL(TTestResult& aResult) |
|
847 { |
|
848 SetupL(); |
|
849 |
|
850 delete iProvider; |
|
851 iProvider = NULL; |
|
852 #ifdef __WINS__ |
|
853 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcAccessViolation) ; |
|
854 #else |
|
855 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcPageFault) ; |
|
856 #endif |
|
857 iServiceManager->UnregisterIdentityProviderL( *iProvider); |
|
858 |
|
859 Teardown(); |
|
860 return KErrNone; |
|
861 |
|
862 } |
|
863 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_UnregisterIdentityProviderLL_randomPtrL(TTestResult& aResult) |
|
864 { |
|
865 SetupL(); |
|
866 |
|
867 delete iProvider; |
|
868 iProvider = (CSenIdentityProvider *)0xeaeaea; |
|
869 #ifdef __WINS__ |
|
870 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcAccessViolation) ; |
|
871 #else |
|
872 TestModuleIf().SetExitReason (TestModuleIf(). EException, EExcPageFault) ; |
|
873 #endif |
|
874 iServiceManager->UnregisterIdentityProviderL( *iProvider); |
|
875 |
|
876 Teardown(); |
|
877 return KErrNone; |
|
878 |
|
879 } |
|
880 |
|
881 //------------------------------------------- |
|
882 // ASSOCIATE IDENTITY |
|
883 //------------------------------------------- |
|
884 |
|
885 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_AssociateServiceLL_normalL(TTestResult& aResult) |
|
886 { |
|
887 SetupL(); |
|
888 |
|
889 iProvider->SetProviderID(KText2); |
|
890 iProvider->SetUserInfoL(KText, KNullDesC8, KNullDesC8); |
|
891 |
|
892 iSenXmlServiceDescription->SetEndPointL(KText); |
|
893 iSenXmlServiceDescription->SetContractL(KText); |
|
894 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
895 LOCAL_ASSERT((iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNone); |
|
896 LOCAL_ASSERT((iServiceManager->RegisterIdentityProviderL(*iProvider)) == KErrNone); |
|
897 LOCAL_ASSERT((iServiceManager->AssociateServiceL(KText, KText2)) == KErrNone); |
|
898 //2nd time doesnt matter |
|
899 LOCAL_ASSERT((iServiceManager->AssociateServiceL(KText, KText2)) == KErrNone); |
|
900 |
|
901 //Added Vaibhav |
|
902 iServiceManager->DissociateServiceL(KText, KText2); |
|
903 iServiceManager->UnregisterIdentityProviderL(*iProvider); |
|
904 iServiceManager->UnregisterServiceDescriptionL( *iSenXmlServiceDescription); |
|
905 |
|
906 Teardown(); |
|
907 return KErrNone; |
|
908 } |
|
909 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_AssociateServiceLL_argumentL(TTestResult& aResult) |
|
910 { |
|
911 SetupL(); |
|
912 |
|
913 LOCAL_ASSERT((iServiceManager->AssociateServiceL(KText, KNullDesC8)) == KErrArgument); |
|
914 LOCAL_ASSERT((iServiceManager->AssociateServiceL(KNullDesC8, KText)) == KErrArgument); |
|
915 LOCAL_ASSERT((iServiceManager->AssociateServiceL(KNullDesC8, KNullDesC8)) == KErrArgument); |
|
916 _LIT8(KPattern, "&<>"); |
|
917 iProvider->SetProviderID(KText); |
|
918 LOCAL_ASSERT((iServiceManager->RegisterIdentityProviderL(*iProvider)) == KErrNone); |
|
919 |
|
920 Teardown(); |
|
921 return KErrNone; |
|
922 } |
|
923 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_AssociateServiceLL_notReadyL(TTestResult& aResult) |
|
924 { |
|
925 SetupL(); |
|
926 |
|
927 Teardown(); |
|
928 return KErrNone; |
|
929 } |
|
930 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_AssociateServiceLL_notFoundL(TTestResult& aResult) |
|
931 { |
|
932 TRAPD(err, SetupL()) |
|
933 if(err != KErrNone)return err; |
|
934 |
|
935 iProvider->SetProviderID(KText); |
|
936 LOCAL_ASSERT((iServiceManager->RegisterIdentityProviderL(*iProvider)) == KErrNone); |
|
937 LOCAL_ASSERT((iServiceManager->AssociateServiceL(KText2, KText2)) == KErrNotFound); |
|
938 |
|
939 Teardown(); |
|
940 return KErrNone; |
|
941 } |
|
942 //------------------------------------------- |
|
943 // DISSOCIATE IDENTITY |
|
944 //------------------------------------------- |
|
945 |
|
946 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_DissociateServiceLL_normalL(TTestResult& aResult) |
|
947 { |
|
948 SetupL(); |
|
949 |
|
950 iProvider->SetProviderID(KText2); |
|
951 iProvider->SetUserInfoL(KText, KNullDesC8, KNullDesC8); |
|
952 |
|
953 iSenXmlServiceDescription->SetEndPointL(KText); |
|
954 iSenXmlServiceDescription->SetContractL(KText); |
|
955 iSenXmlServiceDescription->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
956 LOCAL_ASSERT((iServiceManager->RegisterServiceDescriptionL( *iSenXmlServiceDescription)) == KErrNone); |
|
957 LOCAL_ASSERT((iServiceManager->RegisterIdentityProviderL(*iProvider)) == KErrNone); |
|
958 LOCAL_ASSERT((iServiceManager->AssociateServiceL(KText, KText2)) == KErrNone); |
|
959 TInt error = KErrNone; |
|
960 error = iServiceManager->DissociateServiceL(KText, KText2); |
|
961 RDebug::Print( _L( "WSModTester: DissociateService status %d" ), error); |
|
962 LOCAL_ASSERT(error == KErrNone); |
|
963 |
|
964 Teardown(); |
|
965 return KErrNone; |
|
966 } |
|
967 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_DissociateServiceLL_argumentL(TTestResult& aResult) |
|
968 { |
|
969 SetupL(); |
|
970 |
|
971 LOCAL_ASSERT((iServiceManager->DissociateServiceL(KText, KNullDesC8)) == KErrArgument); |
|
972 LOCAL_ASSERT((iServiceManager->DissociateServiceL(KNullDesC8, KText)) == KErrArgument); |
|
973 LOCAL_ASSERT((iServiceManager->DissociateServiceL(KNullDesC8, KNullDesC8)) == KErrArgument); |
|
974 |
|
975 Teardown(); |
|
976 return KErrNone; |
|
977 } |
|
978 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_DissociateServiceLL_notReadyL(TTestResult& aResult) |
|
979 { |
|
980 SetupL(); |
|
981 |
|
982 Teardown(); |
|
983 return KErrNone; |
|
984 } |
|
985 TInt CSenServiceManagerBCTest::UT_CSenServiceManager_DissociateServiceLL_notFoundL(TTestResult& aResult) |
|
986 { |
|
987 TRAPD(err, SetupL()) |
|
988 if(err != KErrNone)return err; |
|
989 |
|
990 LOCAL_ASSERT((iServiceManager->DissociateServiceL(KText, KText)) == KErrNotFound); |
|
991 _LIT8(KPattern, "&<>"); |
|
992 |
|
993 Teardown(); |
|
994 return KErrNone; |
|
995 } |
|
996 |
|
997 |
|
998 |
|
999 // ----------------------------------------------------------------------------- |
|
1000 // ?classname::?member_function |
|
1001 // ?implementation_description |
|
1002 // (other items were commented in a header). |
|
1003 // ----------------------------------------------------------------------------- |
|
1004 // |
|
1005 /* |
|
1006 ?type ?classname::?member_function( |
|
1007 ?arg_type arg, |
|
1008 ?arg_type arg ) |
|
1009 { |
|
1010 |
|
1011 ?code |
|
1012 |
|
1013 } |
|
1014 */ |
|
1015 |
|
1016 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
1017 |
|
1018 // ----------------------------------------------------------------------------- |
|
1019 // ?function_name implements... |
|
1020 // ?implementation_description. |
|
1021 // Returns: ?value_1: ?description |
|
1022 // ?value_n: ?description |
|
1023 // ?description |
|
1024 // ----------------------------------------------------------------------------- |
|
1025 // |
|
1026 /* |
|
1027 ?type ?function_name( |
|
1028 ?arg_type arg, // ?description |
|
1029 ?arg_type arg ) // ?description |
|
1030 { |
|
1031 |
|
1032 ?code |
|
1033 |
|
1034 } |
|
1035 */ |
|
1036 // End of File |