|
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 |
|
51 RScrAccessor::TAccessorOperationResult opResult = RScrAccessor::EOpSucessful; |
|
52 |
|
53 if(KNonLocalizedSwTypeName() == operationType) |
|
54 { |
|
55 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddNonLocalizedSoftwareType, opResult, iTimeMeasuredExternally); |
|
56 } |
|
57 else if(KLocalizedSwTypeName() == operationType) |
|
58 { |
|
59 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddLocalizedSoftwareType, opResult, iTimeMeasuredExternally); |
|
60 } |
|
61 else if(KSwTypeNoMimeType() == operationType) |
|
62 { |
|
63 TRAPD(err, iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddSofwtareTypeWithoutMimeTypes, opResult, iTimeMeasuredExternally)); |
|
64 if(KErrArgument != err) |
|
65 { |
|
66 ERR_PRINTF3(_L("The result of the function (%d) is not expected (%d)!"), err, KErrArgument); |
|
67 SetTestStepResult(EFail); |
|
68 } |
|
69 } |
|
70 else if(KLocalizedSwTypeDiffPluginUid() == operationType) |
|
71 { |
|
72 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddLocalizedSoftwareTypeWithDifferentPluginUid, opResult, iTimeMeasuredExternally); |
|
73 } |
|
74 else if(KLocalizedSwTypeExtraName() == operationType) |
|
75 { |
|
76 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddLocalizedSoftwareTypeWithExtraName, opResult, iTimeMeasuredExternally); |
|
77 } |
|
78 else if(KLocalizedSwTypeMissingName() == operationType) |
|
79 { |
|
80 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddLocalizedSoftwareTypeWithMissingName, opResult, iTimeMeasuredExternally); |
|
81 } |
|
82 else if(KLocalizedSwTypeExtraMime() == operationType) |
|
83 { |
|
84 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddLocalizedSoftwareTypeWithExtraMime, opResult, iTimeMeasuredExternally); |
|
85 } |
|
86 else if(KLocalizedSwTypeMissingMime() == operationType) |
|
87 { |
|
88 iScrAccessor.AddSoftwareTypeL(RScrAccessor::EAddLocalizedSoftwareTypeWithMissingMime, opResult, iTimeMeasuredExternally); |
|
89 } |
|
90 else |
|
91 { |
|
92 ERR_PRINTF2(_L("The operation type (%S) couldn't be recognised!"), &operationType); |
|
93 SetTestStepResult(EFail); |
|
94 } |
|
95 |
|
96 if(opResult != RScrAccessor::EOpSucessful) |
|
97 { |
|
98 SetTestStepResult(EFail); |
|
99 switch(opResult) |
|
100 { |
|
101 case RScrAccessor::EOpFailSwTypeNotFound: |
|
102 ERR_PRINTF1(_L("The newly added software type couldn't be found in SCR!")); |
|
103 break; |
|
104 case RScrAccessor::EOpFailUnexpectedPluginUid: |
|
105 ERR_PRINTF1(_L("The plugin Uid of the newly added software type doesn't match the expected one!")); |
|
106 break; |
|
107 default: |
|
108 ERR_PRINTF1(_L("Unknown test result received!")); |
|
109 } |
|
110 } |
|
111 } |
|
112 |
|
113 void CScrAddSoftwareTypeStep::ImplTestStepPostambleL() |
|
114 { |
|
115 iScrAccessor.Close(); |
|
116 CScrTestStep::ImplTestStepPostambleL(); |
|
117 } |
|
118 |
|
119 // -----------CScrDeleteSoftwareTypeStep----------------- |
|
120 |
|
121 CScrDeleteSoftwareTypeStep::CScrDeleteSoftwareTypeStep(CScrTestServer& aParent) : CScrTestStep(aParent) |
|
122 { |
|
123 } |
|
124 |
|
125 void CScrDeleteSoftwareTypeStep::ImplTestStepPreambleL() |
|
126 { |
|
127 CScrTestStep::ImplTestStepPreambleL(); |
|
128 User::LeaveIfError(iScrAccessor.Connect()); |
|
129 } |
|
130 |
|
131 void CScrDeleteSoftwareTypeStep::ImplTestStepL() |
|
132 { |
|
133 RScrAccessor::TAccessorOperationResult opResult = RScrAccessor::EOpSucessful; |
|
134 |
|
135 iScrAccessor.DeleteSoftwareTypeL(opResult, iTimeMeasuredExternally); |
|
136 |
|
137 if(opResult != RScrAccessor::EOpSucessful) |
|
138 { |
|
139 SetTestStepResult(EFail); |
|
140 switch(opResult) |
|
141 { |
|
142 case RScrAccessor::EOpFailUnexpectedMimeTypeNum: |
|
143 ERR_PRINTF1(_L("The number of deleted MIME types is unexpected!")); |
|
144 break; |
|
145 case RScrAccessor::EOpFailReturnedUnexpectedMimeType: |
|
146 ERR_PRINTF1(_L("One of the returned deleted MIME type is unexpected!")); |
|
147 break; |
|
148 case RScrAccessor::EOpFailSwTypeStillExists: |
|
149 ERR_PRINTF1(_L("The deleted sofwtare type still exists in SCR!")); |
|
150 break; |
|
151 default: |
|
152 ERR_PRINTF1(_L("Unknown test result received!")); |
|
153 } |
|
154 } |
|
155 } |
|
156 |
|
157 void CScrDeleteSoftwareTypeStep::ImplTestStepPostambleL() |
|
158 { |
|
159 iScrAccessor.Close(); |
|
160 CScrTestStep::ImplTestStepPostambleL(); |
|
161 } |