117 } |
117 } |
118 test.Printf(_L(" Connected to USB Manager.\n")); |
118 test.Printf(_L(" Connected to USB Manager.\n")); |
119 current_test_state = EUSBManConnected; |
119 current_test_state = EUSBManConnected; |
120 break; |
120 break; |
121 case EUSBManConnected: |
121 case EUSBManConnected: |
|
122 // Register as primary client. |
|
123 // *** Obsolete *** |
|
124 /* |
|
125 r = usbman->RegisterAsPrimarySession(); |
|
126 if (r != KErrNone) |
|
127 { |
|
128 test.Printf(_L(" Failed to register as primary client. Error = %d\n"), r); |
|
129 return r; |
|
130 } |
|
131 test.Printf(_L(" Registered as primary client.\n")); |
|
132 */ |
122 current_test_state = EPrimaryRegistered; |
133 current_test_state = EPrimaryRegistered; |
123 break; |
134 break; |
124 default: |
135 default: |
125 break; |
136 break; |
126 } |
137 } |
149 usbman->Stop(status); |
160 usbman->Stop(status); |
150 User::WaitForRequest(status); |
161 User::WaitForRequest(status); |
151 current_test_state = EPrimaryRegistered; |
162 current_test_state = EPrimaryRegistered; |
152 break; |
163 break; |
153 case EPrimaryRegistered: |
164 case EPrimaryRegistered: |
|
165 // *** Obsolete *** |
|
166 // usbman->DeregisterAsPrimarySession(); |
154 current_test_state = EUSBManConnected; |
167 current_test_state = EUSBManConnected; |
155 break; |
168 break; |
156 case EUSBManConnected: |
169 case EUSBManConnected: |
157 // Don't need to disconnect. |
170 // Don't need to disconnect. |
158 current_test_state = EUSBManCreated; |
171 current_test_state = EUSBManCreated; |
225 current_test_state = EUSBManStarted; |
238 current_test_state = EUSBManStarted; |
226 return KErrNone; |
239 return KErrNone; |
227 } |
240 } |
228 |
241 |
229 /** |
242 /** |
230 * Executes test B3 (as detailed in the USB Manager Test Specification). |
243 * Executes test B2 (as detailed in the USB Manager Test Specification). |
231 */ |
244 * No longer a relevant test. |
232 static TInt RunTest_B3() |
245 */ |
|
246 /*static TInt RunTest_B2() |
233 { |
247 { |
234 TInt r; |
248 TInt r; |
235 |
249 |
236 test.Next(_L("Test B3.\n")); |
250 test.Next(_L("Test B2.\n")); |
237 |
251 |
238 // Perform common startup |
252 // Perform common startup |
239 current_test_state = EStart; |
253 current_test_state = EStart; |
240 r = CommonStart(); |
254 r = CommonStart(); |
241 if (r != KErrNone) |
255 if (r != KErrNone) |
242 return r; |
256 return r; |
243 |
257 |
244 // Start the USB Manager |
258 // Start the USB Manager |
245 TRequestStatus status; |
259 TRequestStatus status; |
|
260 test.Printf(_L("Starting.\n")); |
|
261 usbman->Start(status); |
|
262 |
|
263 // Wait for specific time (has to be less than the time to process a start request) |
|
264 timer.After(status, CANCEL_START_REQ_DELAY); |
|
265 User::WaitForRequest(status); |
|
266 |
|
267 // Cancel the start request |
|
268 test.Printf(_L("Cancelling.\n")); |
|
269 usbman->StartCancel(); |
|
270 |
|
271 // Check service status |
|
272 test.Printf(_L("Checking service status.\n")); |
|
273 r = CheckServiceState(EUsbServiceIdle); |
|
274 if ( r != KErrNone) |
|
275 return r; |
|
276 |
|
277 return KErrNone; |
|
278 } |
|
279 */ |
|
280 /** |
|
281 * Executes test B3 (as detailed in the USB Manager Test Specification). |
|
282 */ |
|
283 static TInt RunTest_B3() |
|
284 { |
|
285 TInt r; |
|
286 |
|
287 test.Next(_L("Test B3.\n")); |
|
288 |
|
289 // Perform common startup |
|
290 current_test_state = EStart; |
|
291 r = CommonStart(); |
|
292 if (r != KErrNone) |
|
293 return r; |
|
294 |
|
295 // Start the USB Manager |
|
296 TRequestStatus status; |
246 usbman->Start(status); |
297 usbman->Start(status); |
247 User::WaitForRequest(status); |
298 User::WaitForRequest(status); |
248 test.Printf(_L("Start completed with status %d\n"), status.Int()); |
299 test.Printf(_L("Start completed with status %d\n"), status.Int()); |
249 current_test_state = EUSBManStarted; |
300 current_test_state = EUSBManStarted; |
250 |
301 |
260 return r; |
311 return r; |
261 |
312 |
262 return KErrNone; |
313 return KErrNone; |
263 } |
314 } |
264 |
315 |
|
316 /** |
|
317 * Executes test B4 (as detailed in the USB Manager Test Specification). |
|
318 * No longer a relevant test. |
|
319 */ |
|
320 /*static TInt RunTest_B4() |
|
321 { |
|
322 TInt r; |
|
323 |
|
324 test.Next(_L("Test B4.\n")); |
|
325 |
|
326 // Perform common startup |
|
327 current_test_state = EStart; |
|
328 r = CommonStart(); |
|
329 if (r != KErrNone) |
|
330 return r; |
|
331 |
|
332 // Start the USB Manager |
|
333 TRequestStatus status, timerStatus; |
|
334 usbman->Start(status); |
|
335 User::WaitForRequest(status); |
|
336 test.Printf(_L("Start completed with status %d\n"), status.Int()); |
|
337 current_test_state = EUSBManStarted; |
|
338 |
|
339 // Stop the USB Manager |
|
340 usbman->Stop(status); |
|
341 |
|
342 // Wait for specific time (has to be less than the time to process a start request) |
|
343 timer.After(timerStatus, CANCEL_STOP_REQ_DELAY); |
|
344 User::WaitForRequest(status, timerStatus); |
|
345 |
|
346 // Cancel the stop request |
|
347 usbman->StopCancel(); |
|
348 |
|
349 // Check service status |
|
350 r = CheckServiceState(EUsbServiceStarted); |
|
351 if ( r != KErrNone) |
|
352 return r; |
|
353 |
|
354 return KErrNone; |
|
355 } |
|
356 */ |
265 /** |
357 /** |
266 * Executes test B5 (as detailed in the USB Manager Test Specification). |
358 * Executes test B5 (as detailed in the USB Manager Test Specification). |
267 */ |
359 */ |
268 static TInt RunTest_B5() |
360 static TInt RunTest_B5() |
269 { |
361 { |
413 } |
505 } |
414 else |
506 else |
415 test.Printf(_L("Test B1 passed.\n\n")); |
507 test.Printf(_L("Test B1 passed.\n\n")); |
416 CommonCleanup(); |
508 CommonCleanup(); |
417 |
509 |
|
510 /* Depreciated test. |
|
511 err=RunTest_B2(); |
|
512 if (err != KErrNone) |
|
513 { |
|
514 test.Printf(_L("Test B2 failed, code: %d\n\n"), err); |
|
515 } |
|
516 else |
|
517 test.Printf(_L("Test B2 passed.\n\n")); |
|
518 CommonCleanup(); |
|
519 */ |
418 err=RunTest_B3(); |
520 err=RunTest_B3(); |
419 if (err != KErrNone) |
521 if (err != KErrNone) |
420 { |
522 { |
421 test.Printf(_L("Test B3 failed, code: %d\n\n"), err); |
523 test.Printf(_L("Test B3 failed, code: %d\n\n"), err); |
422 } |
524 } |
423 else |
525 else |
424 test.Printf(_L("Test B3 passed.\n\n")); |
526 test.Printf(_L("Test B3 passed.\n\n")); |
425 CommonCleanup(); |
527 CommonCleanup(); |
426 |
528 |
|
529 /* Depreciated test. |
|
530 err=RunTest_B4(); |
|
531 if (err != KErrNone) |
|
532 { |
|
533 test.Printf(_L("Test B4 failed, code: %d\n\n"), err); |
|
534 } |
|
535 else |
|
536 test.Printf(_L("Test B4 passed.\n\n")); |
|
537 CommonCleanup(); |
|
538 */ |
427 err=RunTest_B5(); |
539 err=RunTest_B5(); |
428 if (err != KErrNone) |
540 if (err != KErrNone) |
429 { |
541 { |
430 test.Printf(_L("Test B5 failed, code: %d\n\n"), err); |
542 test.Printf(_L("Test B5 failed, code: %d\n\n"), err); |
431 } |
543 } |