am 7c1a487b: fix build. update test to new API

* commit '7c1a487ba8c0a3b591a77e2ddcb33ef9bdfaff64':
  fix build. update test to new API
This commit is contained in:
Mathias Agopian 2013-03-20 22:58:52 +00:00 committed by Android Git Automerger
commit 890b345f06

View File

@ -23,11 +23,17 @@
#include <utils/String8.h> #include <utils/String8.h>
#include <private/gui/ComposerService.h> #include <private/gui/ComposerService.h>
#include <binder/ProcessState.h>
namespace android { namespace android {
class SurfaceTest : public ::testing::Test { class SurfaceTest : public ::testing::Test {
protected: protected:
SurfaceTest() {
ProcessState::self()->startThreadPool();
}
virtual void SetUp() { virtual void SetUp() {
mComposerClient = new SurfaceComposerClient; mComposerClient = new SurfaceComposerClient;
ASSERT_EQ(NO_ERROR, mComposerClient->initCheck()); ASSERT_EQ(NO_ERROR, mComposerClient->initCheck());
@ -81,14 +87,11 @@ TEST_F(SurfaceTest, ScreenshotsOfProtectedBuffersSucceed) {
sp<ANativeWindow> anw(mSurface); sp<ANativeWindow> anw(mSurface);
// Verify the screenshot works with no protected buffers. // Verify the screenshot works with no protected buffers.
sp<IMemoryHeap> heap; sp<CpuConsumer> consumer = new CpuConsumer(1);
uint32_t w=0, h=0;
PixelFormat fmt=0;
sp<ISurfaceComposer> sf(ComposerService::getComposerService()); sp<ISurfaceComposer> sf(ComposerService::getComposerService());
sp<IBinder> display(sf->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain)); sp<IBinder> display(sf->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain));
ASSERT_EQ(NO_ERROR, sf->captureScreen(display, &heap, &w, &h, &fmt, 64, 64, 0, ASSERT_EQ(NO_ERROR, sf->captureScreen(display, consumer->getBufferQueue(),
0x7fffffff)); 64, 64, 0, 0x7fffffff, true));
ASSERT_TRUE(heap != NULL);
// Set the PROTECTED usage bit and verify that the screenshot fails. Note // Set the PROTECTED usage bit and verify that the screenshot fails. Note
// that we need to dequeue a buffer in order for it to actually get // that we need to dequeue a buffer in order for it to actually get
@ -116,11 +119,8 @@ TEST_F(SurfaceTest, ScreenshotsOfProtectedBuffersSucceed) {
&buf)); &buf));
ASSERT_EQ(NO_ERROR, anw->queueBuffer(anw.get(), buf, -1)); ASSERT_EQ(NO_ERROR, anw->queueBuffer(anw.get(), buf, -1));
} }
heap = 0; ASSERT_EQ(NO_ERROR, sf->captureScreen(display, consumer->getBufferQueue(),
w = h = fmt = 0; 64, 64, 0, 0x7fffffff, true));
ASSERT_EQ(NO_ERROR, sf->captureScreen(display, &heap, &w, &h, &fmt,
64, 64, 0, 0x7fffffff));
ASSERT_TRUE(heap != NULL);
} }
TEST_F(SurfaceTest, ConcreteTypeIsSurface) { TEST_F(SurfaceTest, ConcreteTypeIsSurface) {