diff -r 000000000000 -r 5d03bc08d59c graphicsresourceservices/graphicsresource/test/tgraphicsresourcesecondprocess.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicsresourceservices/graphicsresource/test/tgraphicsresourcesecondprocess.cpp Tue Feb 02 01:47:50 2010 +0200 @@ -0,0 +1,435 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file + @test + @internalComponent - Internal Symbian test code +*/ + +#include "tgraphicsresourcemultiprocessthread.h" +#include +#include + +/** +Helper function to test the equivalence of two TSgImageInfo structures. + +@param aInfo1 A TSgImageInfo structure to compare. +@param aInfo2 A TSgImageInfo structure to compare. + +@return ETrue if the two are identical, EFalse otherwise. +*/ +TBool CompareInfos(TSgImageInfo& aInfo1, TSgImageInfo& aInfo2) + { + TBool result = EFalse; + if(aInfo1.iCpuAccess == aInfo2.iCpuAccess + && aInfo1.iPixelFormat == aInfo2.iPixelFormat + && aInfo1.iScreenId == aInfo2.iScreenId + && aInfo1.iShareable == aInfo2.iShareable + && aInfo1.iSizeInPixels == aInfo2.iSizeInPixels + && aInfo1.iUsage | aInfo2.iUsage + && aInfo1.iUserAttributeCount == aInfo2.iUserAttributeCount) + { + for(TInt i=0; i infoPkg; + User::LeaveIfError(User::GetDesParameter(KSecondProcessParametersSlot, infoPkg)); + TSgresTestInfo& info = infoPkg(); + TSgresTestCase testCase = info.iTestCase; + TInt result = 0; + + if(KErrNone == SgDriver::Open()) + { + switch(testCase) + { + case ESgresSecondProcessOpenImage: + result = TestOpenImageL(info); + break; + case ESgresSecondProcessOpenDrawable: + result = TestOpenDrawableL(info); + break; + case ESgresSecondProcessOpenImageInvalid: + result = TestOpenImageInvalidL(info); + break; + case ESgresSecondProcessOpenDrawableInvalid: + result = TestOpenDrawableInvalidL(info); + break; + case ESgresSecondProcessMapImage: + result = TestMapImageNonOwnerL(info); + break; + case ESgresSecondProcessUnmapImage: + result = TestUnmapImageL(info); + break; + case ESgresSecondProcessPanicDriverUnclosedResources: + result = TestShutdownMemoryLeakL(info); + break; + case ESgresSecondProcessPanicMemoryLeak: + result = TestDriverMemoryLeakL(info); + break; + } + } + + SgDriver::Close(); + + // Handle check + TInt procHandles2 =0; + TInt threadHandles2=0; + RThread().HandleCount(procHandles2,threadHandles2); + if (threadHandles1 != threadHandles2) + { + result = KErrBadHandle; // Thread-owned handles not closed + } + + return result; + } + +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanupStack = CTrapCleanup::New(); + if(cleanupStack == NULL) + { + return KErrNoMemory; + } + TInt ret = 0; + TRAP_IGNORE(ret=MainL()); + delete cleanupStack; + __UHEAP_MARKEND; + return ret; + }