|
1 // Copyright (c) 2005-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 @file |
|
18 @internalComponent - Internal Symbian test code |
|
19 */ |
|
20 |
|
21 #include "T_IntegritySupportRebootStep.h" |
|
22 |
|
23 /** |
|
24 * Constructor |
|
25 */ |
|
26 CT_IntegritySupportReboot1TestStep::CT_IntegritySupportReboot1TestStep() |
|
27 { |
|
28 // Call base class method to set up the human readable name for logging |
|
29 SetTestStepName(KT_IntegritySupportReboot1Step); |
|
30 } |
|
31 |
|
32 /** |
|
33 * Destructor |
|
34 */ |
|
35 CT_IntegritySupportReboot1TestStep::~CT_IntegritySupportReboot1TestStep() |
|
36 { |
|
37 iSession.Close(); |
|
38 iUtils.Close(); |
|
39 } |
|
40 |
|
41 /** |
|
42 * @return - TVerdict code |
|
43 * Override of base class virtual |
|
44 */ |
|
45 TVerdict CT_IntegritySupportReboot1TestStep::doTestStepPreambleL() |
|
46 { |
|
47 SetTestStepResult(EPass); |
|
48 doAbstractNonNativeAppsTestStepPreambleL(); |
|
49 return TestStepResult(); |
|
50 } |
|
51 |
|
52 /** |
|
53 * @return - TVerdict code |
|
54 * Override of base class virtual |
|
55 */ |
|
56 TVerdict CT_IntegritySupportReboot1TestStep::doTestStepPostambleL() |
|
57 { |
|
58 return TestStepResult(); |
|
59 } |
|
60 |
|
61 TVerdict CT_IntegritySupportReboot1TestStep::doTestStepL() |
|
62 { |
|
63 INFO_PRINTF1(_L("Testing Apparc...T_IntegritySupportReboot1 Test Cases Running...")); |
|
64 |
|
65 TRAPD(ret,RunTestCasesL()) |
|
66 TEST(ret==KErrNone); |
|
67 |
|
68 INFO_PRINTF1(_L("...T_IntegritySupportReboot1 Test Cases Completed.")); |
|
69 |
|
70 return TestStepResult(); |
|
71 } |
|
72 |
|
73 TInt CT_IntegritySupportReboot1TestStep::RunTestCasesL() |
|
74 { |
|
75 //DONT_CHECK due to recreation of applist on server |
|
76 HEAP_TEST_LS_SESSION(iSession, 0, DONT_CHECK, TestSetupL(), NO_CLEANUP); |
|
77 |
|
78 return KErrNone; |
|
79 } |
|
80 |
|
81 _LIT(KLitLogicalExecutable1, "c:\\TestIntegritySupportReboot1.ist"); |
|
82 _LIT(KLitRegistrationFile1,"c:\\private\\10003a3f\\import\\apps\\NonNative\\Resource\\102081ce_reg.rsc"); |
|
83 static const CT_AbstractNonNativeAppsTestStep::TTestAppDetails KApplication1(0x102081CE,KLitLogicalExecutable1,KLitRegistrationFile1); |
|
84 |
|
85 |
|
86 _LIT(KLitLogicalExecutable2, "c:\\TestIntegritySupportReboot2.ist"); |
|
87 _LIT(KLitRegistrationFile2,"c:\\private\\10003a3f\\import\\apps\\NonNative\\Resource\\102081cf_reg.rsc"); |
|
88 static const CT_AbstractNonNativeAppsTestStep::TTestAppDetails KApplication2(0x102081CF,KLitLogicalExecutable2,KLitRegistrationFile2); |
|
89 |
|
90 /** |
|
91 @SYMTestCaseID T-IntegritySupportReboot1TestStep-TestSetupL |
|
92 |
|
93 @SYMPREQ |
|
94 |
|
95 @SYMTestCaseDesc This is only the first half of the test case. It will simulate a |
|
96 reboot in the middle of an installation. |
|
97 |
|
98 @SYMTestPriority |
|
99 |
|
100 @SYMTestStatus Implemented |
|
101 |
|
102 @SYMTestActions Simulate a reboot in the middle of an installation. |
|
103 |
|
104 @SYMTestExpectedResults None. See CT_IntegritySupportReboot2TestStep for the actual test. |
|
105 */ |
|
106 void CT_IntegritySupportReboot1TestStep::TestSetupL() |
|
107 { |
|
108 INFO_PRINTF1(_L("Setting up reboot recovery test...")); |
|
109 |
|
110 // so that we can check the presence/absence of stuff before apparc has respawned |
|
111 RProcess().SetPriority(EPriorityHigh); |
|
112 |
|
113 // make sure we're starting from a clean sheet |
|
114 CleanupAndResetL(iSession, KApplication1); |
|
115 CleanupAndResetL(iSession, KApplication2); |
|
116 |
|
117 // prepare the starting state: KApp1 uninstalled, KApp2 installed |
|
118 CompleteRegisterL(iSession, KApplication2); |
|
119 |
|
120 TEST(AppAbsent(iSession, KApplication1)); |
|
121 TEST(AppPresent(iSession, KApplication2)); |
|
122 |
|
123 // Prepare to install KApp1 and remove KApp2, and then panic after actually performing these steps |
|
124 iSession.PrepareNonNativeApplicationsUpdatesL(); |
|
125 CallRegisterL(iSession, KApplication1); |
|
126 CallDeregisterL(iSession, KApplication2); |
|
127 iSession.AddPanicingNonNativeApplicationsUpdate(); |
|
128 |
|
129 // test that nothing has changed yet |
|
130 TEST(AppAbsent(iSession, KApplication1)); |
|
131 TEST(AppPresent(iSession, KApplication2)); |
|
132 |
|
133 // commit, expect Apparc to die horribly |
|
134 // this function will actually restart apparc if it fails the first time |
|
135 TRAPD(err,iSession.CommitNonNativeApplicationsUpdatesL()); |
|
136 TEST(err == KErrServerTerminated); |
|
137 |
|
138 // the files should be as-if the update happened, but we can't check |
|
139 // the app list because apparc is now dead. |
|
140 TEST(FilePresent(KLitUpdatedAppsList)); |
|
141 TEST(FilePresent(KApplication1.iRegistrationFile)); |
|
142 TEST(FileAbsent(KApplication2.iRegistrationFile)); |
|
143 } |
|
144 |
|
145 /** |
|
146 * Constructor |
|
147 */ |
|
148 CT_IntegritySupportReboot2TestStep::CT_IntegritySupportReboot2TestStep() |
|
149 { |
|
150 // Call base class method to set up the human readable name for logging |
|
151 SetTestStepName(KT_IntegritySupportReboot2Step); |
|
152 } |
|
153 |
|
154 /** |
|
155 * Destructor |
|
156 */ |
|
157 CT_IntegritySupportReboot2TestStep::~CT_IntegritySupportReboot2TestStep() |
|
158 { |
|
159 iSession.Close(); |
|
160 iUtils.Close(); |
|
161 } |
|
162 |
|
163 /** |
|
164 * @return - TVerdict code |
|
165 * Override of base class virtual |
|
166 */ |
|
167 TVerdict CT_IntegritySupportReboot2TestStep::doTestStepPreambleL() |
|
168 { |
|
169 SetTestStepResult(EPass); |
|
170 doAbstractNonNativeAppsTestStepPreambleL(); |
|
171 return TestStepResult(); |
|
172 } |
|
173 |
|
174 /** |
|
175 * @return - TVerdict code |
|
176 * Override of base class virtual |
|
177 */ |
|
178 TVerdict CT_IntegritySupportReboot2TestStep::doTestStepPostambleL() |
|
179 { |
|
180 return TestStepResult(); |
|
181 } |
|
182 |
|
183 TVerdict CT_IntegritySupportReboot2TestStep::doTestStepL() |
|
184 { |
|
185 INFO_PRINTF1(_L("Testing Apparc...T_IntegritySupportReboot2 Test Cases Running...")); |
|
186 |
|
187 TRAPD(ret,RunTestCasesL()) |
|
188 TEST(ret==KErrNone); |
|
189 |
|
190 INFO_PRINTF1(_L("...T_IntegritySupportReboot2 Test Cases Completed.")); |
|
191 |
|
192 return TestStepResult(); |
|
193 } |
|
194 |
|
195 TInt CT_IntegritySupportReboot2TestStep::RunTestCasesL() |
|
196 { |
|
197 HEAP_TEST_LS_SESSION(iSession, 0, 0, TestRollbackL(), NO_CLEANUP); |
|
198 return KErrNone; |
|
199 } |
|
200 |
|
201 /** |
|
202 @SYMTestCaseID T-IntegritySupportReboot2TestStep-TestRollbackL |
|
203 |
|
204 @SYMPREQ |
|
205 |
|
206 @SYMTestCaseDesc This test case assumes IntegritySupportReboot1TestStep has been run before |
|
207 IntegritySupportReboot1TestStep have been rolled back and that the device is in a consistent state. |
|
208 |
|
209 @SYMTestPriority |
|
210 |
|
211 @SYMTestStatus Implemented |
|
212 |
|
213 @SYMTestActions Check the presence/absence of KApplication2 and KApplication1 respectively |
|
214 |
|
215 @SYMTestExpectedResults KApplication1 is absent, KApplication2 is present. |
|
216 */ |
|
217 void CT_IntegritySupportReboot2TestStep::TestRollbackL() |
|
218 { |
|
219 INFO_PRINTF1(_L("Checking that the device is in a consistent state, with all updates rolled back")); |
|
220 TEST(AppAbsent(iSession, KApplication1)); |
|
221 TEST(AppPresent(iSession, KApplication2)); |
|
222 } |