Update contrib.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
20 #include <e32property.h>
22 #include <bacline.h> //CCommandLineArguments
24 // This exe is used to simulate the Software Installer behaviour of setting and resetting
25 // the P&S KSAUidSoftwareInstallKeyValue property.
27 LOCAL_C void DoStartL()
29 CCommandLineArguments* args = CCommandLineArguments::NewLC();
30 TInt i = args->Count();
32 if ( args->Count() == 2 )
34 TLex tlex(args->Arg(1));
36 if ( tlex.Val(argVal) == KErrNone )
38 RProperty propertyHndl;
39 User::LeaveIfError(propertyHndl.Attach(KUidSystemCategory, KSAUidSoftwareInstallKeyValue));
43 TInt err = propertyHndl.Get(initialVal);
45 // 1 => Successful installation
46 // 4 => Successful uninstallation
47 if(argVal == 1 || argVal == 4 )
49 // Imitate the start of SWI
50 TInt val = initialVal;
53 val |= ESASwisInstall;
57 val |= ESASwisUninstall;
59 err = propertyHndl.Set(val);
61 // Wait for the test case to finish and for the P&S value to be set
64 // Imitate the successful completion of SWI
65 val |= ESASwisStatusSuccess;
66 err = propertyHndl.Set(val);
68 // wait for RProperty::Set() to complete
71 // 2 => Aborted installation
72 // 3 => Hanging installation
73 // 5 => Aborted uninstallation
74 // 6 =? Hanging uninstallation
75 else if(argVal == 2 || argVal == 3 || argVal == 5 || argVal == 6)
77 // Imitate the start of SWI
78 TInt val = initialVal;
79 if( argVal == 2 || argVal == 3)
81 val |= ESASwisInstall;
85 val |= ESASwisUninstall;
87 err = propertyHndl.Set(val);
89 // Wait for the test case to finish
90 if( argVal == 3 || argVal == 6 )
92 User::After(16500000);
99 // Imitate the successful completion of SWI
100 val |= ESASwisStatusAborted;
101 err = propertyHndl.Set(val);
103 // wait for RProperty::Set() to complete
106 // Reset initial value for P&S install property
107 err = propertyHndl.Set(initialVal);
108 propertyHndl.Close();
111 CleanupStack::PopAndDestroy(); //args
114 GLDEF_C TInt E32Main()
117 CTrapCleanup* cleanup = CTrapCleanup::New();
118 TRAPD( err, DoStartL() );