1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug541420.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,37 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + */ 1.8 + 1.9 +function run_test() { 1.10 + do_test_pending(); 1.11 + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1"); 1.12 + 1.13 + startupManager(); 1.14 + 1.15 + installAllFiles([do_get_file("data/test_bug541420.xpi")], function() { 1.16 + 1.17 + restartManager(); 1.18 + 1.19 + AddonManager.getAddonByID("bug541420@tests.mozilla.org", function(addon) { 1.20 + 1.21 + do_check_neq(addon, null); 1.22 + do_check_true(addon.hasResource("binary")); 1.23 + let uri = addon.getResourceURI("binary"); 1.24 + do_check_true(uri instanceof AM_Ci.nsIFileURL); 1.25 + let file = uri.file; 1.26 + do_check_true(file.exists()); 1.27 + do_check_true(file.isReadable()); 1.28 + do_check_true(file.isWritable()); 1.29 + 1.30 + // We don't understand executable permissions on Windows since we don't 1.31 + // support NTFS permissions so we don't need to test there. OSX's isExecutable 1.32 + // only tests if the file is an application so it is better to just check the 1.33 + // raw permission bits 1.34 + if (!("nsIWindowsRegKey" in Components.interfaces)) 1.35 + do_check_true((file.permissions & 0100) == 0100); 1.36 + 1.37 + do_execute_soon(do_test_finished); 1.38 + }); 1.39 + }); 1.40 +}