Bug 1027497 - Move Gtest startup after Qt/Gtk initialization. r=BenWa
☠☠ backed out by a6d4659e1031 ☠ ☠
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 25 Jun 2014 08:36:12 +0900
changeset 190594 d4b46f6800f8f8cd59fd7c8dff4179e0bf7524ec
parent 190593 fa2c5fa0167e534937bd6ef1019853c6497b11cc
child 190595 49cadfcde709e64b3f31476fb1370ee8d8ca1403
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersBenWa
bugs1027497
milestone33.0a1
Bug 1027497 - Move Gtest startup after Qt/Gtk initialization. r=BenWa
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -3210,29 +3210,16 @@ XREMain::XRE_mainInit(bool* aExitFlag)
       NS_ENSURE_TRUE(chromeReg, 1);
 
       chromeReg->CheckForNewChrome();
     }
     *aExitFlag = true;
     return 0;
   }
 
-  if (PR_GetEnv("MOZ_RUN_GTEST")) {
-    int result;
-    // RunGTest will only be set if we're in xul-unit
-    if (mozilla::RunGTest) {
-      result = mozilla::RunGTest();
-    } else {
-      result = 1;
-      printf("TEST-UNEXPECTED-FAIL | gtest | Not compiled with enable-tests\n");
-    }
-    *aExitFlag = true;
-    return result;
-  }
-
   return 0;
 }
 
 #ifdef MOZ_CRASHREPORTER
 #ifdef XP_WIN
 /**
  * Uses WMI to read some manufacturer information that may be useful for
  * diagnosing hardware-specific crashes. This function is best-effort; failures
@@ -3427,29 +3414,44 @@ XREMain::XRE_mainStartup(bool* aExitFlag
 
   // Initialize GTK here for splash.
 
   // Open the display ourselves instead of using gtk_init, so that we can
   // close it without fear that one day gtk might clean up the display it
   // opens.
   if (!gtk_parse_args(&gArgc, &gArgv))
     return 1;
-
+#endif /* MOZ_WIDGET_GTK */
+
+  if (PR_GetEnv("MOZ_RUN_GTEST")) {
+    int result;
+    // RunGTest will only be set if we're in xul-unit
+    if (mozilla::RunGTest) {
+      result = mozilla::RunGTest();
+    } else {
+      result = 1;
+      printf("TEST-UNEXPECTED-FAIL | gtest | Not compiled with enable-tests\n");
+    }
+    *aExitFlag = true;
+    return result;
+  }
+
+#if defined(MOZ_WIDGET_GTK)
   // display_name is owned by gdk.
   const char *display_name = gdk_get_display_arg_name();
   if (display_name) {
     SaveWordToEnv("DISPLAY", nsDependentCString(display_name));
   } else {
     display_name = PR_GetEnv("DISPLAY");
     if (!display_name) {
       PR_fprintf(PR_STDERR, "Error: no display specified\n");
       return 1;
     }
   }
-#endif /* MOZ_WIDGET_GTK2 */
+#endif /* MOZ_WIDGET_GTK */
 
 #ifdef MOZ_ENABLE_XREMOTE
   // handle -remote now that xpcom is fired up
   bool newInstance;
   {
     char *e = PR_GetEnv("MOZ_NO_REMOTE");
     mDisableRemote = (e && *e);
     if (mDisableRemote) {