|
1 /* |
|
2 * Copyright (c) 2002 - 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: test functions for alf client server api |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // [INCLUDE FILES] |
|
20 #include <e32svr.h> |
|
21 #include <coemain.h> |
|
22 #include <stifparser.h> |
|
23 #include <stiftestinterface.h> |
|
24 #include <alf/alfappserver.h> |
|
25 #include <alf/alfappsrvsessionbase.h> |
|
26 #include <alf/alfclientbase.h> |
|
27 #include <aknserverapp.h> |
|
28 |
|
29 #include "testplatclientserver.h" |
|
30 |
|
31 //const veriable |
|
32 const TInt KAlfAppServerInterfaceUid3 = 0x10282845; |
|
33 const TInt KStringSize = 50; |
|
34 |
|
35 //The RAlfClientBaseImp class is used to test the RAlfClientBase protect member |
|
36 class RAlfClientBaseImp : public RAlfClientBase |
|
37 { |
|
38 public: |
|
39 RAlfClientBaseImp(TInt aServiceUid):RAlfClientBase( aServiceUid ) |
|
40 { |
|
41 } |
|
42 void TestConstructServerName( |
|
43 TName& aServerName, |
|
44 TUid aAppServerUid, |
|
45 TUint aServerDifferentiator ) |
|
46 { |
|
47 RAlfClientBase::ConstructServerName( aServerName, aAppServerUid, aServerDifferentiator ); |
|
48 } |
|
49 TUint TestStartServerL( TUid aAppUid ) |
|
50 { |
|
51 return StartServerL( aAppUid ); |
|
52 } |
|
53 void TestLaunchAppL( |
|
54 TUid aAppUid, |
|
55 TUint aServerDifferentiator, |
|
56 TThreadId& aThreadId ) |
|
57 { |
|
58 LaunchAppL( aAppUid, aServerDifferentiator, aThreadId); |
|
59 } |
|
60 }; |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CTestPlatClientServer::TestServerRAlfClientBaseL |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 TInt CTestPlatClientServer::TestServerRAlfClientBaseL( CStifItemParser& /*aItem*/ ) |
|
66 { |
|
67 |
|
68 // Print to UI |
|
69 _LIT( Ktestplatclientserver, "testplatclientserver" ); |
|
70 _LIT( KTestServerNewAppServerL, "In TestServerNewAppServerL" ); |
|
71 TestModuleIf().Printf( 0, Ktestplatclientserver, KTestServerNewAppServerL ); |
|
72 // Print to log file |
|
73 iLog->Log( KTestServerNewAppServerL ); |
|
74 |
|
75 RAlfClientBase clientBase( KAlfAppServerInterfaceUid3 ); |
|
76 CleanupClosePushL( clientBase ); |
|
77 CleanupStack::PopAndDestroy( &clientBase ); |
|
78 |
|
79 return KErrNone; |
|
80 |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CTestPlatClientServer::TestServerOpenL |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 TInt CTestPlatClientServer::TestServerOpenL( CStifItemParser& /*aItem*/ ) |
|
88 { |
|
89 |
|
90 // Print to UI |
|
91 _LIT( Ktestplatclientserver, "testplatclientserver" ); |
|
92 _LIT( KTestServerOpenL, "In TestServerOpenL" ); |
|
93 TestModuleIf().Printf( 0, Ktestplatclientserver, KTestServerOpenL ); |
|
94 // Print to log file |
|
95 iLog->Log( KTestServerOpenL ); |
|
96 |
|
97 RAlfClientBase clientBase( KAlfAppServerInterfaceUid3 ); |
|
98 CleanupClosePushL( clientBase ); |
|
99 clientBase.OpenL(); |
|
100 CleanupStack::PopAndDestroy( &clientBase ); |
|
101 |
|
102 return KErrNone; |
|
103 |
|
104 } |
|
105 |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CTestPlatClientServer::TestServerServiceUidL |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 TInt CTestPlatClientServer::TestServerServiceUidL( CStifItemParser& /*aItem*/ ) |
|
112 { |
|
113 |
|
114 // Print to UI |
|
115 _LIT( Ktestplatclientserver, "testplatclientserver" ); |
|
116 _LIT( KTestServerOpenL, "In TestServerOpenL" ); |
|
117 TestModuleIf().Printf( 0, Ktestplatclientserver, KTestServerOpenL ); |
|
118 // Print to log file |
|
119 iLog->Log( KTestServerOpenL ); |
|
120 |
|
121 RAlfClientBase clientBase( KAlfAppServerInterfaceUid3 ); |
|
122 CleanupClosePushL( clientBase ); |
|
123 |
|
124 clientBase.OpenL(); |
|
125 clientBase.ServiceUid(); |
|
126 |
|
127 CleanupStack::PopAndDestroy( &clientBase ); |
|
128 |
|
129 return KErrNone; |
|
130 |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CTestPlatClientServer::TestServerGrantAccessToPrivateFileL |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 TInt CTestPlatClientServer::TestServerGrantAccessToPrivateFileL( CStifItemParser& /*aItem*/ ) |
|
138 { |
|
139 |
|
140 // Print to UI |
|
141 _LIT( Ktestplatclientserver, "testplatclientserver" ); |
|
142 _LIT( KTestServerOpenL, "In TestServerOpenL" ); |
|
143 TestModuleIf().Printf( 0, Ktestplatclientserver, KTestServerOpenL ); |
|
144 // Print to log file |
|
145 iLog->Log( KTestServerOpenL ); |
|
146 |
|
147 RAlfClientBase clientBase( KAlfAppServerInterfaceUid3 ); |
|
148 CleanupClosePushL( clientBase ); |
|
149 |
|
150 TInt objectIdentfier = 0; |
|
151 TInt commandId = 0; |
|
152 |
|
153 TBuf<KStringSize> temp; |
|
154 clientBase.GrantAccessToPrivateFile( temp, objectIdentfier, commandId ); |
|
155 |
|
156 CleanupStack::PopAndDestroy( &clientBase ); |
|
157 |
|
158 return KErrNone; |
|
159 |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CTestPlatClientServer::TestServerGrantAccessToPrivateRFileL |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 TInt CTestPlatClientServer::TestServerGrantAccessToPrivateRFileL( CStifItemParser& /*aItem*/ ) |
|
167 { |
|
168 |
|
169 // Print to UI |
|
170 _LIT( Ktestplatclientserver, "testplatclientserver" ); |
|
171 _LIT( KTestServerGrantAccessToPrivateRFileL, "In TestServerGrantAccessToPrivateRFileL" ); |
|
172 TestModuleIf().Printf( 0, Ktestplatclientserver, KTestServerGrantAccessToPrivateRFileL ); |
|
173 // Print to log file |
|
174 iLog->Log( KTestServerGrantAccessToPrivateRFileL ); |
|
175 |
|
176 RAlfClientBase clientBase( KAlfAppServerInterfaceUid3 ); |
|
177 CleanupClosePushL( clientBase ); |
|
178 |
|
179 TInt objectIdentfier = 0; |
|
180 TInt commandId = 0; |
|
181 RFile file; |
|
182 clientBase.GrantAccessToPrivateFile( file, objectIdentfier, commandId); |
|
183 |
|
184 CleanupStack::PopAndDestroy( &clientBase ); |
|
185 |
|
186 return KErrNone; |
|
187 |
|
188 } |
|
189 |
|
190 // ----------------------------------------------------------------------------- |
|
191 // CTestPlatClientServer::TestServerConstructServerNameL |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 TInt CTestPlatClientServer::TestServerConstructServerNameL( CStifItemParser& /*aItem*/ ) |
|
195 { |
|
196 |
|
197 // Print to UI |
|
198 _LIT( Ktestplatclientserver, "testplatclientserver" ); |
|
199 _LIT( KTestServerConstructServerNameL, "In TestServerConstructServerNameL" ); |
|
200 TestModuleIf().Printf( 0, Ktestplatclientserver, KTestServerConstructServerNameL ); |
|
201 // Print to log file |
|
202 iLog->Log( KTestServerConstructServerNameL ); |
|
203 |
|
204 RAlfClientBaseImp clientBase( KAlfAppServerInterfaceUid3 ); |
|
205 CleanupClosePushL( clientBase ); |
|
206 |
|
207 TName serverName( _L("Name")); |
|
208 TUid appServerUid = { 0 }; |
|
209 TUint serverDifferentiator = 0; |
|
210 clientBase.TestConstructServerName( serverName, appServerUid, serverDifferentiator ); |
|
211 |
|
212 CleanupStack::PopAndDestroy( &clientBase ); |
|
213 |
|
214 return KErrNone; |
|
215 |
|
216 } |
|
217 |
|
218 // ----------------------------------------------------------------------------- |
|
219 // CTestPlatClientServer::TestServerStartServerLL |
|
220 // ----------------------------------------------------------------------------- |
|
221 // |
|
222 TInt CTestPlatClientServer::TestServerStartServerLL( CStifItemParser& /*aItem*/ ) |
|
223 { |
|
224 |
|
225 // Print to UI |
|
226 _LIT( Ktestplatclientserver, "testplatclientserver" ); |
|
227 _LIT( KTestServerStartServerLL, "In TestServerStartServerLL" ); |
|
228 TestModuleIf().Printf( 0, Ktestplatclientserver, KTestServerStartServerLL ); |
|
229 // Print to log file |
|
230 iLog->Log( KTestServerStartServerLL ); |
|
231 |
|
232 RAlfClientBaseImp clientBase( KAlfAppServerInterfaceUid3 ); |
|
233 CleanupClosePushL( clientBase ); |
|
234 |
|
235 |
|
236 TUid appServerUid = { 0 }; |
|
237 clientBase.TestStartServerL( appServerUid ); |
|
238 |
|
239 CleanupStack::PopAndDestroy( &clientBase ); |
|
240 |
|
241 return KErrNone; |
|
242 |
|
243 } |
|
244 |
|
245 // ----------------------------------------------------------------------------- |
|
246 // CTestPlatClientServer::TestServerLaunchAppL |
|
247 // ----------------------------------------------------------------------------- |
|
248 // |
|
249 TInt CTestPlatClientServer::TestServerLaunchAppL( CStifItemParser& /*aItem*/ ) |
|
250 { |
|
251 |
|
252 // Print to UI |
|
253 _LIT( Ktestplatclientserver, "testplatclientserver" ); |
|
254 _LIT( KTestServerLaunchAppL, "In TestServerLaunchAppL" ); |
|
255 TestModuleIf().Printf( 0, Ktestplatclientserver, KTestServerLaunchAppL ); |
|
256 // Print to log file |
|
257 iLog->Log( KTestServerLaunchAppL ); |
|
258 |
|
259 RAlfClientBaseImp clientBase( KAlfAppServerInterfaceUid3 ); |
|
260 CleanupClosePushL( clientBase ); |
|
261 |
|
262 |
|
263 TUid appUid = { 0 }; |
|
264 TUint aServerDifferentiator = 0; |
|
265 TThreadId aThreadId; |
|
266 clientBase.TestLaunchAppL( appUid, aServerDifferentiator, aThreadId ); |
|
267 |
|
268 CleanupStack::PopAndDestroy( &clientBase ); |
|
269 |
|
270 return KErrNone; |
|
271 |
|
272 } |
|
273 |
|
274 // [End of File] |