|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "appmanagersteps.h" |
|
20 #include "tscrdefs.h" |
|
21 |
|
22 using namespace Usif; |
|
23 |
|
24 // -----------CScrIsMediaPresentStep----------------- |
|
25 |
|
26 CScrIsMediaPresentStep::CScrIsMediaPresentStep(CScrTestServer& aParent) : CScrTestStep(aParent) |
|
27 { |
|
28 } |
|
29 |
|
30 void CScrIsMediaPresentStep::ImplTestStepPreambleL() |
|
31 { |
|
32 CScrTestStep::ImplTestStepPreambleL(); |
|
33 } |
|
34 |
|
35 void CScrIsMediaPresentStep::ImplTestStepL() |
|
36 { |
|
37 TInt componentId = GetComponentIdL(); |
|
38 TBool expectedMediaPresent(EFalse); |
|
39 if (!GetBoolFromConfig(ConfigSection(), _L("ExpectedMediaPresent"), expectedMediaPresent)) |
|
40 { |
|
41 PrintErrorL(_L("ExpectedMediaPresent property not found"), KErrNotFound); |
|
42 } |
|
43 TBool foundMediaPresent = iScrSession.IsMediaPresentL(componentId); |
|
44 if (foundMediaPresent != expectedMediaPresent) |
|
45 { |
|
46 ERR_PRINTF4(_L("Mismatch for IsMediaPresentL for component id %d. Expected %d and the result was %d."), componentId, expectedMediaPresent, foundMediaPresent); |
|
47 SetTestStepResult(EFail); |
|
48 } |
|
49 } |
|
50 |
|
51 void CScrIsMediaPresentStep::ImplTestStepPostambleL() |
|
52 { |
|
53 CScrTestStep::ImplTestStepPostambleL(); |
|
54 } |
|
55 |
|
56 // -----------CScrIsComponentOrphanedStep----------------- |
|
57 |
|
58 CScrIsComponentOrphanedStep::CScrIsComponentOrphanedStep(CScrTestServer& aParent) : CScrTestStep(aParent) |
|
59 { |
|
60 } |
|
61 |
|
62 void CScrIsComponentOrphanedStep::ImplTestStepPreambleL() |
|
63 { |
|
64 CScrTestStep::ImplTestStepPreambleL(); |
|
65 } |
|
66 |
|
67 void CScrIsComponentOrphanedStep::ImplTestStepL() |
|
68 { |
|
69 TInt componentId = GetComponentIdL(); |
|
70 TBool expectedComponentOrphaned(EFalse); |
|
71 if (!GetBoolFromConfig(ConfigSection(), _L("ExpectedComponentOrphaned"), expectedComponentOrphaned)) |
|
72 { |
|
73 PrintErrorL(_L("ExpectedComponentOrphaned property not found"), KErrNotFound); |
|
74 } |
|
75 TBool foundComponentOrphaned = iScrSession.IsComponentOrphanedL(componentId); |
|
76 if (foundComponentOrphaned != expectedComponentOrphaned) |
|
77 { |
|
78 ERR_PRINTF4(_L("Mismatch for IsComponentOrphanedL for component id %d. Expected %d and the result was %d."), componentId, expectedComponentOrphaned, foundComponentOrphaned); |
|
79 SetTestStepResult(EFail); |
|
80 } |
|
81 } |
|
82 |
|
83 void CScrIsComponentOrphanedStep::ImplTestStepPostambleL() |
|
84 { |
|
85 CScrTestStep::ImplTestStepPostambleL(); |
|
86 } |
|
87 |
|
88 // -----------CScrCompareVersionsStep----------------- |
|
89 |
|
90 CScrCompareVersionsStep::CScrCompareVersionsStep(CScrTestServer& aParent) : CScrTestStep(aParent) |
|
91 { |
|
92 } |
|
93 |
|
94 void CScrCompareVersionsStep::ImplTestStepPreambleL() |
|
95 { |
|
96 CScrTestStep::ImplTestStepPreambleL(); |
|
97 } |
|
98 |
|
99 void CScrCompareVersionsStep::ImplTestStepL() |
|
100 { |
|
101 HBufC *lVer = GetVersionFromConfigL(KVersionLeft()); |
|
102 CleanupStack::PushL(lVer); |
|
103 |
|
104 HBufC *rVer = GetVersionFromConfigL(KVersionRight()); |
|
105 CleanupStack::PushL(rVer); |
|
106 |
|
107 if(!lVer || !rVer) |
|
108 PrintErrorL(_L("Missing version!"), KErrNotFound); |
|
109 |
|
110 TInt expectedResult; |
|
111 if (!GetIntFromConfig(ConfigSection(), KExpectedResult, expectedResult)) |
|
112 PrintErrorL(_L("The expected result param could not be found in configuration."), KErrNotFound); |
|
113 |
|
114 TInt retrievedResult = iScrSession.CompareVersionsL(*lVer, *rVer); |
|
115 |
|
116 if(retrievedResult > 0) |
|
117 retrievedResult = 1; |
|
118 else if(retrievedResult < 0) |
|
119 retrievedResult = -1; |
|
120 |
|
121 if(retrievedResult != expectedResult) |
|
122 PrintErrorL(_L("The retrieved result (%d) is different from the expected one (%d)."), KErrNotFound, retrievedResult, expectedResult); |
|
123 |
|
124 CleanupStack::PopAndDestroy(2, lVer); // lVer, rVer |
|
125 } |
|
126 |
|
127 void CScrCompareVersionsStep::ImplTestStepPostambleL() |
|
128 { |
|
129 CScrTestStep::ImplTestStepPostambleL(); |
|
130 } |
|
131 |
|
132 // -----------CScrIsComponentOnReadOnlyDriveStep----------------- |
|
133 |
|
134 CScrIsComponentOnReadOnlyDriveStep::CScrIsComponentOnReadOnlyDriveStep(CScrTestServer& aParent) : CScrTestStep(aParent) |
|
135 { |
|
136 } |
|
137 |
|
138 void CScrIsComponentOnReadOnlyDriveStep::ImplTestStepPreambleL() |
|
139 { |
|
140 CScrTestStep::ImplTestStepPreambleL(); |
|
141 } |
|
142 |
|
143 void CScrIsComponentOnReadOnlyDriveStep::ImplTestStepL() |
|
144 { |
|
145 TInt componentId = GetComponentIdL(); |
|
146 TBool expectedROMResult(EFalse); |
|
147 if (!GetBoolFromConfig(ConfigSection(), _L("ExpectedROMResult"), expectedROMResult)) |
|
148 { |
|
149 PrintErrorL(_L("ExpectedROMResult property not found"), KErrNotFound); |
|
150 } |
|
151 |
|
152 TBool result = iScrSession.IsComponentOnReadOnlyDriveL(componentId); |
|
153 if (result != expectedROMResult) |
|
154 { |
|
155 ERR_PRINTF4(_L("Mismatch for IsComponentOnReadOnlyDriveL for component id %d. Expected %d and the result was %d."), componentId, expectedROMResult, result); |
|
156 SetTestStepResult(EFail); |
|
157 } |
|
158 } |
|
159 |
|
160 void CScrIsComponentOnReadOnlyDriveStep::ImplTestStepPostambleL() |
|
161 { |
|
162 CScrTestStep::ImplTestStepPostambleL(); |
|
163 } |
|
164 |
|
165 // -----------CScrComponentPresenceStep----------------- |
|
166 |
|
167 CScrComponentPresenceStep::CScrComponentPresenceStep(CScrTestServer& aParent) : CScrTestStep(aParent) |
|
168 { |
|
169 } |
|
170 |
|
171 void CScrComponentPresenceStep::ImplTestStepPreambleL() |
|
172 { |
|
173 CScrTestStep::ImplTestStepPreambleL(); |
|
174 } |
|
175 |
|
176 void CScrComponentPresenceStep::ImplTestStepL() |
|
177 { |
|
178 TInt componentId = GetComponentIdL(); |
|
179 |
|
180 TBool compPresenceValue(ETrue); |
|
181 if (!GetBoolFromConfig(ConfigSection(), _L("CompPresenceValue"), compPresenceValue)) |
|
182 { |
|
183 PrintErrorL(_L("CompPresenceValue property not found"), KErrNotFound); |
|
184 } |
|
185 |
|
186 TBool setCompPresence(EFalse); |
|
187 GetBoolFromConfig(ConfigSection(), _L("SetCompPresence"), setCompPresence); |
|
188 if (setCompPresence) |
|
189 { |
|
190 iScrSession.SetIsComponentPresentL(componentId, compPresenceValue); |
|
191 } |
|
192 |
|
193 TBool result = iScrSession.IsComponentPresentL(componentId); |
|
194 if (result != compPresenceValue) |
|
195 { |
|
196 ERR_PRINTF4(_L("Mismatch for IsComponentPresentL for component id %d. Expected %d and the result was %d."), componentId, compPresenceValue, result); |
|
197 SetTestStepResult(EFail); |
|
198 } |
|
199 } |
|
200 |
|
201 void CScrComponentPresenceStep::ImplTestStepPostambleL() |
|
202 { |
|
203 CScrTestStep::ImplTestStepPostambleL(); |
|
204 } |