os/graphics/graphicsresourceservices/graphicsresourceimplementation/test/src/tgraphicsresourceinternalsecondprocess.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @test
sl@0
    19
 @internalComponent
sl@0
    20
*/
sl@0
    21
sl@0
    22
#include "tgraphicsresourceinternalsecondprocessenums.h"
sl@0
    23
#include "tsgimagegeneric.h"
sl@0
    24
#include "tsgdrawablegeneric.h"
sl@0
    25
#include "tgraphicsresourceinternalsecondprocesstesthandler.h"
sl@0
    26
sl@0
    27
TInt MainL()
sl@0
    28
	{
sl@0
    29
	TInt procHandles1 = 0;
sl@0
    30
	TInt threadHandles1 = 0;
sl@0
    31
	RThread().HandleCount(procHandles1, threadHandles1);
sl@0
    32
	
sl@0
    33
	TPckgBuf<TSgResIntTestInfo> infoPkg;
sl@0
    34
	User::LeaveIfError(User::GetDesParameter(KSecondProcessParametersSlot, infoPkg));
sl@0
    35
	TSgResIntTestInfo& info = infoPkg();
sl@0
    36
	TInt result = 0;
sl@0
    37
	
sl@0
    38
	CTSgResInternalSecondProcessTestHandler* handler = CTSgResInternalSecondProcessTestHandler::NewLC();
sl@0
    39
	handler->OpenDriverL();
sl@0
    40
sl@0
    41
	result = handler->RunTestCaseL(info);
sl@0
    42
	CleanupStack::PopAndDestroy(handler);
sl@0
    43
sl@0
    44
	// Handle check
sl@0
    45
	if (!(result < KErrNone))
sl@0
    46
		{
sl@0
    47
		TInt procHandles2  =0;
sl@0
    48
		TInt threadHandles2=0;
sl@0
    49
		RThread().HandleCount(procHandles2,threadHandles2);
sl@0
    50
		if (threadHandles1 != threadHandles2)
sl@0
    51
			{
sl@0
    52
			result = KErrBadHandle;  // Thread-owned handles not closed
sl@0
    53
			}
sl@0
    54
		}
sl@0
    55
sl@0
    56
	return result;
sl@0
    57
	}
sl@0
    58
sl@0
    59
GLDEF_C TInt E32Main()
sl@0
    60
	{
sl@0
    61
	__UHEAP_MARK;
sl@0
    62
	CTrapCleanup* cleanupStack = CTrapCleanup::New();
sl@0
    63
	if(cleanupStack == NULL)
sl@0
    64
		{
sl@0
    65
			return KErrNoMemory;
sl@0
    66
		}
sl@0
    67
	TInt result = 0;
sl@0
    68
	TRAPD(ret, result=MainL());
sl@0
    69
	
sl@0
    70
	if (ret != KErrNone)
sl@0
    71
		User::Panic(_L("SGRESTEST"), 0);
sl@0
    72
	
sl@0
    73
	delete cleanupStack;
sl@0
    74
	__UHEAP_MARKEND;
sl@0
    75
	return result;
sl@0
    76
	}