Bug 1167627 - Part 3: Use mozinfo in xpcom/. r=bsmedberg

This commit is contained in:
Hiroyuki Ikezoe 2015-10-11 21:48:00 +02:00
Родитель bf31e06927
Коммит 00b0491dd0
6 изменённых файлов: 7 добавлений и 29 удалений

Просмотреть файл

@ -1,11 +1,8 @@
var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
function get_test_program(prog)
{
var progPath = do_get_cwd();
progPath.append(prog);
if (isWindows)
progPath.leafName = progPath.leafName + ".exe";
progPath.leafName = progPath.leafName + mozinfo.bin_suffix;
return progPath;
}

Просмотреть файл

@ -3,8 +3,7 @@ var Ci = Components.interfaces;
function run_test() {
// skip this test on Windows
var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
if (!isWindows) {
if (mozinfo.os != "win") {
var testDir = __LOCATION__.parent;
// create a test file, then symlink it, then check that we think it's a symlink
var targetFile = testDir.clone();

Просмотреть файл

@ -9,8 +9,7 @@ function run_test() {
// copied from http://mxr.mozilla.org/mozilla-central/source/image/test/unit/test_imgtools.js#135
// nsIXULRuntime.OS doesn't seem to be available in xpcshell, so we'll use
// this as a kludgy way to figure out if we're running on Windows.
var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
if (isWindows) {
if (mozinfo.os == "win") {
root.initWithPath("\\\\.");
} else {
return; // XXX disabled, since this causes intermittent failures on Mac (bug 481369).

Просмотреть файл

@ -3,15 +3,6 @@ var Cc = Components.classes;
const NS_OS_TEMP_DIR = "TmpD";
const CWD = do_get_cwd();
function checkOS(os) {
const nsILocalFile_ = "nsILocalFile" + os;
return nsILocalFile_ in Components.interfaces &&
CWD instanceof Components.interfaces[nsILocalFile_];
}
const isWin = checkOS("Win");
const isMac = checkOS("Mac");
const isUnix = !(isWin || isMac);
var hiddenUnixFile;
function createUNIXHiddenFile() {
@ -28,7 +19,7 @@ function createUNIXHiddenFile() {
function run_test() {
// Skip this test on Windows
if (isWin)
if (mozinfo.os == "win")
return;
do_check_true(createUNIXHiddenFile());

Просмотреть файл

@ -1,8 +1,9 @@
function run_test() {
// this is a hack to skip the rest of the code on non-Mac platforms,
// since #ifdef is not available to xpcshell tests...
if (!("nsILocalFileMac" in Components.interfaces))
if (mozinfo.os != "mac") {
return;
}
// OK, here's the real part of the test:
// make sure these two test bundles are recognized as bundles (or "packages")

Просмотреть файл

@ -1,9 +1,4 @@
const CWD = do_get_cwd();
function checkOS(os) {
const nsILocalFile_ = "nsILocalFile" + os;
return nsILocalFile_ in Components.interfaces &&
CWD instanceof Components.interfaces[nsILocalFile_];
}
const DIR_TARGET = "target";
const DIR_LINK = "link";
@ -16,10 +11,6 @@ const DOES_NOT_EXIST = "doesnotexist";
const DANGLING_LINK = "dangling_link";
const LOOP_LINK = "loop_link";
const isWin = checkOS("Win");
const isMac = checkOS("Mac");
const isUnix = !(isWin || isMac);
const nsIFile = Components.interfaces.nsIFile;
var process;
@ -142,7 +133,7 @@ function testSymLinks(testDir, relative) {
function run_test() {
// Skip this test on Windows
if (isWin)
if (mozinfo.os == "win")
return;
var testDir = CWD;