xpcom/tests/unit/test_bug476919.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 const Cc = Components.classes;
michael@0 2 const Ci = Components.interfaces;
michael@0 3
michael@0 4 function run_test() {
michael@0 5 // skip this test on Windows
michael@0 6 var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
michael@0 7 if (!isWindows) {
michael@0 8 var testDir = __LOCATION__.parent;
michael@0 9 // create a test file, then symlink it, then check that we think it's a symlink
michael@0 10 var targetFile = testDir.clone();
michael@0 11 targetFile.append("target.txt");
michael@0 12 if (!targetFile.exists())
michael@0 13 targetFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0644);
michael@0 14
michael@0 15 var link = testDir.clone();
michael@0 16 link.append("link");
michael@0 17 if (link.exists())
michael@0 18 link.remove(false);
michael@0 19
michael@0 20 var ln = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
michael@0 21 ln.initWithPath("/bin/ln");
michael@0 22 var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
michael@0 23 process.init(ln);
michael@0 24 var args = ["-s", targetFile.path, link.path];
michael@0 25 process.run(true, args, args.length);
michael@0 26 do_check_true(link.isSymlink());
michael@0 27 }
michael@0 28 }

mercurial