sl@0
|
1 |
// Copyright (c) 2009 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 "tgraphicsresourceinternalteststepbase.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
CTGraphicsResourceInternalBase::CTGraphicsResourceInternalBase()
|
sl@0
|
25 |
{
|
sl@0
|
26 |
}
|
sl@0
|
27 |
|
sl@0
|
28 |
CTGraphicsResourceInternalBase::~CTGraphicsResourceInternalBase()
|
sl@0
|
29 |
{
|
sl@0
|
30 |
}
|
sl@0
|
31 |
|
sl@0
|
32 |
/**
|
sl@0
|
33 |
Creates a second process and do some tests in it.
|
sl@0
|
34 |
@param aExecutableName The name of the new process
|
sl@0
|
35 |
@param aTestInfo The information for the tests
|
sl@0
|
36 |
@leave Gets system wide error code
|
sl@0
|
37 |
*/
|
sl@0
|
38 |
TInt CTGraphicsResourceInternalBase::CreateSecondProcessAndDoTestL(const TDesC &aExecutableName, TSgResIntTestInfo& aTestInfo)
|
sl@0
|
39 |
{
|
sl@0
|
40 |
// Create a second process
|
sl@0
|
41 |
RProcess process;
|
sl@0
|
42 |
User::LeaveIfError(process.Create(aExecutableName, KNullDesC));
|
sl@0
|
43 |
CleanupClosePushL(process);
|
sl@0
|
44 |
|
sl@0
|
45 |
// Specify the id passed to the second process
|
sl@0
|
46 |
TPckg<TSgResIntTestInfo> ptr(aTestInfo);
|
sl@0
|
47 |
TInt err = process.SetParameter(KSecondProcessParametersSlot, ptr);
|
sl@0
|
48 |
TESTEL(KErrNone == err, err);
|
sl@0
|
49 |
|
sl@0
|
50 |
// Kick off the second process and wait for it to complete
|
sl@0
|
51 |
// The actual testing is done in the second process
|
sl@0
|
52 |
TRequestStatus status;
|
sl@0
|
53 |
process.Logon(status);
|
sl@0
|
54 |
process.Resume();
|
sl@0
|
55 |
User::WaitForRequest(status);
|
sl@0
|
56 |
|
sl@0
|
57 |
//ExitReason() returns the test result
|
sl@0
|
58 |
TInt exitreason = process.ExitReason();
|
sl@0
|
59 |
|
sl@0
|
60 |
TEST(process.ExitType() == EExitKill);
|
sl@0
|
61 |
|
sl@0
|
62 |
CleanupStack::PopAndDestroy();
|
sl@0
|
63 |
|
sl@0
|
64 |
return exitreason;
|
sl@0
|
65 |
}
|
sl@0
|
66 |
|
sl@0
|
67 |
/**
|
sl@0
|
68 |
Creates a second process, runs the requested test and ensures that
|
sl@0
|
69 |
the specified panic occurs.
|
sl@0
|
70 |
|
sl@0
|
71 |
@param aExecutableName The name of the new process
|
sl@0
|
72 |
@param aTestInfo The specification for this test
|
sl@0
|
73 |
@param aPanicCategory Descriptor containing the start of the expected panic string e.g. for "ALLOC:xxxxxxxx" this would be "ALLOC"
|
sl@0
|
74 |
@leave One of the system wide error codes
|
sl@0
|
75 |
*/
|
sl@0
|
76 |
void CTGraphicsResourceInternalBase::CreateSecondProcessAndCheckAllocPanicL(const TDesC &aExecutableName, TSgResIntTestInfo& aTestInfo, const TDesC &aPanicCategory)
|
sl@0
|
77 |
{
|
sl@0
|
78 |
// Create a second process
|
sl@0
|
79 |
RProcess process;
|
sl@0
|
80 |
TInt err = process.Create(aExecutableName, KNullDesC);
|
sl@0
|
81 |
TESTEL(KErrNone == err, err);
|
sl@0
|
82 |
CleanupClosePushL(process);
|
sl@0
|
83 |
|
sl@0
|
84 |
// Specify the id passed to the second process
|
sl@0
|
85 |
TPckg<TSgResIntTestInfo> ptr(aTestInfo);
|
sl@0
|
86 |
err = process.SetParameter(KSecondProcessParametersSlot, ptr);
|
sl@0
|
87 |
TESTEL(KErrNone == err, err);
|
sl@0
|
88 |
|
sl@0
|
89 |
// Kick off the second process and wait for it to complete
|
sl@0
|
90 |
// The actual testing is done in the second process
|
sl@0
|
91 |
TRequestStatus status;
|
sl@0
|
92 |
process.Logon(status);
|
sl@0
|
93 |
process.Resume();
|
sl@0
|
94 |
User::WaitForRequest(status);
|
sl@0
|
95 |
|
sl@0
|
96 |
if(EExitPanic != process.ExitType())
|
sl@0
|
97 |
{
|
sl@0
|
98 |
ERR_PRINTF3(_L("Expected exit type: %d, Actual exit type: %d"), EExitPanic, process.ExitType());
|
sl@0
|
99 |
TEST(EFalse);
|
sl@0
|
100 |
}
|
sl@0
|
101 |
|
sl@0
|
102 |
TExitCategoryName secondProcessExitCategory = process.ExitCategory();
|
sl@0
|
103 |
if(0 != secondProcessExitCategory.Match(aPanicCategory))
|
sl@0
|
104 |
{
|
sl@0
|
105 |
ERR_PRINTF3(_L("Expected panic category: %S, Actual panic category: %S"), &aPanicCategory, &secondProcessExitCategory);
|
sl@0
|
106 |
TEST(EFalse);
|
sl@0
|
107 |
}
|
sl@0
|
108 |
|
sl@0
|
109 |
CleanupStack::PopAndDestroy();
|
sl@0
|
110 |
}
|
sl@0
|
111 |
|