|
1 /* |
|
2 * Copyright (c) 2007 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: This is the implementation of the Browser Test Plugin, which |
|
15 * tests HTTP functionality. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // System Include Files |
|
21 #include <StringLoader.h> // StringLoader |
|
22 #include <DiagFrameworkDebug.h> // Debugging Macros |
|
23 #include <devdiagbrowserpluginrsc.rsg> // Resource Definitions |
|
24 |
|
25 // User Include Files |
|
26 #include "diagbrowserplugin.h" // CDiagBrowserPlugin |
|
27 #include "diagbrowserpluginmodel.h" // CDiagBrowserPluginModel |
|
28 #include "diagbrowserplugin.hrh" // UID definition |
|
29 #include "diagbrowserplugin.pan" // Panic |
|
30 |
|
31 #include <AknDialog.h> // ADO & Platformization Changes |
|
32 #include <aknmessagequerydialog.h> // ADO & Platformization Changes |
|
33 #include <DiagCommonDialog.h> // for EDiagCommonDialogConfirmCancelAll |
|
34 |
|
35 // ADO & Platformization Changes |
|
36 #include <DiagFrameworkDebug.h> // debug macros |
|
37 #include <DiagTestExecParam.h> // TDiagTestExecParam |
|
38 #include <DiagEngineCommon.h> // MDiagEngineCommon |
|
39 |
|
40 // Local Constants |
|
41 _LIT( KDiagBrowserPluginResourceFileName, "z:devdiagbrowserpluginrsc.rsc" ); |
|
42 const TUid KDiagBrowserPluginUid = { _IMPLEMENTATION_UID }; |
|
43 |
|
44 |
|
45 // ============================ GLOBAL FUNCTIONS ============================= |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // Static two-phase constructor. |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 MDiagPlugin* CDiagBrowserPlugin::NewL( TAny* aInitParams ) |
|
52 { |
|
53 LOGSTRING2( "CDiagBrowserPlugin::NewL( 0x%x )", aInitParams ) |
|
54 |
|
55 __ASSERT_ALWAYS( aInitParams, |
|
56 Panic( EDiagBrowserPluginConstruction ) ); |
|
57 |
|
58 // Construct the plugin. The base class will take ownership of the |
|
59 // initialization parameters. |
|
60 CDiagPluginConstructionParam* param = |
|
61 static_cast< CDiagPluginConstructionParam* >( aInitParams ); |
|
62 |
|
63 CleanupStack::PushL( param ); |
|
64 CDiagBrowserPlugin* self = new( ELeave ) CDiagBrowserPlugin( param ); |
|
65 CleanupStack::Pop( param ); |
|
66 |
|
67 CleanupStack::PushL( self ); |
|
68 self->ConstructL(); |
|
69 CleanupStack::Pop( self ); |
|
70 |
|
71 return self; |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // Destructor. |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 CDiagBrowserPlugin::~CDiagBrowserPlugin() |
|
79 { |
|
80 LOGSTRING( "CDiagBrowserPlugin::~CDiagBrowserPlugin()" ) |
|
81 delete iModel; |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // The default constructor. |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 CDiagBrowserPlugin::CDiagBrowserPlugin( CDiagPluginConstructionParam* aParam ) |
|
89 : CDiagTestPluginBase( aParam ) |
|
90 { |
|
91 LOGSTRING2( "CDiagBrowserPlugin::CDiagBrowserPlugin( 0x%x )", aParam ) |
|
92 |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // The second phase constructor. |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 void CDiagBrowserPlugin::ConstructL() |
|
100 { |
|
101 LOGSTRING( "CDiagBrowserPlugin::ConstructL()" ) |
|
102 BaseConstructL( KDiagBrowserPluginResourceFileName ); |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // From class CDiagTestPluginBase. |
|
107 // Returns whether the plugin should be displayed or not. |
|
108 // --------------------------------------------------------------------------- |
|
109 TBool CDiagBrowserPlugin::IsVisible() const |
|
110 { |
|
111 LOGSTRING( "CDiagBrowserPlugin::IsVisible()" ) |
|
112 return ETrue; |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // From class CDiagTestPluginBase. |
|
117 // Returns the plugin's level of interactivity. |
|
118 // --------------------------------------------------------------------------- |
|
119 MDiagTestPlugin::TRunMode CDiagBrowserPlugin::RunMode() const |
|
120 { |
|
121 LOGSTRING( "CDiagBrowserPlugin::RunMode()" ) |
|
122 return EAutomatic; |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // From class CDiagTestPluginBase. |
|
127 // Returns the total number of execution steps for the plugin. |
|
128 // --------------------------------------------------------------------------- |
|
129 TUint CDiagBrowserPlugin::TotalSteps() const |
|
130 { |
|
131 LOGSTRING( "CDiagBrowserPlugin::TotalSteps()" ) |
|
132 return CDiagBrowserPluginModel::TotalSteps(); |
|
133 } |
|
134 |
|
135 // --------------------------------------------------------------------------- |
|
136 // From class CDiagTestPluginBase. |
|
137 // Returns the plugin name. |
|
138 // --------------------------------------------------------------------------- |
|
139 HBufC* CDiagBrowserPlugin::GetPluginNameL( TNameLayoutType aLayoutType ) const |
|
140 { |
|
141 LOGSTRING2( "CDiagBrowserPlugin::GetPluginNameL( %d )", aLayoutType ) |
|
142 |
|
143 switch ( aLayoutType ) |
|
144 { |
|
145 case ENameLayoutHeadingPane: |
|
146 return StringLoader::LoadL( R_DIAG_BROWSER_HEADING_PANE ); |
|
147 |
|
148 case ENameLayoutPopupInfoPane: |
|
149 return StringLoader::LoadL( R_DIAG_BROWSER_POPUP_INFO_PANE ); |
|
150 |
|
151 case ENameLayoutTitlePane: |
|
152 return StringLoader::LoadL( R_DIAG_BROWSER_TITLE_PANE ); |
|
153 |
|
154 case ENameLayoutListSingleGraphic: |
|
155 return StringLoader::LoadL( R_DIAG_BROWSER_LIST_SINGLE_GRAPHIC ); |
|
156 |
|
157 case ENameLayoutListSingle: |
|
158 return StringLoader::LoadL( R_DIAG_BROWSER_LIST_SINGLE ); |
|
159 |
|
160 default: |
|
161 __ASSERT_DEBUG( EFalse, Panic( EDiagBrowserPluginName ) ); |
|
162 return StringLoader::LoadL( R_DIAG_BROWSER_LIST_SINGLE ); |
|
163 } |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // From class CDiagTestPluginBase. |
|
168 // Returns the plugin's UID. |
|
169 // --------------------------------------------------------------------------- |
|
170 TUid CDiagBrowserPlugin::Uid() const |
|
171 { |
|
172 LOGSTRING( "CDiagBrowserPlugin::Uid()" ) |
|
173 return KDiagBrowserPluginUid; |
|
174 } |
|
175 |
|
176 // --------------------------------------------------------------------------- |
|
177 // From class CDiagTestPluginBase. |
|
178 // Called from the base class to begin test execution. |
|
179 // --------------------------------------------------------------------------- |
|
180 void CDiagBrowserPlugin::DoRunTestL() |
|
181 { |
|
182 LOGSTRING( "CDiagBrowserPlugin::DoRunTestL()" ) |
|
183 |
|
184 __ASSERT_ALWAYS( !iModel, Panic( EDiagBrowserPluginBadState ) ); |
|
185 // ADO & Platformization Changes |
|
186 TInt aButtonId; |
|
187 |
|
188 ShowMessageQueryL(R_DIAG_MESSAGEQUERY_TITLE_BROWSERTEST,aButtonId); |
|
189 |
|
190 if(aButtonId == EBrowserTestCancel) |
|
191 { |
|
192 CompleteTestL( CDiagResultsDatabaseItem::ESkipped ); |
|
193 return; |
|
194 } |
|
195 |
|
196 if(aButtonId == EBrowserTestSkip) |
|
197 { |
|
198 TInt confirmResult = 0; |
|
199 |
|
200 CAknDialog* dlg = ExecutionParam().Engine(). |
|
201 CreateCommonDialogLC( EDiagCommonDialogConfirmSkipAll, NULL ); |
|
202 |
|
203 if ( !RunWaitingDialogL( dlg, confirmResult ) ) |
|
204 { |
|
205 return; |
|
206 } |
|
207 |
|
208 if (confirmResult) |
|
209 { |
|
210 return; |
|
211 } |
|
212 } |
|
213 // Changes Ends |
|
214 |
|
215 iModel = CDiagBrowserPluginModel::NewL( *this ); |
|
216 iModel->RunBrowserTestL(); |
|
217 } |
|
218 |
|
219 // --------------------------------------------------------------------------- |
|
220 // From class CDiagTestPluginBase. |
|
221 // Called when the plugin's execution is stopped. |
|
222 // --------------------------------------------------------------------------- |
|
223 // |
|
224 void CDiagBrowserPlugin::DoStopAndCleanupL() |
|
225 { |
|
226 LOGSTRING( "CDiagBrowserPlugin::DoStopAndCleanupL()" ) |
|
227 |
|
228 delete iModel; |
|
229 iModel = NULL; |
|
230 } |
|
231 |
|
232 // --------------------------------------------------------------------------- |
|
233 // From class CActive. |
|
234 // Active object run handler. |
|
235 // --------------------------------------------------------------------------- |
|
236 void CDiagBrowserPlugin::RunL() |
|
237 { |
|
238 LOGSTRING( "CDiagBrowserPlugin::RunL()" ) |
|
239 |
|
240 } |
|
241 |
|
242 // --------------------------------------------------------------------------- |
|
243 // From class CActive. |
|
244 // Active object cancel. |
|
245 // --------------------------------------------------------------------------- |
|
246 void CDiagBrowserPlugin::DoCancel() |
|
247 { |
|
248 LOGSTRING( "CDiagBrowserPlugin::DoCancel()" ) |
|
249 |
|
250 } |
|
251 |
|
252 // --------------------------------------------------------------------------- |
|
253 // From class MDiagBrowserPluginModelObserver. |
|
254 // This function notifies that test execution has completed. |
|
255 // --------------------------------------------------------------------------- |
|
256 void CDiagBrowserPlugin::TestEndL( CDiagResultsDatabaseItem::TResult aResult ) |
|
257 { |
|
258 LOGSTRING2( "CDiagBrowserPlugin::TestEndL( %d )", aResult ) |
|
259 CompleteTestL( aResult ); |
|
260 |
|
261 delete iModel; |
|
262 iModel = NULL; |
|
263 } |
|
264 |
|
265 // --------------------------------------------------------------------------- |
|
266 // From class MDiagBrowserPluginModelObserver. |
|
267 // This function notifies of test progress. |
|
268 // --------------------------------------------------------------------------- |
|
269 void CDiagBrowserPlugin::TestProgressL( TUint aCurrentStep ) |
|
270 { |
|
271 LOGSTRING2( "CDiagBrowserPlugin::TestProgressL( %d )", aCurrentStep ) |
|
272 ReportTestProgressL( aCurrentStep ); |
|
273 } |
|
274 |
|
275 // ADO & Platformization Changes |
|
276 TBool CDiagBrowserPlugin::ShowMessageQueryL( TInt aResourceId, TInt &aButtonId ) |
|
277 { |
|
278 LOGSTRING( "CDiagAudioPlugin::ShowMessageQueryL IN" ) |
|
279 CAknMessageQueryDialog* dlg = NULL; |
|
280 TBool result = EFalse; |
|
281 |
|
282 // Create CAknMessageQueryDialog instance |
|
283 dlg = new ( ELeave ) CAknMessageQueryDialog(); |
|
284 |
|
285 dlg->PrepareLC( aResourceId ); |
|
286 |
|
287 CEikButtonGroupContainer& cba = dlg->ButtonGroupContainer(); |
|
288 |
|
289 switch ( aResourceId ) |
|
290 { |
|
291 case R_DIAG_MESSAGEQUERY_TITLE_BROWSERTEST: |
|
292 { |
|
293 if ( SinglePluginExecution() ) |
|
294 { |
|
295 cba.SetCommandSetL( R_CBA_BROWSER_SINGLE_EXECUTION ); |
|
296 } |
|
297 else |
|
298 { |
|
299 cba.SetCommandSetL( R_CBA_BROWSER_GROUP_EXECUTION ); |
|
300 } |
|
301 } |
|
302 break; |
|
303 |
|
304 default: |
|
305 break; |
|
306 } |
|
307 |
|
308 result = RunWaitingDialogL( dlg, aButtonId ); |
|
309 |
|
310 LOGSTRING3( "CDiagAudioPlugin::ShowMessageQueryL() OUT aButtonId=%d result=%d", aButtonId, result ); |
|
311 return result; |
|
312 } |
|
313 |
|
314 // End of File |