mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxuser.cpp
changeset 0 a2952bb97e68
child 40 4a1905d205a2
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2002 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:  MPXUser testing implementation (mpxuser.h)
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <s32mem.h>
       
    20 
       
    21 #include <ctsydomainpskeys.h>
       
    22 #include <data_caging_path_literals.hrh>
       
    23 
       
    24 #include "commontestclass.h"
       
    25 #include "mpxuser.h"
       
    26 
       
    27 #include <coeaui.h>
       
    28 #include "EdwinTestControl.h"
       
    29 #include <EIKENV.H>
       
    30 
       
    31 // Begin MPXUser testing implementation (mpxuser.h)=======================================
       
    32 // -----------------------------------------------------------------------------
       
    33 // CCommonTestClass::CompareUids()
       
    34 // Returns: Symbian OS errors.
       
    35 // -----------------------------------------------------------------------------
       
    36 TInt CCommonTestClass::CompareUids()
       
    37     {
       
    38 	FTRACE(FPrint(_L("CCommonTestClass::CompareUids testing MPXUser::CompareUids() begin")));
       
    39     iLog->Log(_L("CCommonTestClass::CompareUids testing MPXUser::CompareUids() begin"));
       
    40     TInt err = KErrNone;
       
    41     const TUid KMPXCollectionServerUid3={0x101FFC31};  
       
    42     const TUid KPodcastCollection = {0x101FFB31};
       
    43         
       
    44     TInt notequal = MPXUser::CompareUids(KMPXCollectionServerUid3, KPodcastCollection);
       
    45     TInt equal = MPXUser::CompareUids(KMPXCollectionServerUid3, KMPXCollectionServerUid3);
       
    46     
       
    47     if ( !notequal || equal )
       
    48         {
       
    49         err = KErrUnexpectedValue;
       
    50         }
       
    51     
       
    52 	FTRACE(FPrint(_L("CCommonTestClass::CompareUids testing MPXUser::CompareUids() end err=%d"), err));
       
    53     iLog->Log(_L("CCommonTestClass::CompareUids testing MPXUser::CompareUids() end err=%d"), err);
       
    54 	return err;
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CCommonTestClass::IsCallOngoing()
       
    59 // Returns: Symbian OS errors.
       
    60 // -----------------------------------------------------------------------------
       
    61 TInt CCommonTestClass::IsCallOngoing()
       
    62     {
       
    63 	FTRACE(FPrint(_L("CCommonTestClass::IsCallOngoing testing MPXUser::IsCallOngoing() begin")));
       
    64     iLog->Log(_L("CCommonTestClass::IsCallOngoing testing MPXUser::IsCallOngoing() begin"));
       
    65     TInt err = KErrNone;
       
    66 
       
    67     MPXUser::IsCallOngoing(EPSCTsyCallTypeH324Multimedia);
       
    68     
       
    69 	FTRACE(FPrint(_L("CCommonTestClass::IsCallOngoing testing MPXUser::IsCallOngoing() end err=%d"), err));
       
    70     iLog->Log(_L("CCommonTestClass::IsCallOngoing testing MPXUser::IsCallOngoing() end err=%d"), err);
       
    71 	return err;
       
    72     }
       
    73 
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CCommonTestClass::CompleteWithDllPath()
       
    77 // Returns: Symbian OS errors.
       
    78 // -----------------------------------------------------------------------------
       
    79 TInt CCommonTestClass::CompleteWithDllPath()
       
    80     {
       
    81 	FTRACE(FPrint(_L("CCommonTestClass::CompleteWithDllPath testing MPXUser::CompleteWithDllPath() begin")));
       
    82     iLog->Log(_L("CCommonTestClass::CompleteWithDllPath testing MPXUser::CompleteWithDllPath() begin"));
       
    83     TInt err = KErrNone;
       
    84 
       
    85     TParse parse;
       
    86     _LIT(KMPXCollectionDbResourceFile,  "mpxcollectiondbres.rsc");
       
    87     parse.Set( KMPXCollectionDbResourceFile, &KDC_APP_RESOURCE_DIR, NULL );
       
    88     TFileName resFile(parse.FullName());
       
    89     User::LeaveIfError(MPXUser::CompleteWithDllPath(resFile));
       
    90     
       
    91 	FTRACE(FPrint(_L("CCommonTestClass::CompleteWithDllPath testing MPXUser::CompleteWithDllPath() end err=%d"), err));
       
    92     iLog->Log(_L("CCommonTestClass::CompleteWithDllPath testing MPXUser::CompleteWithDllPath() end err=%d"), err);
       
    93 	return err;
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CCommonTestClass::Alloc8L()
       
    98 // Returns: Symbian OS errors.
       
    99 // -----------------------------------------------------------------------------
       
   100 TInt CCommonTestClass::Alloc8L()
       
   101     {
       
   102 	FTRACE(FPrint(_L("CCommonTestClass::Alloc8L testing MPXUser::Alloc8L() begin")));
       
   103     iLog->Log(_L("CCommonTestClass::Alloc8L testing MPXUser::Alloc8L() begin"));
       
   104     TInt err = KErrNone;
       
   105 
       
   106     TParse parse;
       
   107     _LIT(descriptor,  "memory to be allocated");
       
   108     HBufC8* mem = MPXUser::Alloc8L(descriptor);
       
   109     delete mem;
       
   110 	FTRACE(FPrint(_L("CCommonTestClass::Alloc8L testing MPXUser::Alloc8L() end err=%d"), err));
       
   111     iLog->Log(_L("CCommonTestClass::Alloc8L testing MPXUser::Alloc8L() end err=%d"), err);
       
   112 	return err;
       
   113     }
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // CCommonTestClass::AllocL()
       
   117 // Returns: Symbian OS errors.
       
   118 // -----------------------------------------------------------------------------
       
   119 TInt CCommonTestClass::AllocL()
       
   120     {
       
   121 	FTRACE(FPrint(_L("CCommonTestClass::AllocL testing MPXUser::AllocL() begin")));
       
   122     iLog->Log(_L("CCommonTestClass::AllocL testing MPXUser::AllocL() begin"));
       
   123     TInt err = KErrNone;
       
   124 
       
   125     TParse parse;
       
   126     _LIT8(descriptor,  "memory to be allocated");
       
   127     HBufC* mem = MPXUser::AllocL(descriptor);
       
   128     delete mem;
       
   129 	FTRACE(FPrint(_L("CCommonTestClass::AllocL testing MPXUser::AllocL() end err=%d"), err));
       
   130     iLog->Log(_L("CCommonTestClass::AllocL testing MPXUser::AllocL() end err=%d"), err);
       
   131 	return err;
       
   132     }
       
   133 
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 // CCommonTestClass::Ptr()
       
   137 // Returns: Symbian OS errors.
       
   138 // -----------------------------------------------------------------------------
       
   139 TInt CCommonTestClass::Ptr()
       
   140     {
       
   141 	FTRACE(FPrint(_L("CCommonTestClass::Ptr testing MPXUser::Ptr(const TDesC& aDes) begin")));
       
   142     iLog->Log(_L("CCommonTestClass::Ptr testing MPXUser::Ptr(const TDesC& aDes) begin"));
       
   143     TInt err = KErrNone;
       
   144 
       
   145     TBufC8<40> descriptor8(_L8("xxx"));
       
   146     TPtrC mem = MPXUser::Ptr(descriptor8);
       
   147 	FTRACE(FPrint(_L("CCommonTestClass::Ptr testing MPXUser::Ptr(const TDesC& aDes) end err=%d"), err));
       
   148     iLog->Log(_L("CCommonTestClass::Ptr testing MPXUser::Ptr(const TDesC& aDes) end err=%d"), err);
       
   149 	return err;
       
   150     }
       
   151 
       
   152     
       
   153 // -----------------------------------------------------------------------------
       
   154 // CCommonTestClass::Ptr8()
       
   155 // Returns: Symbian OS errors.
       
   156 // -----------------------------------------------------------------------------
       
   157 TInt CCommonTestClass::Ptr8()
       
   158     {
       
   159 	FTRACE(FPrint(_L("CCommonTestClass::Ptr8 testing MPXUser::Ptr(const TDesC& aDes) begin")));
       
   160     iLog->Log(_L("CCommonTestClass::Ptr8 testing MPXUser::Ptr(const TDesC& aDes) begin"));
       
   161     TInt err = KErrNone;
       
   162 
       
   163     TBufC<40> descriptor16(_L("xxx"));
       
   164     TPtrC8 mem = MPXUser::Ptr(descriptor16);
       
   165 	FTRACE(FPrint(_L("CCommonTestClass::Ptr8 testing MPXUser::Ptr(const TDesC& aDes) end err=%d"), err));
       
   166     iLog->Log(_L("CCommonTestClass::Ptr8 testing MPXUser::Ptr(const TDesC& aDes) end err=%d"), err);
       
   167 	return err;
       
   168     }
       
   169 
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CCommonTestClass::CreateBufferLC()
       
   173 // Returns: Symbian OS errors.
       
   174 // -----------------------------------------------------------------------------
       
   175 TInt CCommonTestClass::CreateBufferLC()
       
   176     {
       
   177 	FTRACE(FPrint(_L("CCommonTestClass::CreateBufferLC testing MPXUser::CreateBufferLC() begin")));
       
   178     iLog->Log(_L("CCommonTestClass::CreateBufferLC testing MPXUser::CreateBufferLC() begin"));
       
   179     TInt err = KErrNone;
       
   180 
       
   181     TBufC<40> descriptor(_L("xxx"));
       
   182     CBufBase* buf( MPXUser::CreateBufferLC( descriptor.Size() ));
       
   183     CleanupStack::Pop( buf );
       
   184     
       
   185 	FTRACE(FPrint(_L("CCommonTestClass::CreateBufferLC testing MPXUser::CreateBufferLC(s) end err=%d"), err));
       
   186     iLog->Log(_L("CCommonTestClass::CreateBufferLC testing MPXUser::CreateBufferLC() end err=%d"), err);
       
   187 	return err;
       
   188     }
       
   189 
       
   190 
       
   191 // -----------------------------------------------------------------------------
       
   192 // CCommonTestClass::CreateBufferDesCL()
       
   193 // Returns: Symbian OS errors.
       
   194 // -----------------------------------------------------------------------------
       
   195 TInt CCommonTestClass::CreateBufferDesCL()
       
   196     {
       
   197 	FTRACE(FPrint(_L("CCommonTestClass::CreateBufferDesCL testing MPXUser::CreateBufferL() begin")));
       
   198     iLog->Log(_L("CCommonTestClass::CreateBufferDesCL testing MPXUser::CreateBufferL() begin"));
       
   199     TInt err = KErrNone;
       
   200 
       
   201     TBufC<40> descriptor(_L("xxx"));
       
   202     CBufBase* buffer(NULL);
       
   203     MPXUser::CreateBufferL( descriptor, buffer );
       
   204     delete buffer;    
       
   205 	FTRACE(FPrint(_L("CCommonTestClass::CreateBufferDesCL testing MPXUser::CreateBufferL(s) end err=%d"), err));
       
   206     iLog->Log(_L("CCommonTestClass::CreateBufferDesCL testing MPXUser::CreateBufferL() end err=%d"), err);
       
   207 	return err;
       
   208     }
       
   209 
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // CCommonTestClass::CreateBufferDesCArrayL()
       
   213 // Returns: Symbian OS errors.
       
   214 // -----------------------------------------------------------------------------
       
   215 TInt CCommonTestClass::CreateBufferDesCArrayL()
       
   216     {
       
   217 	FTRACE(FPrint(_L("CCommonTestClass::CreateBufferDesCArrayL testing MPXUser::CreateBufferL() begin")));
       
   218     iLog->Log(_L("CCommonTestClass::CreateBufferDesCArrayL testing MPXUser::CreateBufferL() begin"));
       
   219     TInt err = KErrNone;
       
   220 
       
   221     CDesCArray* array = new(ELeave)CDesCArrayFlat(10);    
       
   222     array->AppendL(_L("test"));
       
   223     CBufBase* buffer(NULL);
       
   224     MPXUser::CreateBufferL( array, buffer );
       
   225     delete buffer;    
       
   226     delete array;
       
   227 	FTRACE(FPrint(_L("CCommonTestClass::CreateBufferDesCArrayL testing MPXUser::CreateBufferL(s) end err=%d"), err));
       
   228     iLog->Log(_L("CCommonTestClass::CreateBufferDesCArrayL testing MPXUser::CreateBufferL() end err=%d"), err);
       
   229 	return err;
       
   230     }
       
   231 
       
   232 // -----------------------------------------------------------------------------
       
   233 // CCommonTestClass::CreateBufferMsgL()
       
   234 // Returns: Symbian OS errors.
       
   235 // -----------------------------------------------------------------------------
       
   236 TInt CCommonTestClass::CreateBufferMsgL()
       
   237     {//TODO need to update
       
   238 	FTRACE(FPrint(_L("CCommonTestClass::CreateBufferMsgL testing MPXUser::CreateBufferL() begin")));
       
   239     iLog->Log(_L("CCommonTestClass::CreateBufferMsgL testing MPXUser::CreateBufferL() begin"));
       
   240     TInt err = KErrNone;
       
   241 
       
   242     RMessage2* msg = new(ELeave)RMessage2();
       
   243        
       
   244 //    HBufC* msg1 = HBufC::New( 20 );
       
   245 //    HBufC* msg2 = HBufC::New( 20 );
       
   246 //    TUint16 msgContent = (TUint16)1;
       
   247 //    msg1->Des().Copy( &msgContent );
       
   248 //    msg2->Des().Copy( &msgContent );
       
   249 //
       
   250 //    TPtr msgPtr1 = msg1->Des();
       
   251 //    TPtr msgPtr2 = msg2->Des();
       
   252 ////    
       
   253 ////    TDes8* msgTDes(NULL);
       
   254 //
       
   255 //    msg->ReadL( 0,msgPtr1 );
       
   256 //    msg->ReadL( 1,msgPtr2 );
       
   257     
       
   258 //    msg.Write( 1,_L("Message") );
       
   259 //    const TRequestStatus* statusConst = msg->ClientStatus();
       
   260 //    TRequestStatus* status = const_cast<TRequestStatus*>( statusConst );
       
   261 //    TInt statusValue= status->operator =( 2 );
       
   262 //    TBuf8<2> msgContent;
       
   263 //    TUint8 msgNum = (TUint8)1;
       
   264 //    msgContent = &msgNum;
       
   265 //    msg.Read( 0,msgContent );
       
   266     CBufBase* buffer(NULL);
       
   267     MPXUser::CreateBufferL( *msg,1,buffer );
       
   268     delete buffer;    
       
   269 
       
   270 	FTRACE(FPrint(_L("CCommonTestClass::CreateBufferMsgL testing MPXUser::CreateBufferL(s) end err=%d"), err));
       
   271     iLog->Log(_L("CCommonTestClass::CreateBufferMsgL testing MPXUser::CreateBufferL() end err=%d"), err);
       
   272 	return err;
       
   273     }
       
   274 
       
   275 
       
   276 
       
   277 // -----------------------------------------------------------------------------
       
   278 // CCommonTestClass::ExternalizeL()
       
   279 // Returns: Symbian OS errors.
       
   280 // -----------------------------------------------------------------------------
       
   281 TInt CCommonTestClass::ExternalizeL()
       
   282     {
       
   283 	FTRACE(FPrint(_L("CCommonTestClass::ExternalizeL testing MPXUser::ExternalizeL() begin")));
       
   284     iLog->Log(_L("CCommonTestClass::ExternalizeL testing MPXUser::ExternalizeL() begin"));
       
   285 
       
   286 	TInt err = KErrNone;
       
   287     
       
   288     CBufBase* buffer = CBufFlat::NewL( 50 );
       
   289     CleanupStack::PushL( buffer );
       
   290     RBufWriteStream writeStream( *buffer );
       
   291     CleanupClosePushL( writeStream );
       
   292     CDesCArray* array = new(ELeave)CDesCArrayFlat(10);    
       
   293     array->AppendL(_L("test"));
       
   294     MPXUser::ExternalizeL( array, writeStream );
       
   295     writeStream.CommitL();
       
   296     buffer->Compress();
       
   297     CleanupStack::PopAndDestroy( &writeStream );
       
   298     delete array;
       
   299     CleanupStack::PopAndDestroy( buffer );
       
   300     
       
   301 	FTRACE(FPrint(_L("CCommonTestClass::ExternalizeL testing MPXUser::ExternalizeL() end err=%d"), err));
       
   302     iLog->Log(_L("CCommonTestClass::ExternalizeL testing MPXUser::ExternalizeL() end err=%d"), err);
       
   303 	return err;
       
   304     }
       
   305 
       
   306 // -----------------------------------------------------------------------------
       
   307 // CCommonTestClass::ExternalizeArrayL()
       
   308 // Returns: Symbian OS errors.
       
   309 // -----------------------------------------------------------------------------
       
   310 TInt CCommonTestClass::ExternalizeArrayL()
       
   311     {
       
   312 	FTRACE(FPrint(_L("CCommonTestClass::ExternalizeArrayL testing MPXUser::ExternalizeL() begin")));
       
   313     iLog->Log(_L("CCommonTestClass::ExternalizeArrayL testing MPXUser::ExternalizeL() begin"));
       
   314 
       
   315 	TInt err = KErrNone;
       
   316     
       
   317     CBufBase* buffer = CBufFlat::NewL( 50 );
       
   318     CleanupStack::PushL( buffer );
       
   319     RBufWriteStream writeStream( *buffer );
       
   320     CleanupClosePushL( writeStream );
       
   321     CDesCArray* array = new(ELeave)CDesCArrayFlat(10);    
       
   322     array->AppendL(_L("test"));
       
   323     RArray<TMPXItemId> items;
       
   324     CleanupClosePushL(items);
       
   325     MPXUser::ExternalizeL( items.Array(), writeStream );
       
   326     writeStream.CommitL();
       
   327     buffer->Compress();
       
   328     CleanupStack::PopAndDestroy( &items );
       
   329     CleanupStack::PopAndDestroy( &writeStream );
       
   330     delete array;
       
   331     CleanupStack::PopAndDestroy( buffer );
       
   332     
       
   333 	FTRACE(FPrint(_L("CCommonTestClass::ExternalizeArrayL testing MPXUser::ExternalizeL() end err=%d"), err));
       
   334     iLog->Log(_L("CCommonTestClass::ExternalizeArrayL testing MPXUser::ExternalizeL() end err=%d"), err);
       
   335 	return err;
       
   336     }
       
   337 
       
   338 
       
   339 // -----------------------------------------------------------------------------
       
   340 // CCommonTestClass::InternalizeArrayL()
       
   341 // Returns: Symbian OS errors.
       
   342 // -----------------------------------------------------------------------------
       
   343 
       
   344 
       
   345 
       
   346 // -----------------------------------------------------------------------------
       
   347 // CCommonTestClass::CopyArrayL()
       
   348 // Returns: Symbian OS errors.
       
   349 // -----------------------------------------------------------------------------
       
   350 TInt CCommonTestClass::CopyArrayL()
       
   351     {
       
   352 	FTRACE(FPrint(_L("CCommonTestClass::CopyArrayL testing MPXUser::CopyArrayL() begin")));
       
   353     iLog->Log(_L("CCommonTestClass::CopyArrayL testing MPXUser::CopyArrayL() begin"));
       
   354     TInt err = KErrNone;
       
   355 
       
   356     CDesCArray* src = new(ELeave)CDesCArrayFlat(10);    
       
   357     CDesCArray* dest = new(ELeave)CDesCArrayFlat(10);    
       
   358     src->AppendL(_L("test"));
       
   359     MPXUser::CopyArrayL( *src, *dest );
       
   360     delete src;    
       
   361     delete dest;
       
   362 	FTRACE(FPrint(_L("CCommonTestClass::CopyArrayL testing MPXUser::CopyArrayL(s) end err=%d"), err));
       
   363     iLog->Log(_L("CCommonTestClass::CopyArrayL testing MPXUser::CopyArrayL() end err=%d"), err);
       
   364 	return err;
       
   365     }
       
   366 
       
   367 
       
   368 // -----------------------------------------------------------------------------
       
   369 // CCommonTestClass::MergeArray()
       
   370 // Returns: Symbian OS errors.
       
   371 // -----------------------------------------------------------------------------
       
   372 TInt CCommonTestClass::MergeArray()
       
   373     {
       
   374 	FTRACE(FPrint(_L("CCommonTestClass::MergeArray testing MPXUser::MergeArray() begin")));
       
   375     iLog->Log(_L("CCommonTestClass::MergeArray testing MPXUser::MergeArray() begin"));
       
   376     TInt err = KErrNone;
       
   377 
       
   378     CDesCArray* src;
       
   379     TRAP(err,src = new(ELeave)CDesCArrayFlat(10));    
       
   380     CDesCArray* dest;
       
   381     TRAP(err,dest = new(ELeave)CDesCArrayFlat(20));    
       
   382     TRAP(err , src->AppendL(_L("test")));
       
   383     MPXUser::MergeArray( *src, *dest );
       
   384     delete src;    
       
   385     delete dest;
       
   386 	FTRACE(FPrint(_L("CCommonTestClass::MergeArray testing MPXUser::MergeArray(s) end err=%d"), err));
       
   387     iLog->Log(_L("CCommonTestClass::MergeArray testing MPXUser::MergeArray() end err=%d"), err);
       
   388 	return err;
       
   389     }
       
   390     
       
   391     
       
   392 // -----------------------------------------------------------------------------
       
   393 // CCommonTestClass::MergeAttributeL()
       
   394 // Returns: Symbian OS errors.
       
   395 // -----------------------------------------------------------------------------
       
   396 TInt CCommonTestClass::MergeAttributeL()
       
   397     {
       
   398 	FTRACE(FPrint(_L("CCommonTestClass::MergeAttributeL testing MPXUser::MergeAttributeL() begin")));
       
   399     iLog->Log(_L("CCommonTestClass::MergeAttributeL testing MPXUser::MergeAttributeL() begin"));
       
   400     TInt err = KErrNone;
       
   401 
       
   402     RArray<TMPXAttribute> atts1;
       
   403     RArray<TMPXAttribute> atts2;
       
   404     CleanupClosePushL(atts1);
       
   405     CleanupClosePushL(atts2);
       
   406 
       
   407     TInt contentId = 0;
       
   408     TUint attId = (TUint)0;
       
   409     TMPXAttribute att(contentId, attId);
       
   410     atts1.Append(att);
       
   411     
       
   412     MPXUser::MergeAttributeL( atts1.Array(), atts2 );
       
   413 
       
   414     CleanupStack::PopAndDestroy( &atts2 );
       
   415     CleanupStack::PopAndDestroy( &atts1 );
       
   416 
       
   417 	FTRACE(FPrint(_L("CCommonTestClass::MergeAttributeL testing MPXUser::MergeAttributeL(s) end err=%d"), err));
       
   418     iLog->Log(_L("CCommonTestClass::MergeAttributeL testing MPXUser::MergeAttributeL() end err=%d"), err);
       
   419 	return err;
       
   420     }
       
   421 
       
   422 
       
   423 // -----------------------------------------------------------------------------
       
   424 // CCommonTestClass::ProcessIdL()
       
   425 // Returns: Symbian OS errors.
       
   426 // -----------------------------------------------------------------------------
       
   427 TInt CCommonTestClass::ProcessIdL()
       
   428     {
       
   429 	FTRACE(FPrint(_L("CCommonTestClass::ProcessIdL testing MPXUser::ProcessIdL() begin")));
       
   430     iLog->Log(_L("CCommonTestClass::ProcessIdL testing MPXUser::ProcessIdL() begin"));
       
   431     TInt err = KErrNone;
       
   432 
       
   433     TThreadId threadId = RThread().Id();
       
   434     MPXUser::ProcessIdL(threadId);
       
   435 
       
   436 	FTRACE(FPrint(_L("CCommonTestClass::ProcessIdL testing MPXUser::ProcessIdL(s) end err=%d"), err));
       
   437     iLog->Log(_L("CCommonTestClass::ProcessIdL testing MPXUser::ProcessIdL() end err=%d"), err);
       
   438 	return err;
       
   439     }
       
   440 
       
   441 // -----------------------------------------------------------------------------
       
   442 // CCommonTestClass::CompareOrderedUidArrays()
       
   443 // Returns: Symbian OS errors.
       
   444 // -----------------------------------------------------------------------------
       
   445 TInt CCommonTestClass::CompareOrderedUidArrays()
       
   446     {
       
   447 	FTRACE(FPrint(_L("CCommonTestClass::CompareOrderedUidArrays testing MPXUser::CompareOrderedUidArrays() begin")));
       
   448     iLog->Log(_L("CCommonTestClass::CompareOrderedUidArrays testing MPXUser::CompareOrderedUidArrays() begin"));
       
   449     TInt err = KErrNone;
       
   450 
       
   451     RArray<TUid> atts1;
       
   452     RArray<TUid> atts2;
       
   453     CleanupClosePushL(atts1);
       
   454     CleanupClosePushL(atts2);
       
   455 
       
   456     const TUid KMPXCollectionServerUid3={0x101FFC31};  
       
   457     const TUid KPodcastCollection = {0x101FFB31};
       
   458     atts1.Append(KMPXCollectionServerUid3);
       
   459     atts1.Append(KPodcastCollection);
       
   460     
       
   461     MPXUser::CompareOrderedUidArrays( atts1.Array(), atts2.Array() );
       
   462 
       
   463     CleanupStack::PopAndDestroy( &atts2 );
       
   464     CleanupStack::PopAndDestroy( &atts1 );
       
   465 
       
   466 	FTRACE(FPrint(_L("CCommonTestClass::CompareOrderedUidArrays testing MPXUser::CompareOrderedUidArrays(s) end err=%d"), err));
       
   467     iLog->Log(_L("CCommonTestClass::CompareOrderedUidArrays testing MPXUser::CompareOrderedUidArrays() end err=%d"), err);
       
   468 	return err;
       
   469     }
       
   470 //add function 
       
   471 
       
   472 
       
   473 
       
   474 // -----------------------------------------------------------------------------
       
   475 // CCommonTestClass::CreateFromBufferL()
       
   476 // Returns: Symbian OS errors.
       
   477 // -----------------------------------------------------------------------------
       
   478 TInt CCommonTestClass::CreateFromBufferL()
       
   479     {
       
   480 	FTRACE(FPrint(_L("CCommonTestClass::CreateFromBufferL testing MPXUser::CreateBufferL() begin")));
       
   481     iLog->Log(_L("CCommonTestClass::CreateFromBufferL testing MPXUser::CreateBufferL() begin"));
       
   482 
       
   483 	TInt err = KErrNone;
       
   484 	CDesCArray* array = new(ELeave)CDesCArrayFlat(10);    
       
   485     array->AppendL(_L("test"));
       
   486     CBufBase* buffer(NULL);
       
   487     MPXUser::CreateBufferL( array, buffer );
       
   488 	
       
   489     MPXUser::CreateFromBufferL( *buffer, array );
       
   490     delete array;
       
   491     delete buffer;
       
   492     
       
   493 	FTRACE(FPrint(_L("CCommonTestClass::CreateFromBufferL testing MPXUser::CreateBufferL(s) end err=%d"), err));
       
   494     iLog->Log(_L("CCommonTestClass::CreateFromBufferL testing MPXUser::CreateBufferL() end err=%d"), err);
       
   495 	return err;
       
   496     }
       
   497 // -----------------------------------------------------------------------------
       
   498 // CCommonTestClass::InternalizeArrayL()
       
   499 // Returns: Symbian OS errors.
       
   500 // -----------------------------------------------------------------------------
       
   501 TInt CCommonTestClass::InternalizeArrayL()
       
   502     {
       
   503 	FTRACE(FPrint(_L("CCommonTestClass::InternalizeArrayL testing MPXUser::InternalizeL() begin")));
       
   504     iLog->Log(_L("CCommonTestClass::InternalizeArrayL testing MPXUser::InternalizeL() begin"));
       
   505 
       
   506 	TInt err = KErrNone;
       
   507 	
       
   508     CBufBase* buffer = CBufFlat::NewL( 50 );
       
   509     CleanupStack::PushL( buffer );
       
   510     RBufWriteStream writeStream( *buffer );
       
   511     CleanupClosePushL( writeStream );
       
   512     writeStream.WriteInt32L( 1 );
       
   513     writeStream.WriteUint32L( 1000 );
       
   514     writeStream.WriteUint32L( 1001 );
       
   515     writeStream.CommitL();
       
   516     //buffer->Compress();
       
   517     RBufReadStream readStream( *buffer );
       
   518     CleanupClosePushL( readStream );
       
   519 
       
   520     //create items
       
   521     RArray<TMPXItemId> items;
       
   522     CleanupClosePushL( items );
       
   523     
       
   524     MPXUser::InternalizeL( items, readStream );
       
   525     CleanupStack::PopAndDestroy( 4 );
       
   526 
       
   527 	FTRACE(FPrint(_L("CCommonTestClass::InternalizeArrayL testing MPXUser::InternalizeL() end err=%d"), err));
       
   528     iLog->Log(_L("CCommonTestClass::InternalizeArrayL testing MPXUser::InternalizeL() end err=%d"), err);
       
   529 	return err;
       
   530     }
       
   531 
       
   532 // -----------------------------------------------------------------------------
       
   533 // CCommonTestClass::InternalizeDesCArrayL()
       
   534 // Returns: Symbian OS errors.
       
   535 // -----------------------------------------------------------------------------
       
   536 TInt CCommonTestClass::InternalizeDesCArrayL()
       
   537     {
       
   538 	FTRACE(FPrint(_L("CCommonTestClass::InternalizeDesCArrayL testing MPXUser::InternalizeL() begin")));
       
   539     iLog->Log(_L("CCommonTestClass::InternalizeDesCArrayL testing MPXUser::InternalizeL() begin"));
       
   540 
       
   541 	TInt err = KErrNone;
       
   542 	
       
   543     CBufBase* buffer = CBufFlat::NewL( 50 );
       
   544     CleanupStack::PushL( buffer );
       
   545     RBufWriteStream writeStream( *buffer );
       
   546     CleanupClosePushL( writeStream );
       
   547     writeStream.WriteInt32L( 0 );
       
   548 //    writeStream.WriteUint32L( 1000 );
       
   549 //    writeStream.WriteL( _L("ArrayItem") );
       
   550     writeStream.CommitL();
       
   551     //buffer->Compress();
       
   552     RBufReadStream readStream( *buffer );
       
   553     CleanupClosePushL( readStream );
       
   554     
       
   555     CDesCArray* array = new(ELeave)CDesCArrayFlat(10);    
       
   556     array->AppendL(_L("test"));
       
   557 
       
   558     
       
   559     MPXUser::InternalizeL( array, readStream );
       
   560     buffer->Compress();
       
   561     delete array;
       
   562     CleanupStack::PopAndDestroy( 3 );
       
   563      
       
   564 	FTRACE(FPrint(_L("CCommonTestClass::InternalizeDesCArrayL testing MPXUser::InternalizeL() end err=%d"), err));
       
   565     iLog->Log(_L("CCommonTestClass::InternalizeDesCArrayL testing MPXUser::InternalizeL() end err=%d"), err);
       
   566 	return err;
       
   567     }
       
   568 
       
   569 
       
   570 // -----------------------------------------------------------------------------
       
   571 // CCommonTestClass::FindWindowGroupIdL()
       
   572 // Returns: Symbian OS errors.
       
   573 // -----------------------------------------------------------------------------
       
   574 TInt CCommonTestClass::FindWindowGroupIdL()
       
   575     {
       
   576     FTRACE(FPrint(_L("CCommonTestClass::FindWindowGroupIdL testing MPXUser::FindWindowGroupIdL() begin")));
       
   577     iLog->Log(_L("CCommonTestClass::FindWindowGroupIdL testing MPXUser::FindWindowGroupIdL() begin"));
       
   578     
       
   579     TInt err = KErrNone;
       
   580     TProcessId aProcId;
       
   581   
       
   582     TThreadId threadId = RThread().Id();
       
   583     aProcId= MPXUser::ProcessIdL(threadId);
       
   584    
       
   585     RWsSession wsSession=CEikonEnv::Static()->WsSession();
       
   586 
       
   587     MPXUser::FindWindowGroupIdL(aProcId,wsSession );
       
   588   
       
   589     FTRACE(FPrint(_L("CCommonTestClass::FindWindowGroupIdL testing MPXUser::FindWindowGroupIdL() end err=%d"), err));
       
   590     iLog->Log(_L("CCommonTestClass::FindWindowGroupIdL testing MPXUser::FindWindowGroupIdL() end err=%d"), err);
       
   591    
       
   592    	return err; 
       
   593     }
       
   594 // -----------------------------------------------------------------------------
       
   595 // CCommonTestClass::CompleteWithDllPathOL()
       
   596 // Returns: Symbian OS errors.
       
   597 // -----------------------------------------------------------------------------
       
   598 TInt CCommonTestClass::CompleteWithDllPathOL()
       
   599     {
       
   600     FTRACE(FPrint(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() begin")));
       
   601     iLog->Log(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() begin"));
       
   602   
       
   603     TInt err = KErrNone;
       
   604     TParse parse;
       
   605     _LIT(KMPXCollectionDbResourceFile,  "mpxcollectiondbres.rsc");
       
   606     parse.Set( KMPXCollectionDbResourceFile, &KDC_APP_RESOURCE_DIR, NULL );
       
   607     TFileName resFile(parse.FullName());
       
   608     _LIT(KmpxDllName,"mpxcollectiondbres.dll");
       
   609     const TDesC& aDllName = KmpxDllName;
       
   610     MPXUser::CompleteWithDllPath(aDllName,resFile);
       
   611     
       
   612     FTRACE(FPrint(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() end err=%d"), err));
       
   613     iLog->Log(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() end err=%d"), err);
       
   614 
       
   615 	return err;
       
   616     }
       
   617 
       
   618 // -----------------------------------------------------------------------------
       
   619 // CCommonTestClass::RecreateBufferL()
       
   620 // Returns: Symbian OS errors.
       
   621 // -----------------------------------------------------------------------------
       
   622 TInt CCommonTestClass::RecreateBufferL()
       
   623     {
       
   624     FTRACE(FPrint(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() begin")));
       
   625     iLog->Log(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() begin"));
       
   626 
       
   627     TInt err = KErrNone;
       
   628     TInt aSize = 4;
       
   629     CBufBase* buf=CBufFlat::NewL(aSize);
       
   630     MPXUser::RecreateBufferL( 4 , buf );
       
   631     
       
   632     FTRACE(FPrint(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() end err=%d"), err));
       
   633     iLog->Log(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() end err=%d"), err);
       
   634 	return err;
       
   635     }
       
   636 // -----------------------------------------------------------------------------
       
   637 // CCommonTestClass::Alloc8ZL()
       
   638 // Returns: Symbian OS errors.
       
   639 // -----------------------------------------------------------------------------
       
   640 TInt CCommonTestClass::Alloc8ZL()
       
   641     {
       
   642       FTRACE(FPrint(_L("CCommonTestClass::Alloc8ZL testing MPXUser::Alloc8ZL() begin")));
       
   643 	  iLog->Log(_L("CCommonTestClass::Alloc8ZL testing MPXUser::Alloc8ZL() begin"));
       
   644 	  TInt err = KErrNone;
       
   645 	  TParse parse;
       
   646       _LIT(descriptor,  "memory to be allocated");
       
   647       HBufC8* mem = MPXUser::Alloc8ZL(descriptor);
       
   648       delete mem;
       
   649       FTRACE(FPrint(_L("CCommonTestClass::Alloc8ZL testing MPXUser::Alloc8ZL() end err=%d"), err));
       
   650       iLog->Log(_L("CCommonTestClass::Alloc8ZL testing MPXUser::Alloc8ZL() end err=%d"), err);
       
   651       return err;
       
   652     }
       
   653     
       
   654 // -----------------------------------------------------------------------------
       
   655 // CCommonTestClass::CreateBufferRMessage()
       
   656 // Returns: Symbian OS errors.
       
   657 // -----------------------------------------------------------------------------
       
   658