33 #include <UsbWatcherInternalCRKeys.h> |
30 #include <UsbWatcherInternalCRKeys.h> |
34 #include <usbman.h> |
31 #include <usbman.h> |
35 #include <usbwatcher.h> |
32 #include <usbwatcher.h> |
36 #include <usb/hostms/srverr.h> |
33 #include <usb/hostms/srverr.h> |
37 // CONSTANTS |
34 // CONSTANTS |
38 //const ?type ?constant_var = ?constant; |
|
39 |
35 |
40 // MACROS |
36 // MACROS |
41 //#define ?macro ?macro_def |
|
42 #define TEST_CLASS_VERSION_MAJOR 0 |
37 #define TEST_CLASS_VERSION_MAJOR 0 |
43 #define TEST_CLASS_VERSION_MINOR 0 |
38 #define TEST_CLASS_VERSION_MINOR 0 |
44 #define TEST_CLASS_VERSION_BUILD 0 |
39 #define TEST_CLASS_VERSION_BUILD 0 |
45 |
40 |
46 // Logging path |
41 // Logging path |
47 //_LIT( KUsbUiNotifApiTestLogPath, "\\logs\\testframework\\UsbUiNotifApiTest\\" ); |
42 _LIT( KUSBUiNotifApiTestLogPath, "e:\\testing\\stiflogs\\" ); |
48 |
|
49 // Logging path for ATS - for phone builds comment this line |
|
50 _LIT( KUsbUiNotifApiTestLogPath, "e:\\testing\\stiflogs\\" ); |
|
51 |
43 |
52 // Log file |
44 // Log file |
53 _LIT( KUsbUiNotifApiTestLogFile, "UsbUiNotifApiTest.txt" ); |
45 _LIT( KUSBUiNotifApiTestLogFile, "USBUiNotifApiTest.txt" ); |
54 _LIT( KUsbUiNotifApiTestLogFileWithTitle, "UsbUiNotifApiTest_[%S].txt" ); |
46 _LIT( KUSBUiNotifApiTestLogFileWithTitle, "USBUiNotifApiTest_[%S].txt" ); |
55 |
47 |
56 // FUNCTION PROTOTYPES |
48 // FUNCTION PROTOTYPES |
57 //?type ?function_name(?arg_list); |
|
58 |
49 |
59 // FORWARD DECLARATIONS |
50 // FORWARD DECLARATIONS |
60 //class ?FORWARD_CLASSNAME; |
51 class CUSBUiNotifApiTest; |
61 class CUsbUiNotifApiTest; |
|
62 |
52 |
63 // DATA TYPES |
53 // DATA TYPES |
64 //enum ?declaration |
|
65 |
|
66 enum TUsbUiNotifApiTestResult |
|
67 { |
|
68 ETestCasePassed, |
|
69 ETestCaseFailed |
|
70 }; |
|
71 |
|
72 enum TTestOption |
54 enum TTestOption |
73 { |
55 { |
74 EQueryDiscarded = 0, |
56 EQueryDiscarded = 0, |
75 EQueryAccepted, |
57 EQueryAccepted, |
76 EQueryCanceled |
58 EQueryCanceled |
77 }; |
59 }; |
78 //typedef ?declaration |
|
79 //extern ?data_type; |
|
80 |
60 |
81 // CLASS DECLARATION |
61 // CLASS DECLARATION |
82 |
62 |
83 NONSHARABLE_CLASS( TUsbUiNotifApiTestBlockParams ) |
|
84 { |
|
85 public: |
|
86 TPtrC iTestBlockName; |
|
87 |
|
88 TPtrC iTestOption1; |
|
89 TPtrC iTestOption2; |
|
90 TPtrC iTestOption3; |
|
91 |
|
92 TInt iTestIntOption1; |
|
93 TInt iTestIntOption2; |
|
94 |
|
95 TChar iTestCharOption1; |
|
96 TChar iTestCharOption2; |
|
97 }; |
|
98 |
|
99 /** |
63 /** |
100 * CUsbUiNotifApiTest test class for STIF Test Framework TestScripter. |
64 * CUSBUiNotifApiTest test class for STIF Test Framework TestScripter. |
101 * ?other_description_lines |
65 * ?other_description_lines |
102 * |
66 * |
103 * @lib ?library |
67 * @lib ?library |
104 * @since ?Series60_version |
68 * @since ?Series60_version |
105 */ |
69 */ |
106 NONSHARABLE_CLASS( CUsbUiNotifApiTest ) : public CScriptBase |
70 NONSHARABLE_CLASS(CUSBUiNotifApiTest) : public CScriptBase |
107 { |
71 { |
108 public: // Constructors and destructor |
72 public: // Constructors and destructor |
109 |
73 |
110 /** |
74 /** |
111 * Two-phased constructor. |
75 * Two-phased constructor. |
112 */ |
76 */ |
113 static CUsbUiNotifApiTest* NewL( CTestModuleIf& aTestModuleIf ); |
77 static CUSBUiNotifApiTest* NewL( CTestModuleIf& aTestModuleIf ); |
114 |
78 |
115 /** |
79 /** |
116 * Destructor. |
80 * Destructor. |
117 */ |
81 */ |
118 virtual ~CUsbUiNotifApiTest(); |
82 virtual ~CUSBUiNotifApiTest(); |
119 |
83 |
120 public: // New functions |
84 public: // New functions |
121 |
|
122 /** |
|
123 * ?member_description. |
|
124 * @since ?Series60_version |
|
125 * @param ?arg1 ?description |
|
126 * @return ?description |
|
127 */ |
|
128 //?type ?member_function( ?type ?arg1 ); |
|
129 |
85 |
130 public: // Functions from base classes |
86 public: // Functions from base classes |
131 |
87 |
132 /** |
88 /** |
133 * From CScriptBase Runs a script line. |
89 * From CScriptBase Runs a script line. |
157 private: |
105 private: |
158 |
106 |
159 /** |
107 /** |
160 * C++ default constructor. |
108 * C++ default constructor. |
161 */ |
109 */ |
162 CUsbUiNotifApiTest( CTestModuleIf& aTestModuleIf ); |
110 CUSBUiNotifApiTest( CTestModuleIf& aTestModuleIf ); |
163 |
111 |
164 /** |
112 /** |
165 * By default Symbian 2nd phase constructor is private. |
113 * By default Symbian 2nd phase constructor is private. |
166 */ |
114 */ |
167 void ConstructL(); |
115 void ConstructL(); |
168 |
|
169 // Prohibit copy constructor if not deriving from CBase. |
|
170 // ?classname( const ?classname& ); |
|
171 // Prohibit assigment operator if not deriving from CBase. |
|
172 // ?classname& operator=( const ?classname& ); |
|
173 |
116 |
174 /** |
117 /** |
175 * Frees all resources allocated from test methods. |
118 * Frees all resources allocated from test methods. |
176 * @since ?Series60_version |
119 * @since ?Series60_version |
177 */ |
120 */ |
178 void Delete(); |
121 void Delete(); |
179 |
122 |
180 /** |
123 /** |
181 * Test methods are listed below. |
124 * Test methods are listed below. |
182 */ |
125 */ |
183 |
126 virtual TInt CableConnectedNotifierTest( CStifItemParser& aItem ); |
184 virtual TInt ExecuteApiTestBlock( CStifItemParser& aItem ); |
127 virtual TInt FinishCableConnectedQuery( CStifItemParser& aItem ); |
185 virtual TInt ExecuteModuleTestBlock( CStifItemParser& aItem ); |
128 virtual TInt UsbQueriesNotifierTest( CStifItemParser& aItem ); |
186 virtual TInt ExecuteBranchTestBlock( CStifItemParser& aItem ); |
129 virtual TInt UsbOTGErrorNotifierTests( CStifItemParser& aItem ); |
187 |
130 virtual TInt UsbOTGWarningNotifierTests( CStifItemParser& aItem ); |
188 |
131 virtual TInt FinishQuery( CStifItemParser& aItem ); |
189 |
132 virtual TInt LoadNotifiersL( CStifItemParser& aItem ); |
|
133 virtual TInt UnLoadNotifiers ( CStifItemParser& aItem ); |
|
134 virtual TInt UsbMSMMNotifierTests ( CStifItemParser& aItem ); |
|
135 virtual TInt CancelMsmmNotifier( CStifItemParser& aItem ); |
|
136 virtual TInt CancelQueryNotifier( CStifItemParser& aItem ); |
|
137 virtual TInt CancelOtgErrorNotifier( CStifItemParser& aItem ); |
|
138 virtual TInt CancelOtgWarningNotifier( CStifItemParser& aItem ); |
|
139 virtual TInt CancelCableConnectedNotifier( CStifItemParser& aItem ); |
|
140 virtual TInt WaitForRequest( CStifItemParser& aItem ); |
|
141 virtual TInt SynchStart( CStifItemParser& aItem ); |
|
142 virtual TInt Update( CStifItemParser& aItem ); |
190 /** |
143 /** |
191 * Method used to log version of test class |
144 * Method used to log version of test class |
192 */ |
145 */ |
193 void SendTestClassVersion(); |
146 void SendTestClassVersion(); |
194 |
147 |
195 //ADD NEW METHOD DEC HERE |
148 //ADD NEW METHOD DEC HERE |
196 //[TestMethods] - Do not remove |
149 //[TestMethods] - Do not remove |
197 |
|
198 void GetTestBlockParamsL( CStifItemParser& aItem ); |
|
199 |
|
200 void DoExecuteApiTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult ); |
|
201 void DoExecuteModuleTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult ); |
|
202 void DoExecuteBranchTestBlockL( CStifItemParser& aItem, TUsbUiNotifApiTestResult& aTestResult ); |
|
203 |
|
204 void ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption, |
|
205 TInt aTestIntOption, TInt aTestCharOption, TUsbUiNotifApiTestResult& aTestResult ); |
|
206 |
|
207 void CableConnectedNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult ); |
|
208 void ConnectionNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult ); |
|
209 void UsbQueriesNotifierTest( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult ); |
|
210 void UsbOTGErrorNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult ); |
|
211 void UsbOTGWarningNotifierTests( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult ); |
|
212 TInt FinishQuery( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult ); |
|
213 void LoadNotifiersL( TUsbUiNotifApiTestResult& aTestResult ); |
|
214 void UnLoadNotifiers ( TUsbUiNotifApiTestResult& aTestResult ); |
|
215 void Update( TUsbUiNotifApiTestResult& aTestResult ); |
|
216 //void Cancelnotifier( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult ); |
|
217 void Notifierstart( TUsbUiNotifApiTestResult& aTestResult ); |
|
218 //void AsyncConnectionNotifier ( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult ); |
|
219 void UsbMSMMNotifierTests ( TPtrC aTestSubOption, TUsbUiNotifApiTestResult& aTestResult ); |
|
220 |
|
221 TInt GetTestOption( TPtrC aOptionString, TTestOption& aOption ); |
150 TInt GetTestOption( TPtrC aOptionString, TTestOption& aOption ); |
222 TInt GetPersonalityIdFromString( TPtrC aOptionString, TInt& aPersonalityId ); |
151 TInt GetPersonalityIdFromString( TPtrC aOptionString, TInt& aPersonalityId ); |
223 TInt GetQueryType( TPtrC aTypeString, TUSBUIQueries& aQueryType ); |
152 TInt GetQueryType( TPtrC aTypeString, TUSBUIQueries& aQueryType ); |
224 TInt GetOTGErrorType( TPtrC aTypeString, TUsbUiNotifOtgError& aQueryType ); |
153 TInt GetOTGErrorType( TPtrC aTypeString, TUsbUiNotifOtgError& aQueryType ); |
225 TInt GetOTGWarningType( TPtrC aTypeString, TUsbUiNotifOtgWarning& aQueryType ); |
154 TInt GetOTGWarningType( TPtrC aTypeString, TUsbUiNotifOtgWarning& aQueryType ); |
226 TInt GetMSMMrrorType( TPtrC aTypeString, THostMsErrCode& aQueryType ); |
155 TInt GetMSMMrrorType( TPtrC aTypeString, THostMsErrCode& aQueryType ); |
|
156 TInt FindAndKillProcess(const TDesC& aProcessName); |
227 |
157 |
228 inline void Trace(TRefByValue<const TDesC8> aFmt, ...); |
|
229 inline void Trace(TRefByValue<const TDesC16> aFmt, ...); |
|
230 |
|
231 public: // Data |
158 public: // Data |
232 // ?one_line_short_description_of_data |
|
233 //?data_declaration; |
|
234 |
159 |
235 protected: // Data |
160 protected: // Data |
236 // ?one_line_short_description_of_data |
|
237 //?data_declaration; |
|
238 |
161 |
239 private: // Data |
162 private: // Data |
240 TUsbUiNotifApiTestBlockParams iTestBlockParams; |
163 |
241 |
|
242 RNotifier *iNotifier; |
164 RNotifier *iNotifier; |
|
165 TBool iNotifierConnected; |
243 RUsbWatcher* iUsbWatcher; |
166 RUsbWatcher* iUsbWatcher; |
244 |
167 |
245 CRepository* iRepository; |
168 CRepository* iRepository; |
246 |
169 |
247 TUSBConnectionNotifierParamsPckg iConnectionNotifierResponseParamsPckg; |
170 TUSBConnectionNotifierParamsPckg iConnectionNotifierResponseParamsPckg; |