summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Michael Lentine <mlentine@google.com> 2015-05-19 15:23:43 -0700
committer Michael Lentine <mlentine@google.com> 2015-05-22 13:14:57 -0700
commitd8ead0ccd4b700e43a78efe9b140d4a069dc343d (patch)
tree99c60e7799faf5bfad9635c2239ab3dae55f658f
parent217a04bab40ef5b99d5581878d903a6e6aa8b547 (diff)
Fix libgui tests.
Update IGraphicsBufferProducerTest to the new maximum enum value which is now NATIVE_WINDOW_BUFFER_AGE. Update SurfaceTextureGLToGL_test to use the correct counts for GraphicsBuffer refs. Buf: 18138368 Change-Id: Ie2f7e00b414d63100b16944e3ab36b1ffceecd57
-rw-r--r--libs/gui/tests/IGraphicBufferProducer_test.cpp2
-rw-r--r--libs/gui/tests/SurfaceTextureGLToGL_test.cpp19
2 files changed, 13 insertions, 8 deletions
diff --git a/libs/gui/tests/IGraphicBufferProducer_test.cpp b/libs/gui/tests/IGraphicBufferProducer_test.cpp
index ff58420167..4ef9a69844 100644
--- a/libs/gui/tests/IGraphicBufferProducer_test.cpp
+++ b/libs/gui/tests/IGraphicBufferProducer_test.cpp
@@ -299,7 +299,7 @@ TEST_F(IGraphicBufferProducerTest, Query_ReturnsError) {
ASSERT_NO_FATAL_FAILURE(ConnectProducer());
// One past the end of the last 'query' enum value. Update this if we add more enums.
- const int NATIVE_WINDOW_QUERY_LAST_OFF_BY_ONE = NATIVE_WINDOW_DEFAULT_DATASPACE + 1;
+ const int NATIVE_WINDOW_QUERY_LAST_OFF_BY_ONE = NATIVE_WINDOW_BUFFER_AGE + 1;
int value;
// What was out of range
diff --git a/libs/gui/tests/SurfaceTextureGLToGL_test.cpp b/libs/gui/tests/SurfaceTextureGLToGL_test.cpp
index f4c796131b..6edbfb87a6 100644
--- a/libs/gui/tests/SurfaceTextureGLToGL_test.cpp
+++ b/libs/gui/tests/SurfaceTextureGLToGL_test.cpp
@@ -188,10 +188,10 @@ TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceUnrefsBuffers) {
// This test should have the only reference to buffer 0.
EXPECT_EQ(1, buffers[0]->getStrongCount());
- // The GLConsumer should hold a single reference to buffer 1 in its
- // mCurrentBuffer member. All of the references in the slots should have
- // been released.
- EXPECT_EQ(2, buffers[1]->getStrongCount());
+ // The GLConsumer should hold one reference to buffer 1 in its
+ // mCurrentTextureImage member and another reference in mEglSlots. The third
+ // reference is in this test.
+ EXPECT_EQ(3, buffers[1]->getStrongCount());
}
TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceAfterAbandonUnrefsBuffers) {
@@ -235,14 +235,19 @@ TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceAfterAbandonUnrefsBuffers) {
ASSERT_EQ(EGL_SUCCESS, eglGetError());
mProducerEglSurface = EGL_NO_SURFACE;
- EXPECT_EQ(1, buffers[0]->getStrongCount());
EXPECT_EQ(1, buffers[1]->getStrongCount());
// Depending on how lazily the GL driver dequeues buffers, we may end up
- // with either two or three total buffers. If there are three, make sure
- // the last one was properly down-ref'd.
+ // with either two or three total buffers. If there are three, each entry
+ // of the buffers array will be unique and there should only be one
+ // reference (the one in this test). If there are two the first and last
+ // element in the array will be equal meaning that buffer representing both
+ // 0 and 2 will have two references (one for 0 and one for 2).
if (buffers[2] != buffers[0]) {
+ EXPECT_EQ(1, buffers[0]->getStrongCount());
EXPECT_EQ(1, buffers[2]->getStrongCount());
+ } else {
+ EXPECT_EQ(2, buffers[0]->getStrongCount());
}
}