graphicsresourceservices/graphicsresourceimplementation/test/src/tgraphicsresourceinternalsecondprocess.cpp
changeset 36 01a6848ebfd7
child 103 2717213c588a
equal deleted inserted replaced
0:5d03bc08d59c 36:01a6848ebfd7
       
     1 // Copyright (c) 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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent
       
    20 */
       
    21 
       
    22 #include "tgraphicsresourceinternalsecondprocessenums.h"
       
    23 #include "tsgimagegeneric.h"
       
    24 #include "tsgdrawablegeneric.h"
       
    25 #include "tgraphicsresourceinternalsecondprocesstesthandler.h"
       
    26 
       
    27 TInt MainL()
       
    28 	{
       
    29 	TInt procHandles1 = 0;
       
    30 	TInt threadHandles1 = 0;
       
    31 	RThread().HandleCount(procHandles1, threadHandles1);
       
    32 	
       
    33 	TPckgBuf<TSgResIntTestInfo> infoPkg;
       
    34 	User::LeaveIfError(User::GetDesParameter(KSecondProcessParametersSlot, infoPkg));
       
    35 	TSgResIntTestInfo& info = infoPkg();
       
    36 	TSgResInternalTestCase testCase = info.iTestCase;
       
    37 	TInt result = 0;
       
    38 	
       
    39 	CTSgResInternalSecondProcessTestHandler* handler = CTSgResInternalSecondProcessTestHandler::NewLC();
       
    40 	handler->OpenDriverL();
       
    41 
       
    42 	result = handler->RunTestCaseL(testCase, info);
       
    43 	CleanupStack::PopAndDestroy(handler);
       
    44 
       
    45 	// Handle check
       
    46 	if (!(result < KErrNone))
       
    47 		{
       
    48 		TInt procHandles2  =0;
       
    49 		TInt threadHandles2=0;
       
    50 		RThread().HandleCount(procHandles2,threadHandles2);
       
    51 		if (threadHandles1 != threadHandles2)
       
    52 			{
       
    53 			result = KErrBadHandle;  // Thread-owned handles not closed
       
    54 			}
       
    55 		}
       
    56 
       
    57 	return result;
       
    58 	}
       
    59 
       
    60 GLDEF_C TInt E32Main()
       
    61 	{
       
    62 	__UHEAP_MARK;
       
    63 	CTrapCleanup* cleanupStack = CTrapCleanup::New();
       
    64 	if(cleanupStack == NULL)
       
    65 		{
       
    66 			return KErrNoMemory;
       
    67 		}
       
    68 	TInt result = 0;
       
    69 	TRAPD(ret, result=MainL());
       
    70 	
       
    71 	if (ret != KErrNone)
       
    72 		User::Panic(_L("SGRESTEST"), 0);
       
    73 	
       
    74 	delete cleanupStack;
       
    75 	__UHEAP_MARKEND;
       
    76 	return result;
       
    77 	}