localisation/apparchitecture/tef/T_ProStep.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Tests Application Apparc base classes and utility functions to get application's data.\n
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @test
       
    23  @internalComponent - Internal Symbian test code
       
    24 */
       
    25 
       
    26 #include <f32file.h>
       
    27 #include <fbs.h>
       
    28 #include <s32std.h> 
       
    29 #include <s32stor.h> 
       
    30 #include <s32file.h> 
       
    31 #include <ecom.h>
       
    32 
       
    33 #include <apaid.h>
       
    34 #include "..\apparc\apadll.h"
       
    35 #include "..\apgrfx\apgstd.h"
       
    36 #include <apgaplst.h>
       
    37 #include <apgicnfl.h>
       
    38 #include <apgdoor.h>
       
    39 #include <apfrec.h>
       
    40 #include <apfctlf.h>
       
    41 #include <apgctl.h>
       
    42 #include <apgaplst.h>
       
    43 #include <apaflrec.h>
       
    44 #include "testableapalssession.h"
       
    45 #include <apacmdln.h>
       
    46 
       
    47 #include "T_ProStep.h"
       
    48 #include "tstapp.h"
       
    49 #include <appfwk_test_utils.h>
       
    50 
       
    51 #if !defined(__E32TEST_H__)
       
    52 #include <e32test.h>
       
    53 #endif
       
    54 
       
    55 TInt PanicTestThread(TAny* aOption);
       
    56 
       
    57 enum TPanicOption 
       
    58 	{
       
    59 	EFirst,
       
    60 	ENegativePanicTest,
       
    61 	EUnknownPanicOption,	
       
    62 	ELast
       
    63 	};
       
    64 
       
    65 
       
    66 _LIT(KCTLDIR,"C:\\private\\10003a3f\\import\\apps\\");
       
    67 _LIT(KSOURCEPATH,"z:\\private\\10003a3f\\import\\apps\\m_ctrl_reg.rsc");
       
    68 _LIT(KNEWCTLPATH,"C:\\private\\10003a3f\\import\\apps\\m_ctrl_reg.rsc");
       
    69 _LIT(KNEWPATH,"C:\\cm.txt");
       
    70 _LIT(KEMPTYFILEPATH,"z:\\system\\data\\Testpath\\FilterTests\\testfile1.txt");
       
    71 
       
    72 _LIT(KRSCDIR,"C:\\Resource\\apps\\");
       
    73 _LIT(KLOCPATH,"z:\\Resource\\apps\\M_ctrl_loc.rsc");
       
    74 _LIT(KNEWLOCPATH,"C:\\Resource\\apps\\M_ctrl_loc.rsc");
       
    75 _LIT(KCTRLNAME,"C:\\sys\\bin\\m_ctrl.exe");
       
    76 TFileName ctlPath=_L("z:\\sys\\bin\\m_ctrl.exe");
       
    77 
       
    78 
       
    79 LOCAL_D TInt SimulateKeyL(TAny*)
       
    80 	{
       
    81 	User::After(3000000);
       
    82 	RWsSession session;
       
    83 	User::LeaveIfError(session.Connect());	
       
    84 
       
    85 	//control down
       
    86 	TRawEvent rawEvent;
       
    87 	rawEvent.Set(TRawEvent::EKeyDown,EStdKeyLeftCtrl);
       
    88 	session.SimulateRawEvent(rawEvent);
       
    89 
       
    90 	// e down
       
    91 	rawEvent.Set(TRawEvent::EKeyDown,'E');
       
    92 	session.SimulateRawEvent(rawEvent);
       
    93 
       
    94 	// e up
       
    95 	rawEvent.Set(TRawEvent::EKeyUp,'E');
       
    96 	session.SimulateRawEvent(rawEvent);
       
    97 
       
    98 	//control up
       
    99 	rawEvent.Set(TRawEvent::EKeyUp,EStdKeyLeftCtrl);
       
   100 	session.SimulateRawEvent(rawEvent);
       
   101 
       
   102 	session.Flush();
       
   103 	session.Close();
       
   104 	
       
   105 	return KErrNone;
       
   106 	}
       
   107 
       
   108 void CT_ProStep::setup()
       
   109 	{
       
   110 #if defined(__EPOC32__)
       
   111 	TFullName filePath=_L("c:\\docs\\tstapp.doc");
       
   112 	TFullName tempPath=_L("c:\\system\\temp\\");
       
   113 	// if we're on the rack create the directories we need
       
   114 	TParse parser;
       
   115 	parser.Set(filePath,NULL,NULL);
       
   116 	iFs.MkDirAll(parser.DriveAndPath());
       
   117 	parser.Set(tempPath,NULL,NULL);
       
   118 	iFs.MkDirAll(parser.DriveAndPath());
       
   119 #endif
       
   120 	}
       
   121 
       
   122 
       
   123 /**
       
   124    @SYMTestCaseID T-ProStep-testAppIdentifierL
       
   125   
       
   126    @SYMPREQ
       
   127   
       
   128    @SYMTestCaseDesc Tests TApaAppIdentifier API.
       
   129   
       
   130    @SYMTestPriority High
       
   131   
       
   132    @SYMTestStatus Implemented
       
   133    
       
   134    @SYMTestActions Create a temporary store. Construct an application identifier
       
   135    for the specified application DLL, and Uid. Call WriteAppIdentifierL() to
       
   136    store application identifier details. Read the stored application identifier
       
   137    details.\n
       
   138    API Calls:\n	
       
   139    TApaAppIdentifier::TApaAppIdentifier(TUid aAppUidType,const TFileName& aDllName)\n
       
   140    CApaProcess::WriteAppIdentifierL(CStreamStore& aStore,CStreamDictionary& aStreamDic,const TApaAppIdentifier& aAppId)\n
       
   141    CApsProcess::ReadAppIdentifierL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic)\n
       
   142   
       
   143    @SYMTestExpectedResults Test checks whether stored and read application
       
   144    identifier details match.
       
   145    
       
   146  */
       
   147 void CT_ProStep::testAppIdentifierL()
       
   148 	{
       
   149 	const TFullName tempPath=_L("c:\\system\\temp\\");
       
   150 	const TUid testUid={1};
       
   151 
       
   152 	INFO_PRINTF1(_L("Testing TApaAppIdentifier"));
       
   153 	
       
   154 	// create a process
       
   155 	TRAPD(ret,iProcess = CApaProcess::NewL(iFs));	
       
   156 	TEST(ret==KErrNone);
       
   157 	
       
   158 	// create a temporary store and stream dictionary
       
   159 	TParse newFilePath;
       
   160 	HBufC* related = HBufC::NewL(20);
       
   161 	(*related)=_L("temp.idf");
       
   162 	newFilePath.Set(tempPath,related,NULL);
       
   163 	delete related;
       
   164 	iFs.MkDirAll(newFilePath.DriveAndPath());
       
   165 	CDirectFileStore* store = CDirectFileStore::ReplaceLC(iFs,newFilePath.FullName(),EFileWrite);
       
   166 	store->SetTypeL(TUidType(KDirectFileStoreLayoutUid,testUid,testUid));
       
   167 	CStreamDictionary* streamDic=CStreamDictionary::NewL();
       
   168 	CleanupStack::PushL(streamDic);
       
   169 
       
   170 	// set up an id
       
   171 	TApaAppIdentifier* origId=new(ELeave) TApaAppIdentifier (testUid,_L("FileName"));
       
   172 	CleanupStack::PushL(origId);
       
   173 
       
   174 	// write it out and read it in again
       
   175 	iProcess->WriteAppIdentifierL(*store,*streamDic,*origId);
       
   176 	TApaAppIdentifier* copyId=new(ELeave) TApaAppIdentifier();
       
   177 	*copyId=iProcess->ReadAppIdentifierL(*store,*streamDic);
       
   178 	
       
   179 	CleanupStack::PushL(copyId);
       
   180 	TEST((origId->iAppUid==copyId->iAppUid));
       
   181 	TEST((origId->iFullName==copyId->iFullName));
       
   182 		
       
   183 	// tidy up
       
   184 	CleanupStack::PopAndDestroy(4); // store,streamDic,origId,copyId
       
   185 	delete iProcess;
       
   186 	iFs.Delete(newFilePath.FullName());
       
   187 	}
       
   188 
       
   189 
       
   190 /**
       
   191    @SYMTestCaseID T-ProStep-doTestGenerateFileName
       
   192   
       
   193    @SYMPREQ
       
   194   
       
   195    @SYMTestCaseDesc Tests CApaApplication::GenerateFileName().
       
   196   
       
   197    @SYMTestPriority High
       
   198   
       
   199    @SYMTestStatus Implemented
       
   200    
       
   201    @SYMTestActions Call GenerateFileName() under following scenarios:\n
       
   202    (1) when root name doesn't exist\n
       
   203    (2) when root name exists\n
       
   204    (3) when illegal paths are mentioned.\n
       
   205    (4) when no memory is available to perfom the operation.\n
       
   206    API Calls:\n	
       
   207    CApaApplication::GenerateFileName(RFs& aFs,TFileName& aRootName)\n
       
   208    
       
   209    @SYMTestExpectedResults Test should return the desired filename or error
       
   210    code for each scenario
       
   211    
       
   212  */
       
   213 void CT_ProStep::doTestGenerateFileName()
       
   214 	{
       
   215 	TFileName rootName;
       
   216 
       
   217 	// delete the test files just in case...
       
   218 	iFs.Delete(_L("c:\\path\\name"));
       
   219 	iFs.Delete(_L("c:\\path\\name.ext"));
       
   220 
       
   221 	// try it with a root that doesn't exist
       
   222 	rootName = _L("c:\\path\\name");
       
   223 	TInt ret=CApaApplication::GenerateFileName(iFs,rootName);
       
   224 	TEST(ret==KErrNone);
       
   225 	TEST(rootName.CompareF(_L("c:\\path\\name"))==0);
       
   226 
       
   227 	// try it with a root (inc ext) that doesn't exist
       
   228 	rootName = _L("c:\\path\\name.ext");
       
   229 	ret=CApaApplication::GenerateFileName(iFs,rootName);
       
   230 	TEST(ret==KErrNone);
       
   231 	TEST(rootName.CompareF(_L("c:\\path\\name.ext"))==0);
       
   232 
       
   233 	// create a couple of files
       
   234 	RFile file;
       
   235 	file.Create(iFs,_L("c:\\path\\name"),EFileWrite);
       
   236 	file.Close();
       
   237 	file.Create(iFs,_L("c:\\path\\name.ext"),EFileWrite);
       
   238 	// file.Close(); // purposely don't close this one
       
   239 
       
   240 	// try it with a root that exists
       
   241 	rootName = _L("c:\\path\\name");
       
   242 	ret=CApaApplication::GenerateFileName(iFs,rootName);
       
   243 	TEST(ret==KErrNone);
       
   244 	TEST(rootName.CompareF(_L("c:\\path\\name(01)"))==0);
       
   245 
       
   246 	// try it with a root (inc ext) that exists
       
   247 	rootName = _L("c:\\path\\name.ext");
       
   248 	ret=CApaApplication::GenerateFileName(iFs,rootName);
       
   249 	TEST(ret==KErrNone);
       
   250 	TEST(rootName.CompareF(_L("c:\\path\\name(01).ext"))==0);
       
   251 
       
   252 	// try with illegal paths
       
   253 	rootName = _L("c:name");
       
   254 	ret=CApaApplication::GenerateFileName(iFs,rootName);
       
   255 	TEST((ret==KErrArgument));
       
   256 	rootName = _L("\\dir\\name");
       
   257 	ret=CApaApplication::GenerateFileName(iFs,rootName);
       
   258 	TEST((ret==KErrArgument));
       
   259 	rootName = _L("c:\\dir\\");
       
   260 	ret=CApaApplication::GenerateFileName(iFs,rootName);
       
   261 	TEST((ret==KErrBadName));
       
   262 
       
   263 	// try when no memory is available to perform the operation. 
       
   264 	// 	(we haven't used a conventional OOM loop, but this is not a leaving function)
       
   265 	__UHEAP_MARK;
       
   266 	__UHEAP_SETFAIL(RHeap::EDeterministic,1);
       
   267 	rootName = _L("c:\\path\\nomemory.ext");
       
   268 	ret=CApaApplication::GenerateFileName(iFs,rootName);
       
   269 	TEST(ret==KErrNoMemory);
       
   270 	__UHEAP_MARKEND;
       
   271 	__UHEAP_RESET;
       
   272 
       
   273 	// tidy up
       
   274 	file.Close();
       
   275 	iFs.Delete(_L("c:\\path\\name"));
       
   276 	iFs.Delete(_L("c:\\path\\name.ext"));
       
   277 	
       
   278 	}
       
   279 
       
   280 /**
       
   281    @SYMTestCaseID APPFWK-APPARC-0055
       
   282   
       
   283    @SYMDEF DEF092509
       
   284   
       
   285    @SYMTestCaseDesc Tests CApaProcess::ReadRootStreamLC ().
       
   286   
       
   287    @SYMTestPriority High
       
   288   
       
   289    @SYMTestStatus Implemented
       
   290    
       
   291    @SYMTestActions Call ReadRootStreamLC() under following scenarios:\n
       
   292    (1) when File name Doesnt Exists\n
       
   293    (2) When an empty file is present \n
       
   294  
       
   295    
       
   296    
       
   297    @SYMTestExpectedResults Test should return  KErrNotFound for scenario (1). And  error 
       
   298    KErrEof orKErrCorrupt for scenario (2).
       
   299       
       
   300  */
       
   301  
       
   302  void CT_ProStep::testReadStreamL()
       
   303 
       
   304 	{
       
   305 	CFileStore* docStore=NULL;
       
   306 	TUint appFileMode=EFileRead|EFileWrite;
       
   307 	CStreamDictionary* streamDic=NULL;
       
   308 	TRAPD(err,streamDic=CApaProcess::ReadRootStreamLC(iFs,docStore,KNEWPATH,appFileMode));
       
   309 	TEST(err==KErrNotFound);
       
   310 
       
   311 	delete docStore;
       
   312 	delete streamDic;
       
   313 	docStore=NULL;
       
   314 	streamDic=NULL;
       
   315 	appFileMode=EFileRead;
       
   316 	TRAP(err,streamDic=CApaProcess::ReadRootStreamLC(iFs,docStore,KEMPTYFILEPATH,appFileMode));
       
   317 	TEST(err==KErrCorrupt || err==KErrEof); 
       
   318 	}
       
   319 /**
       
   320    @SYMTestCaseID T-ProStep-testDocCreation1L
       
   321   
       
   322    @SYMPREQ
       
   323   
       
   324    @SYMTestCaseDesc Tests CApaProcess::AddNewDocumentL().
       
   325    
       
   326    @SYMTestPriority High 
       
   327   
       
   328    @SYMTestStatus Implemented
       
   329    
       
   330    @SYMTestActions Create a process, call AddNewDocumentL() to create a new
       
   331    document for an app DLL by\n
       
   332    (1) passing full path of app.\n
       
   333    (2) passing full path of app and the Uid.\n
       
   334    In both cases call DestroyDocument() to destroy the document thus created.\n
       
   335    API Calls:\n	
       
   336    CApaProcess::NewL(const RFs& aFs,CApaAppFinder& aAppFinder)\n
       
   337    CApaProcess::AddNewDocumentL(const TDesC& aDllFileName,TUid aDllUid=KNullUid)\n
       
   338    CApaProcess::DestroyDocument(CApaDocument* aDoc)\n
       
   339    CApaProcess::ResetL()\n
       
   340    
       
   341    @SYMTestExpectedResults Test checks results against expected values.
       
   342    
       
   343  */
       
   344 void CT_ProStep::testDocCreation1L()
       
   345 	{
       
   346 	const TFullName filePath=_L("c:\\docs\\tstapp.doc");
       
   347 
       
   348 	INFO_PRINTF1(_L("Testing CApaProcess"));
       
   349 
       
   350 	iFs.MkDirAll(filePath);
       
   351 	// delete the file to be created by the testcode
       
   352 	iFs.Delete(filePath);
       
   353 
       
   354 	// create a process
       
   355 	TRAPD(ret,iProcess = CApaProcess::NewL(iFs));
       
   356 	TEST(ret==KErrNone);
       
   357 
       
   358 	// create a new doc passing the full path of the app dll
       
   359 	CApaDocument* doc=NULL;
       
   360 	TApaApplicationFactory appFact(KUidTestApp);
       
   361 	TRAP(ret,doc=iProcess->AddNewDocumentL(appFact));
       
   362 	TEST(ret==KErrNone);
       
   363 	iProcess->DestroyDocument(doc);
       
   364 	doc = NULL;
       
   365 	TRAP(ret,iProcess->ResetL());
       
   366 	TEST(ret==KErrNone);
       
   367 	}
       
   368 
       
   369 
       
   370 /**
       
   371    @SYMTestCaseID T-ProStep-testDocCreation2L
       
   372   
       
   373    @SYMPREQ
       
   374   
       
   375    @SYMTestCaseDesc Tests CApaProcess::AddNewDocumentL().
       
   376    
       
   377    @SYMTestPriority High 
       
   378   
       
   379    @SYMTestStatus Implemented
       
   380    
       
   381    @SYMTestActions Call AddNewDocumentL() to create a new document for an app DLL.
       
   382    Set it as the main document. Associate it with a temporary store. Initialize
       
   383    the document to default settings. Store the document.\n
       
   384    API Calls:\n	
       
   385    CApaProcess::AddNewDocumentL(const TDesC& aDllFileName,TUid aDllUid=KNullUid)\n
       
   386    CApaDocument::NewDocumentL()\n
       
   387    CApaDocument::SaveL()\n
       
   388    
       
   389    @SYMTestExpectedResults Test checks results against expected values.
       
   390    
       
   391  */
       
   392 void CT_ProStep::testDocCreation2L()
       
   393 	{
       
   394 	const TFullName filePath=_L("c:\\docs\\tstapp.doc");
       
   395 	CApaDocument* doc=NULL;
       
   396 	
       
   397 	TApaApplicationFactory appFact(KUidTestApp);
       
   398 	TRAPD(ret,doc=iProcess->AddNewDocumentL(appFact));
       
   399 	TEST(ret==KErrNone);
       
   400 	iProcess->SetMainDocument(doc);
       
   401 	CFileStore* store=NULL;
       
   402 
       
   403 	// create the store and initialise it
       
   404 	TRAP(ret, {
       
   405 		store=doc->CreateFileStoreLC(iProcess->FsSession(),filePath);
       
   406 		CleanupStack::Pop(); // store 
       
   407 		});
       
   408 	TEST(ret==KErrNone);
       
   409 	((CTestAppDoc*)iProcess->MainDocument())->iStore = store;
       
   410 	iProcess->SetMainDocFileName(filePath);
       
   411 
       
   412 	// initialise the document with factory settings
       
   413 	TRAP(ret, doc->NewDocumentL() );
       
   414 	TEST(ret==KErrNone);
       
   415 
       
   416 	// close it 
       
   417 	TRAP(ret,doc->SaveL());
       
   418 	TEST(ret==KErrNone);
       
   419 	TRAP(ret, iProcess->ResetL() );
       
   420 	TEST(ret==KErrNone);
       
   421 	store = NULL;
       
   422 	doc = NULL;
       
   423 	}
       
   424 
       
   425 /**
       
   426    @SYMTestCaseID T-ProStep-testDocCreation3L
       
   427   
       
   428    @SYMPREQ
       
   429   
       
   430    @SYMTestCaseDesc Tests CApaProcess::OpenNewDocumentL() and CApaAppFileReader APIs.
       
   431    
       
   432    @SYMTestPriority High 
       
   433   
       
   434    @SYMTestStatus Implemented
       
   435    
       
   436    @SYMTestActions Create a document from a specified file. Set it as main
       
   437    document file. Create a CApaAppInfoFileReader object by calling
       
   438    OpenAppInfoFileL(). Use CaptionL() and CreateMaskedBitmapL() to read
       
   439    application information like caption and bitmap.\n
       
   440    API Calls:\n	
       
   441    CApaProcess::OpenNewDocumentL(CFileStore*& aStore,CStreamDictionary*& aStreamDic,const TDesC& aDocFullFileName,TUint aFileMode);\n
       
   442    CApaApplication::OpenAppInfoFileL() const\n
       
   443    CApaAppInfoFileReader::CaptionL(TLanguage aLanguage)\n
       
   444    CApaAppInfoFileReader::CreateMaskedBitmapL(TInt aIconSideInPixels)\n
       
   445    
       
   446    @SYMTestExpectedResults Test checks results against expected values.
       
   447     
       
   448  */
       
   449 CApaDocument* CT_ProStep::testDocCreation3L()
       
   450 	{
       
   451 	// try re-opening it
       
   452 	const TFullName filePath=_L("c:\\docs\\tstapp.doc");
       
   453 	CStreamDictionary* streamDic=NULL;
       
   454 	CApaDocument* doc=NULL;
       
   455 	CFileStore* store=NULL;
       
   456 	TRAPD(ret,doc=iProcess->OpenNewDocumentL(store,streamDic,filePath,EFileShareExclusive|EFileWrite));
       
   457 	TEST(ret==KErrNone);
       
   458 	delete streamDic;
       
   459 	streamDic = NULL;
       
   460 	iProcess->SetMainDocument(doc);
       
   461 	iProcess->SetMainDocFileName(filePath);
       
   462 	((CTestAppDoc*)iProcess->MainDocument())->iStore = store;
       
   463 
       
   464 	// remove the main document
       
   465 	iProcess->DestroyDocument(iProcess->MainDocument());
       
   466 	TEST(iProcess->MainDocument()==NULL);
       
   467 
       
   468 	// try re-opening the doc without the app in memory
       
   469 	TRAP(ret,iProcess->ResetL());
       
   470 	TEST(ret==KErrNone);
       
   471 	delete iProcess;
       
   472 	return doc;
       
   473 	}
       
   474 
       
   475 
       
   476 /**
       
   477    @SYMTestCaseID T-ProStep-testDocCreation4L
       
   478   
       
   479    @SYMPREQ
       
   480   
       
   481    @SYMTestCaseDesc Tests CApaProcess::OpenNewDocumentL(). 
       
   482    
       
   483    @SYMTestPriority High 
       
   484   
       
   485    @SYMTestStatus Implemented
       
   486    
       
   487    @SYMTestActions Create a Process. Create a document for an app DLL from a 
       
   488    specified file by calling OpenNewDocumentL(). Call DestroyDocument() to
       
   489    delete the document.\n
       
   490    API Calls:\n	
       
   491    CApaProcess::OpenNewDocumentL(CFileStore*& aStore,CStreamDictionary*& aStreamDic,const TDesC& aDocFullFileName,TUint aFileMode);\n
       
   492    CApaProcess::DestroyDocument(CApaDocument* aDoc)\n
       
   493    
       
   494    @SYMTestExpectedResults Test checks results against expected values.
       
   495     
       
   496  */
       
   497 void CT_ProStep::testDocCreation4L(CApaDocument* aDoc)
       
   498 	{
       
   499 	const TFullName filePath=_L("c:\\docs\\tstapp.doc");
       
   500 	CStreamDictionary* streamDic=NULL;
       
   501 	CFileStore* store=NULL;
       
   502 	TRAPD(ret,iProcess = CApaProcess::NewL(iFs));
       
   503 	TEST(ret==KErrNone);
       
   504 	TRAP(ret,aDoc=iProcess->OpenNewDocumentL(store,streamDic,filePath,EFileShareExclusive|EFileWrite));
       
   505 	TEST(ret==KErrNone);
       
   506 	iProcess->DestroyDocument(aDoc);
       
   507 	delete store;
       
   508 	delete streamDic;
       
   509 
       
   510 	// tidy up
       
   511 	TRAP(ret,iProcess->ResetL());
       
   512 	TEST(ret==KErrNone);
       
   513 	delete iProcess;
       
   514 
       
   515 	// delete the file created by the testcode
       
   516 	iFs.Delete(filePath);
       
   517 	}
       
   518 
       
   519 
       
   520 /**
       
   521   Auxiliary Fn for Test Case ID T-ProStep-testDocCreation1L, T-ProStep-testDocCreation2L,
       
   522   T-ProStep-testDocCreation3L, T-ProStep-testDocCreation4L.
       
   523  
       
   524   The method initiates tests on operation such as creation, storing
       
   525   and deletion of a document.
       
   526   
       
   527 */
       
   528 void CT_ProStep::testDocCreationL()
       
   529 	{
       
   530 	//Create a session with F & B server
       
   531 	TInt ret = RFbsSession::Connect();
       
   532 	TEST(ret == KErrNone);
       
   533 
       
   534 	testDocCreation1L();
       
   535 	testDocCreation2L();
       
   536 	testDocCreation4L(testDocCreation3L());
       
   537 
       
   538 	//Close the session F & B server.
       
   539 	RFbsSession::Disconnect();
       
   540 	}
       
   541 
       
   542 /**
       
   543    @SYMTestCaseID T-ProStep-testEmbeddingL
       
   544   
       
   545    @SYMPREQ
       
   546   
       
   547    @SYMTestCaseDesc Tests embedding of a document and accessing the embedded document.
       
   548    
       
   549    @SYMTestPriority High 
       
   550   
       
   551    @SYMTestStatus Implemented
       
   552    
       
   553    @SYMTestActions The test connects to the Font and Bitmap Server and creates a
       
   554    process by calling CApaProcess::NewL().
       
   555    The method first tests the embedding of document. To do so a document of
       
   556    type tstapp is added to the process and set as the main document. The main
       
   557    document is opened for editing by calling CApaDocument::EditL() and another
       
   558    document of type tstapp is created to embed it within the main document.
       
   559    Tests for the number of embedded documents and editing of the embedded
       
   560    document is done. The main document is closed and then reloaded to verify
       
   561    that the embedded document is saved.\n
       
   562    A test to access the embedded document is then done. For this purpose the
       
   563    main document is detached from its store by calling CApaDocument::DetachFromStoreL()
       
   564    and an attempt to access the embedded document is done by calling CApaDocument::DocumentL().
       
   565    The same test to access the embedded document is again done by reloading
       
   566    the main document without detaching it from its store.\n
       
   567    Finally embedded document is tested to change the format of the door to
       
   568    glass by calling CApaDoor::SetFormatToGlassL(). The test ensures that the
       
   569    embedded document does not support being represented by a glass door by
       
   570    checking for leave KErrNotSupported.\n Then the same embedded document is supported when being 
       
   571    called by CApaDoor::SetFormatToIconL() and returns KErrNone.
       
   572    API Calls:\n	
       
   573    CApaProcess::NewL(const RFs& aFs,CApaAppFinder& aAppFinder)\n
       
   574    CApaProcess::AddNewDocumentL(const TDesC& aDllFileName,TUid aDllUid=KNullUid)\n
       
   575    CApaDocument::EditL(MApaEmbeddedDocObserver* aContainer,TBool aReadOnly=EFalse) = 0\n
       
   576    CApaDocument::DetachFromStoreL(CPicture::TDetach aDegree = CPicture::EDetachFull)\n
       
   577    CApaDoor::DocumentL(TBool aCheckPassword=EFalse)\n
       
   578    CApaDoor::SetFormatToGlassL()\n
       
   579    CApaDoor::SetFormatToIconL()\n
       
   580    
       
   581    @SYMTestExpectedResults All tests completes successfully by checking the
       
   582    results obtained against expected results.
       
   583     
       
   584  */
       
   585 void CT_ProStep::testEmbeddingL()
       
   586 	{
       
   587 	const TFullName filePath=_L("c:\\docs\\tstapp.doc");
       
   588 
       
   589 	//Create a session with F & B server
       
   590 	TInt ret=RFbsSession::Connect();
       
   591 	TEST(ret == KErrNone);
       
   592 	
       
   593 	// delete the file to be created by the testcode
       
   594 	iFs.Delete(filePath);
       
   595 	// create a process
       
   596 	TRAP(ret,iProcess = CApaProcess::NewL(iFs));	
       
   597 	TEST(ret==KErrNone);
       
   598 
       
   599 	// create a new main doc of type tstapp
       
   600 	CApaDocument* doc=NULL;	
       
   601 	TApaApplicationFactory appFact(KUidTestApp);
       
   602 	TRAP(ret,doc=iProcess->AddNewDocumentL(appFact));
       
   603 	TEST(ret==KErrNone);
       
   604 	iProcess->SetMainDocument(doc);
       
   605 	CFileStore* store=NULL;
       
   606 
       
   607 	// create the store and initialise it
       
   608 	TRAP(ret, {
       
   609 		store=doc->CreateFileStoreLC(iProcess->FsSession(),filePath);
       
   610 		CleanupStack::Pop(); // store 
       
   611 		});
       
   612 	TEST(ret==KErrNone);
       
   613 	((CTestAppDoc*)iProcess->MainDocument())->iStore = store;
       
   614 	iProcess->SetMainDocFileName(filePath);
       
   615 	
       
   616 	// initialise the document with factory settings
       
   617 	TRAP(ret, doc->NewDocumentL() );
       
   618 	TEST(ret==KErrNone);
       
   619 
       
   620 	// edit it
       
   621 	TRAP(ret,iProcess->MainDocument()->EditL(NULL));
       
   622 	TEST(ret==KErrNone);
       
   623 
       
   624 	// embed another tstapp doc inside it
       
   625 	INFO_PRINTF1(_L("...Embed a doc"));
       
   626 	TRAP(ret,((CTestAppDoc*)iProcess->MainDocument())->EmbedNewDocL(appFact));
       
   627 	TEST(ret==KErrNone);
       
   628 	TEST(((CTestAppDoc*)iProcess->MainDocument())->iEmbedList->Count()==1);
       
   629 
       
   630 	// edit that doc
       
   631 	TRAP(ret,((CTestAppDoc*)iProcess->MainDocument())->EditEmbeddedDocL(0));
       
   632 	TEST(ret==KErrNone);
       
   633 
       
   634 	// close the main doc and reload it
       
   635 	TRAP(ret,iProcess->MainDocument()->SaveL());
       
   636 	TEST(ret==KErrNone);
       
   637 	TRAP(ret, iProcess->ResetL() );
       
   638 	TEST(ret==KErrNone);
       
   639 	CStreamDictionary* streamDic=NULL;
       
   640 	TRAP(ret,doc=iProcess->OpenNewDocumentL(store,streamDic,filePath,EFileShareExclusive|EFileWrite));
       
   641 	TEST(ret==KErrNone);
       
   642 	delete streamDic;
       
   643 	streamDic = NULL;
       
   644 	iProcess->SetMainDocument(doc);
       
   645 	iProcess->SetMainDocFileName(filePath);
       
   646 	((CTestAppDoc*)iProcess->MainDocument())->iStore = store;
       
   647 	TEST(((CTestAppDoc*)iProcess->MainDocument())->iEmbedList->Count()==1);
       
   648 
       
   649 	// close the main doc and reload it again...
       
   650 	TRAP(ret,iProcess->MainDocument()->SaveL());
       
   651 	TEST(ret==KErrNone);
       
   652 	iProcess->ResetL();
       
   653 	TRAP(ret,doc=iProcess->OpenNewDocumentL(store,streamDic,filePath,EFileShareExclusive|EFileWrite));
       
   654 	TEST(ret==KErrNone);
       
   655 	delete streamDic;
       
   656 	streamDic = NULL;
       
   657 	iProcess->SetMainDocument(doc);
       
   658 	iProcess->SetMainDocFileName(filePath);
       
   659 	((CTestAppDoc*)iProcess->MainDocument())->iStore = store;
       
   660 	TEST(((CTestAppDoc*)iProcess->MainDocument())->iEmbedList->Count()==1);
       
   661 
       
   662 	// detach the main doc from it's store & access the embedded doc
       
   663 	TRAP(ret, iProcess->MainDocument()->DetachFromStoreL(CPicture::EDetachFull) );
       
   664 	TEST(ret==KErrNone);
       
   665 	TRAP(ret, ((CTestAppDoc*)iProcess->MainDocument())->EmbeddedDoor(0)->DocumentL() );
       
   666 	TEST(ret==KErrNone);
       
   667 
       
   668 	// save it, then save it again immediately
       
   669 	TRAP(ret,iProcess->MainDocument()->SaveL());
       
   670 	TEST(ret==KErrNone);
       
   671 	TRAP(ret,iProcess->MainDocument()->SaveL());
       
   672 	TEST(ret==KErrNone);
       
   673 
       
   674 	// load the doc and get a handle to the embedded doc
       
   675 	iProcess->ResetL();
       
   676 	TRAP(ret,doc=iProcess->OpenNewDocumentL(store,streamDic,filePath,EFileShareExclusive|EFileWrite));
       
   677 	TEST(ret==KErrNone);
       
   678 	delete streamDic;
       
   679 	streamDic = NULL;
       
   680 	iProcess->SetMainDocument(doc);
       
   681 	iProcess->SetMainDocFileName(filePath);
       
   682 	((CTestAppDoc*)iProcess->MainDocument())->iStore = store;
       
   683 	TEST(((CTestAppDoc*)iProcess->MainDocument())->iEmbedList->Count()==1);
       
   684 	TRAP(ret, ((CTestAppDoc*)iProcess->MainDocument())->EmbeddedDoor(0)->DocumentL() );
       
   685 	TEST(ret==KErrNone);
       
   686 
       
   687 	// try to set the embedded doc's format to glass
       
   688 	TRAP(ret, ((CTestAppDoc*)iProcess->MainDocument())->EmbeddedDoor(0)->SetFormatToGlassL() );
       
   689 	TEST((ret==KErrNotSupported));
       
   690 	
       
   691 	// try to set the embedded docs to temporary Icon 	
       
   692 	TRAP(ret, ((CTestAppDoc*)iProcess->MainDocument())->EmbeddedDoor(0)->SetFormatToTemporaryIconL(ETrue) );
       
   693 	TEST((ret==KErrNone));
       
   694 	
       
   695 	// try to set embedded doc's format to Icon
       
   696 	TRAP(ret, ((CTestAppDoc*)iProcess->MainDocument())->EmbeddedDoor(0)->SetFormatToIconL() );
       
   697 	TEST((ret==KErrNone));
       
   698 
       
   699 	// tidy up and delete the file created by the testcode
       
   700 	delete iProcess;
       
   701 	iFs.Delete(filePath);
       
   702 
       
   703 	//Close the session F & B server.
       
   704 	RFbsSession::Disconnect();
       
   705 	}
       
   706 
       
   707 _LIT(KMaxLengthDocFileName, "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"); // length must be equal to KMaxFileName
       
   708 
       
   709 void CT_ProStep::MainDocFileNameTestsL()
       
   710 	{
       
   711 	testMainDocFileName1L();
       
   712  	testMainDocFileName2L();
       
   713  	testMainDocFileName3L();
       
   714 	}
       
   715  /**
       
   716    @SYMTestCaseID CT-ProStep-testMainDocFileName1L
       
   717    
       
   718    @SYMPREQ PHAR-5NTCWY
       
   719    
       
   720    @SYMTestCaseDesc
       
   721    Checks that the CApaProcess's MainDocFileName is large enough by default.
       
   722    Clients of CApaProcess::SetMainDocFileName API expect to be able to
       
   723    pass it a descriptor with a length between zero and KMaxFileName inclusive.
       
   724    Check that passing a descriptor of length KMaxFileName doesn't give an
       
   725    APPARC 7 panic (EPanicFileNameTooLong)
       
   726    
       
   727    @SYMTestPriority High
       
   728    
       
   729    @SYMTestStatus Implemented
       
   730    
       
   731    @SYMTestActions
       
   732    Construct a CApaProcess object, and call SetMainDocFileName on it, passing
       
   733    a file name KMaxFileName characters long
       
   734    
       
   735    @SYMTestExpectedResults
       
   736    The call to CApaProcess::SetMainDocFileName should not cause a panic
       
   737    
       
   738  */
       
   739 void CT_ProStep::testMainDocFileName1L()
       
   740   	{
       
   741  	CApaProcess* process = CApaProcess::NewL(iFs);
       
   742  	process->SetMainDocFileName(KMaxLengthDocFileName); // should not panic
       
   743  	delete process;
       
   744   	}
       
   745  
       
   746  /**
       
   747    @SYMTestCaseID CT-ProStep-testMainDocFileName2L
       
   748    
       
   749    @SYMPREQ PHAR-5NTCWY
       
   750    
       
   751    @SYMTestCaseDesc
       
   752    Checks that the maximum length of CApaProcess's MainDocFileName is still large
       
   753    enough to store a file name KMaxFileName characters long after setting a file name using
       
   754    CApaProcess::SetMainDocFileNameL which is less than KMaxFileName characters long
       
   755    
       
   756    @SYMTestPriority High
       
   757    
       
   758    @SYMTestStatus Implemented
       
   759    
       
   760    @SYMTestActions
       
   761    1. Construct a CApaProcess object, and call SetMainDocFileNameL on it, passing
       
   762    a file name which is less than KMaxFileName characters long
       
   763    2. Call SetMainDocFileName passing a file name which is KMaxFileName characters long
       
   764    
       
   765    @SYMTestExpectedResults
       
   766    The call to CApaProcess::SetMainDocFileName should not cause a panic
       
   767    
       
   768  */
       
   769 void CT_ProStep::testMainDocFileName2L()
       
   770  	{
       
   771  	_LIT(KShortDocFileName, "ShortDocumentFileName"); // must be < KMaxFileName in length
       
   772  	CApaProcess* process = CApaProcess::NewL(iFs); 
       
   773  	CleanupStack::PushL(process);
       
   774  	process->SetMainDocFileNameL(KShortDocFileName);
       
   775  	process->SetMainDocFileName(KMaxLengthDocFileName); // should not panic
       
   776  	CleanupStack::PopAndDestroy(process);
       
   777  	}
       
   778 
       
   779  /**
       
   780    @SYMTestCaseID CT-ProStep-testMainDocFileName3L
       
   781   
       
   782    @SYMPREQ PHAR-5NTCWY
       
   783   
       
   784    @SYMTestCaseDesc
       
   785    Checks that CApaProcess's MainDocFileName can store a filename longer than KMaxFileName
       
   786   
       
   787    @SYMTestPriority High
       
   788   
       
   789    @SYMTestStatus Implemented
       
   790   
       
   791    @SYMTestActions
       
   792    1. Construct a CApaProcess object, and call SetMainDocFileNameL on it, passing
       
   793    a file name which is greater than KMaxFileName characters long
       
   794    2. Check the length of the file name returned by MainDocFileName
       
   795   
       
   796    @SYMTestExpectedResults
       
   797    The file name returned by MainDocFileName should be the same length as the file name
       
   798    passed to SetMainDocFileNameL
       
   799   
       
   800  */
       
   801 void CT_ProStep::testMainDocFileName3L()
       
   802 	{
       
   803 	_LIT(KLongDocFileName, "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefLong"); // must be > KMaxFileName in length
       
   804 	TPtrC longDocFileName(KLongDocFileName);
       
   805 	CApaProcess* process = CApaProcess::NewL(iFs); 
       
   806 	CleanupStack::PushL(process);
       
   807 	process->SetMainDocFileNameL(longDocFileName);
       
   808 	TEST(process->MainDocFileName().Length() == longDocFileName.Length());
       
   809 	CleanupStack::PopAndDestroy(process);
       
   810 	}
       
   811 
       
   812 /**
       
   813    @SYMTestCaseID T-ProStep-testIniFilesL
       
   814   
       
   815    @SYMPREQ
       
   816   
       
   817    @SYMTestCaseDesc Tests creation of ini file and reading or writing of data to an ini file. 
       
   818    
       
   819    @SYMTestPriority High 
       
   820   
       
   821    @SYMTestStatus Implemented
       
   822    
       
   823    @SYMTestActions Create a Process. Add a new document for an app DLL by calling
       
   824    AddNewDocumentL().Create a store and initialize the document. Create
       
   825    an .ini file by calling OpenIniFileLC().Write data to ini file using
       
   826    RDictionaryWriteStream. Save changes by calling CDictionaryStore::CommitL()
       
   827    and close the ini file. Re-open the ini file and read data from it using
       
   828    RDictionaryReadStream.\n
       
   829    API Calls:\n	
       
   830    CApaApplication::OpenIniFileLC(RFs& aFs) \n
       
   831    RDictionaryWriteStream::AssignL(CDictionaryStore& aDictStore,TUid aUid)\n
       
   832    RDictionaryWriteStream::WriteInt8L(TInt aValue)\n
       
   833    RDictionaryWriteStream::CommitL()\n
       
   834    CDictionaryStore::CommitL()\n
       
   835    RDictionaryReadStream::OpenL(const CDictionaryStore& aDictStore,TUid aUid)\n
       
   836    RDictionaryReadStream::ReadInt8L()\n
       
   837    
       
   838    @SYMTestExpectedResults Test checks whether stored and read values from the
       
   839    ini file match. 
       
   840  */
       
   841 void CT_ProStep::testIniFilesL()
       
   842 	{
       
   843 	TFullName filePath=_L("c:\\docs\\tstapp.doc");
       
   844 	const TFullName iniPath=_L("c:\\system\\data\\tstapp.ini");		// defined in tstapp
       
   845 	const TUid testUid={1};
       
   846 
       
   847 	// delete the files to be created by the testcode
       
   848 	iFs.Delete(filePath);
       
   849 	iFs.Delete(iniPath);
       
   850 	// create a process
       
   851 	TRAPD(ret,iProcess = CApaProcess::NewL(iFs));
       
   852 	TEST(ret==KErrNone);
       
   853 
       
   854 	// create a new main doc of type tstapp
       
   855 	CApaDocument* doc=NULL;
       
   856 	TApaApplicationFactory appFact(KUidTestApp);
       
   857 	TRAP(ret,doc=iProcess->AddNewDocumentL(appFact));
       
   858 	TEST(ret==KErrNone);
       
   859 	iProcess->SetMainDocument(doc);
       
   860 	CFileStore* store=NULL;
       
   861 
       
   862 	// create the store and initialise it
       
   863 	TRAP(ret, {
       
   864 		store=doc->CreateFileStoreLC(iProcess->FsSession(),filePath);
       
   865 		CleanupStack::Pop(); // store 
       
   866 		});
       
   867 	TEST(ret==KErrNone);
       
   868 	((CTestAppDoc*)iProcess->MainDocument())->iStore = store;
       
   869 	iProcess->SetMainDocFileName(filePath);
       
   870 
       
   871 	// initialise the document with factory settings
       
   872 	TRAP(ret, doc->NewDocumentL() );
       
   873 	TEST(ret==KErrNone);
       
   874 
       
   875 	// create a new ini file for the app
       
   876 	CDictionaryStore* iniFile=NULL;
       
   877 	TRAP(ret, {
       
   878 		iniFile=iProcess->MainDocument()->Application()->OpenIniFileLC(iFs);
       
   879 		CleanupStack::Pop();
       
   880 		});
       
   881 		TEST(ret==KErrNone);
       
   882 
       
   883 	// add some data to it
       
   884 	RDictionaryWriteStream writeStream;
       
   885 	TRAP(ret, writeStream.AssignL(*iniFile,testUid) );
       
   886 	TEST(ret==KErrNone);
       
   887 	TInt data=17;
       
   888 	TRAP(ret, writeStream.WriteInt8L(data) );
       
   889 	TEST(ret==KErrNone);
       
   890 	TRAP(ret, writeStream.CommitL() );
       
   891 	TEST(ret==KErrNone);
       
   892 	writeStream.Close();
       
   893 
       
   894 	// close it
       
   895 	TRAP(ret, iniFile->CommitL() );
       
   896 	TEST(ret==KErrNone);
       
   897 	delete iniFile;
       
   898 	iniFile = NULL;
       
   899 
       
   900 	// re-open it
       
   901 	TRAP(ret, {
       
   902 		iniFile=iProcess->MainDocument()->Application()->OpenIniFileLC(iFs);
       
   903 		CleanupStack::Pop();
       
   904 		});
       
   905 		TEST(ret==KErrNone);
       
   906 
       
   907 	// check the contents
       
   908 	RDictionaryReadStream readStream;
       
   909 	TRAP(ret, readStream.OpenL(*iniFile,testUid) );
       
   910 	TEST(ret==KErrNone);
       
   911 	TInt check=0;
       
   912 	TRAP(ret, check=readStream.ReadInt8L() );
       
   913 	TEST(ret==KErrNone);
       
   914 	TEST(check==data);
       
   915 	readStream.Close();
       
   916 
       
   917 	// close it
       
   918 	delete iniFile;
       
   919 
       
   920 	// tidy up
       
   921 	delete iProcess;
       
   922 	iFs.Delete(filePath);
       
   923 	iFs.Delete(iniPath);
       
   924 	}
       
   925 
       
   926 /**
       
   927   Auxiliary Fn for Test Case ID T-ProStep-testControls1L,
       
   928   T-ProStep-testControls2L, T-ProStep-testControls3L
       
   929  
       
   930   The method finds the index of control m_ctrl.exe in the control list.
       
   931   Depending on the Boolean value of argument aIsNewPath the search is
       
   932   done on ROM / RAM.\n
       
   933  
       
   934 */
       
   935 
       
   936 TInt CT_ProStep::ControlIndexInList(CApaSystemControlList* aList, TBool aIsNewPath)
       
   937 	{
       
   938 	TFileName newCtlPath=_L("c:\\sys\\bin\\m_ctrl.exe");
       
   939 
       
   940 	const TInt count = aList->Count();
       
   941 	TInt retVal = KErrNotFound;
       
   942 	for(TInt ii = 0; ii < count; ++ii)
       
   943 		{
       
   944 		if(((aList->Control(ii)->FileName().CompareF(ctlPath)==0) && (!aIsNewPath)) ||
       
   945 			((aList->Control(ii)->FileName().CompareF(newCtlPath)==0) && (aIsNewPath)))
       
   946 			{
       
   947 			retVal = ii;
       
   948 			break;
       
   949 			}
       
   950 		}
       
   951 	return retVal;
       
   952 	}
       
   953 
       
   954 
       
   955 /**
       
   956    @SYMTestCaseID T-ProStep-testControls1L
       
   957   
       
   958    @SYMPREQ
       
   959   
       
   960    @SYMTestCaseDesc Tests CApaSystemControlList::UpdateL().
       
   961    
       
   962    @SYMTestPriority High 
       
   963   
       
   964    @SYMTestStatus Implemented
       
   965    
       
   966    @SYMTestActions Check the control list to find the number of controls in the
       
   967    list and the number of updates to the list. Call UpdateL(). Check the list
       
   968    again for no change in the count of controls and updates to the list.\n
       
   969    API Calls:\n	
       
   970    CApaSystemControlList::UpdateL()\n
       
   971    
       
   972    @SYMTestExpectedResults Test confirms that there is no change in the control
       
   973    list after updating.
       
   974  */
       
   975 void CT_ProStep::testControls1L()
       
   976 	{
       
   977 	iControlCount1 = iControlList->Count();
       
   978 	TEST((iControlCount1>=1));
       
   979 	TEST((iControlList->UpdateCount()>=1));
       
   980 
       
   981 	// do an update - there should be no changes
       
   982 	TInt ret;
       
   983 	TRAP(ret, iControlList->UpdateL());
       
   984 	TEST(ret==KErrNone);
       
   985 	iControlCount2 = iControlList->Count();
       
   986 	TEST(iControlCount2 == iControlCount1);	// no change in the count (finds a m_ctrl.exe file on z, not c)
       
   987 	TEST((iControlList->UpdateCount()>=1));
       
   988 	TInt index = ControlIndexInList(iControlList,EFalse);
       
   989 	TEST((index >= 0) && (index < iControlCount2));
       
   990 	}
       
   991 
       
   992 
       
   993 /**
       
   994    @SYMTestCaseID T-ProStep-testControls2L
       
   995   
       
   996    @SYMPREQ
       
   997   
       
   998    @SYMTestCaseDesc Tests CApaSystemControlList::UpdateL() and UpdateCount().
       
   999    
       
  1000    @SYMTestPriority High 
       
  1001   
       
  1002    @SYMTestStatus Implemented
       
  1003   
       
  1004    @SYMTestActions Copy control from Z: drive to C: drive. Call UpdateL() to
       
  1005    update the control list. Check if UpdateL() has incremented iUpdateCount
       
  1006    by calling UpdateCount(). Check the filename of control to ensure that the
       
  1007    control copied to C: drive has been updated in the list. Delete the newly
       
  1008    copied control.\n
       
  1009    API Calls:\n	
       
  1010    CApaSystemControlList::UpdateL()\n
       
  1011    CApaSystemControlList::UpdateCount()const\n
       
  1012    
       
  1013    @SYMTestExpectedResults The test shows updating of the copied control in control list.
       
  1014  */
       
  1015 void CT_ProStep::testControls2L()
       
  1016 	{
       
  1017 	RSmlTestUtils testSession;
       
  1018 	User::LeaveIfError(testSession.Connect());
       
  1019 
       
  1020 	testSession.CreateDirectoryL(KCTLDIR);
       
  1021 	testSession.CreateDirectoryL(KRSCDIR);
       
  1022 
       
  1023 	TInt ret=testSession.CopyFileL(KSOURCEPATH,KNEWCTLPATH);
       
  1024 	TEST(ret==KErrNone);
       
  1025 	ret=testSession.CopyFileL(KLOCPATH,KNEWLOCPATH);
       
  1026 	TEST(ret==KErrNone);
       
  1027 
       
  1028 	TInt controlCount=iControlList->UpdateCount();
       
  1029 	while(iControlList->UpdateCount()<=controlCount)
       
  1030 		{
       
  1031 		TRAP(ret, iControlList->UpdateL());
       
  1032 		if(ret!=KErrNone)
       
  1033 			{
       
  1034 			break;				
       
  1035 			}
       
  1036 		User::After(100000);	
       
  1037 		}
       
  1038 	TEST(ret==KErrNone);
       
  1039 
       
  1040 	iControlCount3 = iControlList->Count();
       
  1041 	TEST(iControlCount3 == iControlCount1);	// still no changes in the count (finds a m_ctrl.exe file on c, not z)
       
  1042 	TEST((iControlList->UpdateCount()==controlCount+1));
       
  1043 
       
  1044 	TInt index = ControlIndexInList(iControlList,ETrue);
       
  1045 	TEST((index>=0)&&(index<iControlCount3));
       
  1046 	if(index>=0)
       
  1047 		{
       
  1048 		TFileName name=iControlList->Control(index)->FileName();
       
  1049 		TEST(name.CompareF(KCTRLNAME)==0);
       
  1050 		}
       
  1051 	
       
  1052 	// hide the control and do an update - there should be changes
       
  1053 	testSession.SetReadOnly(KNEWCTLPATH,0);  // remove the read only attribute
       
  1054 	ret=testSession.DeleteFileL(KNEWCTLPATH);
       
  1055 	TEST(ret==KErrNone);
       
  1056 	testSession.SetReadOnly(KNEWLOCPATH,0);  // remove the read only attribute
       
  1057 	ret=testSession.DeleteFileL(KNEWLOCPATH);
       
  1058 	TEST(ret==KErrNone);
       
  1059 	controlCount=iControlList->UpdateCount();
       
  1060 	while(iControlList->UpdateCount()<=controlCount)
       
  1061 		{
       
  1062 		TRAPD(ret, iControlList->UpdateL());
       
  1063 		if(ret!=KErrNone)
       
  1064 			{
       
  1065 			break;				
       
  1066 			}
       
  1067 		User::After(100000);
       
  1068 		}
       
  1069 
       
  1070 	testSession.Close();
       
  1071 	}
       
  1072 
       
  1073 
       
  1074 /**
       
  1075    @SYMTestCaseID T-ProStep-testControls3L
       
  1076   
       
  1077    @SYMPREQ
       
  1078   
       
  1079    @SYMTestCaseDesc Tests CApaSystemControlList::Control() and CApaSystemControl APIs Type() and Caption().
       
  1080    
       
  1081    @SYMTestPriority High 
       
  1082   
       
  1083    @SYMTestStatus Implemented
       
  1084    
       
  1085    @SYMTestActions Update the control list to ensure that the deleted control is
       
  1086    removed from the list and the control on the Z: Drive is added to the list.
       
  1087    Retrieve this control from the list using CApaSystemControlList::Control(). 
       
  1088    Check the type and caption of the control calling Type() and Caption() methods.\n
       
  1089    API Calls:\n	
       
  1090    CApaSystemControlList::Control(TInt aIndex)const\n
       
  1091    CApaSystemControl::Type()const\n
       
  1092    CApaSystemControl::Caption()const\n
       
  1093    
       
  1094    @SYMTestExpectedResults The test shows the addition of the control present on 
       
  1095    Z: drive in control list. Test confirms the retrieved info on the control
       
  1096    obtained from the control list.
       
  1097   
       
  1098  */
       
  1099 void CT_ProStep::testControls3L()
       
  1100    {
       
  1101 	TUid KUidMinimalControl={0x13008AEE};
       
  1102 	TFileName ctlCaption=_L("m_ctrl");
       
  1103 	// This method is called to close the panic dialog generated by previous test
       
  1104 	ClosePanicWindowL();
       
  1105 
       
  1106 	TRAPD(ret, iControlList->UpdateL());
       
  1107 	TEST(ret==KErrNone);
       
  1108 	const TInt controlCount4 = iControlList->Count();
       
  1109 	TEST(controlCount4 == iControlCount1);	// still no changes in the count (finds a .ctl file on z, not c)
       
  1110 	TEST((iControlList->UpdateCount()==3));
       
  1111 	TInt index = ControlIndexInList(iControlList,EFalse);
       
  1112 	TEST((index >= 0) && (index < controlCount4));
       
  1113 	if(index>=0)
       
  1114 		{
       
  1115 		TEST(iControlList->Control(index)->FileName().CompareF(ctlPath)==0);
       
  1116 	
       
  1117 		INFO_PRINTF1(_L("Testing CApaSystemControl"));
       
  1118 
       
  1119 		//get the control from the list and check it's type and caption
       
  1120 		iControl=iControlList->Control(index);
       
  1121 		TEST(iControl!=NULL);
       
  1122 		TEST((iControl->Type()==KUidMinimalControl));
       
  1123 		TFileName caption=iControl->Caption();
       
  1124 		TEST(caption.CompareF(ctlCaption)==0);
       
  1125 		TEST(iControl->Icon()!=NULL);
       
  1126 		RThread thread;
       
  1127 		TFullName name=_L("Control Panel Test");
       
  1128 		TInt r=thread.Create(name,SimulateKeyL,KDefaultStackSize,KDefaultStackSize,KDefaultStackSize,NULL);
       
  1129 		TEST(r==KErrNone);
       
  1130 		thread.Resume();
       
  1131 
       
  1132 		// run the control
       
  1133 		TRAP(ret, iControl->CreateL()); // this control is synchronous
       
  1134 		TEST(ret==KErrNone);
       
  1135 		thread.Close();
       
  1136 		}
       
  1137 	}
       
  1138 
       
  1139 /**
       
  1140    Auxiliary Fn for T-ProStep-testControls1L, T-ProStep-testControls2L, T-ProStep-testControls3L
       
  1141    
       
  1142    This method creates a control list by calling CApaSystemControlList::NewL() and 
       
  1143    initiates subsequent tests on CApaSystemControlList and CApaSystemControl APIs.
       
  1144     
       
  1145  */
       
  1146 void CT_ProStep::testControlsL()
       
  1147 	{
       
  1148 	INFO_PRINTF1(_L("Testing CApaSystemControlList"));
       
  1149 
       
  1150 	//Create a session with F & B server
       
  1151 	TInt ret = RFbsSession::Connect();
       
  1152 	TEST(ret == KErrNone);
       
  1153 
       
  1154 	CFileMan* fileMan=CFileMan::NewL(iFs);
       
  1155 	CleanupStack::PushL(fileMan);
       
  1156 
       
  1157 	TRAP(ret,iControlList=CApaSystemControlList::NewL(iFs));
       
  1158 	TEST(ret==KErrNone);
       
  1159 
       
  1160 	testControls1L();
       
  1161 	testControls2L();
       
  1162 	testControls3L();
       
  1163 
       
  1164 	// tidy up
       
  1165 	delete iControlList;
       
  1166 	CleanupStack::PopAndDestroy(fileMan);
       
  1167 
       
  1168 	//Close the session F & B server.
       
  1169 	RFbsSession::Disconnect();
       
  1170 
       
  1171      }
       
  1172 
       
  1173  TInt PanicTestThread(TAny* aOption)
       
  1174 	{
       
  1175 	CTrapCleanup::New();
       
  1176 	const TInt option = TInt(aOption);
       
  1177 	//Create a session with F & B server
       
  1178 	TInt ret = RFbsSession::Connect();
       
  1179 	switch(option)
       
  1180 		{
       
  1181 	case ENegativePanicTest:
       
  1182 	 	
       
  1183 		if(ret==KErrNone)
       
  1184 			{
       
  1185 			RFs fs;
       
  1186 			fs.Connect();
       
  1187 			CApaSystemControlList *controlList=NULL;
       
  1188 			TRAP(ret,controlList=CApaSystemControlList::NewL(fs));
       
  1189 			if(ret==KErrNone)
       
  1190 				{
       
  1191 				TInt count=controlList->Count();
       
  1192 				controlList->Control(count+10);
       
  1193 				}
       
  1194 			delete controlList;
       
  1195 			fs.Close();
       
  1196 			}
       
  1197      break;
       
  1198 	 default:
       
  1199 		User::Panic(_L("TProStep Error"), EUnknownPanicOption);
       
  1200 	 	}
       
  1201 	RFbsSession::Disconnect(); 	
       
  1202 	return KErrNone;
       
  1203 	}
       
  1204 	
       
  1205 /**
       
  1206    @SYMTestCaseID APPFWK-APPARC-0056
       
  1207   
       
  1208    @SYMDEF DEF092293
       
  1209   
       
  1210    @SYMTestCaseDesc Tests CApaSystemControlList::Control() Throws the right Panic on Invalid Count.
       
  1211    
       
  1212    @SYMTestPriority High 
       
  1213   
       
  1214    @SYMTestStatus Implemented
       
  1215    
       
  1216    @SYMTestActions Create  Seperate Thread to call the PanicTestThread Method where we create a new system ControlList
       
  1217    and get the actual count of the lists present inside . now call the CApaSystemControlList::Control(Index);where Index
       
  1218    is a number greater than the actual count list.
       
  1219    CApaSystemControlList::Control(TInt aIndex)const\n
       
  1220   
       
  1221    
       
  1222    @SYMTestExpectedResults Expect a APGRFX Panic EPanicIndexOutOfRange.
       
  1223   
       
  1224  */	
       
  1225 	
       
  1226 void CT_ProStep::testPanicForControlListL()
       
  1227 	{
       
  1228 	RThread thrd;
       
  1229 	TRequestStatus stat;
       
  1230 	TInt ret=thrd.Create(_L("ptt"),PanicTestThread,KDefaultStackSize,0x2000,0x20000,(TAny*)ENegativePanicTest);
       
  1231 	User::LeaveIfError(ret);
       
  1232 	thrd.SetPriority(EPriorityMuchMore);
       
  1233 	thrd.Logon(stat);
       
  1234 	User::SetJustInTime(EFalse);
       
  1235 	thrd.Resume();
       
  1236 	User::WaitForRequest(stat);
       
  1237 	TEST(thrd.ExitType()==EExitPanic); 
       
  1238 	TEST(thrd.ExitReason()==EPanicIndexOutOfRange);
       
  1239 	INFO_PRINTF2(_L("TestPanicForControlList panic=%d"), thrd.ExitReason());
       
  1240 	thrd.Close();
       
  1241 	User::SetJustInTime(ETrue);
       
  1242 	ClosePanicWindowL();
       
  1243 	
       
  1244 	}
       
  1245 	
       
  1246 // This method is called to close the panic generated by the testPanicForControlListL() test.	
       
  1247 void CT_ProStep::ClosePanicWindowL()
       
  1248 	{
       
  1249 	RWsSession	ws;
       
  1250 	User::LeaveIfError(ws.Connect());
       
  1251 
       
  1252 	TInt wgFocus = ws.GetFocusWindowGroup();
       
  1253 
       
  1254 	const TUint32 ENullWsHandle = 0xFFFFFFFF;	// Events delivered to this handle are thrown away
       
  1255 	RWindowGroup wg = RWindowGroup(ws);
       
  1256 
       
  1257 	wg.Construct(ENullWsHandle);
       
  1258 	TInt wgId = wg.Identifier();
       
  1259 
       
  1260 	TWsEvent event;
       
  1261 	event.SetType(EEventKey);
       
  1262 	TKeyEvent *keyEvent = event.Key();
       
  1263 	keyEvent->iCode = EKeyEscape;
       
  1264 	keyEvent->iScanCode = EStdKeyEscape;
       
  1265 	keyEvent->iModifiers = 0;
       
  1266 
       
  1267 	TInt limit = 0;
       
  1268 	for(limit = 0; wgFocus != wgId && (limit < 50); limit++)
       
  1269 	{
       
  1270 		ws.SendEventToAllWindowGroups(event);
       
  1271 		wgFocus = ws.GetFocusWindowGroup();
       
  1272 		RDebug::Print(_L("CloseAllPanicWindowsL() - EKeyEscape sent to Windows Group"));
       
  1273 	}
       
  1274 
       
  1275 	// close everything
       
  1276 	wg.Close();
       
  1277 	ws.Close();
       
  1278 	
       
  1279 	}
       
  1280 /**
       
  1281    @SYMTestCaseID T_ProStep_DoAppListInvalidTestL
       
  1282   
       
  1283    @SYMPREQ
       
  1284  
       
  1285    @SYMTestCaseDesc Tests GetNextApp() never returns RApaLsSession::EAppListInvalid.
       
  1286   
       
  1287    @SYMTestPriority High 
       
  1288   
       
  1289    @SYMTestStatus Implemented
       
  1290    
       
  1291    @SYMTestActions Copy tstapp files from z: drive to c: drive. Create a session
       
  1292    with the Application Architecture server. Populate the list of applications
       
  1293    to cache by calling RApaLsSession::GetAllApps().Remove the copied files
       
  1294    from C: drive. Traverse through the list by calling
       
  1295    RApaLsSession::GetNextApp(). Check return value to ensure that
       
  1296    RApaLsSession::EAppListInvalid is never returned.\n
       
  1297    API Calls:\n	
       
  1298    RApaLsSession::GetNextApp(TApaAppInfo& aInfo) const
       
  1299    
       
  1300    @SYMTestExpectedResults Test confirms that RApaLsSession::EAppListInvalid is never returned.
       
  1301     
       
  1302  */
       
  1303 void CT_ProStep::DoAppListInvalidTestL(RApaLsSession& aLs)
       
  1304 	{
       
  1305 	_LIT(KTempAppDir, "C:\\private\\10003a3f\\import\\apps\\");
       
  1306 	_LIT(KTempRegPath, "C:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc");
       
  1307 	TFullName regPath=_L("z:\\private\\10003a3f\\import\\apps\\tstapp_reg.rsc");
       
  1308 	
       
  1309 	CFileMan* fileMan = CFileMan::NewL (iFs);
       
  1310 	CleanupStack::PushL(fileMan);
       
  1311 	
       
  1312 	INFO_PRINTF1(_L("Copy tstapp files to C: drive......."));
       
  1313 	TInt ret = iFs.MkDir(KTempAppDir);
       
  1314 	TEST(ret==KErrNone || ret==KErrAlreadyExists);
       
  1315 	TEST(fileMan->Copy(regPath, KTempRegPath)==KErrNone);	//Just to start the idle update.
       
  1316 
       
  1317 	User::After(8000000);
       
  1318 	
       
  1319 	INFO_PRINTF1(_L("Get app list......."));
       
  1320 	ret = aLs.GetAllApps();
       
  1321 	TEST(ret==KErrNone);
       
  1322 
       
  1323 	INFO_PRINTF1(_L("Remove temp files from C: drive......."));
       
  1324 	TRequestStatus status;
       
  1325 	TTime tempTime(0); // added tempTime to avoid asynch CFileMan::Attribs request completing with KErrArgument
       
  1326 	TInt err=fileMan->Attribs(KTempAppDir,0,KEntryAttReadOnly, tempTime, CFileMan::ERecurse, status);
       
  1327 	TEST(err==KErrNone);
       
  1328 	User::WaitForRequest(status);
       
  1329 	TEST(status.Int() == KErrNone);
       
  1330 	TEST(fileMan->Delete(KTempRegPath)==KErrNone);	//Just to start the idle update.
       
  1331 	TEST(fileMan->RmDir(KTempAppDir)==KErrNone);
       
  1332 
       
  1333 	User::After(8000000);
       
  1334 	
       
  1335 	INFO_PRINTF1(_L("Testing GetNextApp() never returns RApaLsSession::EAppListInvalid."));
       
  1336 	TApaAppInfo info;
       
  1337 	while(ret==KErrNone)
       
  1338 		{
       
  1339 		ret=aLs.GetNextApp(info);
       
  1340 		}
       
  1341 	TEST(ret!=RApaLsSession::EAppListInvalid);
       
  1342 	TEST(ret==RApaLsSession::ENoMoreAppsInList);
       
  1343 
       
  1344 	CleanupStack::PopAndDestroy(fileMan);
       
  1345 	}
       
  1346 
       
  1347 
       
  1348 /**
       
  1349   Auxiliary Fn for all Test Cases.
       
  1350  
       
  1351   This method creates and installs an active scheduler and puts the
       
  1352   test code on the scheduler as a CIdle object. The method initiates
       
  1353   all tests by calling the static method CT_ProStepCallBack::CallBack().
       
  1354  
       
  1355 */
       
  1356 void CT_ProStep::DoStepTestsInCallbackL()
       
  1357 	{
       
  1358 	// create an active scheduler
       
  1359 	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
       
  1360 	CActiveScheduler::Install(scheduler);
       
  1361 	CleanupStack::PushL(scheduler);
       
  1362 
       
  1363 	// put the test code onto the scheduler as an idle object
       
  1364 	CIdle* idle=CIdle::NewL(-20);
       
  1365 	CleanupStack::PushL(idle);
       
  1366 
       
  1367 	CT_ProStepCallBack* callBack = new(ELeave) CT_ProStepCallBack(this);
       
  1368 	CleanupStack::PushL(callBack);
       
  1369 
       
  1370 	idle->Start(TCallBack(CT_ProStepCallBack::CallBack,callBack));
       
  1371 	// start the test code
       
  1372 	CActiveScheduler::Start();
       
  1373 
       
  1374 	// all outstanding requests complete - kill the scheduler
       
  1375 	CleanupStack::PopAndDestroy(3); //scheduler, callBack, idle
       
  1376 	}
       
  1377 
       
  1378 /**
       
  1379   This static method is the callback function of CIdle object. The method
       
  1380   calls the non-static method DoStepTests() which initiates all the tests. 
       
  1381 */
       
  1382 TInt CT_ProStepCallBack::CallBack(TAny* callBack /*aThis*/)
       
  1383 {
       
  1384 	//Call Test Step func
       
  1385 	((CT_ProStepCallBack *)callBack)->iTestStep->DoStepTests();
       
  1386 	
       
  1387 	CActiveScheduler::Stop();
       
  1388 	return EFalse; // don't call back again
       
  1389 	}
       
  1390 
       
  1391 
       
  1392 /**
       
  1393    Constructor
       
  1394  */
       
  1395 CT_ProStepCallBack::CT_ProStepCallBack(CT_ProStep* aTestStep)
       
  1396 	{
       
  1397 	iTestStep = aTestStep;
       
  1398 	}
       
  1399 
       
  1400 /**
       
  1401    Destructor
       
  1402  */
       
  1403 CT_ProStepCallBack::~CT_ProStepCallBack()
       
  1404 	{
       
  1405 	}
       
  1406 
       
  1407 /**
       
  1408   Auxiliary Fn for all Test Cases. 
       
  1409   The method initiates all tests to be performed.
       
  1410 */
       
  1411 void CT_ProStep::DoStepTests()
       
  1412 	{
       
  1413 	INFO_PRINTF1(_L("Test AppListInvalidTest......"));
       
  1414 	RTestableApaLsSession ls;
       
  1415 	TEST(KErrNone == ls.Connect());
       
  1416 	CleanupClosePushL(ls);
       
  1417 	//DONT_CHECK due to changes to file system
       
  1418 	HEAP_TEST_LS_SESSION(ls, 0, DONT_CHECK, DoAppListInvalidTestL(ls), REComSession::FinalClose() );
       
  1419 	CleanupStack::PopAndDestroy(&ls);
       
  1420 	
       
  1421 	__UHEAP_MARK;
       
  1422 	INFO_PRINTF1(_L("Test AppIdentifier......"));
       
  1423 	TRAPD(r,testAppIdentifierL());
       
  1424 	TEST(r==KErrNone);
       
  1425 	INFO_PRINTF2(_L("Test AppIdentifier completed with code %d\n"), r);
       
  1426 	REComSession::FinalClose();
       
  1427 	__UHEAP_MARKEND;
       
  1428 	
       
  1429 	__UHEAP_MARK;
       
  1430 	INFO_PRINTF1(_L("Test TestGenerateFileName......"));
       
  1431 	TRAP(r,doTestGenerateFileName());
       
  1432 	TEST(r==KErrNone);
       
  1433 	INFO_PRINTF2(_L("Test TestGenerateFileName completed with code %d\n"), r);
       
  1434 	REComSession::FinalClose();
       
  1435 	__UHEAP_MARKEND;
       
  1436 
       
  1437 	__UHEAP_MARK;
       
  1438 	INFO_PRINTF1(_L("Test TestReadStreamL......"));
       
  1439 	TRAP(r,testReadStreamL());
       
  1440 	TEST(r==KErrNone);
       
  1441 	INFO_PRINTF2(_L("Test TestReadStream completed with code %d\n"), r);
       
  1442 	REComSession::FinalClose();
       
  1443 	__UHEAP_MARKEND;
       
  1444 
       
  1445 	__UHEAP_MARK;
       
  1446 	INFO_PRINTF1(_L("Test DocCreation......"));
       
  1447 	TRAP(r,testDocCreationL());
       
  1448 	TEST(r==KErrNone);
       
  1449 	INFO_PRINTF2(_L("Test DocCreation completed with code %d\n"), r);
       
  1450 	REComSession::FinalClose();
       
  1451 	__UHEAP_MARKEND;	
       
  1452 	
       
  1453 	__UHEAP_MARK;
       
  1454 	INFO_PRINTF1(_L("Test Embedding......"));
       
  1455 	TRAP(r,testEmbeddingL());
       
  1456 	TEST(r==KErrNone);
       
  1457 	INFO_PRINTF2(_L("Test Embedding completed with code %d\n"), r);
       
  1458 	REComSession::FinalClose();
       
  1459 	__UHEAP_MARKEND;
       
  1460 
       
  1461 	__UHEAP_MARK;
       
  1462 	INFO_PRINTF1(_L("Test MainDocFileName......"));
       
  1463 	TRAP(r,MainDocFileNameTestsL());
       
  1464 	TEST(r==KErrNone);
       
  1465 	INFO_PRINTF2(_L("Test MainDocFileName completed with code %d\n"), r);
       
  1466 	REComSession::FinalClose();
       
  1467 	__UHEAP_MARKEND;
       
  1468 
       
  1469 	__UHEAP_MARK;
       
  1470 	INFO_PRINTF1(_L("Test IniFiles......"));
       
  1471 	TRAP(r,testIniFilesL());
       
  1472 	TEST(r==KErrNone);
       
  1473 	INFO_PRINTF2(_L("Test IniFiles completed with code %d\n"), r);
       
  1474 	REComSession::FinalClose();
       
  1475 	__UHEAP_MARKEND;
       
  1476 
       
  1477 	__UHEAP_MARK;
       
  1478 	INFO_PRINTF1(_L("Test Controls......"));
       
  1479 	TRAP(r,testControlsL());
       
  1480 	TEST(r==KErrNone);
       
  1481 	INFO_PRINTF2(_L("Test Controls completed with code %d\n"), r);
       
  1482 	REComSession::FinalClose();
       
  1483 	__UHEAP_MARKEND;
       
  1484 
       
  1485         __UHEAP_MARK;
       
  1486 	INFO_PRINTF1(_L("Test Panic Controls......"));
       
  1487 	TRAP(r,testPanicForControlListL());
       
  1488 	TEST(r==KErrNone);
       
  1489 	INFO_PRINTF2(_L("Test Panic Controls completed with code %d\n"), r);
       
  1490 	REComSession::FinalClose();
       
  1491 	__UHEAP_MARKEND;
       
  1492 	} 
       
  1493 
       
  1494 /**
       
  1495    Destructor
       
  1496  */
       
  1497 CT_ProStep::~CT_ProStep()
       
  1498 	{
       
  1499 	}
       
  1500 
       
  1501 /**
       
  1502    Constructor
       
  1503  */
       
  1504 CT_ProStep::CT_ProStep()
       
  1505 	{
       
  1506 	SetTestStepName(KT_ProStep);
       
  1507 	}
       
  1508 
       
  1509 /**
       
  1510    @return - TVerdict code
       
  1511    Override of base class virtual
       
  1512  */
       
  1513 TVerdict CT_ProStep::doTestStepPreambleL()
       
  1514 	{
       
  1515 	SetTestStepResult(EPass);
       
  1516 	return TestStepResult();
       
  1517 	}
       
  1518 
       
  1519 /**
       
  1520    @return - TVerdict code
       
  1521    Override of base class virtual
       
  1522  */
       
  1523 TVerdict CT_ProStep::doTestStepPostambleL()
       
  1524 	{
       
  1525 	return TestStepResult();
       
  1526 	}
       
  1527 
       
  1528 /**
       
  1529    @return - TVerdict code
       
  1530    Override of base class virtual
       
  1531 */
       
  1532 TVerdict CT_ProStep::doTestStepL()
       
  1533 	{
       
  1534 	INFO_PRINTF1(_L("Testing Apparch...T_Pro"));
       
  1535 
       
  1536 	FbsStartup();
       
  1537 
       
  1538 	iFs.Connect();
       
  1539 	setup();
       
  1540 
       
  1541 	TRAPD(ret,DoStepTestsInCallbackL())
       
  1542 	TEST(ret==KErrNone);
       
  1543 
       
  1544 	iFs.Close();
       
  1545 
       
  1546 	INFO_PRINTF1(_L("T_Pro Completed."));
       
  1547 	return TestStepResult();
       
  1548 	}