|
1 /** |
|
2 * Copyright (c) 2006-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 */ |
|
23 |
|
24 #ifndef __MESSAGINGTESTUTILITYSERVER2_H__ |
|
25 #define __MESSAGINGTESTUTILITYSERVER2_H__ |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <f32file.h> |
|
29 #include <messagingtestutility2.h> |
|
30 #include "cmsgtestpropertymappair.h" |
|
31 #include "mmsgtestpropertywatcher.h" |
|
32 |
|
33 class CMsgTestPropertyWatcher; |
|
34 |
|
35 /** |
|
36 Enumerations for panic code |
|
37 */ |
|
38 enum TTestPanic |
|
39 { |
|
40 ETestPanicBadDescriptor, |
|
41 ETestPanicIllegalFunction, |
|
42 ETestPanicAlreadyReceiving |
|
43 }; |
|
44 |
|
45 void PanicClient(RMessage2& aMessage,TTestPanic TMyPanic); |
|
46 |
|
47 |
|
48 /** |
|
49 Shuts down a server |
|
50 */ |
|
51 class CShutdown : public CTimer |
|
52 { |
|
53 enum {KMyShutdownDelay = 0x200000}; // approx 2s |
|
54 public: |
|
55 inline CShutdown(); |
|
56 inline void ConstructL(); |
|
57 inline void Start(); |
|
58 |
|
59 private: |
|
60 void RunL(); |
|
61 }; |
|
62 |
|
63 |
|
64 /** |
|
65 An utility server that handles the sessions and requests from the client |
|
66 */ |
|
67 class CMessagingTestUtilityServer2 : public CServer2 |
|
68 { |
|
69 public: |
|
70 static CServer2* NewLC(); |
|
71 void AddSession(); |
|
72 void DropSession(); |
|
73 |
|
74 private: |
|
75 CMessagingTestUtilityServer2(); |
|
76 void ConstructL(); |
|
77 CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; |
|
78 |
|
79 private: |
|
80 TInt iSessionCount; |
|
81 CShutdown iShutdown; |
|
82 }; |
|
83 |
|
84 |
|
85 /** |
|
86 Perfroms the file system operations |
|
87 */ |
|
88 class CMessagingTestUtilitySession2 : public CSession2, public MMsgTestPropertyWatcher |
|
89 { |
|
90 public: |
|
91 CMessagingTestUtilitySession2(); |
|
92 void CreateL(); |
|
93 private: |
|
94 ~CMessagingTestUtilitySession2(); |
|
95 inline CMessagingTestUtilityServer2& Server(); |
|
96 void ServiceL(const RMessage2& aMessage); |
|
97 void ServiceError(const RMessage2& aMessage,TInt aError); |
|
98 inline TBool ReceivePending() const; |
|
99 |
|
100 //From MMsgTestPropertyWatcher |
|
101 void HandleEventL(RProperty& aProperty, TUint /*aKey*/); |
|
102 |
|
103 private: |
|
104 TInt DoDeleteMessageStoreL(const RMessage2& aMessage); |
|
105 TInt DoKillProcessL(const RMessage2& aMessage); |
|
106 TInt DoCopyFileL(const RMessage2& aMessage); |
|
107 TInt DoDeleteFileL(const RMessage2& aMessage); |
|
108 TInt DoMkDirL(const RMessage2& aMessage); |
|
109 TInt DoRmDirL(const RMessage2& aMessage); |
|
110 TInt DoGetDirL(const RMessage2& aMessage); |
|
111 TInt DoGetDirCountL(const RMessage2& aMessage); |
|
112 TInt DoGetDirEntryL(const RMessage2& aMessage); |
|
113 TInt DoFileExistsL(const RMessage2& aMessage); |
|
114 |
|
115 //EventHandler |
|
116 TInt DoEventHandlerInitL(); |
|
117 TInt DoEventHandlerAddL(const RMessage2& aMessage); |
|
118 TInt DoEventHandlerCheck(); |
|
119 |
|
120 private: |
|
121 RFs iFs; |
|
122 CDir* iDir; |
|
123 |
|
124 CMsgTestPropertyWatcher* iWatcherNetTestStub; |
|
125 RPointerArray<CMsgTestPropertyMapPair> iEventList; |
|
126 }; |
|
127 |
|
128 #endif //__MESSAGINGTESTUTILITYSERVER2__ |