1 /* |
|
2 * Copyright (c) 2002 - 2007 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 "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 |
|
20 |
|
21 #ifndef USBUIAPITEST_H |
|
22 #define USBUIAPITEST_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <StifLogger.h> |
|
26 #include <TestScripterInternal.h> |
|
27 #include <StifTestModule.h> |
|
28 #include <TestclassAssert.h> |
|
29 |
|
30 #include "coreapplicationuisdomainpskeys.h" |
|
31 #include <SettingsInternalCRKeys.h> |
|
32 #include <centralrepository.h> |
|
33 #include <apgcli.h> |
|
34 #include <apacmdln.h> |
|
35 #include <UsbWatcherInternalCRKeys.h> |
|
36 #include <usbpersonalityids.h> |
|
37 |
|
38 #include "USBClassChangeUI.h" |
|
39 // CONSTANTS |
|
40 _LIT( KUsbAppFileName, "usbclasschangeui" ); |
|
41 |
|
42 // MACROS |
|
43 //#define ?macro ?macro_def |
|
44 #define TEST_CLASS_VERSION_MAJOR 0 |
|
45 #define TEST_CLASS_VERSION_MINOR 0 |
|
46 #define TEST_CLASS_VERSION_BUILD 0 |
|
47 |
|
48 // Logging path |
|
49 //_LIT( KUSBUiApiTestLogPath, "\\logs\\testframework\\USBUiApiTest\\" ); |
|
50 |
|
51 // Logging path for ATS - for phone builds comment this line |
|
52 _LIT( KUSBUiApiTestLogPath, "e:\\testing\\stiflogs\\" ); |
|
53 |
|
54 // Log file |
|
55 _LIT( KUSBUiApiTestLogFile, "USBUiApiTest.txt" ); |
|
56 _LIT( KUSBUiApiTestLogFileWithTitle, "USBUiApiTest_[%S].txt" ); |
|
57 |
|
58 // FUNCTION PROTOTYPES |
|
59 //?type ?function_name(?arg_list); |
|
60 |
|
61 // FORWARD DECLARATIONS |
|
62 //class ?FORWARD_CLASSNAME; |
|
63 class CUSBUiApiTest; |
|
64 |
|
65 // DATA TYPES |
|
66 //enum ?declaration |
|
67 |
|
68 enum TUSBUiApiTestResult |
|
69 { |
|
70 ETestCasePassed, |
|
71 ETestCaseFailed |
|
72 }; |
|
73 |
|
74 enum TUSBAppTestOption |
|
75 { |
|
76 EAppCancelled = 0, |
|
77 EAskOnConnectionSettingChanged,//1 |
|
78 EUsbConnectionModeSettingChanged//2 |
|
79 }; |
|
80 |
|
81 //typedef ?declaration |
|
82 //extern ?data_type; |
|
83 |
|
84 // CLASS DECLARATION |
|
85 |
|
86 NONSHARABLE_CLASS( TUSBUiApiTestBlockParams ) |
|
87 { |
|
88 public: |
|
89 TPtrC iTestBlockName; |
|
90 |
|
91 TPtrC iTestOption1; |
|
92 TPtrC iTestOption2; |
|
93 TPtrC iTestOption3; |
|
94 |
|
95 TInt iTestIntOption1; |
|
96 TInt iTestIntOption2; |
|
97 |
|
98 TChar iTestCharOption1; |
|
99 TChar iTestCharOption2; |
|
100 }; |
|
101 |
|
102 /** |
|
103 * CUSBUiApiTest test class for STIF Test Framework TestScripter. |
|
104 * ?other_description_lines |
|
105 * |
|
106 * @lib ?library |
|
107 * @since ?Series60_version |
|
108 */ |
|
109 NONSHARABLE_CLASS( CUSBUiApiTest ) : public CScriptBase |
|
110 { |
|
111 public: // Constructors and destructor |
|
112 |
|
113 /** |
|
114 * Two-phased constructor. |
|
115 */ |
|
116 static CUSBUiApiTest* NewL( CTestModuleIf& aTestModuleIf ); |
|
117 |
|
118 /** |
|
119 * Destructor. |
|
120 */ |
|
121 virtual ~CUSBUiApiTest(); |
|
122 |
|
123 public: // New functions |
|
124 |
|
125 /** |
|
126 * ?member_description. |
|
127 * @since ?Series60_version |
|
128 * @param ?arg1 ?description |
|
129 * @return ?description |
|
130 */ |
|
131 //?type ?member_function( ?type ?arg1 ); |
|
132 |
|
133 public: // Functions from base classes |
|
134 |
|
135 /** |
|
136 * From CScriptBase Runs a script line. |
|
137 * @since ?Series60_version |
|
138 * @param aItem Script line containing method name and parameters |
|
139 * @return Symbian OS error code |
|
140 */ |
|
141 virtual TInt RunMethodL( CStifItemParser& aItem ); |
|
142 |
|
143 protected: // New functions |
|
144 |
|
145 /** |
|
146 * ?member_description. |
|
147 * @since ?Series60_version |
|
148 * @param ?arg1 ?description |
|
149 * @return ?description |
|
150 */ |
|
151 //?type ?member_function( ?type ?arg1 ); |
|
152 |
|
153 protected: // Functions from base classes |
|
154 |
|
155 /** |
|
156 * From ?base_class ?member_description |
|
157 */ |
|
158 //?type ?member_function(); |
|
159 |
|
160 private: |
|
161 |
|
162 /** |
|
163 * C++ default constructor. |
|
164 */ |
|
165 CUSBUiApiTest( CTestModuleIf& aTestModuleIf ); |
|
166 |
|
167 /** |
|
168 * By default Symbian 2nd phase constructor is private. |
|
169 */ |
|
170 void ConstructL(); |
|
171 |
|
172 // Prohibit copy constructor if not deriving from CBase. |
|
173 // ?classname( const ?classname& ); |
|
174 // Prohibit assigment operator if not deriving from CBase. |
|
175 // ?classname& operator=( const ?classname& ); |
|
176 |
|
177 /** |
|
178 * Frees all resources allocated from test methods. |
|
179 * @since ?Series60_version |
|
180 */ |
|
181 void Delete(); |
|
182 |
|
183 /** |
|
184 * Test methods are listed below. |
|
185 */ |
|
186 |
|
187 virtual TInt ExecuteApiTestBlock( CStifItemParser& aItem ); |
|
188 virtual TInt ExecuteModuleTestBlock( CStifItemParser& aItem ); |
|
189 virtual TInt ExecuteBranchTestBlock( CStifItemParser& aItem ); |
|
190 |
|
191 /** |
|
192 * Method used to log version of test class |
|
193 */ |
|
194 void SendTestClassVersion(); |
|
195 |
|
196 //ADD NEW METHOD DEC HERE |
|
197 //[TestMethods] - Do not remove |
|
198 |
|
199 void GetTestBlockParamsL( CStifItemParser& aItem ); |
|
200 |
|
201 void DoExecuteApiTestBlockL( CStifItemParser& aItem, TUSBUiApiTestResult& aTestResult ); |
|
202 void DoExecuteModuleTestBlockL( CStifItemParser& aItem, TUSBUiApiTestResult& aTestResult ); |
|
203 void DoExecuteBranchTestBlockL( CStifItemParser& aItem, TUSBUiApiTestResult& aTestResult ); |
|
204 |
|
205 void ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption, |
|
206 TInt aTestIntOption, TInt aTestCharOption, TUSBUiApiTestResult& aTestResult ); |
|
207 |
|
208 virtual TInt LaunchUsbUiApp( TPtrC aTestOption, TPtrC aTestSubOption, TUSBUiApiTestResult& aTestResult ); |
|
209 virtual TInt FinishTest( TPtrC aTestOption, TPtrC aTestSubOption, TPtrC aTestSubOption2, TUSBUiApiTestResult& aTestResult ); |
|
210 TInt GetTestOption( TPtrC aOptionString, TUSBAppTestOption& aOption ); |
|
211 TInt GetAskOnConnectionOptionFromString( TPtrC aOptionString, TInt& aOption ); |
|
212 TInt GetUsbPersonalityOptionFromString( TPtrC aOptionString, TInt& aOption ); |
|
213 TBool IsUsbAppRunning(); |
|
214 TInt GetUsbSettings( TInt& aUsbPersinalityId, TInt& aAskOnConnectionSetting ); |
|
215 TInt SetUsbSettings( TInt aUsbPersinalityId, TInt aAskOnConnectionSetting ); |
|
216 |
|
217 TInt TurnLightsOn( ); |
|
218 |
|
219 |
|
220 |
|
221 inline void Trace(TRefByValue<const TDesC8> aFmt, ...); |
|
222 inline void Trace(TRefByValue<const TDesC16> aFmt, ...); |
|
223 |
|
224 public: // Data |
|
225 // ?one_line_short_description_of_data |
|
226 //?data_declaration; |
|
227 |
|
228 protected: // Data |
|
229 // ?one_line_short_description_of_data |
|
230 //?data_declaration; |
|
231 |
|
232 private: // Data |
|
233 TUSBUiApiTestBlockParams iTestBlockParams; |
|
234 |
|
235 RApaLsSession iApaLsSession; |
|
236 |
|
237 CApaCommandLine *iCommandLine; |
|
238 CRepository *iRepository; |
|
239 |
|
240 TSecureId iUsbAppSecureId; |
|
241 TInt iAskOnConnectionSettingBackup; |
|
242 TInt iUsbPersonalityBackup; |
|
243 TInt iTestAskOnConnectionSetting; |
|
244 TInt iTestUsbPersonality; |
|
245 |
|
246 public: // Friend classes |
|
247 //?friend_class_declaration; |
|
248 protected: // Friend classes |
|
249 //?friend_class_declaration; |
|
250 private: // Friend classes |
|
251 //?friend_class_declaration; |
|
252 |
|
253 }; |
|
254 |
|
255 #include "USBUiApiTestDebug.inl" |
|
256 |
|
257 #endif // USBUIAPITEST_H |
|
258 |
|
259 // End of File |
|