|
1 // Copyright (c) 2010 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 */ |
|
19 #include "comparePMAStep.h" |
|
20 #include "Te_centrep_BURSuiteDefs.h" |
|
21 #include "Te_centrep_BURSuiteStepBase.h" |
|
22 |
|
23 CcomparePMAStep::~CcomparePMAStep() |
|
24 /** |
|
25 * Destructor |
|
26 */ |
|
27 { |
|
28 } |
|
29 |
|
30 CcomparePMAStep::CcomparePMAStep() |
|
31 /** |
|
32 * Constructor |
|
33 */ |
|
34 { |
|
35 // **MUST** call SetTestStepName in the constructor as the controlling |
|
36 // framework uses the test step name immediately following construction to set |
|
37 // up the step's unique logging ID. |
|
38 SetTestStepName(KcomparePMAStep); |
|
39 } |
|
40 |
|
41 TVerdict CcomparePMAStep::doTestStepL() |
|
42 /** |
|
43 * @return - TVerdict code |
|
44 * Override of base class pure virtual |
|
45 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
46 * not leave. That being the case, the current test result value will be EPass. |
|
47 */ |
|
48 { |
|
49 SetTestStepResult(EFail); |
|
50 |
|
51 #if defined(SYMBIAN_INCLUDE_APP_CENTRIC) |
|
52 // Check on PMA repository to test that a repository which: |
|
53 // 1. Has not been modified and hence don't have repository |
|
54 // file on the PMA drive is correctly handled - This |
|
55 // should always contain just the ROM default values. |
|
56 // 2. Has been been modified (after backup) and hence has |
|
57 // repository file on the PMA drive is correctly handled |
|
58 // This should always contain the modified the PMA drive's |
|
59 // repository values (even after restore). |
|
60 INFO_PRINTF2(_L("Start PMA ComparePMAStep repos id: 0x%x"), KUidBURTestPMARepository); |
|
61 |
|
62 TBool PmaReposExist = EFalse; |
|
63 TBool bRet = GetBoolFromConfig(ConfigSection(), KIniPMAReposExist, PmaReposExist); |
|
64 TESTL(bRet); |
|
65 CRepository* repository(NULL); |
|
66 TRAPD(r, repository = CRepository::NewL(KUidBURTestPMARepository)); |
|
67 |
|
68 if(!PmaReposExist) |
|
69 { |
|
70 TESTL(r==KErrNotFound); |
|
71 } |
|
72 else |
|
73 { |
|
74 TESTL(r==KErrNone); |
|
75 CleanupStack::PushL(repository); |
|
76 // Int value |
|
77 // In modify step, we will modify an 'integer' setting (after backup finished), |
|
78 // it must still contain the modified setting after restore. |
|
79 // During other steps, this setting will not be modified, hence it should |
|
80 // still have the ROM value. |
|
81 TInt PmaExpectedResult ; |
|
82 bRet = GetIntFromConfig(ConfigSection(), KIniPMAExpectedGetResult, PmaExpectedResult); |
|
83 TBool PmaIsModified ; |
|
84 bRet = GetBoolFromConfig(ConfigSection(), KIniPMAIsModified, PmaIsModified); |
|
85 TInt PMAIntCurrentVal = 0; |
|
86 r=repository->Get(KPMAIntKey, PMAIntCurrentVal); |
|
87 TESTL(r==KErrNone); |
|
88 if(PmaIsModified) |
|
89 { |
|
90 TESTL(PMAIntCurrentVal == KPMAIntModifiedValue); |
|
91 } |
|
92 else |
|
93 { |
|
94 TESTL(PMAIntCurrentVal == KPMAIntOrigValue); |
|
95 } |
|
96 |
|
97 // Real value |
|
98 // In modify step, we will modify a 'real' setting (after backup finished), |
|
99 // it must still contain the modified setting after restore. |
|
100 // During other steps, this setting will not be modified, hence it should |
|
101 // still have the ROM value. |
|
102 TReal PMARealCurrentVal = 0; |
|
103 r=repository->Get(KPMARealKey, PMARealCurrentVal); |
|
104 TESTL(r==KErrNone); //ROM setting, should always exist |
|
105 if(PmaIsModified) |
|
106 { |
|
107 TESTL(PMARealCurrentVal == KPMARealModifiedValue); |
|
108 } |
|
109 else |
|
110 { |
|
111 TESTL(PMARealCurrentVal == KPMARealOrigValue); |
|
112 } |
|
113 |
|
114 // Bin value |
|
115 // In modify step, we will modify a 'string8(binary)' setting (after backup finished), |
|
116 // it must still contain the modified setting after restore. |
|
117 // During other steps, this setting will not be modified, hence it should |
|
118 // still have the ROM value. |
|
119 TBuf8 <20> PMABinCurrentVal; |
|
120 r=repository->Get(KPMABinKey, PMABinCurrentVal); |
|
121 TESTL(r==KErrNone); //ROM setting, should always exist |
|
122 if(PmaIsModified) |
|
123 { |
|
124 TESTL(PMABinCurrentVal == KPMABinModifiedValue); |
|
125 } |
|
126 else |
|
127 { |
|
128 TESTL(PMABinCurrentVal == KPMABinOrigValue); |
|
129 } |
|
130 |
|
131 // String value |
|
132 // In modify step, we will modify a 'string' setting (after backup finished), |
|
133 // it must still contain the modified setting after restore. |
|
134 // During other steps, this setting will not be modified, hence it should |
|
135 // still have the ROM value. |
|
136 TBuf <20> PMAStrCurrentVal; |
|
137 r=repository->Get(KPMAStrKey, PMAStrCurrentVal); |
|
138 TESTL(r==KErrNone); //ROM setting, should always exist |
|
139 if(PmaIsModified) |
|
140 { |
|
141 TESTL(PMAStrCurrentVal == KPMAStrModifiedValue); |
|
142 } |
|
143 else |
|
144 { |
|
145 TESTL(PMAStrCurrentVal == KPMAStrOrigValue); |
|
146 } |
|
147 |
|
148 //Deleted key |
|
149 // In modify step, we will delete a setting (after backup finished), |
|
150 // it must not be restored after restore is finished. |
|
151 // During other steps, this setting will not be deleted, hence it should still exist. |
|
152 r=repository->Get(KPMADeleteIntKey, PMAIntCurrentVal); |
|
153 if(PmaIsModified) |
|
154 { |
|
155 TESTL(r==KErrNotFound); |
|
156 } |
|
157 else |
|
158 { |
|
159 TESTL(r==KErrNone); |
|
160 TESTL(PMAIntCurrentVal==KPMADeleteIntValue); |
|
161 } |
|
162 |
|
163 //Created key |
|
164 // In modify step, we will create a new int setting (after backup finished), |
|
165 // it must still be exist after restore. |
|
166 // During other steps, this setting will not be created, hence it should not exist. |
|
167 r=repository->Get(KPMACreateIntKey, PMAIntCurrentVal); |
|
168 if(PmaIsModified) |
|
169 { |
|
170 TESTL(r==KErrNone); |
|
171 TESTL(PMAIntCurrentVal==KPMACreateIntValue); |
|
172 } |
|
173 else |
|
174 { |
|
175 TESTL(r==KErrNotFound); |
|
176 } |
|
177 |
|
178 |
|
179 |
|
180 //adsaddlkajdlkas |
|
181 r=repository->Get(KPMAInitIntKey, PMAIntCurrentVal); |
|
182 RDebug::Print(_L("r = %d, PmaExpectedResult = %d, PmaIsModified = %d"),r,PmaExpectedResult, PmaIsModified); |
|
183 RDebug::Print(_L("PMAIntCurrentVal = %d, KPMAInitIntOrigValue = %d, KPMAInitIntModifiedValue = %d"), PMAIntCurrentVal, KPMAInitIntOrigValue, KPMAInitIntModifiedValue); |
|
184 TESTL(r==PmaExpectedResult); |
|
185 if (r == KErrNone) |
|
186 { |
|
187 if(PmaIsModified) |
|
188 { |
|
189 TESTL(PMAIntCurrentVal == KPMAInitIntModifiedValue); |
|
190 } |
|
191 else |
|
192 { |
|
193 TESTL(PMAIntCurrentVal == KPMAInitIntOrigValue); |
|
194 } |
|
195 } |
|
196 |
|
197 // Real value |
|
198 // In modify step, we will modify a 'real' setting (after backup finished), |
|
199 // it must still contain the modified setting after restore. |
|
200 // During other steps, this setting will not be modified, hence it should |
|
201 // still have the ROM value. |
|
202 r=repository->Get(KPMAInitRealKey, PMARealCurrentVal); |
|
203 RDebug::Print(_L("PMARealCurrentVal = %f, KPMAInitRealOrigValue = %f, KPMAInitRealModifiedValue = %f"), PMARealCurrentVal, KPMAInitRealOrigValue, KPMAInitRealModifiedValue); |
|
204 TESTL(r==PmaExpectedResult); |
|
205 if (r == KErrNone) |
|
206 { |
|
207 if(PmaIsModified) |
|
208 { |
|
209 TESTL(PMARealCurrentVal == KPMAInitRealModifiedValue); |
|
210 } |
|
211 else |
|
212 { |
|
213 TESTL(PMARealCurrentVal == KPMAInitRealOrigValue); |
|
214 } |
|
215 } |
|
216 |
|
217 // Bin value |
|
218 // In modify step, we will modify a 'string8(binary)' setting (after backup finished), |
|
219 // it must still contain the modified setting after restore. |
|
220 // During other steps, this setting will not be modified, hence it should |
|
221 // still have the ROM value. |
|
222 r=repository->Get(KPMAInitBinKey, PMABinCurrentVal); |
|
223 RDebug::Printf("PMABinCurrentVal = %s, KPMAInitBinOrigValue = %s, KPMAInitBinModifiedValue = %s", &PMABinCurrentVal, &KPMAInitBinOrigValue, &KPMAInitBinModifiedValue); |
|
224 TESTL(r==PmaExpectedResult); |
|
225 if (r == KErrNone) |
|
226 { |
|
227 if(PmaIsModified) |
|
228 { |
|
229 TESTL(PMABinCurrentVal == KPMAInitBinModifiedValue); |
|
230 } |
|
231 else |
|
232 { |
|
233 TESTL(PMABinCurrentVal == KPMAInitBinOrigValue); |
|
234 } |
|
235 } |
|
236 |
|
237 // String value |
|
238 // In modify step, we will modify a 'string' setting (after backup finished), |
|
239 // it must still contain the modified setting after restore. |
|
240 // During other steps, this setting will not be modified, hence it should |
|
241 // still have the ROM value. |
|
242 r=repository->Get(KPMAInitStrKey, PMAStrCurrentVal); |
|
243 RDebug::Print(_L("PMAStrCurrentVal = %S, KPMAInitStrOrigValue = %S, KPMAInitStrModifiedValue = %S"), &PMAStrCurrentVal, &KPMAInitStrOrigValue, &KPMAInitStrModifiedValue); |
|
244 TESTL(r==PmaExpectedResult); |
|
245 if (r == KErrNone) |
|
246 { |
|
247 if(PmaIsModified) |
|
248 { |
|
249 TESTL(PMAStrCurrentVal == KPMAInitStrModifiedValue); |
|
250 } |
|
251 else |
|
252 { |
|
253 TESTL(PMAStrCurrentVal == KPMAInitStrOrigValue); |
|
254 } |
|
255 } |
|
256 CleanupStack::PopAndDestroy(repository); |
|
257 } |
|
258 #endif //defined(SYMBIAN_INCLUDE_APP_CENTRIC) |
|
259 |
|
260 SetTestStepResult(EPass); |
|
261 |
|
262 return TestStepResult(); |
|
263 } |