|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "TestStartUpExeStep.h" |
|
17 |
|
18 CTestStartUpExeStep::~CTestStartUpExeStep() |
|
19 /** |
|
20 * Destructor |
|
21 */ |
|
22 { |
|
23 } |
|
24 |
|
25 CTestStartUpExeStep::CTestStartUpExeStep(CTestStartUpServer& aTestServerPtr) |
|
26 /** |
|
27 * Constructor |
|
28 */ |
|
29 { |
|
30 // Call base class method to set up the human readable name for logging |
|
31 SetTestStepName(KTestStartUpExeStep); |
|
32 iTestServerPtr = &aTestServerPtr; |
|
33 } |
|
34 |
|
35 TVerdict CTestStartUpExeStep::doTestStepPreambleL() |
|
36 /**Step |
|
37 * @return - TVerdict code |
|
38 * Override of base class virtual |
|
39 */ |
|
40 { |
|
41 SetTestStepResult(EPass); |
|
42 GetStringFromConfig(ConfigSection(),KStartupnameTag,iCntsStarupExeName); |
|
43 GetStringFromConfig(ConfigSection(),KStartupActionTag,iStartupAction); |
|
44 GetIntFromConfig(ConfigSection(),KExitReasonTag,iExitReasonFromIni); |
|
45 GetStringFromConfig(ConfigSection(),KModeTag,iServerMode); |
|
46 |
|
47 //Fetch the expected exit type for the cnts server process and convert |
|
48 //to the correct type |
|
49 TInt exitTypeFromIni; |
|
50 if (GetIntFromConfig(ConfigSection(),KExitTypeTag,exitTypeFromIni)) |
|
51 { |
|
52 switch (exitTypeFromIni) |
|
53 { |
|
54 case (0): |
|
55 iExitTypeFromIni = EExitKill; |
|
56 break; |
|
57 |
|
58 case (1): |
|
59 iExitTypeFromIni = EExitTerminate; |
|
60 break; |
|
61 |
|
62 case (2): |
|
63 iExitTypeFromIni = EExitPanic; |
|
64 break; |
|
65 |
|
66 case (3): |
|
67 iExitTypeFromIni = EExitPending; |
|
68 break; |
|
69 |
|
70 default: |
|
71 _LIT(KinvalidExitType,"Invalid Exit Type Read From ini File"); |
|
72 ERR_PRINTF1(KinvalidExitType); |
|
73 SetTestStepResult(EFail); |
|
74 } |
|
75 } |
|
76 return TestStepResult(); |
|
77 } |
|
78 |
|
79 |
|
80 TVerdict CTestStartUpExeStep::doTestStepL() |
|
81 /** |
|
82 * @return - TVerdict code |
|
83 * Override of base class virtual. Implements the main control |
|
84 * for the test step. Depending on the action requested the stored |
|
85 * TestServer pointer is used to either launch, terminate or check |
|
86 * the contacts server. |
|
87 */ |
|
88 { |
|
89 SetTestStepResult(EPass); |
|
90 |
|
91 if (iStartupAction.Compare(KLaunch) == KErrNone) |
|
92 { |
|
93 TInt err = iTestServerPtr->LaunchCntsStartUpExe(iCntsStarupExeName,iServerMode); |
|
94 if(err != KErrNone) |
|
95 { |
|
96 SetTestStepResult(EFail); |
|
97 } |
|
98 } |
|
99 |
|
100 else if (iStartupAction.Compare(KCheck) == KErrNone) |
|
101 { |
|
102 TBool res = iTestServerPtr->CheckCntsStartUpExe(iExitTypeFromIni,iExitReasonFromIni); |
|
103 if(!res) |
|
104 { |
|
105 SetTestStepResult(EFail); |
|
106 } |
|
107 } |
|
108 |
|
109 else if (iStartupAction.Compare(KTerminate) == KErrNone) |
|
110 { |
|
111 iTestServerPtr->TermCntsStartUpExe(); |
|
112 } |
|
113 |
|
114 else |
|
115 { |
|
116 //illegal action |
|
117 SetTestStepResult(EFail); |
|
118 } |
|
119 |
|
120 return TestStepResult(); |
|
121 }; |
|
122 |
|
123 |
|
124 TVerdict CTestStartUpExeStep::doTestStepPostambleL() |
|
125 /** |
|
126 * @return - TVerdict code |
|
127 * Override of base class virtual |
|
128 */ |
|
129 { |
|
130 return TestStepResult(); |
|
131 } |