Bug 544356 followup: Use getDMUI(). r=Neil
authorFelipe Gomes <felipc@gmail.com>
Mon, 21 Jun 2010 15:39:00 -0400
changeset 44127 ce18b4287791cf2d4e5ef997f7a59b61cb1f6377
parent 44126 c1ac92989e91de89ab12b9e0df82170cd10841a9
child 44128 4524f7cbf18c8fe2e5ea61672d05b6ee96d39eb3
push id13979
push userCallek@gmail.com
push dateTue, 22 Jun 2010 07:11:52 +0000
treeherdermozilla-central@ce18b4287791 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs544356
milestone1.9.3a6pre
first release with
nightly linux32
ce18b4287791 / 3.7a6pre / 20100622030727 / files
nightly linux64
ce18b4287791 / 3.7a6pre / 20100622030948 / files
nightly mac
ce18b4287791 / 3.7a6pre / 20100622030847 / files
nightly win32
ce18b4287791 / 3.7a6pre / 20100622040308 / files
nightly win64
ce18b4287791 / 3.7a6pre / 20100622050041 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 544356 followup: Use getDMUI(). r=Neil "Bug 544356 - Exit when only the download manager window is open and there are no downloads."
toolkit/mozapps/downloads/tests/chrome/test_close_on_last_window.xul
--- a/toolkit/mozapps/downloads/tests/chrome/test_close_on_last_window.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_close_on_last_window.xul
@@ -28,22 +28,23 @@
 const DLMGR_UI_DONE = "download-manager-ui-done";
 
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 let gGen, dm, dmui, chromeWindow, testCleanup;
 
 function test()
 {
-  testSetup();
-  SimpleTest.waitForExplicitFinish();
+  if (testSetup()) {
+    SimpleTest.waitForExplicitFinish();
 
-  //Start test
-  gGen = doTest();
-  gGen.next();
+    //Start test
+    gGen = doTest();
+    gGen.next();
+  }
 }
 
 function doTest()
 {
   let browserWindow1 = openBrowserWindow(continueTest);
   yield;
   let browserWindow2 = openBrowserWindow(continueTest);
   yield;
@@ -123,18 +124,21 @@ function testSetup()
 
   // Change the window type so this one doesn't count as a browser window
   let oldWinType = chromeWindow.document.documentElement.getAttribute("windowtype");
   chromeWindow.document.documentElement.setAttribute("windowtype", "navigator:testrunner");
 
   dm = Cc["@mozilla.org/download-manager;1"].
        getService(Ci.nsIDownloadManager);
 
-  dmui = Cc["@mozilla.org/download-manager-ui;1"].
-         getService(Ci.nsIDownloadManagerUI);
+  dmui = getDMUI();
+  if (!dmui) {
+    todo(false, "skip test for toolkit download manager UI");
+    return false;
+  }
 
   downloadListener = {
 
     onDownloadStateChange: function(aState, aDownload)
     {
       if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_PAUSED) {
         continueTest();
       } else if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_DOWNLOADING) {
@@ -148,16 +152,18 @@ function testSetup()
   };
 
   dm.addListener(downloadListener);
 
   testCleanup = function() {
     dm.removeListener(downloadListener);
     chromeWindow.document.documentElement.setAttribute("windowtype", oldWinType);
   };
+
+  return true;
 }
 
 function openBrowserWindow(callback)
 {
   let browserWindow = openDialog(chromeWindow.location, "_blank",
                                  "chrome,all,dialog=no", "about:blank");
  
   let helperFunc = function() {