|
1 /* |
|
2 * Copyright (c) 2004-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 #include <test/testexecutelog.h> |
|
22 #include "CUsbTestStepBase.h" |
|
23 #include "CStartPersonality.h" |
|
24 |
|
25 CStartPersonality::CStartPersonality() |
|
26 |
|
27 { |
|
28 // Call base class method to set up the human readable name for logging |
|
29 SetTestStepName(KStartPersonality); |
|
30 //We need the service to continue running after the test so that usbcheck |
|
31 //can find the device connected to the PC. |
|
32 iStopService = EFalse; |
|
33 } |
|
34 |
|
35 TVerdict CStartPersonality::doTestStepL() |
|
36 { |
|
37 SetTestStepResult(EFail); |
|
38 TRequestStatus status; |
|
39 iUsb.Start(status); |
|
40 User::WaitForRequest(status); |
|
41 if (status != KErrNone) |
|
42 { |
|
43 INFO_PRINTF2(_L("Unable to start USB service: %d"), status.Int()); |
|
44 return TestStepResult(); |
|
45 } |
|
46 |
|
47 TUsbServiceState aState; |
|
48 TInt err; |
|
49 err = iUsb.GetServiceState(aState); |
|
50 if (err != KErrNone) |
|
51 { |
|
52 INFO_PRINTF2(_L("Error getting USB service state: %d"), status.Int()); |
|
53 return TestStepResult(); |
|
54 } |
|
55 |
|
56 if (EUsbServiceStarted != aState) |
|
57 { |
|
58 INFO_PRINTF2(_L("USB service is in wrong state: %d"), aState); |
|
59 return TestStepResult(); |
|
60 } |
|
61 |
|
62 SetTestStepResult(EPass); |
|
63 return TestStepResult(); |
|
64 } |
|
65 |