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