os/ossrv/lowlevellibsandfws/apputils/tsrc/T_NamedPlugins.CPP
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Tests for CBaNamedPlugins class, which contains CParameters class
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include <banamedplugins.h>
sl@0
    19
#include <e32test.h>
sl@0
    20
#include <basched.h>
sl@0
    21
#include <f32file.h>
sl@0
    22
#include <baflpan.h>
sl@0
    23
sl@0
    24
RTest TheTest(_L("T_NamedPlugins"));
sl@0
    25
RFs TheFs;
sl@0
    26
sl@0
    27
//Test macros and functions
sl@0
    28
sl@0
    29
LOCAL_C void Check(TInt aValue, TInt aLine)
sl@0
    30
	{
sl@0
    31
	if(!aValue)
sl@0
    32
		{
sl@0
    33
		TheTest(EFalse, aLine);
sl@0
    34
		}
sl@0
    35
	}
sl@0
    36
sl@0
    37
LOCAL_C void Check(TInt aValue, TInt aExpected, TInt aLine)
sl@0
    38
	{
sl@0
    39
	if(aValue != aExpected)
sl@0
    40
		{
sl@0
    41
		RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
sl@0
    42
		TheTest(EFalse, aLine);
sl@0
    43
		}
sl@0
    44
	}
sl@0
    45
sl@0
    46
#define TEST(arg) Check((arg), __LINE__)
sl@0
    47
#define TEST2(aValue, aExpected) Check(aValue, aExpected, __LINE__)
sl@0
    48
sl@0
    49
sl@0
    50
TUid KUid1 = {0xE1A01753};
sl@0
    51
TUid KUid2 = {0xE1B01753};
sl@0
    52
sl@0
    53
_LIT(KRscFileName1, "\\resource\\plugins\\E1A01753.RSC");
sl@0
    54
_LIT(KRscFileName2, "\\resource\\plugins\\E1B01753.RSC");
sl@0
    55
_LIT(KIdentifier, "plugin");
sl@0
    56
_LIT(KBadIdentifier, "plugni");
sl@0
    57
_LIT(KMainPath, "\\system\\data\\");
sl@0
    58
_LIT(KLitWildCard, "*.RSC");
sl@0
    59
_LIT(KTextForNone, "NoPlugin");
sl@0
    60
sl@0
    61
class CImplementation: public CBaNamedPlugins::MFallBackName
sl@0
    62
{
sl@0
    63
	public:
sl@0
    64
sl@0
    65
		HBufC* FallBackNameL(const TDesC& aFullResourceFileName) const;
sl@0
    66
};
sl@0
    67
sl@0
    68
HBufC* CImplementation::FallBackNameL(const TDesC& aFullResourceFileName) const
sl@0
    69
{
sl@0
    70
	return aFullResourceFileName.AllocL();
sl@0
    71
}
sl@0
    72
sl@0
    73
TBool TestAlgorithmToCompareNames(const TDesC& aName1, const TDesC& aName2)
sl@0
    74
	{
sl@0
    75
	return( aName1.CompareC(aName2) == 0);	// Function is supposed to return 1, when CompareC returns 0
sl@0
    76
	}
sl@0
    77
sl@0
    78
/*
sl@0
    79
@SYMTestCaseID          SYSLIB-BAFL-CT-1756
sl@0
    80
@SYMTestCaseDesc        CBaNamedPlugins class test
sl@0
    81
                        Tests for CBaNamedPlugins::IndexOfIdentifier(), CBaNamedPlugins::IndexOfUid(), CBaNamedPlugins::MdcaPoint(), CBaNamedPlugins::IdentifierAtIndex(), CBaNamedPlugins::UidAtIndex(),CBaNamedPlugins::MdcaCount() functions
sl@0
    82
@SYMTestPriority        Medium
sl@0
    83
@SYMTestActions         CBaNamedPlugins object is populated with resource file names and checking for identifier and Uid
sl@0
    84
@SYMTestExpectedResults Test must not fail
sl@0
    85
@SYMREQ                 REQ0000
sl@0
    86
*/
sl@0
    87
sl@0
    88
void DoTests1()
sl@0
    89
{
sl@0
    90
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-1756 Testing DoTests1... "));
sl@0
    91
	TBuf<64> buf;
sl@0
    92
sl@0
    93
  	CBaNamedPlugins* namedPlugins;
sl@0
    94
    RArray<CBaNamedPlugins::TResourceFile> arrayOfResourceFiles;
sl@0
    95
    CleanupClosePushL(arrayOfResourceFiles);
sl@0
    96
sl@0
    97
    buf = KRscFileName1;
sl@0
    98
sl@0
    99
    CBaNamedPlugins::TResourceFile resourceFile1;
sl@0
   100
    resourceFile1.iFullFileName = buf.AllocLC();
sl@0
   101
    resourceFile1.iIdentifier = NULL;
sl@0
   102
    resourceFile1.iUid = KUid1;
sl@0
   103
    resourceFile1.iFormat = CBaNamedPlugins::TResourceFile::EFormatTbuf;
sl@0
   104
    User::LeaveIfError(arrayOfResourceFiles.Append(resourceFile1));
sl@0
   105
    CleanupStack::Pop(resourceFile1.iFullFileName);
sl@0
   106
sl@0
   107
    buf = KRscFileName2;
sl@0
   108
sl@0
   109
    CBaNamedPlugins::TResourceFile resourceFile2;
sl@0
   110
    resourceFile2.iFullFileName = buf.AllocLC();
sl@0
   111
    buf = KIdentifier;
sl@0
   112
    resourceFile2.iIdentifier = buf.AllocLC();
sl@0
   113
    resourceFile2.iUid = KUid2;
sl@0
   114
    resourceFile2.iFormat = CBaNamedPlugins::TResourceFile::EFormatTbuf;
sl@0
   115
    User::LeaveIfError(arrayOfResourceFiles.Append(resourceFile2));
sl@0
   116
    CleanupStack::Pop(resourceFile2.iIdentifier);
sl@0
   117
sl@0
   118
    CleanupStack::Pop(resourceFile2.iFullFileName);
sl@0
   119
sl@0
   120
    CBaNamedPlugins::CParameters* const parameters = CBaNamedPlugins::CParameters::NewLC(TheFs, arrayOfResourceFiles.Array());
sl@0
   121
	HBufC* textForNone=KTextForNone().AllocL();
sl@0
   122
  	parameters->SetTextForNone(textForNone,CBaNamedPlugins::EArrayPositionLast);
sl@0
   123
sl@0
   124
  	// This call to SetTextForNoneL will delete textForNone
sl@0
   125
  	parameters->SetTextForNoneL(KTextForNone,CBaNamedPlugins::EArrayPositionLast);
sl@0
   126
sl@0
   127
    namedPlugins = CBaNamedPlugins::NewL(*parameters);
sl@0
   128
sl@0
   129
    CBaNamedPlugins::TEquivalentIdentifiers eqIdent = TestAlgorithmToCompareNames;
sl@0
   130
	TInt i = (*namedPlugins).IndexOfIdentifier(KIdentifier,eqIdent);
sl@0
   131
	// With the sorting algorithm and resource files benig used KIdentifier is at index 0
sl@0
   132
	TEST2(i,0);
sl@0
   133
	i = (*namedPlugins).IndexOfIdentifier(KBadIdentifier,eqIdent);
sl@0
   134
	TEST2(i,KErrNotFound);
sl@0
   135
sl@0
   136
	TInt index = namedPlugins->IndexOfUid(KUid1);
sl@0
   137
    TEST(index>=0);
sl@0
   138
    TPtrC name;
sl@0
   139
    if( index >= 0 )
sl@0
   140
        {
sl@0
   141
        name.Set((*namedPlugins).MdcaPoint(index));
sl@0
   142
        }
sl@0
   143
    index = (namedPlugins)->IndexOfUid(TUid::Uid(0x123));
sl@0
   144
    TEST2(index,-1);
sl@0
   145
sl@0
   146
    TEST((*namedPlugins).IdentifierAtIndex(1)!= &buf);
sl@0
   147
    TEST((*namedPlugins).UidAtIndex(0)==KUid2);
sl@0
   148
    TEST((*namedPlugins).UidAtIndex(1)==KUid1);
sl@0
   149
sl@0
   150
	TInt count = (*namedPlugins).MdcaCount();
sl@0
   151
	TEST2(count,3);
sl@0
   152
sl@0
   153
    count = arrayOfResourceFiles.Count();
sl@0
   154
    for(i = 0; i < count; i++ )
sl@0
   155
        {
sl@0
   156
        const CBaNamedPlugins::TResourceFile& resourceFileData=arrayOfResourceFiles[i];
sl@0
   157
        delete resourceFileData.iFullFileName;
sl@0
   158
        delete resourceFileData.iIdentifier;
sl@0
   159
        }
sl@0
   160
sl@0
   161
    CleanupStack::PopAndDestroy(2, &arrayOfResourceFiles);
sl@0
   162
    delete namedPlugins;
sl@0
   163
sl@0
   164
	// Test EFormatArrayOfUidNamePairs format
sl@0
   165
	buf = KRscFileName1;
sl@0
   166
sl@0
   167
	CleanupClosePushL(arrayOfResourceFiles);
sl@0
   168
sl@0
   169
	CBaNamedPlugins::TResourceFile resourceFile;
sl@0
   170
	resourceFile.iFullFileName = KRscFileName1().AllocLC();
sl@0
   171
	resourceFile.iIdentifier = NULL;
sl@0
   172
	resourceFile.iUid = KNullUid;
sl@0
   173
	resourceFile.iFormat = CBaNamedPlugins::TResourceFile::EFormatArrayOfUidNamePairs;
sl@0
   174
	User::LeaveIfError(arrayOfResourceFiles.Append(resourceFile));
sl@0
   175
	CleanupStack::Pop(resourceFile.iFullFileName);
sl@0
   176
sl@0
   177
	CBaNamedPlugins::CParameters* const parameters1 = CBaNamedPlugins::CParameters::NewL(TheFs, arrayOfResourceFiles.Array());
sl@0
   178
	textForNone=KTextForNone().AllocL();
sl@0
   179
  	parameters1->SetTextForNone(textForNone,CBaNamedPlugins::EArrayPositionFirst);
sl@0
   180
    namedPlugins = CBaNamedPlugins::NewL(*parameters1);
sl@0
   181
sl@0
   182
	delete resourceFile.iFullFileName;
sl@0
   183
sl@0
   184
	CleanupStack::PopAndDestroy(&arrayOfResourceFiles);
sl@0
   185
	delete parameters1;
sl@0
   186
	delete namedPlugins;
sl@0
   187
}
sl@0
   188
sl@0
   189
/*
sl@0
   190
@SYMTestCaseID          SYSLIB-BAFL-CT-1757
sl@0
   191
@SYMTestCaseDesc        CBaNamedPlugins::CParameters class test
sl@0
   192
                        Tests for CParameters::SetFallBackName,CParameters::SetCompareNames,getting file names by searching file system
sl@0
   193
@SYMTestPriority        Medium
sl@0
   194
@SYMTestActions         Setting the algorithm to compare two plugin names
sl@0
   195
@SYMTestExpectedResults Test must not fail
sl@0
   196
@SYMREQ                 REQ0000
sl@0
   197
*/
sl@0
   198
sl@0
   199
void DoTests2()
sl@0
   200
{
sl@0
   201
     TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-1757 Testing DoTests2... "));
sl@0
   202
     TBuf<64> buf;
sl@0
   203
     buf = KMainPath;
sl@0
   204
sl@0
   205
     CBaNamedPlugins* namedPlugins;
sl@0
   206
     RArray<CBaNamedPlugins::TResourceFile> arrayOfResourceFiles;
sl@0
   207
     CleanupClosePushL(arrayOfResourceFiles);
sl@0
   208
sl@0
   209
     TFindFile* findFile = new(ELeave) TFindFile(TheFs);
sl@0
   210
     CleanupStack::PushL(findFile);
sl@0
   211
sl@0
   212
     CDir* directory = NULL;
sl@0
   213
sl@0
   214
     TInt err = findFile->FindWildByDir(KLitWildCard, buf, directory);
sl@0
   215
     TInt mdcaCount=0;
sl@0
   216
     while(err==KErrNone)
sl@0
   217
         {
sl@0
   218
         CleanupStack::PushL(directory);
sl@0
   219
         for (TInt i=directory->Count()-1; i>=0; --i)
sl@0
   220
             {
sl@0
   221
             const TEntry& entry = (*directory)[i];
sl@0
   222
             CBaNamedPlugins::TResourceFile resourceFile;
sl@0
   223
             resourceFile.iFullFileName = entry.iName.AllocLC();
sl@0
   224
             resourceFile.iIdentifier = NULL;
sl@0
   225
             resourceFile.iUid = KNullUid;
sl@0
   226
             resourceFile.iFormat = CBaNamedPlugins::TResourceFile::EFormatTbuf;
sl@0
   227
             ++mdcaCount;
sl@0
   228
             User::LeaveIfError(arrayOfResourceFiles.Append(resourceFile));
sl@0
   229
             CleanupStack::Pop(resourceFile.iFullFileName);
sl@0
   230
             }
sl@0
   231
         CleanupStack::PopAndDestroy(); // directory
sl@0
   232
         directory = NULL;
sl@0
   233
       	 err=findFile->FindWild(directory);
sl@0
   234
         }
sl@0
   235
     CleanupStack::PopAndDestroy(); // findfile
sl@0
   236
sl@0
   237
     CBaNamedPlugins::CParameters* const parameters = CBaNamedPlugins::CParameters::NewL(TheFs, arrayOfResourceFiles.Array());
sl@0
   238
sl@0
   239
     CBaNamedPlugins::TCompareNames compName = TestAlgorithmToCompareNames;
sl@0
   240
     (*parameters).SetCompareNames(compName);
sl@0
   241
     namedPlugins = CBaNamedPlugins::NewL(*parameters);
sl@0
   242
sl@0
   243
     // Test CBaNamedPlugins constructor when fall back name is set
sl@0
   244
     CImplementation obj;
sl@0
   245
     (*parameters).SetFallBackName(obj);
sl@0
   246
     delete namedPlugins;
sl@0
   247
     namedPlugins = CBaNamedPlugins::NewL(*parameters);
sl@0
   248
sl@0
   249
     TInt count = (*namedPlugins).MdcaCount();
sl@0
   250
     TEST2(count,mdcaCount);
sl@0
   251
sl@0
   252
     count=arrayOfResourceFiles.Count();
sl@0
   253
     for( TInt i = 0; i < count; i++ )
sl@0
   254
         {
sl@0
   255
         const CBaNamedPlugins::TResourceFile& resourceFileData=arrayOfResourceFiles[i];
sl@0
   256
         delete resourceFileData.iFullFileName;
sl@0
   257
         }
sl@0
   258
     CleanupStack::PopAndDestroy(&arrayOfResourceFiles);
sl@0
   259
     delete parameters;
sl@0
   260
     delete namedPlugins;
sl@0
   261
}
sl@0
   262
sl@0
   263
LOCAL_C void StartTestPanicBadArrayPositionL()
sl@0
   264
	{
sl@0
   265
  	CBaNamedPlugins* namedPlugins;
sl@0
   266
    RArray<CBaNamedPlugins::TResourceFile> arrayOfResourceFiles;
sl@0
   267
    CleanupClosePushL(arrayOfResourceFiles);
sl@0
   268
    RFs fs;
sl@0
   269
 	fs.Connect();
sl@0
   270
 	TBuf<64> buf;
sl@0
   271
    buf = KRscFileName2;
sl@0
   272
sl@0
   273
	// Test Panic
sl@0
   274
	CBaNamedPlugins::TResourceFile resourceFile;
sl@0
   275
	resourceFile.iFullFileName = buf.AllocLC();
sl@0
   276
	resourceFile.iIdentifier = NULL;
sl@0
   277
	resourceFile.iUid = KNullUid;
sl@0
   278
	resourceFile.iFormat = CBaNamedPlugins::TResourceFile::EFormatTbuf;
sl@0
   279
	User::LeaveIfError(arrayOfResourceFiles.Append(resourceFile));
sl@0
   280
	CleanupStack::Pop(resourceFile.iFullFileName);
sl@0
   281
sl@0
   282
	CBaNamedPlugins::CParameters* const parameters = CBaNamedPlugins::CParameters::NewL(fs, arrayOfResourceFiles.Array());
sl@0
   283
sl@0
   284
	HBufC* textForNone=KTextForNone().AllocL();
sl@0
   285
  	parameters->SetTextForNone(textForNone,static_cast<CBaNamedPlugins::TArrayPosition>(255));		// Pick an illegal position
sl@0
   286
sl@0
   287
	// This should panic
sl@0
   288
    namedPlugins = CBaNamedPlugins::NewL(*parameters);
sl@0
   289
sl@0
   290
	delete resourceFile.iFullFileName;
sl@0
   291
sl@0
   292
	CleanupStack::PopAndDestroy(&arrayOfResourceFiles);
sl@0
   293
	delete parameters;
sl@0
   294
	delete namedPlugins;
sl@0
   295
	}
sl@0
   296
sl@0
   297
LOCAL_C TInt TestPanicBadArrayPosition(TAny* /*aData*/)
sl@0
   298
	{
sl@0
   299
	__UHEAP_MARK;
sl@0
   300
	CTrapCleanup* cleanup = CTrapCleanup::New();
sl@0
   301
	if(!cleanup)
sl@0
   302
		return KErrNoMemory;
sl@0
   303
sl@0
   304
	TRAPD(err, StartTestPanicBadArrayPositionL());
sl@0
   305
sl@0
   306
	// Won't get here but add this line to get rid of ARMV5 warning
sl@0
   307
	TEST2(err, KErrNone);
sl@0
   308
sl@0
   309
	delete cleanup;
sl@0
   310
	__UHEAP_MARKEND;
sl@0
   311
sl@0
   312
	return (KErrNone);
sl@0
   313
	}
sl@0
   314
sl@0
   315
LOCAL_C void StartTestPanicBadResourceFileFormatL()
sl@0
   316
	{
sl@0
   317
  	CBaNamedPlugins* namedPlugins;
sl@0
   318
    RArray<CBaNamedPlugins::TResourceFile> arrayOfResourceFiles;
sl@0
   319
    CleanupClosePushL(arrayOfResourceFiles);
sl@0
   320
    RFs fs;
sl@0
   321
 	fs.Connect();
sl@0
   322
 	TBuf<64> buf;
sl@0
   323
    buf = KRscFileName2;
sl@0
   324
sl@0
   325
	// Test Panic
sl@0
   326
	CBaNamedPlugins::TResourceFile resourceFile;
sl@0
   327
	resourceFile.iFullFileName = buf.AllocLC();
sl@0
   328
	resourceFile.iIdentifier = NULL;
sl@0
   329
	resourceFile.iUid = KNullUid;
sl@0
   330
	resourceFile.iFormat = static_cast<CBaNamedPlugins::TResourceFile::TFormat>(255);		// Pick an illegal format
sl@0
   331
	User::LeaveIfError(arrayOfResourceFiles.Append(resourceFile));
sl@0
   332
	CleanupStack::Pop(resourceFile.iFullFileName);
sl@0
   333
sl@0
   334
	CBaNamedPlugins::CParameters* const parameters = CBaNamedPlugins::CParameters::NewL(fs, arrayOfResourceFiles.Array());
sl@0
   335
sl@0
   336
	// This should panic
sl@0
   337
    namedPlugins = CBaNamedPlugins::NewL(*parameters);
sl@0
   338
sl@0
   339
	delete resourceFile.iFullFileName;
sl@0
   340
sl@0
   341
	CleanupStack::PopAndDestroy(&arrayOfResourceFiles);
sl@0
   342
	delete parameters;
sl@0
   343
	delete namedPlugins;
sl@0
   344
	}
sl@0
   345
sl@0
   346
LOCAL_C TInt TestPanicBadResourceFileFormat(TAny* /*aData*/)
sl@0
   347
	{
sl@0
   348
	__UHEAP_MARK;
sl@0
   349
	CTrapCleanup* cleanup = CTrapCleanup::New();
sl@0
   350
	if(!cleanup)
sl@0
   351
		return KErrNoMemory;
sl@0
   352
sl@0
   353
	TRAPD(err, StartTestPanicBadResourceFileFormatL());
sl@0
   354
sl@0
   355
	// Won't get here but add this line to get rid of ARMV5 warning
sl@0
   356
	TEST2(err, KErrNone);
sl@0
   357
sl@0
   358
	delete cleanup;
sl@0
   359
	__UHEAP_MARKEND;
sl@0
   360
sl@0
   361
	return (KErrNone);
sl@0
   362
	}
sl@0
   363
sl@0
   364
/*
sl@0
   365
@SYMTestCaseID          SYSLIB-BAFL-CT-3379
sl@0
   366
@SYMTestCaseDesc        CBaNamedPlugins::CParameters class test
sl@0
   367
                        Tests the class panic conditions
sl@0
   368
@SYMTestPriority        Medium
sl@0
   369
@SYMTestActions         Cause the class to panic by setting bad enums.
sl@0
   370
@SYMTestExpectedResults Test must not fail
sl@0
   371
@SYMREQ                 DEF101753
sl@0
   372
*/
sl@0
   373
LOCAL_C void NamedPluginsPanicConditionsThread()
sl@0
   374
	{
sl@0
   375
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-3379 Testing CBaNamedPlugins Panics... "));
sl@0
   376
	TBool jitEnabled = User::JustInTime();
sl@0
   377
	User::SetJustInTime(EFalse);
sl@0
   378
sl@0
   379
	TRequestStatus status;
sl@0
   380
sl@0
   381
	_LIT(KName, "NamedPlugins_Panic_Thread");
sl@0
   382
sl@0
   383
	RThread thread;
sl@0
   384
	const TInt KThreadStackSize =0x2000; // 8k
sl@0
   385
	const TInt KThreadMinHeapSize   =0x4000; // 16k
sl@0
   386
	const TInt KThreadMaxHeapSize   =0xf000; // 60k
sl@0
   387
sl@0
   388
	// Test EBafPanicBadResourceFileFormat
sl@0
   389
	TInt rc = thread.Create(KName,TestPanicBadResourceFileFormat,KThreadStackSize,KThreadMinHeapSize,KThreadMaxHeapSize,NULL);
sl@0
   390
sl@0
   391
	TEST(rc==KErrNone);
sl@0
   392
sl@0
   393
	thread.Logon(status);
sl@0
   394
	thread.Resume();
sl@0
   395
sl@0
   396
	User::WaitForRequest(status);
sl@0
   397
sl@0
   398
	// Should result in a EExitPanic exit type and an EBafPanicBadResourceFileFormat exit reason
sl@0
   399
	TEST(thread.ExitType() == EExitPanic);
sl@0
   400
	TEST(thread.ExitReason() == EBafPanicBadResourceFileFormat);
sl@0
   401
sl@0
   402
	CLOSE_AND_WAIT(thread);
sl@0
   403
sl@0
   404
	// Test EBafPanicBadArrayPosition
sl@0
   405
	rc = thread.Create(KName,TestPanicBadArrayPosition,KThreadStackSize,KThreadMinHeapSize,KThreadMaxHeapSize,NULL);
sl@0
   406
sl@0
   407
	TEST(rc==KErrNone);
sl@0
   408
sl@0
   409
	thread.Logon(status);
sl@0
   410
	thread.Resume();
sl@0
   411
sl@0
   412
	User::WaitForRequest(status);
sl@0
   413
sl@0
   414
	// Should result in a EExitPanic exit type and an EBafPanicBadArrayPosition exit reason
sl@0
   415
	TEST(thread.ExitType() == EExitPanic);
sl@0
   416
	TEST(thread.ExitReason() == EBafPanicBadArrayPosition);
sl@0
   417
sl@0
   418
	thread.Close();
sl@0
   419
sl@0
   420
	User::SetJustInTime(jitEnabled);
sl@0
   421
	}
sl@0
   422
sl@0
   423
sl@0
   424
void DoTestsL()
sl@0
   425
{
sl@0
   426
	TheTest.Next(_L("Calling the tests"));
sl@0
   427
	TheFs.Connect();
sl@0
   428
	CleanupClosePushL(TheFs);
sl@0
   429
sl@0
   430
	DoTests1();//Getting the resource file names from literals
sl@0
   431
	DoTests2();//Getting the resource file names by performing a search on the file system
sl@0
   432
	NamedPluginsPanicConditionsThread();	// Test Panic condition
sl@0
   433
sl@0
   434
 	CleanupStack::PopAndDestroy(); // TheFs
sl@0
   435
}
sl@0
   436
sl@0
   437
TInt E32Main()
sl@0
   438
{
sl@0
   439
	__UHEAP_MARK;
sl@0
   440
sl@0
   441
	CTrapCleanup* cleanup = CTrapCleanup::New();
sl@0
   442
	TheTest.Title();
sl@0
   443
	TheTest.Start(_L("Testing CBaNamedPlugins Class"));
sl@0
   444
	TRAPD(err,DoTestsL());
sl@0
   445
	TEST2(err,KErrNone);
sl@0
   446
	TheTest.End();
sl@0
   447
	TheTest.Close();
sl@0
   448
	delete cleanup;
sl@0
   449
sl@0
   450
	__UHEAP_MARKEND;
sl@0
   451
	return(0);
sl@0
   452
}