os/graphics/graphicsresourceservices/graphicsresourceimplementation/test/src/tgraphicsresourceinternalsecondprocess.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsresourceservices/graphicsresourceimplementation/test/src/tgraphicsresourceinternalsecondprocess.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,76 @@
1.4 +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 + @internalComponent
1.23 +*/
1.24 +
1.25 +#include "tgraphicsresourceinternalsecondprocessenums.h"
1.26 +#include "tsgimagegeneric.h"
1.27 +#include "tsgdrawablegeneric.h"
1.28 +#include "tgraphicsresourceinternalsecondprocesstesthandler.h"
1.29 +
1.30 +TInt MainL()
1.31 + {
1.32 + TInt procHandles1 = 0;
1.33 + TInt threadHandles1 = 0;
1.34 + RThread().HandleCount(procHandles1, threadHandles1);
1.35 +
1.36 + TPckgBuf<TSgResIntTestInfo> infoPkg;
1.37 + User::LeaveIfError(User::GetDesParameter(KSecondProcessParametersSlot, infoPkg));
1.38 + TSgResIntTestInfo& info = infoPkg();
1.39 + TInt result = 0;
1.40 +
1.41 + CTSgResInternalSecondProcessTestHandler* handler = CTSgResInternalSecondProcessTestHandler::NewLC();
1.42 + handler->OpenDriverL();
1.43 +
1.44 + result = handler->RunTestCaseL(info);
1.45 + CleanupStack::PopAndDestroy(handler);
1.46 +
1.47 + // Handle check
1.48 + if (!(result < KErrNone))
1.49 + {
1.50 + TInt procHandles2 =0;
1.51 + TInt threadHandles2=0;
1.52 + RThread().HandleCount(procHandles2,threadHandles2);
1.53 + if (threadHandles1 != threadHandles2)
1.54 + {
1.55 + result = KErrBadHandle; // Thread-owned handles not closed
1.56 + }
1.57 + }
1.58 +
1.59 + return result;
1.60 + }
1.61 +
1.62 +GLDEF_C TInt E32Main()
1.63 + {
1.64 + __UHEAP_MARK;
1.65 + CTrapCleanup* cleanupStack = CTrapCleanup::New();
1.66 + if(cleanupStack == NULL)
1.67 + {
1.68 + return KErrNoMemory;
1.69 + }
1.70 + TInt result = 0;
1.71 + TRAPD(ret, result=MainL());
1.72 +
1.73 + if (ret != KErrNone)
1.74 + User::Panic(_L("SGRESTEST"), 0);
1.75 +
1.76 + delete cleanupStack;
1.77 + __UHEAP_MARKEND;
1.78 + return result;
1.79 + }