Bug 1311644 - Pass ImageBridge as allocator to create YCbCr texture client, r?nical draft
authorpeter chang <pchang@mozilla.com>
Tue, 08 Nov 2016 15:22:36 +0800
changeset 435757 a65313cfe77c0e22a58b453411bb1158f0360057
parent 435239 00bf54b502f1016a6d68b2a7f14d051317124cd6
child 436965 10b77fdf8671951cc190700eaf013d9e379c815e
push id35117
push userbmo:howareyou322@gmail.com
push dateWed, 09 Nov 2016 05:41:55 +0000
reviewersnical
bugs1311644
milestone52.0a1
Bug 1311644 - Pass ImageBridge as allocator to create YCbCr texture client, r?nical MozReview-Commit-ID: 4P5LyWST0yv
gfx/tests/gtest/TestTextures.cpp
--- a/gfx/tests/gtest/TestTextures.cpp
+++ b/gfx/tests/gtest/TestTextures.cpp
@@ -3,19 +3,20 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 #include "gtest/gtest.h"
 #include "gmock/gmock.h"
 
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/Tools.h"
+#include "mozilla/layers/BufferTexture.h"
+#include "mozilla/layers/ImageBridgeChild.h"  // for ImageBridgeChild
 #include "mozilla/layers/TextureClient.h"
 #include "mozilla/layers/TextureHost.h"
-#include "mozilla/layers/BufferTexture.h"
 #include "mozilla/RefPtr.h"
 #include "gfx2DGlue.h"
 #include "gfxImageSurface.h"
 #include "gfxTypes.h"
 #include "ImageContainer.h"
 #include "mozilla/layers/ImageDataSerializer.h"
 
 using namespace mozilla;
@@ -261,16 +262,25 @@ TEST(Layers, TextureYCbCrSerialization) 
   clientData.mYUVColorSpace = YUVColorSpace::BT601;
   clientData.mYSkip = 0;
   clientData.mCbSkip = 0;
   clientData.mCrSkip = 0;
   clientData.mCrSkip = 0;
   clientData.mPicX = 0;
   clientData.mPicX = 0;
 
-  RefPtr<TextureClient> client = TextureClient::CreateForYCbCr(nullptr, clientData.mYSize, clientData.mCbCrSize,
+  ImageBridgeChild::InitSameProcess();
+  // wait until IPDL connection
+#ifdef XP_WIN
+  Sleep(1);
+#else
+  sleep(1);
+#endif
+  RefPtr<ImageBridgeChild> imageBridge = ImageBridgeChild::GetSingleton();
+
+  RefPtr<TextureClient> client = TextureClient::CreateForYCbCr(imageBridge, clientData.mYSize, clientData.mCbCrSize,
                                                                StereoMode::MONO, YUVColorSpace::BT601,
                                                                TextureFlags::DEALLOCATE_CLIENT);
 
   TestTextureClientYCbCr(client, clientData);
 
   // XXX - Test more texture client types.
 }