author | sl |
Tue, 10 Jun 2014 14:32:02 +0200 | |
changeset 1 | 260cb5ec6c19 |
permissions | -rw-r--r-- |
sl@0 | 1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
sl@0 | 2 |
// All rights reserved. |
sl@0 | 3 |
// This component and the accompanying materials are made available |
sl@0 | 4 |
// under the terms of "Eclipse Public License v1.0" |
sl@0 | 5 |
// which accompanies this distribution, and is available |
sl@0 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
sl@0 | 7 |
// |
sl@0 | 8 |
// Initial Contributors: |
sl@0 | 9 |
// Nokia Corporation - initial contribution. |
sl@0 | 10 |
// |
sl@0 | 11 |
// Contributors: |
sl@0 | 12 |
// |
sl@0 | 13 |
// Description: |
sl@0 | 14 |
// |
sl@0 | 15 |
|
sl@0 | 16 |
|
sl@0 | 17 |
#include "dummyswi.h" |
sl@0 | 18 |
#include <e32base.h> |
sl@0 | 19 |
#include <eikenv.h> |
sl@0 | 20 |
#include <e32property.h> |
sl@0 | 21 |
#include <sacls.h> |
sl@0 | 22 |
#include <bacline.h> //CCommandLineArguments |
sl@0 | 23 |
|
sl@0 | 24 |
// This exe is used to simulate the Software Installer behaviour of setting and resetting |
sl@0 | 25 |
// the P&S KSAUidSoftwareInstallKeyValue property. |
sl@0 | 26 |
|
sl@0 | 27 |
LOCAL_C void DoStartL() |
sl@0 | 28 |
{ |
sl@0 | 29 |
CCommandLineArguments* args = CCommandLineArguments::NewLC(); |
sl@0 | 30 |
TInt i = args->Count(); |
sl@0 | 31 |
|
sl@0 | 32 |
if ( args->Count() == 2 ) |
sl@0 | 33 |
{ |
sl@0 | 34 |
TLex tlex(args->Arg(1)); |
sl@0 | 35 |
TInt argVal = 0; |
sl@0 | 36 |
if ( tlex.Val(argVal) == KErrNone ) |
sl@0 | 37 |
{ |
sl@0 | 38 |
RProperty propertyHndl; |
sl@0 | 39 |
User::LeaveIfError(propertyHndl.Attach(KUidSystemCategory, KSAUidSoftwareInstallKeyValue)); |
sl@0 | 40 |
TInt initialVal = 0; |
sl@0 | 41 |
|
sl@0 | 42 |
// Get initial value |
sl@0 | 43 |
TInt err = propertyHndl.Get(initialVal); |
sl@0 | 44 |
|
sl@0 | 45 |
// 1 => Successful installation |
sl@0 | 46 |
// 4 => Successful uninstallation |
sl@0 | 47 |
if(argVal == 1 || argVal == 4 ) |
sl@0 | 48 |
{ |
sl@0 | 49 |
// Imitate the start of SWI |
sl@0 | 50 |
TInt val = initialVal; |
sl@0 | 51 |
if(argVal == 1) |
sl@0 | 52 |
{ |
sl@0 | 53 |
val |= ESASwisInstall; |
sl@0 | 54 |
} |
sl@0 | 55 |
else |
sl@0 | 56 |
{ |
sl@0 | 57 |
val |= ESASwisUninstall; |
sl@0 | 58 |
} |
sl@0 | 59 |
err = propertyHndl.Set(val); |
sl@0 | 60 |
|
sl@0 | 61 |
// Wait for the test case to finish and for the P&S value to be set |
sl@0 | 62 |
User::After(1200000); |
sl@0 | 63 |
|
sl@0 | 64 |
// Imitate the successful completion of SWI |
sl@0 | 65 |
val |= ESASwisStatusSuccess; |
sl@0 | 66 |
err = propertyHndl.Set(val); |
sl@0 | 67 |
|
sl@0 | 68 |
// wait for RProperty::Set() to complete |
sl@0 | 69 |
User::After(100000); |
sl@0 | 70 |
} |
sl@0 | 71 |
// 2 => Aborted installation |
sl@0 | 72 |
// 3 => Hanging installation |
sl@0 | 73 |
// 5 => Aborted uninstallation |
sl@0 | 74 |
// 6 =? Hanging uninstallation |
sl@0 | 75 |
else if(argVal == 2 || argVal == 3 || argVal == 5 || argVal == 6) |
sl@0 | 76 |
{ |
sl@0 | 77 |
// Imitate the start of SWI |
sl@0 | 78 |
TInt val = initialVal; |
sl@0 | 79 |
if( argVal == 2 || argVal == 3) |
sl@0 | 80 |
{ |
sl@0 | 81 |
val |= ESASwisInstall; |
sl@0 | 82 |
} |
sl@0 | 83 |
else |
sl@0 | 84 |
{ |
sl@0 | 85 |
val |= ESASwisUninstall; |
sl@0 | 86 |
} |
sl@0 | 87 |
err = propertyHndl.Set(val); |
sl@0 | 88 |
|
sl@0 | 89 |
// Wait for the test case to finish |
sl@0 | 90 |
if( argVal == 3 || argVal == 6 ) |
sl@0 | 91 |
{ |
sl@0 | 92 |
User::After(16500000); |
sl@0 | 93 |
} |
sl@0 | 94 |
else |
sl@0 | 95 |
{ |
sl@0 | 96 |
User::After(1200000); |
sl@0 | 97 |
} |
sl@0 | 98 |
|
sl@0 | 99 |
// Imitate the successful completion of SWI |
sl@0 | 100 |
val |= ESASwisStatusAborted; |
sl@0 | 101 |
err = propertyHndl.Set(val); |
sl@0 | 102 |
|
sl@0 | 103 |
// wait for RProperty::Set() to complete |
sl@0 | 104 |
User::After(100000); |
sl@0 | 105 |
} |
sl@0 | 106 |
// Reset initial value for P&S install property |
sl@0 | 107 |
err = propertyHndl.Set(initialVal); |
sl@0 | 108 |
propertyHndl.Close(); |
sl@0 | 109 |
} |
sl@0 | 110 |
} |
sl@0 | 111 |
CleanupStack::PopAndDestroy(); //args |
sl@0 | 112 |
} |
sl@0 | 113 |
|
sl@0 | 114 |
GLDEF_C TInt E32Main() |
sl@0 | 115 |
{ |
sl@0 | 116 |
__UHEAP_MARK; |
sl@0 | 117 |
CTrapCleanup* cleanup = CTrapCleanup::New(); |
sl@0 | 118 |
TRAPD( err, DoStartL() ); |
sl@0 | 119 |
delete cleanup; |
sl@0 | 120 |
__UHEAP_MARKEND; |
sl@0 | 121 |
return err; |
sl@0 | 122 |
} |