mpx/tsrc/public/basic/collectiontest/src/collectiontests.cpp
changeset 64 92dbd2a406d9
equal deleted inserted replaced
61:3b098142db83 64:92dbd2a406d9
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  MpxCollectionTest test module.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <mpxcollectionutility.h>
       
    20 #include <mpxcollectionpath.h>
       
    21 #include <mpxcollectionplaylist.h>
       
    22 #include <mpxplaybackframeworkdefs.h>
       
    23 #include <mpxcollectionmessage.h>
       
    24 #include <mpxcollectionframeworkdefs.h>
       
    25 #include <mpxmessagegeneraldefs.h> // KMPXMessageGeneralEvent, KMPXMessageGeneralType
       
    26 #include <mpxmediageneraldefs.h>
       
    27 #include <mpxmediaarray.h>
       
    28 #include <mpxmediacontainerdefs.h>
       
    29 #include <mpxattribute.h>
       
    30 #include <stiflogger.h>
       
    31 #include "testutility.h"
       
    32 #include "testplaybackview.h"
       
    33 #include "pathoptionmenu.h" 
       
    34 #include "collectiontests.h"
       
    35 #include "testpanic.h"
       
    36 
       
    37 // MACROS
       
    38 
       
    39 #define DELETE_PTR( PTR_VAR )\
       
    40 	if( PTR_VAR )\
       
    41 		{\
       
    42 		delete PTR_VAR;\
       
    43 		PTR_VAR = NULL;\
       
    44 		}
       
    45 		
       
    46 #define DELETE_COLLECTION_PTR( PTR_VAR )\
       
    47 	if( PTR_VAR )\
       
    48 		{\
       
    49 		PTR_VAR->Close();\
       
    50 		PTR_VAR = NULL;\
       
    51 		}
       
    52 
       
    53 // return on failure
       
    54 #define TMC_ASSERT( _TMCcode, _TMCcheckpt )\
       
    55 	{\
       
    56 	AssertL( _TMCcode, _TMCcheckpt );\
       
    57 	if( !(_TMCcode ) )\
       
    58 		{\
       
    59 		return;\
       
    60 		}\
       
    61 	}
       
    62 			
       
    63 			
       
    64 // DATA TYPES
       
    65 
       
    66 // ============================ MEMBER FUNCTIONS ===============================
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CCollectionTests::NewL
       
    70 // Two-phased constructor.
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 CCollectionTests* CCollectionTests::NewL(CConsoleMain* aConsoleMain,
       
    74                                     	 CTestBaseView* aParent,
       
    75                                    		 const TDesC& aName,
       
    76                                    	     CStifLogger* aLogger,
       
    77                                    	     TInt testIndex)
       
    78     {
       
    79     CCollectionTests* self = CCollectionTests::NewLC(aConsoleMain,
       
    80                                                      aParent,
       
    81                                                    	 aName,
       
    82                                                      aLogger,
       
    83                                                      testIndex);
       
    84     CleanupStack::PopAndDestroy(self);
       
    85 
       
    86     return self;
       
    87     }
       
    88     
       
    89 // -----------------------------------------------------------------------------
       
    90 // CCollectionTests::NewLC
       
    91 // Two-phased constructor.
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 CCollectionTests* CCollectionTests::NewLC(CConsoleMain* aConsoleMain,
       
    95                                     	  CTestBaseView* aParent,
       
    96                                    		  const TDesC& aName,
       
    97                                    	      CStifLogger* aLogger,
       
    98                                    	      TInt testIndex)
       
    99     {
       
   100     CCollectionTests* self = new (ELeave) CCollectionTests(aConsoleMain,
       
   101                                                            aParent,
       
   102                                                    	       aName,
       
   103                                                            aLogger,
       
   104                                                            testIndex);
       
   105     
       
   106     CleanupStack::PushL( self );
       
   107     self->ConstructL();
       
   108 
       
   109     return self;
       
   110     }
       
   111     
       
   112 // -----------------------------------------------------------------------------
       
   113 // C++ default constructor.
       
   114 // -----------------------------------------------------------------------------
       
   115 CCollectionTests::CCollectionTests(CConsoleMain* aConsoleMain,
       
   116                                    CTestBaseView* aParent,
       
   117                                    const TDesC& aName,
       
   118                                    CStifLogger* aLogger,
       
   119                                    TInt testIndex)
       
   120     : CTestMenuView(aConsoleMain, aParent, aName),
       
   121       iCollectionUtility1(NULL), 
       
   122       iCollectionUtility2(NULL),
       
   123       iLogger(aLogger), 
       
   124       iTestIndex(testIndex), 
       
   125       iStopAtTestIndex(testIndex), 
       
   126       iTempCnt(0),
       
   127       iLatestTestResult(KErrNone)
       
   128     {    
       
   129     // set stop index for groups
       
   130     switch(iTestIndex)
       
   131     	{
       
   132     	case  21: iStopAtTestIndex =  35; break;
       
   133     	case  36: iStopAtTestIndex =  41; break;
       
   134     	case  42: iStopAtTestIndex =  53; break;
       
   135     	case  54: iStopAtTestIndex =  60; break;
       
   136     	case  70: iStopAtTestIndex =  81; break;
       
   137     	case  82: iStopAtTestIndex = 100; break;
       
   138     	case 101: iStopAtTestIndex = 109; break;
       
   139     	case 110: iStopAtTestIndex = 120; break;
       
   140     	case 121: iStopAtTestIndex = 140; break;
       
   141     	case 141: iStopAtTestIndex = 149; break;
       
   142     	case 150: iStopAtTestIndex = 169; break;
       
   143     	case 170: iStopAtTestIndex = 184; break;
       
   144     	case 185: iStopAtTestIndex = 189; break;
       
   145     	case 194: iStopAtTestIndex = 202; break;
       
   146     	}
       
   147     }
       
   148 
       
   149 // -----------------------------------------------------------------------------
       
   150 // Second phase constructor
       
   151 // -----------------------------------------------------------------------------
       
   152 void CCollectionTests::ConstructL()
       
   153     {
       
   154     CTestMenuView::ConstructL();
       
   155     }
       
   156   
       
   157 // -----------------------------------------------------------------------------
       
   158 // Destructor
       
   159 // -----------------------------------------------------------------------------
       
   160 CCollectionTests::~CCollectionTests()
       
   161     {
       
   162     iLogger->Log(_L("+CCollectionTests::~CCollectionTests"));  
       
   163     
       
   164     DELETE_COLLECTION_PTR(iCollectionUtility1);    	
       
   165     DELETE_COLLECTION_PTR(iCollectionUtility2);	    
       
   166 
       
   167     iLogger->Log(_L("-CCollectionTests::~CCollectionTests"));
       
   168     }
       
   169            
       
   170 // -----------------------------------------------------------------------------
       
   171 // Return whether test requires scheduler for aysynchronous wait.
       
   172 // -----------------------------------------------------------------------------
       
   173 
       
   174 TBool CCollectionTests::IsTestSynchronous(int testIndex)
       
   175 	{
       
   176 	// some cases do not use callbacks; so, no need to use scheduler
       
   177 	return (testIndex == 20 ) || (testIndex >= 190 && testIndex <= 193);
       
   178 	}
       
   179 	
       
   180 // -----------------------------------------------------------------------------
       
   181 // Result from latest test
       
   182 // -----------------------------------------------------------------------------    	
       
   183 TInt CCollectionTests::GetLatestTestResult()
       
   184     {
       
   185     return iLatestTestResult;
       
   186 	}
       
   187 	
       
   188 	
       
   189 // -----------------------------------------------------------------------------
       
   190 // Stop the current test
       
   191 // -----------------------------------------------------------------------------
       
   192 void CCollectionTests::TestCompleteL()
       
   193 	{
       
   194 	CurrentViewDoneL();
       
   195 	}
       
   196 	
       
   197 // -----------------------------------------------------------------------------
       
   198 // From CTestBaseView
       
   199 // Handle number key press
       
   200 // -----------------------------------------------------------------------------
       
   201 void CCollectionTests::HandleNumKeyL()
       
   202     {            
       
   203     }
       
   204     
       
   205 // -----------------------------------------------------------------------------
       
   206 // From CTestBaseView
       
   207 // Handle left key press
       
   208 // -----------------------------------------------------------------------------
       
   209 void CCollectionTests::HandleLeftKeyL()
       
   210     {
       
   211     iLogger->Log(_L("+CCollectionTests::HandleLeftKeyL"));
       
   212 
       
   213     iLogger->Log(_L("-CCollectionTests::HandleLeftKeyL"));
       
   214     }
       
   215         
       
   216 // -----------------------------------------------------------------------------
       
   217 // From CTestBaseView
       
   218 // Handle right/enter key press
       
   219 // -----------------------------------------------------------------------------
       
   220 void CCollectionTests::HandleRightKeyL()
       
   221     {
       
   222     iLogger->Log(_L("+CCollectionTests::HandleRightKeyL"));
       
   223 
       
   224     iLogger->Log(_L("-CCollectionTests::HandleRightKeyL"));
       
   225     }   
       
   226 
       
   227 // -----------------------------------------------------------------------------
       
   228 // From CTestBaseView
       
   229 // Cleanup the view before deactivate/destroy view
       
   230 // -----------------------------------------------------------------------------
       
   231 void CCollectionTests::CleanupViewL()
       
   232     {  
       
   233     }
       
   234      
       
   235 // -----------------------------------------------------------------------------
       
   236 // From CTestBaseView
       
   237 // Initialize the view before display view
       
   238 // -----------------------------------------------------------------------------
       
   239 void CCollectionTests::InitializeViewL()
       
   240     {
       
   241     Collection1_Initialize();
       
   242     }          
       
   243            
       
   244 void CCollectionTests::RunNext()
       
   245 	{        
       
   246 	if(iStopAtTestIndex == iTestIndex)
       
   247 		{
       
   248 		TestCompleteL();
       
   249 		return;
       
   250 		}
       
   251 		
       
   252 	iTestIndex++;
       
   253  
       
   254     StartNextTestL();
       
   255 	}
       
   256     	    
       
   257 void CCollectionTests::StartNextTestL()
       
   258 {	
       
   259     switch(iTestIndex)
       
   260     	{
       
   261     	case   1: StartTest0001L(); break;
       
   262     	case   2: StartTest0002L(); break;
       
   263     	case   3: StartTest0003L(); break;
       
   264     	case   4: StartTest0004L(); break;
       
   265     	case   5: StartTest0005L(); break;
       
   266     	case   6: StartTest0006L(); break;
       
   267     	case   7: StartTest0007L(); break;
       
   268     	case   8: StartTest0008L(); break;
       
   269     	case   9: StartTest0009L(); break;
       
   270     	case  10: StartTest0010L(); break;
       
   271     	case  11: StartTest0011L(); break;
       
   272     	case  12: StartTest0012L(); break;
       
   273     	case  13: StartTest0013L(); break;
       
   274     	case  14: StartTest0014L(); break;
       
   275     	case  15: StartTest0015L(); break;
       
   276     	case  16: StartTest0016L(); break;
       
   277     	case  17: StartTest0017L(); break;
       
   278     	case  18: StartTest0018L(); break;
       
   279     	case  19: StartTest0019L(); break;
       
   280     	case  20: StartTest0020L(); break;
       
   281     	case  21: StartTest0021L(); break;
       
   282     	case  22: StartTest0022L(); break;
       
   283     	case  23: StartTest0023L(); break;
       
   284     	case  24: StartTest0024L(); break;
       
   285     	case  25: StartTest0025L(); break;
       
   286     	case  26: StartTest0026L(); break;
       
   287     	case  27: StartTest0027L(); break;
       
   288     	case  28: StartTest0028L(); break;
       
   289     	case  29: StartTest0029L(); break;
       
   290     	case  30: StartTest0030L(); break;
       
   291     	case  31: StartTest0031L(); break;
       
   292     	case  32: StartTest0032L(); break;
       
   293     	case  33: StartTest0033L(); break;
       
   294     	case  34: StartTest0034L(); break;
       
   295     	case  35: StartTest0035L(); break;
       
   296     	case  36: StartTest0036L(); break;
       
   297     	case  37: StartTest0037L(); break;
       
   298     	case  38: StartTest0038L(); break;
       
   299     	case  39: StartTest0039L(); break;
       
   300     	case  40: StartTest0040L(); break;
       
   301     	case  41: StartTest0041L(); break;
       
   302     	case  42: StartTest0042L(); break;
       
   303     	case  43: StartTest0043L(); break;
       
   304     	case  44: StartTest0044L(); break;
       
   305     	case  45: StartTest0045L(); break;
       
   306     	case  46: StartTest0046L(); break;
       
   307     	case  47: StartTest0047L(); break;
       
   308     	case  48: StartTest0048L(); break;
       
   309     	case  49: StartTest0049L(); break;
       
   310     	case  50: StartTest0050L(); break;
       
   311     	case  51: StartTest0051L(); break;
       
   312     	case  52: StartTest0052L(); break;
       
   313     	case  53: StartTest0053L(); break;
       
   314     	case  54: StartTest0054L(); break;
       
   315     	case  55: StartTest0055L(); break;
       
   316     	case  56: StartTest0056L(); break;
       
   317     	case  57: StartTest0057L(); break;
       
   318     	case  58: StartTest0058L(); break;
       
   319     	case  59: StartTest0059L(); break;
       
   320     	case  60: StartTest0060L(); break;
       
   321     	case  61: StartTest0061L(); break;
       
   322     	case  62: StartTest0062L(); break;
       
   323     	case  63: StartTest0063L(); break;
       
   324     	case  64: StartTest0064L(); break;
       
   325     	case  65: StartTest0065L(); break;
       
   326     	case  66: StartTest0066L(); break;
       
   327     	case  67: StartTest0067L(); break;
       
   328     	case  68: StartTest0068L(); break;
       
   329     	case  69: StartTest0069L(); break;
       
   330     	case  70: StartTest0070L(); break;
       
   331     	case  71: StartTest0071L(); break;
       
   332     	case  72: StartTest0072L(); break;
       
   333     	case  73: StartTest0073L(); break;
       
   334     	case  74: StartTest0074L(); break;
       
   335     	case  75: StartTest0075L(); break;
       
   336     	case  76: StartTest0076L(); break;
       
   337     	case  77: StartTest0077L(); break;
       
   338     	case  78: StartTest0078L(); break;
       
   339     	case  79: StartTest0079L(); break;
       
   340     	case  80: StartTest0080L(); break;
       
   341     	case  81: StartTest0081L(); break;
       
   342     	case  82: StartTest0082L(); break;
       
   343     	case  83: StartTest0083L(); break;
       
   344     	case  84: StartTest0084L(); break;
       
   345     	case  85: StartTest0085L(); break;
       
   346     	case  86: StartTest0086L(); break;
       
   347     	case  87: StartTest0087L(); break;
       
   348     	case  88: StartTest0088L(); break;
       
   349     	case  89: StartTest0089L(); break;
       
   350     	case  90: StartTest0090L(); break;
       
   351     	case  91: StartTest0091L(); break;
       
   352     	case  92: StartTest0092L(); break;
       
   353     	case  93: StartTest0093L(); break;
       
   354     	case  94: StartTest0094L(); break;
       
   355     	case  95: StartTest0095L(); break;
       
   356     	case  96: StartTest0096L(); break;
       
   357     	case  97: StartTest0097L(); break;
       
   358     	case  98: StartTest0098L(); break;
       
   359     	case  99: StartTest0099L(); break;
       
   360     	case 100: StartTest0100L(); break;
       
   361     	case 101: StartTest0101L(); break;
       
   362     	case 102: StartTest0102L(); break;
       
   363     	case 103: StartTest0103L(); break;
       
   364     	case 104: StartTest0104L(); break;
       
   365     	case 105: StartTest0105L(); break;
       
   366     	case 106: StartTest0106L(); break;
       
   367     	case 107: StartTest0107L(); break;
       
   368     	case 108: StartTest0108L(); break;
       
   369     	case 109: StartTest0109L(); break;
       
   370     	case 110: StartTest0110L(); break;
       
   371     	case 111: StartTest0111L(); break;
       
   372     	case 112: StartTest0112L(); break;
       
   373     	case 113: StartTest0113L(); break;
       
   374     	case 114: StartTest0114L(); break;
       
   375     	case 115: StartTest0115L(); break;
       
   376     	case 116: StartTest0116L(); break;
       
   377     	case 117: StartTest0117L(); break;
       
   378     	case 118: StartTest0118L(); break;
       
   379     	case 119: StartTest0119L(); break;
       
   380     	case 120: StartTest0120L(); break;
       
   381     	case 121: StartTest0121L(); break;
       
   382     	case 122: StartTest0122L(); break;
       
   383     	case 123: StartTest0123L(); break;
       
   384     	case 124: StartTest0124L(); break;
       
   385     	case 125: StartTest0125L(); break;
       
   386     	case 126: StartTest0126L(); break;
       
   387     	case 127: StartTest0127L(); break;
       
   388     	case 128: StartTest0128L(); break;
       
   389     	case 129: StartTest0129L(); break;
       
   390     	case 130: StartTest0130L(); break;
       
   391     	case 131: StartTest0131L(); break;
       
   392     	case 132: StartTest0132L(); break;
       
   393     	case 133: StartTest0133L(); break;
       
   394     	case 134: StartTest0134L(); break;
       
   395     	case 135: StartTest0135L(); break;
       
   396     	case 136: StartTest0136L(); break;
       
   397     	case 137: StartTest0137L(); break;
       
   398     	case 138: StartTest0138L(); break;
       
   399     	case 139: StartTest0139L(); break;
       
   400     	case 140: StartTest0140L(); break;
       
   401     	case 141: StartTest0141L(); break;
       
   402     	case 142: StartTest0142L(); break;
       
   403     	case 143: StartTest0143L(); break;
       
   404     	case 144: StartTest0144L(); break;
       
   405     	case 145: StartTest0145L(); break;
       
   406     	case 146: StartTest0146L(); break;
       
   407     	case 147: StartTest0147L(); break;
       
   408     	case 148: StartTest0148L(); break;
       
   409     	case 149: StartTest0149L(); break;
       
   410     	case 150: StartTest0150L(); break;
       
   411     	case 151: StartTest0151L(); break;
       
   412     	case 152: StartTest0152L(); break;
       
   413     	case 153: StartTest0153L(); break;
       
   414     	case 154: StartTest0154L(); break;
       
   415     	case 155: StartTest0155L(); break;
       
   416     	case 156: StartTest0156L(); break;
       
   417     	case 157: StartTest0157L(); break;
       
   418     	case 158: StartTest0158L(); break;
       
   419     	case 159: StartTest0159L(); break;
       
   420     	case 160: StartTest0160L(); break;
       
   421     	case 161: StartTest0161L(); break;
       
   422     	case 162: StartTest0162L(); break;
       
   423     	case 163: StartTest0163L(); break;
       
   424     	case 164: StartTest0164L(); break;
       
   425     	case 165: StartTest0165L(); break;
       
   426     	case 166: StartTest0166L(); break;
       
   427     	case 167: StartTest0167L(); break;
       
   428     	case 168: StartTest0168L(); break;
       
   429     	case 169: StartTest0169L(); break;
       
   430     	case 170: StartTest0170L(); break;
       
   431     	case 171: StartTest0171L(); break;
       
   432     	case 172: StartTest0172L(); break;
       
   433     	case 173: StartTest0173L(); break;
       
   434     	case 174: StartTest0174L(); break;
       
   435     	case 175: StartTest0175L(); break;
       
   436     	case 176: StartTest0176L(); break;
       
   437     	case 177: StartTest0177L(); break;
       
   438     	case 178: StartTest0178L(); break;
       
   439     	case 179: StartTest0179L(); break;
       
   440     	case 180: StartTest0180L(); break;
       
   441     	case 181: StartTest0181L(); break;
       
   442     	case 182: StartTest0182L(); break;
       
   443     	case 183: StartTest0183L(); break;
       
   444     	case 184: StartTest0184L(); break;
       
   445     	case 185: StartTest0185L(); break;
       
   446     	case 186: StartTest0186L(); break;
       
   447     	case 187: StartTest0187L(); break;
       
   448     	case 188: StartTest0188L(); break;
       
   449     	case 189: StartTest0189L(); break;
       
   450     	case 190: StartTest0190L(); break;
       
   451     	case 191: StartTest0191L(); break;
       
   452     	case 192: StartTest0192L(); break;
       
   453     	case 193: StartTest0193L(); break;
       
   454     	case 194: StartTest0194L(); break;
       
   455     	case 195: StartTest0195L(); break;
       
   456     	case 196: StartTest0196L(); break;
       
   457     	case 197: StartTest0197L(); break;
       
   458     	case 198: StartTest0198L(); break;
       
   459     	case 199: StartTest0199L(); break;
       
   460     	case 200: StartTest0200L(); break;
       
   461     	case 201: StartTest0201L(); break;
       
   462     	case 202: StartTest0202L(); break;
       
   463     	}
       
   464     }
       
   465 		
       
   466 TInt CCollectionTests::StartTest0001L()
       
   467     {
       
   468     // Initialization
       
   469     iLogger->Log( KTextApiNewL );
       
   470 
       
   471     iCollectionUtility1->Collection().OpenL();
       
   472     return 0;
       
   473     }
       
   474     
       
   475 TInt CCollectionTests::StartTest0002L()
       
   476     {
       
   477     // MMPXCollectionUtility::CollectionIDL not implemented
       
   478     iLogger->Log( KTextApiCollectionIDL );
       
   479     iLogger->Log( KTextNotImplemented );
       
   480     RunNext();
       
   481     return 0;
       
   482     }
       
   483 
       
   484 TInt CCollectionTests::StartTest0003L()
       
   485     {
       
   486     // MMPXCollectionUtility::CollectionIDL not implemented
       
   487     iLogger->Log( KTextApiCollectionIDL );
       
   488     iLogger->Log( KTextNotImplemented );
       
   489     RunNext();
       
   490     return 0;
       
   491     }
       
   492 
       
   493 TInt CCollectionTests::StartTest0004L()
       
   494     {
       
   495     // MMPXCollectionUtility::CollectionIDL not implemented
       
   496     iLogger->Log( KTextApiCollectionIDL );
       
   497     iLogger->Log( KTextNotImplemented );
       
   498     RunNext();
       
   499     return 0;
       
   500     }
       
   501 
       
   502 TInt CCollectionTests::StartTest0005L()
       
   503     {
       
   504     // MMPXCollectionUtility::CollectionIDL not implemented
       
   505     iLogger->Log( KTextApiCollectionIDL );
       
   506     RunNext();
       
   507     return 0;
       
   508     }
       
   509 
       
   510 TInt CCollectionTests::StartTest0006L()
       
   511     {
       
   512     // MMPXCollectionUtility::CollectionIDL not implemented
       
   513     iLogger->Log( KTextApiCollectionIDL );
       
   514     iLogger->Log( KTextNotImplemented );
       
   515     RunNext();
       
   516     return 0;
       
   517     }
       
   518 
       
   519 TInt CCollectionTests::StartTest0007L()
       
   520     {
       
   521     // MMPXCollectionUtility::CollectionIDL not implemented
       
   522     iLogger->Log( KTextApiCollectionIDL );
       
   523     RunNext();
       
   524     return 0;
       
   525     }
       
   526 
       
   527 TInt CCollectionTests::StartTest0008L()
       
   528     {
       
   529     // MMPXCollectionUtility::CollectionIDL not implemented
       
   530     iLogger->Log( KTextApiCollectionIDL );
       
   531     iLogger->Log( KTextNotImplemented );
       
   532     RunNext();
       
   533     return 0;
       
   534     }
       
   535 
       
   536 TInt CCollectionTests::StartTest0009L()
       
   537     {
       
   538     // MMPXCollection::OpenL
       
   539     iLogger->Log( KTextApiOpenL );
       
   540     iLogger->Log( KTextUninstallPlugin );
       
   541     RunNext();
       
   542     return 0;
       
   543     }
       
   544     
       
   545 TInt CCollectionTests::StartTest0010L()
       
   546     {
       
   547     // MMPXCollection::OpenL
       
   548     iLogger->Log( KTextApiOpenL );
       
   549     iLogger->Log( KTextUninstallPlugin );
       
   550     RunNext();
       
   551     return 0;
       
   552     }
       
   553 
       
   554 TInt CCollectionTests::StartTest0011L()
       
   555     {
       
   556     iLogger->Log( KTextApiOpenL );
       
   557     Collection2_InitializeAndOpenL( EMPXOpenDefault );
       
   558     return 0;
       
   559     }
       
   560 
       
   561 TInt CCollectionTests::StartTest0012L()
       
   562     {
       
   563     // Included in Test0011
       
   564     RunNext();
       
   565     return 0;
       
   566     }
       
   567     
       
   568 TInt CCollectionTests::StartTest0013L()
       
   569     {
       
   570     iLogger->Log( KTextApiOpenL );
       
   571     Collection2_InitializeAndOpenL( EMPXOpenGroupOrPlaylist );
       
   572     return 0;
       
   573     }
       
   574     
       
   575 TInt CCollectionTests::StartTest0014L()
       
   576     {
       
   577     // Included in Test0013
       
   578     RunNext();
       
   579     return 0;
       
   580     }
       
   581     
       
   582 TInt CCollectionTests::StartTest0015L()
       
   583     {
       
   584     iLogger->Log( KTextApiOpenL );
       
   585     Collection2_InitializeAndOpenL( EMPXOpenAllItems );
       
   586     return 0;
       
   587     }
       
   588     
       
   589 TInt CCollectionTests::StartTest0016L()
       
   590     {
       
   591     // Included in Test0015
       
   592     RunNext();
       
   593     return 0;
       
   594     }
       
   595     
       
   596 TInt CCollectionTests::StartTest0017L()
       
   597     {
       
   598     iLogger->Log( KTextApiOpenL );
       
   599     Collection2_InitializeAndOpenL( EMPXOpenNoPlaylist );
       
   600     return 0;
       
   601     }
       
   602     
       
   603 TInt CCollectionTests::StartTest0018L()
       
   604     {
       
   605     // Included in Test0017
       
   606     RunNext();
       
   607     return 0;
       
   608     }
       
   609     
       
   610 TInt CCollectionTests::StartTest0019L()
       
   611     {
       
   612     iLogger->Log( KTextApiOpenL );
       
   613     Collection2_InitializeAndOpenL( EMPXOpenPlaylistOnly );
       
   614     return 0;
       
   615     }
       
   616     
       
   617 TInt CCollectionTests::StartTest0020L()
       
   618     {    
       
   619     // Included in Test0019
       
   620     //RunNext();
       
   621     
       
   622     // copy case 19 here
       
   623     iLogger->Log( KTextApiOpenL );
       
   624     Collection2_InitializeAndOpenL( EMPXOpenPlaylistOnly );
       
   625     
       
   626     // Cleanup up iCollectionUtility2
       
   627     DELETE_COLLECTION_PTR(iCollectionUtility2);
       
   628 
       
   629     return 0;
       
   630     }
       
   631 
       
   632 TInt CCollectionTests::StartTest0021L()
       
   633     {
       
   634     iLogger->Log( KTextApiOpenL );
       
   635     
       
   636     
       
   637     iCollectionUtility1->Collection().OpenL( EMPXOpenDefault);
       
   638     return 0;
       
   639     }
       
   640 
       
   641 TInt CCollectionTests::StartTest0022L()
       
   642     {
       
   643     iLogger->Log( KTextApiOpenL );
       
   644     iCollectionUtility1->Collection().OpenL(KColTestPluginIndex, EMPXOpenDefault);
       
   645     return 0;
       
   646     }
       
   647 
       
   648 TInt CCollectionTests::StartTest0023L()
       
   649     {
       
   650     iLogger->Log( KTextApiOpenL );
       
   651     iCollectionUtility1->Collection().OpenL( EMPXOpenDefault );
       
   652     return 0;
       
   653     }
       
   654 
       
   655 TInt CCollectionTests::StartTest0024L()
       
   656     {
       
   657     iLogger->Log( KTextApiOpenL );
       
   658     // No HandleMessage should be received, since No Path and No Collection plugin changed
       
   659     iCollectionUtility1->Collection().OpenL( EMPXOpenGroupOrPlaylist );
       
   660     return 0;
       
   661     }
       
   662 
       
   663 TInt CCollectionTests::StartTest0025L()
       
   664     {
       
   665     iLogger->Log( KTextApiOpenL );
       
   666     // No HandleMessage should be received, since No Path and No Collection plugin changed
       
   667     iCollectionUtility1->Collection().OpenL( EMPXOpenAllItems );
       
   668     return 0;
       
   669     }
       
   670     
       
   671 TInt CCollectionTests::StartTest0026L()
       
   672     {
       
   673     iLogger->Log( KTextApiOpenL );
       
   674     // No HandleMessage should be received, since No Path and No Collection plugin changed
       
   675     iCollectionUtility1->Collection().OpenL( EMPXOpenNoPlaylist );
       
   676     return 0;
       
   677     }
       
   678 
       
   679 TInt CCollectionTests::StartTest0027L()
       
   680     {
       
   681     iLogger->Log( KTextApiOpenL );
       
   682     // No HandleMessage should be received, since No Path and No Collection plugin changed
       
   683     // TODO: SINCE TMPXOpenMode IS DECPRECATED, REMOVED THESE TEST SOONER OR LATER
       
   684     iCollectionUtility1->Collection().OpenL( EMPXOpenPlaylistOnly );
       
   685     return 0;
       
   686     }
       
   687 
       
   688 TInt CCollectionTests::StartTest0028L()
       
   689     {
       
   690     iLogger->Log( KTextApiOpenL );
       
   691     // No HandleMessage should be received, since No Path and No Collection plugin changed
       
   692     iCollectionUtility1->Collection().OpenL( EMPXOpenDefault );
       
   693     return 0;
       
   694     }
       
   695 
       
   696 TInt CCollectionTests::StartTest0029L()
       
   697     {
       
   698     iLogger->Log( KTextApiOpenL );
       
   699     // Open first entry in CollectionTestPlugin root menu
       
   700     iCollectionUtility1->Collection().OpenL(0, EMPXOpenDefault);
       
   701     return 0;
       
   702     }
       
   703 
       
   704 TInt CCollectionTests::StartTest0030L()
       
   705     {
       
   706     iLogger->Log( KTextApiOpenL );
       
   707     // Open the CollectionTestPlugin root menu through path
       
   708     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
   709     CleanupStack::PushL( path );
       
   710     path->AppendL( KCollectionTestPluginImpId );
       
   711     RArray<TMPXAttribute> attrs;
       
   712     CleanupClosePushL( attrs );
       
   713     attrs.Append( KMPXMediaGeneralId ); //TODO: NOTE: attribute is not selected through path
       
   714     path->Set( attrs.Array() );
       
   715     
       
   716     iCollectionUtility1->Collection().OpenL(*path, EMPXOpenDefault);
       
   717     CleanupStack::PopAndDestroy(2, path);   // attrs, path
       
   718     return 0;
       
   719     }
       
   720 
       
   721 TInt CCollectionTests::StartTest0031L()
       
   722     {
       
   723     iLogger->Log( KTextApiOpenL );
       
   724     iCollectionUtility1->Collection().OpenL( EMPXOpenDefault );
       
   725     return 0;
       
   726     }
       
   727 
       
   728 TInt CCollectionTests::StartTest0032L()
       
   729     {
       
   730     iLogger->Log( KTextApiOpenL );
       
   731     // Open second entry in CollectionTestPlugin root menu
       
   732     RArray<TMPXAttribute> attrs;
       
   733     CleanupClosePushL( attrs );
       
   734     attrs.Append( KMPXMediaGeneralId );
       
   735     attrs.Append( KMPXMediaGeneralUri );
       
   736     
       
   737     iCollectionUtility1->Collection().OpenL(1, attrs.Array(), EMPXOpenDefault);
       
   738     CleanupStack::PopAndDestroy( &attrs );   // attrs
       
   739     return 0;
       
   740     }
       
   741 
       
   742 TInt CCollectionTests::StartTest0033L()
       
   743     {
       
   744     iLogger->Log( KTextApiOpenL );
       
   745     iCollectionUtility1->Collection().OpenL( EMPXOpenDefault );
       
   746     return 0;
       
   747     }
       
   748 
       
   749 TInt CCollectionTests::StartTest0034L()
       
   750     {
       
   751     iLogger->Log( KTextApiOpenL );
       
   752     // Open the CollectionTestPlugin container level13 through path
       
   753     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
   754     CleanupStack::PushL( path );
       
   755     path->AppendL( KCollectionTestPluginImpId );
       
   756     path->AppendL( 13 );
       
   757     
       
   758     RArray<TMPXAttribute> attrs;
       
   759     CleanupClosePushL( attrs );
       
   760     attrs.Append( KMPXMediaGeneralId );
       
   761     attrs.Append( KMPXMediaGeneralUri );
       
   762     
       
   763     iCollectionUtility1->Collection().OpenL(*path, attrs.Array(), EMPXOpenDefault);
       
   764     CleanupStack::PopAndDestroy(2, path);   // attrs, path
       
   765     return 0;
       
   766     }
       
   767 
       
   768 TInt CCollectionTests::StartTest0035L()
       
   769     {
       
   770     iLogger->Log( KTextApiOpenL );
       
   771     iCollectionUtility1->Collection().OpenL( EMPXOpenDefault );
       
   772     return 0;
       
   773     }
       
   774 
       
   775 TInt CCollectionTests::StartTest0036L()
       
   776     {
       
   777     iLogger->Log( KTextApiOpenL );
       
   778     RArray<TUid> uidArray;
       
   779     CleanupClosePushL( uidArray );
       
   780     uidArray.Append( TUid::Uid( ECollectionTestPluginType ) );
       
   781     iCollectionUtility1->Collection().OpenL(uidArray.Array(), EMPXOpenDefault);
       
   782     CleanupStack::PopAndDestroy( &uidArray );
       
   783     return 0;
       
   784     }
       
   785 
       
   786 TInt CCollectionTests::StartTest0037L()
       
   787     {
       
   788     iLogger->Log( KTextApiOpenL );
       
   789     RArray<TUid> uidArray;
       
   790     CleanupClosePushL( uidArray );
       
   791     uidArray.Append( TUid::Uid( EMPXCollectionPluginMusic ) );
       
   792     uidArray.Append( TUid::Uid( EMPXCollectionPluginPodCast ) );
       
   793     iCollectionUtility1->Collection().OpenL(uidArray.Array(), EMPXOpenDefault);
       
   794     CleanupStack::PopAndDestroy( &uidArray );
       
   795     return 0;
       
   796     }
       
   797 
       
   798 TInt CCollectionTests::StartTest0038L()
       
   799     {
       
   800     iLogger->Log( KTextApiOpenL );
       
   801     iCollectionUtility1->Collection().OpenL( EMPXOpenDefault );
       
   802     return 0;
       
   803     }
       
   804 
       
   805 TInt CCollectionTests::StartTest0039L()
       
   806     {
       
   807     iLogger->Log( KTextApiOpenL );
       
   808     // No plugin Id should returned through HandleOpenL
       
   809     iCollectionUtility1->Collection().OpenL(TUid::Uid(EMPXCollectionPluginUnknown), EMPXOpenDefault);
       
   810     return 0;
       
   811     }
       
   812 
       
   813 TInt CCollectionTests::StartTest0040L()
       
   814     {
       
   815     iLogger->Log( KTextApiOpenL );
       
   816     iCollectionUtility1->Collection().OpenL(TUid::Uid( ECollectionTestPluginType ), EMPXOpenDefault);
       
   817     return 0;
       
   818     }
       
   819     
       
   820 TInt CCollectionTests::StartTest0041L()
       
   821     {
       
   822     iLogger->Log( KTextApiOpenL );
       
   823     iCollectionUtility1->Collection().OpenL( EMPXOpenDefault );
       
   824     return 0;
       
   825     }
       
   826 
       
   827 TInt CCollectionTests::StartTest0042L()
       
   828     {
       
   829     iLogger->Log( KTextApiSetFilterL );
       
   830     CMPXFilter* filter = CMPXFilter::NewL();
       
   831     CleanupStack::PushL( filter );
       
   832     
       
   833     TMPXAttribute titleAttr(KMPXMediaGeneralTitle);
       
   834     TMPXAttribute idAttr(KMPXMediaGeneralId);
       
   835     
       
   836     // Filter out Title="level211"
       
   837     filter->SetTextValueL(titleAttr, _L("level211"));
       
   838     // Filter out Id=213
       
   839     filter->SetTObjectValueL<TInt>(idAttr, 213);
       
   840     
       
   841     iCollectionUtility1->Collection().SetFilterL( filter );
       
   842     CleanupStack::PopAndDestroy( filter );
       
   843     RunNext();
       
   844     return 0;
       
   845     }
       
   846 
       
   847 TInt CCollectionTests::StartTest0043L()
       
   848     {
       
   849     iLogger->Log( KTextApiSetFilterL );
       
   850     // Open the CollectionTestPlugin container "level11"
       
   851     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
   852     CleanupStack::PushL( path );
       
   853     path->AppendL( KCollectionTestPluginImpId );
       
   854     path->AppendL( 11 );
       
   855     
       
   856     iCollectionUtility1->Collection().OpenL(*path, EMPXOpenDefault);
       
   857     CleanupStack::PopAndDestroy(path);   // path
       
   858     return 0;
       
   859     }
       
   860 
       
   861 TInt CCollectionTests::StartTest0044L()
       
   862     {
       
   863     iLogger->Log( KTextApiSetFilterL );
       
   864     iCollectionUtility1->Collection().OpenL( EMPXOpenDefault );
       
   865     return 0;
       
   866     }
       
   867 
       
   868 TInt CCollectionTests::StartTest0045L()
       
   869     {
       
   870     iLogger->Log( KTextApiSetFilterL );
       
   871     CMPXFilter* filter = iCollectionUtility1->Collection().FilterL();
       
   872     CleanupStack::PushL( filter );
       
   873     TMC_ASSERT((filter != NULL), 1);
       
   874     
       
   875     TMPXAttribute titleAttr(KMPXMediaGeneralTitle);
       
   876     TMPXAttribute idAttr(KMPXMediaGeneralId);
       
   877     TMC_ASSERT(filter->IsSupported(titleAttr) && filter->IsSupported(titleAttr), 2);
       
   878     
       
   879     TInt filterId = *filter->Value<TInt>( idAttr );
       
   880     TMC_ASSERT(filterId == 213, 3);
       
   881     
       
   882     const TDesC& filterTitle = filter->ValueText( titleAttr );
       
   883     TMC_ASSERT(filterTitle == _L("level211"), 4);
       
   884     
       
   885     CleanupStack::PopAndDestroy( filter );
       
   886     RunNext();
       
   887     return 0;
       
   888     }
       
   889 
       
   890 TInt CCollectionTests::StartTest0046L()
       
   891     {
       
   892     iLogger->Log( KTextApiSetFilterL );
       
   893     CMPXFilter* filter = CMPXFilter::NewL();
       
   894     CleanupStack::PushL( filter );
       
   895     
       
   896     TMPXAttribute uriAttr(KMPXMediaGeneralUri);
       
   897     // Filter out Uri="\song3311.ts"
       
   898     filter->SetTextValueL(uriAttr, _L("\\song3311.ts"));
       
   899     iCollectionUtility1->Collection().SetFilterL( filter );
       
   900     CleanupStack::PopAndDestroy( filter );
       
   901     RunNext();
       
   902     return 0;
       
   903     }
       
   904 TInt CCollectionTests::StartTest0047L()
       
   905     {
       
   906     iLogger->Log( KTextApiSetFilterL );
       
   907     // Open the CollectionTestPlugin container "level231"
       
   908     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
   909     CleanupStack::PushL( path );
       
   910     path->AppendL( KCollectionTestPluginImpId );
       
   911     path->AppendL( 13 );
       
   912     path->AppendL( 231 );
       
   913     
       
   914     iCollectionUtility1->Collection().OpenL(*path, EMPXOpenDefault);
       
   915     CleanupStack::PopAndDestroy(path);   // path
       
   916     return 0;
       
   917     }
       
   918 
       
   919 TInt CCollectionTests::StartTest0048L()
       
   920     {
       
   921     iLogger->Log( KTextApiSetFilterL );
       
   922     iCollectionUtility1->Collection().OpenL( EMPXOpenDefault );
       
   923     return 0;
       
   924     }
       
   925 
       
   926 TInt CCollectionTests::StartTest0049L()
       
   927     {
       
   928     iLogger->Log( KTextApiSetFilterL );
       
   929     CMPXFilter* filter = iCollectionUtility1->Collection().FilterL();
       
   930     CleanupStack::PushL( filter );
       
   931     TMC_ASSERT(filter != NULL, 1);
       
   932     
       
   933     TMPXAttribute uriAttr(KMPXMediaGeneralUri);
       
   934     TMC_ASSERT(filter->IsSupported(uriAttr), 2);
       
   935     
       
   936     const TDesC& filterUri = filter->ValueText( uriAttr );
       
   937     TMC_ASSERT(filterUri == _L("\\song3311.ts"), 3);
       
   938     
       
   939     CleanupStack::PopAndDestroy( filter );
       
   940     RunNext();
       
   941     return 0;
       
   942     }
       
   943     
       
   944 TInt CCollectionTests::StartTest0050L()
       
   945     {
       
   946     iLogger->Log( KTextApiSetFilterL );
       
   947     iCollectionUtility1->Collection().SetFilterL( NULL );
       
   948     CMPXFilter* filter = iCollectionUtility1->Collection().FilterL();
       
   949     TMC_ASSERT(filter == NULL, 1);
       
   950     
       
   951     RunNext();
       
   952     return 0;
       
   953     }
       
   954     
       
   955 TInt CCollectionTests::StartTest0051L()
       
   956     {
       
   957     iLogger->Log( KTextApiSetFilterL );
       
   958     // Open the CollectionTestPlugin container level11 through path
       
   959     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
   960     CleanupStack::PushL( path );
       
   961     path->AppendL( KCollectionTestPluginImpId );
       
   962     path->AppendL( 11 );
       
   963     
       
   964     iCollectionUtility1->Collection().OpenL(*path, EMPXOpenDefault);
       
   965     CleanupStack::PopAndDestroy( path);   // path
       
   966     return 0;
       
   967     }
       
   968 
       
   969 TInt CCollectionTests::StartTest0052L()
       
   970     {
       
   971     iLogger->Log( KTextApiSetFilterL );
       
   972     iCollectionUtility1->Collection().OpenL( EMPXOpenDefault );
       
   973     return 0;
       
   974     }
       
   975     
       
   976 TInt CCollectionTests::StartTest0053L()
       
   977     {
       
   978     iLogger->Log( KTextApiUidL );
       
   979     TUid pluginUid;
       
   980     TRAPD(err, pluginUid = iCollectionUtility1->Collection().UidL() );
       
   981     TMC_ASSERT(err == KErrNone, 1);
       
   982     TMC_ASSERT(pluginUid == TUid::Uid(KCollectionTestPluginImpId), 2);
       
   983     
       
   984     RunNext();
       
   985     return 0;
       
   986     }
       
   987 
       
   988 TInt CCollectionTests::StartTest0054L()
       
   989     {
       
   990     iLogger->Log( KTextApiUidL );
       
   991     
       
   992     // Close all the collection utility API
       
   993     DELETE_COLLECTION_PTR(iCollectionUtility1);
       
   994     
       
   995     iCollectionUtility1 = MMPXCollectionUtility::NewL(this, KMcModeDefault);
       
   996     TUid pluginUid;
       
   997     TRAPD(err, pluginUid = iCollectionUtility1->Collection().UidL() );
       
   998     TMC_ASSERT(err == KErrNone, 1);
       
   999     TMC_ASSERT(pluginUid == KNullUid, 1);
       
  1000     
       
  1001     RunNext();
       
  1002     return 0;
       
  1003     }
       
  1004 
       
  1005 TInt CCollectionTests::StartTest0055L()
       
  1006     {
       
  1007     iLogger->Log( KTextApiPathL );
       
  1008     
       
  1009     CMPXCollectionPath* path = iCollectionUtility1->Collection().PathL();
       
  1010     CleanupStack::PushL( path );
       
  1011     TMC_ASSERT(path->Levels() == 0, 1);
       
  1012     CleanupStack::PopAndDestroy( path );
       
  1013     RunNext();
       
  1014     return 0;
       
  1015     }
       
  1016 
       
  1017 TInt CCollectionTests::StartTest0056L()
       
  1018     {
       
  1019     iLogger->Log( KTextApiPathL );
       
  1020     iCollectionUtility1->Collection().OpenL( EMPXOpenDefault );
       
  1021     return 0;
       
  1022     }    
       
  1023 
       
  1024 TInt CCollectionTests::StartTest0057L()
       
  1025     {
       
  1026     iLogger->Log( KTextApiPathL );
       
  1027     iCollectionUtility1->Collection().OpenL(KColTestPluginIndex, EMPXOpenDefault);
       
  1028     return 0;
       
  1029     }    
       
  1030 
       
  1031 TInt CCollectionTests::StartTest0058L()
       
  1032     {
       
  1033     iLogger->Log( KTextApiPathL );
       
  1034     iCollectionUtility1->Collection().OpenL(2, EMPXOpenDefault);
       
  1035     return 0;
       
  1036     }    
       
  1037 
       
  1038 TInt CCollectionTests::StartTest0059L()
       
  1039     {        
       
  1040     iLogger->Log( KTextApiBackL );
       
  1041     iCollectionUtility1->Collection().BackL();
       
  1042     return 0;
       
  1043     }
       
  1044 
       
  1045 TInt CCollectionTests::StartTest0060L()
       
  1046     {
       
  1047     iLogger->Log( KTextApiBackL );
       
  1048     iCollectionUtility1->Collection().BackL();
       
  1049     return 0;
       
  1050     }
       
  1051 
       
  1052 TInt CCollectionTests::StartTest0061L()
       
  1053     {
       
  1054     // MMPXCollectionUtility::IsRemote not implemented
       
  1055     iLogger->Log( KTextApiIsRemote );
       
  1056     iLogger->Log( KTextNotImplemented );
       
  1057     RunNext();
       
  1058     return 0;
       
  1059     }
       
  1060 
       
  1061 TInt CCollectionTests::StartTest0062L()
       
  1062     {
       
  1063     iLogger->Log( KTextApiCancelRequest );
       
  1064     iLogger->Log( _L("Cancel Request can be called through UI \"Stop\" key") );
       
  1065     RunNext();
       
  1066     return 0;
       
  1067     }
       
  1068 
       
  1069 TInt CCollectionTests::StartTest0063L()
       
  1070     {
       
  1071     // MMPXCollection::AddL
       
  1072     iLogger->Log( KTextApiAddL );
       
  1073     iLogger->Log( KTextUninstallPlugin );
       
  1074     RunNext();
       
  1075     return 0;
       
  1076     }
       
  1077     
       
  1078 TInt CCollectionTests::StartTest0064L()
       
  1079     {
       
  1080     RunNext();
       
  1081     return 0;
       
  1082     }
       
  1083 
       
  1084 TInt CCollectionTests::StartTest0065L()
       
  1085     {
       
  1086     RunNext();
       
  1087     return 0;
       
  1088     }
       
  1089 
       
  1090 TInt CCollectionTests::StartTest0066L()
       
  1091     {
       
  1092     RunNext();
       
  1093     return 0;
       
  1094     }
       
  1095     
       
  1096 TInt CCollectionTests::StartTest0067L()
       
  1097     {
       
  1098     RunNext();
       
  1099     return 0;
       
  1100     }
       
  1101 
       
  1102 TInt CCollectionTests::StartTest0068L()
       
  1103     {
       
  1104     RunNext();
       
  1105     return 0;
       
  1106     }
       
  1107 
       
  1108 TInt CCollectionTests::StartTest0069L()
       
  1109     {
       
  1110     RunNext();
       
  1111     return 0;
       
  1112     }
       
  1113     
       
  1114 TInt CCollectionTests::StartTest0070L()
       
  1115     {
       
  1116     /*
       
  1117     // MMPXCollection::AddL
       
  1118     iLogger->Log( KTextApiAddL );
       
  1119     CMPXMedia* media = CMPXMedia::NewL();
       
  1120     CleanupStack::PushL( media );
       
  1121     
       
  1122     TRAPD(err, iCollectionUtility1->Collection().AddL(*media) );
       
  1123     // Adding empty media
       
  1124     TMC_ASSERT(err == KErrArgument, 1);
       
  1125     
       
  1126     CleanupStack::PopAndDestroy( media );
       
  1127     */
       
  1128     RunNext(); // do not remove
       
  1129     return 0;
       
  1130     }
       
  1131 
       
  1132 TInt CCollectionTests::StartTest0071L()
       
  1133     {
       
  1134     /*
       
  1135     // MMPXCollection::AddL
       
  1136     iLogger->Log( KTextApiAddL );
       
  1137     CMPXMedia* media = CMPXMedia::NewL();
       
  1138     CleanupStack::PushL( media );
       
  1139     
       
  1140     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1141     // Adding an empty item
       
  1142     TRAPD(err, iCollectionUtility1->Collection().AddL(*media) );
       
  1143     TMC_ASSERT(err == KErrNotSupported, 1);
       
  1144     
       
  1145     CleanupStack::PopAndDestroy( media );
       
  1146     */
       
  1147     RunNext();
       
  1148     return 0;
       
  1149     }
       
  1150 
       
  1151 TInt CCollectionTests::StartTest0072L()
       
  1152     {
       
  1153     /*
       
  1154     // MMPXCollection::AddL
       
  1155     iLogger->Log( KTextApiAddL );
       
  1156     CMPXMedia* media = CMPXMedia::NewL();
       
  1157     CleanupStack::PushL( media );
       
  1158     
       
  1159     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1160     media->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, KNullUid);
       
  1161     // Adding with NULL collection Id
       
  1162     TRAPD(err, iCollectionUtility1->Collection().AddL(*media) );
       
  1163     TMC_ASSERT(err == KErrNotSupported, 1);
       
  1164     
       
  1165     CleanupStack::PopAndDestroy( media );
       
  1166     */
       
  1167     RunNext();
       
  1168     return 0;
       
  1169     }
       
  1170 
       
  1171 TInt CCollectionTests::StartTest0073L()
       
  1172     {
       
  1173     /*
       
  1174     // MMPXCollection::AddL
       
  1175     iLogger->Log( KTextApiAddL );
       
  1176     CMPXMedia* media = CMPXMedia::NewL();
       
  1177     CleanupStack::PushL( media );
       
  1178     
       
  1179     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1180     media->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(0x12345678)); // arbitary Uid
       
  1181     // Adding with non-supported collection Id
       
  1182     TRAPD(err, iCollectionUtility1->Collection().AddL(*media) );
       
  1183     TMC_ASSERT(err == KErrNotSupported, 1);
       
  1184     
       
  1185     CleanupStack::PopAndDestroy( media );
       
  1186     */
       
  1187     RunNext();
       
  1188     return 0;
       
  1189     }
       
  1190 
       
  1191 TInt CCollectionTests::StartTest0074L()
       
  1192     {
       
  1193     /*
       
  1194     // MMPXCollection::AddL
       
  1195     iLogger->Log( KTextApiAddL );
       
  1196     CMPXMedia* media = CMPXMedia::NewL();
       
  1197     CleanupStack::PushL( media );
       
  1198     
       
  1199     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1200     media->SetTextValueL(KMPXMediaGeneralUri, KNullDesC);
       
  1201     // Adding with NULL Uri
       
  1202     TRAPD(err, iCollectionUtility1->Collection().AddL(*media) );
       
  1203     TMC_ASSERT(err == KErrArgument, 1);
       
  1204     
       
  1205     CleanupStack::PopAndDestroy( media );
       
  1206     */
       
  1207     RunNext();
       
  1208     return 0;
       
  1209     }
       
  1210 
       
  1211 TInt CCollectionTests::StartTest0075L()
       
  1212     {
       
  1213     // MMPXCollection::AddL
       
  1214     iLogger->Log( KTextApiAddL );
       
  1215     
       
  1216     /*
       
  1217     CMPXMedia* media = CMPXMedia::NewL();
       
  1218     CleanupStack::PushL( media );
       
  1219     // Adding with uri with non-suported extension
       
  1220     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1221     media->SetTextValueL(KMPXMediaGeneralUri, _L("c:\\song.abc"));    // unsupported extension
       
  1222     
       
  1223     TRAPD(err, iCollectionUtility1->Collection().AddL(*media) );
       
  1224 
       
  1225     TMC_ASSERT(err == KErrArgument, 1);
       
  1226     
       
  1227     CleanupStack::PopAndDestroy( media );
       
  1228     RunNext();
       
  1229     */
       
  1230     
       
  1231     //TODO: Collection framework won't check the Uri extension and select right plugin
       
  1232     //      Therefore, this test case doesn't make any sense until above feature has been implemented
       
  1233     iLogger->Log( _L("TODO: feature not implemented.  Test case skipped") );
       
  1234     RunNext();
       
  1235     return 0;
       
  1236     }
       
  1237 
       
  1238 TInt CCollectionTests::StartTest0076L()
       
  1239     {
       
  1240     // MMPXCollection::AddL
       
  1241     iLogger->Log( KTextApiAddL );
       
  1242 
       
  1243 	/*
       
  1244     CMPXMedia* media = CMPXMedia::NewL();
       
  1245     CleanupStack::PushL( media );
       
  1246     
       
  1247     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup);
       
  1248     // Adding an empty group item
       
  1249     iLogger->Log( KTextPanicExpected );
       
  1250 
       
  1251     // TODO: panic will raised
       
  1252     //TRAPD(err, iCollectionUtility1->Collection().AddL(*media) );
       
  1253     //TMC_ASSERT(err == KErrNotSupported, 1);
       
  1254     TMC_ASSERT(EFalse, 1);  // mark it as failing
       
  1255     
       
  1256     CleanupStack::PopAndDestroy( media );
       
  1257     */
       
  1258     
       
  1259     RunNext();
       
  1260     return 0;
       
  1261     }
       
  1262 
       
  1263 TInt CCollectionTests::StartTest0077L()
       
  1264     {
       
  1265     // MMPXCollection::AddL
       
  1266     iLogger->Log( KTextApiAddL );
       
  1267     CMPXMedia* media = CMPXMedia::NewL();
       
  1268     CleanupStack::PushL( media );
       
  1269     
       
  1270     CMPXMediaArray* array = CMPXMediaArray::NewL();
       
  1271     CleanupStack::PushL( array );
       
  1272     
       
  1273     // Add empty media
       
  1274     CMPXMedia* content = CMPXMedia::NewL();
       
  1275     CleanupStack::PushL( content );
       
  1276     content->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1277     array->AppendL( content );
       
  1278     CleanupStack::Pop( content );
       
  1279     
       
  1280     // Adding an array and set media to group
       
  1281     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup);
       
  1282     media->SetCObjectValueL(KMPXMediaArrayContents, array);
       
  1283     media->SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count() );
       
  1284             
       
  1285     TRAPD(err, iCollectionUtility1->Collection().AddL(*media) );
       
  1286     TMC_ASSERT(err == KErrNotSupported, 1);
       
  1287     
       
  1288     CleanupStack::PopAndDestroy(2, media);  // array, media
       
  1289     RunNext();
       
  1290     return 0;
       
  1291     }
       
  1292 
       
  1293 TInt CCollectionTests::StartTest0078L()
       
  1294     {
       
  1295     // MMPXCollection::AddL
       
  1296     iLogger->Log( KTextApiAddL );
       
  1297     CMPXMedia* media = CMPXMedia::NewL();
       
  1298     CleanupStack::PushL( media );
       
  1299     
       
  1300     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1301     media->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  1302     media->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0078"));
       
  1303     // Adding valid media
       
  1304     TRAPD(err, iCollectionUtility1->Collection().AddL(*media) );
       
  1305     TMC_ASSERT(err == KErrNone, 1);
       
  1306     
       
  1307     CleanupStack::PopAndDestroy( media );
       
  1308 
       
  1309     return 0;
       
  1310     }
       
  1311 
       
  1312 TInt CCollectionTests::StartTest0079L()
       
  1313     {
       
  1314     // MMPXCollection::AddL
       
  1315     iLogger->Log( KTextApiAddL );
       
  1316     CMPXMedia* media = CMPXMedia::NewL();
       
  1317     CleanupStack::PushL( media );
       
  1318     
       
  1319     CMPXMediaArray* array = CMPXMediaArray::NewL();
       
  1320     CleanupStack::PushL( array );
       
  1321     
       
  1322     // Add 1st media
       
  1323     CMPXMedia* content = CMPXMedia::NewL();
       
  1324     CleanupStack::PushL( content );
       
  1325     content->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1326     content->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  1327     content->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0079"));
       
  1328     array->AppendL( content );
       
  1329     CleanupStack::Pop( content );
       
  1330     // Add 2nd media
       
  1331     content = CMPXMedia::NewL();
       
  1332     CleanupStack::PushL( content );
       
  1333     content->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1334     content->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  1335     content->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0079"));
       
  1336     array->AppendL( content );
       
  1337     CleanupStack::Pop( content );
       
  1338     
       
  1339     // Adding an array and set media to group
       
  1340     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup);
       
  1341     media->SetCObjectValueL(KMPXMediaArrayContents, array);
       
  1342     media->SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count() );
       
  1343             
       
  1344     TRAPD(err, iCollectionUtility1->Collection().AddL(*media) );
       
  1345     TMC_ASSERT(err == KErrNone, 1);
       
  1346     
       
  1347     CleanupStack::PopAndDestroy(2, media);  // array, media
       
  1348     iTempCnt = 2;   // expecting 2 sets of callback
       
  1349 
       
  1350     return 0;
       
  1351     }
       
  1352 
       
  1353 TInt CCollectionTests::StartTest0080L()
       
  1354     {
       
  1355     // MMPXCollection::AddL
       
  1356     iLogger->Log( KTextApiAddL );
       
  1357     CMPXMedia* media = CMPXMedia::NewL();
       
  1358     CleanupStack::PushL( media );
       
  1359     
       
  1360     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1361     media->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  1362     media->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0080"));
       
  1363     // Adding valid media
       
  1364     TRAPD(err, iCollectionUtility1->Collection().AddL(*media) );
       
  1365     TMC_ASSERT(err == KErrNone, 1);
       
  1366     
       
  1367     CleanupStack::PopAndDestroy( media );
       
  1368 
       
  1369     return 0;
       
  1370     }
       
  1371 
       
  1372 TInt CCollectionTests::StartTest0081L()
       
  1373     {
       
  1374     // MMPXCollection::AddL
       
  1375     iLogger->Log( KTextApiAddL );
       
  1376     iLogger->Log( _L("Reuse part of Test0078") );
       
  1377     CMPXMedia* media = CMPXMedia::NewL();
       
  1378     CleanupStack::PushL( media );
       
  1379     
       
  1380     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1381     media->SetTextValueL(KMPXMediaGeneralUri, _L("\\song.ts"));
       
  1382     media->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0078"));
       
  1383     // Adding valid media
       
  1384     TRAPD(err, iCollectionUtility1->Collection().AddL(*media) );
       
  1385     TMC_ASSERT(err == KErrNone, 1);
       
  1386     
       
  1387     CleanupStack::PopAndDestroy( media );
       
  1388 
       
  1389     return 0;
       
  1390     }
       
  1391     
       
  1392 TInt CCollectionTests::StartTest0082L()
       
  1393     {
       
  1394     // MMPXCollection::RemoveL
       
  1395     iLogger->Log( KTextApiRemoveL );
       
  1396     iLogger->Log( KTextUninstallPlugin );
       
  1397     RunNext();
       
  1398     return 0;
       
  1399     }    
       
  1400     
       
  1401 TInt CCollectionTests::StartTest0083L()
       
  1402     {
       
  1403     // MMPXCollection::RemoveL
       
  1404     iLogger->Log( KTextApiRemoveL );
       
  1405     iLogger->Log( KTextUninstallPlugin );
       
  1406     RunNext();
       
  1407     return 0;
       
  1408     }
       
  1409     
       
  1410 TInt CCollectionTests::StartTest0084L()
       
  1411     {
       
  1412     // MMPXCollection::RemoveL
       
  1413     iLogger->Log( KTextApiRemoveL );
       
  1414           
       
  1415 	/*          
       
  1416     CMPXCollectionPath* path = iCollectionUtility1->Collection().PathL();
       
  1417     CleanupStack::PushL( path );
       
  1418     //TestUtility::LogCollectionPath(*path, iLogger);
       
  1419 
       
  1420     TMC_ASSERT(path->Levels() == 1, 1); // Assume currently browing plugins main view
       
  1421         
       
  1422     CMPXCollectionPath* removePath = CMPXCollectionPath::NewL();
       
  1423     CleanupStack::PushL( removePath );
       
  1424     TRAPD(err, iCollectionUtility1->Collection().RemoveL(*removePath, NULL));
       
  1425     CleanupStack::PopAndDestroy(2, path);   // removePath, path
       
  1426     // No callback expected
       
  1427     TMC_ASSERT(err == KErrArgument, 2);
       
  1428     */
       
  1429     
       
  1430     RunNext();
       
  1431     return 0;
       
  1432     }
       
  1433     
       
  1434 TInt CCollectionTests::StartTest0085L()
       
  1435     {
       
  1436     // MMPXCollection::RemoveL
       
  1437     iLogger->Log( KTextApiRemoveL );
       
  1438     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  1439     CleanupStack::PushL( path );
       
  1440     path->AppendL( KCollectionTestPluginImpId );
       
  1441     iCollectionUtility1->Collection().OpenL( *path );
       
  1442     CleanupStack::PopAndDestroy( path );
       
  1443     return 0;
       
  1444     }
       
  1445     
       
  1446 TInt CCollectionTests::StartTest0086L()
       
  1447     {
       
  1448     // MMPXCollection::RemoveL
       
  1449     iLogger->Log( KTextApiRemoveL );
       
  1450     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  1451     CleanupStack::PushL( path );    // empty path
       
  1452     TRAPD(err, iCollectionUtility1->Collection().RemoveL( *path ));
       
  1453     CleanupStack::PopAndDestroy( path );
       
  1454     TMC_ASSERT(err == KErrArgument, 1);
       
  1455     RunNext();
       
  1456     return 0;
       
  1457     }
       
  1458 
       
  1459 TInt CCollectionTests::StartTest0087L()
       
  1460     {
       
  1461     // MMPXCollection::RemoveL
       
  1462     iLogger->Log( KTextApiRemoveL );
       
  1463     
       
  1464     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  1465     CleanupStack::PushL( path );    // empty path
       
  1466     TRAPD(err, iCollectionUtility1->Collection().RemoveL(*path, this));
       
  1467     CleanupStack::PopAndDestroy( path );
       
  1468     TMC_ASSERT(err == KErrArgument, 1);
       
  1469     RunNext();
       
  1470     return 0;
       
  1471     }
       
  1472 
       
  1473 TInt CCollectionTests::StartTest0088L()
       
  1474     {
       
  1475     // MMPXCollection::RemoveL
       
  1476     iLogger->Log( KTextApiRemoveL );
       
  1477     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  1478     CleanupStack::PushL( path );
       
  1479     path->AppendL( KCollectionTestPluginImpId );
       
  1480     path->AppendL( 11 );
       
  1481     path->AppendL( 211 );
       
  1482     path->AppendL( 3111 );  // for testing purpose, not actually deleting
       
  1483     iCollectionUtility1->Collection().RemoveL(*path, this);
       
  1484     CleanupStack::PopAndDestroy( path );
       
  1485     return 0;
       
  1486     }
       
  1487 
       
  1488 TInt CCollectionTests::StartTest0089L()
       
  1489     {
       
  1490     // MMPXCollection::RemoveL
       
  1491     iLogger->Log( KTextApiRemoveL );
       
  1492     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  1493     CleanupStack::PushL( path );
       
  1494     path->AppendL( KCollectionTestPluginImpId );
       
  1495     path->AppendL( 11 );
       
  1496     path->AppendL( 211 );
       
  1497     path->AppendL( 3111 );  // for testing purpose, not actually deleting
       
  1498     iCollectionUtility1->Collection().RemoveL(*path, NULL);
       
  1499     CleanupStack::PopAndDestroy( path );
       
  1500     RunNext();  // No callback expected
       
  1501     return 0;
       
  1502     }
       
  1503 
       
  1504 TInt CCollectionTests::StartTest0090L()
       
  1505     {
       
  1506     // MMPXCollection::RemoveL
       
  1507     iLogger->Log( KTextApiRemoveL );
       
  1508     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  1509     CleanupStack::PushL( path );
       
  1510     path->AppendL( KCollectionTestPluginImpId );
       
  1511     path->AppendL( 11 );
       
  1512     path->AppendL( 212 );   // for testing purpose, not actually deleting
       
  1513     iCollectionUtility1->Collection().RemoveL(*path, this);
       
  1514     CleanupStack::PopAndDestroy( path );
       
  1515     return 0;
       
  1516     }
       
  1517 
       
  1518 TInt CCollectionTests::StartTest0091L()
       
  1519     {
       
  1520     // MMPXCollection::RemoveL
       
  1521     iLogger->Log( KTextApiRemoveL );
       
  1522     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  1523     CleanupStack::PushL( path );
       
  1524     path->AppendL( KCollectionTestPluginImpId );
       
  1525     path->AppendL( 14 );    // for testing purpose, not actually deleting
       
  1526     iCollectionUtility1->Collection().RemoveL(*path, this);
       
  1527     CleanupStack::PopAndDestroy( path );
       
  1528     return 0;
       
  1529     }
       
  1530 
       
  1531 TInt CCollectionTests::StartTest0092L()
       
  1532     {
       
  1533     // MMPXCollection::RemoveL
       
  1534     iLogger->Log( KTextApiRemoveL );
       
  1535     iLogger->Log( KTextUninstallPlugin );
       
  1536     RunNext();
       
  1537     return 0;
       
  1538     }        
       
  1539     
       
  1540 TInt CCollectionTests::StartTest0093L()
       
  1541     {
       
  1542     // MMPXCollection::RemoveL
       
  1543     iLogger->Log( KTextApiRemoveL );
       
  1544     iLogger->Log( KTextUninstallPlugin );
       
  1545     RunNext();
       
  1546     return 0;
       
  1547     }        
       
  1548 
       
  1549 TInt CCollectionTests::StartTest0094L()
       
  1550     {
       
  1551     // MMPXCollection::RemoveL
       
  1552     iLogger->Log( KTextApiRemoveL );
       
  1553     iLogger->Log( KTextUninstallPlugin );
       
  1554     RunNext();
       
  1555     return 0;
       
  1556     }        
       
  1557 
       
  1558 TInt CCollectionTests::StartTest0095L()
       
  1559     {
       
  1560     // MMPXCollection::RemoveL
       
  1561     iLogger->Log( KTextApiRemoveL );
       
  1562     iLogger->Log( KTextUninstallPlugin );
       
  1563     RunNext();
       
  1564     return 0;
       
  1565     }        
       
  1566 
       
  1567 TInt CCollectionTests::StartTest0096L()
       
  1568     {
       
  1569     // MMPXCollection::RemoveL
       
  1570     iLogger->Log( KTextApiRemoveL );
       
  1571     iLogger->Log( KTextUninstallPlugin );
       
  1572     RunNext();
       
  1573     return 0;
       
  1574     }        
       
  1575 
       
  1576 TInt CCollectionTests::StartTest0097L()
       
  1577     {
       
  1578     // MMPXCollection::RemoveL
       
  1579     iLogger->Log( KTextApiRemoveL );
       
  1580     iLogger->Log( KTextUninstallPlugin );
       
  1581     RunNext();
       
  1582     return 0;
       
  1583     }        
       
  1584 
       
  1585 TInt CCollectionTests::StartTest0098L()
       
  1586     {
       
  1587     // MMPXCollection::RemoveL
       
  1588     iLogger->Log( KTextApiRemoveL );
       
  1589     iLogger->Log( KTextUninstallPlugin );
       
  1590     RunNext();
       
  1591     return 0;
       
  1592     }        
       
  1593 
       
  1594 TInt CCollectionTests::StartTest0099L()
       
  1595     {
       
  1596     // MMPXCollection::RemoveL
       
  1597     iLogger->Log( KTextApiRemoveL );
       
  1598     
       
  1599     CMPXMedia* media = CMPXMedia::NewL();
       
  1600     CleanupStack::PushL( media );
       
  1601     
       
  1602     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1603     media->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  1604     media->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0099"));
       
  1605     // Adding valid media
       
  1606     TRAPD(err, iCollectionUtility1->Collection().RemoveL(*media) );
       
  1607     TMC_ASSERT(err == KErrNone, 1);
       
  1608     
       
  1609     CleanupStack::PopAndDestroy( media );
       
  1610 
       
  1611     return 0;
       
  1612     }
       
  1613 
       
  1614 TInt CCollectionTests::StartTest0100L()
       
  1615     {
       
  1616     /*
       
  1617     // MMPXCollection::RemoveL
       
  1618     iLogger->Log( KTextApiRemoveL );
       
  1619     
       
  1620     CMPXMedia* media = CMPXMedia::NewL();
       
  1621     CleanupStack::PushL( media );
       
  1622     
       
  1623     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1624     media->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  1625     media->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0100"));
       
  1626     // Adding valid media
       
  1627     TRAPD(err, iCollectionUtility1->Collection().RemoveL(*media) );
       
  1628     TMC_ASSERT(err == KErrNone, 1);
       
  1629     
       
  1630     CleanupStack::PopAndDestroy( media );
       
  1631     iTempCnt = 2;   // expecting receiving 2 HandleCollectionMessages
       
  1632     */
       
  1633     RunNext();
       
  1634     return 0;
       
  1635     }
       
  1636 
       
  1637 TInt CCollectionTests::StartTest0101L()
       
  1638     {
       
  1639     // MMPXCollection::SetSyncL
       
  1640     iLogger->Log( KTextApiSetSyncL );
       
  1641     iLogger->Log( KTextUninstallPlugin );
       
  1642     RunNext();
       
  1643     return 0;
       
  1644     }
       
  1645     
       
  1646 TInt CCollectionTests::StartTest0102L()
       
  1647     {
       
  1648     // MMPXCollection::SetSyncL
       
  1649     iLogger->Log( KTextApiSetSyncL );
       
  1650     iLogger->Log( KTextUninstallPlugin );
       
  1651     RunNext();
       
  1652     return 0;
       
  1653     }
       
  1654 
       
  1655 TInt CCollectionTests::StartTest0103L()
       
  1656     {
       
  1657     // MMPXCollection::SetSyncL
       
  1658     iLogger->Log( KTextApiSetSyncL );
       
  1659     iLogger->Log( KTextUninstallPlugin );
       
  1660     RunNext();
       
  1661     return 0;
       
  1662     }
       
  1663     
       
  1664 TInt CCollectionTests::StartTest0104L()
       
  1665     {
       
  1666     // MMPXCollection::SetSyncL
       
  1667     iLogger->Log( KTextApiSetSyncL );
       
  1668     iLogger->Log( KTextUninstallPlugin );
       
  1669     RunNext();
       
  1670     return 0;
       
  1671     }
       
  1672 
       
  1673 TInt CCollectionTests::StartTest0105L()
       
  1674     {
       
  1675     // MMPXCollection::SetSyncL
       
  1676     iLogger->Log( KTextApiSetSyncL );
       
  1677     iLogger->Log( KTextUninstallPlugin );
       
  1678     RunNext();
       
  1679     return 0;
       
  1680     }
       
  1681     
       
  1682 TInt CCollectionTests::StartTest0106L()
       
  1683     {
       
  1684     // MMPXCollection::SetSyncL
       
  1685     iLogger->Log( KTextApiSetSyncL );
       
  1686     iLogger->Log( KTextUninstallPlugin );
       
  1687     RunNext();
       
  1688     return 0;
       
  1689     }
       
  1690     
       
  1691 TInt CCollectionTests::StartTest0107L()
       
  1692     {
       
  1693     // MMPXCollection::SetSyncL
       
  1694     iLogger->Log( KTextApiSetSyncL );
       
  1695     iLogger->Log( KTextUninstallPlugin );
       
  1696     RunNext();
       
  1697     return 0;
       
  1698     }
       
  1699     
       
  1700 TInt CCollectionTests::StartTest0108L()
       
  1701     {
       
  1702     // MMPXCollection::SetSyncL
       
  1703     iLogger->Log( KTextApiSetSyncL );
       
  1704     
       
  1705     CMPXMedia* media = CMPXMedia::NewL();
       
  1706     CleanupStack::PushL( media );
       
  1707     
       
  1708     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1709     media->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  1710     media->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0108"));
       
  1711     // Adding valid media
       
  1712     TRAPD(err, iCollectionUtility1->Collection().SetSyncL(*media) );
       
  1713     TMC_ASSERT(err == KErrNone, 1);
       
  1714     
       
  1715     CleanupStack::PopAndDestroy( media );
       
  1716 
       
  1717     return 0;
       
  1718     }
       
  1719 
       
  1720 TInt CCollectionTests::StartTest0109L()
       
  1721     {
       
  1722     // MMPXCollection::SetSyncL
       
  1723     iLogger->Log( KTextApiSetSyncL );
       
  1724     
       
  1725     CMPXMedia* media = CMPXMedia::NewL();
       
  1726     CleanupStack::PushL( media );
       
  1727     
       
  1728     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1729     media->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  1730     media->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0109"));
       
  1731     // Adding valid media
       
  1732     TRAPD(err, iCollectionUtility1->Collection().SetSyncL(*media) );
       
  1733     TMC_ASSERT(err == KErrNone, 1);
       
  1734     
       
  1735     CleanupStack::PopAndDestroy( media );
       
  1736     iTempCnt = 2;   // expecting receiving 2 HandleCollectionMessages
       
  1737     return 0;
       
  1738     }
       
  1739 
       
  1740 TInt CCollectionTests::StartTest0110L()
       
  1741     {
       
  1742     // MMPXCollection::SetL
       
  1743     iLogger->Log( KTextApiSetL );
       
  1744     iLogger->Log( KTextUninstallPlugin );
       
  1745     RunNext();
       
  1746     return 0;
       
  1747     }
       
  1748     
       
  1749 TInt CCollectionTests::StartTest0111L()
       
  1750     {
       
  1751     // MMPXCollection::SetL
       
  1752     iLogger->Log( KTextApiSetL );
       
  1753     iLogger->Log( KTextUninstallPlugin );
       
  1754     RunNext();
       
  1755     return 0;
       
  1756     }
       
  1757 
       
  1758 TInt CCollectionTests::StartTest0112L()
       
  1759     {
       
  1760     // MMPXCollection::SetL
       
  1761     iLogger->Log( KTextApiSetL );
       
  1762     iLogger->Log( KTextUninstallPlugin );
       
  1763     RunNext();
       
  1764     return 0;
       
  1765     }
       
  1766 
       
  1767 TInt CCollectionTests::StartTest0113L()
       
  1768     {
       
  1769     // MMPXCollection::SetL
       
  1770     iLogger->Log( KTextApiSetL );
       
  1771     iLogger->Log( KTextUninstallPlugin );
       
  1772     RunNext();
       
  1773     return 0;
       
  1774     }
       
  1775     
       
  1776 TInt CCollectionTests::StartTest0114L()
       
  1777     {
       
  1778     // MMPXCollection::SetL
       
  1779     iLogger->Log( KTextApiSetL );
       
  1780     iLogger->Log( KTextUninstallPlugin );
       
  1781     RunNext();
       
  1782     return 0;
       
  1783     }
       
  1784 
       
  1785 TInt CCollectionTests::StartTest0115L()
       
  1786     {
       
  1787     // MMPXCollection::SetL
       
  1788     iLogger->Log( KTextApiSetL );
       
  1789     iLogger->Log( KTextUninstallPlugin );
       
  1790     RunNext();
       
  1791     return 0;
       
  1792     }
       
  1793 
       
  1794 TInt CCollectionTests::StartTest0116L()
       
  1795     {
       
  1796     // MMPXCollection::SetL
       
  1797     iLogger->Log( KTextApiSetL );
       
  1798     iLogger->Log( KTextUninstallPlugin );
       
  1799     RunNext();
       
  1800     return 0;
       
  1801     }
       
  1802 
       
  1803 TInt CCollectionTests::StartTest0117L()
       
  1804     {
       
  1805     // MMPXCollection::SetL
       
  1806     iLogger->Log( KTextApiSetL );
       
  1807     
       
  1808     /*
       
  1809     // Reinitialize collection utility first
       
  1810     DELETE_COLLECTION_PTR(iCollectionUtility1);
       
  1811     iCollectionUtility1 = MMPXCollectionUtility::NewL(this);
       
  1812     iLogger->Log( KTextPanicExpected ); 
       
  1813     // TODO: panic will raised - because of no EMcsSetMediaAsync handle
       
  1814     //       in CMPXCollectionUtility::HandleRunErrorL
       
  1815     CMPXMedia* media = CMPXMedia::NewL();
       
  1816     CleanupStack::PushL( media );
       
  1817     iCollectionUtility1->Collection().SetL( *media );
       
  1818     CleanupStack::PopAndDestroy( media );
       
  1819     TMC_ASSERT(EFalse, 1);  // temp
       
  1820     */
       
  1821     
       
  1822     RunNext();
       
  1823     return 0;
       
  1824     }
       
  1825 
       
  1826 TInt CCollectionTests::StartTest0118L()
       
  1827     {
       
  1828     // MMPXCollection::SetL
       
  1829     iLogger->Log( KTextApiSetL );
       
  1830     iLogger->Log( KTextPanicExpected ); 
       
  1831     // TODO: panic will raised - because of NULL callback
       
  1832     // Update DoHandleCollectionTest0118L() as the problem is fixed
       
  1833     
       
  1834     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  1835     CleanupStack::PushL( path );
       
  1836     path->AppendL( KCollectionTestPluginImpId );
       
  1837     iCollectionUtility1->Collection().OpenL( *path );
       
  1838     CleanupStack::PopAndDestroy( path );
       
  1839     return 0;
       
  1840     }
       
  1841 TInt CCollectionTests::StartTest0119L()
       
  1842     {
       
  1843     // MMPXCollection::SetL
       
  1844     iLogger->Log( KTextApiSetL );
       
  1845     
       
  1846     /*
       
  1847     CMPXMedia* media = CMPXMedia::NewL();
       
  1848     CleanupStack::PushL( media );
       
  1849     
       
  1850     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1851     media->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  1852     media->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0119"));
       
  1853     // Adding valid media
       
  1854     TRAPD(err, iCollectionUtility1->Collection().SetL(*media) );
       
  1855     TMC_ASSERT(err == KErrNone, 1);
       
  1856     
       
  1857     CleanupStack::PopAndDestroy( media );
       
  1858     //TODO: API deprecated
       
  1859     iLogger->Log( KTextApiDeprecated );
       
  1860     */
       
  1861     
       
  1862     RunNext();
       
  1863     return 0;
       
  1864     }
       
  1865 
       
  1866 TInt CCollectionTests::StartTest0120L()
       
  1867     {
       
  1868     // MMPXCollection::SetL
       
  1869     iLogger->Log( KTextApiSetL );
       
  1870     
       
  1871     /*
       
  1872     CMPXMedia* media = CMPXMedia::NewL();
       
  1873     CleanupStack::PushL( media );
       
  1874     
       
  1875     media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
       
  1876     media->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  1877     media->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0120"));
       
  1878     // Adding valid media
       
  1879     TRAPD(err, iCollectionUtility1->Collection().SetL(*media) );
       
  1880     TMC_ASSERT(err == KErrNone, 1);
       
  1881     
       
  1882     CleanupStack::PopAndDestroy( media );
       
  1883     iTempCnt = 2;   // expecting receiving 2 HandleCollectionMessages
       
  1884     //TODO: API deprecated
       
  1885     iLogger->Log( KTextApiDeprecated );
       
  1886     */
       
  1887     
       
  1888     RunNext();
       
  1889     return 0;
       
  1890     }
       
  1891 
       
  1892 TInt CCollectionTests::StartTest0121L()
       
  1893     {
       
  1894     // MMPXCollection::FindAllL
       
  1895     iLogger->Log( KTextApiFindAllL_Asyn );
       
  1896     iLogger->Log( KTextUninstallPlugin );
       
  1897     RunNext();
       
  1898     return 0;
       
  1899     }
       
  1900     
       
  1901 TInt CCollectionTests::StartTest0122L()
       
  1902     {
       
  1903     // MMPXCollection::FindAllL
       
  1904     iLogger->Log( KTextApiFindAllL_Asyn );
       
  1905     iLogger->Log( KTextUninstallPlugin );
       
  1906     RunNext();
       
  1907     return 0;
       
  1908     }
       
  1909     
       
  1910 TInt CCollectionTests::StartTest0123L()
       
  1911     {
       
  1912     // MMPXCollection::FindAllL
       
  1913     iLogger->Log( KTextApiFindAllL_Asyn );
       
  1914     iLogger->Log( KTextUninstallPlugin );
       
  1915     RunNext();
       
  1916     return 0;
       
  1917     }
       
  1918     
       
  1919 TInt CCollectionTests::StartTest0124L()
       
  1920     {
       
  1921     // MMPXCollection::FindAllL
       
  1922     iLogger->Log( KTextApiFindAllL_Asyn );
       
  1923     iLogger->Log( KTextUninstallPlugin );
       
  1924     RunNext();
       
  1925     return 0;
       
  1926     }
       
  1927     
       
  1928 TInt CCollectionTests::StartTest0125L()
       
  1929     {
       
  1930     // MMPXCollection::FindAllL
       
  1931     iLogger->Log( KTextApiFindAllL_Asyn );
       
  1932     iLogger->Log( KTextUninstallPlugin );
       
  1933     RunNext();
       
  1934     return 0;
       
  1935     }
       
  1936     
       
  1937 TInt CCollectionTests::StartTest0126L()
       
  1938     {
       
  1939     // MMPXCollection::FindAllL
       
  1940     iLogger->Log( KTextApiFindAllL_Asyn );
       
  1941     
       
  1942     // Close iCollectionUtility and re-initialize
       
  1943     DELETE_COLLECTION_PTR(iCollectionUtility1);
       
  1944     iCollectionUtility1 = MMPXCollectionUtility::NewL(this);
       
  1945     
       
  1946     // Find with empty attribute list and cristeria
       
  1947     RArray<TMPXAttribute> attrs;
       
  1948     CleanupClosePushL( attrs );
       
  1949     CMPXSearchCriteria* criteria = CMPXSearchCriteria::NewL();
       
  1950     CleanupStack::PushL( criteria );
       
  1951     iCollectionUtility1->Collection().FindAllL(*criteria, attrs.Array(), *this);
       
  1952     
       
  1953     CleanupStack::PopAndDestroy(2, &attrs); // criteria, attrs
       
  1954     return 0;
       
  1955     }
       
  1956     
       
  1957 TInt CCollectionTests::StartTest0127L()
       
  1958     {
       
  1959     // MMPXCollection::FindAllL
       
  1960     iLogger->Log( KTextApiFindAllL_Asyn );
       
  1961     RArray<TMPXAttribute> attrs;
       
  1962     CleanupClosePushL( attrs );
       
  1963     CMPXSearchCriteria* criteria = CMPXSearchCriteria::NewL();
       
  1964     CleanupStack::PushL( criteria );
       
  1965     criteria->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, KNullUid);
       
  1966     iCollectionUtility1->Collection().FindAllL(*criteria, attrs.Array(), *this);
       
  1967     
       
  1968     CleanupStack::PopAndDestroy(2, &attrs); // criteria, attrs
       
  1969     return 0;
       
  1970     }
       
  1971 
       
  1972 TInt CCollectionTests::StartTest0128L()
       
  1973     {
       
  1974     // MMPXCollection::FindAllL
       
  1975     iLogger->Log( KTextApiFindAllL_Asyn );
       
  1976     RArray<TMPXAttribute> attrs;
       
  1977     CleanupClosePushL( attrs );
       
  1978     CMPXSearchCriteria* criteria = CMPXSearchCriteria::NewL();
       
  1979     CleanupStack::PushL( criteria );
       
  1980     criteria->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0128"));
       
  1981     criteria->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  1982     iCollectionUtility1->Collection().FindAllL(*criteria, attrs.Array(), *this);
       
  1983     
       
  1984     CleanupStack::PopAndDestroy(2, &attrs); // criteria, attrs
       
  1985     return 0;
       
  1986     }
       
  1987 
       
  1988 TInt CCollectionTests::StartTest0129L()
       
  1989     {
       
  1990     // MMPXCollection::FindAllL
       
  1991     iLogger->Log( KTextApiFindAllL_Asyn );
       
  1992     RArray<TMPXAttribute> attrs;
       
  1993     CleanupClosePushL( attrs );
       
  1994     attrs.Append( KMPXMediaGeneralTitle );
       
  1995     attrs.Append( KMPXMediaGeneralUri );
       
  1996     attrs.Append( KMPXMediaGeneralId );
       
  1997     
       
  1998     CMPXSearchCriteria* criteria = CMPXSearchCriteria::NewL();
       
  1999     CleanupStack::PushL( criteria );
       
  2000     criteria->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0129"));
       
  2001     criteria->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  2002     iCollectionUtility1->Collection().FindAllL(*criteria, attrs.Array(), *this);
       
  2003     
       
  2004     CleanupStack::PopAndDestroy(2, &attrs); // criteria, attrs
       
  2005     return 0;
       
  2006     }
       
  2007 
       
  2008 TInt CCollectionTests::StartTest0130L()
       
  2009     {
       
  2010     // MMPXCollection::FindAllL
       
  2011     iLogger->Log( KTextApiFindAllL_Asyn );
       
  2012     RArray<TMPXAttribute> attrs;
       
  2013     CleanupClosePushL( attrs );
       
  2014     CMPXSearchCriteria* criteria = CMPXSearchCriteria::NewL();
       
  2015     CleanupStack::PushL( criteria );
       
  2016     criteria->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0130"));
       
  2017     criteria->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  2018     iCollectionUtility1->Collection().FindAllL(*criteria, attrs.Array(), *this);
       
  2019     
       
  2020     CleanupStack::PopAndDestroy(2, &attrs); // criteria, attrs
       
  2021     return 0;
       
  2022     }    
       
  2023 
       
  2024 TInt CCollectionTests::StartTest0131L()
       
  2025     {
       
  2026     // MMPXCollection::FindAllL
       
  2027     iLogger->Log( KTextApiFindAllL_Syn );
       
  2028     iLogger->Log( KTextUninstallPlugin );
       
  2029     RunNext();
       
  2030     return 0;
       
  2031     }
       
  2032 
       
  2033 TInt CCollectionTests::StartTest0132L()
       
  2034     {
       
  2035     // MMPXCollection::FindAllL
       
  2036     iLogger->Log( KTextApiFindAllL_Syn );
       
  2037     iLogger->Log( KTextUninstallPlugin );
       
  2038     RunNext();
       
  2039     return 0;
       
  2040     }
       
  2041 
       
  2042 TInt CCollectionTests::StartTest0133L()
       
  2043     {
       
  2044     // MMPXCollection::FindAllL
       
  2045     iLogger->Log( KTextApiFindAllL_Syn );
       
  2046     iLogger->Log( KTextUninstallPlugin );
       
  2047     RunNext();
       
  2048     return 0;
       
  2049     }
       
  2050 
       
  2051 TInt CCollectionTests::StartTest0134L()
       
  2052     {
       
  2053     // MMPXCollection::FindAllL
       
  2054     iLogger->Log( KTextApiFindAllL_Syn );
       
  2055     iLogger->Log( KTextUninstallPlugin );
       
  2056     RunNext();
       
  2057     return 0;
       
  2058     }
       
  2059 
       
  2060 TInt CCollectionTests::StartTest0135L()
       
  2061     {
       
  2062     // MMPXCollection::FindAllL
       
  2063     iLogger->Log( KTextApiFindAllL_Syn );
       
  2064     iLogger->Log( KTextUninstallPlugin );
       
  2065     RunNext();
       
  2066     return 0;
       
  2067     }
       
  2068 
       
  2069 TInt CCollectionTests::StartTest0136L()
       
  2070     {
       
  2071     // MMPXCollection::FindAllL
       
  2072     iLogger->Log( KTextApiFindAllL_Syn );
       
  2073     
       
  2074     // Close iCollectionUtility and re-initialize
       
  2075     DELETE_COLLECTION_PTR(iCollectionUtility1);
       
  2076     iCollectionUtility1 = MMPXCollectionUtility::NewL(this);
       
  2077     
       
  2078     // Find with empty attribute list and cristeria
       
  2079     RArray<TMPXAttribute> attrs;
       
  2080     CleanupClosePushL( attrs );
       
  2081     CMPXSearchCriteria* criteria = CMPXSearchCriteria::NewL();
       
  2082     CleanupStack::PushL( criteria );
       
  2083     CMPXMedia* media = NULL;
       
  2084     TRAPD(err, media = iCollectionUtility1->Collection().FindAllL(*criteria, attrs.Array()) );
       
  2085     DELETE_PTR( media );
       
  2086     TMC_ASSERT(err == KErrNotSupported, 1);
       
  2087     CleanupStack::PopAndDestroy(2, &attrs); // criteria, attrs
       
  2088     RunNext();
       
  2089     return 0;
       
  2090     }
       
  2091 
       
  2092 TInt CCollectionTests::StartTest0137L()
       
  2093     {
       
  2094     // MMPXCollection::FindAllL
       
  2095     iLogger->Log( KTextApiFindAllL_Syn );
       
  2096     RArray<TMPXAttribute> attrs;
       
  2097     CleanupClosePushL( attrs );
       
  2098     CMPXSearchCriteria* criteria = CMPXSearchCriteria::NewL();
       
  2099     CleanupStack::PushL( criteria );
       
  2100     criteria->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, KNullUid);
       
  2101     CMPXMedia* media = NULL;
       
  2102     TRAPD(err, media = iCollectionUtility1->Collection().FindAllL(*criteria, attrs.Array()) );
       
  2103     DELETE_PTR( media );
       
  2104     TMC_ASSERT(err == KErrNotSupported, 1);
       
  2105     CleanupStack::PopAndDestroy(2, &attrs); // criteria, attrs
       
  2106     RunNext();
       
  2107     return 0;
       
  2108     }
       
  2109 
       
  2110 TInt CCollectionTests::StartTest0138L()
       
  2111     {
       
  2112     // MMPXCollection::FindAllL
       
  2113     iLogger->Log( KTextApiFindAllL_Asyn );
       
  2114     RArray<TMPXAttribute> attrs;
       
  2115     CleanupClosePushL( attrs );
       
  2116     CMPXSearchCriteria* criteria = CMPXSearchCriteria::NewL();
       
  2117     CleanupStack::PushL( criteria );
       
  2118     criteria->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0138"));
       
  2119     criteria->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  2120     CMPXMedia* media = NULL;
       
  2121     TRAPD(err, media = iCollectionUtility1->Collection().FindAllL(*criteria, attrs.Array()) );
       
  2122     CleanupStack::PopAndDestroy(2, &attrs); // criteria, attrs
       
  2123     CleanupStack::PushL( media );
       
  2124     TMC_ASSERT(err == KErrNone, 1);
       
  2125     TMC_ASSERT(media != NULL, 2);
       
  2126     
       
  2127     // Result comparsion
       
  2128     if( !media->IsSupported(KMPXMediaGeneralTitle) )
       
  2129         {
       
  2130         TMC_ASSERT(EFalse , 3);
       
  2131         return 0;
       
  2132         }
       
  2133     const TDesC& title = media->ValueText( KMPXMediaGeneralTitle );
       
  2134     TMC_ASSERT(title == _L("CollectionPluginTest0138"), 4 );
       
  2135     
       
  2136     if( !media->IsSupported(KMPXMediaGeneralCollectionId) )
       
  2137         {
       
  2138         TMC_ASSERT(EFalse , 5);
       
  2139         return 0;
       
  2140         }
       
  2141     TUid uid = media->ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId );
       
  2142     TMC_ASSERT(uid == TUid::Uid(KCollectionTestPluginImpId), 6);
       
  2143     
       
  2144     if( !media->IsSupported(KMPXMediaGeneralSize) )
       
  2145         {
       
  2146         TMC_ASSERT(EFalse , 7);
       
  2147         return 0;
       
  2148         }
       
  2149     TInt attrSize = media->ValueTObjectL<TInt>( KMPXMediaGeneralSize );
       
  2150     TMC_ASSERT(attrSize == 0, 8);    
       
  2151     CleanupStack::PopAndDestroy( media );
       
  2152     RunNext();
       
  2153     return 0;
       
  2154     }    
       
  2155 
       
  2156 TInt CCollectionTests::StartTest0139L()
       
  2157     {
       
  2158     // MMPXCollection::FindAllL
       
  2159     iLogger->Log( KTextApiFindAllL_Asyn );
       
  2160     RArray<TMPXAttribute> attrs;
       
  2161     CleanupClosePushL( attrs );
       
  2162     attrs.Append( KMPXMediaGeneralTitle );
       
  2163     attrs.Append( KMPXMediaGeneralUri );
       
  2164     attrs.Append( KMPXMediaGeneralId );
       
  2165     
       
  2166     CMPXSearchCriteria* criteria = CMPXSearchCriteria::NewL();
       
  2167     CleanupStack::PushL( criteria );
       
  2168     criteria->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0139"));
       
  2169     criteria->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  2170     CMPXMedia* media = NULL;
       
  2171     TRAPD(err, media = iCollectionUtility1->Collection().FindAllL(*criteria, attrs.Array()) );
       
  2172     CleanupStack::PopAndDestroy(2, &attrs); // criteria, attrs
       
  2173     CleanupStack::PushL( media );
       
  2174     TMC_ASSERT(err == KErrNone, 1);
       
  2175     TMC_ASSERT(media != NULL, 2);
       
  2176     
       
  2177     // Result comparsion
       
  2178     if( !media->IsSupported(KMPXMediaGeneralTitle) )
       
  2179         {
       
  2180         TMC_ASSERT(EFalse , 3);
       
  2181         return 0;
       
  2182         }
       
  2183     const TDesC& title = media->ValueText( KMPXMediaGeneralTitle );
       
  2184     TMC_ASSERT(title == _L("CollectionPluginTest0139"), 4 );
       
  2185     
       
  2186     if( !media->IsSupported(KMPXMediaGeneralCollectionId) )
       
  2187         {
       
  2188         TMC_ASSERT(EFalse , 5);
       
  2189         return 0;
       
  2190         }
       
  2191     TUid uid = media->ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId );
       
  2192     TMC_ASSERT(uid == TUid::Uid(KCollectionTestPluginImpId), 6);
       
  2193     
       
  2194     if( !media->IsSupported(KMPXMediaGeneralSize) )
       
  2195         {
       
  2196         TMC_ASSERT(EFalse , 7);
       
  2197         return 0;
       
  2198         }
       
  2199     TInt attrSize = media->ValueTObjectL<TInt>( KMPXMediaGeneralSize );
       
  2200     TMC_ASSERT(attrSize == 3, 8);
       
  2201     CleanupStack::PopAndDestroy( media );
       
  2202     RunNext();
       
  2203     return 0;
       
  2204     }
       
  2205 
       
  2206 TInt CCollectionTests::StartTest0140L()
       
  2207     {
       
  2208     // MMPXCollection::FindAllL
       
  2209     iLogger->Log( KTextApiFindAllL_Asyn );
       
  2210     RArray<TMPXAttribute> attrs;
       
  2211     CleanupClosePushL( attrs );
       
  2212     CMPXSearchCriteria* criteria = CMPXSearchCriteria::NewL();
       
  2213     CleanupStack::PushL( criteria );
       
  2214     criteria->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0140"));
       
  2215     criteria->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, TUid::Uid(KCollectionTestPluginImpId));
       
  2216     CMPXMedia* media = NULL;
       
  2217     TRAPD(err, media = iCollectionUtility1->Collection().FindAllL(*criteria, attrs.Array()) );
       
  2218     CleanupStack::PopAndDestroy(2, &attrs); // criteria, attrs
       
  2219     
       
  2220     TMC_ASSERT(err == KErrNotFound, 1);
       
  2221     TMC_ASSERT(media == NULL, 2);
       
  2222     
       
  2223     RunNext();
       
  2224     return 0;
       
  2225     }
       
  2226 
       
  2227 TInt CCollectionTests::StartTest0141L()
       
  2228     {
       
  2229     // MMPXCollection::MediaL
       
  2230     iLogger->Log( KTextApiMediaL );
       
  2231     iLogger->Log( KTextUninstallPlugin );
       
  2232     RunNext();
       
  2233     return 0;
       
  2234     }    
       
  2235 
       
  2236 TInt CCollectionTests::StartTest0142L()
       
  2237     {
       
  2238     // MMPXCollection::MediaL
       
  2239     iLogger->Log( KTextApiMediaL );
       
  2240     iLogger->Log( KTextUninstallPlugin );
       
  2241     RunNext();
       
  2242     return 0;
       
  2243     }    
       
  2244 
       
  2245 TInt CCollectionTests::StartTest0143L()
       
  2246     {
       
  2247     // MMPXCollection::MediaL
       
  2248     iLogger->Log( KTextApiMediaL );
       
  2249     iLogger->Log( KTextUninstallPlugin );
       
  2250     RunNext();
       
  2251     return 0;
       
  2252     }    
       
  2253 
       
  2254 TInt CCollectionTests::StartTest0144L()
       
  2255     {
       
  2256     // MMPXCollection::MediaL
       
  2257     iLogger->Log( KTextApiMediaL );
       
  2258     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  2259     CleanupStack::PushL( path );
       
  2260     RArray<TMPXAttribute> attrs;
       
  2261     CleanupClosePushL( attrs );
       
  2262     TRAPD(err, iCollectionUtility1->Collection().MediaL(*path, attrs.Array()) );
       
  2263     TMC_ASSERT(err == KErrArgument, 1);
       
  2264     CleanupStack::PopAndDestroy(2, path);   // attrs, path
       
  2265     RunNext();
       
  2266     return 0;
       
  2267     }    
       
  2268 
       
  2269 TInt CCollectionTests::StartTest0145L()
       
  2270     {
       
  2271     // MMPXCollection::MediaL
       
  2272     iLogger->Log( KTextApiMediaL );
       
  2273     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  2274     CleanupStack::PushL( path );
       
  2275     path->AppendL( NULL );
       
  2276     RArray<TMPXAttribute> attrs;
       
  2277     CleanupClosePushL( attrs );
       
  2278     iCollectionUtility1->Collection().MediaL(*path, attrs.Array());
       
  2279     CleanupStack::PopAndDestroy(2, path);   // attrs, path
       
  2280     return 0;
       
  2281     }    
       
  2282 
       
  2283 TInt CCollectionTests::StartTest0146L()
       
  2284     {
       
  2285     // MMPXCollection::MediaL
       
  2286     iLogger->Log( KTextApiMediaL );
       
  2287     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  2288     CleanupStack::PushL( path );
       
  2289     path->AppendL( KCollectionTestPluginImpId );
       
  2290     path->AppendL( 14 );
       
  2291     RArray<TMPXAttribute> attrs;
       
  2292     CleanupClosePushL( attrs );
       
  2293     iCollectionUtility1->Collection().MediaL(*path, attrs.Array());
       
  2294     CleanupStack::PopAndDestroy(2, path);   // attrs, path
       
  2295     
       
  2296     // Do HandleMediaTest0146L() is never called
       
  2297     RunNext();
       
  2298     return 0;
       
  2299     } 
       
  2300 
       
  2301 TInt CCollectionTests::StartTest0147L()
       
  2302     {
       
  2303     // MMPXCollection::MediaL
       
  2304     iLogger->Log( KTextApiMediaL );
       
  2305     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  2306     CleanupStack::PushL( path );
       
  2307     path->AppendL( KCollectionTestPluginImpId );
       
  2308     path->AppendL( 15 );
       
  2309     RArray<TMPXAttribute> attrs;
       
  2310     CleanupClosePushL( attrs );
       
  2311     iCollectionUtility1->Collection().MediaL(*path, attrs.Array());
       
  2312     CleanupStack::PopAndDestroy(2, path);   // attrs, path
       
  2313     return 0;
       
  2314     }    
       
  2315     
       
  2316 TInt CCollectionTests::StartTest0148L()
       
  2317     {
       
  2318     // MMPXCollection::MediaL
       
  2319     iLogger->Log( KTextApiMediaL );
       
  2320     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  2321     CleanupStack::PushL( path );
       
  2322     path->AppendL( KCollectionTestPluginImpId );
       
  2323     path->AppendL( 16 );
       
  2324     RArray<TMPXAttribute> attrs;
       
  2325     CleanupClosePushL( attrs );
       
  2326     iCollectionUtility1->Collection().MediaL(*path, attrs.Array());
       
  2327     CleanupStack::PopAndDestroy(2, path);   // attrs, path
       
  2328     return 0;
       
  2329     }    
       
  2330 
       
  2331 TInt CCollectionTests::StartTest0149L()
       
  2332     {
       
  2333     /*
       
  2334     // MMPXCollection::MediaL
       
  2335     iLogger->Log( KTextApiMediaL );
       
  2336     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  2337     CleanupStack::PushL( path );
       
  2338     path->AppendL( KCollectionTestPluginImpId );
       
  2339     path->AppendL( 17 );
       
  2340     RArray<TMPXAttribute> attrs;
       
  2341     CleanupClosePushL( attrs );
       
  2342     CMPXAttributeSpecs* spec = CMPXAttributeSpecs::NewL();
       
  2343     CleanupStack::PushL( spec );
       
  2344     spec->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0149"));
       
  2345     iCollectionUtility1->Collection().MediaL(*path, attrs.Array(), spec);
       
  2346     CleanupStack::PopAndDestroy(3, path);   // spec, attrs, path
       
  2347     */
       
  2348     
       
  2349     RunNext(); // remove later
       
  2350 
       
  2351     return 0;
       
  2352     }
       
  2353 
       
  2354 TInt CCollectionTests::StartTest0150L()
       
  2355     {
       
  2356     // MMPXCollection::CommandL
       
  2357     iLogger->Log( KTextApiCommandL );
       
  2358     iLogger->Log( KTextUninstallPlugin );
       
  2359     RunNext();
       
  2360     return 0;
       
  2361     }
       
  2362     
       
  2363 TInt CCollectionTests::StartTest0151L()
       
  2364     {
       
  2365     // MMPXCollection::CommandL
       
  2366     iLogger->Log( KTextApiCommandL );
       
  2367     iLogger->Log( KTextUninstallPlugin );
       
  2368     RunNext();
       
  2369     return 0;
       
  2370     } 
       
  2371 
       
  2372 TInt CCollectionTests::StartTest0152L()
       
  2373     {
       
  2374     // MMPXCollection::CommandL
       
  2375     iLogger->Log( KTextApiCommandL );
       
  2376     iLogger->Log( KTextUninstallPlugin );
       
  2377     RunNext();
       
  2378     return 0;
       
  2379     } 
       
  2380 
       
  2381 TInt CCollectionTests::StartTest0153L()
       
  2382     {
       
  2383     // MMPXCollection::CommandL
       
  2384     iLogger->Log( KTextApiCommandL );
       
  2385     TRAPD(err, iCollectionUtility1->Collection().CommandL(EMcCmdRemoveAll, NULL));
       
  2386     TMC_ASSERT(err == KErrNotSupported, 1);
       
  2387     RunNext();
       
  2388     return 0;
       
  2389     } 
       
  2390 
       
  2391 TInt CCollectionTests::StartTest0154L()
       
  2392     {
       
  2393     // MMPXCollection::CommandL
       
  2394     iLogger->Log( KTextApiCommandL );
       
  2395     TRAPD(err, iCollectionUtility1->Collection().CommandL(EMcCmdRemoveAll, 0x12345678));
       
  2396     TMC_ASSERT(err == KErrNotSupported, 1);
       
  2397     RunNext();
       
  2398     return 0;
       
  2399     } 
       
  2400 
       
  2401 TInt CCollectionTests::StartTest0155L()
       
  2402     {
       
  2403     // MMPXCollection::CommandL
       
  2404     iLogger->Log( KTextApiCommandL );
       
  2405     iLogger->Log( _L("Issuing EMcCmdRemoveAll command") );
       
  2406     
       
  2407     /* Requires manual check		
       
  2408     iCollectionUtility1->Collection().CommandL(EMcCmdRemoveAll, KCollectionTestPluginImpId);
       
  2409     iLogger->Log( KTextManualCheck );
       
  2410     TMC_ASSERT(EFalse, 1);
       
  2411     */
       
  2412     
       
  2413     RunNext();
       
  2414     return 0;
       
  2415     }
       
  2416     
       
  2417 TInt CCollectionTests::StartTest0156L()
       
  2418     {
       
  2419     // MMPXCollection::CommandL
       
  2420     iLogger->Log( KTextApiCommandL );
       
  2421     iLogger->Log( _L("Issuing EMcCmdReCreateDB command") );
       
  2422     
       
  2423 	/* Requires manual check		
       
  2424     iCollectionUtility1->Collection().CommandL(EMcCmdReCreateDB, KCollectionTestPluginImpId);
       
  2425     iLogger->Log( KTextManualCheck );
       
  2426     TMC_ASSERT(EFalse, 1);
       
  2427     */
       
  2428     
       
  2429     RunNext();
       
  2430     return 0;
       
  2431     }
       
  2432     
       
  2433 TInt CCollectionTests::StartTest0157L()
       
  2434     {
       
  2435     // MMPXCollection::CommandL
       
  2436     iLogger->Log( KTextApiCommandL );
       
  2437     iLogger->Log( _L("Issuing EMcCmdDbCorrupted command") );
       
  2438     
       
  2439     /* Requires manual check		
       
  2440     iCollectionUtility1->Collection().CommandL(EMcCmdDbCorrupted, KCollectionTestPluginImpId);
       
  2441     iLogger->Log( KTextManualCheck );
       
  2442     TMC_ASSERT(EFalse, 1);
       
  2443     */
       
  2444     
       
  2445     RunNext();
       
  2446     return 0;
       
  2447     }
       
  2448 
       
  2449 TInt CCollectionTests::StartTest0158L()
       
  2450     {
       
  2451     // MMPXCollection::CommandL
       
  2452     iLogger->Log( KTextApiCommandL );
       
  2453     iLogger->Log( _L("Issuing EMcCmdCollectionInit command") );
       
  2454     
       
  2455     /* Requires manual check		
       
  2456     iCollectionUtility1->Collection().CommandL(EMcCmdCollectionInit, KCollectionTestPluginImpId);
       
  2457     iLogger->Log( KTextManualCheck );
       
  2458     TMC_ASSERT(EFalse, 1);
       
  2459     */
       
  2460     
       
  2461     RunNext();
       
  2462     return 0;
       
  2463     }
       
  2464 TInt CCollectionTests::StartTest0159L()
       
  2465     {
       
  2466     // MMPXCollection::CommandL
       
  2467     iLogger->Log( KTextApiCommandL );
       
  2468     iLogger->Log( _L("Issuing EMcCmdCollectionResyn command") );
       
  2469     
       
  2470     /* Requires manual check		
       
  2471     iCollectionUtility1->Collection().CommandL(EMcCmdCollectionResyn, KCollectionTestPluginImpId);
       
  2472     iLogger->Log( KTextManualCheck );
       
  2473     TMC_ASSERT(EFalse, 1);
       
  2474     */
       
  2475     
       
  2476     RunNext();
       
  2477     return 0;
       
  2478     }
       
  2479 
       
  2480 TInt CCollectionTests::StartTest0160L()
       
  2481     {
       
  2482     // MMPXCollection::CommandL
       
  2483     iLogger->Log( KTextApiCommandL );
       
  2484     TRAPD(err, iCollectionUtility1->Collection().CommandL(EMcCmdCollectionResyn, NULL));
       
  2485     TMC_ASSERT(err == KErrNotSupported, 1);
       
  2486     RunNext();
       
  2487     return 0;
       
  2488     }
       
  2489 
       
  2490 TInt CCollectionTests::StartTest0161L()
       
  2491     {
       
  2492     // MMPXCollection::CommandL
       
  2493     iLogger->Log( KTextApiCommandL );
       
  2494     
       
  2495     // Close iCollectionUtility and re-initialize
       
  2496     DELETE_COLLECTION_PTR(iCollectionUtility1);
       
  2497     iCollectionUtility1 = MMPXCollectionUtility::NewL(this);
       
  2498     
       
  2499     // Execute command
       
  2500     iLogger->Log( _L("Issuing EMcCmdSelect command") );
       
  2501     TRAPD(err, iCollectionUtility1->Collection().CommandL(EMcCmdSelect, 0));
       
  2502     TMC_ASSERT(err == KErrNotReady, 1);
       
  2503     RunNext();
       
  2504     return 0;
       
  2505     }
       
  2506     
       
  2507 TInt CCollectionTests::StartTest0162L()
       
  2508     {
       
  2509     // MMPXCollection::CommandL
       
  2510     iLogger->Log( KTextApiCommandL );
       
  2511     // Open CollectionPluginTest
       
  2512     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  2513     CleanupStack::PushL( path );
       
  2514     path->AppendL( KCollectionTestPluginImpId );
       
  2515     iCollectionUtility1->Collection().OpenL( *path );
       
  2516     CleanupStack::PopAndDestroy( path );
       
  2517     return 0;
       
  2518     }  
       
  2519     
       
  2520 TInt CCollectionTests::StartTest0163L()
       
  2521     {
       
  2522     // MMPXCollection::CommandL
       
  2523     iLogger->Log( KTextApiCommandL );
       
  2524     // Current path should in main view of CollectionTestPlugin 
       
  2525     // containing 3 entries: "level11", "level12", "level13" and now select 3rd
       
  2526     iCollectionUtility1->Collection().CommandL(EMcCmdSelect, 2);
       
  2527     return 0;
       
  2528     }
       
  2529     
       
  2530 TInt CCollectionTests::StartTest0164L()
       
  2531     {
       
  2532     // MMPXCollection::CommandL
       
  2533     iLogger->Log( KTextApiCommandL );
       
  2534     // Current path should in main view of CollectionTestPlugin 
       
  2535     // containing 3 entries: "level11", "level12", "level13" and now select -1th one
       
  2536     TRAPD(err, iCollectionUtility1->Collection().CommandL(EMcCmdSelect, -1));
       
  2537     TMC_ASSERT(err == KErrArgument, 1);
       
  2538     RunNext();
       
  2539     return 0;
       
  2540     }
       
  2541     
       
  2542 TInt CCollectionTests::StartTest0165L()
       
  2543     {
       
  2544     // MMPXCollection::CommandL
       
  2545     iLogger->Log( KTextApiCommandL );
       
  2546     // Current path should in main view of CollectionTestPlugin 
       
  2547     // containing 3 entries: "level11", "level12", "level13" and now select 1000th one
       
  2548     TRAPD(err, iCollectionUtility1->Collection().CommandL(EMcCmdSelect, 1000));
       
  2549     TMC_ASSERT(err == KErrArgument, 1);
       
  2550     RunNext();
       
  2551     return 0;
       
  2552     }
       
  2553     
       
  2554 TInt CCollectionTests::StartTest0166L()
       
  2555     {
       
  2556     // MMPXCollection::CommandL
       
  2557     iLogger->Log( KTextApiCommandL );
       
  2558     TRAPD(err, iCollectionUtility1->Collection().CommandL(EMcCmdRefresh, 0));
       
  2559     TMC_ASSERT(err == KErrNotSupported, 1);
       
  2560     RunNext();
       
  2561     return 0;
       
  2562     }
       
  2563     
       
  2564 TInt CCollectionTests::StartTest0167L()
       
  2565     {
       
  2566     // MMPXCollection::CommandL
       
  2567     iLogger->Log( KTextApiCommandL_Ext );
       
  2568     iLogger->Log( KTextUninstallPlugin );
       
  2569     RunNext();
       
  2570     return 0;
       
  2571     }
       
  2572 
       
  2573 TInt CCollectionTests::StartTest0168L()
       
  2574     {
       
  2575     // MMPXCollection::CommandL
       
  2576     iLogger->Log( KTextApiCommandL_Ext );
       
  2577     iLogger->Log( KTextUninstallPlugin );
       
  2578     RunNext();
       
  2579     return 0;
       
  2580     }
       
  2581 
       
  2582 TInt CCollectionTests::StartTest0169L()
       
  2583     {
       
  2584     // MMPXCollection::CommandL
       
  2585     iLogger->Log( KTextApiCommandL_Ext );
       
  2586     iLogger->Log( KTextUninstallPlugin );
       
  2587     
       
  2588     RunNext();
       
  2589     return 0;
       
  2590     }
       
  2591 
       
  2592 TInt CCollectionTests::StartTest0170L()
       
  2593     {
       
  2594     // MMPXCollection::CommandL
       
  2595     iLogger->Log( KTextApiCommandL_Ext );
       
  2596     
       
  2597     // Close collection utilty
       
  2598     DELETE_COLLECTION_PTR(iCollectionUtility1);
       
  2599     iCollectionUtility1 = MMPXCollectionUtility::NewL(this);
       
  2600     
       
  2601     // Send command
       
  2602     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2603     CleanupStack::PushL( cmd );
       
  2604     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  2605     TRAPD(err, iCollectionUtility1->Collection().CommandL( *cmd ));
       
  2606     CleanupStack::PopAndDestroy( cmd );
       
  2607     
       
  2608     // Seems to be Ready		
       
  2609     TMC_ASSERT(err == KErrNone, 1);
       
  2610     //TMC_ASSERT(err == KErrNotReady, 1);
       
  2611     RunNext();
       
  2612     return 0;
       
  2613     }
       
  2614 
       
  2615 TInt CCollectionTests::StartTest0171L()
       
  2616     {
       
  2617     // MMPXCollection::CommandL
       
  2618     iLogger->Log( KTextApiCommandL_Ext );
       
  2619     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2620     CleanupStack::PushL( cmd );
       
  2621     iCollectionUtility1->Collection().CommandL( *cmd );
       
  2622     CleanupStack::PopAndDestroy( cmd );
       
  2623     return 0;
       
  2624     }
       
  2625     
       
  2626 TInt CCollectionTests::StartTest0172L()    
       
  2627     {
       
  2628     // MMPXCollection::CommandL
       
  2629     iLogger->Log( KTextApiCommandL_Ext );
       
  2630     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2631     CleanupStack::PushL( cmd );
       
  2632     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  2633     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralCollectionId, NULL);
       
  2634     TRAPD(err, iCollectionUtility1->Collection().CommandL( *cmd ));
       
  2635     CleanupStack::PopAndDestroy( cmd );
       
  2636     TMC_ASSERT(err == KErrNotSupported, 1);
       
  2637     RunNext();
       
  2638     return 0;
       
  2639     }
       
  2640 
       
  2641 TInt CCollectionTests::StartTest0173L()    
       
  2642     {
       
  2643     // MMPXCollection::CommandL
       
  2644     iLogger->Log( KTextApiCommandL_Ext );
       
  2645     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2646     CleanupStack::PushL( cmd );
       
  2647     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralCollectionId, NULL);
       
  2648     iCollectionUtility1->Collection().CommandL( *cmd );
       
  2649     CleanupStack::PopAndDestroy( cmd );
       
  2650     return 0;
       
  2651     }
       
  2652 
       
  2653 TInt CCollectionTests::StartTest0174L()
       
  2654     {
       
  2655     // MMPXCollection::CommandL
       
  2656     iLogger->Log( KTextApiCommandL_Ext );
       
  2657     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2658     CleanupStack::PushL( cmd );
       
  2659     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  2660     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralCollectionId, KCollectionTestPluginImpId);
       
  2661     iCollectionUtility1->Collection().CommandL( *cmd );
       
  2662     CleanupStack::PopAndDestroy( cmd );
       
  2663     RunNext();
       
  2664     return 0;
       
  2665     }
       
  2666 
       
  2667 TInt CCollectionTests::StartTest0175L()
       
  2668     {
       
  2669     // MMPXCollection::CommandL
       
  2670     iLogger->Log( KTextApiCommandL_Ext );
       
  2671     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2672     CleanupStack::PushL( cmd );
       
  2673     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  2674     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralCollectionId, KCollectionTestPluginImpId);
       
  2675     cmd->SetTObjectValueL<TMPXCommandId>(KMPXCommandGeneralId, 175);
       
  2676     cmd->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0175"));
       
  2677     iCollectionUtility1->Collection().CommandL( *cmd );
       
  2678     CleanupStack::PopAndDestroy( cmd );
       
  2679     RunNext();
       
  2680     return 0;
       
  2681     }
       
  2682 
       
  2683 TInt CCollectionTests::StartTest0176L()
       
  2684     {
       
  2685     // MMPXCollection::CommandL
       
  2686     iLogger->Log( KTextApiCommandL_Ext );
       
  2687     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2688     CleanupStack::PushL( cmd );
       
  2689     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralCollectionId, KCollectionTestPluginImpId);
       
  2690     cmd->SetTObjectValueL<TMPXCommandId>(KMPXCommandGeneralId, 176);
       
  2691     cmd->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0176"));
       
  2692     iCollectionUtility1->Collection().CommandL( *cmd );
       
  2693     CleanupStack::PopAndDestroy( cmd );
       
  2694     return 0;
       
  2695     }
       
  2696 
       
  2697 TInt CCollectionTests::StartTest0177L()
       
  2698     {
       
  2699     // MMPXCollection::CommandL
       
  2700     iLogger->Log( KTextApiCommandL_Ext );
       
  2701     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2702     CleanupStack::PushL( cmd );
       
  2703     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralCollectionId, KCollectionTestPluginImpId);
       
  2704     cmd->SetTObjectValueL<TMPXCommandId>(KMPXCommandGeneralId, 177);
       
  2705     cmd->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0177"));
       
  2706     iCollectionUtility1->Collection().CommandL( *cmd );
       
  2707     CleanupStack::PopAndDestroy( cmd );
       
  2708     return 0;
       
  2709     }
       
  2710 
       
  2711 TInt CCollectionTests::StartTest0178L()
       
  2712     {
       
  2713     // MMPXCollection::CommandL
       
  2714     iLogger->Log( KTextApiCommandL_Ext );
       
  2715     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2716     CleanupStack::PushL( cmd );
       
  2717     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  2718     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralCollectionId, KCollectionTestPluginImpId);
       
  2719     cmd->SetTObjectValueL<TMPXCommandId>(KMPXCommandGeneralId, KMPXCommandIdCollectionSelect);
       
  2720     cmd->SetTObjectValueL<TInt>(TMPXAttribute(KMPXCommandContentIdCollection, EMPXCollectionCommandIndex),
       
  2721                                 0);
       
  2722     cmd->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0178"));
       
  2723     TRAPD(err, iCollectionUtility1->Collection().CommandL( *cmd ));
       
  2724     CleanupStack::PopAndDestroy( cmd );
       
  2725     TMC_ASSERT(err == KErrNotReady, 1);
       
  2726     RunNext();
       
  2727     return 0;
       
  2728     }
       
  2729 
       
  2730 TInt CCollectionTests::StartTest0179L()
       
  2731     {
       
  2732     iLogger->Log( KTextApiCommandL_Ext );
       
  2733     // Open CollectionPluginTest
       
  2734     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  2735     CleanupStack::PushL( path );
       
  2736     path->AppendL( KCollectionTestPluginImpId );
       
  2737     iCollectionUtility1->Collection().OpenL( *path );
       
  2738     CleanupStack::PopAndDestroy( path );
       
  2739     return 0;
       
  2740     }
       
  2741 
       
  2742 TInt CCollectionTests::StartTest0180L()
       
  2743     {
       
  2744     // MMPXCollection::CommandL
       
  2745     iLogger->Log( KTextApiCommandL_Ext );
       
  2746     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2747     CleanupStack::PushL( cmd );
       
  2748     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  2749     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralCollectionId, KCollectionTestPluginImpId);
       
  2750     cmd->SetTObjectValueL<TMPXCommandId>(KMPXCommandGeneralId, KMPXCommandIdCollectionSelect);
       
  2751     cmd->SetTObjectValueL<TInt>(TMPXAttribute(KMPXCommandContentIdCollection, EMPXCollectionCommandIndex),
       
  2752                                 -1);
       
  2753     cmd->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0180"));
       
  2754     TRAPD(err, iCollectionUtility1->Collection().CommandL( *cmd ));
       
  2755     CleanupStack::PopAndDestroy( cmd );
       
  2756     TMC_ASSERT(err == KErrArgument, 1);
       
  2757     RunNext();
       
  2758     return 0;
       
  2759     }    
       
  2760 
       
  2761 TInt CCollectionTests::StartTest0181L()
       
  2762     {
       
  2763     // MMPXCollection::CommandL
       
  2764     iLogger->Log( KTextApiCommandL_Ext );
       
  2765     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2766     CleanupStack::PushL( cmd );
       
  2767     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  2768     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralCollectionId, KCollectionTestPluginImpId);
       
  2769     cmd->SetTObjectValueL<TMPXCommandId>(KMPXCommandGeneralId, KMPXCommandIdCollectionSelect);
       
  2770     cmd->SetTObjectValueL<TInt>(TMPXAttribute(KMPXCommandContentIdCollection, EMPXCollectionCommandIndex),
       
  2771                                 1000);
       
  2772     cmd->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0181"));
       
  2773     TRAPD(err, iCollectionUtility1->Collection().CommandL( *cmd ));
       
  2774     CleanupStack::PopAndDestroy( cmd );
       
  2775     TMC_ASSERT(err == KErrArgument, 1);
       
  2776     RunNext();
       
  2777     return 0;
       
  2778     }
       
  2779 
       
  2780 TInt CCollectionTests::StartTest0182L()
       
  2781     {
       
  2782     // MMPXCollection::CommandL
       
  2783     iLogger->Log( KTextApiCommandL_Ext );
       
  2784     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2785     CleanupStack::PushL( cmd );
       
  2786     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  2787     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralCollectionId, KCollectionTestPluginImpId);
       
  2788     cmd->SetTObjectValueL<TMPXCommandId>(KMPXCommandGeneralId, KMPXCommandIdCollectionSelect);
       
  2789     cmd->SetTObjectValueL<TInt>(TMPXAttribute(KMPXCommandContentIdCollection, EMPXCollectionCommandIndex),
       
  2790                                 2);
       
  2791     cmd->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0182"));
       
  2792     iCollectionUtility1->Collection().CommandL( *cmd );
       
  2793     CleanupStack::PopAndDestroy( cmd );
       
  2794     return 0;
       
  2795     }
       
  2796 
       
  2797 TInt CCollectionTests::StartTest0183L()
       
  2798     {    
       
  2799     // MMPXCollection::CommandL
       
  2800     iLogger->Log( KTextApiCommandL_Ext );
       
  2801     
       
  2802     /* This test must be manually checked		
       
  2803     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2804     CleanupStack::PushL( cmd );
       
  2805     cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
       
  2806     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralCollectionId, KCollectionTestPluginImpId);
       
  2807     cmd->SetTObjectValueL<TMPXCommandId>(KMPXCommandGeneralId, 183);
       
  2808     cmd->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0183"));
       
  2809     iCollectionUtility1->Collection().CommandL( *cmd );
       
  2810     CleanupStack::PopAndDestroy( cmd );
       
  2811     iLogger->Log( KTextManualCheck );
       
  2812     TMC_ASSERT(EFalse, 1);    
       
  2813     */
       
  2814     
       
  2815     RunNext();
       
  2816     return 0;
       
  2817     }    
       
  2818 
       
  2819 TInt CCollectionTests::StartTest0184L()
       
  2820     {
       
  2821     // MMPXCollection::CommandL
       
  2822     iLogger->Log( KTextApiCommandL_Ext );
       
  2823     CMPXCommand* cmd = CMPXCommand::NewL();
       
  2824     CleanupStack::PushL( cmd );
       
  2825     cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralCollectionId, KCollectionTestPluginImpId);
       
  2826     cmd->SetTObjectValueL<TMPXCommandId>(KMPXCommandGeneralId, 184);
       
  2827     cmd->SetTextValueL(KMPXMediaGeneralTitle, _L("CollectionPluginTest0184"));
       
  2828     iCollectionUtility1->Collection().CommandL( *cmd );
       
  2829     CleanupStack::PopAndDestroy( cmd );
       
  2830     return 0;
       
  2831     }
       
  2832 
       
  2833 TInt CCollectionTests::StartTest0185L()
       
  2834     {
       
  2835     // MMPXCollection::GetSupportedTypesL
       
  2836     iLogger->Log( KTextApiGetSupportedTypesL );
       
  2837     iLogger->Log( KTextUninstallPlugin );
       
  2838     RunNext();
       
  2839     return 0;
       
  2840     }
       
  2841 
       
  2842 TInt CCollectionTests::StartTest0186L()
       
  2843     {
       
  2844     /*
       
  2845     // MMPXCollection::GetSupportedTypesL
       
  2846     iLogger->Log( KTextApiGetSupportedTypesL );
       
  2847     RPointerArray<CMPXCollectionType> typeArr;
       
  2848     CleanupClosePushL( typeArr );
       
  2849     TRAPD(err, iCollectionUtility1->Collection().GetSupportedTypesL( typeArr ));
       
  2850     TMC_ASSERT(err == KErrNone, 1);
       
  2851     for(TInt i = 0; i < typeArr.Count(); i++)
       
  2852         {
       
  2853         TBuf<512> log;
       
  2854         CMPXCollectionType* type = typeArr[i];
       
  2855         TUid uid = type->Uid();
       
  2856         const CDesCArray& exts = type->Extensions();
       
  2857         const CDesCArray& mimes = type->Mimetypes();
       
  2858         
       
  2859         iLogger->Log(_L("[%d] Uid=0x%x"), i, uid.iUid);
       
  2860         
       
  2861         TInt j = 0;
       
  2862         log.Format( _L("[%d] supports ext: "), i );
       
  2863         for(j = 0; j < exts.Count(); j++)
       
  2864             {
       
  2865             TPtrC ext = exts[j];
       
  2866             log.AppendFormat(_L("[%S]"), &ext);
       
  2867             }
       
  2868         iLogger->Log( log );
       
  2869         
       
  2870         log.Format( _L("[%d] supports mime: "), i );
       
  2871         for(j = 0; j < mimes.Count(); j++)
       
  2872             {
       
  2873             TPtrC mime = mimes[j];
       
  2874             log.AppendFormat(_L("[%S]"), &mime);
       
  2875             }
       
  2876         iLogger->Log( log );
       
  2877         }
       
  2878     typeArr.ResetAndDestroy();
       
  2879     CleanupStack::PopAndDestroy( &typeArr );
       
  2880     iLogger->Log( KTextManualCheck );
       
  2881     TMC_ASSERT(EFalse, 1);
       
  2882     */
       
  2883     
       
  2884     RunNext();
       
  2885     
       
  2886     return 0;
       
  2887     }
       
  2888 
       
  2889 
       
  2890 TInt CCollectionTests::StartTest0187L()
       
  2891     {
       
  2892     // MMPXCollection::GetSupportedCapabilitiesL 
       
  2893     iLogger->Log( KTextApiGetSupportedCapabilitiesL );
       
  2894     iLogger->Log( KTextUninstallPlugin );
       
  2895     RunNext();
       
  2896     return 0;
       
  2897     }
       
  2898 
       
  2899 TInt CCollectionTests::StartTest0188L()
       
  2900     {
       
  2901     /*
       
  2902     // MMPXCollection::GetSupportedCapabilitiesL 
       
  2903     iLogger->Log( KTextApiGetSupportedCapabilitiesL );
       
  2904     TCollectionCapability capability;
       
  2905     iCollectionUtility1->Collection().GetSupportedCapabilitiesL( capability );
       
  2906     TMC_ASSERT(capability == EMcNotModifiable, 1);
       
  2907     */
       
  2908     RunNext();
       
  2909     return 0;
       
  2910     }
       
  2911 
       
  2912 TInt CCollectionTests::StartTest0189L()
       
  2913     {
       
  2914     // MMPXCollection::GetSupportedCapabilitiesL 
       
  2915     iLogger->Log( KTextApiGetSupportedCapabilitiesL );
       
  2916     
       
  2917     DELETE_COLLECTION_PTR(iCollectionUtility1);
       
  2918     iCollectionUtility1 = MMPXCollectionUtility::NewL(this);
       
  2919     
       
  2920     // Get current context capability
       
  2921     TCollectionCapability capability;
       
  2922     iCollectionUtility1->Collection().GetSupportedCapabilitiesL( capability );
       
  2923     TMC_ASSERT(capability == 0, 1);
       
  2924     
       
  2925     RunNext();
       
  2926     return 0;
       
  2927     }
       
  2928     
       
  2929 TInt CCollectionTests::StartTest0190L()
       
  2930     {
       
  2931     // MMPXCollection::CollectionIDL
       
  2932     iLogger->Log( KTextApiCollectionIDL_Col );
       
  2933     TUid absUid = KLocalCollection;
       
  2934     TUid uid = iCollectionUtility1->Collection().CollectionIDL( absUid );
       
  2935     DELETE_COLLECTION_PTR(iCollectionUtility1);
       
  2936     TMC_ASSERT(uid == TUid::Uid(0x101FFC3A), 1);
       
  2937     
       
  2938     RunNext();
       
  2939     return 0;
       
  2940     }
       
  2941     
       
  2942 TInt CCollectionTests::StartTest0191L()
       
  2943     {
       
  2944     // MMPXCollection::CollectionIDL
       
  2945     iLogger->Log( KTextApiCollectionIDL );
       
  2946     TUid absUid = KPodcastCollection;
       
  2947     TUid uid = iCollectionUtility1->Collection().CollectionIDL( absUid );
       
  2948     TMC_ASSERT(uid == TUid::Uid(0x101FFC3C), 1);
       
  2949     
       
  2950 	RunNext();
       
  2951     return 0;
       
  2952     }
       
  2953 
       
  2954 TInt CCollectionTests::StartTest0192L()
       
  2955     {
       
  2956     // MMPXCollection::CollectionIDL
       
  2957     iLogger->Log( KTextApiCollectionIDL );
       
  2958     TUid absUid = KInMemoryCollection;
       
  2959     TUid uid = iCollectionUtility1->Collection().CollectionIDL( absUid );
       
  2960     TMC_ASSERT(uid == TUid::Uid(0x101FFCD8), 1);
       
  2961     
       
  2962     RunNext();
       
  2963     return 0;
       
  2964     }
       
  2965 
       
  2966 TInt CCollectionTests::StartTest0193L()
       
  2967     {
       
  2968     // MMPXCollection::CollectionIDL
       
  2969     iLogger->Log( KTextApiCollectionIDL );
       
  2970     TUid absUid = TUid::Uid(0x12345678);    // invalid Uid
       
  2971     TUid uid;
       
  2972     TRAPD(err, uid = iCollectionUtility1->Collection().CollectionIDL( absUid ));
       
  2973     TMC_ASSERT(err == KErrNone, 1);
       
  2974     TMC_ASSERT(uid == KNullUid, 2);
       
  2975         
       
  2976     RunNext();
       
  2977     return 0;
       
  2978     }
       
  2979 
       
  2980 TInt CCollectionTests::StartTest0194L()
       
  2981     {
       
  2982     // MMPXCollection::NotifyL
       
  2983     iLogger->Log( KTextApiNotifyL );
       
  2984     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  2985     CleanupStack::PushL( path );
       
  2986     path->AppendL( KCollectionTestPluginImpId );
       
  2987     iCollectionUtility1->Collection().OpenL( *path );
       
  2988     CleanupStack::PopAndDestroy( path );
       
  2989     return 0;
       
  2990     }
       
  2991 
       
  2992 TInt CCollectionTests::StartTest0195L()
       
  2993     {
       
  2994     // MMPXCollection::NotifyL
       
  2995     iLogger->Log( KTextApiNotifyL );
       
  2996     iCollectionUtility1->Collection().NotifyL(EMcMsgFormatStart, EDriveE);
       
  2997     return 0;
       
  2998     }
       
  2999 
       
  3000 TInt CCollectionTests::StartTest0196L()
       
  3001     {
       
  3002     // MMPXCollection::NotifyL
       
  3003     iLogger->Log( KTextApiNotifyL );
       
  3004     iCollectionUtility1->Collection().NotifyL(EMcMsgFormatEnd, EDriveE);
       
  3005     return 0;
       
  3006     }
       
  3007 
       
  3008 TInt CCollectionTests::StartTest0197L()
       
  3009     {
       
  3010     // MMPXCollection::NotifyL
       
  3011     iLogger->Log( KTextApiNotifyL );
       
  3012     iCollectionUtility1->Collection().NotifyL(EMcMsgDiskRemoved, EDriveE);
       
  3013     return 0;
       
  3014     }
       
  3015 
       
  3016 TInt CCollectionTests::StartTest0198L()
       
  3017     {
       
  3018     // MMPXCollection::NotifyL
       
  3019     iLogger->Log( KTextApiNotifyL );
       
  3020     iCollectionUtility1->Collection().NotifyL(EMcMsgDiskInserted, EDriveE);
       
  3021     return 0;
       
  3022     }
       
  3023 
       
  3024 TInt CCollectionTests::StartTest0199L()
       
  3025     {
       
  3026     // MMPXCollection::NotifyL
       
  3027     iLogger->Log( KTextApiNotifyL );
       
  3028     iCollectionUtility1->Collection().NotifyL(EMcMsgUSBMassStorageStart, EDriveE);
       
  3029     return 0;
       
  3030     }
       
  3031 
       
  3032 TInt CCollectionTests::StartTest0200L()
       
  3033     {
       
  3034     // MMPXCollection::NotifyL
       
  3035     iLogger->Log( KTextApiNotifyL );
       
  3036     iCollectionUtility1->Collection().NotifyL(EMcMsgUSBMassStorageEnd, EDriveE);
       
  3037     return 0;
       
  3038     }
       
  3039     
       
  3040 TInt CCollectionTests::StartTest0201L()
       
  3041     {
       
  3042     // MMPXCollection::NotifyL
       
  3043     iLogger->Log( KTextApiNotifyL );
       
  3044     iCollectionUtility1->Collection().NotifyL(EMcMsgRefreshStart, EDriveE);
       
  3045     return 0;
       
  3046     }
       
  3047 
       
  3048 TInt CCollectionTests::StartTest0202L()
       
  3049     {
       
  3050     // MMPXCollection::NotifyL
       
  3051     iLogger->Log( KTextApiNotifyL );
       
  3052     iCollectionUtility1->Collection().NotifyL(EMcMsgRefreshEnd, EDriveE);
       
  3053     return 0;
       
  3054     }
       
  3055 
       
  3056 void CCollectionTests::DoHandleCollectionTest0001L( const TMPXCollectionMessage& aMessage )
       
  3057     {
       
  3058     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen)
       
  3059         {
       
  3060         iCollectionUtility1->Collection().OpenL();
       
  3061         }
       
  3062     else
       
  3063         {
       
  3064         iLogger->Log( KTextImproperMsg );
       
  3065         TMC_ASSERT(EFalse, 1);
       
  3066         }
       
  3067     }
       
  3068     
       
  3069 void CCollectionTests::DoHandleCollectionTest0011L( const TMPXCollectionMessage& aMessage )
       
  3070     {
       
  3071     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen)
       
  3072         {
       
  3073         iLogger->Log( KTextPathChangedByOpen );
       
  3074         // To protect that 2 messages will be received from iCollectionUtility1 and iCollectionUtility2
       
  3075         if(iTempCnt++ == 0)
       
  3076             {
       
  3077             TMPXOpenMode openMode = EMPXOpenDefault;
       
  3078             switch( iTestIndex )
       
  3079                 {
       
  3080                 case 11:
       
  3081                     openMode = EMPXOpenDefault; break;
       
  3082                 case 13:
       
  3083                     openMode = EMPXOpenGroupOrPlaylist; break;
       
  3084                 case 15:
       
  3085                     openMode = EMPXOpenAllItems; break;
       
  3086                 case 17:
       
  3087                     openMode = EMPXOpenNoPlaylist; break;
       
  3088                 case 19:
       
  3089                 case 20: 
       
  3090                     openMode = EMPXOpenPlaylistOnly; break;
       
  3091                 default:
       
  3092                     break;
       
  3093                 };
       
  3094             iCollectionUtility2->Collection().OpenL( openMode );
       
  3095             }
       
  3096         }
       
  3097     else if(aMessage.Event() == TMPXCollectionMessage::ECollectionChanged)
       
  3098         {
       
  3099         iLogger->Log( KTextCollectionChange );
       
  3100         // If open at root level, only EMPXOpenDefault and EMPXOpenGroupOrPlaylist are supported
       
  3101         // otherwise, framework assume openmode has changed and reopen at root level
       
  3102         // For ETCFwCollectTest0015(0016), 0017(0018), and 0019(0020), we have to handle callback here
       
  3103         // However, TMPXOpenMode will be changed to support EMPXOpenDefault only later on
       
  3104         iLogger->Log( KTextPluginImpUid, aMessage.Data());
       
  3105         }
       
  3106     else
       
  3107         {
       
  3108         iLogger->Log( KTextImproperMsg );
       
  3109         TMC_ASSERT(EFalse, 1);
       
  3110         }
       
  3111     }
       
  3112 
       
  3113 void CCollectionTests::DoHandleCollectionTest0012L(const CMPXMedia& aEntries, TInt aIndex,TBool aComplete,TInt aError)
       
  3114     {
       
  3115     (void)aComplete;
       
  3116     (void)aIndex;
       
  3117     TMC_ASSERT(aError == KErrNone, 1);
       
  3118     
       
  3119     TMPXAttribute uidAttr(KMPXMediaIdGeneral,EMPXMediaGeneralId);
       
  3120     RArray<TMPXItemId> impUids;
       
  3121     CleanupClosePushL( impUids );
       
  3122     impUids.Append( KMusicCollectionUID );
       
  3123     impUids.Append( KPodcastCollectionUID );
       
  3124     impUids.Append( KCollectionTestPluginImpId );
       
  3125     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, impUids, 
       
  3126                                            uidAttr, CCollectionTests::CompareByTMPXItemId);
       
  3127     CleanupStack::PopAndDestroy( &impUids );
       
  3128     
       
  3129     TMC_ASSERT(match, 2);
       
  3130 
       
  3131 	// Each of tests 2-19 is closes and reopens so no need to Cancel.
       
  3132     RunNext();
       
  3133     }
       
  3134     
       
  3135 void CCollectionTests::DoHandleCollectionTest0021L(const CMPXMedia& aEntries,
       
  3136                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3137     {
       
  3138     if(iTestIndex == 20)
       
  3139     	{
       
  3140     	DELETE_COLLECTION_PTR(iCollectionUtility2);
       
  3141     	}
       
  3142 	else 
       
  3143 		{
       
  3144     	(void)aComplete;
       
  3145     	(void)aIndex;
       
  3146     	TMC_ASSERT(aError == KErrNone, 1);
       
  3147     
       
  3148     	TMPXAttribute uidAttr(KMPXMediaIdGeneral,EMPXMediaGeneralId);
       
  3149     	RArray<TMPXItemId> impUids;
       
  3150     	CleanupClosePushL( impUids );
       
  3151     	impUids.Append( KMusicCollectionUID );
       
  3152     	impUids.Append( KPodcastCollectionUID );
       
  3153     	impUids.Append( KCollectionTestPluginImpId );
       
  3154     	TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, impUids, 
       
  3155         	                              uidAttr, CCollectionTests::CompareByTMPXItemId);
       
  3156     	CleanupStack::PopAndDestroy( &impUids );
       
  3157     
       
  3158     	TMC_ASSERT(match, 2);
       
  3159     	}
       
  3160     	
       
  3161     RunNext();	
       
  3162     }
       
  3163 
       
  3164 void CCollectionTests::DoHandleCollectionTest0022L( const TMPXCollectionMessage& aMessage )
       
  3165     {
       
  3166     if(aMessage.Event() == TMPXCollectionMessage::ECollectionChanged)   // 1st
       
  3167         {
       
  3168         iLogger->Log( KTextCollectionChange );
       
  3169         iLogger->Log( KTextPluginImpUid, aMessage.Data());
       
  3170         }
       
  3171     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  3172         {
       
  3173         iLogger->Log( KTextPathChangedByOpen );
       
  3174         RunNext();
       
  3175         }
       
  3176     else
       
  3177         {
       
  3178         iLogger->Log( KTextImproperMsg );
       
  3179         TMC_ASSERT(EFalse, 1);
       
  3180         }
       
  3181     }
       
  3182 
       
  3183 void CCollectionTests::DoHandleCollectionTest0023L(const CMPXMedia& aEntries,
       
  3184                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3185     {
       
  3186     (void)aComplete;
       
  3187     (void)aIndex;
       
  3188     TMC_ASSERT(aError == KErrNone, 1);
       
  3189 
       
  3190     RArray<TMPXItemId> itemIds;
       
  3191     CleanupClosePushL( itemIds );
       
  3192     TMPXAttribute itemAttr(KMPXMediaGeneralId);
       
  3193     itemIds.Append( 11 );
       
  3194     itemIds.Append( 12 );
       
  3195     itemIds.Append( 13 );
       
  3196     itemIds.Append( 990 );
       
  3197     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, itemIds, 
       
  3198                                              itemAttr, CCollectionTests::CompareByTMPXItemId);
       
  3199     CleanupStack::PopAndDestroy( &itemIds );
       
  3200     TMC_ASSERT(match, 2);
       
  3201     RunNext();
       
  3202     }
       
  3203 
       
  3204 void CCollectionTests::DoHandleCollectionTest0029L( const TMPXCollectionMessage& aMessage )
       
  3205     {
       
  3206     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen)
       
  3207         {
       
  3208         iLogger->Log( KTextPathChangedByOpen );
       
  3209         iCollectionUtility1->Collection().OpenL();
       
  3210         }
       
  3211     else
       
  3212         {
       
  3213         iLogger->Log( KTextImproperMsg );
       
  3214         TMC_ASSERT(EFalse, 1);
       
  3215         }
       
  3216     }
       
  3217     
       
  3218 void CCollectionTests::DoHandleCollectionTest0029L(const CMPXMedia& aEntries,
       
  3219                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3220     {
       
  3221     (void)aComplete;
       
  3222     (void)aIndex;
       
  3223     TMC_ASSERT(aError == KErrNone, 2);
       
  3224 
       
  3225     RArray<TMPXItemId> itemIds;
       
  3226     CleanupClosePushL( itemIds );
       
  3227     TMPXAttribute itemAttr(KMPXMediaGeneralId);
       
  3228     itemIds.Append( 211 );
       
  3229     itemIds.Append( 212 );
       
  3230     itemIds.Append( 213 );
       
  3231     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, itemIds, 
       
  3232                                         itemAttr, CCollectionTests::CompareByTMPXItemId);
       
  3233     CleanupStack::PopAndDestroy( &itemIds );
       
  3234     TMC_ASSERT(match, 3);
       
  3235     RunNext();
       
  3236     }
       
  3237 
       
  3238 void CCollectionTests::DoHandleCollectionTest0030L( const TMPXCollectionMessage& aMessage )
       
  3239     {
       
  3240     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen)
       
  3241         {
       
  3242         iLogger->Log( KTextPathChangedByOpen );
       
  3243         RunNext();
       
  3244         }
       
  3245     else
       
  3246         {
       
  3247         iLogger->Log( KTextImproperMsg );
       
  3248         TMC_ASSERT(EFalse, 1);
       
  3249         }
       
  3250     }
       
  3251     
       
  3252 void CCollectionTests::DoHandleCollectionTest0031L(const CMPXMedia& aEntries,
       
  3253                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3254     {
       
  3255     (void)aComplete;
       
  3256     (void)aIndex;
       
  3257     TMC_ASSERT(aError == KErrNone, 1);
       
  3258 
       
  3259     RArray<TMPXItemId> itemIds;
       
  3260     CleanupClosePushL( itemIds );
       
  3261     TMPXAttribute itemAttr(KMPXMediaGeneralId);
       
  3262     itemIds.Append( 11 );
       
  3263     itemIds.Append( 12 );
       
  3264     itemIds.Append( 13 );
       
  3265     itemIds.Append( 990 );
       
  3266     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, itemIds, 
       
  3267                                           itemAttr, CCollectionTests::CompareByTMPXItemId);
       
  3268     CleanupStack::PopAndDestroy( &itemIds );
       
  3269     TMC_ASSERT(match, 2);
       
  3270     RunNext();
       
  3271     }
       
  3272 
       
  3273 void CCollectionTests::DoHandleCollectionTest0032L( const TMPXCollectionMessage& aMessage )
       
  3274     {
       
  3275     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen)
       
  3276         {
       
  3277         iLogger->Log( KTextPathChangedByOpen );
       
  3278         RunNext();
       
  3279         }
       
  3280     else
       
  3281         {
       
  3282         iLogger->Log( KTextImproperMsg );
       
  3283         TMC_ASSERT(EFalse, 1);
       
  3284         }
       
  3285     }
       
  3286 
       
  3287 void CCollectionTests::DoHandleCollectionTest0033L(const CMPXMedia& aEntries,
       
  3288                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3289     {
       
  3290     (void)aComplete;
       
  3291     (void)aIndex;
       
  3292     TMC_ASSERT(aError == KErrNone, 1);
       
  3293 
       
  3294     // Match Id
       
  3295     RArray<TMPXItemId> itemIds;
       
  3296     CleanupClosePushL( itemIds );
       
  3297     TMPXAttribute itemAttr(KMPXMediaGeneralId);
       
  3298     itemIds.Append( 221 );
       
  3299     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, itemIds, 
       
  3300                                               itemAttr, CCollectionTests::CompareByTMPXItemId);
       
  3301     CleanupStack::PopAndDestroy( &itemIds );
       
  3302     TMC_ASSERT(match, 2);
       
  3303     
       
  3304     // Match Uri
       
  3305     CDesCArrayFlat* textArray = new (ELeave) CDesCArrayFlat( 2 );
       
  3306     CleanupStack::PushL( textArray );
       
  3307     TMPXAttribute uriAttr(KMPXMediaGeneralUri);
       
  3308     textArray->AppendL( KNullDesC );
       
  3309     match = TestUtility::MatchMediaArrayTextObject(aEntries, *textArray, uriAttr);
       
  3310     CleanupStack::PopAndDestroy( textArray );
       
  3311     TMC_ASSERT(match, 3);
       
  3312     
       
  3313     // Match Title - should not contain this attribute
       
  3314     textArray = new (ELeave) CDesCArrayFlat( 2 );
       
  3315     CleanupStack::PushL( textArray );
       
  3316     TMPXAttribute titleAttr(KMPXMediaGeneralTitle);
       
  3317     textArray->AppendL( _L("level221") );
       
  3318     match = TestUtility::MatchMediaArrayTextObject(aEntries, *textArray, titleAttr);
       
  3319     CleanupStack::PopAndDestroy( textArray );
       
  3320     TMC_ASSERT(match == EFalse, 4);
       
  3321     
       
  3322     RunNext();
       
  3323     }
       
  3324 
       
  3325 void CCollectionTests::DoHandleCollectionTest0034L( const TMPXCollectionMessage& aMessage )
       
  3326     {
       
  3327     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen)
       
  3328         {
       
  3329         iLogger->Log( KTextPathChangedByOpen );
       
  3330         RunNext();
       
  3331         }
       
  3332     else
       
  3333         {
       
  3334         iLogger->Log( KTextImproperMsg );
       
  3335         TMC_ASSERT(EFalse, 1);
       
  3336         }
       
  3337     }
       
  3338 
       
  3339 void CCollectionTests::DoHandleCollectionTest0035L(const CMPXMedia& aEntries,
       
  3340                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3341     {
       
  3342     (void)aComplete;
       
  3343     (void)aIndex;
       
  3344     TMC_ASSERT(aError == KErrNone, 1);
       
  3345 
       
  3346     // Match Id
       
  3347     RArray<TMPXItemId> itemIds;
       
  3348     CleanupClosePushL( itemIds );
       
  3349     TMPXAttribute itemAttr(KMPXMediaGeneralId);
       
  3350     itemIds.Append( 231 );
       
  3351     itemIds.Append( 232 );
       
  3352     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, itemIds, 
       
  3353                                             itemAttr, CCollectionTests::CompareByTMPXItemId);
       
  3354     CleanupStack::PopAndDestroy( &itemIds );
       
  3355     TMC_ASSERT(match, 2);
       
  3356     
       
  3357     // Match Uri
       
  3358     CDesCArrayFlat* textArray = new (ELeave) CDesCArrayFlat( 2 );
       
  3359     CleanupStack::PushL( textArray );
       
  3360     TMPXAttribute uriAttr(KMPXMediaGeneralUri);
       
  3361     textArray->AppendL( KNullDesC );
       
  3362     textArray->AppendL( KNullDesC );
       
  3363     match = TestUtility::MatchMediaArrayTextObject(aEntries, *textArray, uriAttr);
       
  3364     CleanupStack::PopAndDestroy( textArray );
       
  3365     TMC_ASSERT(match, 3);
       
  3366     
       
  3367     // Match Title - should not contain this attribute
       
  3368     textArray = new (ELeave) CDesCArrayFlat( 2 );
       
  3369     CleanupStack::PushL( textArray );
       
  3370     TMPXAttribute titleAttr(KMPXMediaGeneralTitle);
       
  3371     textArray->AppendL( _L("level231") );
       
  3372     textArray->AppendL( _L("level232") );
       
  3373     match = TestUtility::MatchMediaArrayTextObject(aEntries, *textArray, titleAttr);
       
  3374     CleanupStack::PopAndDestroy( textArray );
       
  3375     TMC_ASSERT(match == EFalse, 4);
       
  3376     
       
  3377     RunNext();
       
  3378     }
       
  3379 
       
  3380 void CCollectionTests::DoHandleCollectionTest0036L( const TMPXCollectionMessage& aMessage )
       
  3381     {
       
  3382     if(aMessage.Event() == TMPXCollectionMessage::ECollectionChanged)   // 1st
       
  3383         {
       
  3384         iLogger->Log( KTextCollectionChange );
       
  3385         iLogger->Log( KTextPluginImpUid, aMessage.Data());
       
  3386         }
       
  3387     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  3388         {
       
  3389         iLogger->Log( KTextPathChangedByOpen );
       
  3390         RunNext();
       
  3391         // iCollectionUtility1->Collection().OpenL();   // TODO: may update later
       
  3392         }
       
  3393     else
       
  3394         {
       
  3395         iLogger->Log( KTextImproperMsg );
       
  3396         TMC_ASSERT(EFalse, 1);
       
  3397         }
       
  3398     }
       
  3399     
       
  3400 void CCollectionTests::DoHandleCollectionTest0036L(const CMPXMedia& aEntries,
       
  3401                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3402     {
       
  3403     // TODO: Update may require
       
  3404     (void)aComplete;
       
  3405     (void)aIndex;
       
  3406     TMC_ASSERT(aError == KErrNone, 2);
       
  3407 
       
  3408     // Match Id
       
  3409     RArray<TMPXItemId> itemIds;
       
  3410     CleanupClosePushL( itemIds );
       
  3411     TMPXAttribute itemAttr(KMPXMediaGeneralId);
       
  3412     itemIds.Append( 231 );
       
  3413     itemIds.Append( 232 );
       
  3414     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, itemIds, 
       
  3415                                                    itemAttr, CCollectionTests::CompareByTMPXItemId);
       
  3416     CleanupStack::PopAndDestroy( &itemIds );
       
  3417     TMC_ASSERT(match, 3);
       
  3418     
       
  3419     // Match Uri
       
  3420     CDesCArrayFlat* textArray = new (ELeave) CDesCArrayFlat( 2 );
       
  3421     CleanupStack::PushL( textArray );
       
  3422     TMPXAttribute uriAttr(KMPXMediaGeneralUri);
       
  3423     textArray->AppendL( KNullDesC );
       
  3424     textArray->AppendL( KNullDesC );
       
  3425     match = TestUtility::MatchMediaArrayTextObject(aEntries, *textArray, uriAttr);
       
  3426     CleanupStack::PopAndDestroy( textArray );
       
  3427     TMC_ASSERT(match, 4);
       
  3428     
       
  3429     // Match Title
       
  3430     textArray = new (ELeave) CDesCArrayFlat( 2 );
       
  3431     CleanupStack::PushL( textArray );
       
  3432     TMPXAttribute titleAttr(KMPXMediaGeneralTitle);
       
  3433     textArray->AppendL( _L("level231") );
       
  3434     textArray->AppendL( _L("level232") );
       
  3435     match = TestUtility::MatchMediaArrayTextObject(aEntries, *textArray, titleAttr);
       
  3436     CleanupStack::PopAndDestroy( textArray );
       
  3437     TMC_ASSERT(match, 5);
       
  3438     
       
  3439     RunNext();
       
  3440     }
       
  3441 
       
  3442 void CCollectionTests::DoHandleCollectionTest0037L( const TMPXCollectionMessage& aMessage )
       
  3443     {
       
  3444     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen)
       
  3445         {
       
  3446         iLogger->Log( KTextPathChangedByOpen );
       
  3447         RunNext();
       
  3448         }
       
  3449     else
       
  3450         {
       
  3451         iLogger->Log( KTextImproperMsg );
       
  3452         TMC_ASSERT(EFalse, 1);
       
  3453         }
       
  3454     }
       
  3455     
       
  3456 void CCollectionTests::DoHandleCollectionTest0038L(const CMPXMedia& aEntries,
       
  3457                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3458     {
       
  3459     (void)aComplete;
       
  3460     (void)aIndex;
       
  3461     TMC_ASSERT(aError == KErrNone, 1);
       
  3462 
       
  3463     // Match Id
       
  3464     RArray<TMPXItemId> itemIds;
       
  3465     CleanupClosePushL( itemIds );
       
  3466     TMPXAttribute itemAttr(KMPXMediaGeneralId);
       
  3467     itemIds.Append( KPodcastCollectionUID );
       
  3468     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, itemIds, 
       
  3469                                              itemAttr, CCollectionTests::CompareByTMPXItemId);
       
  3470     CleanupStack::PopAndDestroy( &itemIds );
       
  3471     TMC_ASSERT(match, 2);
       
  3472     
       
  3473     RunNext();
       
  3474     }
       
  3475 
       
  3476 void CCollectionTests::DoHandleCollectionTest0039L( const TMPXCollectionMessage& aMessage )
       
  3477     {
       
  3478     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen)
       
  3479         {
       
  3480         iLogger->Log( KTextPathChangedByOpen );
       
  3481         iCollectionUtility1->Collection().OpenL( EMPXOpenDefault );
       
  3482         }
       
  3483     else
       
  3484         {
       
  3485         iLogger->Log( KTextImproperMsg );
       
  3486         TMC_ASSERT(EFalse, 1);
       
  3487         }
       
  3488     }
       
  3489 void CCollectionTests::DoHandleCollectionTest0039L(const CMPXMedia& aEntries,
       
  3490                                      TInt aIndex,TBool aComplete,TInt aError)
       
  3491     {
       
  3492     (void)aComplete;
       
  3493     (void)aIndex;
       
  3494     TMC_ASSERT(aError == KErrNone, 2);
       
  3495 
       
  3496     // Match Id
       
  3497     RArray<TMPXItemId> itemIds;
       
  3498     CleanupClosePushL( itemIds );
       
  3499     TMPXAttribute itemAttr(KMPXMediaGeneralId);
       
  3500     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, itemIds, 
       
  3501                                           itemAttr, CCollectionTests::CompareByTMPXItemId);
       
  3502     CleanupStack::PopAndDestroy( &itemIds );
       
  3503     TMC_ASSERT(match, 3);
       
  3504     
       
  3505     RunNext();
       
  3506     }
       
  3507 
       
  3508 void CCollectionTests::DoHandleCollectionTest0040L( const TMPXCollectionMessage& aMessage )
       
  3509     {
       
  3510     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  3511         {
       
  3512         iLogger->Log( KTextPathChangedByOpen );
       
  3513         RunNext();
       
  3514         }
       
  3515     else
       
  3516         {
       
  3517         iLogger->Log( KTextImproperMsg );
       
  3518         TMC_ASSERT(EFalse, 1);
       
  3519         }
       
  3520     }
       
  3521 
       
  3522 void CCollectionTests::DoHandleCollectionTest0041L(const CMPXMedia& aEntries,
       
  3523                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3524     {
       
  3525     (void)aComplete;
       
  3526     (void)aIndex;
       
  3527     TMC_ASSERT(aError == KErrNone, 1);
       
  3528 
       
  3529     // Match Id
       
  3530     RArray<TMPXItemId> itemIds;
       
  3531     CleanupClosePushL( itemIds );
       
  3532     TMPXAttribute itemAttr(KMPXMediaGeneralId);
       
  3533     itemIds.Append( KCollectionTestPluginImpId );
       
  3534     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, itemIds, 
       
  3535                                          itemAttr, CCollectionTests::CompareByTMPXItemId);
       
  3536     CleanupStack::PopAndDestroy( &itemIds );
       
  3537     TMC_ASSERT(match, 2);
       
  3538     
       
  3539     RunNext();
       
  3540     }
       
  3541 
       
  3542 void CCollectionTests::DoHandleCollectionTest0043L( const TMPXCollectionMessage& aMessage )
       
  3543     {
       
  3544     if(aMessage.Event() == TMPXCollectionMessage::ECollectionChanged)   // 1st
       
  3545         {
       
  3546         iLogger->Log( KTextCollectionChange );
       
  3547         iLogger->Log( KTextPluginImpUid, aMessage.Data());
       
  3548         }
       
  3549     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  3550         {
       
  3551         iLogger->Log( KTextPathChangedByOpen );
       
  3552         RunNext();
       
  3553         }
       
  3554     else
       
  3555         {
       
  3556         iLogger->Log( KTextImproperMsg );
       
  3557         TMC_ASSERT(EFalse, 1);
       
  3558         }
       
  3559     }
       
  3560 
       
  3561 void CCollectionTests::DoHandleCollectionTest0044L(const CMPXMedia& aEntries,
       
  3562                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3563     {
       
  3564     (void)aComplete;
       
  3565     (void)aIndex;
       
  3566     TMC_ASSERT(aError == KErrNone, 1);
       
  3567 
       
  3568     // Match Id
       
  3569     RArray<TMPXItemId> itemIds;
       
  3570     CleanupClosePushL( itemIds );
       
  3571     TMPXAttribute itemAttr(KMPXMediaGeneralId);
       
  3572     itemIds.Append( 212 );
       
  3573     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, itemIds, 
       
  3574                                             itemAttr, CCollectionTests::CompareByTMPXItemId);
       
  3575     CleanupStack::PopAndDestroy( &itemIds );
       
  3576     TMC_ASSERT(match, 2);
       
  3577     
       
  3578     // Match Uri
       
  3579     CDesCArrayFlat* textArray = new (ELeave) CDesCArrayFlat( 2 );
       
  3580     CleanupStack::PushL( textArray );
       
  3581     TMPXAttribute uriAttr(KMPXMediaGeneralUri);
       
  3582     textArray->AppendL( KNullDesC );
       
  3583     match = TestUtility::MatchMediaArrayTextObject(aEntries, *textArray, uriAttr);
       
  3584     CleanupStack::PopAndDestroy( textArray );
       
  3585     TMC_ASSERT(match, 3);
       
  3586     
       
  3587     // Match Title
       
  3588     textArray = new (ELeave) CDesCArrayFlat( 2 );
       
  3589     CleanupStack::PushL( textArray );
       
  3590     TMPXAttribute titleAttr(KMPXMediaGeneralTitle);
       
  3591     textArray->AppendL( _L("level212") );
       
  3592     match = TestUtility::MatchMediaArrayTextObject(aEntries, *textArray, titleAttr);
       
  3593     CleanupStack::PopAndDestroy( textArray );
       
  3594     TMC_ASSERT(match, 4);
       
  3595     
       
  3596     RunNext();
       
  3597     }
       
  3598 
       
  3599 void CCollectionTests::DoHandleCollectionTest0047L( const TMPXCollectionMessage& aMessage )
       
  3600     {
       
  3601     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  3602         {
       
  3603         iLogger->Log( KTextPathChangedByOpen );
       
  3604         RunNext();
       
  3605         }
       
  3606     else
       
  3607         {
       
  3608         iLogger->Log( KTextImproperMsg );
       
  3609         TMC_ASSERT(EFalse, 1);
       
  3610         }
       
  3611     }
       
  3612     
       
  3613 void CCollectionTests::DoHandleCollectionTest0048L(const CMPXMedia& aEntries,
       
  3614                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3615     {
       
  3616     (void)aComplete;
       
  3617     (void)aIndex;
       
  3618     TMC_ASSERT(aError == KErrNone, 1);
       
  3619 
       
  3620     // Match Id
       
  3621     RArray<TMPXItemId> itemIds;
       
  3622     CleanupClosePushL( itemIds );
       
  3623     TMPXAttribute itemAttr(KMPXMediaGeneralId);
       
  3624     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, itemIds, 
       
  3625                                             itemAttr, CCollectionTests::CompareByTMPXItemId);
       
  3626     CleanupStack::PopAndDestroy( &itemIds );
       
  3627     TMC_ASSERT(match, 2);
       
  3628     
       
  3629     // Match Uri
       
  3630     CDesCArrayFlat* textArray = new (ELeave) CDesCArrayFlat( 2 );
       
  3631     CleanupStack::PushL( textArray );
       
  3632     TMPXAttribute uriAttr(KMPXMediaGeneralUri);
       
  3633     match = TestUtility::MatchMediaArrayTextObject(aEntries, *textArray, uriAttr);
       
  3634     CleanupStack::PopAndDestroy( textArray );
       
  3635     TMC_ASSERT(match, 3);
       
  3636     
       
  3637     // Match Title
       
  3638     textArray = new (ELeave) CDesCArrayFlat( 2 );
       
  3639     CleanupStack::PushL( textArray );
       
  3640     TMPXAttribute titleAttr(KMPXMediaGeneralTitle);
       
  3641     match = TestUtility::MatchMediaArrayTextObject(aEntries, *textArray, titleAttr);
       
  3642     CleanupStack::PopAndDestroy( textArray );
       
  3643     TMC_ASSERT(match, 4);
       
  3644     
       
  3645     RunNext();
       
  3646     }
       
  3647 
       
  3648 void CCollectionTests::DoHandleCollectionTest0051L( const TMPXCollectionMessage& aMessage )
       
  3649     {
       
  3650     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  3651         {
       
  3652         iLogger->Log( KTextPathChangedByOpen );
       
  3653         RunNext();
       
  3654         }
       
  3655     else
       
  3656         {
       
  3657         iLogger->Log( KTextImproperMsg );
       
  3658         TMC_ASSERT(EFalse, 1);
       
  3659         }
       
  3660     }
       
  3661 
       
  3662 void CCollectionTests::DoHandleCollectionTest0052L(const CMPXMedia& aEntries,
       
  3663                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3664     {
       
  3665     (void)aComplete;
       
  3666     (void)aIndex;
       
  3667     TMC_ASSERT(aError == KErrNone, 1);
       
  3668 
       
  3669     // Match Id
       
  3670     RArray<TMPXItemId> itemIds;
       
  3671     CleanupClosePushL( itemIds );
       
  3672     TMPXAttribute itemAttr(KMPXMediaGeneralId);
       
  3673     itemIds.Append( 211 );
       
  3674     itemIds.Append( 212 );
       
  3675     itemIds.Append( 213 );
       
  3676     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, itemIds, 
       
  3677                                               itemAttr, CCollectionTests::CompareByTMPXItemId);
       
  3678     CleanupStack::PopAndDestroy( &itemIds );
       
  3679     TMC_ASSERT(match, 2);
       
  3680     
       
  3681     // Match Uri
       
  3682     CDesCArrayFlat* textArray = new (ELeave) CDesCArrayFlat( 2 );
       
  3683     CleanupStack::PushL( textArray );
       
  3684     TMPXAttribute uriAttr(KMPXMediaGeneralUri);
       
  3685     textArray->AppendL( KNullDesC );
       
  3686     textArray->AppendL( KNullDesC );
       
  3687     textArray->AppendL( KNullDesC );
       
  3688     match = TestUtility::MatchMediaArrayTextObject(aEntries, *textArray, uriAttr);
       
  3689     CleanupStack::PopAndDestroy( textArray );
       
  3690     TMC_ASSERT(match, 3);
       
  3691     
       
  3692     // Match Title
       
  3693     textArray = new (ELeave) CDesCArrayFlat( 2 );
       
  3694     CleanupStack::PushL( textArray );
       
  3695     TMPXAttribute titleAttr(KMPXMediaGeneralTitle);
       
  3696     textArray->AppendL( _L("level211") );
       
  3697     textArray->AppendL( _L("level212") );
       
  3698     textArray->AppendL( _L("level213") );
       
  3699     match = TestUtility::MatchMediaArrayTextObject(aEntries, *textArray, titleAttr);
       
  3700     CleanupStack::PopAndDestroy( textArray );
       
  3701     TMC_ASSERT(match, 4);
       
  3702     
       
  3703    	RunNext();
       
  3704     }
       
  3705 
       
  3706 void CCollectionTests::DoHandleCollectionTest0056L( const TMPXCollectionMessage& aMessage )
       
  3707     {
       
  3708     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  3709         {
       
  3710         iLogger->Log( KTextPathChangedByOpen );
       
  3711         
       
  3712         CMPXCollectionPath* path = iCollectionUtility1->Collection().PathL();
       
  3713         CleanupStack::PushL( path );
       
  3714         
       
  3715         TMC_ASSERT(path->Levels() == 1, 1);
       
  3716         TMC_ASSERT(path->Count() == KRootLvPluginNum, 2);
       
  3717         TMC_ASSERT(path->Index(0) == 0, 3);
       
  3718         TMC_ASSERT(path->Id(0).iId1 == (TInt)KMusicCollectionUID, 4);
       
  3719         path->SetToFirst();
       
  3720         TMC_ASSERT(path->Id().iId1 == (TInt)KMusicCollectionUID, 5);
       
  3721         ++(*path);
       
  3722         TMC_ASSERT(path->Id().iId1 == (TInt)KPodcastCollectionUID, 6);
       
  3723         ++(*path);
       
  3724         TMC_ASSERT(path->Id().iId1 == (TInt)KCollectionTestPluginImpId, 7);
       
  3725         
       
  3726         CleanupStack::PopAndDestroy( path );        
       
  3727         RunNext();
       
  3728         }
       
  3729     else
       
  3730         {
       
  3731         iLogger->Log( KTextImproperMsg );
       
  3732         TMC_ASSERT(EFalse, 1);
       
  3733         }
       
  3734     }
       
  3735 
       
  3736 void CCollectionTests::DoHandleCollectionTest0057L( const TMPXCollectionMessage& aMessage )
       
  3737     {
       
  3738     if(aMessage.Event() == TMPXCollectionMessage::ECollectionChanged)   // 1st
       
  3739         {
       
  3740         iLogger->Log( KTextCollectionChange );
       
  3741         iLogger->Log( KTextPluginImpUid, aMessage.Data());
       
  3742         }
       
  3743     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  3744         {
       
  3745         iLogger->Log( KTextPathChangedByOpen );
       
  3746         CMPXCollectionPath* path = iCollectionUtility1->Collection().PathL();
       
  3747         CleanupStack::PushL( path );
       
  3748         
       
  3749         TMC_ASSERT(path->Levels() == 2, 1);
       
  3750         TMC_ASSERT(path->Count() == 4, 2);
       
  3751         TMC_ASSERT(path->Index(0) == KColTestPluginIndex, 3);
       
  3752         TMC_ASSERT(path->Id(0) == (TInt)KCollectionTestPluginImpId, 4);
       
  3753         TMC_ASSERT(path->Index(1) == 0, 5);
       
  3754         TMC_ASSERT(path->Id(1) == 11, 6);
       
  3755         path->SetToFirst();
       
  3756         TMC_ASSERT(path->Id() == 11, 7);
       
  3757         ++(*path);
       
  3758         TMC_ASSERT(path->Id() == 12, 8);
       
  3759         ++(*path);
       
  3760         TMC_ASSERT(path->Id() == 13, 9);
       
  3761         ++(*path);
       
  3762         TMC_ASSERT(path->Id() == 990, 9);
       
  3763 
       
  3764         CleanupStack::PopAndDestroy( path );
       
  3765         RunNext();
       
  3766         }
       
  3767     else
       
  3768         {
       
  3769         iLogger->Log( KTextImproperMsg );
       
  3770         TMC_ASSERT(EFalse, 1);
       
  3771         }
       
  3772     }
       
  3773 
       
  3774 void CCollectionTests::DoHandleCollectionTest0058L( const TMPXCollectionMessage& aMessage )
       
  3775     {
       
  3776     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  3777         {
       
  3778         iLogger->Log( KTextPathChangedByOpen );
       
  3779         CMPXCollectionPath* path = iCollectionUtility1->Collection().PathL();
       
  3780         CleanupStack::PushL( path );
       
  3781         
       
  3782         TMC_ASSERT(path->Levels() == 3, 1);
       
  3783         TMC_ASSERT(path->Count() == 2, 2);
       
  3784         TMC_ASSERT(path->Index(0) == KColTestPluginIndex, 3);
       
  3785         TMC_ASSERT(path->Id(0) == (TInt)KCollectionTestPluginImpId, 4);
       
  3786         TMC_ASSERT(path->Index(1) == 2, 5);
       
  3787         TMC_ASSERT(path->Id(1) == 13, 6);
       
  3788         TMC_ASSERT(path->Index(2) == 0, 7);
       
  3789         TMC_ASSERT(path->Id(2) == 231, 8);
       
  3790         path->SetToFirst();
       
  3791         TMC_ASSERT(path->Id() == 231, 9);
       
  3792         ++(*path);
       
  3793         TMC_ASSERT(path->Id() == 232, 10);
       
  3794         
       
  3795         CleanupStack::PopAndDestroy( path );
       
  3796         
       
  3797         RunNext();
       
  3798         }
       
  3799     else
       
  3800         {
       
  3801         iLogger->Log( KTextImproperMsg );
       
  3802         TMC_ASSERT(EFalse, 1);
       
  3803         }
       
  3804     }
       
  3805 
       
  3806 void CCollectionTests::DoHandleCollectionTest0059L( const TMPXCollectionMessage& aMessage )
       
  3807     {
       
  3808     if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  3809         {
       
  3810         iLogger->Log( KTextPathChangedByOpen );
       
  3811         iCollectionUtility1->Collection().OpenL();
       
  3812         }
       
  3813     else
       
  3814         {
       
  3815         iLogger->Log( KTextImproperMsg );
       
  3816         TMC_ASSERT(EFalse, 1);
       
  3817         }
       
  3818     }
       
  3819 
       
  3820 void CCollectionTests::DoHandleCollectionTest0059L(const CMPXMedia& aEntries,
       
  3821                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3822     {
       
  3823     (void)aComplete;
       
  3824     (void)aIndex;
       
  3825     TMC_ASSERT(aError == KErrNone, 1);
       
  3826     
       
  3827     TMPXAttribute idAttr(KMPXMediaIdGeneral,EMPXMediaGeneralId);
       
  3828     RArray<TMPXItemId> ids;
       
  3829     CleanupClosePushL( ids );
       
  3830     ids.Append( 11 );
       
  3831     ids.Append( 12 );
       
  3832     ids.Append( 13 );
       
  3833     ids.Append( 990 );
       
  3834     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, ids, 
       
  3835                                               idAttr, CCollectionTests::CompareByTMPXItemId);
       
  3836     CleanupStack::PopAndDestroy( &ids );
       
  3837     
       
  3838     TMC_ASSERT(match, 2);
       
  3839     TMC_ASSERT(aIndex == 2, 3);
       
  3840     RunNext();
       
  3841     }
       
  3842 
       
  3843 void CCollectionTests::DoHandleCollectionTest0060L( const TMPXCollectionMessage& aMessage )
       
  3844     {
       
  3845     if(aMessage.Event() == TMPXCollectionMessage::ECollectionChanged)   // 1st
       
  3846         {
       
  3847         iLogger->Log( KTextCollectionChange );
       
  3848         iLogger->Log( KTextPluginImpUid, aMessage.Data());
       
  3849         }
       
  3850     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  3851         {
       
  3852         iLogger->Log( KTextPathChangedByOpen );
       
  3853         iCollectionUtility1->Collection().OpenL();
       
  3854         }
       
  3855     else
       
  3856         {
       
  3857         iLogger->Log( KTextImproperMsg );
       
  3858         TMC_ASSERT(EFalse, 1);
       
  3859         }
       
  3860     }
       
  3861 
       
  3862 void CCollectionTests::DoHandleCollectionTest0060L(const CMPXMedia& aEntries,
       
  3863                                                   TInt aIndex,TBool aComplete,TInt aError)
       
  3864     {
       
  3865     (void)aComplete;
       
  3866     (void)aIndex;
       
  3867     TMC_ASSERT(aError == KErrNone, 1);
       
  3868     
       
  3869     TMPXAttribute uidAttr(KMPXMediaIdGeneral,EMPXMediaGeneralId);
       
  3870     RArray<TMPXItemId> impUids;
       
  3871     CleanupClosePushL( impUids );
       
  3872     impUids.Append( KMusicCollectionUID );
       
  3873     impUids.Append( KPodcastCollectionUID );
       
  3874     impUids.Append( KCollectionTestPluginImpId );
       
  3875     TBool match = TestUtility::MatchMediaArrayObject<TMPXItemId>(aEntries, impUids, 
       
  3876                                               uidAttr, CCollectionTests::CompareByTMPXItemId);
       
  3877     CleanupStack::PopAndDestroy( &impUids );
       
  3878     
       
  3879     TMC_ASSERT(match, 2);
       
  3880     TMC_ASSERT(aIndex == KColTestPluginIndex, 3);
       
  3881     
       
  3882     RunNext();
       
  3883     }
       
  3884 
       
  3885 void CCollectionTests::DoHandleCollectionTest0078L( const TMPXCollectionMessage& aMessage )
       
  3886     {
       
  3887     if(aMessage.Event() == TMPXCollectionMessage::EItemChanged &&
       
  3888        aMessage.Type() == EMcItemInserted &&
       
  3889        aMessage.Data() == 78)   // 1st
       
  3890         {
       
  3891         iLogger->Log( _L("Insertion of item Id 78 received") );
       
  3892         
       
  3893         RunNext();
       
  3894         }
       
  3895     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged &&
       
  3896             aMessage.Type() == EMcPathChangedByCollectionChange)    // 2nd
       
  3897         {
       
  3898         iLogger->Log( _L("PathChangeByCollectionChange received") );
       
  3899         RunNext();
       
  3900         }
       
  3901     else
       
  3902         {
       
  3903         iLogger->Log( KTextImproperMsg );
       
  3904         TMC_ASSERT(EFalse, 2);
       
  3905         }
       
  3906     }
       
  3907 
       
  3908 void CCollectionTests::DoHandleCollectionTest0079L( const TMPXCollectionMessage& aMessage )
       
  3909     {
       
  3910     if(aMessage.Event() == TMPXCollectionMessage::EItemChanged &&
       
  3911        aMessage.Type() == EMcItemInserted &&
       
  3912        aMessage.Data() == 79)   // 1st
       
  3913         {
       
  3914         iLogger->Log( _L("Insertion of item Id 79 received") );   
       
  3915 /*         
       
  3916         }
       
  3917     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged &&
       
  3918             aMessage.Type() == EMcPathChangedByCollectionChange)    // 2nd
       
  3919         {
       
  3920         iLogger->Log( _L("PathChangeByCollectionChange received") );
       
  3921 */        
       
  3922         if(--iTempCnt <= 0)
       
  3923             {
       
  3924             // 2 sets of callbacks received
       
  3925             RunNext();
       
  3926             }
       
  3927         }
       
  3928     else
       
  3929         {
       
  3930         iLogger->Log( KTextImproperMsg );
       
  3931         TMC_ASSERT(EFalse, 2);
       
  3932         }
       
  3933     }
       
  3934 
       
  3935 void CCollectionTests::DoHandleCollectionTest0080L( const TMPXCollectionMessage& aMessage )
       
  3936     {
       
  3937     if(aMessage.Event() == TMPXCollectionMessage::EItemChanged &&
       
  3938        aMessage.Type() == EMcItemInserted && //EMcPlaylistInserted &&
       
  3939        aMessage.Data() == 80)   // 1st
       
  3940         {
       
  3941         iLogger->Log( _L("Insertion of playlist Id 80 received") );
       
  3942         
       
  3943         RunNext();
       
  3944         }
       
  3945     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged &&
       
  3946             aMessage.Type() == EMcPathChangedByCollectionChange)    // 2nd
       
  3947         {
       
  3948         iLogger->Log( _L("PathChangeByCollectionChange received") );
       
  3949 
       
  3950         RunNext();
       
  3951         }
       
  3952     else
       
  3953         {
       
  3954         iLogger->Log( KTextImproperMsg );
       
  3955         TMC_ASSERT(EFalse, 2);
       
  3956         }
       
  3957     }
       
  3958     
       
  3959 void CCollectionTests::DoHandleCollectionTest0084L( const TMPXCollectionMessage& aMessage )
       
  3960     {
       
  3961     if(aMessage.Event() == TMPXCollectionMessage::EError &&
       
  3962        aMessage.Type() == EMcsRemovePath &&
       
  3963        aMessage.Data() == KErrNotReady)
       
  3964         {
       
  3965         iLogger->Log( _L("RemoveL error message recieved: KErrNotReady") );
       
  3966         RunNext();
       
  3967         }
       
  3968     else
       
  3969         {
       
  3970         iLogger->Log( KTextImproperMsg );
       
  3971         TMC_ASSERT(EFalse, 2);
       
  3972         }
       
  3973     }
       
  3974     
       
  3975 void CCollectionTests::DoHandleCollectionTest0085L( const TMPXCollectionMessage& aMessage )
       
  3976     {
       
  3977     if(aMessage.Event() == TMPXCollectionMessage::ECollectionChanged)   // 1st
       
  3978         {
       
  3979         iLogger->Log( KTextCollectionChange );
       
  3980         iLogger->Log( KTextPluginImpUid, aMessage.Data());
       
  3981         }
       
  3982     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && 
       
  3983             aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  3984         {
       
  3985         iLogger->Log( KTextPathChangedByOpen );
       
  3986         RunNext();
       
  3987         }
       
  3988     else
       
  3989         {
       
  3990         iLogger->Log( KTextImproperMsg );
       
  3991         TMC_ASSERT(EFalse, 1);
       
  3992         }
       
  3993     }
       
  3994 
       
  3995 void CCollectionTests::DoHandleCollectionTest0086L( const TMPXCollectionMessage& aMessage )
       
  3996     {
       
  3997     if(aMessage.Event() == TMPXCollectionMessage::EError &&
       
  3998        aMessage.Type() == EMcsRemovePath &&
       
  3999        aMessage.Data() == KErrArgument)
       
  4000         {
       
  4001         iLogger->Log( _L("RemoveL error message recieved: KErrArgument") );
       
  4002         RunNext();
       
  4003         }
       
  4004     else
       
  4005         {
       
  4006         iLogger->Log( KTextImproperMsg );
       
  4007         TMC_ASSERT(EFalse, 2);
       
  4008         }
       
  4009     }    
       
  4010     
       
  4011 void CCollectionTests::DoHandleRemoveLTest0088L(MDesCArray& aUriArray, TInt aError)
       
  4012     {
       
  4013     TMC_ASSERT(aError == KErrNone, 1);
       
  4014     TMC_ASSERT(aUriArray.MdcaCount() == 1, 2);
       
  4015     TMC_ASSERT(aUriArray.MdcaPoint(0) == _L("\\song3111.ts"), 3);
       
  4016     RunNext();
       
  4017     }
       
  4018     
       
  4019 void CCollectionTests::DoHandleRemoveLTest0089L(MDesCArray& /*aUriArray*/, TInt /*aError*/)
       
  4020     {
       
  4021     // Should never receive this callback
       
  4022     TMC_ASSERT(EFalse, 1);
       
  4023     RunNext();
       
  4024     }
       
  4025     
       
  4026 void CCollectionTests::DoHandleRemoveLTest0090L(MDesCArray& aUriArray, TInt aError)
       
  4027     {
       
  4028     TMC_ASSERT(aError == KErrNone, 1);
       
  4029     TMC_ASSERT(aUriArray.MdcaCount() == 3, 2);
       
  4030     TMC_ASSERT(aUriArray.MdcaPoint(0) == _L("\\song3121.ts"), 3);
       
  4031     TMC_ASSERT(aUriArray.MdcaPoint(1) == _L("\\song3122.ts"), 4);
       
  4032     TMC_ASSERT(aUriArray.MdcaPoint(2) == _L("\\song3123.tp"), 5);
       
  4033     RunNext();
       
  4034     }
       
  4035 
       
  4036 void CCollectionTests::DoHandleRemoveLTest0091L(MDesCArray& /*aUriArray*/, TInt aError)
       
  4037     {
       
  4038     TMC_ASSERT(aError == KErrNotFound, 1);
       
  4039     RunNext();
       
  4040     }
       
  4041 
       
  4042 void CCollectionTests::DoHandleCollectionTest0091L( const TMPXCollectionMessage& aMessage )
       
  4043     {
       
  4044     // TODO: return error through HandleRemoveL/HandleCollectionMessage
       
  4045     if(aMessage.Event() == TMPXCollectionMessage::EError &&
       
  4046        aMessage.Type() == EMcsRemovePath &&
       
  4047        aMessage.Data() == KErrNotFound)
       
  4048         {
       
  4049         iLogger->Log( _L("RemoveL error message recieved: KErrNotFound") );
       
  4050         RunNext();
       
  4051         }
       
  4052     else
       
  4053         {
       
  4054         iLogger->Log( KTextImproperMsg );
       
  4055         TMC_ASSERT(EFalse, 2);
       
  4056         }
       
  4057     }
       
  4058 
       
  4059 void CCollectionTests::DoHandleCollectionTest0099L( const TMPXCollectionMessage& aMessage )
       
  4060     {
       
  4061     if(aMessage.Event() == TMPXCollectionMessage::EItemChanged &&
       
  4062        aMessage.Type() == EMPXItemDeleted &&
       
  4063        aMessage.Data() == 99)   // 1st
       
  4064         {
       
  4065         iLogger->Log( _L("Delete of item Id 99 received") );
       
  4066         RunNext();
       
  4067         }
       
  4068     else
       
  4069         {
       
  4070         iLogger->Log( KTextImproperMsg );
       
  4071         TMC_ASSERT(EFalse, 2);
       
  4072         }
       
  4073     }
       
  4074 
       
  4075 void CCollectionTests::DoHandleCollectionTest0100L( const TMPXCollectionMessage& aMessage )
       
  4076     {
       
  4077     if(aMessage.Event() == TMPXCollectionMessage::EItemChanged &&
       
  4078        aMessage.Type() == EMPXItemDeleted &&
       
  4079        aMessage.Data() == 100)   // 1st
       
  4080         {
       
  4081         iLogger->Log( _L("[%d] Delete of item Id 99 received"), iTempCnt);
       
  4082         if(--iTempCnt <= 0)
       
  4083             {
       
  4084             RunNext();
       
  4085             }
       
  4086         }
       
  4087     else
       
  4088         {
       
  4089         iLogger->Log( KTextImproperMsg );
       
  4090         TMC_ASSERT(EFalse, 2);
       
  4091         }
       
  4092     }
       
  4093 
       
  4094 void CCollectionTests::DoHandleCollectionTest0108L( const TMPXCollectionMessage& aMessage )
       
  4095     {
       
  4096     if(aMessage.Event() == TMPXCollectionMessage::EItemChanged &&
       
  4097        aMessage.Type() == EMPXItemModified &&
       
  4098        aMessage.Data() == 108)   // 1st
       
  4099         {
       
  4100         iLogger->Log( _L("Modification of item Id 108 received") );
       
  4101         RunNext();
       
  4102         }
       
  4103     else
       
  4104         {
       
  4105         iLogger->Log( KTextImproperMsg );
       
  4106         TMC_ASSERT(EFalse, 2);
       
  4107         }
       
  4108     }
       
  4109 
       
  4110 void CCollectionTests::DoHandleCollectionTest0109L( const TMPXCollectionMessage& aMessage )
       
  4111     {
       
  4112     if(aMessage.Event() == TMPXCollectionMessage::EItemChanged &&
       
  4113        aMessage.Type() == EMPXItemModified &&
       
  4114        aMessage.Data() == 109)   // 1st
       
  4115         {
       
  4116         iLogger->Log( _L("[%d] Modification of item Id 109 received"), iTempCnt);
       
  4117         if(--iTempCnt <= 0)
       
  4118             {
       
  4119             RunNext();
       
  4120             }
       
  4121         }
       
  4122     else
       
  4123         {
       
  4124         iLogger->Log( KTextImproperMsg );
       
  4125         TMC_ASSERT(EFalse, 2);
       
  4126         }
       
  4127     }
       
  4128 void CCollectionTests::DoHandleCollectionTest0117L( const TMPXCollectionMessage& aMessage )
       
  4129     {
       
  4130     if(aMessage.Event() == TMPXCollectionMessage::EAsyncOpComplete &&
       
  4131        aMessage.Type() == EMcsSetMediaAsync &&
       
  4132        aMessage.Data() == KErrNotReady)   // 1st
       
  4133         {
       
  4134         iLogger->Log( _L("EAsyncOpComplete[EMcsSetMediaAsync] message: KErrNotReady received") );
       
  4135         }
       
  4136     else if(aMessage.Event() == TMPXCollectionMessage::EError &&
       
  4137             aMessage.Type() == EMcsSetMediaAsync &&
       
  4138             aMessage.Data() == KErrNotReady)   // 2nd
       
  4139         {
       
  4140         iLogger->Log( _L("EError[EMcsSetMediaAsync] message: KErrNotReady received") );
       
  4141         RunNext();
       
  4142         }
       
  4143     else
       
  4144         {
       
  4145         iLogger->Log( KTextImproperMsg );
       
  4146         TMC_ASSERT(EFalse, 2);
       
  4147         }
       
  4148     }
       
  4149 
       
  4150 void CCollectionTests::DoHandleCollectionTest0118L( const TMPXCollectionMessage& aMessage )
       
  4151     {
       
  4152     if(aMessage.Event() == TMPXCollectionMessage::ECollectionChanged)   // 1st
       
  4153         {
       
  4154         iLogger->Log( KTextCollectionChange );
       
  4155         iLogger->Log( KTextPluginImpUid, aMessage.Data());
       
  4156         }
       
  4157     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && 
       
  4158             aMessage.Type() == EMcPathChangedByOpen) // 2nd
       
  4159         {
       
  4160         iLogger->Log( KTextPathChangedByOpen );
       
  4161         RunNext();  // temp
       
  4162         
       
  4163         /*
       
  4164         // TODO: continue running will panic the thread
       
  4165         CMPXMedia* media = CMPXMedia::NewL();
       
  4166         CleanupStack::PushL( media );
       
  4167         iCollectionUtility1->Collection().SetL( *media );
       
  4168         CleanupStack::PopAndDestroy( media );
       
  4169         */
       
  4170         }
       
  4171     else if(aMessage.Event() == TMPXCollectionMessage::EAsyncOpComplete &&
       
  4172        aMessage.Type() == EMcsSetMediaAsync &&
       
  4173        aMessage.Data() == KErrArgument)   // 3st
       
  4174         {
       
  4175         iLogger->Log( _L("EAsyncOpComplete[EMcsSetMediaAsync] message: KErrNotReady received") );
       
  4176         }
       
  4177     else if(aMessage.Event() == TMPXCollectionMessage::EError &&
       
  4178             aMessage.Type() == EMcsSetMediaAsync &&
       
  4179             aMessage.Data() == KErrArgument)   // 4nd
       
  4180         {
       
  4181         iLogger->Log( _L("EError[EMcsSetMediaAsync] message: KErrNotReady received") );
       
  4182         RunNext();
       
  4183         }
       
  4184     else
       
  4185         {
       
  4186         iLogger->Log( KTextImproperMsg );
       
  4187         TMC_ASSERT(EFalse, 1);
       
  4188         }
       
  4189     }
       
  4190 
       
  4191 void CCollectionTests::DoHandleCollectionTest0119L( const TMPXCollectionMessage& aMessage )
       
  4192     {
       
  4193     if(aMessage.Event() == TMPXCollectionMessage::EItemChanged &&
       
  4194        aMessage.Type() == EMPXItemModified &&
       
  4195        aMessage.Data() == 119)   // 1st
       
  4196         {
       
  4197         iLogger->Log( _L("Modification of item Id 119 received") );
       
  4198         }
       
  4199     else if(aMessage.Event() == TMPXCollectionMessage::EAsyncOpComplete &&
       
  4200             aMessage.Type() == EMcsSetMediaAsync &&
       
  4201             aMessage.Data() == KErrNone)   // 2nd
       
  4202         {
       
  4203         iLogger->Log( _L("EAsyncOpComplete[EMcsSetMediaAsync] message: KErrNone received") );
       
  4204         RunNext();
       
  4205         }
       
  4206     else
       
  4207         {
       
  4208         iLogger->Log( KTextImproperMsg );
       
  4209         TMC_ASSERT(EFalse, 2);
       
  4210         }
       
  4211     }    
       
  4212     
       
  4213 void CCollectionTests::DoHandleCollectionTest0120L( const TMPXCollectionMessage& aMessage )
       
  4214     {
       
  4215     if(aMessage.Event() == TMPXCollectionMessage::EItemChanged &&
       
  4216        aMessage.Type() == EMPXItemModified &&
       
  4217        aMessage.Data() == 120)   // 1st
       
  4218         {
       
  4219         iLogger->Log( _L("Modification of item Id 120 received") );
       
  4220         TMC_ASSERT(iTempCnt > 0, 3);
       
  4221         iTempCnt--;
       
  4222         if(iTempCnt == 0)   // temp fix
       
  4223             {            
       
  4224             TMC_ASSERT(EFalse, 4);  // remove this when fixed
       
  4225             //RunNext();      // temp fix
       
  4226             }
       
  4227         }
       
  4228     else if(aMessage.Event() == TMPXCollectionMessage::EAsyncOpComplete &&
       
  4229             aMessage.Type() == EMcsSetMediaAsync &&
       
  4230             aMessage.Data() == KErrNone)   // 2nd
       
  4231         {
       
  4232         iLogger->Log( _L("EAsyncOpComplete[EMcsSetMediaAsync] message: KErrNone received") );
       
  4233         iLogger->Log( _L("THIS MESSAGE IS EXPECTED TO BE RECEIVED LAST") ); // temp
       
  4234         //RunNext();        // temp
       
  4235         }
       
  4236     else
       
  4237         {
       
  4238         iLogger->Log( KTextImproperMsg );
       
  4239         TMC_ASSERT(EFalse, 2);
       
  4240         }
       
  4241     } 
       
  4242     
       
  4243 void CCollectionTests::DoHandleFindAllTest0126L(const CMPXMedia& /*aResults*/, TBool aComplete,TInt aError)
       
  4244     {
       
  4245     TMC_ASSERT(aComplete == 1, 1);
       
  4246     TMC_ASSERT(aError == KErrNotSupported, 2);
       
  4247     RunNext();
       
  4248     }
       
  4249 
       
  4250 void CCollectionTests::DoHandleCollectionTest0126L( const TMPXCollectionMessage& aMessage )
       
  4251     {
       
  4252     if(aMessage.Event() == TMPXCollectionMessage::EError &&
       
  4253        aMessage.Type() == EMcsFindAll &&
       
  4254        aMessage.Data() == KErrNotSupported)
       
  4255         {
       
  4256         iLogger->Log( _L("EError[EMcsFindAll] message: KErrNotSupported received") );
       
  4257         RunNext();
       
  4258         }
       
  4259     else
       
  4260         {
       
  4261         iLogger->Log( KTextImproperMsg );
       
  4262         TMC_ASSERT(EFalse, 3);
       
  4263         }
       
  4264     }
       
  4265 
       
  4266 void CCollectionTests::DoHandleFindAllTest0127L(const CMPXMedia& /*aResults*/, TBool aComplete,TInt aError)
       
  4267     {
       
  4268     TMC_ASSERT(aComplete == 1, 1);
       
  4269     TMC_ASSERT(aError == KErrNotSupported, 2);
       
  4270     RunNext();
       
  4271     }
       
  4272 
       
  4273 void CCollectionTests::DoHandleCollectionTest0127L( const TMPXCollectionMessage& aMessage )
       
  4274     {
       
  4275     if(aMessage.Event() == TMPXCollectionMessage::EError &&
       
  4276        aMessage.Type() == EMcsFindAll &&
       
  4277        aMessage.Data() == KErrNotSupported)
       
  4278         {
       
  4279         iLogger->Log( _L("EError[EMcsFindAll] message: KErrNotSupported received") );
       
  4280         RunNext();
       
  4281         }
       
  4282     else
       
  4283         {
       
  4284         iLogger->Log( KTextImproperMsg );
       
  4285         TMC_ASSERT(EFalse, 3);
       
  4286         }
       
  4287     }
       
  4288     
       
  4289 void CCollectionTests::DoHandleFindAllTest0128L(const CMPXMedia& aResults, TBool aComplete,TInt aError)
       
  4290     {
       
  4291     TMC_ASSERT( aComplete, 1 );
       
  4292     TMC_ASSERT( aError == KErrNone, 2 );
       
  4293     if( !aResults.IsSupported(KMPXMediaGeneralTitle) )
       
  4294         {
       
  4295         TMC_ASSERT(EFalse , 3);
       
  4296         return;
       
  4297         }
       
  4298     const TDesC& title = aResults.ValueText( KMPXMediaGeneralTitle );
       
  4299     TMC_ASSERT(title == _L("CollectionPluginTest0128"), 4 );
       
  4300     
       
  4301     if( !aResults.IsSupported(KMPXMediaGeneralCollectionId) )
       
  4302         {
       
  4303         TMC_ASSERT(EFalse , 5);
       
  4304         return;
       
  4305         }
       
  4306     TUid uid = aResults.ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId );
       
  4307     TMC_ASSERT(uid == TUid::Uid(KCollectionTestPluginImpId), 6);
       
  4308     
       
  4309     if( !aResults.IsSupported(KMPXMediaGeneralSize) )
       
  4310         {
       
  4311         TMC_ASSERT(EFalse , 7);
       
  4312         return;
       
  4313         }
       
  4314     TInt attrSize = aResults.ValueTObjectL<TInt>( KMPXMediaGeneralSize );
       
  4315     TMC_ASSERT(attrSize == 0, 8);    
       
  4316     RunNext();
       
  4317     }
       
  4318 
       
  4319 void CCollectionTests::DoHandleFindAllTest0129L(const CMPXMedia& aResults, TBool aComplete,TInt aError)
       
  4320     {
       
  4321     TMC_ASSERT( aComplete, 1 );
       
  4322     TMC_ASSERT( aError == KErrNone, 2 );
       
  4323     if( !aResults.IsSupported(KMPXMediaGeneralTitle) )
       
  4324         {
       
  4325         TMC_ASSERT(EFalse , 3);
       
  4326         return;
       
  4327         }
       
  4328     const TDesC& title = aResults.ValueText( KMPXMediaGeneralTitle );
       
  4329     TMC_ASSERT(title == _L("CollectionPluginTest0129"), 4 );
       
  4330     
       
  4331     if( !aResults.IsSupported(KMPXMediaGeneralCollectionId) )
       
  4332         {
       
  4333         TMC_ASSERT(EFalse , 5);
       
  4334         return;
       
  4335         }
       
  4336     TUid uid = aResults.ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId );
       
  4337     TMC_ASSERT(uid == TUid::Uid(KCollectionTestPluginImpId), 6);
       
  4338     
       
  4339     if( !aResults.IsSupported(KMPXMediaGeneralSize) )
       
  4340         {
       
  4341         TMC_ASSERT(EFalse , 7);
       
  4342         return;
       
  4343         }
       
  4344     TInt attrSize = aResults.ValueTObjectL<TInt>( KMPXMediaGeneralSize );
       
  4345     TMC_ASSERT(attrSize == 3, 8);
       
  4346     RunNext();
       
  4347     }
       
  4348 
       
  4349 void CCollectionTests::DoHandleFindAllTest0130L(const CMPXMedia& aResults, TBool aComplete,TInt aError)
       
  4350     {
       
  4351     TMC_ASSERT( aComplete, 1 );
       
  4352     TMC_ASSERT( aError == KErrArgument, 2 );
       
  4353     TMC_ASSERT( &aResults != NULL, 3);
       
  4354     RunNext();
       
  4355     }
       
  4356  
       
  4357  void CCollectionTests::DoHandleCollectionTest0130L( const TMPXCollectionMessage& aMessage )
       
  4358     {
       
  4359     if(aMessage.Event() == TMPXCollectionMessage::EError &&
       
  4360        aMessage.Type() == EMcsFindAll &&
       
  4361        aMessage.Data() == KErrArgument)
       
  4362         {
       
  4363         iLogger->Log( _L("EError[EMcsFindAll] message: KErrArgument received") );
       
  4364         RunNext();
       
  4365         }
       
  4366     else
       
  4367         {
       
  4368         iLogger->Log( KTextImproperMsg );
       
  4369         TMC_ASSERT(EFalse, 4);
       
  4370         }
       
  4371     }
       
  4372 
       
  4373 void CCollectionTests::DoHandleCollectionTest0145L( const TMPXCollectionMessage& aMessage )
       
  4374     {
       
  4375     if(aMessage.Event() == TMPXCollectionMessage::EError &&
       
  4376        aMessage.Type() == EMcsMediaByPath &&
       
  4377        aMessage.Data() == KErrNotSupported)
       
  4378         {
       
  4379         iLogger->Log( _L("EError[EMcsMediaByPath] message: KErrNotSupported received") );
       
  4380         RunNext();
       
  4381         }
       
  4382     else
       
  4383         {
       
  4384         iLogger->Log( KTextImproperMsg );
       
  4385         TMC_ASSERT(EFalse, 2);
       
  4386         }
       
  4387     
       
  4388     }
       
  4389 
       
  4390 void CCollectionTests::DoHandleMediaTest0145L(const CMPXMedia& aMedia, TInt aError)
       
  4391     {
       
  4392     TMC_ASSERT(aError == KErrNotSupported, 2);
       
  4393     TMC_ASSERT(&aMedia != NULL, 3);
       
  4394     RunNext();
       
  4395     }
       
  4396     
       
  4397 void CCollectionTests::DoHandleMediaTest0146L(const CMPXMedia& aMedia, TInt aError)
       
  4398     {
       
  4399     TMC_ASSERT(aError == KErrNone, 2);
       
  4400     TMC_ASSERT(&aMedia == NULL, 3);
       
  4401     RunNext();
       
  4402     }
       
  4403     
       
  4404 void CCollectionTests::DoHandleMediaTest0147L(const CMPXMedia& aMedia, TInt aError)
       
  4405     {
       
  4406     TMC_ASSERT(aError == KErrNone, 2);
       
  4407     TMC_ASSERT(aMedia.Count() == 0, 3);
       
  4408     RunNext();
       
  4409     }
       
  4410 
       
  4411 void CCollectionTests::DoHandleCollectionTest0148L( const TMPXCollectionMessage& aMessage )
       
  4412     {
       
  4413     if(aMessage.Event() == TMPXCollectionMessage::EError &&
       
  4414        aMessage.Type() == EMcsMediaByPath &&
       
  4415        aMessage.Data() == KErrNotFound)
       
  4416         {
       
  4417         iLogger->Log( _L("EError[EMcsFindAll] message: KErrNotFound received") );
       
  4418         RunNext();
       
  4419         }
       
  4420     else
       
  4421         {
       
  4422         iLogger->Log( KTextImproperMsg );
       
  4423         TMC_ASSERT(EFalse, 4);
       
  4424         }
       
  4425     }
       
  4426 
       
  4427 void CCollectionTests::DoHandleMediaTest0148L(const CMPXMedia& aMedia, TInt aError)
       
  4428     {
       
  4429     //TMC_ASSERT(aError == KErrNotFound, 2);
       
  4430     TMC_ASSERT(aError == KErrNone, 2); // it is found!
       
  4431     TMC_ASSERT(&aMedia != NULL, 3);
       
  4432     RunNext();
       
  4433     }
       
  4434 
       
  4435 void CCollectionTests::DoHandleMediaTest0149L(const CMPXMedia& aMedia, TInt aError)
       
  4436     {
       
  4437     TMC_ASSERT(aError == KErrNone, 2);
       
  4438     TMC_ASSERT(aMedia.Count() == 1, 3);
       
  4439     TMC_ASSERT(aMedia.IsSupported(KMPXMediaGeneralTitle), 4);
       
  4440     if( aMedia.IsSupported(KMPXMediaGeneralTitle) )
       
  4441         {
       
  4442         const TDesC& title = aMedia.ValueText( KMPXMediaGeneralTitle );
       
  4443         TMC_ASSERT(title == _L("CollectionPluginTest0149"), 5);
       
  4444         }
       
  4445         
       
  4446     RunNext();
       
  4447     }
       
  4448     
       
  4449 void CCollectionTests::DoHandleCollectionTest0162L( const TMPXCollectionMessage& aMessage )
       
  4450     {
       
  4451     if(aMessage.Event() == TMPXCollectionMessage::ECollectionChanged && 
       
  4452        aMessage.Data() == KCollectionTestPluginImpId)
       
  4453         {
       
  4454         iLogger->Log( KTextCollectionChange );
       
  4455         }
       
  4456     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && 
       
  4457             aMessage.Type() == EMcPathChangedByOpen)
       
  4458         {
       
  4459         iLogger->Log( KTextPathChangedByOpen );
       
  4460         RunNext();
       
  4461         }
       
  4462     else
       
  4463         {
       
  4464         iLogger->Log( KTextImproperMsg );
       
  4465         TMC_ASSERT(EFalse, 1);
       
  4466         }
       
  4467     }
       
  4468     
       
  4469 void CCollectionTests::DoHandleCollectionTest0163L( const TMPXCollectionMessage& aMessage )
       
  4470     {
       
  4471     if(aMessage.Event() == TMPXCollectionMessage::EFocusChanged && 
       
  4472        aMessage.Type() == 2 )     // TODO: should be aMessage.Data() == 2???
       
  4473         {
       
  4474         iLogger->Log( KTextFocusChanged );
       
  4475         RunNext();
       
  4476         }
       
  4477     else
       
  4478         {
       
  4479         iLogger->Log( KTextImproperMsg );
       
  4480         TMC_ASSERT(EFalse, 1);
       
  4481         }
       
  4482     }
       
  4483     
       
  4484 void CCollectionTests::DoHandleCollectionTest0171L( const TMPXCollectionMessage& aMessage )
       
  4485     {
       
  4486     if(aMessage.Event() == TMPXCollectionMessage::EError && 
       
  4487        aMessage.Type() == EMcsCommandExt &&
       
  4488        aMessage.Data() == KErrNotReady)
       
  4489         {
       
  4490         iLogger->Log( _L("CommandL error message recieved: KErrNotReady") );
       
  4491         RunNext();
       
  4492         }
       
  4493     else
       
  4494         {
       
  4495         iLogger->Log( KTextImproperMsg );
       
  4496         TMC_ASSERT(EFalse, 1);
       
  4497         }
       
  4498     }
       
  4499 
       
  4500 void CCollectionTests::DoHandleCommandCompleteTest0171L(CMPXCommand* aCommandResult, TInt aError)
       
  4501     {
       
  4502     TMC_ASSERT(aCommandResult != NULL, 1);
       
  4503     TMC_ASSERT(aError == KErrNotReady, 2);
       
  4504     RunNext();
       
  4505     }
       
  4506 
       
  4507 void CCollectionTests::DoHandleCommandCompleteTest0173L(CMPXCommand* aCommandResult, TInt aError)
       
  4508     {
       
  4509     TMC_ASSERT(aCommandResult != NULL, 1);
       
  4510     TMC_ASSERT(aError == KErrNotSupported, 2);
       
  4511     RunNext();
       
  4512     }
       
  4513     
       
  4514 void CCollectionTests::DoHandleCollectionTest0173L( const TMPXCollectionMessage& aMessage )
       
  4515     {
       
  4516     if(aMessage.Event() == TMPXCollectionMessage::EError && 
       
  4517        aMessage.Type() == EMcsCommandExt &&
       
  4518        aMessage.Data() == KErrNotSupported)
       
  4519         {
       
  4520         iLogger->Log( _L("CommandL error message recieved: KErrNotSupported") );
       
  4521         RunNext();
       
  4522         }
       
  4523     else
       
  4524         {
       
  4525         iLogger->Log( KTextImproperMsg );
       
  4526         TMC_ASSERT(EFalse, 1);
       
  4527         }
       
  4528     }
       
  4529 
       
  4530 void CCollectionTests::DoHandleCommandCompleteTest0176L(CMPXCommand* aCommandResult, TInt aError)
       
  4531     {
       
  4532     TMC_ASSERT(aCommandResult == NULL, 1);
       
  4533     TMC_ASSERT(aError == KErrNone, 2);
       
  4534     RunNext();
       
  4535     }
       
  4536 
       
  4537 void CCollectionTests::DoHandleCommandCompleteTest0177L(CMPXCommand* aCommandResult, TInt aError)
       
  4538     {
       
  4539     TMC_ASSERT(aCommandResult != NULL, 1);
       
  4540     TMC_ASSERT(aError == KErrGeneral, 2);
       
  4541     RunNext();
       
  4542     }
       
  4543 
       
  4544 void CCollectionTests::DoHandleCollectionTest0177L( const TMPXCollectionMessage& aMessage )
       
  4545     {
       
  4546     if(aMessage.Event() == TMPXCollectionMessage::EError && 
       
  4547        aMessage.Type() == EMcsCommandExt &&
       
  4548        aMessage.Data() == KErrGeneral)
       
  4549         {
       
  4550         iLogger->Log( _L("CommandL error message recieved: KErrGeneral") );
       
  4551         RunNext();
       
  4552         }
       
  4553     else
       
  4554         {
       
  4555         iLogger->Log( KTextImproperMsg );
       
  4556         TMC_ASSERT(EFalse, 1);
       
  4557         }
       
  4558     }
       
  4559 
       
  4560 void CCollectionTests::DoHandleCollectionTest0179L( const TMPXCollectionMessage& aMessage )
       
  4561     {
       
  4562     if(aMessage.Event() == TMPXCollectionMessage::ECollectionChanged && 
       
  4563        aMessage.Data() == KCollectionTestPluginImpId)
       
  4564         {
       
  4565         iLogger->Log( KTextCollectionChange );
       
  4566         }
       
  4567     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && 
       
  4568             aMessage.Type() == EMcPathChangedByOpen)
       
  4569         {
       
  4570         iLogger->Log( KTextPathChangedByOpen );
       
  4571         RunNext();
       
  4572         }
       
  4573     else
       
  4574         {
       
  4575         iLogger->Log( KTextImproperMsg );
       
  4576         TMC_ASSERT(EFalse, 1);
       
  4577         }
       
  4578     }        
       
  4579 
       
  4580 void CCollectionTests::DoHandleCollectionTest0182L( const TMPXCollectionMessage& aMessage )
       
  4581     {
       
  4582     if(aMessage.Event() == TMPXCollectionMessage::EFocusChanged && 
       
  4583        aMessage.Type() == 2 )     // TODO: should be aMessage.Data() == 2???
       
  4584         {
       
  4585         iLogger->Log( KTextFocusChanged );
       
  4586         RunNext();
       
  4587         }
       
  4588     else
       
  4589         {
       
  4590         iLogger->Log( KTextImproperMsg );
       
  4591         TMC_ASSERT(EFalse, 1);
       
  4592         }
       
  4593     }
       
  4594 
       
  4595 void CCollectionTests::DoHandleCommandCompleteTest0184L(CMPXCommand* aCommandResult, TInt aError)
       
  4596     {
       
  4597     TMC_ASSERT(aError == KErrNone, 1);
       
  4598     if( !aCommandResult )
       
  4599         {
       
  4600         TMC_ASSERT(EFalse, 2);
       
  4601         }
       
  4602     else
       
  4603         {
       
  4604         TMC_ASSERT(aCommandResult->Count() == 3, 3);
       
  4605         TMC_ASSERT(aCommandResult->ValueTObjectL<TMPXCommandId>(KMPXCommandGeneralId) == 184, 4);
       
  4606         }
       
  4607         
       
  4608     RunNext();
       
  4609     }
       
  4610 
       
  4611 void CCollectionTests::DoHandleCollectionTest0194L( const TMPXCollectionMessage& aMessage )
       
  4612     {
       
  4613     if(aMessage.Event() == TMPXCollectionMessage::ECollectionChanged && 
       
  4614        aMessage.Data() == KCollectionTestPluginImpId)
       
  4615         {
       
  4616         iLogger->Log( KTextCollectionChange );
       
  4617         }
       
  4618     else if(aMessage.Event() == TMPXCollectionMessage::EPathChanged && 
       
  4619             aMessage.Type() == EMcPathChangedByOpen)
       
  4620         {
       
  4621         iLogger->Log( KTextPathChangedByOpen );
       
  4622         RunNext();
       
  4623         }
       
  4624     else
       
  4625         {
       
  4626         iLogger->Log( KTextImproperMsg );
       
  4627         TMC_ASSERT(EFalse, 1);
       
  4628         }
       
  4629     }
       
  4630 
       
  4631 void CCollectionTests::DoHandleCollectionTest0195L( const TMPXCollectionMessage& aMessage )
       
  4632     {
       
  4633     if(aMessage.Event() == TMPXCollectionMessage::EBroadcastEvent && 
       
  4634        aMessage.Type() == EMcMsgFormatStart &&
       
  4635        aMessage.Data() == EDriveE )
       
  4636         {
       
  4637         iLogger->Log( _L("Broadcast Event message recieved: EMcMsgFormatStart; drive=EDriveE"));
       
  4638         RunNext();
       
  4639         }
       
  4640     else
       
  4641         {
       
  4642         iLogger->Log( KTextImproperMsg );
       
  4643         TMC_ASSERT(EFalse, 1);
       
  4644         }
       
  4645     }
       
  4646 
       
  4647 void CCollectionTests::DoHandleCollectionTest0196L( const TMPXCollectionMessage& aMessage )
       
  4648     {
       
  4649     if(aMessage.Event() == TMPXCollectionMessage::EBroadcastEvent && 
       
  4650        aMessage.Type() == EMcMsgFormatEnd &&
       
  4651        aMessage.Data() == EDriveE )
       
  4652         {
       
  4653         iLogger->Log( _L("Broadcast Event message recieved: EMcMsgFormatEnd; drive=EDriveE"));
       
  4654         RunNext();
       
  4655         }
       
  4656     else
       
  4657         {
       
  4658         iLogger->Log( KTextImproperMsg );
       
  4659         TMC_ASSERT(EFalse, 1);
       
  4660         }
       
  4661     }
       
  4662 
       
  4663 void CCollectionTests::DoHandleCollectionTest0197L( const TMPXCollectionMessage& aMessage )
       
  4664     {
       
  4665     if(aMessage.Event() == TMPXCollectionMessage::EBroadcastEvent && 
       
  4666        aMessage.Type() == EMcMsgDiskRemoved &&
       
  4667        aMessage.Data() == EDriveE )
       
  4668         {
       
  4669         iLogger->Log( _L("Broadcast Event message recieved: EMcMsgDiskRemoved; drive=EDriveE"));
       
  4670         RunNext();
       
  4671         }
       
  4672     else
       
  4673         {
       
  4674         iLogger->Log( KTextImproperMsg );
       
  4675         TMC_ASSERT(EFalse, 1);
       
  4676         }
       
  4677     }
       
  4678 void CCollectionTests::DoHandleCollectionTest0198L( const TMPXCollectionMessage& aMessage )
       
  4679     {
       
  4680     if(aMessage.Event() == TMPXCollectionMessage::EBroadcastEvent && 
       
  4681        aMessage.Type() == EMcMsgDiskInserted &&
       
  4682        aMessage.Data() == EDriveE )
       
  4683         {
       
  4684         iLogger->Log( _L("Broadcast Event message recieved: EMcMsgDiskInserted; drive=EDriveE"));
       
  4685         RunNext();
       
  4686         }
       
  4687     else
       
  4688         {
       
  4689         iLogger->Log( KTextImproperMsg );
       
  4690         TMC_ASSERT(EFalse, 1);
       
  4691         }
       
  4692     }
       
  4693 
       
  4694 void CCollectionTests::DoHandleCollectionTest0199L( const TMPXCollectionMessage& aMessage )
       
  4695     {
       
  4696     if(aMessage.Event() == TMPXCollectionMessage::EBroadcastEvent && 
       
  4697        aMessage.Type() == EMcMsgUSBMassStorageStart &&
       
  4698        aMessage.Data() == EDriveE )
       
  4699         {
       
  4700         iLogger->Log( _L("Broadcast Event message recieved: EMcMsgUSBMassStorageStart; drive=EDriveE"));
       
  4701         RunNext();
       
  4702         }
       
  4703     else
       
  4704         {
       
  4705         iLogger->Log( KTextImproperMsg );
       
  4706         TMC_ASSERT(EFalse, 1);
       
  4707         }
       
  4708     }
       
  4709 void CCollectionTests::DoHandleCollectionTest0200L( const TMPXCollectionMessage& aMessage )
       
  4710     {
       
  4711     if(aMessage.Event() == TMPXCollectionMessage::EBroadcastEvent && 
       
  4712        aMessage.Type() == EMcMsgUSBMassStorageEnd &&
       
  4713        aMessage.Data() == EDriveE )
       
  4714         {
       
  4715         iLogger->Log( _L("Broadcast Event message recieved: EMcMsgUSBMassStorageEnd; drive=EDriveE"));
       
  4716         RunNext();
       
  4717         }
       
  4718     else
       
  4719         {
       
  4720         iLogger->Log( KTextImproperMsg );
       
  4721         TMC_ASSERT(EFalse, 1);
       
  4722         }
       
  4723     } 
       
  4724 
       
  4725 void CCollectionTests::DoHandleCollectionTest0201L( const TMPXCollectionMessage& aMessage )
       
  4726     {
       
  4727     if(aMessage.Event() == TMPXCollectionMessage::EBroadcastEvent && 
       
  4728        aMessage.Type() == EMcMsgRefreshStart &&
       
  4729        aMessage.Data() == EDriveE )
       
  4730         {
       
  4731         iLogger->Log( _L("Broadcast Event message recieved: EMcMsgRefreshStart; drive=EDriveE"));
       
  4732         RunNext();
       
  4733         }
       
  4734     else
       
  4735         {
       
  4736         iLogger->Log( KTextImproperMsg );
       
  4737         TMC_ASSERT(EFalse, 1);
       
  4738         }
       
  4739     }
       
  4740     
       
  4741 void CCollectionTests::DoHandleCollectionTest0202L( const TMPXCollectionMessage& aMessage )
       
  4742     {
       
  4743     if(aMessage.Event() == TMPXCollectionMessage::EBroadcastEvent && 
       
  4744        aMessage.Type() == EMcMsgRefreshEnd &&
       
  4745        aMessage.Data() == EDriveE )
       
  4746         {
       
  4747         iLogger->Log( _L("Broadcast Event message recieved: EMcMsgRefreshEnd; drive=EDriveE"));
       
  4748                 
       
  4749         RunNext();
       
  4750         }
       
  4751     else
       
  4752         {
       
  4753         iLogger->Log( KTextImproperMsg );
       
  4754         TMC_ASSERT(EFalse, 1);
       
  4755         }
       
  4756     } 
       
  4757 
       
  4758 // ---------------------------------------------------------------------------
       
  4759 // Handle collection message
       
  4760 // ---------------------------------------------------------------------------
       
  4761 //
       
  4762 void CCollectionTests::HandleCollectionMessageL(const CMPXMessage& aMsg)
       
  4763     {
       
  4764     iLogger->Log(_L("+CCollectionTests::HandleCollectionMessageL"));
       
  4765     iLogger->Log( KTextHandleColMsgL2 );
       
  4766     
       
  4767     // Is this right???	*AIP*
       
  4768     if( aMsg.IsSupported(KMPXMessageCollectionId) &&
       
  4769     	aMsg.IsSupported(KMPXMessageChangeEventType))
       
  4770     	{
       
  4771         //TMPXCollectionMessage::TEvent event = 
       
  4772         //*aMsg.Value<TMPXCollectionMessage::TEvent>( KMPXMessageCollectionId );
       
  4773         //TInt type = *aMsg.Value<TInt>( KMPXMessageChangeEventType );
       
  4774         //TInt data = *aMsg.Value<TInt>( KMPXMessageGeneralData );
       
  4775         
       
  4776         TMPXCollectionMessage::TEvent event = TMPXCollectionMessage::EItemChanged;
       
  4777         TInt type = *aMsg.Value<TInt>( KMPXMessageChangeEventType );
       
  4778         TInt data = *aMsg.Value<TInt>( KMPXMessageMediaGeneralId );
       
  4779         
       
  4780         TMPXCollectionMessage message(event, type, data);
       
  4781         switch( iTestIndex )
       
  4782         	{
       
  4783             case 78: //ETCFwCollectTest0078:
       
  4784             case 81: //ETCFwCollectTest0081:
       
  4785                 DoHandleCollectionTest0078L( message );
       
  4786                 break;
       
  4787             case 79: //ETCFwCollectTest0079:
       
  4788                 DoHandleCollectionTest0079L( message );
       
  4789                 break;
       
  4790             case 80: //ETCFwCollectTest0080:
       
  4791                 DoHandleCollectionTest0080L( message );
       
  4792                 break;
       
  4793             case 99: //ETCFwCollectTest0099:
       
  4794                 DoHandleCollectionTest0099L( message );
       
  4795                 break;
       
  4796             case 108: //ETCFwCollectTest0108:
       
  4797                 DoHandleCollectionTest0108L( message );
       
  4798                 break;
       
  4799             case 109: //ETCFwCollectTest0109:
       
  4800                 DoHandleCollectionTest0109L( message );
       
  4801                 break;
       
  4802             default:
       
  4803                 TestPanic( ETestCommonTestNotSupport );                	
       
  4804         	};
       
  4805         	
       
  4806        	return;
       
  4807     	}
       
  4808     	
       
  4809     if( aMsg.IsSupported(KMPXMessageGeneralEvent) &&
       
  4810         aMsg.IsSupported(KMPXMessageGeneralType) ) 
       
  4811         {
       
  4812         TMPXCollectionMessage::TEvent event = 
       
  4813         *aMsg.Value<TMPXCollectionMessage::TEvent>( KMPXMessageGeneralEvent );
       
  4814         TInt type = *aMsg.Value<TInt>( KMPXMessageGeneralType );
       
  4815         TInt data = *aMsg.Value<TInt>( KMPXMessageGeneralData );
       
  4816         TMPXCollectionMessage message(event, type, data);
       
  4817         switch( iTestIndex )
       
  4818             {
       
  4819             case 1: //ETCFwCollectTest0001:
       
  4820     		case 21:
       
  4821             case 23:
       
  4822                 DoHandleCollectionTest0001L( message );
       
  4823                 break;
       
  4824             case 11: //ETCFwCollectTest0011:
       
  4825             case 13: //ETCFwCollectTest0013:
       
  4826             case 15: //ETCFwCollectTest0015:
       
  4827             case 17: //ETCFwCollectTest0017:
       
  4828             case 19: //ETCFwCollectTest0019:
       
  4829             case 20:
       
  4830                 DoHandleCollectionTest0011L( message );
       
  4831                 break;
       
  4832             case 22: //ETCFwCollectTest0022:
       
  4833                 DoHandleCollectionTest0022L( message );
       
  4834                 break;
       
  4835             case 29: //ETCFwCollectTest0029:
       
  4836                 DoHandleCollectionTest0029L( message );
       
  4837                 break;
       
  4838             case 30: //ETCFwCollectTest0030:
       
  4839                 DoHandleCollectionTest0030L( message );
       
  4840                 break;
       
  4841             case 32: //ETCFwCollectTest0032:
       
  4842                 DoHandleCollectionTest0032L( message );
       
  4843                 break;
       
  4844             case 34: //ETCFwCollectTest0034:
       
  4845                 DoHandleCollectionTest0034L( message );
       
  4846                 break;
       
  4847             case 36: //ETCFwCollectTest0036:
       
  4848                 DoHandleCollectionTest0036L( message );
       
  4849                 break;
       
  4850             case 37: //ETCFwCollectTest0037:
       
  4851                 DoHandleCollectionTest0037L( message );
       
  4852                 break;
       
  4853             case 39: //ETCFwCollectTest0039:
       
  4854                 DoHandleCollectionTest0039L( message );
       
  4855                 break;
       
  4856             case 40: //ETCFwCollectTest0040:
       
  4857                 DoHandleCollectionTest0040L( message );
       
  4858                 break;
       
  4859             case 43: //ETCFwCollectTest0043:
       
  4860                 DoHandleCollectionTest0043L( message );
       
  4861                 break;
       
  4862             case 47: //ETCFwCollectTest0047:
       
  4863                 DoHandleCollectionTest0047L( message );
       
  4864                 break;
       
  4865             case 51: //ETCFwCollectTest0051:
       
  4866                 DoHandleCollectionTest0051L( message );
       
  4867                 break;
       
  4868             case 56: //ETCFwCollectTest0056:
       
  4869                 DoHandleCollectionTest0056L( message );
       
  4870                 break;
       
  4871             case 57: //ETCFwCollectTest0057:
       
  4872                 DoHandleCollectionTest0057L( message );
       
  4873                 break;
       
  4874             case 58: //ETCFwCollectTest0058:
       
  4875                 DoHandleCollectionTest0058L( message );
       
  4876                 break;
       
  4877             case 59: //ETCFwCollectTest0059:
       
  4878                 DoHandleCollectionTest0059L( message );
       
  4879                 break;
       
  4880             case 60: //ETCFwCollectTest0060:
       
  4881                 DoHandleCollectionTest0060L( message );
       
  4882                 break;
       
  4883                 /* *AIP*
       
  4884             case 78: //ETCFwCollectTest0078:
       
  4885             case 81: //ETCFwCollectTest0081:
       
  4886                 DoHandleCollectionTest0078L( message );
       
  4887                 break;
       
  4888             case 79: //ETCFwCollectTest0079:
       
  4889                 DoHandleCollectionTest0079L( message );
       
  4890                 break;
       
  4891             case 80: //ETCFwCollectTest0080:
       
  4892                 DoHandleCollectionTest0080L( message );
       
  4893                 break;
       
  4894                 */
       
  4895             case 84: //ETCFwCollectTest0084:
       
  4896                 DoHandleCollectionTest0084L( message );
       
  4897                 break;
       
  4898             case 85: //ETCFwCollectTest0085:
       
  4899                 DoHandleCollectionTest0085L( message );
       
  4900                 break;
       
  4901             case 86: //ETCFwCollectTest0086:
       
  4902             case 87: //ETCFwCollectTest0087:
       
  4903                 DoHandleCollectionTest0086L( message );
       
  4904                 break;
       
  4905                 /*                
       
  4906             case 99: //ETCFwCollectTest0099:
       
  4907                 DoHandleCollectionTest0099L( message );
       
  4908                 break;
       
  4909                 */
       
  4910             case 100: //ETCFwCollectTest0100:
       
  4911                 DoHandleCollectionTest0100L( message );
       
  4912                 break;
       
  4913             case 108: //ETCFwCollectTest0108:
       
  4914                 DoHandleCollectionTest0108L( message );
       
  4915                 break;
       
  4916             case 109: //ETCFwCollectTest0109:
       
  4917                 DoHandleCollectionTest0109L( message );
       
  4918                 break;
       
  4919             case 117: //ETCFwCollectTest0117:
       
  4920                 DoHandleCollectionTest0117L( message );
       
  4921                 break;
       
  4922             case 118: //ETCFwCollectTest0118:
       
  4923                 DoHandleCollectionTest0118L( message );
       
  4924                 break;
       
  4925             case 119: //ETCFwCollectTest0119:
       
  4926                 DoHandleCollectionTest0119L( message );
       
  4927                 break;
       
  4928             case 120: //ETCFwCollectTest0120:
       
  4929                 DoHandleCollectionTest0120L( message );
       
  4930                 break;
       
  4931             case 126: //ETCFwCollectTest0126:
       
  4932                 DoHandleCollectionTest0126L( message );
       
  4933                 break;
       
  4934             case 127: //ETCFwCollectTest0127:
       
  4935                 DoHandleCollectionTest0127L( message );
       
  4936                 break;
       
  4937             case 130: //ETCFwCollectTest0130:
       
  4938                 DoHandleCollectionTest0130L( message );
       
  4939                 break;
       
  4940             case 145: //ETCFwCollectTest0145:
       
  4941                 DoHandleCollectionTest0145L( message );
       
  4942                 break;
       
  4943             case 148: //ETCFwCollectTest0148:
       
  4944                 DoHandleCollectionTest0148L( message );
       
  4945                 break;
       
  4946             case 162: //ETCFwCollectTest0162:
       
  4947                 DoHandleCollectionTest0162L( message );
       
  4948                 break;
       
  4949             case 163: //ETCFwCollectTest0163:
       
  4950                 DoHandleCollectionTest0163L( message );
       
  4951                 break;
       
  4952             case 171: //ETCFwCollectTest0171:
       
  4953                 DoHandleCollectionTest0171L( message );
       
  4954                 break;
       
  4955             case 173: //ETCFwCollectTest0173:
       
  4956                 DoHandleCollectionTest0173L( message );
       
  4957                 break;
       
  4958             case 177: //ETCFwCollectTest0177:
       
  4959                 DoHandleCollectionTest0177L( message );
       
  4960                 break;
       
  4961             case 179: //ETCFwCollectTest0179:
       
  4962                 DoHandleCollectionTest0179L( message );
       
  4963                 break;
       
  4964             case 182: //ETCFwCollectTest0182:
       
  4965                 DoHandleCollectionTest0182L( message );
       
  4966                 break;
       
  4967             case 194: //ETCFwCollectTest0194:
       
  4968                 DoHandleCollectionTest0194L( message );
       
  4969                 break;
       
  4970             case 195: //ETCFwCollectTest0195:
       
  4971                 DoHandleCollectionTest0195L( message );
       
  4972                 break;
       
  4973             case 196: //ETCFwCollectTest0196:
       
  4974                 DoHandleCollectionTest0196L( message );
       
  4975                 break;
       
  4976             case 197: //ETCFwCollectTest0197:
       
  4977                 DoHandleCollectionTest0197L( message );
       
  4978                 break;
       
  4979             case 198: //ETCFwCollectTest0198:
       
  4980                 DoHandleCollectionTest0198L( message );
       
  4981                 break;
       
  4982             case 199: //ETCFwCollectTest0199:
       
  4983                 DoHandleCollectionTest0199L( message );
       
  4984                 break;
       
  4985             case 200: //ETCFwCollectTest0200:
       
  4986                 DoHandleCollectionTest0200L( message );
       
  4987                 break;
       
  4988             case 201: //ETCFwCollectTest0201:
       
  4989                 DoHandleCollectionTest0201L( message );
       
  4990                 break;
       
  4991             case 202: //ETCFwCollectTest0202:
       
  4992                 DoHandleCollectionTest0202L( message );
       
  4993                 break;        
       
  4994             default:
       
  4995                 TestPanic( ETestCommonTestNotSupport );
       
  4996             };
       
  4997         }
       
  4998     }
       
  4999 
       
  5000 // ---------------------------------------------------------------------------
       
  5001 //  Handles the collection entries being opened. Typically called
       
  5002 //  when client has Open()'d a folder
       
  5003 // ---------------------------------------------------------------------------
       
  5004 //
       
  5005 void CCollectionTests::HandleOpenL(const CMPXMedia& aEntries,
       
  5006                                   TInt aIndex,TBool aComplete,TInt aError)
       
  5007     {
       
  5008     iLogger->Log(_L("+CCollectionTests::HandleOpenL"));    
       
  5009     iLogger->Log(KTextHandleOpenL1);
       
  5010     iLogger->Log(KTextHandleOpenLArg, aIndex, aComplete, aError);
       
  5011         
       
  5012     switch( iTestIndex )
       
  5013         {
       
  5014         case 1: //ETCFwCollectTest0001:
       
  5015    			RunNext();  // skip the handling of callback   			
       
  5016             break;
       
  5017         case 11: //ETCFwCollectTest0011:
       
  5018         case 13: //ETCFwCollectTest0013:
       
  5019         case 15: //ETCFwCollectTest0015:
       
  5020         case 17: //ETCFwCollectTest0017:
       
  5021         case 19: //ETCFwCollectTest0019:
       
  5022             DoHandleCollectionTest0012L(aEntries, aIndex, aComplete, aError );
       
  5023             break;
       
  5024         case 21: //ETCFwCollectTest0021:
       
  5025         case 22:
       
  5026             DoHandleCollectionTest0021L(aEntries, aIndex, aComplete, aError );
       
  5027             break;
       
  5028         case 23: //ETCFwCollectTest0023:
       
  5029         case 24: //ETCFwCollectTest0024:
       
  5030         case 25: //ETCFwCollectTest0025:
       
  5031         case 26: //ETCFwCollectTest0026:
       
  5032         case 27: //ETCFwCollectTest0027:
       
  5033         case 28: //ETCFwCollectTest0028:
       
  5034             DoHandleCollectionTest0023L(aEntries, aIndex, aComplete, aError );
       
  5035             break;
       
  5036         case 29: //ETCFwCollectTest0029:
       
  5037             DoHandleCollectionTest0029L(aEntries, aIndex, aComplete, aError );
       
  5038             break;
       
  5039         case 31: //ETCFwCollectTest0031:
       
  5040             DoHandleCollectionTest0031L(aEntries, aIndex, aComplete, aError );
       
  5041             break;
       
  5042         case 33: //ETCFwCollectTest0033:
       
  5043             DoHandleCollectionTest0033L(aEntries, aIndex, aComplete, aError );
       
  5044             break;
       
  5045         case 35: //ETCFwCollectTest0035:
       
  5046             DoHandleCollectionTest0035L(aEntries, aIndex, aComplete, aError );
       
  5047             break;
       
  5048         case 36: //ETCFwCollectTest0036:
       
  5049             DoHandleCollectionTest0036L(aEntries, aIndex, aComplete, aError );
       
  5050             break;
       
  5051         case 38: //ETCFwCollectTest0038:
       
  5052             DoHandleCollectionTest0038L(aEntries, aIndex, aComplete, aError );
       
  5053             break;
       
  5054         case 39: //ETCFwCollectTest0039:
       
  5055             DoHandleCollectionTest0039L(aEntries, aIndex, aComplete, aError );
       
  5056             break;
       
  5057         case 41: //ETCFwCollectTest0041:
       
  5058             DoHandleCollectionTest0041L(aEntries, aIndex, aComplete, aError );
       
  5059             break;
       
  5060         case 44: //ETCFwCollectTest0044:
       
  5061             DoHandleCollectionTest0044L(aEntries, aIndex, aComplete, aError );
       
  5062             break;
       
  5063         case 48: //ETCFwCollectTest0048:
       
  5064             DoHandleCollectionTest0048L(aEntries, aIndex, aComplete, aError );
       
  5065             break;
       
  5066         case 52: //ETCFwCollectTest0052:
       
  5067             DoHandleCollectionTest0052L(aEntries, aIndex, aComplete, aError );
       
  5068             break;
       
  5069         case 59: //ETCFwCollectTest0059:
       
  5070             DoHandleCollectionTest0059L(aEntries, aIndex, aComplete, aError );
       
  5071             break;
       
  5072         case 60: //ETCFwCollectTest0060:
       
  5073             DoHandleCollectionTest0060L(aEntries, aIndex, aComplete, aError );
       
  5074             break;
       
  5075         default:
       
  5076             TestPanic( ETestCommonTestNotSupport );
       
  5077         };
       
  5078     }
       
  5079                      
       
  5080 // ---------------------------------------------------------------------------
       
  5081 // Handles the item being opened. Typically called
       
  5082 // when client has Open()'d an item. Client typically responds by
       
  5083 // 'playing' the item via the playlist
       
  5084 // ---------------------------------------------------------------------------
       
  5085 void CCollectionTests::HandleOpenL(const CMPXCollectionPlaylist& /*aPlaylist*/,TInt aError)
       
  5086     {
       
  5087     iLogger->Log(KTextHandleOpenL2);
       
  5088     iLogger->Log(_L("~HandleOpenL executed with error: %d"), aError);
       
  5089     switch( iTestIndex )
       
  5090         {
       
  5091         default:
       
  5092             TestPanic( ETestCommonTestNotSupport );
       
  5093         };
       
  5094     }
       
  5095 
       
  5096 // ---------------------------------------------------------------------------
       
  5097 // Handle completion of a asynchronous command
       
  5098 // ---------------------------------------------------------------------------
       
  5099 void CCollectionTests::HandleCommandComplete(CMPXCommand* aCommandResult, TInt aError)
       
  5100     {
       
  5101     iLogger->Log(KTextHandleCommandComplete);
       
  5102     iLogger->Log(_L("~HandleCommandComplete executed with error: %d; aCmdResult: 0x%x"), aError, aCommandResult);
       
  5103     switch( iTestIndex )
       
  5104         {
       
  5105         case 171: //ETCFwCollectTest0171:
       
  5106             DoHandleCommandCompleteTest0171L(aCommandResult, aError);
       
  5107             break;
       
  5108         case 173: //ETCFwCollectTest0173:
       
  5109             DoHandleCommandCompleteTest0173L(aCommandResult, aError);
       
  5110             break;
       
  5111         case 176: //ETCFwCollectTest0176:
       
  5112             DoHandleCommandCompleteTest0176L(aCommandResult, aError);
       
  5113             break;
       
  5114         case 177: //ETCFwCollectTest0177:
       
  5115             DoHandleCommandCompleteTest0177L(aCommandResult, aError);
       
  5116             break;
       
  5117         case 184: //ETCFwCollectTest0184:
       
  5118             DoHandleCommandCompleteTest0184L(aCommandResult, aError);
       
  5119             break;
       
  5120         default:
       
  5121             TestPanic( ETestCommonTestNotSupport );
       
  5122         };
       
  5123     }
       
  5124     
       
  5125 // ---------------------------------------------------------------------------
       
  5126 //  Handle extended media properties
       
  5127 // ---------------------------------------------------------------------------
       
  5128 //
       
  5129 void CCollectionTests::HandleCollectionMediaL(const CMPXMedia& aMedia, 
       
  5130                                              TInt aError)
       
  5131     {
       
  5132     iLogger->Log(KTextHandleMediaL);
       
  5133     iLogger->Log(_L("~HandleCollectionMediaL executed with error: %d"), aError);
       
  5134     switch( iTestIndex )
       
  5135         {
       
  5136         case 145: //ETCFwCollectTest0145:
       
  5137             DoHandleMediaTest0145L(aMedia, aError);
       
  5138             break;
       
  5139         case 146: //ETCFwCollectTest0146:
       
  5140             DoHandleMediaTest0146L(aMedia, aError);
       
  5141             break;
       
  5142         case 147: //ETCFwCollectTest0147:
       
  5143             DoHandleMediaTest0147L(aMedia, aError);
       
  5144             break;
       
  5145         case 148: //ETCFwCollectTest0148:
       
  5146             DoHandleMediaTest0148L(aMedia, aError);
       
  5147             break;
       
  5148         case 149: //ETCFwCollectTest0149:
       
  5149             DoHandleMediaTest0149L(aMedia, aError);
       
  5150             break;
       
  5151         default:
       
  5152             TestPanic( ETestCommonTestNotSupport );
       
  5153         };
       
  5154     }
       
  5155 
       
  5156 // ---------------------------------------------------------------------------
       
  5157 //  Handles removing a collection path
       
  5158 // ---------------------------------------------------------------------------
       
  5159 //
       
  5160 void CCollectionTests::HandleRemoveL(MDesCArray& aUriArray, TInt aError)
       
  5161     {
       
  5162     // Log parameter
       
  5163     iLogger->Log( KTextHandleRemoveL );
       
  5164     iLogger->Log(_L("~HandleRemoveL executed with error: %d"), aError);
       
  5165     if( !aError )
       
  5166         {
       
  5167         for(TInt i = 0; i < aUriArray.MdcaCount(); i++)
       
  5168             {
       
  5169             TPtrC pt( aUriArray.MdcaPoint(i) );
       
  5170             iLogger->Log(_L("~File [%d]\"%S\""), i, &pt );
       
  5171             }
       
  5172         }
       
  5173     switch( iTestIndex )
       
  5174         {
       
  5175         case 88: //ETCFwCollectTest0088:
       
  5176             DoHandleRemoveLTest0088L(aUriArray, aError);
       
  5177             break;
       
  5178         case 89: //ETCFwCollectTest0089:
       
  5179             DoHandleRemoveLTest0089L(aUriArray, aError);
       
  5180             break;
       
  5181         case 90: //ETCFwCollectTest0090:
       
  5182             DoHandleRemoveLTest0090L(aUriArray, aError);
       
  5183             break;
       
  5184         case 91: //ETCFwCollectTest0091:
       
  5185             DoHandleRemoveLTest0091L(aUriArray, aError);
       
  5186             break;
       
  5187         default:
       
  5188             TestPanic( ETestCommonTestNotSupport );
       
  5189         };
       
  5190     }
       
  5191 
       
  5192 // ---------------------------------------------------------------------------
       
  5193 //  Handle callback for "find" operation
       
  5194 // ---------------------------------------------------------------------------
       
  5195 //
       
  5196 void CCollectionTests::HandleFindAllL(const CMPXMedia& aResults, TBool aComplete,
       
  5197                                      TInt aError)
       
  5198     {
       
  5199     iLogger->Log( KTextHandleFindAllL );
       
  5200     iLogger->Log( _L("~HandleFindAllL executed with error: %d, complete: %d"), aError, aComplete );
       
  5201     switch( iTestIndex )
       
  5202         {
       
  5203         case 126: //ETCFwCollectTest0126:
       
  5204             DoHandleFindAllTest0126L(aResults, aComplete, aError);
       
  5205             break;
       
  5206         case 127: //ETCFwCollectTest0127:
       
  5207             DoHandleFindAllTest0127L(aResults, aComplete, aError);
       
  5208             break;
       
  5209         case 128: //ETCFwCollectTest0128:
       
  5210             DoHandleFindAllTest0128L(aResults, aComplete, aError);
       
  5211             break;
       
  5212         case 129: //ETCFwCollectTest0129:
       
  5213             DoHandleFindAllTest0129L(aResults, aComplete, aError);
       
  5214             break;
       
  5215         case 130: //ETCFwCollectTest0130:
       
  5216             DoHandleFindAllTest0130L(aResults, aComplete, aError);
       
  5217             break;
       
  5218         default:
       
  5219             TestPanic( ETestCommonTestNotSupport );
       
  5220         };
       
  5221     }
       
  5222    
       
  5223 // -----------------------------------------------------------------------------
       
  5224 // Assert Utility
       
  5225 // -----------------------------------------------------------------------------	
       
  5226 void CCollectionTests::AssertL(TBool aCondition, TInt aCheckPt)
       
  5227     {
       
  5228     if( !aCondition )
       
  5229         {
       
  5230         iLogger->Log(KTestModuleCheckptFail, aCheckPt);
       
  5231         iLatestTestResult = KErrGeneral;
       
  5232         TestCompleteL(); // stop on failure
       
  5233         }
       
  5234     }
       
  5235     
       
  5236 // -----------------------------------------------------------------------------
       
  5237 // Compare Utility
       
  5238 // -----------------------------------------------------------------------------
       
  5239 TBool CCollectionTests::CompareByTMPXItemId(const TMPXItemId& aFirst, 
       
  5240                                                 const TMPXItemId& aSecond)
       
  5241     {
       
  5242     // Compare the id
       
  5243     return aFirst == (TInt)aSecond;
       
  5244     }
       
  5245 
       
  5246 // -----------------------------------------------------------------------------	
       
  5247 // Initialize new collection
       
  5248 // -----------------------------------------------------------------------------
       
  5249 void CCollectionTests::Collection1_Initialize()
       
  5250 	{
       
  5251     DELETE_COLLECTION_PTR(iCollectionUtility1);
       
  5252     
       
  5253     iCollectionUtility1 = MMPXCollectionUtility::NewL(this, KMcModeDefault);
       
  5254     }
       
  5255     	
       
  5256 // -----------------------------------------------------------------------------    	
       
  5257 // Initialize new collection and open with TMPXOpenMode
       
  5258 // -----------------------------------------------------------------------------
       
  5259 void CCollectionTests::Collection2_InitializeAndOpenL(TMPXOpenMode aOpenMode)
       
  5260     {
       
  5261     iTempCnt = 0;
       
  5262     
       
  5263     DELETE_COLLECTION_PTR(iCollectionUtility2);
       
  5264 
       
  5265     // Prevent iCollectionUtility2 from using same context as iCollectionUtility1
       
  5266     iCollectionUtility2 = MMPXCollectionUtility::NewL(this, KMcModeIsolated);
       
  5267     iCollectionUtility2->Collection().OpenL( aOpenMode );
       
  5268     }
       
  5269