sl@0: // Copyright (c) 2007-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 - Internal Symbian test code sl@0: */ sl@0: sl@0: #include "tgraphicsresourcemultiprocessthread.h" sl@0: #include sl@0: #include sl@0: sl@0: /** sl@0: Helper function to test the equivalence of two TSgImageInfo structures. sl@0: sl@0: @param aInfo1 A TSgImageInfo structure to compare. sl@0: @param aInfo2 A TSgImageInfo structure to compare. sl@0: sl@0: @return ETrue if the two are identical, EFalse otherwise. sl@0: */ sl@0: TBool CompareInfos(TSgImageInfo& aInfo1, TSgImageInfo& aInfo2) sl@0: { sl@0: TBool result = EFalse; sl@0: if(aInfo1.iCpuAccess == aInfo2.iCpuAccess sl@0: && aInfo1.iPixelFormat == aInfo2.iPixelFormat sl@0: && aInfo1.iScreenId == aInfo2.iScreenId sl@0: && aInfo1.iShareable == aInfo2.iShareable sl@0: && aInfo1.iSizeInPixels == aInfo2.iSizeInPixels sl@0: && aInfo1.iUsage | aInfo2.iUsage sl@0: && aInfo1.iUserAttributeCount == aInfo2.iUserAttributeCount) sl@0: { sl@0: for(TInt i=0; i infoPkg; sl@0: User::LeaveIfError(User::GetDesParameter(KSecondProcessParametersSlot, infoPkg)); sl@0: TSgresTestInfo& info = infoPkg(); sl@0: TSgresTestCase testCase = info.iTestCase; sl@0: TInt result = 0; sl@0: sl@0: if(KErrNone == SgDriver::Open()) sl@0: { sl@0: switch(testCase) sl@0: { sl@0: case ESgresSecondProcessOpenImage: sl@0: result = TestOpenImageL(info); sl@0: break; sl@0: case ESgresSecondProcessOpenDrawable: sl@0: result = TestOpenDrawableL(info); sl@0: break; sl@0: case ESgresSecondProcessOpenImageInvalid: sl@0: result = TestOpenImageInvalidL(info); sl@0: break; sl@0: case ESgresSecondProcessOpenDrawableInvalid: sl@0: result = TestOpenDrawableInvalidL(info); sl@0: break; sl@0: case ESgresSecondProcessMapImage: sl@0: result = TestMapImageNonOwnerL(info); sl@0: break; sl@0: case ESgresSecondProcessUnmapImage: sl@0: result = TestUnmapImageL(info); sl@0: break; sl@0: case ESgresSecondProcessPanicDriverUnclosedResources: sl@0: result = TestShutdownMemoryLeakL(info); sl@0: break; sl@0: case ESgresSecondProcessPanicMemoryLeak: sl@0: result = TestDriverMemoryLeakL(info); sl@0: break; sl@0: } sl@0: } sl@0: sl@0: SgDriver::Close(); sl@0: sl@0: // Handle check sl@0: TInt procHandles2 =0; sl@0: TInt threadHandles2=0; sl@0: RThread().HandleCount(procHandles2,threadHandles2); sl@0: if (threadHandles1 != threadHandles2) sl@0: { sl@0: result = KErrBadHandle; // Thread-owned handles not closed sl@0: } sl@0: sl@0: return result; sl@0: } sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: __UHEAP_MARK; sl@0: CTrapCleanup* cleanupStack = CTrapCleanup::New(); sl@0: if(cleanupStack == NULL) sl@0: { sl@0: return KErrNoMemory; sl@0: } sl@0: TInt ret = 0; sl@0: TRAP_IGNORE(ret=MainL()); sl@0: delete cleanupStack; sl@0: __UHEAP_MARKEND; sl@0: return ret; sl@0: }