From 4d8e7c0a3197b0fce38cd93d3b0fb8d212fb9a99 Mon Sep 17 00:00:00 2001 From: Paolo Amadini Date: Mon, 19 Aug 2013 17:23:59 +0200 Subject: [PATCH] Bug 847863 - Part 3 of 8 - Selectively disable old Download Manager UI tests. r=enn --- .../tests/chrome/test_destinationURI_annotation.xul | 7 +++++++ .../chrome/test_unknownContentType_dialog_layout.xul | 7 +++++++ toolkit/mozapps/downloads/tests/chrome/utils.js | 8 +++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul b/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul index 2ea90ed9f4c1..45eab5a88a39 100644 --- a/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul +++ b/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul @@ -115,6 +115,13 @@ let downloadListener = { }; function init() { + var dmui = getDMUI(); + if (!dmui) { + todo(false, "skip test for toolkit download manager UI"); + SimpleTest.finish(); + return; + } + // Ensure that the download manager callbacks always use the window UI instead // of the panel in the browser's window. Services.prefs.setBoolPref("browser.download.useToolkitUI", true); diff --git a/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul b/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul index 59181b734cb2..421c39580af9 100644 --- a/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul +++ b/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul @@ -68,6 +68,13 @@ let windowObserver = { }; function init() { + var dmui = getDMUI(); + if (!dmui) { + todo(false, "skip test for toolkit download manager UI"); + SimpleTest.finish(); + return; + } + ww.registerNotification(windowObserver); loadNextTest(); } diff --git a/toolkit/mozapps/downloads/tests/chrome/utils.js b/toolkit/mozapps/downloads/tests/chrome/utils.js index b24484878ef7..f56949e26b90 100644 --- a/toolkit/mozapps/downloads/tests/chrome/utils.js +++ b/toolkit/mozapps/downloads/tests/chrome/utils.js @@ -10,6 +10,8 @@ const Cc = Components.classes; const Ci = Components.interfaces; const Cr = Components.results; +Components.utils.import("resource://gre/modules/Services.jsm"); + /** * Returns the toolkit implementation of the download manager UI service. * If the toolkit implementation of the service can't be found (e.g. because @@ -20,6 +22,11 @@ const Cr = Components.results; */ function getDMUI() { + try { + if (Services.prefs.getBoolPref("browser.download.useJSTransfer")) { + return false; + } + } catch (ex) { } if (Components.classesByID["{7dfdf0d1-aff6-4a34-bad1-d0fe74601642}"]) return Components.classesByID["{7dfdf0d1-aff6-4a34-bad1-d0fe74601642}"]. getService(Ci.nsIDownloadManagerUI); @@ -144,7 +151,6 @@ function setCleanState() */ function waitForClearHistory(aCallback) { Components.utils.import("resource://gre/modules/PlacesUtils.jsm"); - Components.utils.import("resource://gre/modules/Services.jsm"); Services.obs.addObserver(function observeClearHistory(aSubject, aTopic) { Services.obs.removeObserver(observeClearHistory, aTopic); aCallback();