@@ -75,7 +75,7 @@ TEST_F(SurfaceTest, QueuesToWindowComposerIsTrueWhenPurgatorized) {
7575}
7676
7777// This test probably doesn't belong here.
78- TEST_F (SurfaceTest, ScreenshotsOfProtectedBuffersFail ) {
78+ TEST_F (SurfaceTest, ScreenshotsOfProtectedBuffersSucceed ) {
7979 sp<ANativeWindow> anw (mSurface );
8080
8181 // Verify the screenshot works with no protected buffers.
@@ -114,31 +114,8 @@ TEST_F(SurfaceTest, ScreenshotsOfProtectedBuffersFail) {
114114 }
115115 heap = 0 ;
116116 w = h = fmt = 0 ;
117- ASSERT_EQ (INVALID_OPERATION , sf->captureScreen (0 , &heap, &w, &h, &fmt,
117+ ASSERT_EQ (NO_ERROR , sf->captureScreen (0 , &heap, &w, &h, &fmt,
118118 64 , 64 , 0 , 0x7fffffff ));
119- ASSERT_TRUE (heap == NULL );
120-
121- // XXX: This should not be needed, but it seems that the new buffers don't
122- // correctly show up after the upcoming dequeue/lock/queue loop without it.
123- // We should look into this at some point.
124- ASSERT_EQ (NO_ERROR, native_window_set_buffer_count (anw.get (), 3 ));
125-
126- // Un-set the PROTECTED usage bit and verify that the screenshot works
127- // again. Note that we have to change the buffers geometry to ensure that
128- // the buffers get reallocated, as the new usage bits are a subset of the
129- // old.
130- ASSERT_EQ (NO_ERROR, native_window_set_usage (anw.get (), 0 ));
131- ASSERT_EQ (NO_ERROR, native_window_set_buffers_geometry (anw.get (), 32 , 32 , 0 ));
132- for (int i = 0 ; i < 4 ; i++) {
133- // Loop to make sure SurfaceFlinger has retired a protected buffer.
134- ASSERT_EQ (NO_ERROR, anw->dequeueBuffer (anw.get (), &buf));
135- ASSERT_EQ (NO_ERROR, anw->lockBuffer (anw.get (), buf));
136- ASSERT_EQ (NO_ERROR, anw->queueBuffer (anw.get (), buf));
137- }
138- heap = 0 ;
139- w = h = fmt = 0 ;
140- ASSERT_EQ (NO_ERROR, sf->captureScreen (0 , &heap, &w, &h, &fmt, 64 , 64 , 0 ,
141- 0x7fffffff ));
142119 ASSERT_TRUE (heap != NULL );
143120}
144121
0 commit comments