|
1 // Copyright (c) 2007-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 // CTestStep derived implementation |
|
15 // |
|
16 |
|
17 |
|
18 |
|
19 /** |
|
20 @file tokenstep.cpp |
|
21 @internalTechnology |
|
22 */ |
|
23 #include "CDStokenstep.h" |
|
24 #include "tcoredumpserversuitedefs.h" |
|
25 #include "tcoredumpserversuiteserver.h" |
|
26 |
|
27 CTokenStep::~CTokenStep() |
|
28 /** |
|
29 * Destructor |
|
30 */ |
|
31 { |
|
32 } |
|
33 |
|
34 CTokenStep::CTokenStep() |
|
35 /** |
|
36 * Constructor |
|
37 */ |
|
38 { |
|
39 // **MUST** call SetTestStepName in the constructor as the controlling |
|
40 // framework uses the test step name immediately following construction to set |
|
41 // up the step's unique logging ID. |
|
42 SetTestStepName(KTokenStep); |
|
43 } |
|
44 |
|
45 TVerdict CTokenStep::doTestStepPreambleL() |
|
46 /** |
|
47 * @return - TVerdict code |
|
48 * Override of base class virtual |
|
49 */ |
|
50 { |
|
51 |
|
52 TInt ret = KErrNone; |
|
53 ret = iSess.Connect(); |
|
54 if(ret != KErrNone) |
|
55 { |
|
56 SetTestStepResult( EFail ); |
|
57 ERR_PRINTF2(_L("Error %d from iSess->Connect()"), ret); |
|
58 } |
|
59 else |
|
60 { |
|
61 SetTestStepResult(EPass); |
|
62 } |
|
63 |
|
64 return TestStepResult(); |
|
65 } |
|
66 |
|
67 |
|
68 TVerdict CTokenStep::doTestStepL() |
|
69 /** |
|
70 * @return - TVerdict code |
|
71 * Override of base class pure virtual |
|
72 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
73 * not leave. That being the case, the current test result value will be EPass. |
|
74 */ |
|
75 { |
|
76 |
|
77 if (TestStepResult()==EPass) |
|
78 { |
|
79 TInt ret = KErrNone; |
|
80 |
|
81 __UHEAP_MARK; |
|
82 |
|
83 TRAP(ret, ClientAppL()); |
|
84 if(KErrNone != ret) |
|
85 { |
|
86 SetTestStepResult(EFail); |
|
87 ERR_PRINTF2(_L("Error %d from CTokenStep->ClientAppL()"), ret); |
|
88 } |
|
89 |
|
90 __UHEAP_MARKEND; |
|
91 |
|
92 } |
|
93 return TestStepResult(); |
|
94 |
|
95 } |
|
96 |
|
97 |
|
98 |
|
99 TVerdict CTokenStep::doTestStepPostambleL() |
|
100 /** |
|
101 * @return - TVerdict code |
|
102 * Override of base class virtual |
|
103 */ |
|
104 { |
|
105 |
|
106 iSess.Disconnect(); |
|
107 return EPass; |
|
108 } |
|
109 |
|
110 |
|
111 void CTokenStep::ClientAppL() |
|
112 /** |
|
113 * @return void |
|
114 * This calls each stage of the test |
|
115 */ |
|
116 { |
|
117 INFO_PRINTF1(_L("Starting Lists Test Suite") ); |
|
118 CheckAttachL(); |
|
119 } |
|
120 |
|
121 |
|
122 void CTokenStep::CheckAttachL() |
|
123 /** |
|
124 * @return void |
|
125 * This tests we can succesfully list the processes and that the returned values make sense |
|
126 */ |
|
127 { |
|
128 INFO_PRINTF1(_L("Token Test Suite: Attach") ); |
|
129 |
|
130 if (TestStepResult()==EPass) |
|
131 { |
|
132 |
|
133 INFO_PRINTF1(_L("Attach to crashapp.exe") ); |
|
134 TRAPD(err, iSess.ObservationRequestL( KCrashAppFileName, KCrashAppFileName, ETrue) ); |
|
135 if(err != KErrNone) |
|
136 { |
|
137 INFO_PRINTF2(_L("attach iSess.ObservationRequestL(z:\\sys\\bin\\crashapp.exe) failed:%d\n"), err); |
|
138 SetTestStepResult(EFail); |
|
139 User::Leave( err ); |
|
140 } |
|
141 |
|
142 INFO_PRINTF1(_L("Detach from crashapp.exe") ); |
|
143 TRAP(err, iSess.ObservationRequestL( KCrashAppFileName, KCrashAppFileName, EFalse) ); |
|
144 if(err != KErrNone) |
|
145 { |
|
146 INFO_PRINTF2(_L("detach iSess.ObservationRequestL(z:\\sys\\bin\\crashapp.exe) failed:%d\n"), err); |
|
147 SetTestStepResult(EFail); |
|
148 User::Leave( err ); |
|
149 } |
|
150 |
|
151 INFO_PRINTF1(_L("Attach to crashappoem.exe") ); |
|
152 TRAPD(oem, iSess.ObservationRequestL( KCrashAppFileNameNonDebugBit, KCrashAppFileNameNonDebugBit, ETrue) ); |
|
153 if(oem != KErrNone) |
|
154 { |
|
155 INFO_PRINTF2(_L("attach iSess.ObservationRequestL(z:\\sys\\bin\\crashappoem.exe) failed:%d\n"), oem); |
|
156 SetTestStepResult(EFail); |
|
157 User::Leave( oem ); |
|
158 } |
|
159 |
|
160 INFO_PRINTF1(_L("Detach from crashappoem.exe") ); |
|
161 TRAP(oem, iSess.ObservationRequestL( KCrashAppFileNameNonDebugBit, KCrashAppFileNameNonDebugBit, EFalse) ); |
|
162 if(oem != KErrNone) |
|
163 { |
|
164 INFO_PRINTF2(_L("detach iSess.ObservationRequestL(z:\\sys\\bin\\crashappoem.exe) failed:%d\n"), oem); |
|
165 SetTestStepResult(EFail); |
|
166 User::Leave( oem ); |
|
167 } |
|
168 } |
|
169 } |