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 default: |
|
244 // Do nothing |
|
245 break; |
|
246 } |
|
247 } |
|
248 else if ( aEvent.Type() == EEventPointer ) |
|
249 { |
|
250 if ( iEventType == EPointerEvent ) |
|
251 { |
|
252 PointerEventHandled(); |
|
253 } |
|
254 } |
|
255 } |
|
256 |
|
257 /* |
|
258 ------------------------------------------------------------------------------- |
|
259 |
|
260 Class: CUITestServerStarterAppUi |
|
261 |
|
262 Method: PrepareToTypeText |
|
263 |
|
264 Description: Prepares AppUi to recive type text event |
|
265 |
|
266 Prepares AppUi to recive type text event |
|
267 |
|
268 Parameters: TInt aTextLength: in: Text length. |
|
269 |
|
270 Return Values: None. |
|
271 |
|
272 Errors/Exceptions: None. |
|
273 |
|
274 Status: Draft |
|
275 |
|
276 ------------------------------------------------------------------------------- |
|
277 */ |
|
278 void CUITestServerStarterAppUi::PrepareToTypeText( TInt aTextLength ) |
|
279 { |
|
280 iTypeTextLength = aTextLength; |
|
281 iEventType = ETypeText; |
|
282 } |
|
283 |
|
284 /* |
|
285 ------------------------------------------------------------------------------- |
|
286 |
|
287 Class: CUITestServerStarterAppUi |
|
288 |
|
289 Method: PrepareToPressKey |
|
290 |
|
291 Description: Prepares AppUi to recive key press event |
|
292 |
|
293 Prepares AppUi to recive key press event |
|
294 |
|
295 Parameters: None. |
|
296 |
|
297 Return Values: None. |
|
298 |
|
299 Errors/Exceptions: None. |
|
300 |
|
301 Status: Draft |
|
302 |
|
303 ------------------------------------------------------------------------------- |
|
304 */ |
|
305 void CUITestServerStarterAppUi::PrepareToPressKey() |
|
306 { |
|
307 iEventType = EPressKey; |
|
308 } |
|
309 |
|
310 /* |
|
311 ------------------------------------------------------------------------------- |
|
312 |
|
313 Class: CUITestServerStarterAppUi |
|
314 |
|
315 Method: PrepareToPointerEvent |
|
316 |
|
317 Description: Prepares AppUi to recive pointer event |
|
318 |
|
319 Prepares AppUi to recive key press event |
|
320 |
|
321 Parameters: None. |
|
322 |
|
323 Return Values: None. |
|
324 |
|
325 Errors/Exceptions: None. |
|
326 |
|
327 Status: Draft |
|
328 |
|
329 ------------------------------------------------------------------------------- |
|
330 */ |
|
331 void CUITestServerStarterAppUi::PrepareToPointerEvent() |
|
332 { |
|
333 iEventType = EPointerEvent; |
|
334 } |
|
335 |
|
336 |
|
337 /* |
|
338 ------------------------------------------------------------------------------- |
|
339 |
|
340 Class: CUITestServerStarterAppUi |
|
341 |
|
342 Method: KeyPressHandled |
|
343 |
|
344 Description: Sends notification that key press was handled. |
|
345 |
|
346 Notifies client that key press was handled. |
|
347 |
|
348 Parameters: None. |
|
349 |
|
350 Return Values: None. |
|
351 |
|
352 Errors/Exceptions: None. |
|
353 |
|
354 Status: Draft |
|
355 |
|
356 ------------------------------------------------------------------------------- |
|
357 */ |
|
358 void CUITestServerStarterAppUi::KeyPressHandled() |
|
359 { |
|
360 if ( ( iEventType == EPressKey ) && ( iEventStatus != NULL ) && ( iEventType == EPressKey ) ) |
|
361 { |
|
362 iEventType = ENone; |
|
363 User::RequestComplete( iEventStatus, KErrNone ); |
|
364 iEventStatus = NULL; |
|
365 } |
|
366 } |
|
367 |
|
368 /* |
|
369 ------------------------------------------------------------------------------- |
|
370 |
|
371 Class: CUITestServerStarterAppUi |
|
372 |
|
373 Method: TextTypeHandled |
|
374 |
|
375 Description: Sends notification that type text was handled. |
|
376 |
|
377 Notifies client that type text was handled. |
|
378 |
|
379 Parameters: None. |
|
380 |
|
381 Return Values: None. |
|
382 |
|
383 Errors/Exceptions: None. |
|
384 |
|
385 Status: Draft |
|
386 |
|
387 ------------------------------------------------------------------------------- |
|
388 */ |
|
389 void CUITestServerStarterAppUi::TextTypeHandled() |
|
390 { |
|
391 if ( ( iEventType == ETypeText ) && ( iEventStatus != NULL ) && ( iEventType == ETypeText ) ) |
|
392 { |
|
393 iEventType = ENone; |
|
394 iTypeTextLength = 0; |
|
395 User::RequestComplete( iEventStatus, KErrNone ); |
|
396 iEventStatus = NULL; |
|
397 } |
|
398 } |
|
399 |
|
400 /* |
|
401 ------------------------------------------------------------------------------- |
|
402 |
|
403 Class: CUITestServerStarterAppUi |
|
404 |
|
405 Method: PointerEventHandled |
|
406 |
|
407 Description: Sends notification that pointer event was handled. |
|
408 |
|
409 Notifies client that pointer event was handled. |
|
410 |
|
411 Parameters: None. |
|
412 |
|
413 Return Values: None. |
|
414 |
|
415 Errors/Exceptions: None. |
|
416 |
|
417 Status: Draft |
|
418 |
|
419 ------------------------------------------------------------------------------- |
|
420 */ |
|
421 void CUITestServerStarterAppUi::PointerEventHandled() |
|
422 { |
|
423 if ( ( iEventType == EPointerEvent ) && ( iEventStatus != NULL ) ) |
|
424 { |
|
425 iEventType = ENone; |
|
426 User::RequestComplete( iEventStatus, KErrNone ); |
|
427 iEventStatus = NULL; |
|
428 } |
|
429 } |
|
430 |
|
431 |
|
432 /* |
|
433 ------------------------------------------------------------------------------- |
|
434 |
|
435 Class: CUITestServerStarterAppUi |
|
436 |
|
437 Method: NotifyAboutHandledKeyPress |
|
438 |
|
439 Description: Requests notification of press key completion. |
|
440 |
|
441 Requests notification of press key completion. |
|
442 |
|
443 Parameters: TRequestStatus* aStatus: in: Request status pointer. |
|
444 |
|
445 Return Values: None. |
|
446 |
|
447 Errors/Exceptions: None. |
|
448 |
|
449 Status: Draft |
|
450 |
|
451 ------------------------------------------------------------------------------- |
|
452 */ |
|
453 void CUITestServerStarterAppUi::NotifyAboutHandledKeyPress( TRequestStatus* aStatus ) |
|
454 { |
|
455 iEventStatus = aStatus; |
|
456 } |
|
457 |
|
458 /* |
|
459 ------------------------------------------------------------------------------- |
|
460 |
|
461 Class: CUITestServerStarterAppUi |
|
462 |
|
463 Method: NotifyAboutHandledTextType |
|
464 |
|
465 Description: Requests notification when text type event is handled. |
|
466 |
|
467 Requests notification when text type event is handled. |
|
468 |
|
469 Parameters: TRequestStatus* aStatus: in: Request status pointer. |
|
470 |
|
471 Return Values: None. |
|
472 |
|
473 Errors/Exceptions: None. |
|
474 |
|
475 Status: Draft |
|
476 |
|
477 ------------------------------------------------------------------------------- |
|
478 */ |
|
479 void CUITestServerStarterAppUi::NotifyAboutHandledTextType( TRequestStatus* aStatus ) |
|
480 { |
|
481 iEventStatus = aStatus; |
|
482 } |
|
483 |
|
484 /* |
|
485 ------------------------------------------------------------------------------- |
|
486 |
|
487 Class: CUITestServerStarterAppUi |
|
488 |
|
489 Method: NotifyAboutHandledPointerEvent |
|
490 |
|
491 Description: Requests notification when pointer event is handled. |
|
492 |
|
493 Requests notification when pointer event is handled. |
|
494 |
|
495 Parameters: TRequestStatus* aStatus: in: Request status pointer. |
|
496 |
|
497 Return Values: None. |
|
498 |
|
499 Errors/Exceptions: None. |
|
500 |
|
501 Status: Draft |
|
502 |
|
503 ------------------------------------------------------------------------------- |
|
504 */ |
|
505 void CUITestServerStarterAppUi::NotifyAboutHandledPointerEvent( TRequestStatus* aStatus ) |
|
506 { |
|
507 iEventStatus = aStatus; |
|
508 } |
|
509 |
|
510 // End of File |
|