28 _LIT( KTestTag, "SLU" ); |
28 _LIT( KTestTag, "SLU" ); |
29 _LIT( KTestStartFormat, "%S: start" ); |
29 _LIT( KTestStartFormat, "%S: start" ); |
30 _LIT( KTestParamFormatArg, "%S: %S => %d"); |
30 _LIT( KTestParamFormatArg, "%S: %S => %d"); |
31 _LIT( KTestDoneFormat, "%S: done" ); |
31 _LIT( KTestDoneFormat, "%S: done" ); |
32 |
32 |
|
33 _LIT( KStartupListUpdaterThread, "StartupListUpdater" ); |
|
34 _LIT( KDevTraceDir, "c:\\data\\logs\\swinst\\" ); |
|
35 |
33 using namespace Usif; |
36 using namespace Usif; |
34 |
37 |
35 |
38 |
36 // ======== LOCAL FUNCTIONS ======== |
39 // ======== LOCAL FUNCTIONS ======== |
37 |
40 |
79 static TStifFunctionInfo const KFunctions[] = |
82 static TStifFunctionInfo const KFunctions[] = |
80 { |
83 { |
81 ENTRY( "Install", CTestStartupListUpdater::InstallL ), |
84 ENTRY( "Install", CTestStartupListUpdater::InstallL ), |
82 ENTRY( "Remove", CTestStartupListUpdater::RemoveL ), |
85 ENTRY( "Remove", CTestStartupListUpdater::RemoveL ), |
83 ENTRY( "InStartList", CTestStartupListUpdater::CheckStartListContainsL ), |
86 ENTRY( "InStartList", CTestStartupListUpdater::CheckStartListContainsL ), |
84 ENTRY( "NotInStartList", CTestStartupListUpdater::CheckStartListDoesNotContainL ) |
87 ENTRY( "NotInStartList", CTestStartupListUpdater::CheckStartListDoesNotContainL ), |
|
88 ENTRY( "MkLogDir", CTestStartupListUpdater::MakeDevTraceLogDirL ), |
|
89 ENTRY( "RmLogDir", CTestStartupListUpdater::RemoveDevTraceLogDirL ), |
|
90 ENTRY( "WaitImportProcessing", CTestStartupListUpdater::WaitImportProcessingL ) |
85 }; |
91 }; |
86 |
92 |
87 const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); |
93 const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); |
88 return RunInternalL( KFunctions, count, aItem ); |
94 return RunInternalL( KFunctions, count, aItem ); |
89 } |
95 } |
105 TPtrC param; |
111 TPtrC param; |
106 while ( aItem.GetNextString ( param ) == KErrNone ) |
112 while ( aItem.GetNextString ( param ) == KErrNone ) |
107 { |
113 { |
108 COpaqueNamedParams* args = COpaqueNamedParams::NewLC(); |
114 COpaqueNamedParams* args = COpaqueNamedParams::NewLC(); |
109 COpaqueNamedParams* results = COpaqueNamedParams::NewLC(); |
115 COpaqueNamedParams* results = COpaqueNamedParams::NewLC(); |
110 args->AddIntL( KSifInParam_InstallSilently, 1 ); |
116 args->AddIntL( KSifInParam_InstallSilently, ETrue ); |
111 |
117 |
112 TRequestStatus status; |
118 TRequestStatus status; |
113 installer.Install( param, *args, *results, status ); |
119 installer.Install( param, *args, *results, status ); |
114 User::WaitForRequest( status ); |
120 User::WaitForRequest( status ); |
115 testResult = status.Int(); |
121 testResult = status.Int(); |
321 CleanupStack::PopAndDestroy( item ); |
327 CleanupStack::PopAndDestroy( item ); |
322 } |
328 } |
323 |
329 |
324 CleanupStack::PopAndDestroy( 2, &dscStore ); // EnumClose, dscStore |
330 CleanupStack::PopAndDestroy( 2, &dscStore ); // EnumClose, dscStore |
325 } |
331 } |
|
332 |
|
333 // --------------------------------------------------------------------------- |
|
334 // CTestStartupListUpdater::MakeDevTraceLogDirL() |
|
335 // --------------------------------------------------------------------------- |
|
336 // |
|
337 TInt CTestStartupListUpdater::MakeDevTraceLogDirL( CStifItemParser& /*aItem*/ ) |
|
338 { |
|
339 _LIT( KTestName, "MkLogDir" ); |
|
340 Print( 0, KTestStartFormat, &KTestName ); |
|
341 TInt testResult = KErrNone; |
|
342 |
|
343 RFs fs; |
|
344 User::LeaveIfError( fs.Connect() ); |
|
345 CleanupClosePushL( fs ); |
|
346 |
|
347 TEntry entry; |
|
348 TInt err = fs.Entry( KDevTraceDir, entry ); |
|
349 if( err == KErrNone ) |
|
350 { |
|
351 testResult = fs.MkDirAll( KDevTraceDir ); |
|
352 } |
|
353 else if( err == KErrAlreadyExists ) |
|
354 { |
|
355 // nothing to do |
|
356 } |
|
357 else |
|
358 { |
|
359 User::Leave( err ); |
|
360 } |
|
361 |
|
362 CleanupStack::PopAndDestroy( &fs ); |
|
363 return testResult; |
|
364 } |
|
365 |
|
366 // --------------------------------------------------------------------------- |
|
367 // CTestStartupListUpdater::RemoveDevTraceLogDirL() |
|
368 // --------------------------------------------------------------------------- |
|
369 // |
|
370 TInt CTestStartupListUpdater::RemoveDevTraceLogDirL( CStifItemParser& /*aItem*/ ) |
|
371 { |
|
372 _LIT( KTestName, "RmLogDir" ); |
|
373 Print( 0, KTestStartFormat, &KTestName ); |
|
374 TInt testResult = KErrNone; |
|
375 |
|
376 RFs fs; |
|
377 User::LeaveIfError( fs.Connect() ); |
|
378 CleanupClosePushL( fs ); |
|
379 |
|
380 TEntry entry; |
|
381 if( fs.Entry( KDevTraceDir, entry ) == KErrNone ) |
|
382 { |
|
383 CFileMan* fileMan = CFileMan::NewL( fs ); |
|
384 CleanupStack::PushL( fileMan ); |
|
385 testResult = fileMan->RmDir( KDevTraceDir ); |
|
386 CleanupStack::PopAndDestroy( fileMan ); |
|
387 } |
|
388 // else nothing to do |
|
389 |
|
390 CleanupStack::PopAndDestroy( &fs ); |
|
391 return testResult; |
|
392 } |
|
393 |
|
394 // --------------------------------------------------------------------------- |
|
395 // CTestStartupListUpdater::WaitImportProcessingL() |
|
396 // --------------------------------------------------------------------------- |
|
397 // |
|
398 TInt CTestStartupListUpdater::WaitImportProcessingL( CStifItemParser& /*aItem*/ ) |
|
399 { |
|
400 _LIT( KTestName, "WaitImportProcessing" ); |
|
401 Print( 0, KTestStartFormat, &KTestName ); |
|
402 TInt testResult = KErrNone; |
|
403 |
|
404 TFullName name( KStartupListUpdaterThread ); |
|
405 name.Append( '*' ); |
|
406 TFindThread findThread; |
|
407 if( findThread.Next( name ) == KErrNone ) |
|
408 { |
|
409 RThread thread; |
|
410 CleanupClosePushL( thread ); |
|
411 |
|
412 User::LeaveIfError( thread.Open( name ) ); |
|
413 TRequestStatus status; |
|
414 thread.Logon( status ); |
|
415 User::WaitForRequest( status ); |
|
416 testResult = status.Int(); |
|
417 |
|
418 CleanupStack::PopAndDestroy( &thread ); |
|
419 } |
|
420 |
|
421 return testResult; |
|
422 } |
|
423 |
|
424 |