First public contribution.
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.
17 @internalComponent - Internal Symbian test code
22 * To add a new message that can be passed over the message queue:
23 * 1. Add the test name to the TTestUid enum.
24 * 2. Create a T class to hold the params.
25 * 3. Add the T class to the TRemoteTestParams union.
27 * These steps are described in more detail below, where the
28 * individual bits should be added.
32 #ifndef __EGLTEST_COMMSCOMMON_H__
33 #define __EGLTEST_COMMSCOMMON_H__
37 #include <graphics/surface.h>
40 #include "egltest_endpoint_engine_types.h"
42 #define ENDPOINT_ASSERT_DEBUG(x, y) do { if (!x) { RDebug::Printf("Assertion (%s) failed: %s:%d ", #x, __FILE__, __LINE__); y; } } while(0)
44 //The maximum size of a message in an async message queue is 256 bytes.
45 //If these valuses are increased, the maximum size will be exceeded.
46 const TInt KRSLogMessageLength = 172;
47 const TInt KRSLogFileLength = 32;
50 //Names for the Async message queues that are used for
51 //communication between the TEF driver app and the test
52 //thread within window server.
53 _LIT(KResultQueueName, "RemoteTestEnvResultQueue");
54 _LIT(KParamsQueueName, "RemoteTestEnvParamsQueue");
56 const TInt KStartTestStepCaseNumber = -1;
57 const TInt KEndTestStepCaseNumber = -2;
59 //Uids for all of the tests that the test thread knows about.
62 //Endpoint Api Exposure Test.
63 ETestUidEndpointApiExposure,
65 // Common UID for engine code.
66 ETestUidEndpointEngine,
68 // Endpoint Lifetime test.
69 ETestUidEndpointLifetime,
72 ETestUidEndpointTearing,
74 //Multithreaded stress tests.
75 ETestUidEndpointThreadStress,
77 //Release Image with Gles context tests.
78 ETestUidEndpointReleaseImageGles,
85 //Each test should have a struct with data members to hold
86 //the test's parameters. The name name should begin
87 //"TTest..." and should contain no member functions.
90 //If it is found that many tests use the same params, we should
91 //create a TTestGeneric class to hold the params and derive
94 struct TTestEndpointApiExposure
98 struct TTestEndpointTearing
100 TSurfaceId iSurfaceId;
103 struct TTestEndpointThreadStress
108 struct TTestEndpointReleaseImageGles
110 TBool iUseValidGlesContext;
114 //Union for all of the structs that tests use to pass
115 //params between the local side and the remote side.
116 union TRemoteTestParams
118 //Endpoint Api Exposure Test.
119 TTestEndpointApiExposure iTestEndpointApiExposure;
121 //Endpoint engine data.
122 TTestEndpointEngine iEndpointEngine;
124 // Endpoint Engine configuration data.
125 TTestEndpointEngineConfig iEndpointEngineConfig;
127 //Image Tearing Test.
128 TTestEndpointTearing iEndpointTearing;
130 //Multithreaded stress tests.
131 TTestEndpointThreadStress iEndpointThreadStress;
133 //Release Image with Gles context tests.
134 TTestEndpointReleaseImageGles iEndpointReleaseImageGles;
138 //Structure that is passed from local side to remote side
139 //in the async message queue. It contains the test Uid,
140 //test case and the params.
141 class TRemoteTestParamsPacket
144 TRemoteTestParamsPacket();
145 TRemoteTestParamsPacket(TTestUid aTestUid, TInt aTestCase, const TRemoteTestParams& aParams);
147 const TInt iTestCase;
148 const TRemoteTestParams iParams;
152 //The object passed back to the TEF driver app from the test
153 //thread. It can be used for sending the resuult of a test and
155 class TRemoteTestResult
160 //Constructor for sending logging info.
161 TRemoteTestResult(TTestUid aUid, TInt aTestCase, const TDesC8& aFile, TInt aLine, TInt aSeverity, const TDesC& aMessage);
163 //Constructor for sending result info.
164 TRemoteTestResult(TTestUid aUid, TInt aTestCase, TRemoteTestVerdict aVerdict);
167 //If EFalse this is a logging message, else a result message.
173 TRemoteTestVerdict iVerdict;
176 TBuf8<KRSLogFileLength> iFile;
179 TBuf8<KRSLogMessageLength> iMessage;
183 //Inline functions --------------------------------------------------------
185 inline TRemoteTestParamsPacket::TRemoteTestParamsPacket() :
188 iParams(TRemoteTestParams())
193 inline TRemoteTestParamsPacket::TRemoteTestParamsPacket(TTestUid aTestUid, TInt aTestCase, const TRemoteTestParams& aParams) :
195 iTestCase(aTestCase),
201 inline TRemoteTestResult::TRemoteTestResult()
206 inline TRemoteTestResult::TRemoteTestResult(TTestUid aUid, TInt aTestCase, const TDesC8& aFile, TInt aLine, TInt aSeverity, const TDesC& aMessage) :
208 iVerdict(ERtvInconclusive),
210 iTestCase(aTestCase),
214 //Copy the filename to the log object. If the string is too long,
215 //truncate the string and append an elipsis to the log.
216 //The "-1"s ensure that a free char is left for appending a NULL (in the TEF app).
217 TBool truncate = iFile.MaxLength()-1 < aFile.Length();
218 TInt numChars = truncate ? iFile.MaxLength()-3-1 : aFile.Length();
219 iFile = aFile.Left(numChars);
222 iFile.Append(_L("..."));
225 //Copy the message to the log object. If the string is too long,
226 //truncate the string and append an elipsis to the log.
227 //Note we convert message from unicode to ascii to conserve space in the message queue.
228 truncate = iMessage.MaxLength() < aMessage.Length();
229 numChars = truncate ? iMessage.MaxLength()-3 : aMessage.Length();
230 iMessage.Copy(aMessage.Left(numChars));
233 iMessage.Append(_L8("..."));
238 inline TRemoteTestResult::TRemoteTestResult(TTestUid aUid, TInt aTestCase, TRemoteTestVerdict aVerdict) :
241 iTestCase(aTestCase),
246 //------------------------------------------------------------------------------------