|
1 /* |
|
2 * Copyright (c) 2002 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 // CLASS HEADER |
|
20 #include "MT_CFSisUpgrade.h" |
|
21 |
|
22 // EXTERNAL INCLUDES |
|
23 #include <EUnitMacros.h> |
|
24 #include <EUnitDecorators.h> |
|
25 #include <bautils.h> |
|
26 #include <ecom/ecom.h> |
|
27 #include <cfclient.h> |
|
28 #include <cfcontextobject.h> |
|
29 #include <cfcontextquery.h> |
|
30 #include <e32property.h> |
|
31 #include <cfcontextsubscription.h> |
|
32 #include <cfcontextindication.h> |
|
33 #include <cfactionindication.h> |
|
34 #include <cfactionsubscription.h> |
|
35 |
|
36 // INTERNAL INCLUDES |
|
37 #include "cftestdelay.h" |
|
38 #include "cleanupresetanddestroy.h" |
|
39 #include "contextsource_v1.hrh" |
|
40 #include "action_v1.hrh" |
|
41 #include "action_v2.hrh" |
|
42 #include "actiondef_v1.h" |
|
43 #include "actiondef_v2.h" |
|
44 #include "operation_v1.hrh" |
|
45 #include "cfenvutils.h" |
|
46 |
|
47 // CONSTANTS |
|
48 const TInt KSecond = 1000000; |
|
49 |
|
50 // CONSTRUCTION |
|
51 MT_CFSisUpgrade* MT_CFSisUpgrade::NewL() |
|
52 { |
|
53 MT_CFSisUpgrade* self = MT_CFSisUpgrade::NewLC(); |
|
54 CleanupStack::Pop(); |
|
55 |
|
56 return self; |
|
57 } |
|
58 |
|
59 MT_CFSisUpgrade* MT_CFSisUpgrade::NewLC() |
|
60 { |
|
61 MT_CFSisUpgrade* self = new( ELeave ) MT_CFSisUpgrade(); |
|
62 CleanupStack::PushL( self ); |
|
63 |
|
64 self->ConstructL(); |
|
65 |
|
66 return self; |
|
67 } |
|
68 |
|
69 // Destructor (virtual by CBase) |
|
70 MT_CFSisUpgrade::~MT_CFSisUpgrade() |
|
71 { |
|
72 // Disable screen saver |
|
73 CFEnvUtils::EnableScreenSaver( ETrue ); |
|
74 } |
|
75 |
|
76 // Default constructor |
|
77 MT_CFSisUpgrade::MT_CFSisUpgrade() |
|
78 { |
|
79 } |
|
80 |
|
81 // Second phase construct |
|
82 void MT_CFSisUpgrade::ConstructL() |
|
83 { |
|
84 // The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
85 // It generates the test case table. |
|
86 CEUnitTestSuiteClass::ConstructL(); |
|
87 |
|
88 // Disable screen saver |
|
89 CFEnvUtils::EnableScreenSaver( EFalse ); |
|
90 } |
|
91 |
|
92 // METHODS |
|
93 |
|
94 void MT_CFSisUpgrade::ContextIndicationL( |
|
95 const CCFContextIndication& aChangedContext ) |
|
96 { |
|
97 const CCFContextObject& co = aChangedContext.Context(); |
|
98 iCo->SetSourceL( co.Source() ); |
|
99 iCo->SetTypeL( co.Type() ); |
|
100 iCo->SetValueL( co.Value() ); |
|
101 iContextIndication = ETrue; |
|
102 } |
|
103 |
|
104 |
|
105 void MT_CFSisUpgrade::ActionIndicationL( |
|
106 const CCFActionIndication& aActionToExecute ) |
|
107 { |
|
108 iActionId = aActionToExecute.Identifier(); |
|
109 iActionIndication = ETrue; |
|
110 } |
|
111 |
|
112 |
|
113 void MT_CFSisUpgrade::HandleContextFrameworkError( TCFError /*aError*/, |
|
114 const TDesC& /*aSource*/, |
|
115 const TDesC& /*aType */) |
|
116 { |
|
117 |
|
118 } |
|
119 |
|
120 |
|
121 TAny* MT_CFSisUpgrade::Extension( const TUid& aExtensionUid ) const |
|
122 { |
|
123 TAny* extension = NULL; |
|
124 if( aExtensionUid == KCFScriptOwnerInterfaceUid ) |
|
125 { |
|
126 MCFScriptOwnerInterface* interface = (MCFScriptOwnerInterface*)this; |
|
127 extension = interface; |
|
128 } |
|
129 return extension; |
|
130 } |
|
131 |
|
132 |
|
133 void MT_CFSisUpgrade::HandleScriptsRemovedL( const RArray<TInt>& aScriptIds ) |
|
134 { |
|
135 iScriptsRemovedNotified = ETrue; |
|
136 for( TInt i = 0; i < aScriptIds.Count(); i++ ) |
|
137 { |
|
138 iScriptIds.AppendL( aScriptIds[i] ); |
|
139 } |
|
140 } |
|
141 |
|
142 |
|
143 void MT_CFSisUpgrade::SetupL( ) |
|
144 { |
|
145 iDelay = CCFTestDelay::NewL(); |
|
146 |
|
147 User::LeaveIfError( iFs.Connect() ); |
|
148 |
|
149 User::LeaveIfError( iSwInst.Connect() ); |
|
150 |
|
151 iCFClient = CCFClient::NewL( *this ); |
|
152 |
|
153 iCo = CCFContextObject::NewL(); |
|
154 |
|
155 iContextIndication = EFalse; |
|
156 |
|
157 iActionIndication = EFalse; |
|
158 |
|
159 iActionId.Zero(); |
|
160 } |
|
161 |
|
162 |
|
163 void MT_CFSisUpgrade::Teardown( ) |
|
164 { |
|
165 iDelay->Start( KSecond * 1 ); |
|
166 |
|
167 iScriptIds.Close(); |
|
168 |
|
169 delete iCo; |
|
170 iCo = NULL; |
|
171 |
|
172 delete iCFClient; |
|
173 iCFClient = NULL; |
|
174 |
|
175 iSwInst.Close(); |
|
176 |
|
177 iDelay->Start( KSecond * 1 ); // SwInstApp server closing takes some time. |
|
178 |
|
179 iFs.Close(); |
|
180 |
|
181 delete iDelay; |
|
182 iDelay = NULL; |
|
183 } |
|
184 |
|
185 |
|
186 void MT_CFSisUpgrade::SetInstallOptions( SwiUI::TInstallOptionsPckg& aOptions ) |
|
187 { |
|
188 aOptions().iUpgrade = SwiUI::EPolicyAllowed; |
|
189 aOptions().iOCSP = SwiUI::EPolicyAllowed; |
|
190 aOptions().iIgnoreOCSPWarnings = SwiUI::EPolicyAllowed; |
|
191 aOptions().iUntrusted = SwiUI::EPolicyAllowed; |
|
192 aOptions().iPackageInfo = SwiUI::EPolicyAllowed; |
|
193 aOptions().iCapabilities = SwiUI::EPolicyAllowed; |
|
194 aOptions().iKillApp = SwiUI::EPolicyAllowed; |
|
195 aOptions().iOverwrite = SwiUI::EPolicyAllowed; |
|
196 aOptions().iDrive = 'c'; |
|
197 aOptions().iUsePhoneLang = ETrue; |
|
198 aOptions().iUpgradeData = SwiUI::EPolicyAllowed; |
|
199 } |
|
200 |
|
201 |
|
202 void MT_CFSisUpgrade::ResetContextObjectL() |
|
203 { |
|
204 iContextIndication = EFalse; |
|
205 iCo->SetSourceL( KNullDesC ); |
|
206 iCo->SetTypeL( KNullDesC ); |
|
207 iCo->SetValueL( KNullDesC ); |
|
208 } |
|
209 |
|
210 |
|
211 void MT_CFSisUpgrade::ResetActionL() |
|
212 { |
|
213 iActionIndication = EFalse; |
|
214 iActionId.Zero(); |
|
215 } |
|
216 |
|
217 |
|
218 void MT_CFSisUpgrade::ResetScriptsRemovedL() |
|
219 { |
|
220 iScriptsRemovedNotified = EFalse; |
|
221 iScriptIds.Reset(); |
|
222 } |
|
223 |
|
224 |
|
225 void MT_CFSisUpgrade::MT_CFSisUpgrade_InstallCfSisUpgrade1L( ) |
|
226 { |
|
227 _LIT( KSisPath, "z:\\data\\cftestdata\\testsis\\contextsource_v1\\contextsource.sisx" ); |
|
228 |
|
229 CCFContextObject* co = CCFContextObject::NewLC(); |
|
230 |
|
231 // x. Preconditions |
|
232 // ------------------------------------------------------------------------- |
|
233 TBool exists = BaflUtils::FileExists( iFs, KSisPath ); |
|
234 EUNIT_ASSERT_DESC( exists, "Context upgrade V1 not found" ); |
|
235 |
|
236 // x. Install context source v1 sis file |
|
237 // ------------------------------------------------------------------------- |
|
238 SwiUI::TInstallOptionsPckg instOptionsPckg; |
|
239 SetInstallOptions( instOptionsPckg ); |
|
240 TInt err = iSwInst.SilentInstall( KSisPath, instOptionsPckg ); |
|
241 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
242 |
|
243 // Wait for few seconds to make sure that installation has completed |
|
244 iDelay->Start( KSecond * 2 ); |
|
245 |
|
246 // Check that context source v1 has been installed |
|
247 CCFContextQuery* coQuery = CCFContextQuery::NewLC(); |
|
248 RContextObjectArray array; |
|
249 CleanupResetAndDestroyPushL( array ); |
|
250 |
|
251 coQuery->SetSourceL( KContextSource_V1_Source ); |
|
252 coQuery->SetTypeL( KContextSource_V1_Type ); |
|
253 err = iCFClient->RequestContext( *coQuery, array ); |
|
254 EUNIT_PRINT( _L("RequestContext: err = %d"), err ); |
|
255 EUNIT_ASSERT_DESC( err == KErrNone, "Request context failed" ); |
|
256 EUNIT_ASSERT_DESC( array.Count() > 0, "Invalid number of contexts" ); |
|
257 |
|
258 CCFContextObject* requestCo = array[0]; |
|
259 EUNIT_PRINT( _L("RequestContext: [%S], [%S], [%S]"), |
|
260 &requestCo->Source(), &requestCo->Type(), &requestCo->Value() ); |
|
261 |
|
262 EUNIT_ASSERT_DESC( requestCo->Source() == KContextSource_V1_Source, |
|
263 "Invalid source" ); |
|
264 EUNIT_ASSERT_DESC( requestCo->Type() == KContextSource_V1_Type, |
|
265 "Invalid type" ); |
|
266 EUNIT_ASSERT_DESC( requestCo->Value() == TPtrC( |
|
267 KContextSource_V1_Type_Values[EContextSource_V1_ValueYes] ), |
|
268 "Invalid value" ); |
|
269 |
|
270 CleanupStack::PopAndDestroy( &array ); |
|
271 CleanupStack::PopAndDestroy( coQuery ); |
|
272 |
|
273 // x. Uninstall context source v1 sis file |
|
274 // ------------------------------------------------------------------------- |
|
275 SwiUI::TUninstallOptionsPckg uninstOptionsPckg; |
|
276 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
277 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
278 err = iSwInst.SilentUninstall( TUid::Uid( KContextSource_V1DllUid ), |
|
279 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
280 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
281 |
|
282 // For some reason uninstall fails when done for the first time |
|
283 // Binaries are cleared though... |
|
284 EUNIT_ASSERT_DESC( err == KErrNone || err == SwiUI::KSWInstErrAccessDenied, |
|
285 "Silent uninstall failed" ); |
|
286 |
|
287 // Wait for few seconds to make sure that installation has completed |
|
288 iDelay->Start( KSecond * 2 ); |
|
289 |
|
290 // Check that context source v1 has been installed |
|
291 coQuery = CCFContextQuery::NewLC(); |
|
292 CleanupResetAndDestroyPushL( array ); |
|
293 |
|
294 coQuery->SetSourceL( KContextSource_V1_Source ); |
|
295 coQuery->SetTypeL( KContextSource_V1_Type ); |
|
296 err = iCFClient->RequestContext( *coQuery, array ); |
|
297 EUNIT_PRINT( _L("RequestContext: err = %d"), err ); |
|
298 EUNIT_ASSERT_DESC( err == KErrNone, "Request context failed" ); |
|
299 EUNIT_ASSERT_DESC( array.Count() > 0, "Invalid number of contexts" ); |
|
300 |
|
301 requestCo = array[0]; |
|
302 EUNIT_PRINT( _L("RequestContext: [%S], [%S], [%S]"), |
|
303 &requestCo->Source(), &requestCo->Type(), &requestCo->Value() ); |
|
304 |
|
305 EUNIT_ASSERT_DESC( requestCo->Source() == KContextSource_V1_Source, |
|
306 "Invalid source" ); |
|
307 EUNIT_ASSERT_DESC( requestCo->Type() == KContextSource_V1_Type, |
|
308 "Invalid type" ); |
|
309 EUNIT_ASSERT_DESC( requestCo->Value() == TPtrC( |
|
310 KContextSource_V1_Type_Values[EContextSource_V1_ValueNo] ), |
|
311 "Invalid value" ); |
|
312 |
|
313 CleanupStack::PopAndDestroy( &array ); |
|
314 CleanupStack::PopAndDestroy( coQuery ); |
|
315 |
|
316 // x. Clean up |
|
317 // ------------------------------------------------------------------------- |
|
318 CleanupStack::PopAndDestroy( co ); |
|
319 } |
|
320 |
|
321 |
|
322 void MT_CFSisUpgrade::MT_CFSisUpgrade_InstallCfSisUpgrade2L( ) |
|
323 { |
|
324 _LIT( KSisPath, "z:\\data\\cftestdata\\testsis\\contextsource_v1\\contextsource.sisx" ); |
|
325 |
|
326 CCFContextSubscription* subscript = CCFContextSubscription::NewLC(); |
|
327 subscript->SetContextSourceL( KContextSource_V1_Source ); |
|
328 subscript->SetContextTypeL( KContextSource_V1_Type ); |
|
329 |
|
330 // x. Preconditions |
|
331 // ------------------------------------------------------------------------- |
|
332 TBool exists = BaflUtils::FileExists( iFs, KSisPath ); |
|
333 EUNIT_ASSERT_DESC( exists, "Context upgrade V1 not found" ); |
|
334 |
|
335 // x. Install context source v1 sis file and subscribe context |
|
336 // ------------------------------------------------------------------------- |
|
337 SwiUI::TInstallOptionsPckg instOptionsPckg; |
|
338 SetInstallOptions( instOptionsPckg ); |
|
339 TInt err = iSwInst.SilentInstall( KSisPath, instOptionsPckg ); |
|
340 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
341 |
|
342 // Wait for few seconds to make sure that installation has completed |
|
343 iDelay->Start( KSecond * 2 ); |
|
344 |
|
345 // Check that context source v1 has been installed |
|
346 CCFContextQuery* coQuery = CCFContextQuery::NewLC(); |
|
347 RContextObjectArray array; |
|
348 CleanupResetAndDestroyPushL( array ); |
|
349 |
|
350 coQuery->SetSourceL( KContextSource_V1_Source ); |
|
351 coQuery->SetTypeL( KContextSource_V1_Type ); |
|
352 err = iCFClient->RequestContext( *coQuery, array ); |
|
353 EUNIT_PRINT( _L("RequestContext: err = %d"), err ); |
|
354 EUNIT_ASSERT_DESC( err == KErrNone, "Request context failed" ); |
|
355 EUNIT_ASSERT_DESC( array.Count() > 0, "Invalid number of contexts" ); |
|
356 |
|
357 CCFContextObject* requestCo = array[0]; |
|
358 EUNIT_PRINT( _L("RequestContext: [%S], [%S], [%S]"), |
|
359 &requestCo->Source(), &requestCo->Type(), &requestCo->Value() ); |
|
360 |
|
361 EUNIT_ASSERT_DESC( requestCo->Source() == KContextSource_V1_Source, |
|
362 "Invalid source" ); |
|
363 EUNIT_ASSERT_DESC( requestCo->Type() == KContextSource_V1_Type, |
|
364 "Invalid type" ); |
|
365 EUNIT_ASSERT_DESC( requestCo->Value() == TPtrC( |
|
366 KContextSource_V1_Type_Values[EContextSource_V1_ValueYes] ), |
|
367 "Invalid value" ); |
|
368 |
|
369 CleanupStack::PopAndDestroy( &array ); |
|
370 CleanupStack::PopAndDestroy( coQuery ); |
|
371 |
|
372 // Subscribe the context |
|
373 err = iCFClient->SubscribeContext( *subscript ); |
|
374 EUNIT_ASSERT_DESC( err == KErrNone, "Context subscription failed" ); |
|
375 |
|
376 // x. Uninstall context source v1 sis file and unsubscribe context |
|
377 // ------------------------------------------------------------------------- |
|
378 SwiUI::TUninstallOptionsPckg uninstOptionsPckg; |
|
379 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
380 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
381 err = iSwInst.SilentUninstall( TUid::Uid( KContextSource_V1DllUid ), |
|
382 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
383 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
384 |
|
385 // Wait for few seconds to make sure that installation has completed |
|
386 iDelay->Start( KSecond * 2 ); |
|
387 |
|
388 // Check that context source v1 has been installed |
|
389 coQuery = CCFContextQuery::NewLC(); |
|
390 CleanupResetAndDestroyPushL( array ); |
|
391 |
|
392 coQuery->SetSourceL( KContextSource_V1_Source ); |
|
393 coQuery->SetTypeL( KContextSource_V1_Type ); |
|
394 err = iCFClient->RequestContext( *coQuery, array ); |
|
395 EUNIT_PRINT( _L("RequestContext: err = %d"), err ); |
|
396 EUNIT_ASSERT_DESC( err == KErrNone, "Request context failed" ); |
|
397 EUNIT_ASSERT_DESC( array.Count() > 0, "Invalid number of contexts" ); |
|
398 |
|
399 requestCo = array[0]; |
|
400 EUNIT_PRINT( _L("RequestContext: [%S], [%S], [%S]"), |
|
401 &requestCo->Source(), &requestCo->Type(), &requestCo->Value() ); |
|
402 |
|
403 EUNIT_ASSERT_DESC( requestCo->Source() == KContextSource_V1_Source, |
|
404 "Invalid source" ); |
|
405 EUNIT_ASSERT_DESC( requestCo->Type() == KContextSource_V1_Type, |
|
406 "Invalid type" ); |
|
407 EUNIT_ASSERT_DESC( requestCo->Value() == TPtrC( |
|
408 KContextSource_V1_Type_Values[EContextSource_V1_ValueNo] ), |
|
409 "Invalid value" ); |
|
410 |
|
411 CleanupStack::PopAndDestroy( &array ); |
|
412 CleanupStack::PopAndDestroy( coQuery ); |
|
413 |
|
414 // Unsubscribe context |
|
415 err = iCFClient->UnsubscribeContext( *subscript ); |
|
416 EUNIT_ASSERT_DESC( err == KErrNone, "Context unsubscription failed" ); |
|
417 |
|
418 // x. Subscribe for a context and install context source v1 sis |
|
419 // Check that context indication is received |
|
420 // ------------------------------------------------------------------------- |
|
421 // Subscribe the context |
|
422 ResetContextObjectL(); |
|
423 err = iCFClient->SubscribeContext( *subscript ); |
|
424 EUNIT_ASSERT_DESC( err == KErrNone, "Context subscription failed" ); |
|
425 |
|
426 SetInstallOptions( instOptionsPckg ); |
|
427 err = iSwInst.SilentInstall( KSisPath, instOptionsPckg ); |
|
428 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
429 |
|
430 // Wait for few seconds to make sure that installation has completed |
|
431 iDelay->Start( KSecond * 2 ); |
|
432 |
|
433 // Check that context source v1 has been installed |
|
434 coQuery = CCFContextQuery::NewLC(); |
|
435 CleanupResetAndDestroyPushL( array ); |
|
436 |
|
437 coQuery->SetSourceL( KContextSource_V1_Source ); |
|
438 coQuery->SetTypeL( KContextSource_V1_Type ); |
|
439 err = iCFClient->RequestContext( *coQuery, array ); |
|
440 EUNIT_PRINT( _L("RequestContext: err = %d"), err ); |
|
441 EUNIT_ASSERT_DESC( err == KErrNone, "Request context failed" ); |
|
442 EUNIT_ASSERT_DESC( array.Count() > 0, "Invalid number of contexts" ); |
|
443 |
|
444 requestCo = array[0]; |
|
445 EUNIT_PRINT( _L("RequestContext: [%S], [%S], [%S]"), |
|
446 &requestCo->Source(), &requestCo->Type(), &requestCo->Value() ); |
|
447 |
|
448 EUNIT_ASSERT_DESC( requestCo->Source() == KContextSource_V1_Source, |
|
449 "Invalid source" ); |
|
450 EUNIT_ASSERT_DESC( requestCo->Type() == KContextSource_V1_Type, |
|
451 "Invalid type" ); |
|
452 EUNIT_ASSERT_DESC( requestCo->Value() == TPtrC( |
|
453 KContextSource_V1_Type_Values[EContextSource_V1_ValueYes] ), |
|
454 "Invalid value" ); |
|
455 |
|
456 CleanupStack::PopAndDestroy( &array ); |
|
457 CleanupStack::PopAndDestroy( coQuery ); |
|
458 |
|
459 // Check that context has been indicated |
|
460 EUNIT_ASSERT_DESC( iContextIndication, "Context indication not received " ); |
|
461 EUNIT_ASSERT_DESC( iCo->Source() == KContextSource_V1_Source, "Invalid context source" ); |
|
462 EUNIT_ASSERT_DESC( iCo->Type() == KContextSource_V1_Type, "Invalid context type" ); |
|
463 EUNIT_ASSERT_DESC( iCo->Value() == TPtrC( |
|
464 KContextSource_V1_Type_Values[EContextSource_V1_ValueYes] ), "Invalid context type" ); |
|
465 |
|
466 // x. Uninstall context source v1 sis file and unsubscribe context |
|
467 // ------------------------------------------------------------------------- |
|
468 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
469 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
470 err = iSwInst.SilentUninstall( TUid::Uid( KContextSource_V1DllUid ), |
|
471 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
472 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
473 |
|
474 // Wait for few seconds to make sure that installation has completed |
|
475 iDelay->Start( KSecond * 2 ); |
|
476 |
|
477 // Check that context source v1 has been installed |
|
478 coQuery = CCFContextQuery::NewLC(); |
|
479 CleanupResetAndDestroyPushL( array ); |
|
480 |
|
481 coQuery->SetSourceL( KContextSource_V1_Source ); |
|
482 coQuery->SetTypeL( KContextSource_V1_Type ); |
|
483 err = iCFClient->RequestContext( *coQuery, array ); |
|
484 EUNIT_PRINT( _L("RequestContext: err = %d"), err ); |
|
485 EUNIT_ASSERT_DESC( err == KErrNone, "Request context failed" ); |
|
486 EUNIT_ASSERT_DESC( array.Count() > 0, "Invalid number of contexts" ); |
|
487 |
|
488 requestCo = array[0]; |
|
489 EUNIT_PRINT( _L("RequestContext: [%S], [%S], [%S]"), |
|
490 &requestCo->Source(), &requestCo->Type(), &requestCo->Value() ); |
|
491 |
|
492 EUNIT_ASSERT_DESC( requestCo->Source() == KContextSource_V1_Source, |
|
493 "Invalid source" ); |
|
494 EUNIT_ASSERT_DESC( requestCo->Type() == KContextSource_V1_Type, |
|
495 "Invalid type" ); |
|
496 EUNIT_ASSERT_DESC( requestCo->Value() == TPtrC( |
|
497 KContextSource_V1_Type_Values[EContextSource_V1_ValueNo] ), |
|
498 "Invalid value" ); |
|
499 |
|
500 CleanupStack::PopAndDestroy( &array ); |
|
501 CleanupStack::PopAndDestroy( coQuery ); |
|
502 |
|
503 // Unsubscribe context |
|
504 err = iCFClient->UnsubscribeContext( *subscript ); |
|
505 EUNIT_ASSERT_DESC( err == KErrNone, "Context unsubscription failed" ); |
|
506 |
|
507 // x. Clean up |
|
508 // ------------------------------------------------------------------------- |
|
509 CleanupStack::PopAndDestroy( subscript ); |
|
510 } |
|
511 |
|
512 |
|
513 void MT_CFSisUpgrade::MT_CFSisUpgrade_InstallCfSisUpgrade3L( ) |
|
514 { |
|
515 _LIT( KSisPath_V1, |
|
516 "z:\\data\\cftestdata\\testsis\\contextsource_v1\\contextsource.sisx" ); |
|
517 _LIT( KSisPath_V2, |
|
518 "z:\\data\\cftestdata\\testsis\\contextsource_v2\\contextsource.sisx" ); |
|
519 |
|
520 // x. Preconditions |
|
521 // ------------------------------------------------------------------------- |
|
522 TBool exists = BaflUtils::FileExists( iFs, KSisPath_V1 ); |
|
523 EUNIT_ASSERT_DESC( exists, "Context upgrade V1 not found" ); |
|
524 exists = BaflUtils::FileExists( iFs, KSisPath_V2 ); |
|
525 EUNIT_ASSERT_DESC( exists, "Context upgrade V2 not found" ); |
|
526 |
|
527 // x. Install context source v1 sis and verify |
|
528 // ------------------------------------------------------------------------- |
|
529 SwiUI::TInstallOptionsPckg instOptionsPckg; |
|
530 SetInstallOptions( instOptionsPckg ); |
|
531 TInt err = iSwInst.SilentInstall( KSisPath_V1, instOptionsPckg ); |
|
532 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
533 |
|
534 // Wait for few seconds to make sure that installation has completed |
|
535 iDelay->Start( KSecond * 2 ); |
|
536 |
|
537 // Check that context source v1 has been installed |
|
538 CCFContextQuery* coQuery = CCFContextQuery::NewLC(); |
|
539 RContextObjectArray array; |
|
540 CleanupResetAndDestroyPushL( array ); |
|
541 |
|
542 coQuery->SetSourceL( KContextSource_V1_Source ); |
|
543 coQuery->SetTypeL( KContextSource_V1_Type ); |
|
544 err = iCFClient->RequestContext( *coQuery, array ); |
|
545 EUNIT_PRINT( _L("RequestContext: err = %d"), err ); |
|
546 EUNIT_ASSERT_DESC( err == KErrNone, "Request context failed" ); |
|
547 EUNIT_ASSERT_DESC( array.Count() > 0, "Invalid number of contexts" ); |
|
548 |
|
549 CCFContextObject* requestCo = array[0]; |
|
550 EUNIT_PRINT( _L("RequestContext: [%S], [%S], [%S]"), |
|
551 &requestCo->Source(), &requestCo->Type(), &requestCo->Value() ); |
|
552 |
|
553 EUNIT_ASSERT_DESC( requestCo->Source() == KContextSource_V1_Source, |
|
554 "Invalid source" ); |
|
555 EUNIT_ASSERT_DESC( requestCo->Type() == KContextSource_V1_Type, |
|
556 "Invalid type" ); |
|
557 EUNIT_ASSERT_DESC( requestCo->Value() == TPtrC( |
|
558 KContextSource_V1_Type_Values[EContextSource_V1_ValueYes] ), |
|
559 "Invalid value" ); |
|
560 |
|
561 CleanupStack::PopAndDestroy( &array ); |
|
562 CleanupStack::PopAndDestroy( coQuery ); |
|
563 |
|
564 // x. Install context source v2 sis upgrade and verify |
|
565 // ------------------------------------------------------------------------- |
|
566 SetInstallOptions( instOptionsPckg ); |
|
567 err = iSwInst.SilentInstall( KSisPath_V2, instOptionsPckg ); |
|
568 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
569 |
|
570 // Wait for few seconds to make sure that installation has completed |
|
571 iDelay->Start( KSecond * 2 ); |
|
572 |
|
573 // Check that context source v1 has been removed |
|
574 coQuery = CCFContextQuery::NewLC(); |
|
575 CleanupResetAndDestroyPushL( array ); |
|
576 |
|
577 coQuery->SetSourceL( KContextSource_V1_Source ); |
|
578 coQuery->SetTypeL( KContextSource_V1_Type ); |
|
579 err = iCFClient->RequestContext( *coQuery, array ); |
|
580 EUNIT_PRINT( _L("RequestContext: err = %d"), err ); |
|
581 EUNIT_ASSERT_DESC( err == KErrNone, "Request context failed" ); |
|
582 EUNIT_ASSERT_DESC( array.Count() > 0, "Invalid number of contexts" ); |
|
583 |
|
584 requestCo = array[0]; |
|
585 EUNIT_PRINT( _L("RequestContext: [%S], [%S], [%S]"), |
|
586 &requestCo->Source(), &requestCo->Type(), &requestCo->Value() ); |
|
587 |
|
588 EUNIT_ASSERT_DESC( requestCo->Source() == KContextSource_V1_Source, |
|
589 "Invalid source" ); |
|
590 EUNIT_ASSERT_DESC( requestCo->Type() == KContextSource_V1_Type, |
|
591 "Invalid type" ); |
|
592 EUNIT_ASSERT_DESC( requestCo->Value() == TPtrC( |
|
593 KContextSource_V1_Type_Values[EContextSource_V1_ValueNo] ), |
|
594 "Invalid value" ); |
|
595 |
|
596 CleanupStack::PopAndDestroy( &array ); |
|
597 CleanupStack::PopAndDestroy( coQuery ); |
|
598 |
|
599 // Check that context source v2 has been upgraded |
|
600 coQuery = CCFContextQuery::NewLC(); |
|
601 CleanupResetAndDestroyPushL( array ); |
|
602 |
|
603 coQuery->SetSourceL( KContextSource_V2_Source ); |
|
604 coQuery->SetTypeL( KContextSource_V2_Type ); |
|
605 err = iCFClient->RequestContext( *coQuery, array ); |
|
606 EUNIT_PRINT( _L("RequestContext: err = %d"), err ); |
|
607 EUNIT_ASSERT_DESC( err == KErrNone, "Request context failed" ); |
|
608 EUNIT_ASSERT_DESC( array.Count() > 0, "Invalid number of contexts" ); |
|
609 |
|
610 requestCo = array[0]; |
|
611 EUNIT_PRINT( _L("RequestContext: [%S], [%S], [%S]"), |
|
612 &requestCo->Source(), &requestCo->Type(), &requestCo->Value() ); |
|
613 |
|
614 EUNIT_ASSERT_DESC( requestCo->Source() == KContextSource_V2_Source, |
|
615 "Invalid source" ); |
|
616 EUNIT_ASSERT_DESC( requestCo->Type() == KContextSource_V2_Type, |
|
617 "Invalid type" ); |
|
618 EUNIT_ASSERT_DESC( requestCo->Value() == TPtrC( |
|
619 KContextSource_V2_Type_Values[EContextSource_V2_ValueYes] ), |
|
620 "Invalid value" ); |
|
621 |
|
622 CleanupStack::PopAndDestroy( &array ); |
|
623 CleanupStack::PopAndDestroy( coQuery ); |
|
624 |
|
625 // x. Uninstall context source v2 sis upgrade and verify |
|
626 // ------------------------------------------------------------------------- |
|
627 SwiUI::TUninstallOptionsPckg uninstOptionsPckg; |
|
628 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
629 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
630 err = iSwInst.SilentUninstall( TUid::Uid( KContextSource_V1DllUid ), |
|
631 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
632 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
633 |
|
634 // Wait for few seconds to make sure that installation has completed |
|
635 iDelay->Start( KSecond * 2 ); |
|
636 |
|
637 // Check that context source v2 has been upgraded |
|
638 coQuery = CCFContextQuery::NewLC(); |
|
639 CleanupResetAndDestroyPushL( array ); |
|
640 |
|
641 coQuery->SetSourceL( KContextSource_V2_Source ); |
|
642 coQuery->SetTypeL( KContextSource_V2_Type ); |
|
643 err = iCFClient->RequestContext( *coQuery, array ); |
|
644 EUNIT_PRINT( _L("RequestContext: err = %d"), err ); |
|
645 EUNIT_ASSERT_DESC( err == KErrNone, "Request context failed" ); |
|
646 EUNIT_ASSERT_DESC( array.Count() > 0, "Invalid number of contexts" ); |
|
647 |
|
648 requestCo = array[0]; |
|
649 EUNIT_PRINT( _L("RequestContext: [%S], [%S], [%S]"), |
|
650 &requestCo->Source(), &requestCo->Type(), &requestCo->Value() ); |
|
651 |
|
652 EUNIT_ASSERT_DESC( requestCo->Source() == KContextSource_V2_Source, |
|
653 "Invalid source" ); |
|
654 EUNIT_ASSERT_DESC( requestCo->Type() == KContextSource_V2_Type, |
|
655 "Invalid type" ); |
|
656 EUNIT_ASSERT_DESC( requestCo->Value() == TPtrC( |
|
657 KContextSource_V2_Type_Values[EContextSource_V2_ValueNo] ), |
|
658 "Invalid value" ); |
|
659 |
|
660 CleanupStack::PopAndDestroy( &array ); |
|
661 CleanupStack::PopAndDestroy( coQuery ); |
|
662 |
|
663 // x. Clean up |
|
664 // ------------------------------------------------------------------------- |
|
665 // Nothing to do |
|
666 } |
|
667 |
|
668 |
|
669 void MT_CFSisUpgrade::MT_CFSisUpgrade_InstallCfSisUpgrade4L( ) |
|
670 { |
|
671 _LIT( KSisPath_V1, "z:\\data\\cftestdata\\testsis\\action_v1\\action.sisx" ); |
|
672 |
|
673 CCFContextObject* co = CCFContextObject::NewLC(); |
|
674 co->SetSourceL( _L("action.source") ); |
|
675 co->SetTypeL( _L("action.source.v1") ); |
|
676 |
|
677 // x. Preconditions |
|
678 // ------------------------------------------------------------------------- |
|
679 TBool exists = BaflUtils::FileExists( iFs, KSisPath_V1 ); |
|
680 EUNIT_ASSERT_DESC( exists, "Action upgrade V1 not found" ); |
|
681 |
|
682 _LIT_SECURITY_POLICY_PASS( passSec ); |
|
683 TInt err = iCFClient->DefineContext( co->Source(), co->Type(), passSec, passSec ); |
|
684 EUNIT_ASSERT_DESC( err == KErrNone || err == KErrAlreadyExists, |
|
685 "Define context failed" ); |
|
686 |
|
687 // x. Install action v1 sis |
|
688 // ------------------------------------------------------------------------- |
|
689 SwiUI::TInstallOptionsPckg instOptionsPckg; |
|
690 SetInstallOptions( instOptionsPckg ); |
|
691 err = iSwInst.SilentInstall( KSisPath_V1, instOptionsPckg ); |
|
692 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
693 |
|
694 iDelay->Start( KSecond * 2 ); |
|
695 |
|
696 // x. Test that action v1 has been installed |
|
697 // ------------------------------------------------------------------------- |
|
698 // Check that action has been initialized |
|
699 TInt value = 0; |
|
700 err = RProperty::Get( KAction_V1PSUid, KAction_V1PSCategory, value ); |
|
701 EUNIT_ASSERT_DESC( err == KErrNone, "P&S key get failed" ); |
|
702 EUNIT_ASSERT_DESC( value == EAction_V1NotTriggered, "Action v1 not triggered" ); |
|
703 |
|
704 // Register script |
|
705 TInt scriptId = 0; |
|
706 err = iCFClient->RegisterScript( |
|
707 _L("z:\\data\\cftestdata\\testscripts\\test-actionV1.xml"), scriptId ); |
|
708 EUNIT_PRINT( _L("RegisterScript: err = %d"), err ); |
|
709 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
710 |
|
711 // Publish context |
|
712 co->SetValueL( _L("true") ); |
|
713 err = iCFClient->PublishContext( *co ); |
|
714 EUNIT_ASSERT_DESC( err == KErrNone, "Publish context failed" ); |
|
715 |
|
716 // Wait that action thread has been executed |
|
717 iDelay->Start( KSecond * 2 ); |
|
718 |
|
719 // Check that action has been executed |
|
720 value = 0; |
|
721 err = RProperty::Get( KAction_V1PSUid, KAction_V1PSCategory, value ); |
|
722 EUNIT_ASSERT_DESC( err == KErrNone, "P&S key get failed" ); |
|
723 EUNIT_ASSERT_DESC( value == EAction_V1Triggered, "Action v1 not triggered" ); |
|
724 |
|
725 // x. Uninstall action v1 sis |
|
726 // ------------------------------------------------------------------------- |
|
727 SwiUI::TUninstallOptionsPckg uninstOptionsPckg; |
|
728 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
729 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
730 err = iSwInst.SilentUninstall( TUid::Uid( KAction_V1DllUid ), |
|
731 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
732 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
733 |
|
734 // Wait that action plug-in is fully uninstalled |
|
735 iDelay->Start( KSecond * 2 ); |
|
736 |
|
737 // Publish context to double check that action is not triggered and no |
|
738 // panics occurs |
|
739 co->SetValueL( _L("true") ); |
|
740 err = iCFClient->PublishContext( *co ); |
|
741 EUNIT_ASSERT_DESC( err == KErrNone, "Publish context failed" ); |
|
742 |
|
743 // Wait that action thread has been executed |
|
744 iDelay->Start( KSecond * 2 ); |
|
745 |
|
746 // Check that action plug-in is really uninstalled |
|
747 value = 0; |
|
748 err = RProperty::Get( KAction_V1PSUid, KAction_V1PSCategory, value ); |
|
749 EUNIT_ASSERT_DESC( err == KErrNone, "P&S key get failed" ); |
|
750 EUNIT_ASSERT_DESC( value == EAction_V1NotTriggered, "Action v1 still triggered" ); |
|
751 |
|
752 // x. Clean up |
|
753 // ------------------------------------------------------------------------- |
|
754 CleanupStack::PopAndDestroy( co ); |
|
755 } |
|
756 |
|
757 |
|
758 void MT_CFSisUpgrade::MT_CFSisUpgrade_InstallCfSisUpgrade5L( ) |
|
759 { |
|
760 _LIT( KSisPath_V1, "z:\\data\\cftestdata\\testsis\\action_v1\\action.sisx" ); |
|
761 _LIT( KSisPath_V2, "z:\\data\\cftestdata\\testsis\\action_v2\\action.sisx" ); |
|
762 |
|
763 CCFContextObject* co = CCFContextObject::NewLC(); |
|
764 |
|
765 // x. Preconditions |
|
766 // ------------------------------------------------------------------------- |
|
767 TBool exists = BaflUtils::FileExists( iFs, KSisPath_V1 ); |
|
768 EUNIT_ASSERT_DESC( exists, "Action upgrade V1 not found" ); |
|
769 exists = BaflUtils::FileExists( iFs, KSisPath_V2 ); |
|
770 EUNIT_ASSERT_DESC( exists, "Action upgrade V2 not found" ); |
|
771 |
|
772 co->SetSourceL( _L("action.source") ); |
|
773 co->SetTypeL( _L("action.source.v1") ); |
|
774 _LIT_SECURITY_POLICY_PASS( passSec ); |
|
775 TInt err = iCFClient->DefineContext( co->Source(), co->Type(), passSec, passSec ); |
|
776 |
|
777 co->SetSourceL( _L("action.source") ); |
|
778 co->SetTypeL( _L("action.source.v2") ); |
|
779 err = iCFClient->DefineContext( co->Source(), co->Type(), passSec, passSec ); |
|
780 |
|
781 // x. Install action v1 sis |
|
782 // ------------------------------------------------------------------------- |
|
783 SwiUI::TInstallOptionsPckg instOptionsPckg; |
|
784 SetInstallOptions( instOptionsPckg ); |
|
785 err = iSwInst.SilentInstall( KSisPath_V1, instOptionsPckg ); |
|
786 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
787 |
|
788 iDelay->Start( KSecond * 2 ); |
|
789 |
|
790 // x. Test that action v1 has been installed |
|
791 // ------------------------------------------------------------------------- |
|
792 // Check that action has been initialized |
|
793 TInt value = 0; |
|
794 err = RProperty::Get( KAction_V1PSUid, KAction_V1PSCategory, value ); |
|
795 EUNIT_ASSERT_DESC( err == KErrNone, "P&S key get failed" ); |
|
796 EUNIT_ASSERT_DESC( value == EAction_V1NotTriggered, "Action v1 not triggered" ); |
|
797 |
|
798 // Register script for action v1 |
|
799 TInt scriptId = 0; |
|
800 err = iCFClient->RegisterScript( |
|
801 _L("z:\\data\\cftestdata\\testscripts\\test-actionV1.xml"), scriptId ); |
|
802 EUNIT_PRINT( _L("RegisterScript: err = %d"), err ); |
|
803 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
804 |
|
805 // Publish context |
|
806 co->SetSourceL( _L("action.source") ); |
|
807 co->SetTypeL( _L("action.source.v1") ); |
|
808 co->SetValueL( _L("true") ); |
|
809 err = iCFClient->PublishContext( *co ); |
|
810 EUNIT_ASSERT_DESC( err == KErrNone, "Publish context failed" ); |
|
811 |
|
812 // Wait that action thread has been executed |
|
813 iDelay->Start( KSecond * 2 ); |
|
814 |
|
815 // Check that action has been executed |
|
816 value = 0; |
|
817 err = RProperty::Get( KAction_V1PSUid, KAction_V1PSCategory, value ); |
|
818 EUNIT_ASSERT_DESC( err == KErrNone, "P&S key get failed" ); |
|
819 EUNIT_ASSERT_DESC( value == EAction_V1Triggered, "Action v1 not triggered" ); |
|
820 |
|
821 // x. Install action v2 sis |
|
822 // ------------------------------------------------------------------------- |
|
823 SetInstallOptions( instOptionsPckg ); |
|
824 err = iSwInst.SilentInstall( KSisPath_V2, instOptionsPckg ); |
|
825 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
826 iDelay->Start( KSecond * 2 ); |
|
827 |
|
828 // x. Check that action v1 is uninstalled |
|
829 // ------------------------------------------------------------------------- |
|
830 value = 0; |
|
831 err = RProperty::Get( KAction_V1PSUid, KAction_V1PSCategory, value ); |
|
832 EUNIT_ASSERT_DESC( err == KErrNone, "P&S key get failed" ); |
|
833 EUNIT_ASSERT_DESC( value == EAction_V1NotTriggered, "Action v1 still triggered" ); |
|
834 |
|
835 // x. Check that action v2 is installed |
|
836 // ------------------------------------------------------------------------- |
|
837 value = 0; |
|
838 err = RProperty::Get( KAction_V2PSUid, KAction_V2PSCategory, value ); |
|
839 EUNIT_ASSERT_DESC( err == KErrNone, "P&S key get failed" ); |
|
840 EUNIT_ASSERT_DESC( value == EAction_V2NotTriggered, "Action v2 not triggered" ); |
|
841 |
|
842 // Register script for action v2 |
|
843 scriptId = 0; |
|
844 err = iCFClient->RegisterScript( |
|
845 _L("z:\\data\\cftestdata\\testscripts\\test-actionV2.xml"), scriptId ); |
|
846 EUNIT_PRINT( _L("RegisterScript: err = %d"), err ); |
|
847 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
848 |
|
849 // Publish context |
|
850 co->SetSourceL( _L("action.source") ); |
|
851 co->SetTypeL( _L("action.source.v2") ); |
|
852 co->SetValueL( _L("true") ); |
|
853 err = iCFClient->PublishContext( *co ); |
|
854 EUNIT_ASSERT_DESC( err == KErrNone, "Publish context failed" ); |
|
855 |
|
856 // Wait that action thread has been executed |
|
857 iDelay->Start( KSecond * 2 ); |
|
858 |
|
859 // Check that action has been executed |
|
860 value = 0; |
|
861 err = RProperty::Get( KAction_V2PSUid, KAction_V2PSCategory, value ); |
|
862 EUNIT_ASSERT_DESC( err == KErrNone, "P&S key get failed" ); |
|
863 EUNIT_ASSERT_DESC( value == EAction_V2Triggered, "Action v2 not triggered" ); |
|
864 |
|
865 // x. Uninstall action v2 sis |
|
866 // ------------------------------------------------------------------------- |
|
867 SwiUI::TUninstallOptionsPckg uninstOptionsPckg; |
|
868 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
869 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
870 err = iSwInst.SilentUninstall( TUid::Uid( KAction_V2DllUid ), |
|
871 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
872 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
873 |
|
874 // Wait that action plug-in is fully uninstalled |
|
875 iDelay->Start( KSecond * 2 ); |
|
876 |
|
877 // Publish context to double check that action is not triggered and no |
|
878 // panics occurs |
|
879 co->SetSourceL( _L("action.source") ); |
|
880 co->SetTypeL( _L("action.source.v2") ); |
|
881 co->SetValueL( _L("true") ); |
|
882 err = iCFClient->PublishContext( *co ); |
|
883 EUNIT_ASSERT_DESC( err == KErrNone, "Publish context failed" ); |
|
884 |
|
885 // Wait that action thread has been executed |
|
886 iDelay->Start( KSecond * 2 ); |
|
887 |
|
888 // Check that action plug-in is really uninstalled |
|
889 value = 0; |
|
890 err = RProperty::Get( KAction_V2PSUid, KAction_V2PSCategory, value ); |
|
891 EUNIT_ASSERT_DESC( err == KErrNone, "P&S key get failed" ); |
|
892 EUNIT_ASSERT_DESC( value == EAction_V2NotTriggered, "Action v2 still triggered" ); |
|
893 |
|
894 // x. Clean up |
|
895 // ------------------------------------------------------------------------- |
|
896 CleanupStack::PopAndDestroy( co ); |
|
897 } |
|
898 |
|
899 |
|
900 void MT_CFSisUpgrade::MT_CFSisUpgrade_InstallCfSisUpgrade6L( ) |
|
901 { |
|
902 _LIT( KSisPath_V1, "z:\\data\\cftestdata\\testsis\\operation_v1\\operation.sisx" ); |
|
903 _LIT_SECURITY_POLICY_PASS( passSec ); |
|
904 |
|
905 CCFContextObject* co = CCFContextObject::NewLC(); |
|
906 CCFActionSubscription* action = CCFActionSubscription::NewLC(); |
|
907 |
|
908 // x. Preconditions |
|
909 // ------------------------------------------------------------------------- |
|
910 TBool exists = BaflUtils::FileExists( iFs, KSisPath_V1 ); |
|
911 EUNIT_ASSERT_DESC( exists, "Operation upgrade V1 not found" ); |
|
912 exists = BaflUtils::FileExists( |
|
913 iFs, _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml") ); |
|
914 EUNIT_ASSERT_DESC( exists, "test-operationV1-1.xml not found" ); |
|
915 |
|
916 // Define needed context |
|
917 co->SetSourceL( _L("operation.source") ); |
|
918 co->SetTypeL( _L("operation.type.v1") ); |
|
919 TInt err = iCFClient->DefineContext( co->Source(), co->Type(), passSec, passSec ); |
|
920 EUNIT_ASSERT_DESC( err == KErrNone, "Define context failed" ); |
|
921 |
|
922 // Define needed action and subscribe it |
|
923 action->SetActionIdentifierL( _L("operationAction_v1") ); |
|
924 err = iCFClient->DefineAction( action->ActionIdentifier(), passSec ); |
|
925 EUNIT_ASSERT_DESC( err == KErrNone, "Define action failed" ); |
|
926 err = iCFClient->SubscribeAction( *action ); |
|
927 EUNIT_ASSERT_DESC( err == KErrNone, "Subscribe action failed" ); |
|
928 |
|
929 // x. Install operation v1 and check that installation is succesfull |
|
930 // ------------------------------------------------------------------------- |
|
931 SwiUI::TInstallOptionsPckg instOptionsPckg; |
|
932 SetInstallOptions( instOptionsPckg ); |
|
933 err = iSwInst.SilentInstall( KSisPath_V1, instOptionsPckg ); |
|
934 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
935 |
|
936 iDelay->Start( KSecond * 2 ); |
|
937 |
|
938 // Check that the operation plug-in is installed by registering script |
|
939 // which uses the new condition operation |
|
940 TInt scriptId1 = KErrNotFound; |
|
941 err = iCFClient->RegisterScript( |
|
942 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml"), scriptId1 ); |
|
943 EUNIT_PRINT( _L("ResgisterScript: err =%d, scriptId = %d"), err, scriptId1 ); |
|
944 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
945 EUNIT_ASSERT_DESC( scriptId1 > 0, "Register script failed" ); |
|
946 |
|
947 // Publish context and wait for action indication |
|
948 ResetActionL(); |
|
949 co->SetSourceL( _L("operation.source") ); |
|
950 co->SetTypeL( _L("operation.type.v1") ); |
|
951 co->SetValueL( _L("true") ); |
|
952 err = iCFClient->PublishContext( *co ); |
|
953 EUNIT_PRINT( _L("PublishContext: err = %d"), err ); |
|
954 EUNIT_ASSERT_DESC( err == KErrNone, "Publish context failed" ); |
|
955 |
|
956 iDelay->Start( KSecond * 2 ); |
|
957 |
|
958 EUNIT_PRINT( _L("ActionIndication: [%d], [%S]"), iActionIndication, &iActionId ); |
|
959 |
|
960 EUNIT_ASSERT_DESC( iActionIndication, "Action indication not received" ); |
|
961 EUNIT_ASSERT_DESC( iActionId == _L("operationAction_v1"), "Action indication incorrect" ); |
|
962 |
|
963 // x. Uninstall operation v1 and check that uninstallation is succesfull |
|
964 // ------------------------------------------------------------------------- |
|
965 ResetScriptsRemovedL(); |
|
966 SwiUI::TUninstallOptionsPckg uninstOptionsPckg; |
|
967 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
968 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
969 err = iSwInst.SilentUninstall( TUid::Uid( KOperation_V1DllUid ), |
|
970 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
971 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
972 |
|
973 iDelay->Start( KSecond * 2 ); |
|
974 |
|
975 // Check that script removal notification is received |
|
976 EUNIT_ASSERT_DESC( iScriptsRemovedNotified, "Script removal not notified" ); |
|
977 TBool found = EFalse; |
|
978 for( TInt i = 0; i < iScriptIds.Count(); i++ ) |
|
979 { |
|
980 if( iScriptIds[i] == scriptId1 ) |
|
981 { |
|
982 found = ETrue; |
|
983 break; |
|
984 } |
|
985 } |
|
986 EUNIT_ASSERT_DESC( found, "Script id not found" ); |
|
987 |
|
988 // Deregister script - should fail |
|
989 err = iCFClient->DeregisterScript( scriptId1 ); |
|
990 EUNIT_PRINT( _L("DeregisterScript: err = %d"), err ); |
|
991 EUNIT_ASSERT_DESC( err != KErrNone, "Deregister script failed" ); |
|
992 |
|
993 // Try to register script again - should fail |
|
994 scriptId1 = KErrNotFound; |
|
995 err = iCFClient->RegisterScript( |
|
996 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml"), scriptId1 ); |
|
997 EUNIT_PRINT( _L("ResgisterScript: err = %d, scriptId = %d"), err, scriptId1 ); |
|
998 EUNIT_ASSERT_DESC( err != KErrNone, "Register script failed" ); |
|
999 |
|
1000 // x. Clean up |
|
1001 // ------------------------------------------------------------------------- |
|
1002 CleanupStack::PopAndDestroy( action ); |
|
1003 CleanupStack::PopAndDestroy( co ); |
|
1004 } |
|
1005 |
|
1006 |
|
1007 void MT_CFSisUpgrade::MT_CFSisUpgrade_InstallCfSisUpgrade7L( ) |
|
1008 { |
|
1009 _LIT( KSisPath_V1, "z:\\data\\cftestdata\\testsis\\operation_v1\\operation.sisx" ); |
|
1010 _LIT_SECURITY_POLICY_PASS( passSec ); |
|
1011 |
|
1012 // x. Preconditions |
|
1013 // ------------------------------------------------------------------------- |
|
1014 TBool exists = BaflUtils::FileExists( iFs, KSisPath_V1 ); |
|
1015 EUNIT_ASSERT_DESC( exists, "Operation upgrade V1 not found" ); |
|
1016 exists = BaflUtils::FileExists( |
|
1017 iFs, _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml") ); |
|
1018 EUNIT_ASSERT_DESC( exists, "test-operationV1-1.xml not found" ); |
|
1019 exists = BaflUtils::FileExists( |
|
1020 iFs, _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-2.xml") ); |
|
1021 EUNIT_ASSERT_DESC( exists, "test-operationV1-2.xml not found" ); |
|
1022 |
|
1023 // Define needed context |
|
1024 TInt err = iCFClient->DefineContext( |
|
1025 _L("operation.source"), _L("operation.type.v1"), passSec, passSec ); |
|
1026 EUNIT_ASSERT_DESC( err == KErrNone, "Define context failed" ); |
|
1027 |
|
1028 // Define needed action and subscribe it |
|
1029 err = iCFClient->DefineAction( _L("operationAction_v1"), passSec ); |
|
1030 EUNIT_ASSERT_DESC( err == KErrNone, "Define action failed" ); |
|
1031 |
|
1032 // x. Install operation v1 and register two scripts |
|
1033 // ------------------------------------------------------------------------- |
|
1034 SwiUI::TInstallOptionsPckg instOptionsPckg; |
|
1035 SetInstallOptions( instOptionsPckg ); |
|
1036 err = iSwInst.SilentInstall( KSisPath_V1, instOptionsPckg ); |
|
1037 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
1038 |
|
1039 iDelay->Start( KSecond * 2 ); |
|
1040 |
|
1041 // register script1 |
|
1042 TInt scriptId1 = KErrNotFound; |
|
1043 err = iCFClient->RegisterScript( |
|
1044 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml"), scriptId1 ); |
|
1045 EUNIT_PRINT( _L("ResgisterScript: err =%d, scriptId = %d"), err, scriptId1 ); |
|
1046 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
1047 EUNIT_ASSERT_DESC( scriptId1 > 0, "Register script failed" ); |
|
1048 |
|
1049 // register script2 |
|
1050 TInt scriptId2 = KErrNotFound; |
|
1051 err = iCFClient->RegisterScript( |
|
1052 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-2.xml"), scriptId2 ); |
|
1053 EUNIT_PRINT( _L("ResgisterScript: err =%d, scriptId = %d"), err, scriptId2 ); |
|
1054 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
1055 EUNIT_ASSERT_DESC( scriptId2 > 0, "Register script failed" ); |
|
1056 |
|
1057 // x. Uninstall operation v1 |
|
1058 // ------------------------------------------------------------------------- |
|
1059 ResetScriptsRemovedL(); |
|
1060 SwiUI::TUninstallOptionsPckg uninstOptionsPckg; |
|
1061 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
1062 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
1063 err = iSwInst.SilentUninstall( TUid::Uid( KOperation_V1DllUid ), |
|
1064 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
1065 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
1066 |
|
1067 iDelay->Start( KSecond * 2 ); |
|
1068 |
|
1069 // x. Check that a notification regarding the two registered scripts are |
|
1070 // received. |
|
1071 // ------------------------------------------------------------------------- |
|
1072 EUNIT_ASSERT_DESC( iScriptsRemovedNotified, "Script removal not notified" ); |
|
1073 TBool foundScriptId1 = EFalse; |
|
1074 TBool foundScriptId2 = EFalse; |
|
1075 for( TInt i = 0; i < iScriptIds.Count(); i++ ) |
|
1076 { |
|
1077 if( iScriptIds[i] == scriptId1 ) |
|
1078 { |
|
1079 foundScriptId1 = ETrue; |
|
1080 } |
|
1081 else if( iScriptIds[i] == scriptId2 ) |
|
1082 { |
|
1083 foundScriptId2 = ETrue; |
|
1084 } |
|
1085 } |
|
1086 EUNIT_ASSERT_DESC( foundScriptId1, "Script id 1 not found" ); |
|
1087 EUNIT_ASSERT_DESC( foundScriptId2, "Script id 2 not found" ); |
|
1088 |
|
1089 // x. Clean up |
|
1090 // ------------------------------------------------------------------------- |
|
1091 // Nothing to do |
|
1092 } |
|
1093 |
|
1094 |
|
1095 void MT_CFSisUpgrade::MT_CFSisUpgrade_InstallCfSisUpgrade8L() |
|
1096 { |
|
1097 _LIT( KSisPath_V1, "z:\\data\\cftestdata\\testsis\\operation_v1\\operation.sisx" ); |
|
1098 _LIT_SECURITY_POLICY_PASS( passSec ); |
|
1099 |
|
1100 // x. Preconditions |
|
1101 // ------------------------------------------------------------------------- |
|
1102 TBool exists = BaflUtils::FileExists( iFs, KSisPath_V1 ); |
|
1103 EUNIT_ASSERT_DESC( exists, "Operation upgrade V1 not found" ); |
|
1104 exists = BaflUtils::FileExists( |
|
1105 iFs, _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml") ); |
|
1106 EUNIT_ASSERT_DESC( exists, "test-operationV1-1.xml not found" ); |
|
1107 |
|
1108 // Define needed context |
|
1109 TInt err = iCFClient->DefineContext( |
|
1110 _L("operation.source"), _L("operation.type.v1"), passSec, passSec ); |
|
1111 EUNIT_ASSERT_DESC( err == KErrNone, "Define context failed" ); |
|
1112 |
|
1113 // Define needed action and subscribe it |
|
1114 err = iCFClient->DefineAction( _L("operationAction_v1"), passSec ); |
|
1115 EUNIT_ASSERT_DESC( err == KErrNone, "Define action failed" ); |
|
1116 |
|
1117 // x. Install operation v1 and one script |
|
1118 // ------------------------------------------------------------------------- |
|
1119 SwiUI::TInstallOptionsPckg instOptionsPckg; |
|
1120 SetInstallOptions( instOptionsPckg ); |
|
1121 err = iSwInst.SilentInstall( KSisPath_V1, instOptionsPckg ); |
|
1122 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
1123 |
|
1124 iDelay->Start( KSecond * 2 ); |
|
1125 |
|
1126 // register script1 |
|
1127 TInt scriptId1 = KErrNotFound; |
|
1128 err = iCFClient->RegisterScript( |
|
1129 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml"), scriptId1 ); |
|
1130 EUNIT_PRINT( _L("ResgisterScript: err =%d, scriptId = %d"), err, scriptId1 ); |
|
1131 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
1132 EUNIT_ASSERT_DESC( scriptId1 > 0, "Register script failed" ); |
|
1133 |
|
1134 // x. Delete client and uninstall operation v1 |
|
1135 // ------------------------------------------------------------------------- |
|
1136 delete iCFClient; |
|
1137 iCFClient = NULL; |
|
1138 |
|
1139 ResetScriptsRemovedL(); |
|
1140 SwiUI::TUninstallOptionsPckg uninstOptionsPckg; |
|
1141 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
1142 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
1143 err = iSwInst.SilentUninstall( TUid::Uid( KOperation_V1DllUid ), |
|
1144 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
1145 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
1146 |
|
1147 iDelay->Start( KSecond * 2 ); |
|
1148 |
|
1149 // x. Create client again and try to deregister and register script |
|
1150 // ------------------------------------------------------------------------- |
|
1151 iCFClient = CCFClient::NewL( *this ); |
|
1152 |
|
1153 // Deregister script - should fail |
|
1154 err = iCFClient->DeregisterScript( scriptId1 ); |
|
1155 EUNIT_PRINT( _L("DeregisterScript: err = %d"), err ); |
|
1156 EUNIT_ASSERT_DESC( err != KErrNone, "Deregister script failed" ); |
|
1157 |
|
1158 // Try to register script again - should fail |
|
1159 scriptId1 = KErrNotFound; |
|
1160 err = iCFClient->RegisterScript( |
|
1161 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml"), scriptId1 ); |
|
1162 EUNIT_PRINT( _L("ResgisterScript: err = %d, scriptId = %d"), err, scriptId1 ); |
|
1163 EUNIT_ASSERT_DESC( err != KErrNone, "Register script failed" ); |
|
1164 |
|
1165 // x. Clean up |
|
1166 // ------------------------------------------------------------------------- |
|
1167 // Nothing to do |
|
1168 } |
|
1169 |
|
1170 |
|
1171 void MT_CFSisUpgrade::MT_CFSisUpgrade_InstallCfSisUpgrade9L() |
|
1172 { |
|
1173 _LIT( KSisPath_V1, "z:\\data\\cftestdata\\testsis\\operation_v1\\operation.sisx" ); |
|
1174 _LIT_SECURITY_POLICY_PASS( passSec ); |
|
1175 |
|
1176 // Create another session to cfserver |
|
1177 CCFClient* cfClient2 = CCFClient::NewLC( *this ); |
|
1178 |
|
1179 // x. Preconditions |
|
1180 // ------------------------------------------------------------------------- |
|
1181 TBool exists = BaflUtils::FileExists( iFs, KSisPath_V1 ); |
|
1182 EUNIT_ASSERT_DESC( exists, "Operation upgrade V1 not found" ); |
|
1183 exists = BaflUtils::FileExists( |
|
1184 iFs, _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml") ); |
|
1185 EUNIT_ASSERT_DESC( exists, "test-operationV1-1.xml not found" ); |
|
1186 exists = BaflUtils::FileExists( |
|
1187 iFs, _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-2.xml") ); |
|
1188 EUNIT_ASSERT_DESC( exists, "test-operationV1-2.xml not found" ); |
|
1189 |
|
1190 // Define needed context |
|
1191 TInt err = iCFClient->DefineContext( |
|
1192 _L("operation.source"), _L("operation.type.v1"), passSec, passSec ); |
|
1193 EUNIT_ASSERT_DESC( err == KErrNone, "Define context failed" ); |
|
1194 |
|
1195 // Define needed action and subscribe it |
|
1196 err = iCFClient->DefineAction( _L("operationAction_v1"), passSec ); |
|
1197 EUNIT_ASSERT_DESC( err == KErrNone, "Define action failed" ); |
|
1198 |
|
1199 // x. Install operation v1 |
|
1200 // ------------------------------------------------------------------------- |
|
1201 SwiUI::TInstallOptionsPckg instOptionsPckg; |
|
1202 SetInstallOptions( instOptionsPckg ); |
|
1203 err = iSwInst.SilentInstall( KSisPath_V1, instOptionsPckg ); |
|
1204 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
1205 |
|
1206 iDelay->Start( KSecond * 2 ); |
|
1207 |
|
1208 // x. Register script test-operationV1-1.xml from first client |
|
1209 // ------------------------------------------------------------------------- |
|
1210 TInt scriptId1 = KErrNotFound; |
|
1211 err = iCFClient->RegisterScript( |
|
1212 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml"), scriptId1 ); |
|
1213 EUNIT_PRINT( _L("ResgisterScript: err =%d, scriptId = %d"), err, scriptId1 ); |
|
1214 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
1215 EUNIT_ASSERT_DESC( scriptId1 > 0, "Register script failed" ); |
|
1216 |
|
1217 // x. Register script test-operationV1-2.xml from first client |
|
1218 // ------------------------------------------------------------------------- |
|
1219 TInt scriptId2 = KErrNotFound; |
|
1220 err = cfClient2->RegisterScript( |
|
1221 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-2.xml"), scriptId2 ); |
|
1222 EUNIT_PRINT( _L("ResgisterScript: err =%d, scriptId = %d"), err, scriptId2 ); |
|
1223 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
1224 EUNIT_ASSERT_DESC( scriptId2 > 0, "Register script failed" ); |
|
1225 |
|
1226 // x. Uninstall operation v1 |
|
1227 // ------------------------------------------------------------------------- |
|
1228 ResetScriptsRemovedL(); |
|
1229 SwiUI::TUninstallOptionsPckg uninstOptionsPckg; |
|
1230 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
1231 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
1232 err = iSwInst.SilentUninstall( TUid::Uid( KOperation_V1DllUid ), |
|
1233 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
1234 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
1235 |
|
1236 iDelay->Start( KSecond * 2 ); |
|
1237 |
|
1238 // x. Check that both script removals are notified |
|
1239 // ------------------------------------------------------------------------- |
|
1240 EUNIT_ASSERT_DESC( iScriptsRemovedNotified, "Script removal not notified" ); |
|
1241 TBool foundScriptId1 = EFalse; |
|
1242 TBool foundScriptId2 = EFalse; |
|
1243 for( TInt i = 0; i < iScriptIds.Count(); i++ ) |
|
1244 { |
|
1245 if( iScriptIds[i] == scriptId1 ) |
|
1246 { |
|
1247 foundScriptId1 = ETrue; |
|
1248 } |
|
1249 else if( iScriptIds[i] == scriptId2 ) |
|
1250 { |
|
1251 foundScriptId2 = ETrue; |
|
1252 } |
|
1253 } |
|
1254 EUNIT_ASSERT_DESC( foundScriptId1, "Script id 1 not found" ); |
|
1255 EUNIT_ASSERT_DESC( foundScriptId2, "Script id 2 not found" ); |
|
1256 |
|
1257 // x. Try to deregister and register scripts again |
|
1258 // ------------------------------------------------------------------------- |
|
1259 // Deregister script 1 - should fail |
|
1260 err = iCFClient->DeregisterScript( scriptId1 ); |
|
1261 EUNIT_PRINT( _L("DeregisterScript: err = %d"), err ); |
|
1262 EUNIT_ASSERT_DESC( err != KErrNone, "Deregister script failed" ); |
|
1263 |
|
1264 // Try to register script 1 again - should fail |
|
1265 scriptId1 = KErrNotFound; |
|
1266 err = iCFClient->RegisterScript( |
|
1267 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml"), scriptId1 ); |
|
1268 EUNIT_PRINT( _L("ResgisterScript: err = %d, scriptId = %d"), err, scriptId1 ); |
|
1269 EUNIT_ASSERT_DESC( err != KErrNone, "Register script failed" ); |
|
1270 |
|
1271 // Deregister script 2 - should fail |
|
1272 err = cfClient2->DeregisterScript( scriptId2 ); |
|
1273 EUNIT_PRINT( _L("DeregisterScript: err = %d"), err ); |
|
1274 EUNIT_ASSERT_DESC( err != KErrNone, "Deregister script failed" ); |
|
1275 |
|
1276 // Try to register script 2 again - should fail |
|
1277 scriptId2 = KErrNotFound; |
|
1278 err = cfClient2->RegisterScript( |
|
1279 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-2.xml"), scriptId2 ); |
|
1280 EUNIT_PRINT( _L("ResgisterScript: err = %d, scriptId = %d"), err, scriptId2 ); |
|
1281 EUNIT_ASSERT_DESC( err != KErrNone, "Register script failed" ); |
|
1282 |
|
1283 // x. Clean up |
|
1284 // ------------------------------------------------------------------------- |
|
1285 CleanupStack::PopAndDestroy( cfClient2 ); |
|
1286 } |
|
1287 |
|
1288 |
|
1289 void MT_CFSisUpgrade::MT_CFSisUpgrade_InstallCfSisUpgrade10L() |
|
1290 { |
|
1291 _LIT( KSisPath_V1, "z:\\data\\cftestdata\\testsis\\operation_v1\\operation.sisx" ); |
|
1292 _LIT_SECURITY_POLICY_PASS( passSec ); |
|
1293 |
|
1294 // Create another session to cfserver |
|
1295 CCFClient* cfClient2 = CCFClient::NewLC( *this ); |
|
1296 |
|
1297 // x. Preconditions |
|
1298 // ------------------------------------------------------------------------- |
|
1299 TBool exists = BaflUtils::FileExists( iFs, KSisPath_V1 ); |
|
1300 EUNIT_ASSERT_DESC( exists, "Operation upgrade V1 not found" ); |
|
1301 exists = BaflUtils::FileExists( |
|
1302 iFs, _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml") ); |
|
1303 EUNIT_ASSERT_DESC( exists, "test-operationV1-1.xml not found" ); |
|
1304 exists = BaflUtils::FileExists( |
|
1305 iFs, _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-2.xml") ); |
|
1306 EUNIT_ASSERT_DESC( exists, "test-operationV1-2.xml not found" ); |
|
1307 |
|
1308 // Define needed context |
|
1309 TInt err = iCFClient->DefineContext( |
|
1310 _L("operation.source"), _L("operation.type.v1"), passSec, passSec ); |
|
1311 EUNIT_ASSERT_DESC( err == KErrNone, "Define context failed" ); |
|
1312 |
|
1313 // Define needed action and subscribe it |
|
1314 err = iCFClient->DefineAction( _L("operationAction_v1"), passSec ); |
|
1315 EUNIT_ASSERT_DESC( err == KErrNone, "Define action failed" ); |
|
1316 |
|
1317 // x. Install operation v1 |
|
1318 // ------------------------------------------------------------------------- |
|
1319 SwiUI::TInstallOptionsPckg instOptionsPckg; |
|
1320 SetInstallOptions( instOptionsPckg ); |
|
1321 err = iSwInst.SilentInstall( KSisPath_V1, instOptionsPckg ); |
|
1322 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
1323 |
|
1324 iDelay->Start( KSecond * 2 ); |
|
1325 |
|
1326 // x. Register script test-operationV1-1.xml from first client |
|
1327 // ------------------------------------------------------------------------- |
|
1328 TInt scriptId1 = KErrNotFound; |
|
1329 err = iCFClient->RegisterScript( |
|
1330 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml"), scriptId1 ); |
|
1331 EUNIT_PRINT( _L("ResgisterScript: err =%d, scriptId = %d"), err, scriptId1 ); |
|
1332 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
1333 EUNIT_ASSERT_DESC( scriptId1 > 0, "Register script failed" ); |
|
1334 |
|
1335 // x. Register script test-operationV1-2.xml from second client |
|
1336 // ------------------------------------------------------------------------- |
|
1337 TInt scriptId2 = KErrNotFound; |
|
1338 err = cfClient2->RegisterScript( |
|
1339 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-2.xml"), scriptId2 ); |
|
1340 EUNIT_PRINT( _L("ResgisterScript: err =%d, scriptId = %d"), err, scriptId2 ); |
|
1341 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
1342 EUNIT_ASSERT_DESC( scriptId2 > 0, "Register script failed" ); |
|
1343 |
|
1344 // Delete client 2 |
|
1345 CleanupStack::PopAndDestroy( cfClient2 ); |
|
1346 |
|
1347 // x. Uninstall operation v1 |
|
1348 // ------------------------------------------------------------------------- |
|
1349 ResetScriptsRemovedL(); |
|
1350 SwiUI::TUninstallOptionsPckg uninstOptionsPckg; |
|
1351 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
1352 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
1353 err = iSwInst.SilentUninstall( TUid::Uid( KOperation_V1DllUid ), |
|
1354 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
1355 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
1356 |
|
1357 iDelay->Start( KSecond * 2 ); |
|
1358 |
|
1359 // x. Check that script removal for script 1 is notified |
|
1360 // ------------------------------------------------------------------------- |
|
1361 EUNIT_ASSERT_DESC( iScriptsRemovedNotified, "Script removal not notified" ); |
|
1362 TBool foundScriptId1 = EFalse; |
|
1363 for( TInt i = 0; i < iScriptIds.Count(); i++ ) |
|
1364 { |
|
1365 if( iScriptIds[i] == scriptId1 ) |
|
1366 { |
|
1367 foundScriptId1 = ETrue; |
|
1368 } |
|
1369 } |
|
1370 EUNIT_ASSERT_DESC( foundScriptId1, "Script id 1 not found" ); |
|
1371 |
|
1372 // x. Try to deregister and register scripts again |
|
1373 // ------------------------------------------------------------------------- |
|
1374 // Deregister script 1 - should fail |
|
1375 err = iCFClient->DeregisterScript( scriptId1 ); |
|
1376 EUNIT_PRINT( _L("DeregisterScript: err = %d"), err ); |
|
1377 EUNIT_ASSERT_DESC( err != KErrNone, "Deregister script failed" ); |
|
1378 |
|
1379 // Try to register script 1 again - should fail |
|
1380 scriptId1 = KErrNotFound; |
|
1381 err = iCFClient->RegisterScript( |
|
1382 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml"), scriptId1 ); |
|
1383 EUNIT_PRINT( _L("ResgisterScript: err = %d, scriptId = %d"), err, scriptId1 ); |
|
1384 EUNIT_ASSERT_DESC( err != KErrNone, "Register script failed" ); |
|
1385 |
|
1386 // x. Clean up |
|
1387 // ------------------------------------------------------------------------- |
|
1388 // Nothing to do. |
|
1389 } |
|
1390 |
|
1391 |
|
1392 void MT_CFSisUpgrade::MT_CFSisUpgrade_InstallCfSisUpgrade11L() |
|
1393 { |
|
1394 _LIT( KSisPath_V1, "z:\\data\\cftestdata\\testsis\\operation_v1\\operation.sisx" ); |
|
1395 _LIT( KSisPath_V2, "z:\\data\\cftestdata\\testsis\\operation_v2\\operation.sisx" ); |
|
1396 _LIT_SECURITY_POLICY_PASS( passSec ); |
|
1397 |
|
1398 CCFContextObject* co = CCFContextObject::NewLC(); |
|
1399 CCFActionSubscription* action = CCFActionSubscription::NewLC(); |
|
1400 |
|
1401 // x. Preconditions |
|
1402 // ------------------------------------------------------------------------- |
|
1403 TBool exists = BaflUtils::FileExists( iFs, KSisPath_V1 ); |
|
1404 EUNIT_ASSERT_DESC( exists, "Operation upgrade V1 not found" ); |
|
1405 exists = BaflUtils::FileExists( iFs, KSisPath_V2 ); |
|
1406 EUNIT_ASSERT_DESC( exists, "Operation upgrade V2 not found" ); |
|
1407 exists = BaflUtils::FileExists( |
|
1408 iFs, _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml") ); |
|
1409 EUNIT_ASSERT_DESC( exists, "test-operationV1-1.xml not found" ); |
|
1410 exists = BaflUtils::FileExists( |
|
1411 iFs, _L("z:\\data\\cftestdata\\testscripts\\test-operationV2.xml") ); |
|
1412 EUNIT_ASSERT_DESC( exists, "test-operationV2.xml not found" ); |
|
1413 |
|
1414 // Define needed context |
|
1415 co->SetSourceL( _L("operation.source") ); |
|
1416 co->SetTypeL( _L("operation.type.v1") ); |
|
1417 TInt err = iCFClient->DefineContext( co->Source(), co->Type(), passSec, passSec ); |
|
1418 EUNIT_ASSERT_DESC( err == KErrNone, "Define context failed" ); |
|
1419 |
|
1420 co->SetSourceL( _L("operation.source") ); |
|
1421 co->SetTypeL( _L("operation.type.v2") ); |
|
1422 err = iCFClient->DefineContext( co->Source(), co->Type(), passSec, passSec ); |
|
1423 EUNIT_ASSERT_DESC( err == KErrNone, "Define context failed" ); |
|
1424 |
|
1425 // Define needed action and subscribe it |
|
1426 action->SetActionIdentifierL( _L("operationAction_v1") ); |
|
1427 err = iCFClient->DefineAction( action->ActionIdentifier(), passSec ); |
|
1428 EUNIT_ASSERT_DESC( err == KErrNone, "Define action failed" ); |
|
1429 err = iCFClient->SubscribeAction( *action ); |
|
1430 EUNIT_ASSERT_DESC( err == KErrNone, "Subscribe action failed" ); |
|
1431 |
|
1432 action->SetActionIdentifierL( _L("operationAction_v2") ); |
|
1433 err = iCFClient->DefineAction( action->ActionIdentifier(), passSec ); |
|
1434 EUNIT_ASSERT_DESC( err == KErrNone, "Define action failed" ); |
|
1435 err = iCFClient->SubscribeAction( *action ); |
|
1436 EUNIT_ASSERT_DESC( err == KErrNone, "Subscribe action failed" ); |
|
1437 |
|
1438 // x. Install operation v1 |
|
1439 // ------------------------------------------------------------------------- |
|
1440 SwiUI::TInstallOptionsPckg instOptionsPckg; |
|
1441 SetInstallOptions( instOptionsPckg ); |
|
1442 err = iSwInst.SilentInstall( KSisPath_V1, instOptionsPckg ); |
|
1443 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
1444 |
|
1445 iDelay->Start( KSecond * 2 ); |
|
1446 |
|
1447 // x. Register test-operationV1-1.xml and check results |
|
1448 // ------------------------------------------------------------------------- |
|
1449 TInt scriptId = KErrNotFound; |
|
1450 err = iCFClient->RegisterScript( |
|
1451 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml"), scriptId ); |
|
1452 EUNIT_PRINT( _L("ResgisterScript: err =%d, scriptId = %d"), err, scriptId ); |
|
1453 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
1454 EUNIT_ASSERT_DESC( scriptId > 0, "Register script failed" ); |
|
1455 |
|
1456 // Publish context and check that action indication is received |
|
1457 ResetActionL(); |
|
1458 co->SetSourceL( _L("operation.source") ); |
|
1459 co->SetTypeL( _L("operation.type.v1") ); |
|
1460 co->SetValueL( _L("true") ); |
|
1461 err = iCFClient->PublishContext( *co ); |
|
1462 EUNIT_PRINT( _L("PublishContext: err = %d"), err ); |
|
1463 EUNIT_ASSERT_DESC( err == KErrNone, "Publish context failed" ); |
|
1464 |
|
1465 iDelay->Start( KSecond * 2 ); |
|
1466 |
|
1467 EUNIT_PRINT( _L("ActionIndication: [%d], [%S]"), iActionIndication, &iActionId ); |
|
1468 |
|
1469 EUNIT_ASSERT_DESC( iActionIndication, "Action indication not received" ); |
|
1470 EUNIT_ASSERT_DESC( iActionId == _L("operationAction_v1"), "Action indication incorrect" ); |
|
1471 |
|
1472 // x. Upgrade operation v1 with operation v2 |
|
1473 // ------------------------------------------------------------------------- |
|
1474 ResetScriptsRemovedL(); |
|
1475 SetInstallOptions( instOptionsPckg ); |
|
1476 err = iSwInst.SilentInstall( KSisPath_V2, instOptionsPckg ); |
|
1477 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
1478 |
|
1479 iDelay->Start( KSecond * 2 ); |
|
1480 |
|
1481 // x. Check that script removal for script 1 is notified |
|
1482 // ------------------------------------------------------------------------- |
|
1483 EUNIT_ASSERT_DESC( iScriptsRemovedNotified, "Script removal not notified" ); |
|
1484 TBool foundScriptId = EFalse; |
|
1485 for( TInt i = 0; i < iScriptIds.Count(); i++ ) |
|
1486 { |
|
1487 if( iScriptIds[i] == scriptId ) |
|
1488 { |
|
1489 foundScriptId = ETrue; |
|
1490 } |
|
1491 } |
|
1492 EUNIT_ASSERT_DESC( foundScriptId, "Script id not found" ); |
|
1493 |
|
1494 // x. Register test-operationV2.xml and check results |
|
1495 // ------------------------------------------------------------------------- |
|
1496 scriptId = KErrNotFound; |
|
1497 err = iCFClient->RegisterScript( |
|
1498 _L("z:\\data\\cftestdata\\testscripts\\test-operationV2.xml"), scriptId ); |
|
1499 EUNIT_PRINT( _L("ResgisterScript: err =%d, scriptId = %d"), err, scriptId ); |
|
1500 EUNIT_ASSERT_DESC( err == KErrNone, "Register script failed" ); |
|
1501 EUNIT_ASSERT_DESC( scriptId > 0, "Register script failed" ); |
|
1502 |
|
1503 // Publish context and check that action indication is received |
|
1504 ResetActionL(); |
|
1505 co->SetSourceL( _L("operation.source") ); |
|
1506 co->SetTypeL( _L("operation.type.v2") ); |
|
1507 co->SetValueL( _L("true") ); |
|
1508 err = iCFClient->PublishContext( *co ); |
|
1509 EUNIT_PRINT( _L("PublishContext: err = %d"), err ); |
|
1510 EUNIT_ASSERT_DESC( err == KErrNone, "Publish context failed" ); |
|
1511 |
|
1512 iDelay->Start( KSecond * 2 ); |
|
1513 |
|
1514 EUNIT_PRINT( _L("ActionIndication: [%d], [%S]"), iActionIndication, &iActionId ); |
|
1515 |
|
1516 EUNIT_ASSERT_DESC( iActionIndication, "Action indication not received" ); |
|
1517 EUNIT_ASSERT_DESC( iActionId == _L("operationAction_v2"), "Action indication incorrect" ); |
|
1518 |
|
1519 // x. Uninstall operation v2 |
|
1520 // ------------------------------------------------------------------------- |
|
1521 ResetScriptsRemovedL(); |
|
1522 SwiUI::TUninstallOptionsPckg uninstOptionsPckg; |
|
1523 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
1524 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
1525 err = iSwInst.SilentUninstall( TUid::Uid( KOperation_V1DllUid ), |
|
1526 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
1527 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
1528 |
|
1529 iDelay->Start( KSecond * 2 ); |
|
1530 |
|
1531 // x. Check that script removal for script 1 is notified |
|
1532 // ------------------------------------------------------------------------- |
|
1533 EUNIT_ASSERT_DESC( iScriptsRemovedNotified, "Script removal not notified" ); |
|
1534 foundScriptId = EFalse; |
|
1535 for( TInt i = 0; i < iScriptIds.Count(); i++ ) |
|
1536 { |
|
1537 if( iScriptIds[i] == scriptId ) |
|
1538 { |
|
1539 foundScriptId = ETrue; |
|
1540 } |
|
1541 } |
|
1542 EUNIT_ASSERT_DESC( foundScriptId, "Script id not found" ); |
|
1543 |
|
1544 // x. Try to deregister and register test-operationV2.xml |
|
1545 // ------------------------------------------------------------------------- |
|
1546 // Deregister script 1 - should fail |
|
1547 err = iCFClient->DeregisterScript( scriptId ); |
|
1548 EUNIT_PRINT( _L("DeregisterScript: err = %d"), err ); |
|
1549 EUNIT_ASSERT_DESC( err != KErrNone, "Deregister script failed" ); |
|
1550 |
|
1551 // Try to register script 1 again - should fail |
|
1552 scriptId = KErrNotFound; |
|
1553 err = iCFClient->RegisterScript( |
|
1554 _L("z:\\data\\cftestdata\\testscripts\\test-operationV2.xml"), scriptId ); |
|
1555 EUNIT_PRINT( _L("ResgisterScript: err = %d, scriptId = %d"), err, scriptId ); |
|
1556 EUNIT_ASSERT_DESC( err != KErrNone, "Register script failed" ); |
|
1557 |
|
1558 // x. Clean up |
|
1559 // ------------------------------------------------------------------------- |
|
1560 CleanupStack::PopAndDestroy( action ); |
|
1561 CleanupStack::PopAndDestroy( co ); |
|
1562 } |
|
1563 |
|
1564 |
|
1565 void MT_CFSisUpgrade::MT_CFSisUpgrade_InstallCfSisUpgrade12L() |
|
1566 { |
|
1567 _LIT( KSisPath_V1, "z:\\data\\cftestdata\\testsis\\operation_v1\\operation.sisx" ); |
|
1568 _LIT( KSisPath_V3, "z:\\data\\cftestdata\\testsis\\operation_v3\\operation.sisx" ); |
|
1569 _LIT_SECURITY_POLICY_PASS( passSec ); |
|
1570 |
|
1571 CCFContextObject* co = CCFContextObject::NewLC(); |
|
1572 CCFActionSubscription* action = CCFActionSubscription::NewLC(); |
|
1573 |
|
1574 // x. Preconditions |
|
1575 // ------------------------------------------------------------------------- |
|
1576 TBool exists = BaflUtils::FileExists( iFs, KSisPath_V1 ); |
|
1577 EUNIT_ASSERT_DESC( exists, "Operation upgrade V1 not found" ); |
|
1578 exists = BaflUtils::FileExists( iFs, KSisPath_V3 ); |
|
1579 EUNIT_ASSERT_DESC( exists, "Operation upgrade V3 not found" ); |
|
1580 |
|
1581 exists = BaflUtils::FileExists( |
|
1582 iFs, _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml") ); |
|
1583 EUNIT_ASSERT_DESC( exists, "test-operationV1-1.xml not found" ); |
|
1584 |
|
1585 // Define needed context |
|
1586 co->SetSourceL( _L("operation.source") ); |
|
1587 co->SetTypeL( _L("operation.type.v1") ); |
|
1588 TInt err = iCFClient->DefineContext( co->Source(), co->Type(), passSec, passSec ); |
|
1589 EUNIT_ASSERT_DESC( err == KErrNone, "Define context failed" ); |
|
1590 |
|
1591 // Define needed action and subscribe it |
|
1592 action->SetActionIdentifierL( _L("operationAction_v1") ); |
|
1593 err = iCFClient->DefineAction( action->ActionIdentifier(), passSec ); |
|
1594 EUNIT_ASSERT_DESC( err == KErrNone, "Define action failed" ); |
|
1595 err = iCFClient->SubscribeAction( *action ); |
|
1596 EUNIT_ASSERT_DESC( err == KErrNone, "Subscribe action failed" ); |
|
1597 |
|
1598 // x. Install operation v1 |
|
1599 // ------------------------------------------------------------------------- |
|
1600 SwiUI::TInstallOptionsPckg instOptionsPckg; |
|
1601 SetInstallOptions( instOptionsPckg ); |
|
1602 err = iSwInst.SilentInstall( KSisPath_V1, instOptionsPckg ); |
|
1603 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
1604 |
|
1605 iDelay->Start( KSecond * 2 ); |
|
1606 |
|
1607 // x. Save script test-operationV1-1.xml |
|
1608 // ------------------------------------------------------------------------- |
|
1609 TInt scriptId = KErrNotFound; |
|
1610 err = iCFClient->SaveScript( |
|
1611 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml"), |
|
1612 scriptId ); |
|
1613 EUNIT_PRINT( _L("SaveScript: err = %d"), err ); |
|
1614 EUNIT_ASSERT_DESC( err == KErrNone, "Save script failed" ); |
|
1615 |
|
1616 // check that script is really saved and activated |
|
1617 ResetActionL(); |
|
1618 co->SetSourceL( _L("operation.source") ); |
|
1619 co->SetTypeL( _L("operation.type.v1") ); |
|
1620 co->SetValueL( _L("true") ); |
|
1621 err = iCFClient->PublishContext( *co ); |
|
1622 EUNIT_PRINT( _L("PublishContext: err = %d" ), err ); |
|
1623 EUNIT_ASSERT_DESC( err == KErrNone, "Publish context failed" ); |
|
1624 |
|
1625 iDelay->Start( KSecond * 2 ); |
|
1626 |
|
1627 // check that action indication is received |
|
1628 EUNIT_PRINT( _L("ActionIndication: [%d], [%S]"), iActionIndication, &iActionId ); |
|
1629 |
|
1630 EUNIT_ASSERT_DESC( iActionIndication, "Action indication not received" ); |
|
1631 EUNIT_ASSERT_DESC( iActionId == _L("operationAction_v1"), "Action indication incorrect" ); |
|
1632 |
|
1633 // x. Install operation v3 |
|
1634 // ------------------------------------------------------------------------- |
|
1635 ResetScriptsRemovedL(); |
|
1636 SetInstallOptions( instOptionsPckg ); |
|
1637 err = iSwInst.SilentInstall( KSisPath_V3, instOptionsPckg ); |
|
1638 EUNIT_PRINT( _L("SilentInstall: err = %d"), err ); |
|
1639 |
|
1640 iDelay->Start( KSecond * 2 ); |
|
1641 |
|
1642 // check that script removal is not informed |
|
1643 EUNIT_ASSERT_DESC( !iScriptsRemovedNotified, "Script removal notification error" ); |
|
1644 |
|
1645 // check that script has been automatically re-loaded |
|
1646 ResetActionL(); |
|
1647 co->SetSourceL( _L("operation.source") ); |
|
1648 co->SetTypeL( _L("operation.type.v1") ); |
|
1649 co->SetValueL( _L("true") ); |
|
1650 err = iCFClient->PublishContext( *co ); |
|
1651 EUNIT_PRINT( _L("PublishContext: err = %d" ), err ); |
|
1652 EUNIT_ASSERT_DESC( err == KErrNone, "Publish context failed" ); |
|
1653 |
|
1654 iDelay->Start( KSecond * 2 ); |
|
1655 |
|
1656 // check that action indication is received |
|
1657 EUNIT_PRINT( _L("ActionIndication: [%d], [%S]"), iActionIndication, &iActionId ); |
|
1658 |
|
1659 EUNIT_ASSERT_DESC( iActionIndication, "Action indication not received" ); |
|
1660 EUNIT_ASSERT_DESC( iActionId == _L("operationAction_v1"), "Action indication incorrect" ); |
|
1661 |
|
1662 // x. Uninstall operation v3 |
|
1663 // ------------------------------------------------------------------------- |
|
1664 ResetScriptsRemovedL(); |
|
1665 SwiUI::TUninstallOptionsPckg uninstOptionsPckg; |
|
1666 uninstOptionsPckg().iKillApp = SwiUI::EPolicyAllowed; |
|
1667 uninstOptionsPckg().iBreakDependency = SwiUI::EPolicyAllowed; |
|
1668 err = iSwInst.SilentUninstall( TUid::Uid( KOperation_V1DllUid ), |
|
1669 uninstOptionsPckg, SwiUI::KSisxMimeType ); |
|
1670 EUNIT_PRINT( _L("SilentUninstall: err = %d"), err ); |
|
1671 |
|
1672 iDelay->Start( KSecond * 2 ); |
|
1673 |
|
1674 // check that script removal is not informed |
|
1675 EUNIT_ASSERT_DESC( !iScriptsRemovedNotified, "Script removal notification error" ); |
|
1676 |
|
1677 // delete script |
|
1678 err = iCFClient->DeleteScript( |
|
1679 _L("z:\\data\\cftestdata\\testscripts\\test-operationV1-1.xml") ); |
|
1680 EUNIT_PRINT( _L("DeleteScript: err = %d"), err ); |
|
1681 EUNIT_ASSERT_DESC( err == KErrNone, "Delete script failed" ); |
|
1682 |
|
1683 // check that script has been correctly deleted |
|
1684 ResetActionL(); |
|
1685 co->SetSourceL( _L("operation.source") ); |
|
1686 co->SetTypeL( _L("operation.type.v1") ); |
|
1687 co->SetValueL( _L("true") ); |
|
1688 err = iCFClient->PublishContext( *co ); |
|
1689 EUNIT_PRINT( _L("PublishContext: err = %d" ), err ); |
|
1690 EUNIT_ASSERT_DESC( err == KErrNone, "Publish context failed" ); |
|
1691 |
|
1692 iDelay->Start( KSecond * 2 ); |
|
1693 |
|
1694 EUNIT_ASSERT_DESC( !iActionIndication, "Action indication still received" ); |
|
1695 |
|
1696 // x. Clean up |
|
1697 // ------------------------------------------------------------------------- |
|
1698 CleanupStack::PopAndDestroy( action ); |
|
1699 CleanupStack::PopAndDestroy( co ); |
|
1700 } |
|
1701 |
|
1702 |
|
1703 // TEST TABLE |
|
1704 EUNIT_BEGIN_TEST_TABLE( |
|
1705 MT_CFSisUpgrade, |
|
1706 "Add test suite description here.", |
|
1707 "MODULE" ) |
|
1708 |
|
1709 EUNIT_TEST( |
|
1710 "Context Source Sis - 1", |
|
1711 "", |
|
1712 "MT_CFSisUpgrade_InstallCfSisUpgrade1L", |
|
1713 "FUNCTIONALITY", |
|
1714 SetupL, MT_CFSisUpgrade_InstallCfSisUpgrade1L, Teardown) |
|
1715 |
|
1716 EUNIT_TEST( |
|
1717 "Context Source Sis - 2", |
|
1718 "", |
|
1719 "MT_CFSisUpgrade_InstallCfSisUpgrade2L", |
|
1720 "FUNCTIONALITY", |
|
1721 SetupL, MT_CFSisUpgrade_InstallCfSisUpgrade2L, Teardown) |
|
1722 |
|
1723 EUNIT_TEST( |
|
1724 "Context Source Sis - 3", |
|
1725 "", |
|
1726 "MT_CFSisUpgrade_InstallCfSisUpgrade3L", |
|
1727 "FUNCTIONALITY", |
|
1728 SetupL, MT_CFSisUpgrade_InstallCfSisUpgrade3L, Teardown) |
|
1729 |
|
1730 EUNIT_TEST( |
|
1731 "Action Sis - 1", |
|
1732 "", |
|
1733 "MT_CFSisUpgrade_InstallCfSisUpgrade4L", |
|
1734 "FUNCTIONALITY", |
|
1735 SetupL, MT_CFSisUpgrade_InstallCfSisUpgrade4L, Teardown) |
|
1736 |
|
1737 EUNIT_TEST( |
|
1738 "Action Sis - 2", |
|
1739 "", |
|
1740 "MT_CFSisUpgrade_InstallCfSisUpgrade5L", |
|
1741 "FUNCTIONALITY", |
|
1742 SetupL, MT_CFSisUpgrade_InstallCfSisUpgrade5L, Teardown) |
|
1743 |
|
1744 EUNIT_TEST( |
|
1745 "Operation Sis - 1", |
|
1746 "", |
|
1747 "MT_CFSisUpgrade_InstallCfSisUpgrade6L", |
|
1748 "FUNCTIONALITY", |
|
1749 SetupL, MT_CFSisUpgrade_InstallCfSisUpgrade6L, Teardown) |
|
1750 |
|
1751 EUNIT_TEST( |
|
1752 "Operation Sis - 2", |
|
1753 "", |
|
1754 "MT_CFSisUpgrade_InstallCfSisUpgrade7L", |
|
1755 "FUNCTIONALITY", |
|
1756 SetupL, MT_CFSisUpgrade_InstallCfSisUpgrade7L, Teardown) |
|
1757 |
|
1758 EUNIT_TEST( |
|
1759 "Operation Sis - 3", |
|
1760 "", |
|
1761 "MT_CFSisUpgrade_InstallCfSisUpgrade8L", |
|
1762 "FUNCTIONALITY", |
|
1763 SetupL, MT_CFSisUpgrade_InstallCfSisUpgrade8L, Teardown) |
|
1764 |
|
1765 EUNIT_TEST( |
|
1766 "Operation Sis - 4", |
|
1767 "", |
|
1768 "MT_CFSisUpgrade_InstallCfSisUpgrade9L", |
|
1769 "FUNCTIONALITY", |
|
1770 SetupL, MT_CFSisUpgrade_InstallCfSisUpgrade9L, Teardown) |
|
1771 |
|
1772 EUNIT_TEST( |
|
1773 "Operation Sis - 5", |
|
1774 "", |
|
1775 "MT_CFSisUpgrade_InstallCfSisUpgrade10L", |
|
1776 "FUNCTIONALITY", |
|
1777 SetupL, MT_CFSisUpgrade_InstallCfSisUpgrade10L, Teardown) |
|
1778 |
|
1779 EUNIT_TEST( |
|
1780 "Operation Sis - 6", |
|
1781 "", |
|
1782 "MT_CFSisUpgrade_InstallCfSisUpgrade11L", |
|
1783 "FUNCTIONALITY", |
|
1784 SetupL, MT_CFSisUpgrade_InstallCfSisUpgrade11L, Teardown) |
|
1785 |
|
1786 EUNIT_TEST( |
|
1787 "Operation Sis - 7", |
|
1788 "", |
|
1789 "MT_CFSisUpgrade_InstallCfSisUpgrade12L", |
|
1790 "FUNCTIONALITY", |
|
1791 SetupL, MT_CFSisUpgrade_InstallCfSisUpgrade12L, Teardown) |
|
1792 |
|
1793 EUNIT_END_TEST_TABLE |
|
1794 |
|
1795 // END OF FILE |