Enable bug 442629 test. r=bzbarsky
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 17 Jul 2008 09:26:02 -0400
changeset 16007 8c55641fe8ff5b32d41345e94c606901154b85a6
parent 16006 1d63270c1b21bd4845921e47b0db0c50e022d731
child 16008 97d87f0f8ee895c5b96f074fc9640f1ee89fe15d
push idunknown
push userunknown
push dateunknown
reviewersbzbarsky
bugs442629
milestone1.9.1a1pre
Enable bug 442629 test. r=bzbarsky
uriloader/exthandler/tests/Makefile.in
uriloader/exthandler/tests/unit/test_handlerService.js
--- a/uriloader/exthandler/tests/Makefile.in
+++ b/uriloader/exthandler/tests/Makefile.in
@@ -63,9 +63,11 @@ DEFINES +=	\
 		$(NULL)
 
 LIBS +=		\
 		$(NSPR_LIBS) \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
+ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 export PERSONAL_MAILCAP=$(shell cd $(srcdir) && pwd)/mailcap
+endif
--- a/uriloader/exthandler/tests/unit/test_handlerService.js
+++ b/uriloader/exthandler/tests/unit/test_handlerService.js
@@ -49,16 +49,19 @@ function run_test() {
                    getService(Ci.nsIExternalProtocolService);
   
   const prefSvc = Cc["@mozilla.org/preferences-service;1"].
                   getService(Ci.nsIPrefService);
                   
   const ioService = Cc["@mozilla.org/network/io-service;1"].
                     getService(Ci.nsIIOService);
 
+  const env = Cc["@mozilla.org/process/environment;1"].
+              getService(Components.interfaces.nsIEnvironment);
+
   const rootPrefBranch = prefSvc.getBranch("");
   
   //**************************************************************************//
   // Sample Data
 
   // It doesn't matter whether or not this nsIFile is actually executable,
   // only that it has a path and exists.  Since we don't know any executable
   // that exists on all platforms (except possibly the application being
@@ -379,14 +382,14 @@ function run_test() {
   var DS = gRDF.GetDataSourceBlocking(rdfFileURI);
   DS.Assert(mimeSource, valueProperty, mimeLiteral, true);
 
 
   // test now-existent extension
   lolType = handlerSvc.getTypeFromExtension("lolcat");
   do_check_eq(lolType, "application/lolcat");
 
-  // Commented out for now until it can be made unix-only (bug 442629)
-  //var handlerInfo = mimeSvc.getFromTypeAndExtension("text/plain", null);
-  //do_check_eq(handlerInfo.preferredAction, Ci.nsIHandlerInfo.useSystemDefault);
-  //do_check_eq(handlerInfo.defaultDescription, "sed");
-
+  if (env.get("PERSONAL_MAILCAP")) {
+    handlerInfo = mimeSvc.getFromTypeAndExtension("text/plain", null);
+    do_check_eq(handlerInfo.preferredAction, Ci.nsIHandlerInfo.useSystemDefault);
+    do_check_eq(handlerInfo.defaultDescription, "sed");
+  }
 }