|
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: Tester class for mediamtpdp plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32def.h> |
|
20 #include <stiftestinterface.h> |
|
21 #include <settingserverclient.h> |
|
22 #include <mtp/mtpprotocolconstants.h> |
|
23 #include <mtp/cmtptypeobjectinfo.h> |
|
24 #include <mtp/cmtptypefile.h> |
|
25 #include <mtp/cmtptypestring.h> |
|
26 #include <mtp/cmtptypearray.h> |
|
27 #include <mtp/cmtptypeobjectproplist.h> |
|
28 #include <mtp/cmtptypeobjectpropdesc.h> |
|
29 #include <bautils.h> |
|
30 #include <f32file.h> |
|
31 #include <mpxharvesterutility.h> |
|
32 #include "cmediamtpdataprovidertester.h" |
|
33 #include "logging.h" |
|
34 |
|
35 #ifdef LOGGER |
|
36 #undef LOGGER |
|
37 #endif |
|
38 #define LOGGER iLog |
|
39 |
|
40 // definitions and constants for the test data |
|
41 |
|
42 const TUint32 KTestStorageId = 0x10000; |
|
43 const TInt KTestObjectsCount = 4; |
|
44 const TUint KTestDirHandle = 1; |
|
45 const TInt KTestDirDataproviderId = 0; |
|
46 _LIT( KTempDirPath, "C:\\mtp_testdata\\temp\\" ); |
|
47 _LIT( KTestDirPath, "C:\\mtp_testdata\\temp\\TESTDIR\\" ); |
|
48 _LIT( KTestFileOrigPath, "C:\\mtp_testdata\\TEST.MP3" ); |
|
49 _LIT( KTestFileTempPath, "C:\\mtp_testdata\\temp\\TEST.MP3" ); |
|
50 _LIT( KTestDirOrigPath, "C:\\mtp_testdata\\TESTDIR\\*" ); |
|
51 _LIT( KTestDirTempPath, "C:\\mtp_testdata\\temp\\TESTDIR\\" ); |
|
52 _LIT( KTestDirPhysicalStorage, "C:\\mtp_testdata\\temp\\" ); |
|
53 _LIT( KTestDirLogicalStorage, "C:\\mtp_testdata\\temp\\" ); |
|
54 _LIT( KTestObjectPath1, "C:\\mtp_testdata\\temp\\TEST.MP3" ); |
|
55 _LIT( KTestObjectPath2, "C:\\mtp_testdata\\temp\\TESTDIR\\TEST1.MP3" ); |
|
56 _LIT( KTestObjectPath3, "C:\\mtp_testdata\\temp\\TESTDIR\\TEST2.MP3" ); |
|
57 |
|
58 _LIT( KSendTestObjectFile, "SENDTEST.MP3" ); |
|
59 _LIT( KSendTestObjectFileFullPath, "C:\\mtp_testdata\\SENDTEST.MP3" ); |
|
60 _LIT( KSendTestObjectPath, "C:\\mtp_testdata\\temp\\SENDTEST.MP3" ); |
|
61 _LIT( KSendTestObjectDateString, "20090511T091022+0800" ); |
|
62 _LIT( KCopyTestObjectPath, "C:\\mtp_testdata\\temp\\TEST1.MP3" ); |
|
63 _LIT( KCopyTestFileName, "TEST1.MP3" ); |
|
64 _LIT( KMoveTestObjectOldPath, "C:\\mtp_testdata\\temp\\TESTDIR\\TEST1.MP3" ); |
|
65 _LIT( KMoveTestObjectNewPath, "C:\\mtp_testdata\\temp\\TEST1.MP3" ); |
|
66 _LIT( KMoveTestFileName, "TEST1.MP3" ); |
|
67 _LIT( KRenameObjectName, "TESTDIR" ); |
|
68 _LIT( KRenameObjectPath, "C:\\mtp_testdata\\temp\\RENAMEDIR\\" ); |
|
69 |
|
70 //_LIT( KSendObjectNameString, "Test Object" ); |
|
71 |
|
72 _LIT( KPropObjectDate, "20090610T090000+0800" ); |
|
73 _LIT( KPropObjectName, "Test Object" ); |
|
74 _LIT( KPropObjectArtist, "Test Artist" ); |
|
75 _LIT( KPropObjectAlbumName, "Test Album" ); |
|
76 |
|
77 const TInt KTestFileSize = 271890; |
|
78 const TInt KSendTestFileSize = 271890; |
|
79 const TInt KCopyTestFileSize = 271890; |
|
80 const TInt KMoveTestFileSize = 271890; |
|
81 |
|
82 // ---------------------------------------------------------------------------- |
|
83 // Two-phased constructor. |
|
84 // ---------------------------------------------------------------------------- |
|
85 // |
|
86 CMediaMtpDataProviderTester* CMediaMtpDataProviderTester::NewL() |
|
87 { |
|
88 CMediaMtpDataProviderTester* self = |
|
89 new ( ELeave ) CMediaMtpDataProviderTester(); |
|
90 CleanupStack::PushL( self ); |
|
91 self->ConstructL(); |
|
92 CleanupStack::Pop( self ); |
|
93 return self; |
|
94 } |
|
95 |
|
96 // ---------------------------------------------------------------------------- |
|
97 // C++ default constructor can NOT contain any code, that might leave. |
|
98 // ---------------------------------------------------------------------------- |
|
99 // |
|
100 CMediaMtpDataProviderTester::CMediaMtpDataProviderTester() |
|
101 : CMmMtpDataProviderTester() |
|
102 { |
|
103 // no implementation required |
|
104 } |
|
105 |
|
106 // ---------------------------------------------------------------------------- |
|
107 // Symbian 2nd phase constructor can leave. |
|
108 // ---------------------------------------------------------------------------- |
|
109 // |
|
110 void CMediaMtpDataProviderTester::ConstructL() |
|
111 { |
|
112 TFileName logFileName; |
|
113 logFileName.Copy( KMtpDataProviderTestModuleLogFile ); |
|
114 |
|
115 iLog = CStifLogger::NewL( KMtpDataProviderTestModuleLogPath, |
|
116 logFileName, |
|
117 CStifLogger::ETxt, |
|
118 TRACE_TARGET, |
|
119 ETrue, ETrue, ETrue, EFalse, ETrue ); |
|
120 PRINTF0( ">CMediaMtpDataProviderTester::ConstructL" ); |
|
121 iActiveSchedulerWait = new ( ELeave ) CActiveSchedulerWait(); |
|
122 iFsSession.Connect(); |
|
123 iFileMan = CFileMan::NewL( iFsSession ); |
|
124 PRINTF0( "<CMediaMtpDataProviderTester::ConstructL" ); |
|
125 } |
|
126 |
|
127 // ---------------------------------------------------------------------------- |
|
128 // Destructor. |
|
129 // ---------------------------------------------------------------------------- |
|
130 // |
|
131 CMediaMtpDataProviderTester::~CMediaMtpDataProviderTester() |
|
132 { |
|
133 PRINTF0( ">CMediaMtpDataProviderTester::~CMediaMtpDataProviderTester" ); |
|
134 delete iActiveSchedulerWait; |
|
135 delete iFileMan; |
|
136 iFsSession.Close(); |
|
137 PRINTF0( "<CMediaMtpDataProviderTester::~CMediaMtpDataProviderTester" ); |
|
138 delete iLog; |
|
139 } |
|
140 |
|
141 TInt CMediaMtpDataProviderTester::PrepareEnvironmentL() |
|
142 { |
|
143 PRINTF0( ">CMediaMtpDataProviderTester::PrepareEnvironmentL" ); |
|
144 TInt result = KErrNone; |
|
145 |
|
146 result = iFileMan->RmDir( KTempDirPath ); |
|
147 if ( result == KErrNone ) |
|
148 { |
|
149 PRINTN0( "Warning: old temp directory found, deleted" ); |
|
150 } |
|
151 result = KErrNone; |
|
152 |
|
153 // create the temp dir if it doesn't exist |
|
154 BaflUtils::EnsurePathExistsL( iFsSession, KTempDirPath ); |
|
155 |
|
156 // copy the test data to temp dir |
|
157 result = iFileMan->Copy( KTestFileOrigPath, KTestFileTempPath ); |
|
158 if ( result != KErrNone ) |
|
159 { |
|
160 PRINTE1( "Failed to copy test file, error %d", result ); |
|
161 } |
|
162 else |
|
163 { |
|
164 result = iFileMan->Copy( KTestDirOrigPath, KTestDirTempPath, |
|
165 CFileMan::EOverWrite | CFileMan::ERecurse ); |
|
166 if ( result != KErrNone ) |
|
167 { |
|
168 PRINTE1( "Failed to copy test dir, error %d", result ); |
|
169 } |
|
170 } |
|
171 |
|
172 PRINTF1( "<CMediaMtpDataProviderTester::PrepareEnvironmentL result = %d", result ); |
|
173 return result; |
|
174 } |
|
175 |
|
176 TInt CMediaMtpDataProviderTester::CleanEnvironmentL() |
|
177 { |
|
178 PRINTF0( ">CMediaMtpDataProviderTester::CleanEnvironmentL" ); |
|
179 TInt result = KErrNone; |
|
180 TMTPObjectMgrQueryParams queryParams ( KMTPStorageAll, KMTPFormatsAll, |
|
181 KMTPHandleNone ); |
|
182 RMTPObjectMgrQueryContext context; |
|
183 RArray<TUint> handles; |
|
184 CleanupClosePushL( handles ); |
|
185 |
|
186 PRINTN0( "Starting to delete entries from mpx" ); |
|
187 MMPXHarvesterUtility* harvester = CMPXHarvesterFactory::NewL(); |
|
188 CleanupClosePushL( *harvester ); |
|
189 |
|
190 iTestObserver->ObjectMgr().GetObjectHandlesL( queryParams, context, |
|
191 handles ); |
|
192 PRINTV1( "Handle count: %d", handles.Count() ); |
|
193 context.Close(); |
|
194 |
|
195 CMTPObjectMetaData* metadata = CMTPObjectMetaData::NewLC(); |
|
196 for ( TInt i = 0; i < handles.Count(); i++ ) |
|
197 { |
|
198 PRINTN0( "enter for loop" ); |
|
199 TUint handle = handles[i]; |
|
200 if ( handle != KTestDirHandle ) |
|
201 { |
|
202 iTestObserver->ObjectMgr().ObjectL( handles[i], *metadata ); |
|
203 TPtrC fileName = metadata->DesC( CMTPObjectMetaData::ESuid ); |
|
204 PRINTV1( "Handle: %d", handles[i] ); |
|
205 PRINTV1( "File name: %S", &fileName ); |
|
206 |
|
207 PRINTN0( "Starting to delete the file from mpx" ); |
|
208 iTestObserver->SetPendingOperation( CTestObserver::EHarvesterDeleteObject ); |
|
209 PRINTN0( "before deletefilel" ); |
|
210 harvester->DeleteFileL( fileName, iTestObserver ); |
|
211 PRINTN0( "after deletefilel" ); |
|
212 User::After( 1000000 ); |
|
213 PRINTN0( "before waitforpendingoperation" ); |
|
214 // waiting for asynchronous operation to complete |
|
215 result = iTestObserver->WaitForPendingOperation(); |
|
216 PRINTN0( "after waitforpendingoperation" ); |
|
217 |
|
218 if ( result != KErrNone ) |
|
219 { |
|
220 PRINTE1( "Warning: failed to delete from mpx, error %d", result ); |
|
221 result = KErrNone; // ignore for now, there are problems after DeleteObject |
|
222 } |
|
223 } |
|
224 } |
|
225 CleanupStack::PopAndDestroy( 3 ); // metadata, harvester, handles |
|
226 PRINTN0( "Finished deleting entries from mpx" ); |
|
227 |
|
228 if ( result == KErrNone ) |
|
229 { |
|
230 PRINTN0( "Deleting temp directory" ); |
|
231 result = iFileMan->RmDir( KTempDirPath ); |
|
232 if ( result != KErrNone ) |
|
233 { |
|
234 PRINTE1( "Warning: failed to delete temp directory, error %d", result ); |
|
235 result = KErrNone; |
|
236 } |
|
237 } |
|
238 |
|
239 PRINTF1( "<CMediaMtpDataProviderTester::CleanEnvironmentL result = %d", result ); |
|
240 return result; |
|
241 } |
|
242 |
|
243 TBool CMediaMtpDataProviderTester::ObjectEnumerationL_prepare( |
|
244 CMTPStorageMetaData* aPhysicalStorage, |
|
245 CMTPStorageMetaData* aLogicalStorage ) |
|
246 { |
|
247 PRINTF0( ">CMediaMtpDataProviderTester::ObjectEnumerationL_prepare" ); |
|
248 |
|
249 TBool result = ETrue; |
|
250 aPhysicalStorage->SetDesCL( CMTPStorageMetaData::EStorageSuid, |
|
251 KTestDirPhysicalStorage() ); |
|
252 aPhysicalStorage->SetUint( CMTPStorageMetaData::EStorageSystemType, |
|
253 CMTPStorageMetaData::ESystemTypeDefaultFileSystem ); |
|
254 |
|
255 aLogicalStorage->SetDesCL( CMTPStorageMetaData::EStorageSuid, |
|
256 KTestDirLogicalStorage() ); |
|
257 aLogicalStorage->SetUint( CMTPStorageMetaData::EStorageSystemType, |
|
258 CMTPStorageMetaData::ESystemTypeDefaultFileSystem ); |
|
259 |
|
260 // insert TESTDIR object manually |
|
261 CMTPObjectMetaData* object( CMTPObjectMetaData::NewLC( 0, |
|
262 EMTPFormatCodeAssociation, // a folder object |
|
263 KTestStorageId, KTestDirPath ) ); |
|
264 // object is in storage root |
|
265 object->SetInt( CMTPObjectMetaData::EParentId, KErrNotFound ); |
|
266 |
|
267 iTestObserver->ObjectMgr().InsertObjectL( *object ); |
|
268 CleanupStack::PopAndDestroy( object ); |
|
269 |
|
270 PRINTF1( "<CMediaMtpDataProviderTester::ObjectEnumerationL_prepare result = %d", result ); |
|
271 return result; |
|
272 } |
|
273 |
|
274 TInt CMediaMtpDataProviderTester::ObjectEnumerationL_checkresults( |
|
275 MMTPObjectMgr& aObjectManager ) |
|
276 { |
|
277 PRINTF0( ">CMediaMtpDataProviderTester::ObjectEnumerationL_checkresults" ); |
|
278 |
|
279 TInt result = KErrNone; |
|
280 |
|
281 TMTPObjectMgrQueryParams queryParams ( KMTPStorageAll, KMTPFormatsAll, |
|
282 KMTPHandleNone ); |
|
283 RMTPObjectMgrQueryContext context; |
|
284 RArray<TUint> handles; |
|
285 CleanupClosePushL( handles ); |
|
286 MMPXHarvesterUtility* harvester = CMPXHarvesterFactory::NewL(); |
|
287 CleanupClosePushL( *harvester ); |
|
288 |
|
289 aObjectManager.GetObjectHandlesL( queryParams, context, handles ); |
|
290 context.Close(); |
|
291 TInt count = handles.Count(); |
|
292 PRINTV1( "Handle count: %d", count ); |
|
293 if ( count != KTestObjectsCount ) |
|
294 { |
|
295 PRINTE2( "Wrong number of handles: %d != %d", count, KTestObjectsCount ); |
|
296 result = KErrGeneral; |
|
297 } |
|
298 |
|
299 CMTPObjectMetaData* metadata = CMTPObjectMetaData::NewLC(); |
|
300 for ( TInt i = 0; i < count; i++ ) |
|
301 { |
|
302 TUint handle = handles[i]; |
|
303 aObjectManager.ObjectL( handle, *metadata ); |
|
304 TPtrC suid = metadata->DesC( CMTPObjectMetaData::ESuid ); |
|
305 TUint formatCode = metadata->Uint( CMTPObjectMetaData::EFormatCode ); |
|
306 TUint dataproviderId = metadata->Uint( CMTPObjectMetaData::EDataProviderId ); |
|
307 TUint storageId = metadata->Uint( CMTPObjectMetaData::EStorageId ); |
|
308 TInt parentId = metadata->Int( CMTPObjectMetaData::EParentId ); |
|
309 |
|
310 PRINTN1( "Handle: %d", handle ); |
|
311 PRINTN1( "Suid: %S", &suid ); |
|
312 |
|
313 if ( dataproviderId != iTestObserver->DataProviderId() ) |
|
314 { |
|
315 if ( !( ( handle == KTestDirHandle ) && |
|
316 ( dataproviderId == KTestDirDataproviderId ) ) ) |
|
317 { |
|
318 PRINTE2( "Wrong dataprovider id: %d != %d", dataproviderId, iTestObserver->DataProviderId() ); |
|
319 result = KErrGeneral; |
|
320 } |
|
321 } |
|
322 if ( storageId != KTestStorageId ) |
|
323 { |
|
324 PRINTE2( "Wrong storage id: %d != %d", storageId, KTestStorageId ); |
|
325 result = KErrGeneral; |
|
326 } |
|
327 switch ( handle ) |
|
328 { |
|
329 case 1: |
|
330 { |
|
331 if ( suid.Match( KTestDirPath ) != 0 ) |
|
332 { |
|
333 PRINTE2( "Wrong test dir path: %S != %S", &suid, &KTestDirPath ); |
|
334 result = KErrGeneral; |
|
335 } |
|
336 if ( formatCode != EMTPFormatCodeAssociation ) |
|
337 { |
|
338 PRINTE2( "Wrong format code: 0x%x != 0x%x", formatCode, EMTPFormatCodeAssociation ); |
|
339 result = KErrGeneral; |
|
340 } |
|
341 if ( parentId != KErrNotFound ) |
|
342 { |
|
343 PRINTE2( "Wrong parent id: %d != %d", parentId, KErrNotFound ); |
|
344 result = KErrGeneral; |
|
345 } |
|
346 break; |
|
347 } |
|
348 case 2: |
|
349 { |
|
350 if ( suid.Match( KTestObjectPath1 ) != 0 ) |
|
351 { |
|
352 PRINTE2( "Wrong test object 1 path: %S != %S", &suid, &KTestObjectPath1 ); |
|
353 result = KErrGeneral; |
|
354 } |
|
355 if ( formatCode != EMTPFormatCodeMP3 ) |
|
356 { |
|
357 PRINTE2( "Wrong format code: 0x%x != 0x%x", formatCode, EMTPFormatCodeMP3 ); |
|
358 result = KErrGeneral; |
|
359 } |
|
360 if ( parentId != KErrNotFound ) |
|
361 { |
|
362 PRINTE2( "Wrong parent id: %d != %d", parentId, KErrNotFound ); |
|
363 result = KErrGeneral; |
|
364 } |
|
365 break; |
|
366 } |
|
367 case 3: |
|
368 { |
|
369 if ( suid.Match( KTestObjectPath2 ) != 0 ) |
|
370 { |
|
371 PRINTE2( "Wrong test object 2 path: %S != %S", &suid, KTestObjectPath2 ); |
|
372 result = KErrGeneral; |
|
373 } |
|
374 if ( formatCode != EMTPFormatCodeMP3 ) |
|
375 { |
|
376 PRINTE2( "Wrong format code: 0x%x != 0x%x", formatCode, EMTPFormatCodeMP3 ); |
|
377 result = KErrGeneral; |
|
378 } |
|
379 if ( parentId != 1 ) |
|
380 { |
|
381 PRINTE2( "Wrong parent id: %d != %d", parentId, 1 ); |
|
382 result = KErrGeneral; |
|
383 } |
|
384 break; |
|
385 } |
|
386 case 4: |
|
387 { |
|
388 if ( suid.Match( KTestObjectPath3 ) != 0 ) |
|
389 { |
|
390 PRINTE2( "Wrong test object 3 path: %S != %S", &suid, &KTestObjectPath3 ); |
|
391 result = KErrGeneral; |
|
392 } |
|
393 if ( formatCode != EMTPFormatCodeMP3 ) |
|
394 { |
|
395 PRINTE2( "Wrong format code: 0x%x != 0x%x", formatCode, EMTPFormatCodeMP3 ); |
|
396 result = KErrGeneral; |
|
397 } |
|
398 if ( parentId != 1 ) |
|
399 { |
|
400 PRINTE2( "Wrong parent id: %d != %d", parentId, 1 ); |
|
401 result = KErrGeneral; |
|
402 } |
|
403 break; |
|
404 } |
|
405 default: |
|
406 { |
|
407 PRINTE1( "Unexpected handle: %d", handle ); |
|
408 result = KErrGeneral; |
|
409 } |
|
410 } |
|
411 |
|
412 if ( ( result == KErrNone ) && ( handle != KTestDirHandle ) ) |
|
413 { |
|
414 PRINTN0( "Starting to harvest the file" ); |
|
415 iTestObserver->SetPendingOperation( CTestObserver::EHarvesterAddObject ); |
|
416 harvester->AddFileL( metadata->DesC( CMTPObjectMetaData::ESuid ), iTestObserver ); |
|
417 PRINTN0( "Waiting for harvesting to complete" ); |
|
418 result = iTestObserver->WaitForPendingOperation(); |
|
419 if ( result != KErrNone ) |
|
420 { |
|
421 PRINTE1( "Harvesting error: %d", result ); |
|
422 } |
|
423 } |
|
424 } |
|
425 CleanupStack::PopAndDestroy( 3 ); // handles, harvester, metadata |
|
426 PRINTF1( "<CMediaMtpDataProviderTester::ObjectEnumerationL_checkresults result = %d", result ); |
|
427 return result; |
|
428 } |
|
429 |
|
430 TInt CMediaMtpDataProviderTester::GetObjectInfoL_checkresults( |
|
431 const CMTPTypeObjectInfo* aObjectInfo ) |
|
432 { |
|
433 PRINTF0( ">CMediaMtpDataProviderTester::GetObjectInfoL_checkresults" ); |
|
434 _LIT( KTestFileName, "TEST.MP3" ); |
|
435 TInt result = KErrNone; |
|
436 if ( aObjectInfo ) |
|
437 { |
|
438 PRINTV1( "Object filename: %S", &aObjectInfo->StringCharsL( CMTPTypeObjectInfo::EFilename ) ); |
|
439 if ( aObjectInfo->StringCharsL( CMTPTypeObjectInfo::EFilename ). |
|
440 CompareF( KTestFileName ) != 0 ) |
|
441 { |
|
442 PRINTE0( "ObjectInfo filename not correct" ); |
|
443 result = KErrGeneral; |
|
444 } |
|
445 PRINTV1( "Object modified date: %S", &aObjectInfo->StringCharsL( CMTPTypeObjectInfo::EDateModified ) ); |
|
446 if ( aObjectInfo->StringCharsL( CMTPTypeObjectInfo::EDateModified ). |
|
447 Length() == 0 ) |
|
448 { |
|
449 PRINTE0( "ObjectInfo modified date not set" ); |
|
450 } |
|
451 PRINTV1( "Object formatcode: 0x%x", aObjectInfo->Uint16L( CMTPTypeObjectInfo::EObjectFormat ) ); |
|
452 if ( aObjectInfo->Uint16L( CMTPTypeObjectInfo::EObjectFormat ) != |
|
453 EMTPFormatCodeMP3 ) |
|
454 { |
|
455 PRINTE0( "ObjectInfo format code not correct" ); |
|
456 result=KErrGeneral; |
|
457 } |
|
458 } |
|
459 else |
|
460 { |
|
461 PRINTE0( "ObjectInfo not received correctly" ); |
|
462 result = KErrArgument; |
|
463 } |
|
464 PRINTF1( "<CMediaMtpDataProviderTester::GetObjectInfoL_checkresults result = %d", result ); |
|
465 return result; |
|
466 } |
|
467 |
|
468 TInt CMediaMtpDataProviderTester::GetObjectL_checkresults( |
|
469 CMTPTypeFile* aObjectInfo ) |
|
470 { |
|
471 PRINTF0( ">CMediaMtpDataProviderTester::GetObjectL_checkresults" ); |
|
472 // just check the handle is correct, based on the size |
|
473 TInt result = KErrNone; |
|
474 if ( aObjectInfo ) |
|
475 { |
|
476 TInt size = aObjectInfo->Size(); |
|
477 PRINTV1( "Received object size: %d", size ); |
|
478 if ( size != KTestFileSize ) |
|
479 { |
|
480 PRINTE2( "Wrong received object size: %d != %d", KTestFileSize, size ); |
|
481 result = KErrGeneral; |
|
482 } |
|
483 aObjectInfo->File().Close(); |
|
484 } |
|
485 else |
|
486 { |
|
487 PRINTE0( "Object info not received" ); |
|
488 result = KErrArgument; |
|
489 } |
|
490 PRINTF1( "<CMediaMtpDataProviderTester::GetObjectL_checkresults result = %d", result ); |
|
491 return result; |
|
492 } |
|
493 |
|
494 TInt CMediaMtpDataProviderTester::GetObjectPropValueL_checkresults( |
|
495 const MMTPType* aObjectPropValue, const TUint aPropCode ) |
|
496 { |
|
497 PRINTF0( ">CMediaMtpDataProviderTester::GetObjectPropValueL_checkresults" ); |
|
498 TInt type = aObjectPropValue->Type(); |
|
499 PRINTV1( "Received data type: 0x%x", type ); |
|
500 TInt result = KErrNone; |
|
501 |
|
502 switch ( aPropCode ) |
|
503 { |
|
504 case EMTPObjectPropCodeStorageID: |
|
505 { |
|
506 TUint32 value = static_cast<const TMTPTypeUint32*>( aObjectPropValue )->Value(); |
|
507 PRINTV1( "Storage ID: 0x%x", value ); |
|
508 if ( value == KTestStorageId ) |
|
509 { |
|
510 result = KErrNone; |
|
511 } |
|
512 } |
|
513 break; |
|
514 case EMTPObjectPropCodeObjectFormat: |
|
515 { |
|
516 TUint16 value = static_cast<const TMTPTypeUint16*>( aObjectPropValue )->Value(); |
|
517 PRINTV1( "Format: 0x%x", value ); |
|
518 if ( value == EMTPFormatCodeMP3 ) |
|
519 { |
|
520 result = KErrNone; |
|
521 } |
|
522 } |
|
523 break; |
|
524 case EMTPObjectPropCodeProtectionStatus: |
|
525 { |
|
526 TUint16 value = static_cast<const TMTPTypeUint16*>( aObjectPropValue )->Value(); |
|
527 PRINTV1( "Protections status: 0x%x", value ); |
|
528 if ( value == EMTPProtectionNoProtection ) |
|
529 { |
|
530 result = KErrNone; |
|
531 } |
|
532 } |
|
533 break; |
|
534 case EMTPObjectPropCodeObjectSize: |
|
535 { |
|
536 TUint64 value = static_cast<const TMTPTypeUint64*>( aObjectPropValue )->Value(); |
|
537 PRINTV1( "Object size: %d", value ); |
|
538 if ( value == KTestFileSize ) |
|
539 { |
|
540 result = KErrNone; |
|
541 } |
|
542 } |
|
543 break; |
|
544 case EMTPObjectPropCodeObjectFileName: |
|
545 { |
|
546 TPtrC value = static_cast<const CMTPTypeString*>( aObjectPropValue )->StringChars(); |
|
547 PRINTV1( "Object file name: '%S'", &value ); |
|
548 result = KErrNone; |
|
549 } |
|
550 break; |
|
551 case EMTPObjectPropCodeParentObject: |
|
552 { |
|
553 TUint32 value = static_cast<const TMTPTypeUint32*>( aObjectPropValue )->Value(); |
|
554 PRINTV1( "Parent object: %d", value ); |
|
555 if ( value == KMaxTUint32 ) |
|
556 { |
|
557 result = KErrNone; |
|
558 } |
|
559 } |
|
560 break; |
|
561 case EMTPObjectPropCodePersistentUniqueObjectIdentifier: |
|
562 { |
|
563 /* |
|
564 TUint64 lower = static_cast<const TMTPTypeUint128*>( aObjectPropValue )->LowerValue(); |
|
565 TUint64 upper = static_cast<const TMTPTypeUint128*>( aObjectPropValue )->UpperValue(); |
|
566 __TRACE( KPrint, ( _L( "Unique identifier: 0x%x 0x%x" ), lower, upper ) ); |
|
567 if ( ( lower == 1) && ( upper == 1 ) ) |
|
568 { |
|
569 result = KErrNone; |
|
570 } |
|
571 */ |
|
572 } |
|
573 break; |
|
574 case EMTPObjectPropCodeName: |
|
575 { |
|
576 TPtrC value = static_cast<const CMTPTypeString*>( aObjectPropValue )->StringChars(); |
|
577 PRINTV1( "Object name: '%S'", &value ); |
|
578 if ( value.Match( KPropObjectName ) != 0 ) |
|
579 { |
|
580 PRINTE2( "Received object name does not match: '%S' != '%S'", &value, &KPropObjectName ); |
|
581 result = KErrGeneral; |
|
582 } |
|
583 } |
|
584 break; |
|
585 case EMTPObjectPropCodeNonConsumable: |
|
586 { |
|
587 TUint8 value = static_cast<const TMTPTypeUint8*>( aObjectPropValue )->Value(); |
|
588 PRINTV1( "Non-consumable: %d", value ); |
|
589 if ( value == 1 ) |
|
590 { |
|
591 result = KErrNone; |
|
592 } |
|
593 } |
|
594 break; |
|
595 case EMTPObjectPropCodeDateAdded: |
|
596 { |
|
597 TPtrC value = static_cast<const CMTPTypeString*>( aObjectPropValue )->StringChars(); |
|
598 PRINTV1( "Date added: '%S'", &value ); |
|
599 result = KErrNone; |
|
600 } |
|
601 break; |
|
602 case EMTPObjectPropCodeDateCreated: |
|
603 { |
|
604 TPtrC value = static_cast<const CMTPTypeString*>( aObjectPropValue )->StringChars(); |
|
605 PRINTV1( "Date created: '%S'", &value ); |
|
606 result = KErrNone; |
|
607 } |
|
608 break; |
|
609 case EMTPObjectPropCodeDateModified: |
|
610 { |
|
611 TPtrC value = static_cast<const CMTPTypeString*>( aObjectPropValue )->StringChars(); |
|
612 PRINTV1( "Date modified: '%S'", &value ); |
|
613 result = KErrNone; |
|
614 } |
|
615 break; |
|
616 case EMTPObjectPropCodeArtist: |
|
617 { |
|
618 TPtrC value = static_cast<const CMTPTypeString*>( aObjectPropValue )->StringChars(); |
|
619 PRINTV1( "Artist: '%S'", &value ); |
|
620 if ( value.Match( KPropObjectArtist ) != 0 ) |
|
621 { |
|
622 PRINTE2( "Received object artist does not match: '%S' != '%S'", &value, &KPropObjectArtist ); |
|
623 result = KErrGeneral; |
|
624 } |
|
625 } |
|
626 break; |
|
627 case EMTPObjectPropCodeTrack: |
|
628 { |
|
629 TUint16 value = static_cast<const TMTPTypeUint16*>( aObjectPropValue )->Value(); |
|
630 PRINTV1( "Track: %d", value ); |
|
631 if ( value == 1 ) |
|
632 { |
|
633 result = KErrNone; |
|
634 } |
|
635 } |
|
636 break; |
|
637 case EMTPObjectPropCodeGenre: |
|
638 { |
|
639 TPtrC value = static_cast<const CMTPTypeString*>( aObjectPropValue )->StringChars(); |
|
640 PRINTV1( "Genre: '%S'", &value ); |
|
641 result = KErrNone; |
|
642 } |
|
643 break; |
|
644 case EMTPObjectPropCodeAlbumName: |
|
645 { |
|
646 TPtrC value = static_cast<const CMTPTypeString*>( aObjectPropValue )->StringChars(); |
|
647 PRINTV1( "Album name: '%S'", &value ); |
|
648 if ( value.Match( KPropObjectAlbumName ) != 0 ) |
|
649 { |
|
650 PRINTE2( "Received object album name does not match: '%S' != '%S'", &value, &KPropObjectAlbumName ); |
|
651 result = KErrGeneral; |
|
652 } |
|
653 } |
|
654 break; |
|
655 case EMTPObjectPropCodeSampleRate: |
|
656 { |
|
657 TUint32 value = static_cast<const TMTPTypeUint16*>( aObjectPropValue )->Value(); |
|
658 PRINTV1( "Sample rate: %d", value ); |
|
659 if ( value == 1 ) |
|
660 { |
|
661 result = KErrNone; |
|
662 } |
|
663 } |
|
664 break; |
|
665 case EMTPObjectPropCodeNumberOfChannels: |
|
666 { |
|
667 TUint16 value = static_cast<const TMTPTypeUint16*>( aObjectPropValue )->Value(); |
|
668 PRINTV1( "Number of channels: %d", value ); |
|
669 if ( value == 1 ) |
|
670 { |
|
671 result = KErrNone; |
|
672 } |
|
673 } |
|
674 break; |
|
675 case EMTPObjectPropCodeAudioWAVECodec: |
|
676 { |
|
677 TUint32 value = static_cast<const TMTPTypeUint16*>( aObjectPropValue )->Value(); |
|
678 PRINTV1( "WAVE codec: %d", value ); |
|
679 if ( value == 1 ) |
|
680 { |
|
681 result = KErrNone; |
|
682 } |
|
683 } |
|
684 break; |
|
685 case EMTPObjectPropCodeAudioBitRate: |
|
686 { |
|
687 TUint32 value = static_cast<const TMTPTypeUint16*>( aObjectPropValue )->Value(); |
|
688 PRINTV1( "Audio bit rate: %d", value ); |
|
689 if ( value == 1 ) |
|
690 { |
|
691 result = KErrNone; |
|
692 } |
|
693 } |
|
694 break; |
|
695 case EMTPObjectPropCodeDuration: |
|
696 { |
|
697 TUint32 value = static_cast<const TMTPTypeUint16*>( aObjectPropValue )->Value(); |
|
698 PRINTV1( "Duration: %d", value ); |
|
699 if ( value == 1 ) |
|
700 { |
|
701 result = KErrNone; |
|
702 } |
|
703 } |
|
704 break; |
|
705 case EMTPObjectPropCodeOriginalReleaseDate: |
|
706 { |
|
707 TPtrC value = static_cast<const CMTPTypeString*>( aObjectPropValue )->StringChars(); |
|
708 PRINTV1( "Original release date: '%S'", &value ); |
|
709 result = KErrNone; |
|
710 } |
|
711 break; |
|
712 case EMTPObjectPropCodeDescription: |
|
713 { |
|
714 result = KErrNone; |
|
715 } |
|
716 break; |
|
717 case EMTPObjectPropCodeComposer: |
|
718 { |
|
719 TPtrC value = static_cast<const CMTPTypeString*>( aObjectPropValue )->StringChars(); |
|
720 PRINTV1( "Composer: '%S'", &value ); |
|
721 result = KErrNone; |
|
722 } |
|
723 break; |
|
724 case EMTPObjectPropCodeWidth: |
|
725 case EMTPObjectPropCodeHeight: |
|
726 case EMTPObjectPropCodeUseCount: |
|
727 case EMTPObjectPropCodeScanType: |
|
728 case EMTPObjectPropCodeVideoFourCCCodec: |
|
729 case EMTPObjectPropCodeVideoBitRate: |
|
730 case EMTPObjectPropCodeFramesPerThousandSeconds: |
|
731 case EMTPObjectPropCodeKeyFrameDistance: |
|
732 case EMTPObjectPropCodeEncodingProfile: |
|
733 case EMTPObjectPropCodeParentalRating: |
|
734 { |
|
735 result = KErrNone; |
|
736 } |
|
737 break; |
|
738 default: |
|
739 { |
|
740 PRINTE1( "Unsupported prop code: %d", aPropCode ); |
|
741 result = KErrArgument; |
|
742 } |
|
743 } |
|
744 PRINTF1( "<CMediaMtpDataProviderTester::GetObjectPropValueL_checkresults result = %d", result ); |
|
745 return result; |
|
746 } |
|
747 |
|
748 TInt CMediaMtpDataProviderTester::GetObjectPropListL_checkresults( |
|
749 const CMTPTypeObjectPropList* aObjectPropList ) |
|
750 { |
|
751 PRINTF0( ">CMediaMtpDataProviderTester::GetObjectPropListL_checkresults" ); |
|
752 TInt result = KErrNone; |
|
753 TUint32 count = aObjectPropList->NumberOfElements(); |
|
754 PRINTV1( "PropList elements received: %d", count ); |
|
755 for ( TUint32 i = 0; i < count; i++ ) |
|
756 { |
|
757 CMTPTypeObjectPropListElement& element = aObjectPropList->Element( i ); |
|
758 TUint32 handle = element.Uint32L( CMTPTypeObjectPropListElement::EObjectHandle ); |
|
759 PRINTV1( "Object handle: %d", handle ); |
|
760 TUint16 dataType = element.Uint16L( CMTPTypeObjectPropListElement::EDatatype ); |
|
761 PRINTV1( "Data type: 0x%x", dataType ); |
|
762 TUint16 propCode = element.Uint16L( CMTPTypeObjectPropListElement::EPropertyCode ); |
|
763 PRINTV1( "Prop code: 0x%x", propCode ); |
|
764 if ( propCode == EMTPObjectPropCodeName ) |
|
765 { |
|
766 if ( dataType == EMTPTypeString ) |
|
767 { |
|
768 TPtrC name = element.StringCharsL( CMTPTypeObjectPropListElement::EValue ); |
|
769 PRINTN1( "Object name: %S", &name ); |
|
770 if ( name.Match( KPropObjectName ) != 0 ) |
|
771 { |
|
772 PRINTE2( "Object modified date is incorrect: %S != %S", &name, &KPropObjectName ); |
|
773 result = KErrGeneral; |
|
774 } |
|
775 } |
|
776 else |
|
777 { |
|
778 PRINTE2( "Wrong datatype received, 0x%x != 0x%x", dataType, EMTPTypeString ); |
|
779 result = KErrArgument; |
|
780 } |
|
781 } |
|
782 } |
|
783 |
|
784 PRINTF1( "<CMediaMtpDataProviderTester::GetObjectPropListL_checkresults result = %d", result ); |
|
785 return result; |
|
786 } |
|
787 |
|
788 TInt CMediaMtpDataProviderTester::GetObjectPropDescL_checkresults( |
|
789 const CMTPTypeObjectPropDesc* aObjectPropDesc, const TUint aPropCode ) |
|
790 { |
|
791 PRINTF0( ">CMediaMtpDataProviderTester::GetObjectPropDescL_checkresults" ); |
|
792 TUint16 propertyCode = aObjectPropDesc->Uint16L( CMTPTypeObjectPropDesc::EPropertyCode ); |
|
793 TUint16 dataType = aObjectPropDesc->Uint16L( CMTPTypeObjectPropDesc::EDatatype ); |
|
794 TUint8 getSet = aObjectPropDesc->Uint8L( CMTPTypeObjectPropDesc::EGetSet ); |
|
795 TUint8 formFlag = aObjectPropDesc->Uint8L( CMTPTypeObjectPropDesc::EFormFlag ); |
|
796 |
|
797 TInt result = KErrNone; |
|
798 |
|
799 PRINTV4( "Property code: 0x%x, data type: 0x%x, form flag: 0x%x, get/set: 0x%x", propertyCode, dataType, formFlag, getSet ); |
|
800 |
|
801 if ( formFlag != CMTPTypeObjectPropDesc::ENone ) |
|
802 { |
|
803 switch ( formFlag ) |
|
804 { |
|
805 case CMTPTypeObjectPropDesc::ERangeForm: |
|
806 PRINTV0( "Range form" ); |
|
807 break; |
|
808 case CMTPTypeObjectPropDesc::EEnumerationForm: |
|
809 PRINTV0( "Enumeration form" ); |
|
810 break; |
|
811 case CMTPTypeObjectPropDesc::EDateTimeForm: |
|
812 PRINTV0( "Datetime form" ); |
|
813 break; |
|
814 case CMTPTypeObjectPropDesc::EFixedLengthArrayForm: |
|
815 PRINTV0( "Fixed length array form" ); |
|
816 break; |
|
817 case CMTPTypeObjectPropDesc::ERegularExpressionForm: |
|
818 PRINTV0( "Regular expression form" ); |
|
819 break; |
|
820 case CMTPTypeObjectPropDesc::EByteArrayForm: |
|
821 PRINTV0( "Byte array form" ); |
|
822 break; |
|
823 case CMTPTypeObjectPropDesc::ELongStringForm: |
|
824 PRINTV0( "Long string form" ); |
|
825 default: |
|
826 { |
|
827 PRINTE0( "Invalid form" ); |
|
828 result = KErrArgument; |
|
829 } |
|
830 } |
|
831 } |
|
832 |
|
833 switch ( aPropCode ) |
|
834 { |
|
835 case EMTPObjectPropCodeStorageID: |
|
836 { |
|
837 PRINTV0( "Storage ID" ); |
|
838 result = KErrNone; |
|
839 } |
|
840 break; |
|
841 case EMTPObjectPropCodeObjectFormat: |
|
842 { |
|
843 PRINTV0( "Object format" ); |
|
844 result = KErrNone; |
|
845 } |
|
846 break; |
|
847 case EMTPObjectPropCodeProtectionStatus: |
|
848 { |
|
849 PRINTV0( "Protection status" ); |
|
850 result = KErrNone; |
|
851 } |
|
852 break; |
|
853 case EMTPObjectPropCodeObjectSize: |
|
854 { |
|
855 PRINTV0( "Object size" ); |
|
856 result = KErrNone; |
|
857 } |
|
858 break; |
|
859 case EMTPObjectPropCodeObjectFileName: |
|
860 { |
|
861 PRINTV0( "Object file name" ); |
|
862 result = KErrNone; |
|
863 } |
|
864 break; |
|
865 case EMTPObjectPropCodeParentObject: |
|
866 { |
|
867 PRINTV0( "Parent object" ); |
|
868 result = KErrNone; |
|
869 } |
|
870 break; |
|
871 case EMTPObjectPropCodePersistentUniqueObjectIdentifier: |
|
872 { |
|
873 PRINTV0( "Unique object identifier" ); |
|
874 result = KErrNone; |
|
875 } |
|
876 break; |
|
877 case EMTPObjectPropCodeName: |
|
878 { |
|
879 PRINTV0( "Name" ); |
|
880 result = KErrNone; |
|
881 } |
|
882 break; |
|
883 case EMTPObjectPropCodeNonConsumable: |
|
884 { |
|
885 PRINTV0( "Non consumable" ); |
|
886 result = KErrNone; |
|
887 } |
|
888 break; |
|
889 case EMTPObjectPropCodeDateAdded: |
|
890 { |
|
891 PRINTV0( "Date added" ); |
|
892 result = KErrNone; |
|
893 } |
|
894 break; |
|
895 case EMTPObjectPropCodeDateCreated: |
|
896 { |
|
897 PRINTV0( "Date created" ); |
|
898 result = KErrNone; |
|
899 } |
|
900 break; |
|
901 case EMTPObjectPropCodeDateModified: |
|
902 { |
|
903 PRINTV0( "Date modified" ); |
|
904 result = KErrNone; |
|
905 } |
|
906 break; |
|
907 case EMTPObjectPropCodeArtist: |
|
908 { |
|
909 PRINTV0( "Artist" ); |
|
910 result = KErrNone; |
|
911 } |
|
912 break; |
|
913 case EMTPObjectPropCodeTrack: |
|
914 { |
|
915 PRINTV0( "Track" ); |
|
916 result = KErrNone; |
|
917 } |
|
918 break; |
|
919 case EMTPObjectPropCodeGenre: |
|
920 { |
|
921 PRINTV0( "Genre" ); |
|
922 result = KErrNone; |
|
923 } |
|
924 break; |
|
925 case EMTPObjectPropCodeAlbumName: |
|
926 { |
|
927 PRINTV0( "Album name" ); |
|
928 result = KErrNone; |
|
929 } |
|
930 break; |
|
931 case EMTPObjectPropCodeSampleRate: |
|
932 { |
|
933 PRINTV0( "Sample rate" ); |
|
934 result = KErrNone; |
|
935 } |
|
936 break; |
|
937 case EMTPObjectPropCodeNumberOfChannels: |
|
938 { |
|
939 PRINTV0( "Number of channels" ); |
|
940 result = KErrNone; |
|
941 } |
|
942 break; |
|
943 case EMTPObjectPropCodeAudioWAVECodec: |
|
944 { |
|
945 PRINTV0( "Audio wave codec" ); |
|
946 result = KErrNone; |
|
947 } |
|
948 break; |
|
949 case EMTPObjectPropCodeAudioBitRate: |
|
950 { |
|
951 PRINTV0( "Audio bitrate" ); |
|
952 result = KErrNone; |
|
953 } |
|
954 break; |
|
955 case EMTPObjectPropCodeDuration: |
|
956 { |
|
957 PRINTV0( "Duration" ); |
|
958 result = KErrNone; |
|
959 } |
|
960 break; |
|
961 case EMTPObjectPropCodeOriginalReleaseDate: |
|
962 { |
|
963 PRINTV0( "Original release date" ); |
|
964 result = KErrNone; |
|
965 } |
|
966 break; |
|
967 case EMTPObjectPropCodeDescription: |
|
968 { |
|
969 PRINTV0( "Description" ); |
|
970 result = KErrNone; |
|
971 } |
|
972 break; |
|
973 case EMTPObjectPropCodeComposer: |
|
974 { |
|
975 PRINTV0( "Composer" ); |
|
976 result = KErrNone; |
|
977 } |
|
978 break; |
|
979 case EMTPObjectPropCodeWidth: |
|
980 { |
|
981 PRINTV0( "Width" ); |
|
982 result = KErrNone; |
|
983 } |
|
984 break; |
|
985 case EMTPObjectPropCodeHeight: |
|
986 { |
|
987 PRINTV0( "Height" ); |
|
988 result = KErrNone; |
|
989 } |
|
990 break; |
|
991 case EMTPObjectPropCodeUseCount: |
|
992 { |
|
993 PRINTV0( "Use count" ); |
|
994 result = KErrNone; |
|
995 } |
|
996 break; |
|
997 case EMTPObjectPropCodeScanType: |
|
998 { |
|
999 PRINTV0( "Scan type" ); |
|
1000 result = KErrNone; |
|
1001 } |
|
1002 break; |
|
1003 case EMTPObjectPropCodeVideoFourCCCodec: |
|
1004 { |
|
1005 PRINTV0( "Video 4cc codec" ); |
|
1006 result = KErrNone; |
|
1007 } |
|
1008 break; |
|
1009 case EMTPObjectPropCodeVideoBitRate: |
|
1010 { |
|
1011 PRINTV0( "Video bitrate" ); |
|
1012 result = KErrNone; |
|
1013 } |
|
1014 break; |
|
1015 case EMTPObjectPropCodeFramesPerThousandSeconds: |
|
1016 { |
|
1017 PRINTV0( "Frames per thousand seconds" ); |
|
1018 result = KErrNone; |
|
1019 } |
|
1020 break; |
|
1021 case EMTPObjectPropCodeKeyFrameDistance: |
|
1022 { |
|
1023 PRINTV0( "Key frame distance" ); |
|
1024 result = KErrNone; |
|
1025 } |
|
1026 break; |
|
1027 case EMTPObjectPropCodeEncodingProfile: |
|
1028 { |
|
1029 PRINTV0( "Encoding profile" ); |
|
1030 result = KErrNone; |
|
1031 } |
|
1032 break; |
|
1033 case EMTPObjectPropCodeParentalRating: |
|
1034 { |
|
1035 PRINTV0( "Parental rating" ); |
|
1036 result = KErrNone; |
|
1037 } |
|
1038 break; |
|
1039 default: |
|
1040 { |
|
1041 PRINTE1( "Unsupported prop code: %d", aPropCode ); |
|
1042 result = KErrArgument; |
|
1043 } |
|
1044 } |
|
1045 PRINTF1( "<CMediaMtpDataProviderTester::GetObjectPropDescL_checkresults result = %d", result ); |
|
1046 return result; |
|
1047 } |
|
1048 |
|
1049 TBool CMediaMtpDataProviderTester::SendObjectInfoL_prepare( |
|
1050 TMTPTypeRequest& aRequest ) |
|
1051 { |
|
1052 PRINTF0( ">CMediaMtpDataProviderTester::SendObjectInfoL_prepare" ); |
|
1053 TBool result = ETrue; |
|
1054 TUint32 storageId = KTestStorageId; // physical storage |
|
1055 aRequest.SetUint32( TMTPTypeRequest::ERequestParameter1, storageId ); |
|
1056 PRINTF1( "<CMediaMtpDataProviderTester::SendObjectInfoL_prepare result = %d", result ); |
|
1057 return result; |
|
1058 } |
|
1059 |
|
1060 void CMediaMtpDataProviderTester::SendObjectInfoReceiveData( |
|
1061 CMTPTypeObjectInfo* aData ) |
|
1062 { |
|
1063 PRINTF0( ">CMediaMtpDataProviderTester::SendObjectInfoReceiveData" ); |
|
1064 aData->SetUint32L( CMTPTypeObjectInfo::EStorageID, KTestStorageId ); |
|
1065 aData->SetUint16L( CMTPTypeObjectInfo::EObjectFormat, EMTPFormatCodeMP3 ); |
|
1066 aData->SetStringL( CMTPTypeObjectInfo::EFilename, KSendTestObjectFile ); |
|
1067 aData->SetStringL( CMTPTypeObjectInfo::EDateModified, KSendTestObjectDateString ); |
|
1068 aData->SetUint32L( CMTPTypeObjectInfo::EObjectCompressedSize, KSendTestFileSize ); |
|
1069 PRINTF0( "<CMediaMtpDataProviderTester::SendObjectInfoReceiveData" ); |
|
1070 } |
|
1071 |
|
1072 TBool CMediaMtpDataProviderTester::SendObjectL_prepare( |
|
1073 TMTPTypeRequest& aRequest ) |
|
1074 { |
|
1075 PRINTF0( ">CMediaMtpDataProviderTester::SendObjectL_prepare" ); |
|
1076 TBool result = ETrue; |
|
1077 TUint32 storageId = KTestStorageId; // physical storage |
|
1078 aRequest.SetUint32( TMTPTypeRequest::ERequestParameter1, storageId ); |
|
1079 PRINTF1( "<CMediaMtpDataProviderTester::SendObjectL_prepare result = %d", result ); |
|
1080 return result; |
|
1081 } |
|
1082 |
|
1083 void CMediaMtpDataProviderTester::SendObjectReceiveDataL( CMTPTypeFile* aData ) |
|
1084 { |
|
1085 PRINTF0( ">CMediaMtpDataProviderTester::SendObjectReceiveDataL" ); |
|
1086 CMTPTypeFile* fileObject = CMTPTypeFile::NewL( iFsSession, |
|
1087 KSendTestObjectFileFullPath, EFileRead ); |
|
1088 CMTPTypeFile::CopyL( *fileObject, *aData ); |
|
1089 delete fileObject; |
|
1090 aData->File().Close(); |
|
1091 PRINTF0( "<CMediaMtpDataProviderTester::SendObjectReceiveDataL" ); |
|
1092 } |
|
1093 |
|
1094 TInt CMediaMtpDataProviderTester::SendObjectL_checkresults() |
|
1095 { |
|
1096 PRINTF0( ">CMediaMtpDataProviderTester::SendObjectL_checkresults" ); |
|
1097 TInt result = KErrNone; |
|
1098 TEntry entry; |
|
1099 if ( !BaflUtils::FileExists( iFsSession, KSendTestObjectPath ) ) |
|
1100 { |
|
1101 PRINTE0( "Sent file does not exist" ); |
|
1102 result = KErrGeneral; |
|
1103 } |
|
1104 else |
|
1105 { |
|
1106 result = iFsSession.Entry( KSendTestObjectPath, entry ); |
|
1107 if ( result != KErrNone ) |
|
1108 { |
|
1109 PRINTE1( "Could not read file entry, error: %d", result ); |
|
1110 } |
|
1111 else |
|
1112 { |
|
1113 if ( entry.iSize != KSendTestFileSize ) |
|
1114 { |
|
1115 PRINTE2( "Sent file size is incorrect: %d != %d", entry.iSize, KSendTestFileSize ); |
|
1116 result = KErrGeneral; |
|
1117 } |
|
1118 } |
|
1119 } |
|
1120 if ( result == KErrNone ) |
|
1121 { |
|
1122 CMTPObjectMetaData* metadata = CMTPObjectMetaData::NewLC(); |
|
1123 iTestObserver->ObjectMgr().ObjectL( KSendTestObjectPath, *metadata ); |
|
1124 if ( metadata->Uint( CMTPObjectMetaData::EHandle ) <= 0 ) |
|
1125 { |
|
1126 PRINTE1( "Object handle not found: %d", metadata->Uint( CMTPObjectMetaData::EHandle ) ); |
|
1127 result = KErrGeneral; |
|
1128 } |
|
1129 if ( metadata->Uint( CMTPObjectMetaData::EFormatCode ) != EMTPFormatCodeMP3 ) |
|
1130 { |
|
1131 PRINTE1( "Wrong format code: %d", metadata->Uint( CMTPObjectMetaData::EFormatCode ) ); |
|
1132 result = KErrGeneral; |
|
1133 } |
|
1134 CleanupStack::PopAndDestroy( metadata ); |
|
1135 } |
|
1136 PRINTF1( "<CMediaMtpDataProviderTester::SendObjectL_checkresults result = %d", result ); |
|
1137 return result; |
|
1138 } |
|
1139 |
|
1140 void CMediaMtpDataProviderTester::SetObjectPropValueReceiveDataL( |
|
1141 const TMTPTypeRequest& aRequest, MMTPType* aData ) |
|
1142 { |
|
1143 TUint32 propCode = aRequest.Uint32( TMTPTypeRequest::ERequestParameter2 ); |
|
1144 TUint type = aData->Type(); |
|
1145 switch ( propCode ) |
|
1146 { |
|
1147 case EMTPObjectPropCodeName: |
|
1148 if ( type != EMTPTypeString ) |
|
1149 { |
|
1150 PRINTE2( "Incorrect data type: 0x%x != 0x%x", type, EMTPTypeString ); |
|
1151 User::Leave( KErrArgument ); |
|
1152 } |
|
1153 static_cast<CMTPTypeString*>( aData )->SetL( KPropObjectName ); |
|
1154 break; |
|
1155 case EMTPObjectPropCodeArtist: |
|
1156 if ( type != EMTPTypeString ) |
|
1157 { |
|
1158 PRINTE2( "Incorrect data type: 0x%x != 0x%x", type, EMTPTypeString ); |
|
1159 User::Leave( KErrArgument ); |
|
1160 } |
|
1161 static_cast<CMTPTypeString*>( aData )->SetL( KPropObjectArtist ); |
|
1162 break; |
|
1163 case EMTPObjectPropCodeAlbumName: |
|
1164 if ( type != EMTPTypeString ) |
|
1165 { |
|
1166 PRINTE2( "Incorrect data type: 0x%x != 0x%x", type, EMTPTypeString ); |
|
1167 User::Leave( KErrArgument ); |
|
1168 } |
|
1169 static_cast<CMTPTypeString*>( aData )->SetL( KPropObjectAlbumName ); |
|
1170 break; |
|
1171 default: |
|
1172 PRINTE1( "Property code not supported: 0x%x", propCode ); |
|
1173 User::Leave( KErrNotSupported ); |
|
1174 break; |
|
1175 } |
|
1176 } |
|
1177 |
|
1178 void CMediaMtpDataProviderTester::SetObjectPropListReceiveDataL( |
|
1179 CMTPTypeObjectPropList* aData ) |
|
1180 { |
|
1181 PRINTF0( ">CMediaMtpDataProviderTester::SetObjectPropListReceiveDataL" ); |
|
1182 CMTPTypeString* nameString = CMTPTypeString::NewLC( KPropObjectName ); |
|
1183 CMTPTypeObjectPropListElement* newElement; |
|
1184 newElement = CMTPTypeObjectPropListElement::NewL( 1, static_cast<TUint16>( EMTPObjectPropCodeName ), *nameString ); |
|
1185 aData->AppendL( newElement ); |
|
1186 newElement = CMTPTypeObjectPropListElement::NewL( 2, static_cast<TUint16>( EMTPObjectPropCodeName ), *nameString ); |
|
1187 aData->AppendL( newElement ); |
|
1188 newElement = CMTPTypeObjectPropListElement::NewL( 3, static_cast<TUint16>( EMTPObjectPropCodeName ), *nameString ); |
|
1189 aData->AppendL( newElement ); |
|
1190 CleanupStack::Pop( nameString ); |
|
1191 PRINTF0( "<CMediaMtpDataProviderTester::SetObjectPropListReceiveDataL" ); |
|
1192 } |
|
1193 |
|
1194 TInt CMediaMtpDataProviderTester::DeleteObjectL_checkresults( |
|
1195 MMTPObjectMgr& aObjectManager ) |
|
1196 { |
|
1197 PRINTF0( ">CMediaMtpDataProviderTester::DeleteObjectL_checkresults" ); |
|
1198 TInt result = KErrNone; |
|
1199 // check that everything has been deleted from the file system |
|
1200 if ( BaflUtils::FileExists( iFsSession, KTestObjectPath1 ) ) |
|
1201 { |
|
1202 PRINTE0( "Test file 1 was not deleted successfully" ); |
|
1203 result = KErrGeneral; |
|
1204 } |
|
1205 if ( BaflUtils::FileExists( iFsSession, KTestObjectPath2 ) ) |
|
1206 { |
|
1207 PRINTE0( "Test file 2 was not deleted successfully" ); |
|
1208 result = KErrGeneral; |
|
1209 } |
|
1210 if ( BaflUtils::FileExists( iFsSession, KTestObjectPath3 ) ) |
|
1211 { |
|
1212 PRINTE0( "Test file 3 was not deleted successfully" ); |
|
1213 result = KErrGeneral; |
|
1214 } |
|
1215 PRINTF1( ">CMediaMtpDataProviderTester::DeleteObjectL_checkresults result = %d", result ); |
|
1216 return result; |
|
1217 } |
|
1218 |
|
1219 TBool CMediaMtpDataProviderTester::CopyObjectL_prepare( |
|
1220 TMTPTypeRequest& aRequest ) |
|
1221 { |
|
1222 PRINTF0( ">CMediaMtpDataProviderTester::CopyObjectL_prepare" ); |
|
1223 TBool result = ETrue; |
|
1224 TUint32 storageId = KTestStorageId; // physical storage |
|
1225 aRequest.SetUint32( TMTPTypeRequest::ERequestParameter2, storageId ); |
|
1226 PRINTF1( "<CMediaMtpDataProviderTester::CopyObjectL_prepare result = %d", result ); |
|
1227 return result; |
|
1228 } |
|
1229 |
|
1230 TInt CMediaMtpDataProviderTester::CopyObjectL_checkresults( |
|
1231 const CMTPObjectMetaData* aMetaData ) |
|
1232 { |
|
1233 PRINTF0( ">CMediaMtpDataProviderTester::CopyObjectL_checkresults" ); |
|
1234 TInt result = KErrNone; |
|
1235 if ( !BaflUtils::FileExists( iFsSession, KCopyTestObjectPath ) ) |
|
1236 { |
|
1237 PRINTE0( "Copied file does not exist" ); |
|
1238 result = KErrGeneral; |
|
1239 } |
|
1240 else |
|
1241 { |
|
1242 TEntry entry; |
|
1243 result = iFsSession.Entry( KCopyTestObjectPath, entry ); |
|
1244 if ( result != KErrNone ) |
|
1245 { |
|
1246 PRINTE1( "Could not read file entry, error: %d", result ); |
|
1247 } |
|
1248 else |
|
1249 { |
|
1250 if ( entry.iSize != KCopyTestFileSize ) |
|
1251 { |
|
1252 PRINTE2( "Copied file size is incorrect: %d != %d", entry.iSize, KCopyTestFileSize ); |
|
1253 result = KErrGeneral; |
|
1254 } |
|
1255 } |
|
1256 } |
|
1257 |
|
1258 if ( aMetaData ) |
|
1259 { |
|
1260 PRINTV1( "Suid: %S", &aMetaData->DesC( CMTPObjectMetaData::ESuid ) ); |
|
1261 |
|
1262 if ( aMetaData->Uint( CMTPObjectMetaData::EParentHandle ) != KMTPHandleNoParent ) |
|
1263 { |
|
1264 PRINTV1( "Parent handle = %d", aMetaData->Uint( CMTPObjectMetaData::EParentHandle ) ); |
|
1265 //TODO: parent handles don't work yet properly |
|
1266 //result = KErrGeneral; |
|
1267 } |
|
1268 |
|
1269 if ( aMetaData->Int( CMTPObjectMetaData::EParentId ) != KErrNotFound ) |
|
1270 { |
|
1271 PRINTV1( "Parent id = %d", aMetaData->Int( CMTPObjectMetaData::EParentId ) ); |
|
1272 //TODO: parent ids don't work yet properly |
|
1273 //result = KErrGeneral; |
|
1274 } |
|
1275 if ( aMetaData->Uint( CMTPObjectMetaData::EDataProviderId ) != 0 ) |
|
1276 { |
|
1277 PRINTV1( "Dataprovider id = %d", aMetaData->Uint( CMTPObjectMetaData::EDataProviderId ) ); |
|
1278 //TODO: not sure if this is necessary |
|
1279 //result = KErrGeneral; |
|
1280 } |
|
1281 if ( aMetaData->Uint( CMTPObjectMetaData::EFormatCode ) != EMTPFormatCodeMP3 ) |
|
1282 { |
|
1283 PRINTV1( "Format code = %d", aMetaData->Uint( CMTPObjectMetaData::EFormatCode ) ); |
|
1284 result = KErrGeneral; |
|
1285 } |
|
1286 if ( aMetaData->Uint( CMTPObjectMetaData::EStorageId ) != KTestStorageId ) |
|
1287 { |
|
1288 PRINTV1( "StorageId = %d ", aMetaData->Uint( CMTPObjectMetaData::EStorageId ) ); |
|
1289 result = KErrGeneral; |
|
1290 } |
|
1291 if ( ( aMetaData->DesC( CMTPObjectMetaData::ESuid ) ).Match( KCopyTestObjectPath ) != 0 ) |
|
1292 { |
|
1293 PRINTV0( "Copied object path incorrect" ); |
|
1294 result = KErrGeneral; |
|
1295 } |
|
1296 } |
|
1297 else |
|
1298 { |
|
1299 PRINTV0( "Object metadata not received correctly" ); |
|
1300 result = KErrArgument; |
|
1301 } |
|
1302 PRINTF1( "<CMediaMtpDataProviderTester::CopyObjectL_checkresults result = %d", result ); |
|
1303 return result; |
|
1304 } |
|
1305 |
|
1306 TBool CMediaMtpDataProviderTester::MoveObjectL_prepare( |
|
1307 TMTPTypeRequest& aRequest ) |
|
1308 { |
|
1309 PRINTF0( ">CMediaMtpDataProviderTester::MoveObjectL_prepare" ); |
|
1310 TBool result = ETrue; |
|
1311 TUint32 storageId = KTestStorageId; // physical storage |
|
1312 aRequest.SetUint32( TMTPTypeRequest::ERequestParameter2, storageId ); |
|
1313 PRINTF1( "<CMediaMtpDataProviderTester::MoveObjectL_prepare result = %d", result ); |
|
1314 return result; |
|
1315 } |
|
1316 |
|
1317 TInt CMediaMtpDataProviderTester::MoveObjectL_checkresults( const CMTPObjectMetaData* aMetaData ) |
|
1318 { |
|
1319 PRINTF0( ">CMediaMtpDataProviderTester::MoveObjectL_checkresults" ); |
|
1320 TInt result = KErrNone; |
|
1321 if ( BaflUtils::FileExists( iFsSession, KMoveTestObjectOldPath ) ) |
|
1322 { |
|
1323 PRINTE0( "Moved file still exists in original location" ); |
|
1324 result = KErrGeneral; |
|
1325 } |
|
1326 if ( !BaflUtils::FileExists( iFsSession, KMoveTestObjectNewPath ) ) |
|
1327 { |
|
1328 PRINTE0( "Moved file does not exist in new location" ); |
|
1329 result = KErrGeneral; |
|
1330 } |
|
1331 else |
|
1332 { |
|
1333 TEntry entry; |
|
1334 result = iFsSession.Entry( KMoveTestObjectNewPath, entry ); |
|
1335 if ( result != KErrNone ) |
|
1336 { |
|
1337 PRINTE1( "Could not read file entry, error: %d", result ); |
|
1338 } |
|
1339 else |
|
1340 { |
|
1341 if ( entry.iSize != KMoveTestFileSize ) |
|
1342 { |
|
1343 PRINTE2( "Moved file size is incorrect: %d != %d", entry.iSize, KCopyTestFileSize ); |
|
1344 result = KErrGeneral; |
|
1345 } |
|
1346 } |
|
1347 } |
|
1348 |
|
1349 if ( aMetaData ) |
|
1350 { |
|
1351 PRINTV1( "Suid: %S", &aMetaData->DesC( CMTPObjectMetaData::ESuid ) ); |
|
1352 |
|
1353 if ( aMetaData->Uint( CMTPObjectMetaData::EParentHandle ) != KMTPHandleNoParent ) |
|
1354 { |
|
1355 PRINTV1( "Parent handle = %d", aMetaData->Uint( CMTPObjectMetaData::EParentHandle ) ); |
|
1356 //TODO: parent handles don't work yet properly |
|
1357 //result = KErrGeneral; |
|
1358 } |
|
1359 |
|
1360 if ( aMetaData->Int( CMTPObjectMetaData::EParentId ) != KErrNotFound ) |
|
1361 { |
|
1362 PRINTV1( "Parent id = %d", aMetaData->Int( CMTPObjectMetaData::EParentId ) ); |
|
1363 //TODO: parent ids don't work yet properly |
|
1364 //result = KErrGeneral; |
|
1365 } |
|
1366 if ( aMetaData->Uint( CMTPObjectMetaData::EDataProviderId ) != 0 ) |
|
1367 { |
|
1368 PRINTV1( "Dataprovider id = %d", aMetaData->Uint( CMTPObjectMetaData::EDataProviderId ) ); |
|
1369 //TODO: not sure if this is necessary |
|
1370 //result = KErrGeneral; |
|
1371 } |
|
1372 if ( aMetaData->Uint( CMTPObjectMetaData::EFormatCode ) != EMTPFormatCodeMP3 ) |
|
1373 { |
|
1374 PRINTV1( "Format code = %d", aMetaData->Uint( CMTPObjectMetaData::EFormatCode ) ); |
|
1375 result = KErrGeneral; |
|
1376 } |
|
1377 if ( aMetaData->Uint( CMTPObjectMetaData::EStorageId ) != KTestStorageId ) |
|
1378 { |
|
1379 PRINTV1( "StorageId = %d ", aMetaData->Uint( CMTPObjectMetaData::EStorageId ) ); |
|
1380 result = KErrGeneral; |
|
1381 } |
|
1382 if ( ( aMetaData->DesC( CMTPObjectMetaData::ESuid ) ).Match( KMoveTestObjectNewPath ) != 0 ) |
|
1383 { |
|
1384 PRINTV0( "Copied object path incorrect" ); |
|
1385 result = KErrGeneral; |
|
1386 } |
|
1387 } |
|
1388 else |
|
1389 { |
|
1390 PRINTV0( "Object metadata not received correctly" ); |
|
1391 result = KErrArgument; |
|
1392 } |
|
1393 PRINTF1( "<CMediaMtpDataProviderTester::MoveObjectL_checkresults result = %d", result ); |
|
1394 return KErrNone; |
|
1395 } |
|
1396 |
|
1397 TInt CMediaMtpDataProviderTester::GetPartialObjectL_checkresults( CMTPTypeFile *aObjectInfo ) |
|
1398 { |
|
1399 PRINTF0( ">CMediaMtpDataProviderTester::GetPartialObjectL_checkresults" ); |
|
1400 // just check the handle is correct, based on the size... |
|
1401 TInt result = KErrNone; |
|
1402 if ( aObjectInfo ) |
|
1403 { |
|
1404 TInt size = aObjectInfo->Size(); |
|
1405 __TRACE( KPrint, ( _L("Received object size: %d"), size ) ); |
|
1406 if ( size != KTestFileSize ) |
|
1407 { |
|
1408 __TRACE( KError, ( _L("Wrong received object size: %d != %d" ), KTestFileSize, size ) ); |
|
1409 result = KErrGeneral; |
|
1410 } |
|
1411 aObjectInfo->File().Close(); |
|
1412 } |
|
1413 else |
|
1414 { |
|
1415 __TRACE( KError, ( _L("Object info not received" ) ) ); |
|
1416 result = KErrArgument; |
|
1417 } |
|
1418 PRINTF1( "<CMediaMtpDataProviderTester::GetPartialObjectL_checkresults result = %d", result ); |
|
1419 return result; |
|
1420 } |
|
1421 |
|
1422 TBool CMediaMtpDataProviderTester::RenameObjectL_prepare( TMTPNotificationParamsHandle& aParam ) |
|
1423 { |
|
1424 PRINTF0( ">CMediaMtpDataProviderTester::RenameObjectL_prepare" ); |
|
1425 TBool result = ETrue; |
|
1426 TFileName fileName( KRenameObjectName ); |
|
1427 aParam.iHandleId = KTestDirHandle; |
|
1428 aParam.iFileName = fileName; |
|
1429 |
|
1430 TInt moveResult = iFileMan->Move( KTestDirPath, KRenameObjectPath, |
|
1431 CFileMan::ERecurse ); |
|
1432 if ( moveResult != KErrNone ) |
|
1433 { |
|
1434 PRINTE1( "Moving directory failed with error %d", moveResult ); |
|
1435 } |
|
1436 CMTPObjectMetaData* metadata = CMTPObjectMetaData::NewLC(); |
|
1437 iTestObserver->ObjectMgr().ObjectL( KTestDirPath, *metadata ); |
|
1438 metadata->SetDesCL( CMTPObjectMetaData::ESuid, KRenameObjectPath ); |
|
1439 iTestObserver->ObjectMgr().ModifyObjectL( *metadata ); |
|
1440 CleanupStack::PopAndDestroy( metadata ); |
|
1441 PRINTF1( "<CMediaMtpDataProviderTester::RenameObjectL_prepare result = %d", result ); |
|
1442 return result; |
|
1443 } |
|
1444 |
|
1445 TInt CMediaMtpDataProviderTester::RenameObjectL_checkresults( const CMTPObjectMetaData* aMetaData ) |
|
1446 { |
|
1447 PRINTF0( ">CMediaMtpDataProviderTester::RenameObjectL_checkresults" ); |
|
1448 TInt result = KErrNone; |
|
1449 |
|
1450 TMTPObjectMgrQueryParams queryParams ( KMTPStorageAll, KMTPFormatsAll, KMTPHandleNone ); |
|
1451 RMTPObjectMgrQueryContext context; |
|
1452 RArray<TUint> handles; |
|
1453 CleanupClosePushL( handles ); |
|
1454 |
|
1455 iTestObserver->ObjectMgr().GetObjectHandlesL( queryParams, context, handles ); |
|
1456 context.Close(); |
|
1457 TInt count = handles.Count(); |
|
1458 PRINTV1( "Handle count: %d", count ); |
|
1459 |
|
1460 CMTPObjectMetaData* metadata = CMTPObjectMetaData::NewLC(); |
|
1461 for ( TInt i = 0; i < count; i++ ) |
|
1462 { |
|
1463 TUint handle = handles[i]; |
|
1464 iTestObserver->ObjectMgr().ObjectL( handle, *metadata ); |
|
1465 TPtrC fileName = metadata->DesC( CMTPObjectMetaData::ESuid ); |
|
1466 PRINTV1( "Handle: %d", handle ); |
|
1467 PRINTV1( "File name: %S", &fileName ); |
|
1468 } |
|
1469 CleanupStack::PopAndDestroy( 2 ); // metadata, handles |
|
1470 PRINTF1( "<CMediaMtpDataProviderTester::RenameObjectL_checkresults result = %d", result ); |
|
1471 return result; |
|
1472 } |
|
1473 |
|
1474 TBool CMediaMtpDataProviderTester::GetObjectPropsSupportedL_prepare( TMTPTypeRequest& aRequest ) |
|
1475 { |
|
1476 PRINTF0( ">CMediaMtpDataProviderTester::GetObjectPropsSupportedL_prepare" ); |
|
1477 TBool result = ETrue; |
|
1478 aRequest.SetUint32( TMTPTypeRequest::ERequestParameter1, EMTPFormatCodeMP3 ); |
|
1479 PRINTF1( "<CMediaMtpDataProviderTester::GetObjectPropsSupportedL_prepare result = %d", result ); |
|
1480 return result; |
|
1481 } |
|
1482 |
|
1483 TInt CMediaMtpDataProviderTester::GetObjectPropsSupportedL_checkresults( const CMTPTypeArray* aObjectProps ) |
|
1484 { |
|
1485 PRINTF0( ">CMediaMtpDataProviderTester::GetObjectPropsSupportedL_checkresults" ); |
|
1486 TInt result = KErrNone; |
|
1487 TInt count = aObjectProps->NumElements(); |
|
1488 PRINTV1( "Object props found: %d", count ); |
|
1489 PRINTF1( "<CMediaMtpDataProviderTester::GetObjectPropsSupportedL_checkresults result = %d", result ); |
|
1490 return result; |
|
1491 } |
|
1492 |
|
1493 TBool CMediaMtpDataProviderTester::ProcessRequestIllegalIdL_prepare(TInt aOpCode) |
|
1494 { |
|
1495 PRINTF0( ">CMediaMtpDataProviderTester::ProcessRequestIllegalIdL_prepare" ); |
|
1496 // EMTPOpCodeGetObjectPropValue cannot be tested with the invalid session id, as the object |
|
1497 // must exist or the data provider fails in __ASSERT_DEBUG(aObjectInfo, Panic(EMTPPictureDpObjectNull)); |
|
1498 TBool result = ETrue; |
|
1499 if ( aOpCode == EMTPOpCodeGetObjectPropValue ) |
|
1500 { |
|
1501 result = EFalse; |
|
1502 } |
|
1503 PRINTF1( "<CMediaMtpDataProviderTester::ProcessRequestIllegalIdL_prepare result = %d", result ); |
|
1504 return result; |
|
1505 } |
|
1506 |
|
1507 TInt CMediaMtpDataProviderTester::ProcessRequestIllegalIdL_checkresults(TInt aOpCode, TInt aResponseCode) |
|
1508 { |
|
1509 PRINTF0( ">CMediaMtpDataProviderTester::ProcessRequestIllegalIdL_checkresults" ); |
|
1510 TInt result = KErrGeneral; |
|
1511 switch (aOpCode) |
|
1512 { |
|
1513 case EMTPOpCodeGetObjectInfo: |
|
1514 case EMTPOpCodeGetObject: |
|
1515 case EMTPOpCodeGetPartialObject: |
|
1516 case EMTPOpCodeGetThumb: |
|
1517 case EMTPOpCodeDeleteObject: |
|
1518 case EMTPOpCodeMoveObject: |
|
1519 case EMTPOpCodeCopyObject: |
|
1520 case EMTPOpCodeGetObjectPropsSupported: |
|
1521 case EMTPOpCodeGetObjectPropList: |
|
1522 case EMTPOpCodeGetObjectReferences: |
|
1523 if (aResponseCode == EMTPRespCodeSessionNotOpen) |
|
1524 { |
|
1525 result = KErrNone; |
|
1526 } |
|
1527 break; |
|
1528 case EMTPOpCodeSendObjectInfo: |
|
1529 case EMTPOpCodeSendObject: |
|
1530 case EMTPOpCodeSetObjectPropValue: |
|
1531 case EMTPOpCodeSetObjectPropList: |
|
1532 case EMTPOpCodeSendObjectPropList: |
|
1533 case EMTPOpCodeSetObjectReferences: |
|
1534 if (aResponseCode == 0) |
|
1535 { |
|
1536 result = KErrNone; |
|
1537 } |
|
1538 break; |
|
1539 case EMTPOpCodeGetObjectPropDesc: |
|
1540 if (aResponseCode == EMTPRespCodeInvalidObjectFormatCode) |
|
1541 { |
|
1542 result = KErrNone; |
|
1543 } |
|
1544 break; |
|
1545 case EMTPOpCodeGetDeviceInfo: |
|
1546 if (aResponseCode == EMTPRespCodeInvalidTransactionID) |
|
1547 { |
|
1548 result = KErrNone; |
|
1549 } |
|
1550 break; |
|
1551 default: |
|
1552 result = KErrNone; |
|
1553 break; |
|
1554 } |
|
1555 PRINTF1( "<CMediaMtpDataProviderTester::ProcessRequestIllegalIdL_checkresults result = %d", result ); |
|
1556 return result; |
|
1557 } |