sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent sl@0: */ sl@0: sl@0: #include "tgraphicsresourceinternalteststepbase.h" sl@0: sl@0: CTGraphicsResourceInternalBase::CTGraphicsResourceInternalBase() sl@0: { sl@0: } sl@0: sl@0: CTGraphicsResourceInternalBase::~CTGraphicsResourceInternalBase() sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Creates a second process and do some tests in it. sl@0: @param aExecutableName The name of the new process sl@0: @param aTestInfo The information for the tests sl@0: @leave Gets system wide error code sl@0: */ sl@0: TInt CTGraphicsResourceInternalBase::CreateSecondProcessAndDoTestL(const TDesC &aExecutableName, TSgResIntTestInfo& aTestInfo) sl@0: { sl@0: // Create a second process sl@0: RProcess process; sl@0: User::LeaveIfError(process.Create(aExecutableName, KNullDesC)); sl@0: CleanupClosePushL(process); sl@0: sl@0: // Specify the id passed to the second process sl@0: TPckg ptr(aTestInfo); sl@0: TInt err = process.SetParameter(KSecondProcessParametersSlot, ptr); sl@0: TESTEL(KErrNone == err, err); sl@0: sl@0: // Kick off the second process and wait for it to complete sl@0: // The actual testing is done in the second process sl@0: TRequestStatus status; sl@0: process.Logon(status); sl@0: process.Resume(); sl@0: User::WaitForRequest(status); sl@0: sl@0: //ExitReason() returns the test result sl@0: TInt exitreason = process.ExitReason(); sl@0: sl@0: TEST(process.ExitType() == EExitKill); sl@0: sl@0: CleanupStack::PopAndDestroy(); sl@0: sl@0: return exitreason; sl@0: } sl@0: sl@0: /** sl@0: Creates a second process, runs the requested test and ensures that sl@0: the specified panic occurs. sl@0: sl@0: @param aExecutableName The name of the new process sl@0: @param aTestInfo The specification for this test sl@0: @param aPanicCategory Descriptor containing the start of the expected panic string e.g. for "ALLOC:xxxxxxxx" this would be "ALLOC" sl@0: @leave One of the system wide error codes sl@0: */ sl@0: void CTGraphicsResourceInternalBase::CreateSecondProcessAndCheckAllocPanicL(const TDesC &aExecutableName, TSgResIntTestInfo& aTestInfo, const TDesC &aPanicCategory) sl@0: { sl@0: // Create a second process sl@0: RProcess process; sl@0: TInt err = process.Create(aExecutableName, KNullDesC); sl@0: TESTEL(KErrNone == err, err); sl@0: CleanupClosePushL(process); sl@0: sl@0: // Specify the id passed to the second process sl@0: TPckg ptr(aTestInfo); sl@0: err = process.SetParameter(KSecondProcessParametersSlot, ptr); sl@0: TESTEL(KErrNone == err, err); sl@0: sl@0: // Kick off the second process and wait for it to complete sl@0: // The actual testing is done in the second process sl@0: TRequestStatus status; sl@0: process.Logon(status); sl@0: process.Resume(); sl@0: User::WaitForRequest(status); sl@0: sl@0: if(EExitPanic != process.ExitType()) sl@0: { sl@0: ERR_PRINTF3(_L("Expected exit type: %d, Actual exit type: %d"), EExitPanic, process.ExitType()); sl@0: TEST(EFalse); sl@0: } sl@0: sl@0: TExitCategoryName secondProcessExitCategory = process.ExitCategory(); sl@0: if(0 != secondProcessExitCategory.Match(aPanicCategory)) sl@0: { sl@0: ERR_PRINTF3(_L("Expected panic category: %S, Actual panic category: %S"), &aPanicCategory, &secondProcessExitCategory); sl@0: TEST(EFalse); sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(); sl@0: } sl@0: