|
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 "tgraphicsresourceinternalteststepbase.h" |
|
23 |
|
24 CTGraphicsResourceInternalBase::CTGraphicsResourceInternalBase() |
|
25 { |
|
26 } |
|
27 |
|
28 CTGraphicsResourceInternalBase::~CTGraphicsResourceInternalBase() |
|
29 { |
|
30 } |
|
31 |
|
32 /** |
|
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 |
|
37 */ |
|
38 TInt CTGraphicsResourceInternalBase::CreateSecondProcessAndDoTestL(const TDesC &aExecutableName, TSgResIntTestInfo& aTestInfo) |
|
39 { |
|
40 // Create a second process |
|
41 RProcess process; |
|
42 User::LeaveIfError(process.Create(aExecutableName, KNullDesC)); |
|
43 CleanupClosePushL(process); |
|
44 |
|
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); |
|
49 |
|
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); |
|
54 process.Resume(); |
|
55 User::WaitForRequest(status); |
|
56 |
|
57 //ExitReason() returns the test result |
|
58 TInt exitreason = process.ExitReason(); |
|
59 |
|
60 TEST(process.ExitType() == EExitKill); |
|
61 |
|
62 CleanupStack::PopAndDestroy(); |
|
63 |
|
64 return exitreason; |
|
65 } |
|
66 |
|
67 /** |
|
68 Creates a second process, runs the requested test and ensures that |
|
69 the specified panic occurs. |
|
70 |
|
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 |
|
75 */ |
|
76 void CTGraphicsResourceInternalBase::CreateSecondProcessAndCheckAllocPanicL(const TDesC &aExecutableName, TSgResIntTestInfo& aTestInfo, const TDesC &aPanicCategory) |
|
77 { |
|
78 // Create a second process |
|
79 RProcess process; |
|
80 TInt err = process.Create(aExecutableName, KNullDesC); |
|
81 TESTEL(KErrNone == err, err); |
|
82 CleanupClosePushL(process); |
|
83 |
|
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); |
|
88 |
|
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); |
|
93 process.Resume(); |
|
94 User::WaitForRequest(status); |
|
95 |
|
96 if(EExitPanic != process.ExitType()) |
|
97 { |
|
98 ERR_PRINTF3(_L("Expected exit type: %d, Actual exit type: %d"), EExitPanic, process.ExitType()); |
|
99 TEST(EFalse); |
|
100 } |
|
101 |
|
102 TExitCategoryName secondProcessExitCategory = process.ExitCategory(); |
|
103 if(0 != secondProcessExitCategory.Match(aPanicCategory)) |
|
104 { |
|
105 ERR_PRINTF3(_L("Expected panic category: %S, Actual panic category: %S"), &aPanicCategory, &secondProcessExitCategory); |
|
106 TEST(EFalse); |
|
107 } |
|
108 |
|
109 CleanupStack::PopAndDestroy(); |
|
110 } |
|
111 |