Bug 1317083 - Try to wait for IPDL connection before texture client creation, r?nical draft
authorpeter chang <pchang@mozilla.com>
Tue, 15 Nov 2016 17:50:50 +0800
changeset 443233 3de516afbe8d22762d45b6bac6c48be27bab81f3
parent 439375 79feeed4293336089590320a9f30a813fade8e3c
child 537993 72639af7169841e3dfe304497bf6b3bd9ed02c30
push id36928
push userbmo:howareyou322@gmail.com
push dateThu, 24 Nov 2016 02:53:44 +0000
reviewersnical
bugs1317083
milestone53.0a1
Bug 1317083 - Try to wait for IPDL connection before texture client creation, r?nical MozReview-Commit-ID: JLpubGsE0eu
gfx/tests/gtest/TestTextures.cpp
--- a/gfx/tests/gtest/TestTextures.cpp
+++ b/gfx/tests/gtest/TestTextures.cpp
@@ -263,23 +263,34 @@ TEST(Layers, TextureYCbCrSerialization) 
   clientData.mYSkip = 0;
   clientData.mCbSkip = 0;
   clientData.mCrSkip = 0;
   clientData.mCrSkip = 0;
   clientData.mPicX = 0;
   clientData.mPicX = 0;
 
   ImageBridgeChild::InitSameProcess();
-  // wait until IPDL connection
+
+  RefPtr<ImageBridgeChild> imageBridge = ImageBridgeChild::GetSingleton();
+  static int retry = 5;
+  while(!imageBridge->IPCOpen() && retry) {
+    // IPDL connection takes time especially in slow testing environment, like
+    // VM machines. Here we added retry mechanism to wait for IPDL connnection.
 #ifdef XP_WIN
-  Sleep(1);
+    Sleep(1);
 #else
-  sleep(1);
+    sleep(1);
 #endif
-  RefPtr<ImageBridgeChild> imageBridge = ImageBridgeChild::GetSingleton();
+    retry--;
+  }
+
+  // Skip this testing if IPDL connection is not ready
+  if (!retry && !imageBridge->IPCOpen()) {
+    return;
+  }
 
   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.