summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2013-02-26 00:53:28 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2013-02-26 00:53:28 +0000
commit30055f1e96f5a04c6ff5fc7f7d5812fca38c2759 (patch)
treeb192fcc84589d9fcf2e9ed35994a7a68a64ec539
parentd6f549f92541d8ab947fe35e3b3c21133eed2a6f (diff)
parent993e14fe1085e78b5f5d8b759dd3c757b4327eb4 (diff)
Merge "Added a test that checks the error behavior of ConsumerBase::abandon" into jb-mr2-dev
-rw-r--r--libs/gui/tests/SurfaceTextureClient_test.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/libs/gui/tests/SurfaceTextureClient_test.cpp b/libs/gui/tests/SurfaceTextureClient_test.cpp
index 24b60f1afc..ce960367b0 100644
--- a/libs/gui/tests/SurfaceTextureClient_test.cpp
+++ b/libs/gui/tests/SurfaceTextureClient_test.cpp
@@ -61,6 +61,7 @@ protected:
&myConfig, 1, &numConfigs));
ASSERT_EQ(EGL_SUCCESS, eglGetError());
+ mEglConfig = myConfig;
EGLint pbufferAttribs[] = {
EGL_WIDTH, 16,
EGL_HEIGHT, 16,
@@ -95,7 +96,7 @@ protected:
virtual EGLint const* getConfigAttribs() {
static EGLint sDefaultConfigAttribs[] = {
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
+ EGL_SURFACE_TYPE, EGL_PBUFFER_BIT | EGL_WINDOW_BIT,
EGL_NONE
};
@@ -109,6 +110,7 @@ protected:
EGLDisplay mEglDisplay;
EGLSurface mEglSurface;
EGLContext mEglContext;
+ EGLConfig mEglConfig;
};
TEST_F(SurfaceTextureClientTest, GetISurfaceTextureIsNotNull) {
@@ -169,6 +171,34 @@ TEST_F(SurfaceTextureClientTest, EglCreateWindowSurfaceSucceeds) {
eglTerminate(dpy);
}
+TEST_F(SurfaceTextureClientTest, EglSwapBuffersAbandonErrorIsEglBadSurface) {
+
+ EGLSurface eglSurface = eglCreateWindowSurface(mEglDisplay, mEglConfig, mANW.get(), NULL);
+ EXPECT_NE(EGL_NO_SURFACE, eglSurface);
+ EXPECT_EQ(EGL_SUCCESS, eglGetError());
+
+ EGLBoolean success = eglMakeCurrent(mEglDisplay, eglSurface, eglSurface, mEglContext);
+ EXPECT_EQ(EGL_TRUE, success);
+
+ glClear(GL_COLOR_BUFFER_BIT);
+ success = eglSwapBuffers(mEglDisplay, eglSurface);
+ EXPECT_EQ(EGL_TRUE, success);
+
+ mST->abandon();
+
+ glClear(GL_COLOR_BUFFER_BIT);
+ success = eglSwapBuffers(mEglDisplay, eglSurface);
+ EXPECT_EQ(EGL_FALSE, success);
+ EXPECT_EQ(EGL_BAD_SURFACE, eglGetError());
+
+ success = eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext);
+ ASSERT_EQ(EGL_TRUE, success);
+
+ if (eglSurface != EGL_NO_SURFACE) {
+ eglDestroySurface(mEglDisplay, eglSurface);
+ }
+}
+
TEST_F(SurfaceTextureClientTest, BufferGeometryInvalidSizesFail) {
EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), -1, 0, 0));
EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 0, -1, 0));