1 /* |
|
2 * Copyright (c) 2005-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 * Example CTestStep derived implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file checkprogramstep.cpp |
|
23 */ |
|
24 #include "checkprogramstep.h" |
|
25 |
|
26 CCheckProgramStep::~CCheckProgramStep() |
|
27 /** |
|
28 * Destructor |
|
29 */ |
|
30 { |
|
31 } |
|
32 |
|
33 CCheckProgramStep::CCheckProgramStep() |
|
34 /** |
|
35 * Constructor |
|
36 */ |
|
37 { |
|
38 // Call base class method to set up the human readable name for logging |
|
39 SetTestStepName(KCheckProgramStep); |
|
40 } |
|
41 |
|
42 TVerdict CCheckProgramStep::doTestStepL() |
|
43 /** |
|
44 * @return - TVerdict code |
|
45 * Override of base class pure virtual |
|
46 * Demonstrates opening up a handle to the data saved at RChunk base using template class |
|
47 * Overwrite shared data with values and also demonstrates the locking mechanism |
|
48 */ |
|
49 { |
|
50 SetTestStepResult(EFail); |
|
51 _LIT(KProcessName, "ProcessName"); |
|
52 _LIT(KExpectedRetValue, "ExpectedRetValue"); |
|
53 |
|
54 RProcess process; |
|
55 TPtrC processName; |
|
56 TInt expectedRetValue; |
|
57 if (!GetStringFromConfig(ConfigSection(), KProcessName(), processName) |
|
58 || !GetIntFromConfig(ConfigSection(), KExpectedRetValue(), expectedRetValue)) |
|
59 { |
|
60 ERR_PRINTF1(_L("Failed when getting parameters from config file.")); |
|
61 SetTestStepResult(EInconclusive); |
|
62 return TestStepResult(); |
|
63 } |
|
64 |
|
65 TInt err = process.Open(processName); |
|
66 if (expectedRetValue == err) |
|
67 { |
|
68 SetTestStepResult(EPass); |
|
69 } |
|
70 else if (KErrNone == err) |
|
71 { |
|
72 TExitType exitType = process.ExitType(); |
|
73 if ((EExitKill==exitType && KErrNotFound==expectedRetValue) |
|
74 || EExitPending==exitType && KErrNone==expectedRetValue) |
|
75 { |
|
76 SetTestStepResult(EPass); |
|
77 } |
|
78 } |
|
79 |
|
80 return TestStepResult(); |
|
81 } |
|