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 * appmanagersteps.cpp |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "pluginmanagementsteps.h" |
|
21 |
|
22 using namespace Usif; |
|
23 |
|
24 // -----------CScrAddSoftwareTypeStep----------------- |
|
25 |
|
26 CScrAddSoftwareTypeStep::CScrAddSoftwareTypeStep(CScrTestServer& aParent) : CScrTestStep(aParent) |
|
27 { |
|
28 } |
|
29 |
|
30 void CScrAddSoftwareTypeStep::ImplTestStepPreambleL() |
|
31 { |
|
32 CScrTestStep::ImplTestStepPreambleL(); |
|
33 User::LeaveIfError(iScrAccessor.Connect()); |
|
34 } |
|
35 |
|
36 void CScrAddSoftwareTypeStep::ImplTestStepL() |
|
37 { |
|
38 TPtrC operationType; |
|
39 if (!GetStringFromConfig(ConfigSection(), _L("OperationType"), operationType)) |
|
40 PrintErrorL(_L("Operation type could not be found in configuration."), KErrNotFound); |
|
41 |
|
42 _LIT(KNonLocalizedSwTypeName, "NonLocalized"); |
|
43 _LIT(KLocalizedSwTypeName, "Localized"); |
|
44 _LIT(KSwTypeNoMimeType, "NoMimeType"); |
|
45 _LIT(KLocalizedSwTypeDiffPluginUid, "LocalizedWithDifferentPluginUid"); |
|
46 _LIT(KLocalizedSwTypeExtraName, "LocalizedWithExtraName"); |
|
47 _LIT(KLocalizedSwTypeMissingName, "LocalizedWithMissingName"); |
|
48 _LIT(KLocalizedSwTypeExtraMime, "LocalizedExtraMime"); |
|
49 _LIT(KLocalizedSwTypeMissingMime, "LocalizedMissingMime"); |
|
50 _LIT(KMultipleSidAndLauncherExecutable, "MultipleSidAndLauncherExecutable"); |
|
51 |
|
52 RScrAccessor::TAccessorOperationResult opResult = RScrAccessor::EOpSucessful; |
|
53 |
|
54 if(KNonLocalizedSwTypeName() == operationType) |
|
55 { |
|
56 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddNonLocalizedSoftwareType, opResult, iTimeMeasuredExternally); |
|
57 } |
|
58 else if(KLocalizedSwTypeName() == operationType) |
|
59 { |
|
60 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddLocalizedSoftwareType, opResult, iTimeMeasuredExternally); |
|
61 } |
|
62 else if(KSwTypeNoMimeType() == operationType) |
|
63 { |
|
64 TRAPD(err, iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddSofwtareTypeWithoutMimeTypes, opResult, iTimeMeasuredExternally)); |
|
65 if(KErrArgument != err) |
|
66 { |
|
67 ERR_PRINTF3(_L("The result of the function (%d) is not expected (%d)!"), err, KErrArgument); |
|
68 SetTestStepResult(EFail); |
|
69 } |
|
70 } |
|
71 else if(KLocalizedSwTypeDiffPluginUid() == operationType) |
|
72 { |
|
73 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddLocalizedSoftwareTypeWithDifferentPluginUid, opResult, iTimeMeasuredExternally); |
|
74 } |
|
75 else if(KLocalizedSwTypeExtraName() == operationType) |
|
76 { |
|
77 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddLocalizedSoftwareTypeWithExtraName, opResult, iTimeMeasuredExternally); |
|
78 } |
|
79 else if(KLocalizedSwTypeMissingName() == operationType) |
|
80 { |
|
81 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddLocalizedSoftwareTypeWithMissingName, opResult, iTimeMeasuredExternally); |
|
82 } |
|
83 else if(KLocalizedSwTypeExtraMime() == operationType) |
|
84 { |
|
85 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddLocalizedSoftwareTypeWithExtraMime, opResult, iTimeMeasuredExternally); |
|
86 } |
|
87 else if(KLocalizedSwTypeMissingMime() == operationType) |
|
88 { |
|
89 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddLocalizedSoftwareTypeWithMissingMime, opResult, iTimeMeasuredExternally); |
|
90 } |
|
91 else if(KMultipleSidAndLauncherExecutable() == operationType) |
|
92 { |
|
93 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddMultipleSidWithLauncherExecutable, opResult, iTimeMeasuredExternally); |
|
94 } |
|
95 else |
|
96 { |
|
97 ERR_PRINTF2(_L("The operation type (%S) couldn't be recognised!"), &operationType); |
|
98 SetTestStepResult(EFail); |
|
99 } |
|
100 |
|
101 if(opResult != RScrAccessor::EOpSucessful) |
|
102 { |
|
103 SetTestStepResult(EFail); |
|
104 switch(opResult) |
|
105 { |
|
106 case RScrAccessor::EOpFailSwTypeNotFound: |
|
107 ERR_PRINTF1(_L("The newly added software type couldn't be found in SCR!")); |
|
108 break; |
|
109 case RScrAccessor::EOpFailUnexpectedPluginUid: |
|
110 ERR_PRINTF1(_L("The plugin Uid of the newly added software type doesn't match the expected one!")); |
|
111 break; |
|
112 default: |
|
113 ERR_PRINTF1(_L("Unknown test result received!")); |
|
114 } |
|
115 } |
|
116 } |
|
117 |
|
118 void CScrAddSoftwareTypeStep::ImplTestStepPostambleL() |
|
119 { |
|
120 iScrAccessor.Close(); |
|
121 CScrTestStep::ImplTestStepPostambleL(); |
|
122 } |
|
123 |
|
124 // -----------CScrDeleteSoftwareTypeStep----------------- |
|
125 |
|
126 CScrDeleteSoftwareTypeStep::CScrDeleteSoftwareTypeStep(CScrTestServer& aParent) : CScrTestStep(aParent) |
|
127 { |
|
128 } |
|
129 |
|
130 void CScrDeleteSoftwareTypeStep::ImplTestStepPreambleL() |
|
131 { |
|
132 CScrTestStep::ImplTestStepPreambleL(); |
|
133 User::LeaveIfError(iScrAccessor.Connect()); |
|
134 } |
|
135 |
|
136 void CScrDeleteSoftwareTypeStep::ImplTestStepL() |
|
137 { |
|
138 RScrAccessor::TAccessorOperationResult opResult = RScrAccessor::EOpSucessful; |
|
139 |
|
140 iScrAccessor.DeleteSoftwareTypeL(opResult, iTimeMeasuredExternally); |
|
141 |
|
142 if(opResult != RScrAccessor::EOpSucessful) |
|
143 { |
|
144 SetTestStepResult(EFail); |
|
145 switch(opResult) |
|
146 { |
|
147 case RScrAccessor::EOpFailUnexpectedMimeTypeNum: |
|
148 ERR_PRINTF1(_L("The number of deleted MIME types is unexpected!")); |
|
149 break; |
|
150 case RScrAccessor::EOpFailReturnedUnexpectedMimeType: |
|
151 ERR_PRINTF1(_L("One of the returned deleted MIME type is unexpected!")); |
|
152 break; |
|
153 case RScrAccessor::EOpFailSwTypeStillExists: |
|
154 ERR_PRINTF1(_L("The deleted sofwtare type still exists in SCR!")); |
|
155 break; |
|
156 default: |
|
157 ERR_PRINTF1(_L("Unknown test result received!")); |
|
158 } |
|
159 } |
|
160 } |
|
161 |
|
162 void CScrDeleteSoftwareTypeStep::ImplTestStepPostambleL() |
|
163 { |
|
164 iScrAccessor.Close(); |
|
165 CScrTestStep::ImplTestStepPostambleL(); |
|
166 } |
|