|
1 /* |
|
2 * Copyright (c) 2002 - 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // [INCLUDE FILES] - do not remove |
|
22 #include <e32svr.h> |
|
23 #include <StifParser.h> |
|
24 #include <Stiftestinterface.h> |
|
25 #include "UsbObexClassControllerTest.h" |
|
26 |
|
27 // EXTERNAL DATA STRUCTURES |
|
28 //extern ?external_data; |
|
29 |
|
30 // EXTERNAL FUNCTION PROTOTYPES |
|
31 //extern ?external_function( ?arg_type,?arg_type ); |
|
32 |
|
33 // CONSTANTS |
|
34 //const ?type ?constant_var = ?constant; |
|
35 const TUid KCSrcsInterfaceUid = {0x101F7C8C}; |
|
36 const TInt KObexNumInterfaces = 2; |
|
37 |
|
38 // MACROS |
|
39 //#define ?macro ?macro_def |
|
40 |
|
41 // LOCAL CONSTANTS AND MACROS |
|
42 //const ?type ?constant_var = ?constant; |
|
43 //#define ?macro_name ?macro_def |
|
44 |
|
45 // MODULE DATA STRUCTURES |
|
46 //enum ?declaration |
|
47 //typedef ?declaration |
|
48 |
|
49 // LOCAL FUNCTION PROTOTYPES |
|
50 //?type ?function_name( ?arg_type, ?arg_type ); |
|
51 |
|
52 // FORWARD DECLARATIONS |
|
53 //class ?FORWARD_CLASSNAME; |
|
54 |
|
55 // ============================= LOCAL FUNCTIONS =============================== |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // ?function_name ?description. |
|
59 // ?description |
|
60 // Returns: ?value_1: ?description |
|
61 // ?value_n: ?description_line1 |
|
62 // ?description_line2 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 /* |
|
66 ?type ?function_name( |
|
67 ?arg_type arg, // ?description |
|
68 ?arg_type arg) // ?description |
|
69 { |
|
70 |
|
71 ?code // ?comment |
|
72 |
|
73 // ?comment |
|
74 ?code |
|
75 } |
|
76 */ |
|
77 |
|
78 // ============================ MEMBER FUNCTIONS =============================== |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CUsbObexClassControllerTest::Delete |
|
82 // Delete here all resources allocated and opened from test methods. |
|
83 // Called from destructor. |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 void CUsbObexClassControllerTest::Delete() |
|
87 { |
|
88 |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CUsbObexClassControllerTest::RunMethodL |
|
93 // Run specified method. Contains also table of test mothods and their names. |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 TInt CUsbObexClassControllerTest::RunMethodL( |
|
97 CStifItemParser& aItem ) |
|
98 { |
|
99 |
|
100 static TStifFunctionInfo const KFunctions[] = |
|
101 { |
|
102 //ADD NEW ENTRY HERE |
|
103 // [test cases entries] - Do not remove |
|
104 ENTRY( "ExecuteApiTest", CUsbObexClassControllerTest::ExecuteApiTest ), |
|
105 ENTRY( "ExecuteModuleTest", CUsbObexClassControllerTest::ExecuteModuleTest ), |
|
106 ENTRY( "ExecuteBranchTest", CUsbObexClassControllerTest::ExecuteBranchTest ), |
|
107 }; |
|
108 |
|
109 const TInt count = sizeof( KFunctions ) / |
|
110 sizeof( TStifFunctionInfo ); |
|
111 |
|
112 return RunInternalL( KFunctions, count, aItem ); |
|
113 |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CUsbObexClassControllerTest::ExecuteApiTest |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 TInt CUsbObexClassControllerTest::ExecuteApiTest( CStifItemParser& aItem ) |
|
121 { |
|
122 STIF_LOG( "[STIF_LOG] >>>ExecuteApiTest" ); |
|
123 |
|
124 TInt res; |
|
125 TUsbObexClassControllerTestResult testResult = ETestCaseFailed; |
|
126 TPtrC apiTestName( KNullDesC ); |
|
127 |
|
128 res = aItem.GetString( _L( "ExecuteApiTest" ), apiTestName ); |
|
129 if ( res != KErrNone ) |
|
130 { |
|
131 iLog -> Log( _L( "GetString failed with value: %d" ), res ); |
|
132 return res; |
|
133 } |
|
134 |
|
135 TRAP( res, DoExecuteApiTestL( apiTestName, testResult ) ); |
|
136 if ( res != KErrNone ) |
|
137 { |
|
138 iLog -> Log( _L( "DoExecuteApiTestL error: %d"), res ); |
|
139 return res; |
|
140 } |
|
141 |
|
142 STIF_ASSERT_EQUALS( ETestCasePassed, testResult ); |
|
143 STIF_LOG( "[STIF_LOG] Test case passed" ); |
|
144 STIF_LOG( "[STIF_LOG] <<<ExecuteApiTest" ); |
|
145 return KErrNone; |
|
146 } |
|
147 |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CUsbObexClassControllerTest::DoExecuteApiTestL |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 void CUsbObexClassControllerTest::DoExecuteApiTestL( TPtrC aApiTestName, TUsbObexClassControllerTestResult& aTestResult ) |
|
154 { |
|
155 STIF_LOG( "[STIF_LOG] >>>DoExecuteApiTestL" ); |
|
156 if ( !aApiTestName.Compare( _L( "ExampleApiTest" ) ) ) |
|
157 { |
|
158 STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); |
|
159 ExampleApiTestL( aTestResult ); |
|
160 } |
|
161 else if ( !aApiTestName.Compare( _L( "InitializationTest" ) ) ) |
|
162 { |
|
163 STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); |
|
164 InitializationTestL( aTestResult ); |
|
165 } |
|
166 else if ( !aApiTestName.Compare( _L( "StartTest" ) ) ) |
|
167 { |
|
168 STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); |
|
169 StartTestL( aTestResult ); |
|
170 } |
|
171 else if ( !aApiTestName.Compare( _L( "StopTest" ) ) ) |
|
172 { |
|
173 STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); |
|
174 StopTestL( aTestResult ); |
|
175 } |
|
176 else if ( !aApiTestName.Compare( _L( "InterfaceInfoTest" ) ) ) |
|
177 { |
|
178 STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); |
|
179 InterfaceInfoTestL( aTestResult ); |
|
180 } |
|
181 else if ( !aApiTestName.Compare( _L( "InterfaceLengthInfoTest" ) ) ) |
|
182 { |
|
183 STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); |
|
184 InterfaceLengthInfoTestL( aTestResult ); |
|
185 } |
|
186 else if ( !aApiTestName.Compare( _L( "NumberOfInterfacesInfoTest" ) ) ) |
|
187 { |
|
188 STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); |
|
189 NumberOfInterfacesInfoTestL( aTestResult ); |
|
190 } |
|
191 else if ( !aApiTestName.Compare( _L( "StartupPriorityInfoTest" ) ) ) |
|
192 { |
|
193 STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); |
|
194 StartupPriorityInfoTestL( aTestResult ); |
|
195 } |
|
196 else if ( !aApiTestName.Compare( _L( "StateInfoTest" ) ) ) |
|
197 { |
|
198 STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); |
|
199 StateInfoTestL( aTestResult ); |
|
200 } |
|
201 else if ( !aApiTestName.Compare( _L( "OwnerTest" ) ) ) |
|
202 { |
|
203 STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); |
|
204 OwnerTestL( aTestResult ); |
|
205 } |
|
206 else |
|
207 { |
|
208 STIF_LOG( "[STIF_LOG] Api test type: not found" ); |
|
209 User::Leave( KErrNotFound ); |
|
210 } |
|
211 STIF_LOG( "[STIF_LOG] <<<DoExecuteApiTestL" ); |
|
212 } |
|
213 |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CUsbObexClassControllerTest::ExecuteApiTest |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 void CUsbObexClassControllerTest::ExampleApiTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
220 { |
|
221 STIF_LOG( "[STIF_LOG] >>>ExampleApiTestL" ); |
|
222 |
|
223 aTestResult = ETestCasePassed; |
|
224 |
|
225 STIF_LOG( "[STIF_LOG] <<<ExampleApiTestL" ); |
|
226 } |
|
227 |
|
228 // ----------------------------------------------------------------------------- |
|
229 // CUsbObexClassControllerTest::ExecuteModuleTest |
|
230 // ----------------------------------------------------------------------------- |
|
231 // |
|
232 TInt CUsbObexClassControllerTest::ExecuteModuleTest( CStifItemParser& aItem ) |
|
233 { |
|
234 STIF_LOG( "[STIF_LOG] >>>ExecuteModuleTest" ); |
|
235 |
|
236 TInt res; |
|
237 TUsbObexClassControllerTestResult testResult; |
|
238 TPtrC moduleTestName( KNullDesC ); |
|
239 |
|
240 res = aItem.GetString( _L( "ExecuteModuleTest" ), moduleTestName ); |
|
241 if ( res != KErrNone ) |
|
242 { |
|
243 iLog -> Log( _L( "GetString failed with value: %d" ), res ); |
|
244 return res; |
|
245 } |
|
246 |
|
247 TRAP( res, DoExecuteModuleTestL( moduleTestName, testResult ) ); |
|
248 if ( res != KErrNone ) |
|
249 { |
|
250 iLog -> Log( _L( "DoExecuteModuleTestL error: %d"), res ); |
|
251 return res; |
|
252 } |
|
253 |
|
254 STIF_ASSERT_EQUALS( ETestCasePassed, testResult ); |
|
255 STIF_LOG( "[STIF_LOG] Test case passed" ); |
|
256 STIF_LOG( "[STIF_LOG] <<<ExecuteModuleTest" ); |
|
257 return KErrNone; |
|
258 } |
|
259 |
|
260 // ----------------------------------------------------------------------------- |
|
261 // CUsbObexClassControllerTest::DoExecuteModuleTestL |
|
262 // ----------------------------------------------------------------------------- |
|
263 // |
|
264 void CUsbObexClassControllerTest::DoExecuteModuleTestL( TPtrC aModuleTestName, TUsbObexClassControllerTestResult& aTestResult ) |
|
265 { |
|
266 STIF_LOG( "[STIF_LOG] >>>DoExecuteModuleTestL" ); |
|
267 if ( !aModuleTestName.Compare( _L( "ExampleModuleTest" ) ) ) |
|
268 { |
|
269 STIF_LOG( "[STIF_LOG] Module test type: ExampleModuleTest" ); |
|
270 ExampleModuleTestL( aTestResult ); |
|
271 } |
|
272 else |
|
273 { |
|
274 STIF_LOG( "[STIF_LOG] Module test type: not found" ); |
|
275 User::Leave( KErrNotFound ); |
|
276 } |
|
277 STIF_LOG( "[STIF_LOG] <<<DoExecuteModuleTestL" ); |
|
278 } |
|
279 |
|
280 |
|
281 // ----------------------------------------------------------------------------- |
|
282 // CUsbObexClassControllerTest::ExampleModuleTestL |
|
283 // ----------------------------------------------------------------------------- |
|
284 // |
|
285 void CUsbObexClassControllerTest::ExampleModuleTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
286 { |
|
287 STIF_LOG( "[STIF_LOG] >>>ExampleModuleTestL" ); |
|
288 |
|
289 aTestResult = ETestCasePassed; |
|
290 |
|
291 STIF_LOG( "[STIF_LOG] <<<ExampleModuleTestL" ); |
|
292 } |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CUsbObexClassControllerTest::ExecuteBranchTest |
|
296 // ----------------------------------------------------------------------------- |
|
297 // |
|
298 TInt CUsbObexClassControllerTest::ExecuteBranchTest( CStifItemParser& aItem ) |
|
299 { |
|
300 STIF_LOG( "[STIF_LOG] >>>ExecuteBranchTest" ); |
|
301 |
|
302 TInt res; |
|
303 TUsbObexClassControllerTestResult testResult; |
|
304 TPtrC branchTestName( KNullDesC ); |
|
305 |
|
306 res = aItem.GetString( _L( "ExecuteBranchTest" ), branchTestName ); |
|
307 if ( res != KErrNone ) |
|
308 { |
|
309 iLog -> Log( _L( "GetString failed with value: %d" ), res ); |
|
310 return res; |
|
311 } |
|
312 |
|
313 TRAP( res, DoExecuteBranchTestL( branchTestName, testResult ) ); |
|
314 if ( res != KErrNone ) |
|
315 { |
|
316 iLog -> Log( _L( "DoExecuteBranchTestL error: %d"), res ); |
|
317 return res; |
|
318 } |
|
319 |
|
320 STIF_ASSERT_EQUALS( ETestCasePassed, testResult ); |
|
321 STIF_LOG( "[STIF_LOG] Test case passed" ); |
|
322 STIF_LOG( "[STIF_LOG] <<<ExecuteBranchTest" ); |
|
323 return KErrNone; |
|
324 } |
|
325 |
|
326 // ----------------------------------------------------------------------------- |
|
327 // CUsbObexClassControllerTest::DoExecuteBranchTestL |
|
328 // ----------------------------------------------------------------------------- |
|
329 // |
|
330 void CUsbObexClassControllerTest::DoExecuteBranchTestL( TPtrC aBranchTestName, TUsbObexClassControllerTestResult& aTestResult ) |
|
331 { |
|
332 STIF_LOG( "[STIF_LOG] >>>DoExecuteBranchTestL" ); |
|
333 if ( !aBranchTestName.Compare( _L( "ExampleBranchTest" ) ) ) |
|
334 { |
|
335 STIF_LOG( "[STIF_LOG] Branch test type: ExampleBranchTest" ); |
|
336 ExampleBranchTestL( aTestResult ); |
|
337 } |
|
338 else |
|
339 { |
|
340 STIF_LOG( "[STIF_LOG] Branch test type: not found" ); |
|
341 User::Leave( KErrNotFound ); |
|
342 } |
|
343 STIF_LOG( "[STIF_LOG] <<<DoExecuteBranchTestL" ); |
|
344 } |
|
345 |
|
346 // ----------------------------------------------------------------------------- |
|
347 // CUsbObexClassControllerTest::ExampleBranchTestL |
|
348 // ----------------------------------------------------------------------------- |
|
349 // |
|
350 void CUsbObexClassControllerTest::ExampleBranchTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
351 { |
|
352 STIF_LOG( "[STIF_LOG] >>>ExampleBranchTestL" ); |
|
353 |
|
354 aTestResult = ETestCasePassed; |
|
355 |
|
356 STIF_LOG( "[STIF_LOG] <<<ExampleBranchTestL" ); |
|
357 } |
|
358 |
|
359 |
|
360 // ----------------------------------------------------------------------------- |
|
361 // CUsbObexClassControllerTest::InitializationTestL |
|
362 // ----------------------------------------------------------------------------- |
|
363 // |
|
364 TInt CUsbObexClassControllerTest::InitializationTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
365 { |
|
366 InitializeTestObjectL(); |
|
367 STIF_ASSERT_NOT_NULL( iUsbClassControllerPlugIn ); |
|
368 DeleteTestObject(); |
|
369 |
|
370 // Case was executed |
|
371 iLog->Log( _L("Test Case Passed")); |
|
372 aTestResult = ETestCasePassed; |
|
373 return KErrNone; |
|
374 } |
|
375 |
|
376 |
|
377 // ----------------------------------------------------------------------------- |
|
378 // CUsbObexClassControllerTest::StartTestL |
|
379 // ----------------------------------------------------------------------------- |
|
380 // |
|
381 TInt CUsbObexClassControllerTest::StartTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
382 { |
|
383 iUsbServiceState = EUsbServiceStarted; |
|
384 InitializeTestObjectL(); |
|
385 CUSBObexApiTestActiveObject* activeTestObject = |
|
386 CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); |
|
387 activeTestObject -> Start(); |
|
388 CActiveScheduler::Start(); |
|
389 iLog->Log( _L("UsbServiceState = %d, expected %d"), |
|
390 iUsbServiceState, iUsbClassControllerPlugIn -> State()); |
|
391 STIF_ASSERT_EQUALS( iUsbServiceState, iUsbClassControllerPlugIn -> State() ); |
|
392 DeleteTestObject(); |
|
393 activeTestObject -> Cancel(); |
|
394 |
|
395 // Case was executed |
|
396 iLog->Log( _L("Test Case Passed")); |
|
397 aTestResult = ETestCasePassed; |
|
398 return KErrNone; |
|
399 } |
|
400 |
|
401 // ----------------------------------------------------------------------------- |
|
402 // CUsbObexClassControllerTest::StopTestL |
|
403 // ----------------------------------------------------------------------------- |
|
404 // |
|
405 TInt CUsbObexClassControllerTest::StopTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
406 { |
|
407 iUsbServiceState = EUsbServiceIdle; |
|
408 InitializeTestObjectL(); |
|
409 CUSBObexApiTestActiveObject* activeTestObject = |
|
410 CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); |
|
411 activeTestObject -> Start(); |
|
412 CActiveScheduler::Start(); |
|
413 activeTestObject -> Stop(); |
|
414 CActiveScheduler::Start(); |
|
415 iLog->Log( _L("UsbServiceState = %d, expected %d"), |
|
416 iUsbServiceState, iUsbClassControllerPlugIn -> State()); |
|
417 STIF_ASSERT_EQUALS( iUsbServiceState, iUsbClassControllerPlugIn -> State() ); |
|
418 DeleteTestObject(); |
|
419 activeTestObject -> Cancel(); |
|
420 |
|
421 // Case was executed |
|
422 iLog->Log( _L("Test Case Passed")); |
|
423 aTestResult = ETestCasePassed; |
|
424 return KErrNone; |
|
425 } |
|
426 |
|
427 |
|
428 // ----------------------------------------------------------------------------- |
|
429 // CUsbObexClassControllerTest::InterfaceInfoTestL |
|
430 // ----------------------------------------------------------------------------- |
|
431 // |
|
432 TInt CUsbObexClassControllerTest::InterfaceInfoTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
433 { |
|
434 TUsbDescriptor aDescriptorInfo; |
|
435 RImplInfoPtrArray implInfoArray; |
|
436 CleanupClosePushL(implInfoArray); |
|
437 TEComResolverParams resolverParams; |
|
438 TInt numberOfInterfaces; |
|
439 |
|
440 InitializeTestObjectL(); |
|
441 CUSBObexApiTestActiveObject* activeTestObject = |
|
442 CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); |
|
443 activeTestObject -> Start(); |
|
444 CActiveScheduler::Start(); |
|
445 iUsbClassControllerPlugIn -> GetDescriptorInfo( aDescriptorInfo ); |
|
446 resolverParams.SetDataType( KSrcsTransportUSB ); |
|
447 resolverParams.SetWildcardMatch( EFalse ); |
|
448 REComSession::ListImplementationsL( KCSrcsInterfaceUid, resolverParams, implInfoArray ); |
|
449 numberOfInterfaces = implInfoArray.Count() * KObexNumInterfaces; |
|
450 |
|
451 iLog->Log( _L("Number of interfaces = %d, expected %d"), |
|
452 numberOfInterfaces, aDescriptorInfo.iNumInterfaces); |
|
453 STIF_ASSERT_EQUALS( numberOfInterfaces, aDescriptorInfo.iNumInterfaces ); |
|
454 |
|
455 DeleteTestObject(); |
|
456 activeTestObject -> Cancel(); |
|
457 CleanupStack::PopAndDestroy(&implInfoArray); |
|
458 |
|
459 // Case was executed |
|
460 iLog->Log( _L("Test Case Passed")); |
|
461 aTestResult = ETestCasePassed; |
|
462 return KErrNone; |
|
463 } |
|
464 |
|
465 |
|
466 // ----------------------------------------------------------------------------- |
|
467 // CUsbObexClassControllerTest::InterfaceLengthInfoTestL |
|
468 // ----------------------------------------------------------------------------- |
|
469 // |
|
470 TInt CUsbObexClassControllerTest::InterfaceLengthInfoTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
471 { |
|
472 TUsbDescriptor aDescriptorInfo; |
|
473 RImplInfoPtrArray implInfoArray; |
|
474 CleanupClosePushL(implInfoArray); |
|
475 TEComResolverParams resolverParams; |
|
476 TInt interfaceLength = 0; |
|
477 |
|
478 InitializeTestObjectL(); |
|
479 CUSBObexApiTestActiveObject* activeTestObject = |
|
480 CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); |
|
481 activeTestObject -> Start(); |
|
482 CActiveScheduler::Start(); |
|
483 iUsbClassControllerPlugIn -> GetDescriptorInfo( aDescriptorInfo ); |
|
484 resolverParams.SetDataType( KSrcsTransportUSB ); |
|
485 resolverParams.SetWildcardMatch( EFalse ); |
|
486 REComSession::ListImplementationsL( KCSrcsInterfaceUid, resolverParams, implInfoArray ); |
|
487 |
|
488 iLog->Log( _L("Interface Length = %d, expected %d"), |
|
489 interfaceLength, aDescriptorInfo.iLength); |
|
490 STIF_ASSERT_EQUALS( interfaceLength, aDescriptorInfo.iLength ); |
|
491 |
|
492 DeleteTestObject(); |
|
493 activeTestObject -> Cancel(); |
|
494 CleanupStack::PopAndDestroy(&implInfoArray); |
|
495 |
|
496 // Case was executed |
|
497 iLog->Log( _L("Test Case Passed")); |
|
498 aTestResult = ETestCasePassed; |
|
499 return KErrNone; |
|
500 } |
|
501 |
|
502 |
|
503 // ----------------------------------------------------------------------------- |
|
504 // CUsbObexClassControllerTest::NumberOfInterfacesInfoTestL |
|
505 // ----------------------------------------------------------------------------- |
|
506 // |
|
507 TInt CUsbObexClassControllerTest::NumberOfInterfacesInfoTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
508 { |
|
509 TUsbDescriptor aDescriptorInfo; |
|
510 RImplInfoPtrArray implInfoArray; |
|
511 CleanupClosePushL(implInfoArray); |
|
512 TEComResolverParams resolverParams; |
|
513 TInt interfaceLength = 0; |
|
514 |
|
515 InitializeTestObjectL(); |
|
516 CUSBObexApiTestActiveObject* activeTestObject = |
|
517 CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); |
|
518 activeTestObject -> Start(); |
|
519 CActiveScheduler::Start(); |
|
520 iUsbClassControllerPlugIn -> GetDescriptorInfo( aDescriptorInfo ); |
|
521 resolverParams.SetDataType( KSrcsTransportUSB ); |
|
522 resolverParams.SetWildcardMatch( EFalse ); |
|
523 REComSession::ListImplementationsL( KCSrcsInterfaceUid, resolverParams, implInfoArray ); |
|
524 |
|
525 iLog->Log( _L("Number of Interfaces this class controller is responsible for = %d, expected %d"), |
|
526 interfaceLength, aDescriptorInfo.iNumInterfaces); |
|
527 STIF_ASSERT_EQUALS( interfaceLength, aDescriptorInfo.iLength ); |
|
528 |
|
529 DeleteTestObject(); |
|
530 activeTestObject -> Cancel(); |
|
531 CleanupStack::PopAndDestroy(&implInfoArray); |
|
532 |
|
533 // Case was executed |
|
534 iLog->Log( _L("Test Case Passed")); |
|
535 aTestResult = ETestCasePassed; |
|
536 return KErrNone; |
|
537 } |
|
538 |
|
539 // ----------------------------------------------------------------------------- |
|
540 // CUsbObexClassControllerTest::StartupPriorityInfoTestL |
|
541 // ----------------------------------------------------------------------------- |
|
542 // |
|
543 TInt CUsbObexClassControllerTest::StartupPriorityInfoTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
544 { |
|
545 TInt priority = 0; |
|
546 |
|
547 InitializeTestObjectL(); |
|
548 CUSBObexApiTestActiveObject* activeTestObject = |
|
549 CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); |
|
550 activeTestObject -> Start(); |
|
551 CActiveScheduler::Start(); |
|
552 priority = iUsbClassControllerPlugIn -> StartupPriority(); |
|
553 |
|
554 iLog->Log( _L("StartupPriorityInfoTestL:> Priority = %d "),priority ); |
|
555 |
|
556 DeleteTestObject(); |
|
557 activeTestObject -> Cancel(); |
|
558 |
|
559 // Case was executed |
|
560 iLog->Log( _L("StartupPriorityInfoTestL:> Test Case Passed")); |
|
561 aTestResult = ETestCasePassed; |
|
562 return KErrNone; |
|
563 } |
|
564 |
|
565 // ----------------------------------------------------------------------------- |
|
566 // CUsbObexClassControllerTest::StateInfoTestL |
|
567 // ----------------------------------------------------------------------------- |
|
568 // |
|
569 TInt CUsbObexClassControllerTest::StateInfoTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
570 { |
|
571 TUsbServiceState state; |
|
572 |
|
573 InitializeTestObjectL(); |
|
574 CUSBObexApiTestActiveObject* activeTestObject = |
|
575 CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); |
|
576 activeTestObject -> Start(); |
|
577 CActiveScheduler::Start(); |
|
578 state = iUsbClassControllerPlugIn -> State(); |
|
579 |
|
580 iLog->Log( _L("StateTestL:> State = 0x%x "), state ); |
|
581 |
|
582 DeleteTestObject(); |
|
583 activeTestObject -> Cancel(); |
|
584 |
|
585 // Case was executed |
|
586 iLog->Log( _L("StateInfoTestL:> Test Case Passed")); |
|
587 aTestResult = ETestCasePassed; |
|
588 return KErrNone; |
|
589 } |
|
590 |
|
591 // ----------------------------------------------------------------------------- |
|
592 // CUsbObexClassControllerTest::OwnerTestL |
|
593 // ----------------------------------------------------------------------------- |
|
594 // |
|
595 TInt CUsbObexClassControllerTest::OwnerTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
596 { |
|
597 InitializeTestObjectL(); |
|
598 CUSBObexApiTestActiveObject* activeTestObject = |
|
599 CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); |
|
600 activeTestObject -> Start(); |
|
601 CActiveScheduler::Start(); |
|
602 (iUsbClassControllerPlugIn -> Owner()).UccnGetClassControllerIteratorL(); |
|
603 |
|
604 (iUsbClassControllerPlugIn -> Owner()).UccnError( KErrNone ); |
|
605 |
|
606 DeleteTestObject(); |
|
607 activeTestObject -> Cancel(); |
|
608 |
|
609 // Case was executed |
|
610 iLog->Log( _L("OwnerTestL:> Test Case Passed")); |
|
611 aTestResult = ETestCasePassed; |
|
612 return KErrNone; |
|
613 } |
|
614 |
|
615 // ----------------------------------------------------------------------------- |
|
616 // CUsbObexClassControllerTest::CompareTestL |
|
617 // ----------------------------------------------------------------------------- |
|
618 // |
|
619 TInt CUsbObexClassControllerTest::CompareTestL( TUsbObexClassControllerTestResult& aTestResult ) |
|
620 { |
|
621 InitializeTestObjectL(); |
|
622 |
|
623 CUSBObexApiTestActiveObject* activeTestObject = |
|
624 CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); |
|
625 activeTestObject -> Start(); |
|
626 CActiveScheduler::Start(); |
|
627 |
|
628 //result = iUsbClassControllerPlugIn -> Compare( this, iUsbClassControllerPlugIn ); |
|
629 //iLog->Log( _L("CompareTestL:> Comparition Result = %d "),result ); |
|
630 |
|
631 DeleteTestObject(); |
|
632 activeTestObject -> Cancel(); |
|
633 |
|
634 // Case was executed |
|
635 iLog->Log( _L("CompareTestL:> Test Case Passed")); |
|
636 aTestResult = ETestCasePassed; |
|
637 return KErrNone; |
|
638 } |
|
639 |
|
640 // ----------------------------------------------------------------------------- |
|
641 // CUsbObexClassControllerTest::InitializeTestObjectL |
|
642 // ----------------------------------------------------------------------------- |
|
643 // |
|
644 void CUsbObexClassControllerTest::InitializeTestObjectL() |
|
645 { |
|
646 iUsbClassControllerPlugIn = CUsbClassControllerPlugIn::NewL( TUid::Uid( 0x10281F2A ), *this); |
|
647 } |
|
648 |
|
649 // ----------------------------------------------------------------------------- |
|
650 // CUsbObexClassControllerTest::DeleteTestObject |
|
651 // ----------------------------------------------------------------------------- |
|
652 // |
|
653 void CUsbObexClassControllerTest::DeleteTestObject() |
|
654 { |
|
655 delete iUsbClassControllerPlugIn; |
|
656 iUsbClassControllerPlugIn = NULL; |
|
657 REComSession::FinalClose(); |
|
658 } |
|
659 |
|
660 // ----------------------------------------------------------------------------- |
|
661 // CUsbObexClassControllerTest::UccnGetClassControllerIteratorL |
|
662 // ----------------------------------------------------------------------------- |
|
663 // |
|
664 CUsbClassControllerIterator* CUsbObexClassControllerTest::UccnGetClassControllerIteratorL() |
|
665 { |
|
666 iLog->Log( _L("get class controller iterator")); |
|
667 return (CUsbClassControllerIterator *)NULL; |
|
668 } |
|
669 |
|
670 // ----------------------------------------------------------------------------- |
|
671 // CUsbObexClassControllerTest::UccnError |
|
672 // ----------------------------------------------------------------------------- |
|
673 // |
|
674 void CUsbObexClassControllerTest::UccnError( TInt aError ) |
|
675 { |
|
676 iLog->Log( _L("class controller iterator error: %d"), aError ); |
|
677 } |
|
678 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
679 // None |
|
680 |
|
681 // [End of File] - Do not remove |