|
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 file contains STIFUnit implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 /** |
|
19 * STIF_UNIT_INCLUDE SECTION - put all #includes between STIF_UNIT_INCLUDE_SECTION |
|
20 * and STIF_UNIT_INCLUDE_SECTION_END |
|
21 */ |
|
22 #ifdef STIF_UNIT_INCLUDE_SECTION |
|
23 #include "remconeventtable.h" |
|
24 #include "mockremcontspcontroller.h" |
|
25 #include "tsptriggerevents.h" |
|
26 #include "ut_atsptspeventsstub.h" |
|
27 |
|
28 #include <W32STD.H> |
|
29 |
|
30 #endif //STIF_UNIT_INCLUDE_SECTION_END |
|
31 |
|
32 /** |
|
33 * GLOBAL VARIABLES SECTION |
|
34 */ |
|
35 #ifdef TEST_VAR_DECLARATIONS |
|
36 CRemConEventTable* table; |
|
37 CTspTriggerEventsWatcher* watcher; |
|
38 CUt_AtspTspEventsStub* tspstub; |
|
39 CActiveScheduler* scheduler; |
|
40 static const TInt KDefaultWaitTimeInMicroSeconds = 5000000; |
|
41 #endif |
|
42 /** |
|
43 * END OF GLOBAL VARIABLES SECTION |
|
44 */ |
|
45 |
|
46 |
|
47 /** |
|
48 * TEST CASES SECTION |
|
49 */ |
|
50 #ifdef TEST_CASES |
|
51 /** |
|
52 * STIF_SETUP defines activities needed before every test case. |
|
53 */ |
|
54 STIF_SETUP |
|
55 { |
|
56 // Install active scheduler at start up |
|
57 scheduler = new (ELeave) CActiveScheduler(); |
|
58 CleanupStack::PushL(scheduler); |
|
59 CActiveScheduler::Install(scheduler); |
|
60 } |
|
61 |
|
62 /** |
|
63 * STIF_TEARDOWN defines activities needed after every test case |
|
64 */ |
|
65 STIF_TEARDOWN |
|
66 { |
|
67 // Delete active scheduler at last |
|
68 CActiveScheduler::Install(NULL); |
|
69 CleanupStack::PopAndDestroy(scheduler); |
|
70 } |
|
71 |
|
72 /** |
|
73 * STIF_TESTDEFINE defines a test case |
|
74 * |
|
75 */ |
|
76 |
|
77 /** |
|
78 * @SYMTestCaseID GAPS-ATSP-EVENTTABLE-001 |
|
79 * @SYMTestCaseDesc Make sure TableNum is fix after construction. |
|
80 * @SYMTestPriority Medium |
|
81 * @SYMTestActions 1. Construct a CRemConEventTable object with table number as 5. |
|
82 * 2. TableNum() should return 5. |
|
83 * @SYMTestExpectedResults 1. CRemConEventTable object was successfully constructed. |
|
84 * 2. TableNum() returns 5. |
|
85 * @SYMTestType Unit Test |
|
86 * @SYMCreationDate 20-07-2010 |
|
87 */ |
|
88 STIF_TESTDEFINE(GAPS-ATSP-EVENTTABLE-001) |
|
89 { |
|
90 TInt tableNum = 5; |
|
91 table = CRemConEventTable::NewL(tableNum); |
|
92 CleanupStack::PushL(table); |
|
93 |
|
94 STIF_ASSERT_EQUALS(table->TableNum(), tableNum); |
|
95 STIF_LOG("TableNum() returned correct table number."); |
|
96 |
|
97 CleanupStack::PopAndDestroy(); |
|
98 } |
|
99 |
|
100 /** |
|
101 * @SYMTestCaseID GAPS-ATSP-EVENTTABLE-002 |
|
102 * @SYMTestCaseDesc Add different kinds of remote control events into event table. |
|
103 * Check whether those events are really in event table. Check whether unadded events are not in event table. |
|
104 * @SYMTestPriority Medium |
|
105 * @SYMTestActions 1. Construct a CRemConEventTable object with table number as 1. |
|
106 * 2. Add ERemConEvent into event table. |
|
107 * 3. Add ERemConExtEventCall into event table. |
|
108 * 4. Add ERemConExtEventPoc into event table. |
|
109 * 5. Add ERemConExtEventSync into event table. |
|
110 * 6. Add another ERemConEvent into event table. |
|
111 * 7. Add another ERemConExtEventCall into event table. |
|
112 * 8. Add another ERemConExtEventPoc into event table. |
|
113 * 9. Add another ERemConExtEventSync into event table. |
|
114 * 10. Check ERemConEvent in event table. |
|
115 * 11. Check ERemConExtEventCall in event table. |
|
116 * 12. Check ERemConExtEventPoc in event table. |
|
117 * 13. Check ERemConExtEventSync in event table. |
|
118 * 14. Check another ERemConEvent in event table. |
|
119 * 15. Check another ERemConExtEventCall in event table. |
|
120 * 16. Check another ERemConExtEventPoc in event table. |
|
121 * 17. Check another ERemConExtEventSync in event table. |
|
122 * 18. Check unadded events are not in event table. |
|
123 * @SYMTestExpectedResults 1. CRemConEventTable object was successfully constructed. |
|
124 * 2. An ERemConEvent was added into event table. |
|
125 * 3. An ERemConExtEventCall was added into event table. |
|
126 * 4. An ERemConExtEventPoc was added into event table. |
|
127 * 5. An ERemConExtEventSync was added into event table. |
|
128 * 6. Another ERemConEvent was added into event table. |
|
129 * 7. Another ERemConExtEventCall was added into event table. |
|
130 * 8. Another ERemConExtEventPoc was added into event table. |
|
131 * 9. Another ERemConExtEventSync was added into event table. |
|
132 * 10. ERemConEvent was in event table. |
|
133 * 11. ERemConExtEventCall was in event table. |
|
134 * 12. ERemConExtEventPoc was in event table. |
|
135 * 13. ERemConExtEventSync was in event table. |
|
136 * 14. Another ERemConEvent was in event table. |
|
137 * 15. Another ERemConExtEventCall was in event table. |
|
138 * 16. Another ERemConExtEventPoc was in event table. |
|
139 * 17. Another ERemConExtEventSync was in event table. |
|
140 * 18. Unadded events are not in event table. |
|
141 * @SYMTestType Unit Test |
|
142 * @SYMCreationDate 20-07-2010 |
|
143 */ |
|
144 STIF_TESTDEFINE(GAPS-ATSP-EVENTTABLE-002) |
|
145 { |
|
146 // 1. Construct a CRemConEventTable object with table number as 1. |
|
147 TInt tableNum = 1; |
|
148 table = CRemConEventTable::NewL(tableNum); |
|
149 CleanupStack::PushL(table); |
|
150 |
|
151 // 2. Add ERemConEvent into event table. |
|
152 // 3. Add ERemConExtEventCall into event table. |
|
153 // 4. Add ERemConExtEventPoc into event table. |
|
154 // 5. Add ERemConExtEventSync into event table. |
|
155 TInt eventValue = 41; |
|
156 table->AddRemConEventToTable(eventValue, CRemConEventTable::ERemConEvent); |
|
157 table->AddRemConEventToTable(eventValue, CRemConEventTable::ERemConExtEventCall); |
|
158 table->AddRemConEventToTable(eventValue, CRemConEventTable::ERemConExtEventPoc); |
|
159 table->AddRemConEventToTable(eventValue, CRemConEventTable::ERemConExtEventSync); |
|
160 |
|
161 // 6. Add another ERemConEvent into event table. |
|
162 // 7. Add another ERemConExtEventCall into event table. |
|
163 // 8. Add another ERemConExtEventPoc into event table. |
|
164 // 9. Add another ERemConExtEventSync into event table. |
|
165 TInt eventValue2 = 40; |
|
166 table->AddRemConEventToTable(eventValue2, CRemConEventTable::ERemConEvent); |
|
167 table->AddRemConEventToTable(eventValue2, CRemConEventTable::ERemConExtEventCall); |
|
168 table->AddRemConEventToTable(eventValue2, CRemConEventTable::ERemConExtEventPoc); |
|
169 table->AddRemConEventToTable(eventValue2, CRemConEventTable::ERemConExtEventSync); |
|
170 |
|
171 // 10. Check ERemConEvent in event table. |
|
172 // 11. Check ERemConExtEventCall in event table. |
|
173 // 12. Check ERemConExtEventPoc in event table. |
|
174 // 13. Check ERemConExtEventSync in event table. |
|
175 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(eventValue, CRemConEventTable::ERemConEvent), static_cast<TBool>(ETrue)); |
|
176 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(eventValue, CRemConEventTable::ERemConExtEventCall), static_cast<TBool>(ETrue)); |
|
177 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(eventValue, CRemConEventTable::ERemConExtEventPoc), static_cast<TBool>(ETrue)); |
|
178 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(eventValue, CRemConEventTable::ERemConExtEventSync), static_cast<TBool>(ETrue)); |
|
179 |
|
180 // 14. Check another ERemConEvent in event table. |
|
181 // 15. Check another ERemConExtEventCall in event table. |
|
182 // 16. Check another ERemConExtEventPoc in event table. |
|
183 // 17. Check another ERemConExtEventSync in event table. |
|
184 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(eventValue2, CRemConEventTable::ERemConEvent), static_cast<TBool>(ETrue)); |
|
185 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(eventValue2, CRemConEventTable::ERemConExtEventCall), static_cast<TBool>(ETrue)); |
|
186 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(eventValue2, CRemConEventTable::ERemConExtEventPoc), static_cast<TBool>(ETrue)); |
|
187 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(eventValue2, CRemConEventTable::ERemConExtEventSync), static_cast<TBool>(ETrue)); |
|
188 |
|
189 // 18. Check unadded events are not in event table. |
|
190 TInt unaddedEventValue = 39; |
|
191 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(unaddedEventValue, CRemConEventTable::ERemConEvent), static_cast<TBool>(EFalse)); |
|
192 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(unaddedEventValue, CRemConEventTable::ERemConExtEventCall), static_cast<TBool>(EFalse)); |
|
193 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(unaddedEventValue, CRemConEventTable::ERemConExtEventPoc), static_cast<TBool>(EFalse)); |
|
194 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(unaddedEventValue, CRemConEventTable::ERemConExtEventSync), static_cast<TBool>(EFalse)); |
|
195 |
|
196 CleanupStack::PopAndDestroy(); |
|
197 } |
|
198 |
|
199 /** |
|
200 * @SYMTestCaseID GAPS-ATSP-EVENTTABLE-003 |
|
201 * @SYMTestCaseDesc Add invalid remote control events into event table. Check whether invalid events exists in event table. |
|
202 * @SYMTestPriority Medium |
|
203 * @SYMTestActions 1. Add invalid remote control events into event table. |
|
204 * 2. Check whether invalid events exist in event table. |
|
205 * @SYMTestExpectedResults 1. There isn't any crash and leave. |
|
206 * 2. Invalid events are not in event table. |
|
207 * @SYMTestType Unit Test |
|
208 * @SYMCreationDate 20-07-2010 |
|
209 */ |
|
210 STIF_TESTDEFINE(GAPS-ATSP-EVENTTABLE-003) |
|
211 { |
|
212 // Construct a CRemConEventTable object with table number as 1. |
|
213 TInt tableNum = 1; |
|
214 table = CRemConEventTable::NewL(tableNum); |
|
215 CleanupStack::PushL(table); |
|
216 |
|
217 // 1. Add invalid remote control events into event table. |
|
218 TInt eventValue = 41; |
|
219 CRemConEventTable::RemConEventType invalidEventType = static_cast<CRemConEventTable::RemConEventType>(10); |
|
220 table->AddRemConEventToTable(eventValue, invalidEventType); |
|
221 |
|
222 // 2. Check whether invalid events exist in event table. |
|
223 STIF_ASSERT_EQUALS(table->IsRemConEventInTable(eventValue, invalidEventType), static_cast<TBool>(EFalse)); |
|
224 |
|
225 CleanupStack::PopAndDestroy(); |
|
226 } |
|
227 |
|
228 /** |
|
229 * @SYMTestCaseID GAPS-ATSP-EVENTTABLE-004 |
|
230 * @SYMTestCaseDesc Try to add valid rules, get rules. |
|
231 * @SYMTestPriority Medium |
|
232 * @SYMTestActions 1. Construct a CRemConEventTable object with table number as 1. |
|
233 * 2. Get rules list from event table. |
|
234 * 3. Check EActiveAudio not in the rules list. |
|
235 * 4. Check EForegroundApplication not in the rules list. |
|
236 * 5. Check EDefaultApplicationGroup not in the rules list. |
|
237 * 6. Check ELastPlayedMediaApplication not in the rules list. |
|
238 * 7. Check ELaunchDefaultApp not in the rules list. |
|
239 * 8. Add EActiveAudio into event table. |
|
240 * 9. Add EForegroundApplication into event table. |
|
241 * 10. Add EDefaultApplicationGroup into event table. |
|
242 * 11. Add ELastPlayedMediaApplication into event table. |
|
243 * 12. Add ELaunchDefaultApp event table. |
|
244 * 13. Get rules list from event table. |
|
245 * 14. Check EActiveAudio in the rules list. |
|
246 * 15. Check EForegroundApplication in the rules list. |
|
247 * 16. Check EDefaultApplicationGroup in the rules list. |
|
248 * 17. Check ELastPlayedMediaApplication in the rules list. |
|
249 * 18. Check ELaunchDefaultApp in the rules list. |
|
250 * @SYMTestExpectedResults 1. CRemConEventTable object was successfully constructed. |
|
251 * 2. Rules list was gotten. |
|
252 * 3. EActiveAudio was not in the rules list. |
|
253 * 4. EForegroundApplication was not in the rules list. |
|
254 * 5. EDefaultApplicationGroup was not in the rules list. |
|
255 * 6. ELastPlayedMediaApplication was not in the rules list. |
|
256 * 7. ELaunchDefaultApp was not in the rules list. |
|
257 * 8. An EActiveAudio was added into event table. |
|
258 * 9. An EForegroundApplication was added into event table. |
|
259 * 10. An EDefaultApplicationGroup was added into event table. |
|
260 * 11. An ELastPlayedMediaApplication was added into event table. |
|
261 * 12. An ELaunchDefaultApp was added into event table. |
|
262 * 13. Rules list was gotten. |
|
263 * 14. EActiveAudio was in the rules list. |
|
264 * 15. EForegroundApplication was in the rules list. |
|
265 * 16. EDefaultApplicationGroup was in the rules list. |
|
266 * 17. ELastPlayedMediaApplication was in the rules list. |
|
267 * 18. ELaunchDefaultApp was in the rules list. |
|
268 * @SYMTestType Unit Test |
|
269 * @SYMCreationDate 20-07-2010 |
|
270 */ |
|
271 STIF_TESTDEFINE(GAPS-ATSP-EVENTTABLE-004) |
|
272 { |
|
273 // 1. Construct a CRemConEventTable object with table number as 1. |
|
274 TInt tableNum = 1; |
|
275 table = CRemConEventTable::NewL(tableNum); |
|
276 CleanupStack::PushL(table); |
|
277 |
|
278 // 2. Get rules list from event table. |
|
279 RArray<TInt> rulesForThisTable; |
|
280 table->GetRulesForThisTable(rulesForThisTable); |
|
281 |
|
282 // 3. Check EActiveAudio not in the rules list. |
|
283 // 4. Check EForegroundApplication not in the rules list. |
|
284 // 5. Check EDefaultApplicationGroup not in the rules list. |
|
285 // 6. Check ELastPlayedMediaApplication not in the rules list. |
|
286 // 7. Check ELaunchDefaultApp not in the rules list. |
|
287 STIF_ASSERT_EQUALS(rulesForThisTable.Find(CRemConEventTable::EActiveAudio), KErrNotFound); |
|
288 STIF_ASSERT_EQUALS(rulesForThisTable.Find(CRemConEventTable::EForegroundApplication), KErrNotFound); |
|
289 STIF_ASSERT_EQUALS(rulesForThisTable.Find(CRemConEventTable::EDefaultApplicationGroup), KErrNotFound); |
|
290 STIF_ASSERT_EQUALS(rulesForThisTable.Find(CRemConEventTable::ELastPlayedMediaApplication), KErrNotFound); |
|
291 STIF_ASSERT_EQUALS(rulesForThisTable.Find(CRemConEventTable::ELaunchDefaultApp), KErrNotFound); |
|
292 |
|
293 // 8. Add EActiveAudio into event table. |
|
294 // 9. Add EForegroundApplication into event table. |
|
295 // 10. Add EDefaultApplicationGroup into event table. |
|
296 // 11. Add ELastPlayedMediaApplication into event table. |
|
297 // 12. Add ELaunchDefaultApp event table. |
|
298 table->AddRuleForThisTable(CRemConEventTable::EActiveAudio); |
|
299 table->AddRuleForThisTable(CRemConEventTable::EForegroundApplication); |
|
300 table->AddRuleForThisTable(CRemConEventTable::EDefaultApplicationGroup); |
|
301 table->AddRuleForThisTable(CRemConEventTable::ELastPlayedMediaApplication); |
|
302 table->AddRuleForThisTable(CRemConEventTable::ELaunchDefaultApp); |
|
303 |
|
304 // 13. Get rules list from event table. |
|
305 rulesForThisTable.Reset(); |
|
306 table->GetRulesForThisTable(rulesForThisTable); |
|
307 |
|
308 // 14. Check EActiveAudio in the rules list. |
|
309 // 15. Check EForegroundApplication in the rules list. |
|
310 // 16. Check EDefaultApplicationGroup in the rules list. |
|
311 // 17. Check ELastPlayedMediaApplication in the rules list. |
|
312 // 18. Check ELaunchDefaultApp in the rules list. |
|
313 STIF_ASSERT_NOT_EQUALS(rulesForThisTable.Find(CRemConEventTable::EActiveAudio), KErrNotFound); |
|
314 STIF_ASSERT_NOT_EQUALS(rulesForThisTable.Find(CRemConEventTable::EForegroundApplication), KErrNotFound); |
|
315 STIF_ASSERT_NOT_EQUALS(rulesForThisTable.Find(CRemConEventTable::EDefaultApplicationGroup), KErrNotFound); |
|
316 STIF_ASSERT_NOT_EQUALS(rulesForThisTable.Find(CRemConEventTable::ELastPlayedMediaApplication), KErrNotFound); |
|
317 STIF_ASSERT_NOT_EQUALS(rulesForThisTable.Find(CRemConEventTable::ELaunchDefaultApp), KErrNotFound); |
|
318 |
|
319 CleanupStack::PopAndDestroy(); |
|
320 } |
|
321 |
|
322 /** |
|
323 * @SYMTestCaseID GAPS-ATSP-EVENTTABLE-005 |
|
324 * @SYMTestCaseDesc Try to add default application, get default application. |
|
325 * @SYMTestPriority Medium |
|
326 * @SYMTestActions 1. Construct a CRemConEventTable object with table number as 1. |
|
327 * 2. Get default application list from event table. |
|
328 * 3. Check the default application info not in the rules list. |
|
329 * 4. Add a default application into event table. |
|
330 * 5. Get default application list from event table. |
|
331 * 6. Check default application info is right in the rules list. |
|
332 * @SYMTestExpectedResults 1. CRemConEventTable object was successfully constructed. |
|
333 * 2. Default application list was gotten. |
|
334 * 3. The default application info was not in the rules list. |
|
335 * 4. A default application was added into event table. |
|
336 * 5. Default application list was gotten. |
|
337 * 6. The default application info in the list is right. |
|
338 * @SYMTestType Unit Test |
|
339 * @SYMCreationDate 20-07-2010 |
|
340 */ |
|
341 STIF_TESTDEFINE(GAPS-ATSP-EVENTTABLE-005) |
|
342 { |
|
343 // 1. Construct a CRemConEventTable object with table number as 1. |
|
344 TInt tableNum = 1; |
|
345 table = CRemConEventTable::NewL(tableNum); |
|
346 CleanupStack::PushL(table); |
|
347 |
|
348 TInt defaultApplication = 0x100058B3; |
|
349 |
|
350 // 2. Get default application list from event table. |
|
351 RArray<TInt> defaultApplicationsForThisTable; |
|
352 table->GetDefaultApplicationsForTable(defaultApplicationsForThisTable); |
|
353 |
|
354 // 3. Check the default application info not in the rules list. |
|
355 STIF_ASSERT_EQUALS(defaultApplicationsForThisTable.Find(defaultApplication), KErrNotFound); |
|
356 |
|
357 // 4. Add a default application into event table. |
|
358 table->AddDefaultApplicationForThisTable(defaultApplication); |
|
359 |
|
360 // 5. Get default application list from event table. |
|
361 defaultApplicationsForThisTable.Reset(); |
|
362 table->GetDefaultApplicationsForTable(defaultApplicationsForThisTable); |
|
363 |
|
364 // 6. Check default application info is right in the rules list. |
|
365 STIF_ASSERT_NOT_EQUALS(defaultApplicationsForThisTable.Find(defaultApplication), KErrNotFound); |
|
366 |
|
367 CleanupStack::PopAndDestroy(); |
|
368 } |
|
369 |
|
370 |
|
371 /** |
|
372 * @SYMTestCaseID GAPS-ATSP-EVENTTABLE-006 |
|
373 * @SYMTestCaseDesc Try to add default launch application, get the default launch application. |
|
374 * @SYMTestPriority Medium |
|
375 * @SYMTestActions 1. Construct a CRemConEventTable object with table number as 1. |
|
376 * 2. Add a default launch application into event table. |
|
377 * 3. Get default launch application from event table. |
|
378 * @SYMTestExpectedResults 1. CRemConEventTable object was successfully constructed. |
|
379 * 2. The default launch application was set into event table. |
|
380 * 3. The default launch application uid is right. |
|
381 * @SYMTestType Unit Test |
|
382 * @SYMCreationDate 20-07-2010 |
|
383 */ |
|
384 STIF_TESTDEFINE(GAPS-ATSP-EVENTTABLE-006) |
|
385 { |
|
386 // 1. Construct a CRemConEventTable object with table number as 1. |
|
387 TInt tableNum = 1; |
|
388 table = CRemConEventTable::NewL(tableNum); |
|
389 CleanupStack::PushL(table); |
|
390 |
|
391 TInt32 defaultLaunchApplication = 0x100058B3; |
|
392 // 2. Add a default launch application into event table. |
|
393 table->AddDefaultLaunchAppForThisTable(defaultLaunchApplication); |
|
394 |
|
395 // 3. Get default launch application from event table. |
|
396 TUid retUid; |
|
397 table->GetDefaultLaunchAppForTable(retUid); |
|
398 STIF_ASSERT_EQUALS(retUid.iUid, defaultLaunchApplication); |
|
399 |
|
400 CleanupStack::PopAndDestroy(); |
|
401 } |
|
402 |
|
403 /** |
|
404 * @SYMTestCaseID GAPS-ATSP-EVENTTABLE-007 |
|
405 * @SYMTestCaseDesc Try to add transparent application, get the transparent application. |
|
406 * @SYMTestPriority Medium |
|
407 * @SYMTestActions 1. Construct a CRemConEventTable object with table number as 1. |
|
408 * 2. Add a transparent application into event table. |
|
409 * 3. Get transparent application list from event table. |
|
410 * 4. Check transparent application info is right in the list. |
|
411 * 5. Check unadded transparent application info is not in the list. |
|
412 * @SYMTestExpectedResults 1. CRemConEventTable object was successfully constructed. |
|
413 * 2. A transparent application was added into event table. |
|
414 * 3. Transparent application list was gotten. |
|
415 * 4. The transparent application info in the list is right. |
|
416 * 5. Unadded transparent application info is not in the list. |
|
417 * @SYMTestType Unit Test |
|
418 * @SYMCreationDate 20-07-2010 |
|
419 */ |
|
420 STIF_TESTDEFINE(GAPS-ATSP-EVENTTABLE-007) |
|
421 { |
|
422 // 1. Construct a CRemConEventTable object with table number as 1. |
|
423 TInt tableNum = 1; |
|
424 table = CRemConEventTable::NewL(tableNum); |
|
425 CleanupStack::PushL(table); |
|
426 |
|
427 TInt transparentApplication = 0x100058B3; |
|
428 TInt unaddedApplication = 0x100058B4; |
|
429 // 2. Add a transparent application into event table. |
|
430 table->AddTransparentApplicationForThisTable(transparentApplication); |
|
431 |
|
432 // 3. Get transparent application list from event table. |
|
433 RArray<TInt> transparentApplicationsForThisTable; |
|
434 table->GetTransparentApplicationsForTable(transparentApplicationsForThisTable); |
|
435 |
|
436 // 4. Check transparent application info is right in the list. |
|
437 STIF_ASSERT_NOT_EQUALS(transparentApplicationsForThisTable.Find(transparentApplication), KErrNotFound); |
|
438 |
|
439 // 5. Check unadded transparent application info is not in the list. |
|
440 STIF_ASSERT_EQUALS(transparentApplicationsForThisTable.Find(unaddedApplication), KErrNotFound); |
|
441 |
|
442 CleanupStack::PopAndDestroy(); |
|
443 } |
|
444 |
|
445 /** |
|
446 * @SYMTestCaseID GAPS-ATSP-IDLELISTENER-001 |
|
447 * @SYMTestCaseDesc Create CRemConIdleListener with mock CRemConTspController. CreateAfterIdleL no error. |
|
448 * @SYMTestPriority Medium |
|
449 * @SYMTestActions 1. Construct a CRemConIdleListener object with mock CRemConTspController. |
|
450 * 2. CRemConIdleListener::CreateAfterIdleL returned with no error. |
|
451 * 3. Destruct CRemConIdleListener object. |
|
452 * @SYMTestExpectedResults 1. A CRemConIdleListener object was constructed with mock CRemConTspController. |
|
453 * 2. CRemConIdleListener::CreateAfterIdleL returned with no error. |
|
454 * 3. The CRemConIdleListener object was destructed. |
|
455 * @SYMTestType Unit Test |
|
456 * @SYMCreationDate 20-07-2010 |
|
457 */ |
|
458 STIF_TESTDEFINE(GAPS-ATSP-IDLELISTENER-001) |
|
459 { |
|
460 CRemConTspController* tspController = CRemConTspController::NewL(ECorrect); |
|
461 |
|
462 delete tspController; |
|
463 } |
|
464 |
|
465 /** |
|
466 * @SYMTestCaseID GAPS-ATSP-IDLELISTENER-002 |
|
467 * @SYMTestCaseDesc Create CRemConIdleListener with mock CRemConTspController. CreateAfterIdleL leaves with deleteInd not changed. |
|
468 * @SYMTestPriority Medium |
|
469 * @SYMTestActions 1. Construct a CRemConIdleListener object with mock CRemConTspController. |
|
470 * 2. CRemConIdleListener::CreateAfterIdleL leaved with deleteInd not changed. |
|
471 * 3. Destruct CRemConIdleListener object. |
|
472 * @SYMTestExpectedResults 1. A CRemConIdleListener object was constructed with mock CRemConTspController. |
|
473 * 2. CRemConIdleListener::CreateAfterIdleL leaved with deleteInd not changed. |
|
474 * 3. The CRemConIdleListener object was destructed. |
|
475 * @SYMTestType Unit Test |
|
476 * @SYMCreationDate 20-07-2010 |
|
477 */ |
|
478 STIF_TESTDEFINE(GAPS-ATSP-IDLELISTENER-002) |
|
479 { |
|
480 CRemConTspController* tspController = CRemConTspController::NewL(ELeaveNoChange); |
|
481 |
|
482 delete tspController; |
|
483 } |
|
484 |
|
485 /** |
|
486 * @SYMTestCaseID GAPS-ATSP-IDLELISTENER-003 |
|
487 * @SYMTestCaseDesc Create CRemConIdleListener with mock CRemConTspController. CreateAfterIdleL leaves with deleteInd changed to ETrue. |
|
488 * @SYMTestPriority Medium |
|
489 * @SYMTestActions 1. Construct a CRemConIdleListener object with mock CRemConTspController. |
|
490 * 2. CRemConIdleListener::CreateAfterIdleL leaved with deleteInd changed to ETrue. |
|
491 * 3. Destruct CRemConIdleListener object. |
|
492 * @SYMTestExpectedResults 1. A CRemConIdleListener object was constructed with mock CRemConTspController. |
|
493 * 2. CRemConIdleListener::CreateAfterIdleL leaved with deleteInd changed to ETrue. |
|
494 * 3. The CRemConIdleListener object was destructed. |
|
495 * @SYMTestType Unit Test |
|
496 * @SYMCreationDate 20-07-2010 |
|
497 */ |
|
498 STIF_TESTDEFINE(GAPS-ATSP-IDLELISTENER-003) |
|
499 { |
|
500 CRemConTspController* tspController = CRemConTspController::NewL(ELeaveChange); |
|
501 |
|
502 delete tspController; |
|
503 } |
|
504 |
|
505 /** |
|
506 * @SYMTestCaseID GAPS-ATSP-TSPEVENTS-001 |
|
507 * @SYMTestCaseDesc Create CTspTriggerEventsWatcher and all observers |
|
508 * @SYMTestPriority Medium |
|
509 * @SYMTestActions 1. Call CTspTriggerEventsWatcher::NewL() function |
|
510 * 2. Delete the created object |
|
511 * @SYMTestExpectedResults 1. Function returns a CTspTriggerEventsWatcher* pointer. All its members |
|
512 * (iAudioClientObserver; iWsEventsObserver; iClientMapperObserver;)are also created. |
|
513 * 2. The object is deleted, and no memory leak |
|
514 * @SYMTestType Unit Test |
|
515 * @SYMCreationDate 20-07-2010 |
|
516 */ |
|
517 STIF_TESTDEFINE(GAPS-ATSP-TSPEVENTS-001) |
|
518 { |
|
519 TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksHandles); |
|
520 tspstub = CUt_AtspTspEventsStub::NewL(); |
|
521 CleanupStack::PushL(tspstub); |
|
522 watcher = CTspTriggerEventsWatcher::NewL(*tspstub); |
|
523 CleanupStack::PushL(watcher); |
|
524 |
|
525 STIF_ASSERT_NOT_NULL(tspstub); |
|
526 STIF_ASSERT_NOT_NULL(watcher); |
|
527 STIF_LOG("CTspTriggerEventsWatcher created successfully"); |
|
528 |
|
529 CleanupStack::PopAndDestroy(2); |
|
530 } |
|
531 |
|
532 /** |
|
533 * @SYMTestCaseID GAPS-ATSP-TSPEVENTS-002 |
|
534 * @SYMTestCaseDesc Event which CTspClientMapperObserver watch is triggered |
|
535 * @SYMTestPriority Medium |
|
536 * @SYMTestActions 1. Create CTspClientMapperObserver object with parameter a pointer to a MTspRulesTriggerObserver type interface |
|
537 * 2. Trigger a Property change which has property category equals to 0x10200C70 |
|
538 * 3. Delete the created object |
|
539 * @SYMTestExpectedResults 1. Object created |
|
540 * 2. MTspRulesTriggerObserver::MtrtoEvaluateRoutingRules() is called by the object |
|
541 * 3. Object deleted |
|
542 * @SYMTestType Unit Test |
|
543 * @SYMCreationDate 20-07-2010 |
|
544 */ |
|
545 STIF_TESTDEFINE(GAPS-ATSP-TSPEVENTS-002) |
|
546 { |
|
547 TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksHandles); |
|
548 tspstub = CUt_AtspTspEventsStub::NewL(); |
|
549 CleanupStack::PushL(tspstub); |
|
550 watcher = CTspTriggerEventsWatcher::NewL(*tspstub); |
|
551 CleanupStack::PushL(watcher); |
|
552 |
|
553 STIF_ASSERT_NOT_NULL(tspstub); |
|
554 STIF_ASSERT_NOT_NULL(watcher); |
|
555 STIF_LOG("CTspTriggerEventsWatcher created successfully"); |
|
556 |
|
557 tspstub->After(TTimeIntervalMicroSeconds32(KDefaultWaitTimeInMicroSeconds)); |
|
558 tspstub->IssueTspPropertyL(); |
|
559 CActiveScheduler::Start(); |
|
560 |
|
561 STIF_ASSERT_TRUE(tspstub->iIsRunLCalled); |
|
562 STIF_ASSERT_FALSE(tspstub->iIsTimerElapsed); |
|
563 STIF_LOG("Trigger of tsp client mapper is as expected"); |
|
564 |
|
565 CleanupStack::PopAndDestroy(2); |
|
566 } |
|
567 |
|
568 /** |
|
569 * @SYMTestCaseID GAPS-ATSP-TSPEVENTS-003 |
|
570 * @SYMTestCaseDesc Event which CWsEventsObserver watch is triggered |
|
571 * @SYMTestPriority Medium |
|
572 * @SYMTestActions 1. Create CWsEventsObserver object with parameter a pointer to a MTspRulesTriggerObserver type interface |
|
573 * 2. Trigger a window server event with type of EEventWindowGroupListChanged |
|
574 * 3. Delete the created object |
|
575 * @SYMTestExpectedResults 1. Object created |
|
576 * 2. MTspRulesTriggerObserver::MtrtoEvaluateRoutingRules() is called by the object |
|
577 * 3. Object deleted |
|
578 * @SYMTestType Unit Test |
|
579 * @SYMCreationDate 20-07-2010 |
|
580 */ |
|
581 STIF_TESTDEFINE(GAPS-ATSP-TSPEVENTS-003) |
|
582 { |
|
583 TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksHandles); |
|
584 tspstub = CUt_AtspTspEventsStub::NewL(); |
|
585 CleanupStack::PushL(tspstub); |
|
586 watcher = CTspTriggerEventsWatcher::NewL(*tspstub); |
|
587 CleanupStack::PushL(watcher); |
|
588 |
|
589 STIF_ASSERT_NOT_NULL(tspstub); |
|
590 STIF_ASSERT_NOT_NULL(watcher); |
|
591 STIF_LOG("CTspTriggerEventsWatcher created successfully"); |
|
592 |
|
593 tspstub->After(TTimeIntervalMicroSeconds32(KDefaultWaitTimeInMicroSeconds)); |
|
594 tspstub->IssueWsEventL(EEventWindowGroupListChanged); |
|
595 CActiveScheduler::Start(); |
|
596 |
|
597 STIF_ASSERT_TRUE(tspstub->iIsRunLCalled); |
|
598 STIF_ASSERT_FALSE(tspstub->iIsTimerElapsed); |
|
599 STIF_LOG("Trigger of ws event is as expected"); |
|
600 |
|
601 CleanupStack::PopAndDestroy(2); |
|
602 } |
|
603 |
|
604 /** |
|
605 * @SYMTestCaseID GAPS-ATSP-TSPEVENTS-004 |
|
606 * @SYMTestCaseDesc Event which CWsEventsObserver watch is triggered, but not interested type |
|
607 * @SYMTestPriority Medium |
|
608 * @SYMTestActions 1. Create CWsEventsObserver object with parameter a pointer to a MTspRulesTriggerObserver type interface |
|
609 * 2. Trigger a window server event which type is not EEventWindowGroupListChanged |
|
610 * 3. Delete the created object |
|
611 * @SYMTestExpectedResults 1. Object created |
|
612 * 2. RunL of CWsEventsObserver is called, but MTspRulesTriggerObserver::MtrtoEvaluateRoutingRules() is not called by the object |
|
613 * 3. Object deleted |
|
614 * @SYMTestType Unit Test |
|
615 * @SYMCreationDate 20-07-2010 |
|
616 */ |
|
617 STIF_TESTDEFINE(GAPS-ATSP-TSPEVENTS-004) |
|
618 { |
|
619 TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksHandles); |
|
620 tspstub = CUt_AtspTspEventsStub::NewL(); |
|
621 CleanupStack::PushL(tspstub); |
|
622 watcher = CTspTriggerEventsWatcher::NewL(*tspstub); |
|
623 CleanupStack::PushL(watcher); |
|
624 |
|
625 STIF_ASSERT_NOT_NULL(tspstub); |
|
626 STIF_ASSERT_NOT_NULL(watcher); |
|
627 STIF_LOG("CTspTriggerEventsWatcher created successfully"); |
|
628 |
|
629 tspstub->After(TTimeIntervalMicroSeconds32(KDefaultWaitTimeInMicroSeconds)); |
|
630 tspstub->IssueWsEventL(EEventWindowVisibilityChanged); |
|
631 CActiveScheduler::Start(); |
|
632 |
|
633 STIF_ASSERT_FALSE(tspstub->iIsRunLCalled); |
|
634 STIF_ASSERT_TRUE(tspstub->iIsTimerElapsed); |
|
635 STIF_LOG("Trigger of not cared ws event is as expected"); |
|
636 |
|
637 CleanupStack::PopAndDestroy(2); |
|
638 } |
|
639 |
|
640 /** |
|
641 * @SYMTestCaseID GAPS-ATSP-TSPEVENTS-005 |
|
642 * @SYMTestCaseDesc Event which CActiveAudioClientObserver watch is triggered |
|
643 * @SYMTestPriority Medium |
|
644 * @SYMTestActions 1. Create CActiveAudioClientObserver object with parameter a pointer to a MTspRulesTriggerObserver type interface |
|
645 * 2. Trigger a Property change which has property category equals to 0x101F457f |
|
646 * 3. Delete the created object |
|
647 * @SYMTestExpectedResults 1. Object created |
|
648 * 2. MTspRulesTriggerObserver::MtrtoEvaluateRoutingRules() is called by the object |
|
649 * 3. Object deleted |
|
650 * @SYMTestType Unit Test |
|
651 * @SYMCreationDate 20-07-2010 |
|
652 */ |
|
653 STIF_TESTDEFINE(GAPS-ATSP-TSPEVENTS-005) |
|
654 { |
|
655 TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksHandles); |
|
656 tspstub = CUt_AtspTspEventsStub::NewL(); |
|
657 CleanupStack::PushL(tspstub); |
|
658 CActiveAudioClientObserver* audioObserver = CActiveAudioClientObserver::NewL(*tspstub); |
|
659 CleanupStack::PushL(audioObserver); |
|
660 |
|
661 STIF_ASSERT_NOT_NULL(tspstub); |
|
662 STIF_ASSERT_NOT_NULL(watcher); |
|
663 STIF_LOG("CTspTriggerEventsWatcher created successfully"); |
|
664 |
|
665 tspstub->After(TTimeIntervalMicroSeconds32(KDefaultWaitTimeInMicroSeconds)); |
|
666 tspstub->IssueAudioPropertyL(); |
|
667 CActiveScheduler::Start(); |
|
668 |
|
669 STIF_ASSERT_TRUE(tspstub->iIsRunLCalled); |
|
670 STIF_ASSERT_FALSE(tspstub->iIsTimerElapsed); |
|
671 STIF_LOG("Trigger of audio client mapper is as expected"); |
|
672 |
|
673 CleanupStack::PopAndDestroy(2); |
|
674 } |
|
675 |
|
676 #endif |
|
677 /** |
|
678 * END OF TEST CASES SECTION |
|
679 */ |
|
680 |
|
681 // End of File |