Bug 969388 - Fix locking in textures gtest. r=kats

This commit is contained in:
Nicolas Silva 2014-02-19 17:34:49 +01:00
parent 2506904086
commit ac651bcf27

View File

@ -108,13 +108,13 @@ void TestTextureClientSurface(TextureClient* texture, gfxImageSurface* surface)
client->AllocateForSurface(ToIntSize(surface->GetSize()));
ASSERT_TRUE(texture->IsAllocated());
ASSERT_TRUE(texture->Lock(OPEN_READ_WRITE));
// client painting
client->UpdateSurface(surface);
nsRefPtr<gfxASurface> aSurface = client->GetAsSurface();
nsRefPtr<gfxImageSurface> clientSurface = aSurface->GetAsImageSurface();
ASSERT_TRUE(texture->Lock(OPEN_READ_ONLY));
AssertSurfacesEqual(surface, clientSurface);
texture->Unlock();
@ -155,10 +155,9 @@ void TestTextureClientYCbCr(TextureClient* client, PlanarYCbCrData& ycbcrData) {
ycbcrData.mStereoMode);
ASSERT_TRUE(client->IsAllocated());
ASSERT_TRUE(client->Lock(OPEN_READ_WRITE));
// client painting
texture->UpdateYCbCr(ycbcrData);
ASSERT_TRUE(client->Lock(OPEN_READ_ONLY));
client->Unlock();
// client serialization
@ -176,13 +175,11 @@ void TestTextureClientYCbCr(TextureClient* client, PlanarYCbCrData& ycbcrData) {
ASSERT_TRUE(host.get() != nullptr);
ASSERT_EQ(host->GetFlags(), client->GetFlags());
// This will work iff the compositor is not BasicCompositor
ASSERT_EQ(host->GetFormat(), mozilla::gfx::SurfaceFormat::YUV);
// host read
ASSERT_TRUE(host->Lock());
ASSERT_TRUE(host->GetFormat() == mozilla::gfx::SurfaceFormat::YUV);
// This will work iff the compositor is not BasicCompositor
ASSERT_EQ(host->GetFormat(), mozilla::gfx::SurfaceFormat::YUV);
YCbCrImageDataDeserializer yuvDeserializer(host->GetBuffer());
ASSERT_TRUE(yuvDeserializer.IsValid());