os/graphics/egl/egltest/endpointtestsuite/automated/tsrc/egltest_endpointapiexposure_local.cpp
Update contrib.
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_LocalTestStep_EndpointApiExposure::CEglTest_LocalTestStep_EndpointApiExposure() :
25 CLocalTestStepBase(ETestUidEndpointApiExposure)
27 //Temp solution. We probably want a local 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_LocalTestStep_EndpointApiExposure::~CEglTest_LocalTestStep_EndpointApiExposure()
35 //Temp Solution. See note above.
36 eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY));
40 void CEglTest_LocalTestStep_EndpointApiExposure::DoPreambleL()
42 //Register the test id.
44 RegisterTestIdsL(KTestId);
45 SetCurrentTestIds(KTestId);
49 TVerdict CEglTest_LocalTestStep_EndpointApiExposure::doTestStepL()
51 //First, test the local side.
53 //temp solution. We probably want an Egl helper class for the local side too.
54 eglInitialize(eglGetDisplay(EGL_DEFAULT_DISPLAY), NULL, NULL);
56 //Check that the extension does not exist in the egl implementation.
57 TPtrC8 extensionString((TUint8*)eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS));
58 _LIT8(KExtensionName, "EGL_NOK_image_endpoint");
59 if(extensionString.Find(KExtensionName) != KErrNotFound)
61 ERR_PRINTF1(_L("Incorrect result for extensionString"));
62 INFO_PRINTF1(_L("Rest of test is being skipped due to failure."));
63 eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY));
64 SetTestStepResult(EFail);
65 return TestStepResult();
69 INFO_PRINTF1(_L("Correct result for extensionString"));
72 //If this function leaves, a function pointer was returned from EGL.
73 //Since we are outside wserv, we expect EGL never to advertise the existance
74 //of the Endpoint API.
75 TRAPD(err, AttemptToGetProcAddressForAllEndpointFunctionsL());
78 INFO_PRINTF1(_L("Rest of test is being skipped due to failure."));
79 eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY));
80 SetTestStepResult(EFail);
81 return TestStepResult();
84 eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY));
87 //Now test remote side.
89 //Params for the remote test step.
90 TRemoteTestParams params;
92 //Run the test step and return the result.
93 StartRemoteTestStep(TRemoteTestParams());
94 RunRemoteTestCase(0, params);
95 EndRemoteTestStep(TRemoteTestParams());
97 return TestStepResult();
101 void CEglTest_LocalTestStep_EndpointApiExposure::AttemptToGetProcAddressForAllEndpointFunctionsL()
103 //Attempt to get the proc address for each endpoint function. The expected outcome is
104 //for them all to fail. If any succeed, ProcAddressL() will leave.
105 ProcAddressL("eglCreateEndpointNOK");
106 ProcAddressL("eglDestroyEndpointNOK");
107 ProcAddressL("eglGetEndpointAttribNOK");
108 ProcAddressL("eglSetEndpointAttribNOK");
109 ProcAddressL("eglEndpointBeginStreamingNOK");
110 ProcAddressL("eglEndpointEndStreamingNOK");
111 ProcAddressL("eglAcquireImageNOK");
112 ProcAddressL("eglReleaseImageNOK");
113 ProcAddressL("eglGetEndpointDirtyAreaNOK");
114 ProcAddressL("eglEndpointRequestNotificationNOK");
115 ProcAddressL("eglEndpointCancelNotificationNOK");
119 void CEglTest_LocalTestStep_EndpointApiExposure::ProcAddressL(const char *aProcName)
121 //Convert the 8bit string to a 16 bit descriptor for logging.
122 //None of the function names are longer than 128 chars.
124 procName.Copy(TPtrC8((TText8*)aProcName));
126 //Attempt to get the function pointer. We are expecting to fail since we are outside wserv.
127 if(eglGetProcAddress(aProcName) != NULL)
129 ERR_PRINTF2(_L("Incorrect result for funcPtr: %S"), &procName);
130 User::Leave(KErrUnknown);
134 INFO_PRINTF2(_L("Correct result for funcPtr: %S"), &procName);