|
1 // Copyright (c) 1996-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 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #ifndef __TMESSAGE_H__ |
|
23 #define __TMESSAGE_H__ |
|
24 |
|
25 #include <e32std.h> |
|
26 #include <w32std.h> |
|
27 #include "../tlib/testbase.h" |
|
28 #include "AUTO.H" |
|
29 #include "TGraphicsHarness.h" |
|
30 |
|
31 class CMessageReceiver; |
|
32 |
|
33 class CLowPriorityIdle : public CIdle |
|
34 { |
|
35 public: |
|
36 CLowPriorityIdle(); |
|
37 virtual TInt RunError(TInt aError); |
|
38 }; |
|
39 |
|
40 class CTMessage : public CTWsGraphicsBase |
|
41 { |
|
42 public: |
|
43 CTMessage(CTestStep* aStep); |
|
44 ~CTMessage(); |
|
45 void ConstructL(); |
|
46 void TestPanicsL(); |
|
47 void MessageTests(TInt aNoOfMessages,TInt aMsgCountCheck,TBool aSyncSendReceiveFlag,TBool aTestNeedsExtraCheck); |
|
48 void OnMessageReceived(const TWsEvent &aEvent, TInt& aMsgCount); |
|
49 TInt SendSyncMessages(); |
|
50 static TInt CallbackLowPriority(TAny *aMessageTest); |
|
51 TInt CreateAndSendMessages(TInt aCount,TInt aNoOfMessages); |
|
52 void TestMessageQueueOverflowL(); |
|
53 |
|
54 protected: |
|
55 virtual void RunTestCaseL(TInt aCurTestCase); |
|
56 |
|
57 private: |
|
58 TBool iSyncSendReceiveFlag; |
|
59 TInt iCounter; |
|
60 HBufC8* iMsg; |
|
61 RPointerArray<CMessageReceiver>* iMessageReceiver; |
|
62 CLowPriorityIdle* iLowPriorityObject; |
|
63 TInt iState; |
|
64 }; |
|
65 |
|
66 |
|
67 class CMessageReceiver : public CTWindowGroup |
|
68 { |
|
69 public: |
|
70 CMessageReceiver(CTClient *aClient, CTMessage *aTMessage); |
|
71 void MessageReady(const TWsEvent &aTime); |
|
72 inline TInt MessageCount() |
|
73 {return iMsgCount;} |
|
74 inline void ResetMessageCount() |
|
75 {iMsgCount=0;} |
|
76 private: |
|
77 CTMessage *iTMessage; // CTMessage, to call it's OnMessageReceived when message is received |
|
78 TInt iMsgCount; |
|
79 }; |
|
80 |
|
81 |
|
82 |
|
83 class CTMessageStep : public CTGraphicsStep |
|
84 { |
|
85 public: |
|
86 CTMessageStep(); |
|
87 protected: |
|
88 //from CTGraphicsStep |
|
89 virtual CTGraphicsBase* CreateTestL(); |
|
90 }; |
|
91 |
|
92 _LIT(KTMessageStep,"TMessage"); |
|
93 |
|
94 |
|
95 #endif |