|
1 /* |
|
2 * Copyright (c) 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: This module contains the implementation of |
|
15 * CUITestServerStarterAppUi class member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <avkon.hrh> |
|
21 #include <aknmessagequerydialog.h> |
|
22 #include <aknnotewrappers.h> |
|
23 #include <stringloader.h> |
|
24 #include <f32file.h> |
|
25 #include <s32file.h> |
|
26 #include <hlplch.h> |
|
27 |
|
28 #include <UITestServerStarter.rsg> |
|
29 |
|
30 #include "UITestServerStarter.hrh" |
|
31 #include "UITestServerStarterAppUi.h" |
|
32 #include "UITestServerStarterAppView.h" |
|
33 |
|
34 #include "TestServerThreadStarter.h" |
|
35 #include <stifinternal/TestThreadContainerRunnerFactory.h> |
|
36 #include "AknUiEnvProxy.h" |
|
37 |
|
38 // EXTERNAL DATA STRUCTURES |
|
39 // None |
|
40 |
|
41 // EXTERNAL FUNCTION PROTOTYPES |
|
42 // None |
|
43 |
|
44 // CONSTANTS |
|
45 // None |
|
46 |
|
47 // MACROS |
|
48 // None |
|
49 |
|
50 // LOCAL CONSTANTS AND MACROS |
|
51 // None |
|
52 |
|
53 // MODULE DATA STRUCTURES |
|
54 // None |
|
55 |
|
56 // LOCAL FUNCTION PROTOTYPES |
|
57 // None |
|
58 |
|
59 // FORWARD DECLARATIONS |
|
60 // None |
|
61 |
|
62 // ================= MEMBER FUNCTIONS ========================================= |
|
63 |
|
64 /* |
|
65 ------------------------------------------------------------------------------- |
|
66 |
|
67 Class: CUITestServerStarterAppUi |
|
68 |
|
69 Method: ConstructL |
|
70 |
|
71 Description: ConstructL is second phase of two-phased constructor. |
|
72 |
|
73 ConstructL is second phase of two-phased constructor. |
|
74 |
|
75 Parameters: None |
|
76 |
|
77 Return Values: None. |
|
78 |
|
79 Errors/Exceptions: Leaves if one of called functions leave. |
|
80 |
|
81 Status: Draft |
|
82 |
|
83 ------------------------------------------------------------------------------- |
|
84 */ |
|
85 void CUITestServerStarterAppUi::ConstructL() |
|
86 { |
|
87 RDebug::Printf( "UITESTING: CUITestServerStarterAppUi::ConstructL - Begin" ); |
|
88 |
|
89 // Initialise app UI with standard value. |
|
90 BaseConstructL( ENoAppResourceFile || CAknAppUi::EAknEnableSkin ); |
|
91 |
|
92 CEikonEnv::Static()->DisableExitChecks( true ); |
|
93 |
|
94 // Create view object |
|
95 iAppView = CUITestServerStarterAppView::NewL(); |
|
96 |
|
97 AddViewL( iAppView ); |
|
98 SetDefaultViewL( *iAppView ); |
|
99 |
|
100 CAknUiEnvProxy* uiEnvProxy = CAknUiEnvProxy::NewL( this ); |
|
101 |
|
102 CTestThreadContainerRunnerFactory* testThreadContainerRunnerFactory = |
|
103 CTestThreadContainerRunnerFactory::NewL( RThread().Id(), CActiveScheduler::Current(), uiEnvProxy ); |
|
104 |
|
105 RDebug::Printf( "UITESTING: CUITestServerStarterAppUi::ConstructL - Starting TestServer" ); |
|
106 CTestServerThreadStarter* testServerThreadStarter = CTestServerThreadStarter::NewL( ); |
|
107 testServerThreadStarter->RunTestServerThread( testThreadContainerRunnerFactory ); |
|
108 |
|
109 RDebug::Printf( "UITESTING: CUITestServerStarterAppUi::ConstructL - Move to background" ); |
|
110 |
|
111 TApaTask task( CCoeEnv::Static()->WsSession() ); |
|
112 task.SetWgId( CCoeEnv::Static()->RootWin().Identifier() ); |
|
113 task.SendToBackground(); |
|
114 |
|
115 RDebug::Printf( "UITESTING: CUITestServerStarterAppUi::ConstructL - End" ); |
|
116 } |
|
117 |
|
118 /* |
|
119 ------------------------------------------------------------------------------- |
|
120 |
|
121 Class: CUITestServerStarterAppUi |
|
122 |
|
123 Method: CUITestServerStarterAppUi |
|
124 |
|
125 Description: C++ default constructor can NOT contain any code, that might leave. |
|
126 |
|
127 C++ default constructor can NOT contain any code, that might leave. |
|
128 |
|
129 Parameters: None. |
|
130 |
|
131 Return Values: None. |
|
132 |
|
133 Errors/Exceptions: None. |
|
134 |
|
135 Status: Draft |
|
136 |
|
137 ------------------------------------------------------------------------------- |
|
138 */ |
|
139 CUITestServerStarterAppUi::CUITestServerStarterAppUi() |
|
140 { |
|
141 // No implementation required |
|
142 } |
|
143 |
|
144 /* |
|
145 ------------------------------------------------------------------------------- |
|
146 |
|
147 Class: CUITestServerStarterAppUi |
|
148 |
|
149 Method: ~CUITestServerStarterAppUi |
|
150 |
|
151 Description: C++ destructor. |
|
152 |
|
153 C++ destructor. |
|
154 |
|
155 Parameters: None. |
|
156 |
|
157 Return Values: None. |
|
158 |
|
159 Errors/Exceptions: None. |
|
160 |
|
161 Status: Draft |
|
162 |
|
163 ------------------------------------------------------------------------------- |
|
164 */ |
|
165 CUITestServerStarterAppUi::~CUITestServerStarterAppUi() |
|
166 { |
|
167 // No implementation required |
|
168 } |
|
169 |
|
170 /* |
|
171 ------------------------------------------------------------------------------- |
|
172 |
|
173 Class: CUITestServerStarterAppUi |
|
174 |
|
175 Method: HandleCommandL |
|
176 |
|
177 Description: Handles user commands. |
|
178 |
|
179 Derived from CCoeAppUi. Handles user commands. |
|
180 |
|
181 Parameters: TInt aCommand: in: User command code. |
|
182 |
|
183 Return Values: None. |
|
184 |
|
185 Errors/Exceptions: None. |
|
186 |
|
187 Status: Draft |
|
188 |
|
189 ------------------------------------------------------------------------------- |
|
190 */ |
|
191 void CUITestServerStarterAppUi::HandleCommandL( TInt ) |
|
192 { |
|
193 // No implementation required |
|
194 } |
|
195 |
|
196 /* |
|
197 ------------------------------------------------------------------------------- |
|
198 |
|
199 Class: CUITestServerStarterAppUi |
|
200 |
|
201 Method: HandleWsEventL |
|
202 |
|
203 Description: Handles window server event. |
|
204 |
|
205 Derived from CCoeAppUi. Handles window server event. |
|
206 |
|
207 Parameters: const TWsEvent& aEvent: in: Event. |
|
208 CCoeControl* aDestination: in: Destination control. |
|
209 |
|
210 Return Values: None. |
|
211 |
|
212 Errors/Exceptions: None. |
|
213 |
|
214 Status: Draft |
|
215 |
|
216 ------------------------------------------------------------------------------- |
|
217 */ |
|
218 void CUITestServerStarterAppUi::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination ) |
|
219 { |
|
220 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
221 |
|
222 if ( ( aEvent.Type() == EEventKey ) ) |
|
223 { |
|
224 switch( iEventType ) |
|
225 { |
|
226 case EPressKey: |
|
227 { |
|
228 if ( iEventStatus != NULL ) |
|
229 { |
|
230 KeyPressHandled(); |
|
231 } |
|
232 } |
|
233 break; |
|
234 case ETypeText: |
|
235 { |
|
236 iTypeTextLength--; |
|
237 if ( ( iEventStatus != NULL ) && ( iTypeTextLength == 0 ) ) |
|
238 { |
|
239 TextTypeHandled(); |
|
240 } |
|
241 } |
|
242 break; |
|
243 } |
|
244 } |
|
245 else if ( aEvent.Type() == EEventPointer ) |
|
246 { |
|
247 if ( iEventType == EPointerEvent ) |
|
248 { |
|
249 PointerEventHandled(); |
|
250 } |
|
251 } |
|
252 } |
|
253 |
|
254 /* |
|
255 ------------------------------------------------------------------------------- |
|
256 |
|
257 Class: CUITestServerStarterAppUi |
|
258 |
|
259 Method: PrepareToTypeText |
|
260 |
|
261 Description: Prepares AppUi to recive type text event |
|
262 |
|
263 Prepares AppUi to recive type text event |
|
264 |
|
265 Parameters: TInt aTextLength: in: Text length. |
|
266 |
|
267 Return Values: None. |
|
268 |
|
269 Errors/Exceptions: None. |
|
270 |
|
271 Status: Draft |
|
272 |
|
273 ------------------------------------------------------------------------------- |
|
274 */ |
|
275 void CUITestServerStarterAppUi::PrepareToTypeText( TInt aTextLength ) |
|
276 { |
|
277 iTypeTextLength = aTextLength; |
|
278 iEventType = ETypeText; |
|
279 } |
|
280 |
|
281 /* |
|
282 ------------------------------------------------------------------------------- |
|
283 |
|
284 Class: CUITestServerStarterAppUi |
|
285 |
|
286 Method: PrepareToPressKey |
|
287 |
|
288 Description: Prepares AppUi to recive key press event |
|
289 |
|
290 Prepares AppUi to recive key press event |
|
291 |
|
292 Parameters: None. |
|
293 |
|
294 Return Values: None. |
|
295 |
|
296 Errors/Exceptions: None. |
|
297 |
|
298 Status: Draft |
|
299 |
|
300 ------------------------------------------------------------------------------- |
|
301 */ |
|
302 void CUITestServerStarterAppUi::PrepareToPressKey() |
|
303 { |
|
304 iEventType = EPressKey; |
|
305 } |
|
306 |
|
307 /* |
|
308 ------------------------------------------------------------------------------- |
|
309 |
|
310 Class: CUITestServerStarterAppUi |
|
311 |
|
312 Method: PrepareToPointerEvent |
|
313 |
|
314 Description: Prepares AppUi to recive pointer event |
|
315 |
|
316 Prepares AppUi to recive key press event |
|
317 |
|
318 Parameters: None. |
|
319 |
|
320 Return Values: None. |
|
321 |
|
322 Errors/Exceptions: None. |
|
323 |
|
324 Status: Draft |
|
325 |
|
326 ------------------------------------------------------------------------------- |
|
327 */ |
|
328 void CUITestServerStarterAppUi::PrepareToPointerEvent() |
|
329 { |
|
330 iEventType = EPointerEvent; |
|
331 } |
|
332 |
|
333 |
|
334 /* |
|
335 ------------------------------------------------------------------------------- |
|
336 |
|
337 Class: CUITestServerStarterAppUi |
|
338 |
|
339 Method: KeyPressHandled |
|
340 |
|
341 Description: Sends notification that key press was handled. |
|
342 |
|
343 Notifies client that key press was handled. |
|
344 |
|
345 Parameters: None. |
|
346 |
|
347 Return Values: None. |
|
348 |
|
349 Errors/Exceptions: None. |
|
350 |
|
351 Status: Draft |
|
352 |
|
353 ------------------------------------------------------------------------------- |
|
354 */ |
|
355 void CUITestServerStarterAppUi::KeyPressHandled() |
|
356 { |
|
357 if ( ( iEventType == EPressKey ) && ( iEventStatus != NULL ) && ( iEventType == EPressKey ) ) |
|
358 { |
|
359 iEventType = ENone; |
|
360 User::RequestComplete( iEventStatus, KErrNone ); |
|
361 iEventStatus = NULL; |
|
362 } |
|
363 } |
|
364 |
|
365 /* |
|
366 ------------------------------------------------------------------------------- |
|
367 |
|
368 Class: CUITestServerStarterAppUi |
|
369 |
|
370 Method: TextTypeHandled |
|
371 |
|
372 Description: Sends notification that type text was handled. |
|
373 |
|
374 Notifies client that type text was handled. |
|
375 |
|
376 Parameters: None. |
|
377 |
|
378 Return Values: None. |
|
379 |
|
380 Errors/Exceptions: None. |
|
381 |
|
382 Status: Draft |
|
383 |
|
384 ------------------------------------------------------------------------------- |
|
385 */ |
|
386 void CUITestServerStarterAppUi::TextTypeHandled() |
|
387 { |
|
388 if ( ( iEventType == ETypeText ) && ( iEventStatus != NULL ) && ( iEventType == ETypeText ) ) |
|
389 { |
|
390 iEventType = ENone; |
|
391 iTypeTextLength = 0; |
|
392 User::RequestComplete( iEventStatus, KErrNone ); |
|
393 iEventStatus = NULL; |
|
394 } |
|
395 } |
|
396 |
|
397 /* |
|
398 ------------------------------------------------------------------------------- |
|
399 |
|
400 Class: CUITestServerStarterAppUi |
|
401 |
|
402 Method: PointerEventHandled |
|
403 |
|
404 Description: Sends notification that pointer event was handled. |
|
405 |
|
406 Notifies client that pointer event was handled. |
|
407 |
|
408 Parameters: None. |
|
409 |
|
410 Return Values: None. |
|
411 |
|
412 Errors/Exceptions: None. |
|
413 |
|
414 Status: Draft |
|
415 |
|
416 ------------------------------------------------------------------------------- |
|
417 */ |
|
418 void CUITestServerStarterAppUi::PointerEventHandled() |
|
419 { |
|
420 if ( ( iEventType == EPointerEvent ) && ( iEventStatus != NULL ) ) |
|
421 { |
|
422 iEventType = ENone; |
|
423 User::RequestComplete( iEventStatus, KErrNone ); |
|
424 iEventStatus = NULL; |
|
425 } |
|
426 } |
|
427 |
|
428 |
|
429 /* |
|
430 ------------------------------------------------------------------------------- |
|
431 |
|
432 Class: CUITestServerStarterAppUi |
|
433 |
|
434 Method: NotifyAboutHandledKeyPress |
|
435 |
|
436 Description: Requests notification of press key completion. |
|
437 |
|
438 Requests notification of press key completion. |
|
439 |
|
440 Parameters: TRequestStatus* aStatus: in: Request status pointer. |
|
441 |
|
442 Return Values: None. |
|
443 |
|
444 Errors/Exceptions: None. |
|
445 |
|
446 Status: Draft |
|
447 |
|
448 ------------------------------------------------------------------------------- |
|
449 */ |
|
450 void CUITestServerStarterAppUi::NotifyAboutHandledKeyPress( TRequestStatus* aStatus ) |
|
451 { |
|
452 iEventStatus = aStatus; |
|
453 } |
|
454 |
|
455 /* |
|
456 ------------------------------------------------------------------------------- |
|
457 |
|
458 Class: CUITestServerStarterAppUi |
|
459 |
|
460 Method: NotifyAboutHandledTextType |
|
461 |
|
462 Description: Requests notification when text type event is handled. |
|
463 |
|
464 Requests notification when text type event is handled. |
|
465 |
|
466 Parameters: TRequestStatus* aStatus: in: Request status pointer. |
|
467 |
|
468 Return Values: None. |
|
469 |
|
470 Errors/Exceptions: None. |
|
471 |
|
472 Status: Draft |
|
473 |
|
474 ------------------------------------------------------------------------------- |
|
475 */ |
|
476 void CUITestServerStarterAppUi::NotifyAboutHandledTextType( TRequestStatus* aStatus ) |
|
477 { |
|
478 iEventStatus = aStatus; |
|
479 } |
|
480 |
|
481 /* |
|
482 ------------------------------------------------------------------------------- |
|
483 |
|
484 Class: CUITestServerStarterAppUi |
|
485 |
|
486 Method: NotifyAboutHandledPointerEvent |
|
487 |
|
488 Description: Requests notification when pointer event is handled. |
|
489 |
|
490 Requests notification when pointer event is handled. |
|
491 |
|
492 Parameters: TRequestStatus* aStatus: in: Request status pointer. |
|
493 |
|
494 Return Values: None. |
|
495 |
|
496 Errors/Exceptions: None. |
|
497 |
|
498 Status: Draft |
|
499 |
|
500 ------------------------------------------------------------------------------- |
|
501 */ |
|
502 void CUITestServerStarterAppUi::NotifyAboutHandledPointerEvent( TRequestStatus* aStatus ) |
|
503 { |
|
504 iEventStatus = aStatus; |
|
505 } |
|
506 |
|
507 |
|
508 // End of File |