Bug 1317083 - Try to wait for IPDL connection before texture client creation, r?nical
MozReview-Commit-ID: JLpubGsE0eu
--- 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.