sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: sl@0: #include "dummyswi.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include //CCommandLineArguments sl@0: sl@0: // This exe is used to simulate the Software Installer behaviour of setting and resetting sl@0: // the P&S KSAUidSoftwareInstallKeyValue property. sl@0: sl@0: LOCAL_C void DoStartL() sl@0: { sl@0: CCommandLineArguments* args = CCommandLineArguments::NewLC(); sl@0: TInt i = args->Count(); sl@0: sl@0: if ( args->Count() == 2 ) sl@0: { sl@0: TLex tlex(args->Arg(1)); sl@0: TInt argVal = 0; sl@0: if ( tlex.Val(argVal) == KErrNone ) sl@0: { sl@0: RProperty propertyHndl; sl@0: User::LeaveIfError(propertyHndl.Attach(KUidSystemCategory, KSAUidSoftwareInstallKeyValue)); sl@0: TInt initialVal = 0; sl@0: sl@0: // Get initial value sl@0: TInt err = propertyHndl.Get(initialVal); sl@0: sl@0: // 1 => Successful installation sl@0: // 4 => Successful uninstallation sl@0: if(argVal == 1 || argVal == 4 ) sl@0: { sl@0: // Imitate the start of SWI sl@0: TInt val = initialVal; sl@0: if(argVal == 1) sl@0: { sl@0: val |= ESASwisInstall; sl@0: } sl@0: else sl@0: { sl@0: val |= ESASwisUninstall; sl@0: } sl@0: err = propertyHndl.Set(val); sl@0: sl@0: // Wait for the test case to finish and for the P&S value to be set sl@0: User::After(1200000); sl@0: sl@0: // Imitate the successful completion of SWI sl@0: val |= ESASwisStatusSuccess; sl@0: err = propertyHndl.Set(val); sl@0: sl@0: // wait for RProperty::Set() to complete sl@0: User::After(100000); sl@0: } sl@0: // 2 => Aborted installation sl@0: // 3 => Hanging installation sl@0: // 5 => Aborted uninstallation sl@0: // 6 =? Hanging uninstallation sl@0: else if(argVal == 2 || argVal == 3 || argVal == 5 || argVal == 6) sl@0: { sl@0: // Imitate the start of SWI sl@0: TInt val = initialVal; sl@0: if( argVal == 2 || argVal == 3) sl@0: { sl@0: val |= ESASwisInstall; sl@0: } sl@0: else sl@0: { sl@0: val |= ESASwisUninstall; sl@0: } sl@0: err = propertyHndl.Set(val); sl@0: sl@0: // Wait for the test case to finish sl@0: if( argVal == 3 || argVal == 6 ) sl@0: { sl@0: User::After(16500000); sl@0: } sl@0: else sl@0: { sl@0: User::After(1200000); sl@0: } sl@0: sl@0: // Imitate the successful completion of SWI sl@0: val |= ESASwisStatusAborted; sl@0: err = propertyHndl.Set(val); sl@0: sl@0: // wait for RProperty::Set() to complete sl@0: User::After(100000); sl@0: } sl@0: // Reset initial value for P&S install property sl@0: err = propertyHndl.Set(initialVal); sl@0: propertyHndl.Close(); sl@0: } sl@0: } sl@0: CleanupStack::PopAndDestroy(); //args sl@0: } sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: __UHEAP_MARK; sl@0: CTrapCleanup* cleanup = CTrapCleanup::New(); sl@0: TRAPD( err, DoStartL() ); sl@0: delete cleanup; sl@0: __UHEAP_MARKEND; sl@0: return err; sl@0: }