|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #include "dummyswi.h" |
|
18 #include <e32base.h> |
|
19 #include <eikenv.h> |
|
20 #include <e32property.h> |
|
21 #include <sacls.h> |
|
22 #include <bacline.h> //CCommandLineArguments |
|
23 |
|
24 // This exe is used to simulate the Software Installer behaviour of setting and resetting |
|
25 // the P&S KSAUidSoftwareInstallKeyValue property. |
|
26 |
|
27 LOCAL_C void DoStartL() |
|
28 { |
|
29 CCommandLineArguments* args = CCommandLineArguments::NewLC(); |
|
30 TInt i = args->Count(); |
|
31 |
|
32 if ( args->Count() == 2 ) |
|
33 { |
|
34 TLex tlex(args->Arg(1)); |
|
35 TInt argVal = 0; |
|
36 if ( tlex.Val(argVal) == KErrNone ) |
|
37 { |
|
38 RProperty propertyHndl; |
|
39 User::LeaveIfError(propertyHndl.Attach(KUidSystemCategory, KSAUidSoftwareInstallKeyValue)); |
|
40 TInt initialVal = 0; |
|
41 |
|
42 // Get initial value |
|
43 TInt err = propertyHndl.Get(initialVal); |
|
44 |
|
45 // 1 => Successful installation |
|
46 // 4 => Successful uninstallation |
|
47 if(argVal == 1 || argVal == 4 ) |
|
48 { |
|
49 // Imitate the start of SWI |
|
50 TInt val = initialVal; |
|
51 if(argVal == 1) |
|
52 { |
|
53 val |= ESASwisInstall; |
|
54 } |
|
55 else |
|
56 { |
|
57 val |= ESASwisUninstall; |
|
58 } |
|
59 err = propertyHndl.Set(val); |
|
60 |
|
61 // Wait for the test case to finish and for the P&S value to be set |
|
62 User::After(1200000); |
|
63 |
|
64 // Imitate the successful completion of SWI |
|
65 val |= ESASwisStatusSuccess; |
|
66 err = propertyHndl.Set(val); |
|
67 |
|
68 // wait for RProperty::Set() to complete |
|
69 User::After(100000); |
|
70 } |
|
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) |
|
76 { |
|
77 // Imitate the start of SWI |
|
78 TInt val = initialVal; |
|
79 if( argVal == 2 || argVal == 3) |
|
80 { |
|
81 val |= ESASwisInstall; |
|
82 } |
|
83 else |
|
84 { |
|
85 val |= ESASwisUninstall; |
|
86 } |
|
87 err = propertyHndl.Set(val); |
|
88 |
|
89 // Wait for the test case to finish |
|
90 if( argVal == 3 || argVal == 6 ) |
|
91 { |
|
92 User::After(16500000); |
|
93 } |
|
94 else |
|
95 { |
|
96 User::After(1200000); |
|
97 } |
|
98 |
|
99 // Imitate the successful completion of SWI |
|
100 val |= ESASwisStatusAborted; |
|
101 err = propertyHndl.Set(val); |
|
102 |
|
103 // wait for RProperty::Set() to complete |
|
104 User::After(100000); |
|
105 } |
|
106 // Reset initial value for P&S install property |
|
107 err = propertyHndl.Set(initialVal); |
|
108 propertyHndl.Close(); |
|
109 } |
|
110 } |
|
111 CleanupStack::PopAndDestroy(); //args |
|
112 } |
|
113 |
|
114 GLDEF_C TInt E32Main() |
|
115 { |
|
116 __UHEAP_MARK; |
|
117 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
118 TRAPD( err, DoStartL() ); |
|
119 delete cleanup; |
|
120 __UHEAP_MARKEND; |
|
121 return err; |
|
122 } |