1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/tests/unit/test_bug478086.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,25 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/licenses/publicdomain/ */ 1.6 + 1.7 +function run_test() { 1.8 + var nsILocalFile = Components.interfaces.nsILocalFile; 1.9 + var root = Components.classes["@mozilla.org/file/local;1"]. 1.10 + createInstance(nsILocalFile); 1.11 + 1.12 + // copied from http://mxr.mozilla.org/mozilla-central/source/image/test/unit/test_imgtools.js#135 1.13 + // nsIXULRuntime.OS doesn't seem to be available in xpcshell, so we'll use 1.14 + // this as a kludgy way to figure out if we're running on Windows. 1.15 + var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes); 1.16 + if (isWindows) { 1.17 + root.initWithPath("\\\\."); 1.18 + } else { 1.19 + return; // XXX disabled, since this causes intermittent failures on Mac (bug 481369). 1.20 + root.initWithPath("/"); 1.21 + } 1.22 + var drives = root.directoryEntries; 1.23 + do_check_true(drives.hasMoreElements()); 1.24 + while (drives.hasMoreElements()) { 1.25 + var newPath = drives.getNext().QueryInterface(nsILocalFile).path; 1.26 + do_check_eq(newPath.indexOf("\0"), -1); 1.27 + } 1.28 +}