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 |
|
sl@0
|
14 |
/**
|
sl@0
|
15 |
@file
|
sl@0
|
16 |
@test
|
sl@0
|
17 |
@internalComponent - Internal Symbian test code
|
sl@0
|
18 |
*/
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
#include "egltest_endpointapiexposure.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
|
sl@0
|
24 |
CEglTest_RemoteTestStep_EndpointApiExposure::CEglTest_RemoteTestStep_EndpointApiExposure() :
|
sl@0
|
25 |
CRemoteTestStepBase(ETestUidEndpointApiExposure)
|
sl@0
|
26 |
{
|
sl@0
|
27 |
//Temp solution. We probably want a remote side Egl helper class.
|
sl@0
|
28 |
//If this fails, the test will fail in a round about way with EGL_NOT_INITIALIZED.
|
sl@0
|
29 |
eglInitialize(eglGetDisplay(EGL_DEFAULT_DISPLAY), NULL, NULL);
|
sl@0
|
30 |
}
|
sl@0
|
31 |
|
sl@0
|
32 |
|
sl@0
|
33 |
CEglTest_RemoteTestStep_EndpointApiExposure::~CEglTest_RemoteTestStep_EndpointApiExposure()
|
sl@0
|
34 |
{
|
sl@0
|
35 |
//Temp Solution. See note above.
|
sl@0
|
36 |
eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY));
|
sl@0
|
37 |
}
|
sl@0
|
38 |
|
sl@0
|
39 |
|
sl@0
|
40 |
TRemoteTestVerdict CEglTest_RemoteTestStep_EndpointApiExposure::DoRunRemoteTestCaseL(TInt aTestCase, const TRemoteTestParams& aParams)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
switch(aTestCase)
|
sl@0
|
43 |
{
|
sl@0
|
44 |
case 0: return RemoteApiExposureTestCase(aParams);
|
sl@0
|
45 |
default: return ERtvAbort;
|
sl@0
|
46 |
}
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
|
sl@0
|
50 |
TRemoteTestVerdict CEglTest_RemoteTestStep_EndpointApiExposure::RemoteApiExposureTestCase(const TRemoteTestParams& /*aParams*/)
|
sl@0
|
51 |
{
|
sl@0
|
52 |
//Check that the extension exists in the egl implementation.
|
sl@0
|
53 |
TPtrC8 extensionString((TUint8*)eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS));
|
sl@0
|
54 |
_LIT8(KExtensionName, "EGL_NOK_image_endpoint");
|
sl@0
|
55 |
if(extensionString.Find(KExtensionName) == KErrNotFound)
|
sl@0
|
56 |
{
|
sl@0
|
57 |
REMOTE_ERR_PRINTF1(_L("Incorrect result for extensionString"));
|
sl@0
|
58 |
REMOTE_INFO_PRINTF1(_L("Rest of test is being skipped due to failure."));
|
sl@0
|
59 |
return ERtvFail;
|
sl@0
|
60 |
}
|
sl@0
|
61 |
else
|
sl@0
|
62 |
{
|
sl@0
|
63 |
REMOTE_INFO_PRINTF1(_L("Correct result for extensionString"));
|
sl@0
|
64 |
}
|
sl@0
|
65 |
|
sl@0
|
66 |
//If this function leaves, a function pointer was not returned from EGL.
|
sl@0
|
67 |
//Since we are inside wserv, we expect EGL to always advertise the existance
|
sl@0
|
68 |
//of the Endpoint API.
|
sl@0
|
69 |
TRAPD(err, AttemptToGetProcAddressForAllEndpointFunctionsL());
|
sl@0
|
70 |
if(err != KErrNone)
|
sl@0
|
71 |
{
|
sl@0
|
72 |
REMOTE_INFO_PRINTF1(_L("Rest of test is being skipped due to failure."));
|
sl@0
|
73 |
return ERtvFail;
|
sl@0
|
74 |
}
|
sl@0
|
75 |
eglReleaseThread(); // otherwise we leak handles
|
sl@0
|
76 |
return ERtvPass;
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|
sl@0
|
79 |
|
sl@0
|
80 |
void CEglTest_RemoteTestStep_EndpointApiExposure::AttemptToGetProcAddressForAllEndpointFunctionsL()
|
sl@0
|
81 |
{
|
sl@0
|
82 |
//Attempt to get the proc address for each endpoint function. The expected outcome is
|
sl@0
|
83 |
//for them all to succeed. If any fail, ProcAddressL() will leave.
|
sl@0
|
84 |
ProcAddressL("eglCreateEndpointNOK");
|
sl@0
|
85 |
ProcAddressL("eglDestroyEndpointNOK");
|
sl@0
|
86 |
ProcAddressL("eglGetEndpointAttribNOK");
|
sl@0
|
87 |
ProcAddressL("eglSetEndpointAttribNOK");
|
sl@0
|
88 |
ProcAddressL("eglEndpointBeginStreamingNOK");
|
sl@0
|
89 |
ProcAddressL("eglEndpointEndStreamingNOK");
|
sl@0
|
90 |
ProcAddressL("eglAcquireImageNOK");
|
sl@0
|
91 |
ProcAddressL("eglReleaseImageNOK");
|
sl@0
|
92 |
ProcAddressL("eglGetEndpointDirtyAreaNOK");
|
sl@0
|
93 |
ProcAddressL("eglEndpointRequestNotificationNOK");
|
sl@0
|
94 |
ProcAddressL("eglEndpointCancelNotificationNOK");
|
sl@0
|
95 |
}
|
sl@0
|
96 |
|
sl@0
|
97 |
|
sl@0
|
98 |
void CEglTest_RemoteTestStep_EndpointApiExposure::ProcAddressL(const char *aProcName)
|
sl@0
|
99 |
{
|
sl@0
|
100 |
//Convert the 8bit string to a 16 bit descriptor for logging.
|
sl@0
|
101 |
//None of the function names are longer than 128 chars.
|
sl@0
|
102 |
TBuf<128> procName;
|
sl@0
|
103 |
procName.Copy(TPtrC8((TText8*)aProcName));
|
sl@0
|
104 |
|
sl@0
|
105 |
//Attempt to get the function pointer. We are expecting to succeed since we are inside wserv.
|
sl@0
|
106 |
if(eglGetProcAddress(aProcName) == NULL)
|
sl@0
|
107 |
{
|
sl@0
|
108 |
REMOTE_ERR_PRINTF2(_L("Incorrect result for funcPtr: %S"), &procName);
|
sl@0
|
109 |
User::Leave(KErrUnknown);
|
sl@0
|
110 |
}
|
sl@0
|
111 |
else
|
sl@0
|
112 |
{
|
sl@0
|
113 |
REMOTE_INFO_PRINTF2(_L("Correct result for funcPtr: %S"), &procName);
|
sl@0
|
114 |
}
|
sl@0
|
115 |
}
|