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_LocalTestStep_EndpointApiExposure::CEglTest_LocalTestStep_EndpointApiExposure() :
|
sl@0
|
25 |
CLocalTestStepBase(ETestUidEndpointApiExposure)
|
sl@0
|
26 |
{
|
sl@0
|
27 |
//Temp solution. We probably want a local 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_LocalTestStep_EndpointApiExposure::~CEglTest_LocalTestStep_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 |
void CEglTest_LocalTestStep_EndpointApiExposure::DoPreambleL()
|
sl@0
|
41 |
{
|
sl@0
|
42 |
//Register the test id.
|
sl@0
|
43 |
_LIT(KTestId, "563");
|
sl@0
|
44 |
RegisterTestIdsL(KTestId);
|
sl@0
|
45 |
SetCurrentTestIds(KTestId);
|
sl@0
|
46 |
}
|
sl@0
|
47 |
|
sl@0
|
48 |
|
sl@0
|
49 |
TVerdict CEglTest_LocalTestStep_EndpointApiExposure::doTestStepL()
|
sl@0
|
50 |
{
|
sl@0
|
51 |
//First, test the local side.
|
sl@0
|
52 |
|
sl@0
|
53 |
//temp solution. We probably want an Egl helper class for the local side too.
|
sl@0
|
54 |
eglInitialize(eglGetDisplay(EGL_DEFAULT_DISPLAY), NULL, NULL);
|
sl@0
|
55 |
|
sl@0
|
56 |
//Check that the extension does not exist in the egl implementation.
|
sl@0
|
57 |
TPtrC8 extensionString((TUint8*)eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS));
|
sl@0
|
58 |
_LIT8(KExtensionName, "EGL_NOK_image_endpoint");
|
sl@0
|
59 |
if(extensionString.Find(KExtensionName) != KErrNotFound)
|
sl@0
|
60 |
{
|
sl@0
|
61 |
ERR_PRINTF1(_L("Incorrect result for extensionString"));
|
sl@0
|
62 |
INFO_PRINTF1(_L("Rest of test is being skipped due to failure."));
|
sl@0
|
63 |
eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY));
|
sl@0
|
64 |
SetTestStepResult(EFail);
|
sl@0
|
65 |
return TestStepResult();
|
sl@0
|
66 |
}
|
sl@0
|
67 |
else
|
sl@0
|
68 |
{
|
sl@0
|
69 |
INFO_PRINTF1(_L("Correct result for extensionString"));
|
sl@0
|
70 |
}
|
sl@0
|
71 |
|
sl@0
|
72 |
//If this function leaves, a function pointer was returned from EGL.
|
sl@0
|
73 |
//Since we are outside wserv, we expect EGL never to advertise the existance
|
sl@0
|
74 |
//of the Endpoint API.
|
sl@0
|
75 |
TRAPD(err, AttemptToGetProcAddressForAllEndpointFunctionsL());
|
sl@0
|
76 |
if(err != KErrNone)
|
sl@0
|
77 |
{
|
sl@0
|
78 |
INFO_PRINTF1(_L("Rest of test is being skipped due to failure."));
|
sl@0
|
79 |
eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY));
|
sl@0
|
80 |
SetTestStepResult(EFail);
|
sl@0
|
81 |
return TestStepResult();
|
sl@0
|
82 |
}
|
sl@0
|
83 |
|
sl@0
|
84 |
eglTerminate(eglGetDisplay(EGL_DEFAULT_DISPLAY));
|
sl@0
|
85 |
|
sl@0
|
86 |
|
sl@0
|
87 |
//Now test remote side.
|
sl@0
|
88 |
|
sl@0
|
89 |
//Params for the remote test step.
|
sl@0
|
90 |
TRemoteTestParams params;
|
sl@0
|
91 |
|
sl@0
|
92 |
//Run the test step and return the result.
|
sl@0
|
93 |
StartRemoteTestStep(TRemoteTestParams());
|
sl@0
|
94 |
RunRemoteTestCase(0, params);
|
sl@0
|
95 |
EndRemoteTestStep(TRemoteTestParams());
|
sl@0
|
96 |
|
sl@0
|
97 |
return TestStepResult();
|
sl@0
|
98 |
}
|
sl@0
|
99 |
|
sl@0
|
100 |
|
sl@0
|
101 |
void CEglTest_LocalTestStep_EndpointApiExposure::AttemptToGetProcAddressForAllEndpointFunctionsL()
|
sl@0
|
102 |
{
|
sl@0
|
103 |
//Attempt to get the proc address for each endpoint function. The expected outcome is
|
sl@0
|
104 |
//for them all to fail. If any succeed, ProcAddressL() will leave.
|
sl@0
|
105 |
ProcAddressL("eglCreateEndpointNOK");
|
sl@0
|
106 |
ProcAddressL("eglDestroyEndpointNOK");
|
sl@0
|
107 |
ProcAddressL("eglGetEndpointAttribNOK");
|
sl@0
|
108 |
ProcAddressL("eglSetEndpointAttribNOK");
|
sl@0
|
109 |
ProcAddressL("eglEndpointBeginStreamingNOK");
|
sl@0
|
110 |
ProcAddressL("eglEndpointEndStreamingNOK");
|
sl@0
|
111 |
ProcAddressL("eglAcquireImageNOK");
|
sl@0
|
112 |
ProcAddressL("eglReleaseImageNOK");
|
sl@0
|
113 |
ProcAddressL("eglGetEndpointDirtyAreaNOK");
|
sl@0
|
114 |
ProcAddressL("eglEndpointRequestNotificationNOK");
|
sl@0
|
115 |
ProcAddressL("eglEndpointCancelNotificationNOK");
|
sl@0
|
116 |
}
|
sl@0
|
117 |
|
sl@0
|
118 |
|
sl@0
|
119 |
void CEglTest_LocalTestStep_EndpointApiExposure::ProcAddressL(const char *aProcName)
|
sl@0
|
120 |
{
|
sl@0
|
121 |
//Convert the 8bit string to a 16 bit descriptor for logging.
|
sl@0
|
122 |
//None of the function names are longer than 128 chars.
|
sl@0
|
123 |
TBuf<128> procName;
|
sl@0
|
124 |
procName.Copy(TPtrC8((TText8*)aProcName));
|
sl@0
|
125 |
|
sl@0
|
126 |
//Attempt to get the function pointer. We are expecting to fail since we are outside wserv.
|
sl@0
|
127 |
if(eglGetProcAddress(aProcName) != NULL)
|
sl@0
|
128 |
{
|
sl@0
|
129 |
ERR_PRINTF2(_L("Incorrect result for funcPtr: %S"), &procName);
|
sl@0
|
130 |
User::Leave(KErrUnknown);
|
sl@0
|
131 |
}
|
sl@0
|
132 |
else
|
sl@0
|
133 |
{
|
sl@0
|
134 |
INFO_PRINTF2(_L("Correct result for funcPtr: %S"), &procName);
|
sl@0
|
135 |
}
|
sl@0
|
136 |
}
|
sl@0
|
137 |
|