os/graphics/graphicsresourceservices/graphicsresourceimplementation/test/src/tgraphicsresourceinternalteststepbase.cpp
Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #include "tgraphicsresourceinternalteststepbase.h"
24 CTGraphicsResourceInternalBase::CTGraphicsResourceInternalBase()
28 CTGraphicsResourceInternalBase::~CTGraphicsResourceInternalBase()
33 Creates a second process and do some tests in it.
34 @param aExecutableName The name of the new process
35 @param aTestInfo The information for the tests
36 @leave Gets system wide error code
38 TInt CTGraphicsResourceInternalBase::CreateSecondProcessAndDoTestL(const TDesC &aExecutableName, TSgResIntTestInfo& aTestInfo)
40 // Create a second process
42 User::LeaveIfError(process.Create(aExecutableName, KNullDesC));
43 CleanupClosePushL(process);
45 // Specify the id passed to the second process
46 TPckg<TSgResIntTestInfo> ptr(aTestInfo);
47 TInt err = process.SetParameter(KSecondProcessParametersSlot, ptr);
48 TESTEL(KErrNone == err, err);
50 // Kick off the second process and wait for it to complete
51 // The actual testing is done in the second process
52 TRequestStatus status;
53 process.Logon(status);
55 User::WaitForRequest(status);
57 //ExitReason() returns the test result
58 TInt exitreason = process.ExitReason();
60 TEST(process.ExitType() == EExitKill);
62 CleanupStack::PopAndDestroy();
68 Creates a second process, runs the requested test and ensures that
69 the specified panic occurs.
71 @param aExecutableName The name of the new process
72 @param aTestInfo The specification for this test
73 @param aPanicCategory Descriptor containing the start of the expected panic string e.g. for "ALLOC:xxxxxxxx" this would be "ALLOC"
74 @leave One of the system wide error codes
76 void CTGraphicsResourceInternalBase::CreateSecondProcessAndCheckAllocPanicL(const TDesC &aExecutableName, TSgResIntTestInfo& aTestInfo, const TDesC &aPanicCategory)
78 // Create a second process
80 TInt err = process.Create(aExecutableName, KNullDesC);
81 TESTEL(KErrNone == err, err);
82 CleanupClosePushL(process);
84 // Specify the id passed to the second process
85 TPckg<TSgResIntTestInfo> ptr(aTestInfo);
86 err = process.SetParameter(KSecondProcessParametersSlot, ptr);
87 TESTEL(KErrNone == err, err);
89 // Kick off the second process and wait for it to complete
90 // The actual testing is done in the second process
91 TRequestStatus status;
92 process.Logon(status);
94 User::WaitForRequest(status);
96 if(EExitPanic != process.ExitType())
98 ERR_PRINTF3(_L("Expected exit type: %d, Actual exit type: %d"), EExitPanic, process.ExitType());
102 TExitCategoryName secondProcessExitCategory = process.ExitCategory();
103 if(0 != secondProcessExitCategory.Match(aPanicCategory))
105 ERR_PRINTF3(_L("Expected panic category: %S, Actual panic category: %S"), &aPanicCategory, &secondProcessExitCategory);
109 CleanupStack::PopAndDestroy();