|
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: Tests senduisingleton.h and CSendingService.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // [INCLUDE FILES] - do not remove |
|
22 #include <e32svr.h> |
|
23 #include <StifParser.h> |
|
24 #include <Stiftestinterface.h> |
|
25 #include <coemain.h> |
|
26 #include "SendUiPluginAPITest.h" |
|
27 #include <CSendingService.h> |
|
28 #include <SendUiConsts.h> |
|
29 #include <senduisingleton.h> |
|
30 |
|
31 // EXTERNAL DATA STRUCTURES |
|
32 |
|
33 // EXTERNAL FUNCTION PROTOTYPES |
|
34 |
|
35 // CONSTANTS |
|
36 |
|
37 // MACROS |
|
38 |
|
39 // LOCAL CONSTANTS AND MACROS |
|
40 |
|
41 // MODULE DATA STRUCTURES |
|
42 |
|
43 // LOCAL FUNCTION PROTOTYPES |
|
44 |
|
45 // FORWARD DECLARATIONS |
|
46 |
|
47 // ============================= LOCAL FUNCTIONS =============================== |
|
48 |
|
49 // ============================ MEMBER FUNCTIONS =============================== |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CSendUiPluginAPITest::Delete |
|
53 // Delete here all resources allocated and opened from test methods. |
|
54 // Called from destructor. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 void CSendUiPluginAPITest::Delete() |
|
58 { |
|
59 |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CSendUiPluginAPITest::RunMethodL |
|
64 // Run specified method. Contains also table of test mothods and their names. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 |
|
68 TInt CSendUiPluginAPITest::RunMethodL( |
|
69 CStifItemParser& aItem ) |
|
70 { |
|
71 |
|
72 static TStifFunctionInfo const KFunctions[] = |
|
73 { |
|
74 // Copy this line for every implemented function. |
|
75 // First string is the function name used in TestScripter script file. |
|
76 // Second is the actual implementation member function. |
|
77 ENTRY( "CSendUiSingleton", CSendUiPluginAPITest::TestCSendUiSingletonNewL ), |
|
78 ENTRY( "CMsvSessions", CSendUiPluginAPITest::TestMsvSessionL ), |
|
79 ENTRY( "CClientMtmRegistryL", CSendUiPluginAPITest::TestClientMtmRegistryL ), |
|
80 ENTRY( "CMtmUiRegistry", CSendUiPluginAPITest::TestMtmUiRegistryL ), |
|
81 ENTRY( "CMtmUiDataRegistry", CSendUiPluginAPITest::TestMtmUiDataRegistryL ), |
|
82 ENTRY( "CSendingService", CSendUiPluginAPITest::TestCSendingServiceL ), |
|
83 |
|
84 //ADD NEW ENTRY HERE |
|
85 // [test cases entries] - Do not remove |
|
86 |
|
87 }; |
|
88 |
|
89 const TInt count = sizeof( KFunctions ) / |
|
90 sizeof( TStifFunctionInfo ); |
|
91 |
|
92 return RunInternalL( KFunctions, count, aItem ); |
|
93 |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CSendUiPluginAPITest::TestCSendUiSingletonNewL |
|
98 // Tests NewL of CSendUISingleton::NewL |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 TInt CSendUiPluginAPITest::TestCSendUiSingletonNewL(CStifItemParser& /*aItem*/ ) |
|
102 { |
|
103 CSendUiSingleton* singleton = CSendUiSingleton::NewL(); |
|
104 delete singleton; |
|
105 return KErrNone; |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CSendUiPluginAPITest::TestMsvSessionL |
|
110 // Tests NewL of CSendUISingleton::MsvSessionL |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 TInt CSendUiPluginAPITest::TestMsvSessionL(CStifItemParser& /*aItem*/ ) |
|
114 { |
|
115 CSendUiSingleton* singleton = CSendUiSingleton::NewL(); |
|
116 CleanupStack::PushL( singleton ); |
|
117 TRAPD( err, CMsvSession& msvSession = singleton->MsvSessionL()); |
|
118 if( err != KErrNone ) |
|
119 { |
|
120 _LIT( KError, "CSendUiSingleton::MsvSessionL leaves with %d error"); |
|
121 iLog->Log( KError, err); |
|
122 } |
|
123 else |
|
124 { |
|
125 _LIT( KError, "CSendUiSingleton::MsvSessionL Passed"); |
|
126 iLog->Log( KError ); |
|
127 } |
|
128 CleanupStack::PopAndDestroy();//singleton |
|
129 return err; |
|
130 } |
|
131 |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CSendUiPluginAPITest::TestClientMtmRegistryL |
|
135 // Tests NewL of CSendUISingleton::ClientMtmRegistryL |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 TInt CSendUiPluginAPITest::TestClientMtmRegistryL(CStifItemParser& /*aItem*/ ) |
|
139 { |
|
140 CSendUiSingleton* singleton = CSendUiSingleton::NewL(); |
|
141 CleanupStack::PushL( singleton ); |
|
142 TRAPD( err, CClientMtmRegistry& clientMtmRegistry = singleton->ClientMtmRegistryL()); |
|
143 if( err != KErrNone ) |
|
144 { |
|
145 _LIT( KError, "CSendUiSingleton::ClientMtmRegistryL leaves with %d error"); |
|
146 iLog->Log( KError, err); |
|
147 } |
|
148 else |
|
149 { |
|
150 _LIT( KError, "CSendUiSingleton::ClientMtmRegistryL Passed"); |
|
151 iLog->Log( KError ); |
|
152 } |
|
153 CleanupStack::PopAndDestroy();//singleton |
|
154 return err; |
|
155 } |
|
156 |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CSendUiPluginAPITest::TestMtmUiRegistryL |
|
160 // Tests NewL of CSendUISingleton::MtmUiRegistryL |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 TInt CSendUiPluginAPITest::TestMtmUiRegistryL(CStifItemParser& /*aItem*/ ) |
|
164 { |
|
165 CSendUiSingleton* singleton = CSendUiSingleton::NewL(); |
|
166 CleanupStack::PushL( singleton ); |
|
167 TRAPD( err, CMtmUiRegistry& MtmUiRegistry = singleton->MtmUiRegistryL()); |
|
168 if( err != KErrNone ) |
|
169 { |
|
170 _LIT( KError, "CSendUiSingleton::MtmUiRegistryL leaves with %d error"); |
|
171 iLog->Log( KError, err); |
|
172 } |
|
173 else |
|
174 { |
|
175 _LIT( KError, "CSendUiSingleton::MtmUiRegistryL Passed"); |
|
176 iLog->Log( KError ); |
|
177 } |
|
178 CleanupStack::PopAndDestroy();//singleton |
|
179 return err; |
|
180 } |
|
181 |
|
182 // ----------------------------------------------------------------------------- |
|
183 // CSendUiPluginAPITest::TestMtmUiDataRegistryL |
|
184 // Tests NewL of CSendUISingleton::MtmUiDataRegistryL |
|
185 // ----------------------------------------------------------------------------- |
|
186 // |
|
187 TInt CSendUiPluginAPITest::TestMtmUiDataRegistryL(CStifItemParser& /*aItem*/ ) |
|
188 { |
|
189 CSendUiSingleton* singleton = CSendUiSingleton::NewL(); |
|
190 CleanupStack::PushL( singleton ); |
|
191 TRAPD( err, CMtmUiDataRegistry& MtmUiDataRegistry = singleton->MtmUiDataRegistryL()); |
|
192 if( err != KErrNone ) |
|
193 { |
|
194 _LIT( KError, "CSendUiSingleton::MtmUiDataRegistryL leaves with %d error"); |
|
195 iLog->Log( KError, err); |
|
196 } |
|
197 else |
|
198 { |
|
199 _LIT( KError, "CSendUiSingleton::MtmUiDataRegistryL Passed"); |
|
200 iLog->Log( KError ); |
|
201 } |
|
202 CleanupStack::PopAndDestroy();//singleton |
|
203 return err; |
|
204 } |
|
205 |
|
206 // ----------------------------------------------------------------------------- |
|
207 // CSendUiPluginAPITest::TestCSendingServiceL |
|
208 // Tests CSendingService::NewL, CSendingService::~CSendingService(), CSendingService::CSendingService |
|
209 // ----------------------------------------------------------------------------- |
|
210 // |
|
211 |
|
212 TInt CSendUiPluginAPITest::TestCSendingServiceL(CStifItemParser& /*aItem*/ ) |
|
213 { |
|
214 CSendUiSingleton* singleton = CSendUiSingleton::NewL(); |
|
215 CSendingService* sendingservice = NULL; |
|
216 TRAPD( error, sendingservice = CSendingService::NewL(KMeetingRequestSender,*(CCoeEnv::Static()),*singleton)); |
|
217 if( error == KErrNone ) |
|
218 { |
|
219 _LIT( KError, "CSendingService::NewL Passed"); |
|
220 iLog->Log( KError); |
|
221 delete sendingservice; |
|
222 _LIT( KError1, "CSendingService::~CSendingService()Passed"); |
|
223 iLog->Log( KError1 ); |
|
224 } |
|
225 else |
|
226 { |
|
227 _LIT( KError, "CSendingService::NewL Failed"); |
|
228 iLog->Log( KError); |
|
229 } |
|
230 delete singleton; |
|
231 REComSession::FinalClose(); |
|
232 return error; |
|
233 } |
|
234 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
235 // None |
|
236 |
|
237 // [End of File] - Do not remove |