Bug 1317083 - Try to wait for IPDL connection before texture client creation, r=nical
authorpeter chang <pchang@mozilla.com>
Tue, 15 Nov 2016 17:50:50 +0800
changeset 324034 5ac0fb38b65024441bcc38bf899ea686c283e798
parent 324033 1ba616d48ed7da7ae9140050e332be22fa74d81a
child 324035 f7286c44643a0588933e818b37a7021c8c4a7f84
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +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.