fix build. update test to new API
Change-Id: I31ca84c85edff3e2ff90c554769e058110f27d49
This commit is contained in:
parent
ff7c2342e2
commit
7c1a487ba8
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user