|
1 /* |
|
2 * Copyright (c) 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 "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: Test module method implementations |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <e32svr.h> |
|
22 #include <stiflogger.h> |
|
23 #include <stifparser.h> |
|
24 #include <stiftestinterface.h> |
|
25 #include <mtp/cmtpdataproviderplugin.h> |
|
26 #include <mtp/mmtpdataprovider.h> |
|
27 #include <ecom/ecom.h> |
|
28 #include <mtp/tmtptypeevent.h> |
|
29 #include <mtp/mtpprotocolconstants.h> |
|
30 #include <mtp/tmtptyperequest.h> |
|
31 #include <mtp/cmtptypeobjectinfo.h> |
|
32 #include <mtp/cmtptypeobjectproplist.h> |
|
33 #include <mtp/cmtptypefile.h> |
|
34 #include <mtp/cmtptypestring.h> |
|
35 #include <mtp/cmtptypearray.h> |
|
36 #include <mtp/cmtptypeobjectpropdesc.h> |
|
37 #include <bautils.h> |
|
38 #include <e32debug.h> |
|
39 |
|
40 #include "cmmmtpdataprovidertestmodule.h" |
|
41 #include "cmmmtpdataprovidertester.h" |
|
42 #include "cmediamtpdataprovidertester.h" |
|
43 #include "cabstractmediamtpdataprovidertester.h" |
|
44 #include "logging.h" |
|
45 |
|
46 // MACROS |
|
47 |
|
48 #ifdef LOGGER |
|
49 #undef LOGGER |
|
50 #endif |
|
51 #define LOGGER iLog |
|
52 #ifdef PRINTTESTMODULEIF |
|
53 #undef PRINTTESTMODULEIF |
|
54 #endif |
|
55 #define PRINTTESTMODULEIF( p ) TestModuleIf().Printf( 0, KTestModuleName, p ); |
|
56 #ifdef PRINTTESTMODULE |
|
57 #undef PRINTTESTMODULE |
|
58 #endif |
|
59 #define PRINTTESTMODULE( p ) this->SetResultDescription( p ); |
|
60 |
|
61 // MEMBER FUNCTIONS |
|
62 |
|
63 void CMmMtpDataProviderTestModule::Delete() |
|
64 { |
|
65 PRINTF0( ">CMmMtpDataProviderTestModule::Delete()" ); |
|
66 delete iDataProviderPlugin; |
|
67 delete iPluginTester; |
|
68 |
|
69 if ( iRequest != NULL ) |
|
70 { |
|
71 PRINTN0( "Delete request" ); |
|
72 delete iRequest; |
|
73 } |
|
74 REComSession::FinalClose(); |
|
75 PRINTF0( "<CMmMtpDataProviderTestModule::Delete()" ); |
|
76 } |
|
77 |
|
78 TInt CMmMtpDataProviderTestModule::RunMethodL( CStifItemParser& aItem ) |
|
79 { |
|
80 PRINTF0( ">CMmMtpDataProviderTestModule::RunMethodL" ); |
|
81 |
|
82 static TStifFunctionInfo const KFunctions[] = |
|
83 { |
|
84 // Copy this line for every implemented function. |
|
85 // First string is the function name used in TestScripter script file. |
|
86 // Second is the actual implementation member function. |
|
87 ENTRY( "LoadPlugin", CMmMtpDataProviderTestModule::LoadPluginL ), |
|
88 ENTRY( "PrepareEnvironment", CMmMtpDataProviderTestModule::PrepareEnvironmentL ), |
|
89 ENTRY( "CleanEnvironment", CMmMtpDataProviderTestModule::CleanEnvironmentL ), |
|
90 ENTRY( "OpenSession", CMmMtpDataProviderTestModule::OpenSessionL ), |
|
91 ENTRY( "CloseSession", CMmMtpDataProviderTestModule::CloseSessionL ), |
|
92 ENTRY( "ObjectEnumeration", CMmMtpDataProviderTestModule::ObjectEnumerationL ), |
|
93 ENTRY( "StorageEnumeration", CMmMtpDataProviderTestModule::StorageEnumerationL ), |
|
94 ENTRY( "StartTransaction", CMmMtpDataProviderTestModule::StartTransactionL ), |
|
95 ENTRY( "CancelTransaction", CMmMtpDataProviderTestModule::CancelTransactionL ), |
|
96 ENTRY( "CompleteTransaction", CMmMtpDataProviderTestModule::CompleteTransactionL ), |
|
97 ENTRY( "GetObjectInfo", CMmMtpDataProviderTestModule::GetObjectInfoL ), |
|
98 ENTRY( "GetObject", CMmMtpDataProviderTestModule::GetObjectL ), |
|
99 ENTRY( "GetObjectPropValue", CMmMtpDataProviderTestModule::GetObjectPropValueL ), |
|
100 ENTRY( "GetObjectPropList", CMmMtpDataProviderTestModule::GetObjectPropListL ), |
|
101 ENTRY( "GetObjectPropDesc", CMmMtpDataProviderTestModule::GetObjectPropDescL ), |
|
102 ENTRY( "SendObjectInfo", CMmMtpDataProviderTestModule::SendObjectInfoL ), |
|
103 ENTRY( "SendObject", CMmMtpDataProviderTestModule::SendObjectL ), |
|
104 ENTRY( "SetObjectPropValue", CMmMtpDataProviderTestModule::SetObjectPropValueL ), |
|
105 ENTRY( "SetObjectPropList", CMmMtpDataProviderTestModule::SetObjectPropListL ), |
|
106 ENTRY( "DeleteObject", CMmMtpDataProviderTestModule::DeleteObjectL ), |
|
107 ENTRY( "CopyObject", CMmMtpDataProviderTestModule::CopyObjectL ), |
|
108 ENTRY( "MoveObject", CMmMtpDataProviderTestModule::MoveObjectL ), |
|
109 ENTRY( "RenameObject", CMmMtpDataProviderTestModule::RenameObjectL ), |
|
110 ENTRY( "GetPartialObject", CMmMtpDataProviderTestModule::GetPartialObjectL ), |
|
111 ENTRY( "SetObjectReferences", CMmMtpDataProviderTestModule::SetObjectReferencesL ), |
|
112 ENTRY( "GetObjectReferences", CMmMtpDataProviderTestModule::GetObjectReferencesL ), |
|
113 ENTRY( "GetObjectPropsSupported", CMmMtpDataProviderTestModule::GetObjectPropsSupportedL) |
|
114 }; |
|
115 |
|
116 const TInt count = sizeof( KFunctions ) / |
|
117 sizeof( TStifFunctionInfo ); |
|
118 |
|
119 TInt result = RunInternalL( KFunctions, count, aItem ); |
|
120 PRINTF1( "<CMmMtpDataProviderTestModule::RunMethodL, result = %d", result ); |
|
121 return result; |
|
122 } |
|
123 |
|
124 TInt CMmMtpDataProviderTestModule::LoadPluginL( CStifItemParser& aItem ) |
|
125 { |
|
126 PRINTM0( "LoadPlugin" ); |
|
127 |
|
128 TPtrC string; |
|
129 TInt result; |
|
130 |
|
131 result = aItem.GetNextString ( string ); |
|
132 if ( result == KErrNone ) |
|
133 { |
|
134 _LIT( KMediaDpString, "mediamtpdp" ); |
|
135 _LIT( KAbstractMediaDpString, "abstractmediamtpdp" ); |
|
136 const TInt KMediaDpUid = 0x10207C4B; |
|
137 const TInt KAbstractMediaDpUid = 0x10207C53; |
|
138 TInt uidValue = 0; |
|
139 |
|
140 if ( string.CompareF( KMediaDpString() ) == 0 ) |
|
141 { |
|
142 PRINTM0( "Loading mediamtpdp plugin" ); |
|
143 uidValue = KMediaDpUid; |
|
144 iPluginTester = CMediaMtpDataProviderTester::NewL(); |
|
145 } |
|
146 else |
|
147 { |
|
148 if ( string.CompareF( KAbstractMediaDpString() ) == 0 ) |
|
149 { |
|
150 PRINTM0( "Loading abstractmediamtpdp plugin" ); |
|
151 uidValue = KAbstractMediaDpUid; |
|
152 iPluginTester = CAbstractMediaMtpDataProviderTester::NewL(); |
|
153 } |
|
154 else |
|
155 { |
|
156 PRINTE0( "Unknown plugin" ); |
|
157 User::Leave( KErrArgument ); |
|
158 } |
|
159 } |
|
160 |
|
161 TUid pluginUid; |
|
162 pluginUid = TUid::Uid( uidValue ); |
|
163 iDataProviderPlugin = CMTPDataProviderPlugin::NewL( pluginUid, iTestObserver ); |
|
164 iPluginTester->RegisterObserver( iTestObserver, iTestConnChannel, iDataProviderPlugin ); |
|
165 } |
|
166 else |
|
167 { |
|
168 PRINTE0( "Missing parameter: plugin name" ); |
|
169 result = KErrArgument; |
|
170 } |
|
171 |
|
172 PRINTN1( "Exiting LoadPluginL with result %d", result ); |
|
173 return result; |
|
174 } |
|
175 |
|
176 TInt CMmMtpDataProviderTestModule::PrepareEnvironmentL( CStifItemParser& /*aItem*/ ) |
|
177 { |
|
178 PRINTM0( "PrepareEnvironment" ); |
|
179 |
|
180 TInt result = iPluginTester->PrepareEnvironmentL(); |
|
181 if ( result != KErrNone ) |
|
182 { |
|
183 PRINTE0( "Preparing environment failed" ); |
|
184 } |
|
185 PRINTN1( "Exiting PrepareEnvironmentL with result %d", result ); |
|
186 return result; |
|
187 } |
|
188 |
|
189 TInt CMmMtpDataProviderTestModule::CleanEnvironmentL( CStifItemParser& /*aItem*/ ) |
|
190 { |
|
191 PRINTM0( "CleanEnvironment" ); |
|
192 |
|
193 TInt result = iPluginTester->CleanEnvironmentL(); |
|
194 if ( result != KErrNone ) |
|
195 { |
|
196 PRINTE0( "Cleaning environment failed" ); |
|
197 } |
|
198 PRINTN1( "Exiting CleanEnvironmentL with result %d", result ); |
|
199 return result; |
|
200 } |
|
201 |
|
202 TInt CMmMtpDataProviderTestModule::OpenSessionL ( CStifItemParser& aItem ) |
|
203 { |
|
204 PRINTM0( "OpenSession" ); |
|
205 |
|
206 TInt result = KErrNone; |
|
207 if ( iSessionOpen ) |
|
208 { |
|
209 PRINTE0( "OpenSession failed, session already open" ); |
|
210 result = KErrNotReady; |
|
211 } |
|
212 else |
|
213 { |
|
214 iSessionId++; |
|
215 TInt sessionId; |
|
216 result = aItem.GetNextInt ( sessionId ); |
|
217 if ( result == KErrNone ) |
|
218 { |
|
219 PRINTN1( "Got session id parameter: %d", sessionId ); |
|
220 iSessionId = sessionId; |
|
221 } |
|
222 else |
|
223 { |
|
224 PRINTN1( "GetNextInt returned %d", result ); |
|
225 } |
|
226 |
|
227 TMTPNotificationParamsSessionChange param = { iSessionId, *iTestConnChannel } ; |
|
228 if ( iPluginTester->OpenSessionL_prepare( param ) ) |
|
229 { |
|
230 iDataProviderPlugin->ProcessNotificationL( EMTPSessionOpened, ¶m ); |
|
231 result = iPluginTester->OpenSessionL_checkresults(); |
|
232 if ( result == KErrNone ) |
|
233 { |
|
234 iSessionOpen = ETrue; |
|
235 } |
|
236 else |
|
237 { |
|
238 PRINTE0( "OpenSession result check failed" ); |
|
239 } |
|
240 } |
|
241 else |
|
242 { |
|
243 PRINTE0( "OpenSession prepare phase failed" ); |
|
244 result = KErrGeneral; |
|
245 } |
|
246 } |
|
247 |
|
248 PRINTN1( "Exiting OpenSession with result %d", result ); |
|
249 return result; |
|
250 } |
|
251 |
|
252 TInt CMmMtpDataProviderTestModule::CloseSessionL ( CStifItemParser& aItem ) |
|
253 { |
|
254 PRINTM0( "CloseSession" ); |
|
255 |
|
256 TInt result = KErrNone; |
|
257 if ( !iSessionOpen ) |
|
258 { |
|
259 PRINTE0( "CloseSession failed, session not open" ); |
|
260 result = KErrNotReady; |
|
261 } |
|
262 else |
|
263 { |
|
264 TMTPNotificationParamsSessionChange param = { iSessionId, *iTestConnChannel }; |
|
265 if ( iPluginTester->CloseSessionL_prepare( param ) ) |
|
266 { |
|
267 iDataProviderPlugin->ProcessNotificationL( EMTPSessionClosed, ¶m ); |
|
268 result = iPluginTester->CloseSessionL_checkresults(); |
|
269 if ( result == KErrNone ) |
|
270 { |
|
271 iSessionId = 0; |
|
272 iSessionOpen = EFalse; |
|
273 iTransactionId = 0; // start transaction numbering from beginning |
|
274 iTransactionOpen = EFalse; |
|
275 } |
|
276 else |
|
277 { |
|
278 PRINTE0( "CloseSession result check failed" ); |
|
279 } |
|
280 } |
|
281 else |
|
282 { |
|
283 PRINTE0( "CloseSession prepare phase failed" ); |
|
284 result = KErrGeneral; |
|
285 } |
|
286 } |
|
287 PRINTN1( "Exiting CloseSession with result %d", result ); |
|
288 return result; |
|
289 } |
|
290 |
|
291 TInt CMmMtpDataProviderTestModule::ObjectEnumerationL( CStifItemParser& /*aItem*/ ) |
|
292 { |
|
293 PRINTM0( "ObjectEnumeration" ); |
|
294 |
|
295 TInt result = KErrNotReady; |
|
296 |
|
297 TBool complete = iTestObserver->ObjectEnumerationComplete(); |
|
298 if ( complete == EFalse ) |
|
299 { |
|
300 CMTPStorageMetaData* physicalStorage( CMTPStorageMetaData::NewLC() ); |
|
301 CMTPStorageMetaData* logicalStorage( CMTPStorageMetaData::NewLC() ); |
|
302 if ( iPluginTester->ObjectEnumerationL_prepare( physicalStorage, logicalStorage ) ) |
|
303 { |
|
304 TUint32 physicalStorageId; |
|
305 physicalStorageId = iTestObserver->StorageMgr().AllocatePhysicalStorageIdL( 0, *physicalStorage ); |
|
306 physicalStorage->SetUint( CMTPStorageMetaData::EStorageId, physicalStorageId ); |
|
307 TUint32 logicalStorageId; |
|
308 TRAP_IGNORE( logicalStorageId = iTestObserver->StorageMgr().AllocateLogicalStorageIdL( 0, physicalStorageId, *logicalStorage ) ); |
|
309 logicalStorage->SetUint( CMTPStorageMetaData::EStorageId, logicalStorageId ); |
|
310 iTestObserver->SetPendingOperation( CTestObserver::EObjectEnumeration ); |
|
311 iDataProviderPlugin->StartObjectEnumerationL( KMTPStorageAll ); |
|
312 iTestObserver->WaitForPendingOperation(); |
|
313 result = iPluginTester->ObjectEnumerationL_checkresults( iTestObserver->ObjectMgr() ); |
|
314 if ( result != KErrNone ) |
|
315 { |
|
316 PRINTE0( "ObjectEnumeration result check failed" ); |
|
317 } |
|
318 } |
|
319 else |
|
320 { |
|
321 PRINTE0 ( "ObjectEnumeration prepare phase failed" ); |
|
322 result = KErrGeneral; |
|
323 } |
|
324 CleanupStack::PopAndDestroy( 2 ); // logicalStorage, physicalStorage |
|
325 } |
|
326 else |
|
327 { |
|
328 PRINTE0( "Object enumeration already run in this session" ); |
|
329 result = KErrGeneral; |
|
330 } |
|
331 |
|
332 PRINTN1( "Exiting ObjectEnumerationL with result %d", result ); |
|
333 return result; |
|
334 } |
|
335 |
|
336 TInt CMmMtpDataProviderTestModule::StorageEnumerationL( CStifItemParser& /*aItem*/ ) |
|
337 { |
|
338 PRINTM0( "StorageEnumeration" ); |
|
339 |
|
340 TInt result = KErrNotReady; |
|
341 TBool complete = iTestObserver->StorageEnumerationComplete(); |
|
342 if ( complete == EFalse ) |
|
343 { |
|
344 if ( iPluginTester->StorageEnumerationL_prepare() ) |
|
345 { |
|
346 iDataProviderPlugin->StartStorageEnumerationL(); |
|
347 complete = iTestObserver->StorageEnumerationComplete(); |
|
348 if (complete) |
|
349 { |
|
350 result = KErrNone; |
|
351 } |
|
352 } |
|
353 else |
|
354 { |
|
355 PRINTE0( "StartStorageEnumeration prepare phase failed" ); |
|
356 result = KErrGeneral; |
|
357 } |
|
358 } |
|
359 else |
|
360 { |
|
361 PRINTE0( "Storage enumeration already run in this session" ); |
|
362 result = KErrGeneral; |
|
363 } |
|
364 return result; |
|
365 } |
|
366 |
|
367 TInt CMmMtpDataProviderTestModule::StartTransactionL( CStifItemParser& aItem ) |
|
368 { |
|
369 PRINTM0( "StartTransaction" ); |
|
370 |
|
371 TInt result = KErrNone; |
|
372 if ( iSessionOpen ) |
|
373 { |
|
374 if ( iTransactionOpen ) |
|
375 { |
|
376 PRINTE0( "StartTransaction failed, transaction already open" ); |
|
377 result = KErrGeneral; |
|
378 } |
|
379 else |
|
380 { |
|
381 if ( iRequest != NULL ) |
|
382 { |
|
383 PRINTN0( "Delete previous request" ); |
|
384 delete iRequest; |
|
385 iRequest = NULL; |
|
386 } |
|
387 iRequest = new TMTPTypeRequest(); |
|
388 iTransactionId++; |
|
389 iTransactionOpen = ETrue; |
|
390 iTestObserver->SetPhaseL( EUndefined ); |
|
391 } |
|
392 } |
|
393 else |
|
394 { |
|
395 PRINTE0( "StartTransaction failed, session not open" ); |
|
396 result = KErrNotReady; |
|
397 } |
|
398 |
|
399 PRINTN1( "Exiting StartTransactionL with result %d", result ); |
|
400 return result; |
|
401 } |
|
402 |
|
403 // Notify that the current transaction has been cancelled. |
|
404 // Affects: |
|
405 // Response code of GetObject response phase |
|
406 // Also default response code of other operations |
|
407 // (EMTPRespCodeIncompleteTransfer) |
|
408 // Outcome of SendObject/SendObjectInfo (should rollback) |
|
409 TInt CMmMtpDataProviderTestModule::CancelTransactionL( CStifItemParser& /*aItem*/ ) |
|
410 { |
|
411 PRINTM0( "CancelTransaction" ); |
|
412 |
|
413 TInt result = KErrNone; |
|
414 iTransactionOpen = EFalse; |
|
415 TMTPTypeEvent eventDataSet; |
|
416 eventDataSet.SetUint16( TMTPTypeEvent::EEventCode, EMTPEventCodeCancelTransaction ); |
|
417 iDataProviderPlugin->ProcessEventL( eventDataSet, *iTestConnChannel ); |
|
418 |
|
419 PRINTN1( "Exiting CancelTransactionL with result %d", result ); |
|
420 return result; |
|
421 } |
|
422 |
|
423 TInt CMmMtpDataProviderTestModule::CompleteTransactionL( CStifItemParser& aItem ) |
|
424 { |
|
425 PRINTM0( "CompleteTransaction" ); |
|
426 |
|
427 TInt result = KErrNone; |
|
428 if ( iSessionOpen ) |
|
429 { |
|
430 if ( !iTransactionOpen ) |
|
431 { |
|
432 PRINTE0( "CompleteTransaction failed, transaction not open" ); |
|
433 result = KErrNotReady; |
|
434 } |
|
435 else |
|
436 { |
|
437 iTransactionOpen = EFalse; |
|
438 TMTPTransactionPhase phase = iTestObserver->SetPhaseL( ECompletingPhase ); |
|
439 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
440 } |
|
441 } |
|
442 else |
|
443 { |
|
444 PRINTE0( "CompleteTransaction failed, session not open" ); |
|
445 result = KErrNotReady; |
|
446 } |
|
447 return result; |
|
448 } |
|
449 |
|
450 TInt CMmMtpDataProviderTestModule::GetObjectInfoL( CStifItemParser& /*aItem*/ ) |
|
451 { |
|
452 PRINTM0( "GetObjectInfo" ); |
|
453 |
|
454 if ( !iTransactionOpen ) |
|
455 { |
|
456 PRINTE0( "Running GetObjectInfo without open transaction" ); |
|
457 return KErrGeneral; |
|
458 } |
|
459 |
|
460 TMTPTransactionPhase phase; |
|
461 TInt result = KErrNone; |
|
462 |
|
463 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
464 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
465 TUint32 objectHandle = 2; |
|
466 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); |
|
467 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetObjectInfo ); |
|
468 |
|
469 if ( iPluginTester->GetObjectInfoL_prepare( *iRequest ) ) |
|
470 { |
|
471 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
472 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
473 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
474 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
475 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
476 { |
|
477 PRINTE0( "GetObjectInfo request failed" ); |
|
478 PRINTE1( "Response code: 0x%x" , iTestObserver->iResponseCode ); |
|
479 result = KErrGeneral; |
|
480 } |
|
481 else |
|
482 { |
|
483 result = iPluginTester->GetObjectInfoL_checkresults( static_cast<const CMTPTypeObjectInfo*> ( iTestObserver->iMMTPTypeData ) ); |
|
484 if ( result != KErrNone ) |
|
485 { |
|
486 PRINTE0( "GetObjectInfo result check failed" ); |
|
487 } |
|
488 } |
|
489 } |
|
490 else |
|
491 { |
|
492 PRINTE0( "GetObjectInfo prepare phase failed" ); |
|
493 result = KErrGeneral; |
|
494 } |
|
495 |
|
496 PRINTN1( "Exiting GetObjectInfoL with result %d", result ); |
|
497 return result; |
|
498 } |
|
499 |
|
500 TInt CMmMtpDataProviderTestModule::GetObjectL( CStifItemParser& /*aItem*/ ) |
|
501 { |
|
502 PRINTM0( "GetObject" ); |
|
503 |
|
504 if ( !iTransactionOpen ) |
|
505 { |
|
506 PRINTE0( "Running GetObject without open transaction" ); |
|
507 return KErrGeneral; |
|
508 } |
|
509 |
|
510 TMTPTransactionPhase phase; |
|
511 TInt result = KErrNone; |
|
512 |
|
513 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
514 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
515 TUint32 objectHandle = 2; |
|
516 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); |
|
517 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, KMTPFormatsAll ); |
|
518 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetObject ); |
|
519 |
|
520 if ( iPluginTester->GetObjectL_prepare( *iRequest ) ) |
|
521 { |
|
522 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
523 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
524 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
525 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
526 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
527 { |
|
528 PRINTE0( "GetObjectInfo request failed" ); |
|
529 PRINTE1( "Response code: 0x%x" , iTestObserver->iResponseCode ); |
|
530 result = KErrGeneral; |
|
531 } |
|
532 else |
|
533 { |
|
534 result = iPluginTester->GetObjectL_checkresults( const_cast<CMTPTypeFile*>( static_cast<const CMTPTypeFile*>( iTestObserver->iMMTPTypeData ) ) ); |
|
535 if ( result != KErrNone ) |
|
536 { |
|
537 PRINTE0( "GetObject result check failed" ); |
|
538 } |
|
539 } |
|
540 } |
|
541 else |
|
542 { |
|
543 result = KErrGeneral; |
|
544 PRINTE0( "GetObject prepare phase failed" ); |
|
545 } |
|
546 |
|
547 PRINTN1( "Exiting GetObjectL with result %d", result ); |
|
548 return result; |
|
549 } |
|
550 |
|
551 TInt CMmMtpDataProviderTestModule::GetObjectPropValueL( CStifItemParser& aItem ) |
|
552 { |
|
553 PRINTM0( "GetObjectPropValue" ); |
|
554 |
|
555 TMTPTransactionPhase phase; |
|
556 TInt result = KErrNone; |
|
557 |
|
558 // get supported properties and test with them all |
|
559 RArray<TUint> properties; |
|
560 iDataProviderPlugin->Supported( EObjectProperties, properties ); |
|
561 |
|
562 for ( TInt i = 0; i < properties.Count(); i++ ) |
|
563 { |
|
564 switch ( properties[i] ) |
|
565 { |
|
566 //case EMTPObjectPropCodeObjectFileName: // 0xDC07 |
|
567 case EMTPObjectPropCodeName: // 0xDC44 |
|
568 case EMTPObjectPropCodeArtist: // 0xDC46 |
|
569 //case EMTPObjectPropCodeGenre: // 0xDC8C |
|
570 //case EMTPObjectPropCodeParentalRating: // 0xDC94 |
|
571 //case EMTPObjectPropCodeComposer: // 0xDC96 |
|
572 //case EMTPObjectPropCodeOriginalReleaseDate: // 0xDC99 |
|
573 case EMTPObjectPropCodeAlbumName: // 0xDC9A |
|
574 //case EMTPObjectPropCodeEncodingProfile: // 0xDEA1 |
|
575 //case EMTPObjectPropCodeDescription: |
|
576 //case EMTPObjectPropCodeWidth: // 0xDC87 |
|
577 //case EMTPObjectPropCodeHeight: // 0xDC88 |
|
578 //case EMTPObjectPropCodeDuration: // 0xDC89 |
|
579 //case EMTPObjectPropCodeUseCount: // 0xDC91 |
|
580 //case EMTPObjectPropCodeSampleRate: // 0xDE93 |
|
581 //case EMTPObjectPropCodeAudioWAVECodec: // 0xDE99 |
|
582 //case EMTPObjectPropCodeAudioBitRate: // 0xDE9A |
|
583 //case EMTPObjectPropCodeVideoFourCCCodec: // 0xDE9B |
|
584 //case EMTPObjectPropCodeVideoBitRate: // 0xDE9C |
|
585 //case EMTPObjectPropCodeFramesPerThousandSeconds: // 0xDE9D |
|
586 //case EMTPObjectPropCodeKeyFrameDistance: // 0xDE9E |
|
587 //case EMTPObjectPropCodeTrack: // 0xDC8B |
|
588 //case EMTPObjectPropCodeDRMStatus: // 0xDC9D |
|
589 //case EMTPObjectPropCodeNumberOfChannels: // 0xDE94 |
|
590 //case EMTPObjectPropCodeScanType: // 0xDE97 |
|
591 //case EMTPExtObjectPropCodeOmaDrmStatus: |
|
592 result = StartTransactionL( aItem ); |
|
593 if ( result != KErrNone ) |
|
594 { |
|
595 break; // transaction cycle is broken, better to abort |
|
596 } |
|
597 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
598 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
599 TUint32 objectHandle = 2; |
|
600 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); |
|
601 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, properties[i] ); |
|
602 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetObjectPropValue ); |
|
603 |
|
604 if ( iPluginTester->GetObjectPropValueL_prepare( *iRequest ) ) |
|
605 { |
|
606 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
607 PRINTV1( "Testing with property 0x%x" , properties[i] ); |
|
608 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
609 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
610 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
611 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
612 { |
|
613 if ( iTestObserver->iResponseCode == EMTPRespCodeAccessDenied ) |
|
614 { |
|
615 PRINTN1( "Could not access value for property 0x%x", properties[i] ); |
|
616 } |
|
617 else |
|
618 { |
|
619 PRINTE0( "GetObjectPropValue request failed" ); |
|
620 PRINTE2( "Property code: 0x%x, response code: 0x%x", properties[i], iTestObserver->iResponseCode ); |
|
621 result = KErrGeneral; |
|
622 } |
|
623 } |
|
624 else |
|
625 { |
|
626 result = iPluginTester->GetObjectPropValueL_checkresults( iTestObserver->iMMTPTypeData, properties[i] ); |
|
627 if ( result != KErrNone ) |
|
628 { |
|
629 PRINTE0( "GetObjectPropValue result check failed" ); |
|
630 } |
|
631 } |
|
632 } |
|
633 else |
|
634 { |
|
635 PRINTE0( "GetObjectPropValue prepare phase failed" ); |
|
636 result = KErrGeneral; |
|
637 } |
|
638 |
|
639 result = CompleteTransactionL( aItem ); |
|
640 break; |
|
641 } |
|
642 // don't allow errors in any request |
|
643 if ( result != KErrNone ) |
|
644 { |
|
645 break; |
|
646 } |
|
647 } |
|
648 properties.Close(); |
|
649 PRINTN1( "Exiting GetObjectPropValueL with result %d", result ); |
|
650 return result; |
|
651 } |
|
652 |
|
653 TInt CMmMtpDataProviderTestModule::GetObjectPropListL( CStifItemParser& aItem ) |
|
654 { |
|
655 PRINTM0( "GetObjectPropList" ); |
|
656 |
|
657 if ( !iTransactionOpen ) |
|
658 { |
|
659 PRINTE0( "Running GetObjectPropList without open transaction" ); |
|
660 return KErrGeneral; |
|
661 } |
|
662 |
|
663 TMTPTransactionPhase phase; |
|
664 TInt result = KErrNone; |
|
665 |
|
666 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
667 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
668 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, KMTPHandleAll ); |
|
669 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, KMTPFormatsAll ); |
|
670 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter3, EMTPObjectPropCodeUndefined ); |
|
671 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter4, 0x00FF0000 ); // mediadb group |
|
672 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter5, 0 ); // depth |
|
673 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetObjectPropList ); |
|
674 |
|
675 if ( iPluginTester->GetObjectPropListL_prepare( *iRequest ) ) |
|
676 { |
|
677 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
678 iTestObserver->SetPendingOperation( CTestObserver::EGetObjectPropList ); |
|
679 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
680 result = iTestObserver->WaitForPendingOperation(); |
|
681 if ( result != KErrNone ) |
|
682 { |
|
683 PRINTE0( "GetObjectPropList asynchronous operation failed" ); |
|
684 } |
|
685 else |
|
686 { |
|
687 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
688 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
689 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
690 { |
|
691 PRINTE0( "GetObjectPropList request failed" ); |
|
692 PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); |
|
693 result = KErrGeneral; |
|
694 } |
|
695 else |
|
696 { |
|
697 result = iPluginTester->GetObjectPropListL_checkresults( static_cast<const CMTPTypeObjectPropList*>( iTestObserver->iMMTPTypeData ) ); |
|
698 if ( result != KErrNone ) |
|
699 { |
|
700 PRINTE0( "GetObjectPropList result check failed" ); |
|
701 } |
|
702 } |
|
703 } |
|
704 } |
|
705 else |
|
706 { |
|
707 PRINTE0( "GetObjectPropList prepare phase failed" ); |
|
708 result = KErrGeneral; |
|
709 } |
|
710 |
|
711 PRINTN1( "Exiting GetObjectPropList with result %d", result ); |
|
712 return result; |
|
713 } |
|
714 |
|
715 TInt CMmMtpDataProviderTestModule::GetObjectPropDescL( CStifItemParser& aItem ) |
|
716 { |
|
717 PRINTM0( "GetObjectPropDesc" ); |
|
718 |
|
719 TMTPTransactionPhase phase; |
|
720 TInt result = KErrNone; |
|
721 |
|
722 // get supported properties and test with them all |
|
723 RArray<TUint> properties; |
|
724 iDataProviderPlugin->Supported( EObjectProperties, properties ); |
|
725 |
|
726 for ( TInt i = 0; i < properties.Count(); i++ ) |
|
727 { |
|
728 if ( properties[i] < 0xde99 ) // some problem with these |
|
729 { |
|
730 result = StartTransactionL( aItem ); |
|
731 if ( result != KErrNone ) |
|
732 { |
|
733 break; // transaction cycle is broken, better to abort |
|
734 } |
|
735 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
736 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
737 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, KMTPFormatsAll ); |
|
738 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetObjectPropDesc ); |
|
739 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, properties[i] ); |
|
740 TInt result = KErrNone; |
|
741 if ( iPluginTester->GetObjectPropDescL_prepare( *iRequest ) ) |
|
742 { |
|
743 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
744 PRINTV1( "Testing with property 0x%x", properties[i] ); |
|
745 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
746 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
747 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
748 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
749 { |
|
750 PRINTE0( "GetObjectPropDesc request failed") |
|
751 PRINTE2( "Property code: 0x%x, response code: 0x%x", properties[i], iTestObserver->iResponseCode ); |
|
752 result = KErrGeneral; |
|
753 } |
|
754 else |
|
755 { |
|
756 result = iPluginTester->GetObjectPropDescL_checkresults( static_cast<const CMTPTypeObjectPropDesc*>( iTestObserver->iMMTPTypeData ), properties[i] ); |
|
757 if ( result != KErrNone ) |
|
758 { |
|
759 PRINTE0( "GetObjectPropDesc result check failed" ); |
|
760 } |
|
761 } |
|
762 } |
|
763 else |
|
764 { |
|
765 PRINTE0( "GetObjectPropValue prepare phase failed" ); |
|
766 } |
|
767 |
|
768 result = CompleteTransactionL( aItem ); |
|
769 // don't allow errors in any request |
|
770 if ( result != KErrNone ) |
|
771 { |
|
772 break; |
|
773 } |
|
774 } |
|
775 } |
|
776 properties.Close(); |
|
777 |
|
778 PRINTN1( "Exiting GetObjectPropValueL with result %d", result ); |
|
779 return result; |
|
780 } |
|
781 |
|
782 TInt CMmMtpDataProviderTestModule::SendObjectInfoL( CStifItemParser& /*aItem*/ ) |
|
783 { |
|
784 PRINTM0( "SendObjectInfo" ); |
|
785 |
|
786 if ( !iTransactionOpen ) |
|
787 { |
|
788 PRINTE0( "Running SendObjectInfo without open transaction" ); |
|
789 return KErrGeneral; |
|
790 } |
|
791 |
|
792 TMTPTransactionPhase phase; |
|
793 TInt result = KErrNone; |
|
794 |
|
795 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
796 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
797 TUint32 objectHandle = 0; // send to storage root |
|
798 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, objectHandle ); |
|
799 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeSendObjectInfo ); |
|
800 |
|
801 if ( iPluginTester->SendObjectInfoL_prepare( *iRequest ) ) |
|
802 { |
|
803 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
804 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
805 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
806 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
807 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
808 { |
|
809 PRINTE0( "SendObjectInfo request failed" ) |
|
810 PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); |
|
811 result = KErrGeneral; |
|
812 } |
|
813 else |
|
814 { |
|
815 result = iPluginTester->SendObjectInfoL_checkresults(); |
|
816 if ( result != KErrNone ) |
|
817 { |
|
818 PRINTE0( "SendObjectInfo result check failed" ); |
|
819 } |
|
820 } |
|
821 } |
|
822 else |
|
823 { |
|
824 PRINTE0( "SendObjectInfo prepare phase failed" ); |
|
825 result = KErrGeneral; |
|
826 } |
|
827 |
|
828 PRINTN1( "Exiting SendObjectInfoL with result %d", result ); |
|
829 return result; |
|
830 } |
|
831 |
|
832 TInt CMmMtpDataProviderTestModule::SendObjectL( CStifItemParser& /*aItem*/ ) |
|
833 { |
|
834 PRINTM0( "SendObject" ); |
|
835 |
|
836 if ( !iTransactionOpen ) |
|
837 { |
|
838 PRINTE0( "Running SendObject without open transaction" ); |
|
839 return KErrGeneral; |
|
840 } |
|
841 |
|
842 TMTPTransactionPhase phase; |
|
843 TInt result = KErrNone; |
|
844 |
|
845 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
846 // the transaction id should be one greater than the id for send object info |
|
847 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
848 // parameter 1 (storage id) is set in prepare function |
|
849 TUint32 objectHandle = 0; // send to storage root |
|
850 iRequest->SetUint32(TMTPTypeRequest::ERequestParameter2, objectHandle ); |
|
851 iRequest->SetUint16(TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeSendObject ); |
|
852 |
|
853 if ( iPluginTester->SendObjectL_prepare( *iRequest ) ) |
|
854 { |
|
855 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
856 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
857 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
858 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
859 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
860 { |
|
861 PRINTE0( "SendObject request failed" ); |
|
862 PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); |
|
863 result = KErrArgument; |
|
864 } |
|
865 else |
|
866 { |
|
867 result = iPluginTester->SendObjectL_checkresults(); |
|
868 if ( result != KErrNone ) |
|
869 { |
|
870 PRINTE0( "SendObject result check failed" ); |
|
871 } |
|
872 } |
|
873 } |
|
874 else |
|
875 { |
|
876 PRINTE0( "SendObject prepare phase failed" ); |
|
877 result = KErrGeneral; |
|
878 } |
|
879 |
|
880 PRINTN1( "Exiting SendObject with result %d", result ); |
|
881 return result; |
|
882 } |
|
883 |
|
884 TInt CMmMtpDataProviderTestModule::SetObjectPropValueL( CStifItemParser& aItem ) |
|
885 { |
|
886 PRINTM0( "SetObjectPropValue" ); |
|
887 |
|
888 TMTPTransactionPhase phase = ERequestPhase; |
|
889 TInt result = KErrNone; |
|
890 |
|
891 // get supported properties and test with them all |
|
892 RArray<TUint> properties; |
|
893 iDataProviderPlugin->Supported( EObjectProperties, properties ); |
|
894 |
|
895 for ( TInt i = 0; i < properties.Count(); i++ ) |
|
896 { |
|
897 switch ( properties[i] ) |
|
898 { |
|
899 //case EMTPObjectPropCodeObjectFileName: // 0xDC07 |
|
900 case EMTPObjectPropCodeName: // 0xDC44 |
|
901 case EMTPObjectPropCodeArtist: // 0xDC46 |
|
902 //case EMTPObjectPropCodeGenre: // 0xDC8C |
|
903 //case EMTPObjectPropCodeParentalRating: // 0xDC94 |
|
904 //case EMTPObjectPropCodeComposer: // 0xDC96 |
|
905 //case EMTPObjectPropCodeOriginalReleaseDate: // 0xDC99 |
|
906 case EMTPObjectPropCodeAlbumName: // 0xDC9A |
|
907 //case EMTPObjectPropCodeEncodingProfile: // 0xDEA1 |
|
908 //case EMTPObjectPropCodeDescription: |
|
909 //case EMTPObjectPropCodeWidth: // 0xDC87 |
|
910 //case EMTPObjectPropCodeHeight: // 0xDC88 |
|
911 //case EMTPObjectPropCodeDuration: // 0xDC89 |
|
912 //case EMTPObjectPropCodeUseCount: // 0xDC91 |
|
913 //case EMTPObjectPropCodeSampleRate: // 0xDE93 |
|
914 //case EMTPObjectPropCodeAudioWAVECodec: // 0xDE99 |
|
915 //case EMTPObjectPropCodeAudioBitRate: // 0xDE9A |
|
916 //case EMTPObjectPropCodeVideoFourCCCodec: // 0xDE9B |
|
917 //case EMTPObjectPropCodeFramesPerThousandSeconds: // 0xDE9D |
|
918 //case EMTPObjectPropCodeKeyFrameDistance: // 0xDE9E |
|
919 //case EMTPObjectPropCodeTrack: // 0xDC8B |
|
920 //case EMTPObjectPropCodeDRMStatus: // 0xDC9D |
|
921 //case EMTPObjectPropCodeNumberOfChannels: // 0xDE94 |
|
922 //case EMTPObjectPropCodeScanType: // 0xDE97 |
|
923 //case EMTPExtObjectPropCodeOmaDrmStatus: |
|
924 result = StartTransactionL( aItem ); |
|
925 if ( result != KErrNone ) |
|
926 { |
|
927 break; // transaction cycle is broken, better to abort |
|
928 } |
|
929 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
930 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
931 TUint32 objectHandle = 2; |
|
932 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); |
|
933 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeSetObjectPropValue ); |
|
934 |
|
935 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, properties[i] ); |
|
936 TInt result = KErrNone; |
|
937 if ( iPluginTester->SetObjectPropValueL_prepare( *iRequest ) ) |
|
938 { |
|
939 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
940 PRINTV1( "Testing with property 0x%x", properties[i] ); |
|
941 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
942 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
943 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
944 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
945 { |
|
946 PRINTE0( "SetObjectPropValue request failed" ); |
|
947 PRINTE2( "Property code: 0x%x, response code: 0x%x", properties[i], iTestObserver->iResponseCode ); |
|
948 result = KErrGeneral; |
|
949 } |
|
950 else |
|
951 { |
|
952 result = iPluginTester->SetObjectPropValueL_checkresults( static_cast<const CMTPTypeObjectInfo*> ( iTestObserver->iMMTPTypeData ) ); |
|
953 if ( result != KErrNone ) |
|
954 { |
|
955 PRINTE0( "SetObjectPropValue result check failed" ); |
|
956 } |
|
957 } |
|
958 } |
|
959 else |
|
960 { |
|
961 PRINTE0( "SetObjectPropValue prepare phase failed" ); |
|
962 } |
|
963 |
|
964 result = CompleteTransactionL( aItem ); |
|
965 break; |
|
966 } |
|
967 // don't allow errors in any request |
|
968 if ( result != KErrNone ) |
|
969 { |
|
970 break; |
|
971 } |
|
972 } |
|
973 properties.Close(); |
|
974 |
|
975 PRINTN1( "Exiting SetObjectPropValueL with result %d", result ); |
|
976 return result; |
|
977 } |
|
978 |
|
979 TInt CMmMtpDataProviderTestModule::SetObjectPropListL( CStifItemParser& aItem ) |
|
980 { |
|
981 PRINTM0( "SetObjectPropList" ); |
|
982 |
|
983 if ( !iTransactionOpen ) |
|
984 { |
|
985 PRINTE0( "Running SetObjectPropList without open transaction" ); |
|
986 return KErrGeneral; |
|
987 } |
|
988 |
|
989 TMTPTransactionPhase phase; |
|
990 TInt result = KErrNotReady; |
|
991 |
|
992 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
993 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
994 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeSetObjectPropList ); |
|
995 |
|
996 if ( iPluginTester->SetObjectPropListL_prepare( *iRequest ) ) |
|
997 { |
|
998 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
999 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
1000 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
1001 iTestObserver->SetPendingOperation( CTestObserver::ESetObjectPropList ); |
|
1002 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
1003 result = iTestObserver->WaitForPendingOperation(); |
|
1004 if ( result != KErrNone ) |
|
1005 { |
|
1006 PRINTE0( "SetObjectPropList asynchronous operation failed" ); |
|
1007 } |
|
1008 else |
|
1009 { |
|
1010 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
1011 { |
|
1012 PRINTE0( "SetObjectPropList request failed" ); |
|
1013 PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); |
|
1014 result = KErrGeneral; |
|
1015 } |
|
1016 else |
|
1017 { |
|
1018 result = iPluginTester->SetObjectPropListL_checkresults( static_cast<const CMTPTypeObjectPropList*>( iTestObserver->iMMTPTypeData ) ); |
|
1019 if ( result != KErrNone ) |
|
1020 { |
|
1021 PRINTE0( "SetObjectPropList result check failed" ); |
|
1022 result = KErrGeneral; |
|
1023 } |
|
1024 } |
|
1025 } |
|
1026 } |
|
1027 else |
|
1028 { |
|
1029 PRINTE0( "SetObjectPropList prepare phase failed" ); |
|
1030 result = KErrGeneral; |
|
1031 } |
|
1032 |
|
1033 PRINTN1( "Exiting SetObjectPropList with result %d", result ); |
|
1034 return result; |
|
1035 } |
|
1036 |
|
1037 TInt CMmMtpDataProviderTestModule::DeleteObjectL( CStifItemParser& aItem ) |
|
1038 { |
|
1039 PRINTM0( "DeleteObject" ); |
|
1040 |
|
1041 if ( !iTransactionOpen ) |
|
1042 { |
|
1043 PRINTE0( "Running DeleteObject without open transaction" ); |
|
1044 return KErrGeneral; |
|
1045 } |
|
1046 |
|
1047 TMTPTransactionPhase phase; |
|
1048 TInt result = KErrNotReady; |
|
1049 |
|
1050 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
1051 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
1052 TUint32 objectHandle = KMTPHandleAll; |
|
1053 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); |
|
1054 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeDeleteObject ); |
|
1055 |
|
1056 if ( iPluginTester->DeleteObjectL_prepare( *iRequest ) ) |
|
1057 { |
|
1058 iTestObserver->SetPendingOperation( CTestObserver::EDeleteObject ); |
|
1059 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
1060 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
1061 result = iTestObserver->WaitForPendingOperation(); |
|
1062 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
1063 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
1064 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
1065 { |
|
1066 PRINTE0( "DeleteObject request failed" ); |
|
1067 PRINTE1( "Response code 0x%x", iTestObserver->iResponseCode ); |
|
1068 result = KErrGeneral; |
|
1069 } |
|
1070 else |
|
1071 { |
|
1072 result = iPluginTester->DeleteObjectL_checkresults( iTestObserver->ObjectMgr() ); |
|
1073 if ( result != KErrNone ) |
|
1074 { |
|
1075 PRINTE0( "DeleteObject result check failed" ); |
|
1076 } |
|
1077 } |
|
1078 } |
|
1079 else |
|
1080 { |
|
1081 PRINTE0( "DeleteObject prepare phase failed" ); |
|
1082 result = KErrGeneral; |
|
1083 } |
|
1084 |
|
1085 PRINTN1( "Exiting TestDeleteObjectL with result %d", result ); |
|
1086 return result; |
|
1087 } |
|
1088 |
|
1089 TInt CMmMtpDataProviderTestModule::CopyObjectL( CStifItemParser& aItem ) |
|
1090 { |
|
1091 PRINTM0( "CopyObject" ); |
|
1092 |
|
1093 if ( !iTransactionOpen ) |
|
1094 { |
|
1095 PRINTE0( "Running CopyObject without open transaction" ); |
|
1096 return KErrGeneral; |
|
1097 } |
|
1098 |
|
1099 TMTPTransactionPhase phase; |
|
1100 TInt result = KErrNone; |
|
1101 |
|
1102 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
1103 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
1104 TUint32 objectHandle = 3; |
|
1105 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); |
|
1106 // parameter 2 (storage id) set in prepare function |
|
1107 TUint32 parentObjectHandle = 0; // copy to root directory |
|
1108 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter3, parentObjectHandle ); |
|
1109 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeCopyObject ); |
|
1110 |
|
1111 if ( iPluginTester->CopyObjectL_prepare( *iRequest ) ) |
|
1112 { |
|
1113 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
1114 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
1115 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
1116 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
1117 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
1118 { |
|
1119 __TRACE( KError, ( _L( "CopyObject request phase failed, response code: 0x%x" ), iTestObserver->iResponseCode ) ); |
|
1120 result = KErrGeneral; |
|
1121 } |
|
1122 else |
|
1123 { |
|
1124 TUint32 handle = iTestObserver->iResponse.Uint32( TMTPTypeResponse::EResponseParameter1 ); |
|
1125 PRINTV1( "Copied object handle: %d", handle ); |
|
1126 CMTPObjectMetaData* metaData = CMTPObjectMetaData::NewLC(); |
|
1127 iTestObserver->ObjectMgr().ObjectL( handle, *metaData ); |
|
1128 result = iPluginTester->CopyObjectL_checkresults( metaData ); |
|
1129 if ( result != KErrNone ) |
|
1130 { |
|
1131 PRINTE0( "CopyObject result check failed" ); |
|
1132 } |
|
1133 CleanupStack::PopAndDestroy( metaData ); |
|
1134 } |
|
1135 } |
|
1136 else |
|
1137 { |
|
1138 PRINTE0( "CopyObject prepare phase failed" ); |
|
1139 result = KErrGeneral; |
|
1140 } |
|
1141 |
|
1142 PRINTN1( "Exiting CopyObject with result %d", result ); |
|
1143 return result; |
|
1144 } |
|
1145 |
|
1146 TInt CMmMtpDataProviderTestModule::MoveObjectL( CStifItemParser& aItem ) |
|
1147 { |
|
1148 PRINTM0( "MoveObject" ); |
|
1149 |
|
1150 if ( !iTransactionOpen ) |
|
1151 { |
|
1152 PRINTE0( "Running MoveObject without open transaction" ); |
|
1153 return KErrGeneral; |
|
1154 } |
|
1155 |
|
1156 TInt result = KErrNotReady; |
|
1157 TMTPTransactionPhase phase; |
|
1158 |
|
1159 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
1160 // the transaction id should be one greater than the id for send object info |
|
1161 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
1162 TUint32 objectHandle = 3; |
|
1163 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); |
|
1164 // parameter 2 (storage id) is set in prepare function |
|
1165 TUint32 parentHandle = 0; // move to root directory |
|
1166 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter3, parentHandle ); |
|
1167 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeMoveObject ); |
|
1168 |
|
1169 if ( iPluginTester->MoveObjectL_prepare( *iRequest ) ) |
|
1170 { |
|
1171 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
1172 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
1173 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
1174 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
1175 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
1176 { |
|
1177 PRINTE0( "MoveObject request failed" ); |
|
1178 PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); |
|
1179 result = KErrGeneral; |
|
1180 } |
|
1181 else |
|
1182 { |
|
1183 CMTPObjectMetaData* metaData = CMTPObjectMetaData::NewLC(); |
|
1184 iTestObserver->ObjectMgr().ObjectL( objectHandle, *metaData ); |
|
1185 result = iPluginTester->MoveObjectL_checkresults( metaData ); |
|
1186 if ( result != KErrNone ) |
|
1187 { |
|
1188 PRINTE0( "MoveObject result check failed" ); |
|
1189 } |
|
1190 CleanupStack::PopAndDestroy( metaData ); |
|
1191 } |
|
1192 } |
|
1193 else |
|
1194 { |
|
1195 PRINTE0( "MoveObject prepare failed" ); |
|
1196 result = KErrGeneral; |
|
1197 } |
|
1198 |
|
1199 PRINTN1( "Exiting MoveObject with result %d", result ); |
|
1200 return result; |
|
1201 } |
|
1202 |
|
1203 TInt CMmMtpDataProviderTestModule::RenameObjectL( CStifItemParser& aItem ) |
|
1204 { |
|
1205 PRINTM0( "RenameObject" ); |
|
1206 |
|
1207 TInt result = KErrNotReady; |
|
1208 TMTPNotificationParamsHandle param; |
|
1209 |
|
1210 if ( iPluginTester->RenameObjectL_prepare( param ) ) |
|
1211 { |
|
1212 TUint32 handle = param.iHandleId; |
|
1213 iDataProviderPlugin->ProcessNotificationL( EMTPRenameObject, ¶m ); |
|
1214 User::After( 10000 ); |
|
1215 CMTPObjectMetaData* metaData = CMTPObjectMetaData::NewLC(); |
|
1216 iTestObserver->ObjectMgr().ObjectL( handle, *metaData ); |
|
1217 result = iPluginTester->RenameObjectL_checkresults( metaData ); |
|
1218 if ( result != KErrNone ) |
|
1219 { |
|
1220 __TRACE( KError, ( _L( "Result check failed with error %d" ), result ) ); |
|
1221 } |
|
1222 CleanupStack::PopAndDestroy( metaData ); |
|
1223 } |
|
1224 else |
|
1225 { |
|
1226 PRINTE0( "RenameObject prepare phase failed" ); |
|
1227 result = KErrGeneral; |
|
1228 } |
|
1229 |
|
1230 return result; |
|
1231 } |
|
1232 |
|
1233 TInt CMmMtpDataProviderTestModule::GetPartialObjectL( CStifItemParser& aItem ) |
|
1234 { |
|
1235 PRINTM0( "GetPartialObject" ); |
|
1236 |
|
1237 if ( !iTransactionOpen ) |
|
1238 { |
|
1239 PRINTE0( "Running GetPartialObject without open transaction" ); |
|
1240 return KErrGeneral; |
|
1241 } |
|
1242 |
|
1243 TMTPTransactionPhase phase; |
|
1244 TInt result = KErrNone; |
|
1245 |
|
1246 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
1247 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
1248 TUint32 objectHandle = 2; // first enumerated object |
|
1249 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); |
|
1250 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, 0 ); |
|
1251 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter3, KMTPHandleAll ); |
|
1252 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetPartialObject ); |
|
1253 |
|
1254 if ( iPluginTester->GetPartialObjectL_prepare( *iRequest ) ) |
|
1255 { |
|
1256 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
1257 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
1258 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
1259 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
1260 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
1261 { |
|
1262 PRINTE0( "GetPartialObject request failed" ); |
|
1263 PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); |
|
1264 result = KErrGeneral; |
|
1265 } |
|
1266 else |
|
1267 { |
|
1268 result = iPluginTester->GetPartialObjectL_checkresults(); |
|
1269 if ( result != KErrNone ) |
|
1270 { |
|
1271 PRINTE0( "GetPartialObject result check failed" ); |
|
1272 } |
|
1273 } |
|
1274 } |
|
1275 else |
|
1276 { |
|
1277 PRINTE0( "GetPartialObject prepare phase failed" ); |
|
1278 result = KErrGeneral; |
|
1279 } |
|
1280 |
|
1281 PRINTN1( "Exiting GetPartialObjectL with result %d", result ); |
|
1282 return result; |
|
1283 } |
|
1284 |
|
1285 TInt CMmMtpDataProviderTestModule::SetObjectReferencesL( CStifItemParser& /*aItem*/ ) |
|
1286 { |
|
1287 PRINTM0( "SetObjectReferences" ); |
|
1288 TInt result = KErrNone; |
|
1289 PRINTN1( "Exiting SetObjectReferences with result %d", result ); |
|
1290 return result; |
|
1291 } |
|
1292 |
|
1293 TInt CMmMtpDataProviderTestModule::GetObjectReferencesL( CStifItemParser& /*aItem*/ ) |
|
1294 { |
|
1295 PRINTM0( "GetObjectReferences" ); |
|
1296 TInt result = KErrNone; |
|
1297 PRINTN1( "Exiting GetObjectReferences with result %d", result ); |
|
1298 return result; |
|
1299 } |
|
1300 |
|
1301 TInt CMmMtpDataProviderTestModule::GetObjectPropsSupportedL( CStifItemParser& /*aItem*/ ) |
|
1302 { |
|
1303 PRINTM0( "GetObjectPropsSupported" ); |
|
1304 |
|
1305 if ( !iTransactionOpen ) |
|
1306 { |
|
1307 PRINTE0( "Running GetObjectPropsSupported without open transaction" ); |
|
1308 return KErrGeneral; |
|
1309 } |
|
1310 |
|
1311 TMTPTransactionPhase phase; |
|
1312 TInt result = KErrNone; |
|
1313 |
|
1314 iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); |
|
1315 iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); |
|
1316 iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, EMTPFormatCodeMP3 ); |
|
1317 iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetObjectPropsSupported ); |
|
1318 |
|
1319 if ( iPluginTester->GetObjectPropsSupportedL_prepare( *iRequest ) ) |
|
1320 { |
|
1321 phase = iTestObserver->SetPhaseL( ERequestPhase ); |
|
1322 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
1323 phase = iTestObserver->SetPhaseL( EResponsePhase ); |
|
1324 iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); |
|
1325 if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) |
|
1326 { |
|
1327 PRINTE0( "GetObjectPropsSupported request failed" ); |
|
1328 PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); |
|
1329 result = KErrGeneral; |
|
1330 } |
|
1331 else |
|
1332 { |
|
1333 result = iPluginTester->GetObjectPropsSupportedL_checkresults( static_cast<const CMTPTypeArray*>( iTestObserver->iMMTPTypeData ) ); |
|
1334 if ( result != KErrNone ) |
|
1335 { |
|
1336 PRINTE0( "GetObjectPropsSupported result check failed" ); |
|
1337 } |
|
1338 } |
|
1339 } |
|
1340 else |
|
1341 { |
|
1342 PRINTE0( "GetObjectPropsSupported prepare phase failed" ); |
|
1343 result = KErrGeneral; |
|
1344 } |
|
1345 |
|
1346 PRINTN1( "Exiting GetObjectPropsSupportedL with result %d", result ); |
|
1347 return result; |
|
1348 } |