1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/test/unit/test_gre_resources.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,27 @@ 1.4 +// test that things that are expected to be in gre-resources are still there 1.5 + 1.6 +var ios = Cc["@mozilla.org/network/io-service;1"]. getService(Ci.nsIIOService); 1.7 + 1.8 +function wrapInputStream(input) 1.9 +{ 1.10 + var nsIScriptableInputStream = Components.interfaces.nsIScriptableInputStream; 1.11 + var factory = Components.classes["@mozilla.org/scriptableinputstream;1"]; 1.12 + var wrapper = factory.createInstance(nsIScriptableInputStream); 1.13 + wrapper.init(input); 1.14 + return wrapper; 1.15 +} 1.16 + 1.17 +function check_file(file) { 1.18 + var channel = ios.newChannel("resource://gre-resources/"+file, null, null); 1.19 + try { 1.20 + let instr = wrapInputStream(channel.open()); 1.21 + do_check_true(instr.read(1024).length > 0) 1.22 + } catch (e) { 1.23 + do_throw("Failed to read " + file + " from gre-resources:"+e) 1.24 + } 1.25 +} 1.26 + 1.27 +function run_test() { 1.28 + for each(let file in ["charsetData.properties"]) 1.29 + check_file(file) 1.30 +}