os/graphics/egl/egltest/endpointtestsuite/automated/tsrc/egltest_endpointapiexposure_remote.cpp
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
21 #include "egltest_endpointapiexposure.h"
24 CEglTest_RemoteTestStep_EndpointApiExposure::CEglTest_RemoteTestStep_EndpointApiExposure() :
25 CRemoteTestStepBase(ETestUidEndpointApiExposure)
27 //Temp solution. We probably want a remote side Egl helper class.
28 //If this fails, the test will fail in a round about way with EGL_NOT_INITIALIZED.
29 eglInitialize(eglGetDisplay(EGL_DEFAULT_DISPLAY), NULL, NULL);
33 CEglTest_RemoteTestStep_EndpointApiExposure::~CEglTest_RemoteTestStep_EndpointApiExposure()
35 //Temp Solution. See note above.
36 eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY));
40 TRemoteTestVerdict CEglTest_RemoteTestStep_EndpointApiExposure::DoRunRemoteTestCaseL(TInt aTestCase, const TRemoteTestParams& aParams)
44 case 0: return RemoteApiExposureTestCase(aParams);
45 default: return ERtvAbort;
50 TRemoteTestVerdict CEglTest_RemoteTestStep_EndpointApiExposure::RemoteApiExposureTestCase(const TRemoteTestParams& /*aParams*/)
52 //Check that the extension exists in the egl implementation.
53 TPtrC8 extensionString((TUint8*)eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS));
54 _LIT8(KExtensionName, "EGL_NOK_image_endpoint");
55 if(extensionString.Find(KExtensionName) == KErrNotFound)
57 REMOTE_ERR_PRINTF1(_L("Incorrect result for extensionString"));
58 REMOTE_INFO_PRINTF1(_L("Rest of test is being skipped due to failure."));
63 REMOTE_INFO_PRINTF1(_L("Correct result for extensionString"));
66 //If this function leaves, a function pointer was not returned from EGL.
67 //Since we are inside wserv, we expect EGL to always advertise the existance
68 //of the Endpoint API.
69 TRAPD(err, AttemptToGetProcAddressForAllEndpointFunctionsL());
72 REMOTE_INFO_PRINTF1(_L("Rest of test is being skipped due to failure."));
75 eglReleaseThread(); // otherwise we leak handles
80 void CEglTest_RemoteTestStep_EndpointApiExposure::AttemptToGetProcAddressForAllEndpointFunctionsL()
82 //Attempt to get the proc address for each endpoint function. The expected outcome is
83 //for them all to succeed. If any fail, ProcAddressL() will leave.
84 ProcAddressL("eglCreateEndpointNOK");
85 ProcAddressL("eglDestroyEndpointNOK");
86 ProcAddressL("eglGetEndpointAttribNOK");
87 ProcAddressL("eglSetEndpointAttribNOK");
88 ProcAddressL("eglEndpointBeginStreamingNOK");
89 ProcAddressL("eglEndpointEndStreamingNOK");
90 ProcAddressL("eglAcquireImageNOK");
91 ProcAddressL("eglReleaseImageNOK");
92 ProcAddressL("eglGetEndpointDirtyAreaNOK");
93 ProcAddressL("eglEndpointRequestNotificationNOK");
94 ProcAddressL("eglEndpointCancelNotificationNOK");
98 void CEglTest_RemoteTestStep_EndpointApiExposure::ProcAddressL(const char *aProcName)
100 //Convert the 8bit string to a 16 bit descriptor for logging.
101 //None of the function names are longer than 128 chars.
103 procName.Copy(TPtrC8((TText8*)aProcName));
105 //Attempt to get the function pointer. We are expecting to succeed since we are inside wserv.
106 if(eglGetProcAddress(aProcName) == NULL)
108 REMOTE_ERR_PRINTF2(_L("Incorrect result for funcPtr: %S"), &procName);
109 User::Leave(KErrUnknown);
113 REMOTE_INFO_PRINTF2(_L("Correct result for funcPtr: %S"), &procName);