/** Auxiliary function for all Test Cases The method creates & sets the test step's user interface object and launches the test step. @SYMTestCaseID UIF-TPARENT-doTestStepL @SYMDEF @SYMTestCaseDesc This test aims to test that the parent of a control created in a container has the view as its parent. @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions The view creates a control, and sets the container window for the control to be itself @SYMTestExpectedResults The control is queried to confirm that its parent is the view. */ TVerdict CTestParentStep::doTestStepL() // main function called by E32 { PreallocateHALBuffer(); __UHEAP_MARK; SetTestStepID(_L("UIF-TPARENT-doTestStepL")); // Before creating the CEikonEnv we must create C:\parent.txt. // The presence of this file will modify the behaviour of // staticsettingsinit RSmlTestUtils utils; User::LeaveIfError(utils.Connect()); CleanupClosePushL(utils); _LIT(KFile, "c:\\parent.txt"); utils.CreateFileL(KFile); CEikonEnv* coe=new CEikonEnv; TRAPD(err,ConstructAppL(coe)); if (!err) coe->ExecuteD(); utils.DeleteFileL(KFile); CleanupStack::PopAndDestroy(&utils); REComSession::FinalClose(); RecordTestResultL(); CloseTMSGraphicsStep(); __UHEAP_MARKEND; return TestStepResult(); }
/** Check that the test plugin file has not been left in the filesystem from a previous aborted test. */ TVerdict CT_ApsScanStep::doTestStepPreambleL() { RSmlTestUtils fs; CleanupClosePushL(fs); User::LeaveIfError(fs.Connect()); INFO_PRINTF1(_L("Verifies that dummy.rsc was not present during boot.")); TBool fileExists = ETrue; TInt err = fs.IsFilePresent(KRscTargetPath, fileExists); TESTE(fileExists==EFalse, err); CleanupStack::PopAndDestroy(&fs); return TestStepResult(); }
/* Ecom factory function Due to platsec we can't build plugin.dll to an alternative location and we can't copy files from epoc32\release\winscw\udeb. Both plugin.rsc and plugin.dll must be on the same drive to be installed. The workaround to implement this tef-test is works like this: 1. This test plugin are copied into z: by the build tools 2. This plugin will not be installed during startup because CreateRecognizerL will leave 3. During the test a dummy plugin.rsc will be copied into c:\resource\plugins to trig Ecom 4. Apparc will re-scan and make sure all recognizers listed by Ecom are properly installed 5. Ecom will not install the copied dummy file as it has no matching dll on the same drive, but 6. This recognizer will detect the dummy file and chose not to leave from CreateRecognizerL */ CApaDataRecognizerType* CTestMimeRecognizer::CreateRecognizerL() { RSmlTestUtils fileServ; CleanupClosePushL(fileServ); User::LeaveIfError(fileServ.Connect()); TBool fileExists = EFalse; User::LeaveIfError(fileServ.IsFilePresent(KRscTargetPath, fileExists)); CleanupStack::PopAndDestroy(&fileServ); if(!fileExists) User::Leave(KErrPathNotFound); return new (ELeave) CTestMimeRecognizer(); }
/* Delete the plugin file which was installed during the test from c:. */ TVerdict CT_ApsScanStep::doTestStepPostambleL() { RSmlTestUtils fs; CleanupClosePushL(fs); User::LeaveIfError(fs.Connect()); TBool fileExists = EFalse; fs.IsFilePresent(KRscTargetPath, fileExists); if(fileExists) { fs.ChangeFilePermissionL(KRscTargetPath); // clear readonly attribute inherited from z: const TInt err = fs.DeleteFileL(KRscTargetPath); if(err == KErrNone) INFO_PRINTF1(_L("Removed temporary file dummy.rsc")); else INFO_PRINTF1(_L("Failed to remove temporary file dummy.rsc")); } CleanupStack::PopAndDestroy(&fs); return TestStepResult(); }
/** Copies the test file dummy.rsc from z: to c: using RSmlTestUtils rather than aFs due to platsec protection of involved directories. */ void CT_ApsScanStep::CopyRecognizerFileL() { RSmlTestUtils fs; CleanupClosePushL(fs); User::LeaveIfError(fs.Connect()); // Ensure c:\\resource\\plugins is created, otherwise leave and abort this teststep TInt err = fs.CreateDirectoryL(KRscTargetDir); TESTEL((err==KErrNone || err==KErrAlreadyExists), err); // Copy resource file from z: to c:, if unsuccessful - leave and abort this teststep #if defined (__WINSCW__) err = fs.CopyFileL(KRscSourcePathWinscw, KRscTargetPath); #else err = fs.CopyFileL(KRscSourcePathArmv5, KRscTargetPath); #endif TESTEL(err==KErrNone, err); CleanupStack::PopAndDestroy(&fs); }
/** @SYMTestCaseID UIF-errorstep-TestResolveAllL @SYMPREQ @SYMTestCaseDesc Test behaviour when error files are added or removed. @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions The method backs up the resource files and renames them.Then invokes CEikErrorResolver::ResolveError() by passing error codes. It tests the error message returned by ResolveError(). The method then adds the resource files back and tests CEikErrorResolver::ResolveError() API. @SYMTestExpectedResults The error message should be unknown error on renaming of the resource files. On restoration of the resource files the error message should be as read from the resource file. */ void CAppTest::TestResolveAllL() { CEikErrorResolver* errRes=CEikErrorResolver::NewL(iEikEnv); CleanupStack::PushL(errRes); TBuf<40> unknownErrText; errRes->ResolveError(unknownErrText,KErrUnknown,KNullUid); // resolve resource files (all should be ok now) TestResolveErrsL(*errRes); // Connect to the utils server RSmlTestUtils utils; User::LeaveIfError(utils.Connect()); CleanupClosePushL(utils); // remove res files CAppBackup* backup=CAppBackup::NewLC(); TInt err = utils.RenameDirectoryL(KLitV2ResFilePath(), KLitV2ResFilePathInvalid()); iAppUi->TEST(err == KErrNone); // resolve resource files (now things are not resolved...) TBuf<256> errText; errRes->ResolveError(errText,KCDriveTest1Err,KNullUid); TestErrTxtL(errText, unknownErrText); errRes->ResolveError(errText,KCDriveTest3Err,KNullUid); TestErrTxtL(errText, unknownErrText); errRes->ResolveError(errText,KCDriveTest5Err,KNullUid); TestErrTxtL(errText, unknownErrText); // add res files again err = utils.RenameDirectoryL(KLitV2ResFilePathInvalid(), KLitV2ResFilePath()); CleanupStack::PopAndDestroy(backup); // resolve works again... TestResolveErrsL(*errRes); // clean-up CleanupStack::PopAndDestroy(2, errRes); }
TVerdict CAppfwkAmaStarterTestStepStandalone::doTestStepL() { INFO_PRINTF1(_L("AMAStarter Standalone tests started....")); __UHEAP_MARK; CActiveScheduler* sched = new(ELeave) CActiveScheduler; CleanupStack::PushL(sched); CActiveScheduler::Install(sched); #ifdef __WINS__ // Create separate EXEs as AmaStarter is EXEXP and more than 1 processes cannot be created for emulator. // Capabilities of AmaStarter.exe PowerMgmt(00000004) + ReadDeviceData(00000010) + ProtServ(00000100) // As SETCAP tool can't be used on hardware for AmaStarter.exe, we don't call the tool in the script, because // this would mean different scripts for emulator and hardware. LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter_default.exe"), KErrNone); LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter1.exe"), KErrNone); LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter2.exe"), KErrNone); LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter3.exe"), KErrNone); LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter4_1.exe"), KErrNone); LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter4_2.exe"), KErrNone); LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter5.exe"), KErrNone); LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter6_1.exe"), KErrNone); LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter6_2.exe"), KErrNone); LaunchExe(_L("setcap.exe"), _L("amastarter.exe 00000114 amastarter6_3.exe"), KErrNone); INFO_PRINTF1(_L("Creation of separate EXEs for AmaStarter (for emulator) completed.\n")); #endif INFO_PRINTF1(_L("Creating DBMS / SQL data store backups and delete original data stores")); TRAPD(ret, DscDatabaseBackupL()); TESTE(ret == KErrNone, ret); INFO_PRINTF1(_L("Creating appropriate data store for the tests")); TRAP(ret, CreateTestDatabaseL()); TESTE(ret == KErrNone, ret); // Run the standalone tests cases INFO_PRINTF1(_L("Now, run the tests")); RunStandaloneTests(); INFO_PRINTF1(_L("Restoring DBMS / SQL data store backups available prior to running the test")); TRAP(ret, DscDatabaseRestoreL()); TESTE(ret == KErrNone, ret); // Delete log files created to store temporary results RSmlTestUtils fs; CleanupClosePushL(fs); User::LeaveIfError(fs.Connect()); User::LeaveIfError(fs.DeleteFileUsingWildcardL(KTestLogFileWild)); CleanupStack::PopAndDestroy(&fs); // Close All panic windows that appear from negative testing conditions in this test CloseAllPanicWindowsL(); CleanupStack::PopAndDestroy(sched); __UHEAP_MARKEND; INFO_PRINTF1(_L("...AMAStarter Standalone tests finished!!")); return TestStepResult(); }