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