|
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 |
|
14 /** |
|
15 @file |
|
16 @test |
|
17 @internalComponent - Internal Symbian test code |
|
18 */ |
|
19 |
|
20 |
|
21 #include "egltest_endpointapiexposure.h" |
|
22 |
|
23 |
|
24 CEglTest_RemoteTestStep_EndpointApiExposure::CEglTest_RemoteTestStep_EndpointApiExposure() : |
|
25 CRemoteTestStepBase(ETestUidEndpointApiExposure) |
|
26 { |
|
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); |
|
30 } |
|
31 |
|
32 |
|
33 CEglTest_RemoteTestStep_EndpointApiExposure::~CEglTest_RemoteTestStep_EndpointApiExposure() |
|
34 { |
|
35 //Temp Solution. See note above. |
|
36 eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY)); |
|
37 } |
|
38 |
|
39 |
|
40 TRemoteTestVerdict CEglTest_RemoteTestStep_EndpointApiExposure::DoRunRemoteTestCaseL(TInt aTestCase, const TRemoteTestParams& aParams) |
|
41 { |
|
42 switch(aTestCase) |
|
43 { |
|
44 case 0: return RemoteApiExposureTestCase(aParams); |
|
45 default: return ERtvAbort; |
|
46 } |
|
47 } |
|
48 |
|
49 |
|
50 TRemoteTestVerdict CEglTest_RemoteTestStep_EndpointApiExposure::RemoteApiExposureTestCase(const TRemoteTestParams& /*aParams*/) |
|
51 { |
|
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) |
|
56 { |
|
57 REMOTE_ERR_PRINTF1(_L("Incorrect result for extensionString")); |
|
58 REMOTE_INFO_PRINTF1(_L("Rest of test is being skipped due to failure.")); |
|
59 return ERtvFail; |
|
60 } |
|
61 else |
|
62 { |
|
63 REMOTE_INFO_PRINTF1(_L("Correct result for extensionString")); |
|
64 } |
|
65 |
|
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()); |
|
70 if(err != KErrNone) |
|
71 { |
|
72 REMOTE_INFO_PRINTF1(_L("Rest of test is being skipped due to failure.")); |
|
73 return ERtvFail; |
|
74 } |
|
75 eglReleaseThread(); // otherwise we leak handles |
|
76 return ERtvPass; |
|
77 } |
|
78 |
|
79 |
|
80 void CEglTest_RemoteTestStep_EndpointApiExposure::AttemptToGetProcAddressForAllEndpointFunctionsL() |
|
81 { |
|
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"); |
|
95 } |
|
96 |
|
97 |
|
98 void CEglTest_RemoteTestStep_EndpointApiExposure::ProcAddressL(const char *aProcName) |
|
99 { |
|
100 //Convert the 8bit string to a 16 bit descriptor for logging. |
|
101 //None of the function names are longer than 128 chars. |
|
102 TBuf<128> procName; |
|
103 procName.Copy(TPtrC8((TText8*)aProcName)); |
|
104 |
|
105 //Attempt to get the function pointer. We are expecting to succeed since we are inside wserv. |
|
106 if(eglGetProcAddress(aProcName) == NULL) |
|
107 { |
|
108 REMOTE_ERR_PRINTF2(_L("Incorrect result for funcPtr: %S"), &procName); |
|
109 User::Leave(KErrUnknown); |
|
110 } |
|
111 else |
|
112 { |
|
113 REMOTE_INFO_PRINTF2(_L("Correct result for funcPtr: %S"), &procName); |
|
114 } |
|
115 } |