|
1 /* |
|
2 * Copyright (c) 2006-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 the License "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 * This file provides implementation for CTSwiConsoleStep |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <test/testexecutelog.h> |
|
21 #include "tswiconsolestep.h" |
|
22 |
|
23 _LIT(KOption, "option"); |
|
24 _LIT(KExpectedResult, "ExpectedResult"); |
|
25 _LIT(KSwiConsole, "z:\\sys\\bin\\swiconsole.exe"); |
|
26 |
|
27 CTSwiConsoleStep::CTSwiConsoleStep() |
|
28 { |
|
29 SetTestStepName(KTSwiConsoleStep); |
|
30 } |
|
31 |
|
32 TVerdict CTSwiConsoleStep::doTestStepL() |
|
33 { |
|
34 SetTestStepResult(EFail); |
|
35 |
|
36 TPtrC appOption; |
|
37 if(!GetStringFromConfig(ConfigSection(),KOption, appOption)) |
|
38 { |
|
39 ERR_PRINTF1(_L("Missing Option")); |
|
40 SetTestStepError(KErrBadName); |
|
41 return EFail; |
|
42 } |
|
43 |
|
44 TInt expectedResult = KErrNone; |
|
45 if(!GetIntFromConfig(ConfigSection(),KExpectedResult, expectedResult)) |
|
46 { |
|
47 ERR_PRINTF1(_L("Missing Expected result")); |
|
48 SetTestStepError(KErrBadName); |
|
49 return EFail; |
|
50 } |
|
51 |
|
52 RProcess process; |
|
53 TInt err = process.Create(KSwiConsole, appOption); |
|
54 process.Resume(); |
|
55 |
|
56 TRequestStatus status; |
|
57 process.Logon(status); |
|
58 User::WaitForRequest(status); |
|
59 |
|
60 TInt exitReason = process.ExitReason(); |
|
61 |
|
62 INFO_PRINTF3(_L("Returned Result %d is compare with expected Result %d"), &exitReason,&expectedResult); |
|
63 |
|
64 if(exitReason == expectedResult) |
|
65 { |
|
66 SetTestStepResult(EPass); |
|
67 } |
|
68 else |
|
69 { |
|
70 SetTestStepError(exitReason); |
|
71 SetTestStepResult(EFail); |
|
72 } |
|
73 |
|
74 process.Close(); |
|
75 |
|
76 |
|
77 return TestStepResult(); |
|
78 } |